From 3cdec5c7ffde324a314e697feb3cf6291c346ce9 Mon Sep 17 00:00:00 2001 From: heheer <1239331448@qq.com> Date: Mon, 9 Oct 2023 16:28:00 +0800 Subject: [PATCH] refactor(web): add ctx data definition --- web/src/components/Editor/typesResolve/globals.ts | 2 ++ web/src/constants/index.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/components/Editor/typesResolve/globals.ts b/web/src/components/Editor/typesResolve/globals.ts index 4f9086c5cf..1abc49ea8b 100644 --- a/web/src/components/Editor/typesResolve/globals.ts +++ b/web/src/components/Editor/typesResolve/globals.ts @@ -31,6 +31,8 @@ interface File { * The input parameters of cloud function calls */ interface FunctionContext { + __function_name: string; + /** * This object is parsed from JWT Token Payload * @deprecated use user instead diff --git a/web/src/constants/index.ts b/web/src/constants/index.ts index 4361f6de92..9aa30b3fbc 100644 --- a/web/src/constants/index.ts +++ b/web/src/constants/index.ts @@ -81,7 +81,7 @@ export const COLOR_MODE = { dark: "dark", }; -export const DEFAULT_CODE = `import cloud, { FunctionContext } from '@lafjs/cloud' +export const DEFAULT_CODE = `import cloud from '@lafjs/cloud' export default async function (ctx: FunctionContext) { console.log('Hello World')