@dxos/plugin-script 0.6.12-staging.e11e696 → 0.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{ScriptContainer-AGDWRBHJ.mjs → ScriptEditor-5Y3EROG3.mjs} +106 -258
- package/dist/lib/browser/ScriptEditor-5Y3EROG3.mjs.map +7 -0
- package/dist/lib/browser/TypescriptEditor-GPE72Y6I.mjs +9 -0
- package/dist/lib/browser/{chunk-G6FWCTGT.mjs → chunk-DL5XQRQM.mjs} +5 -7
- package/dist/lib/browser/chunk-DL5XQRQM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-MDX7ACIK.mjs → chunk-JBACGDOJ.mjs} +6 -3
- package/dist/lib/browser/chunk-JBACGDOJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-MRGOT5RF.mjs +78 -0
- package/dist/lib/browser/chunk-MRGOT5RF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CAEANETO.mjs → chunk-O4LWBX6A.mjs} +2 -2
- package/dist/lib/browser/{chunk-CAEANETO.mjs.map → chunk-O4LWBX6A.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-G6H56WFS.mjs → chunk-RHEZ5LUU.mjs} +2 -51
- package/dist/lib/browser/{chunk-G6H56WFS.mjs.map → chunk-RHEZ5LUU.mjs.map} +4 -4
- package/dist/lib/browser/edge/index.mjs +1 -3
- package/dist/lib/browser/index.mjs +62 -80
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node/ScriptEditor-YCUQFWQM.cjs +526 -0
- package/dist/lib/node/ScriptEditor-YCUQFWQM.cjs.map +7 -0
- package/dist/lib/node/{chunk-OJ77BZRH.cjs → TypescriptEditor-M3WWFIP2.cjs} +8 -19
- package/dist/lib/node/TypescriptEditor-M3WWFIP2.cjs.map +7 -0
- package/dist/lib/node/{chunk-ACLCRWDB.cjs → chunk-4GTXIELQ.cjs} +6 -44
- package/dist/lib/node/chunk-4GTXIELQ.cjs.map +7 -0
- package/dist/lib/node/chunk-4VMNBXWU.cjs +54 -0
- package/dist/lib/node/chunk-4VMNBXWU.cjs.map +7 -0
- package/dist/lib/node/{chunk-2PZKJXNP.cjs → chunk-5RBVXKXT.cjs} +6 -6
- package/dist/lib/node/{chunk-2PZKJXNP.cjs.map → chunk-5RBVXKXT.cjs.map} +2 -2
- package/dist/lib/node/chunk-IMLDKD5Y.cjs +111 -0
- package/dist/lib/node/chunk-IMLDKD5Y.cjs.map +7 -0
- package/dist/lib/node/{chunk-UZ3ZXEBF.cjs → chunk-PFH3ROEH.cjs} +8 -11
- package/dist/lib/node/chunk-PFH3ROEH.cjs.map +7 -0
- package/dist/lib/node/edge/index.cjs +8 -10
- package/dist/lib/node/edge/index.cjs.map +2 -2
- package/dist/lib/node/index.cjs +82 -95
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +5 -5
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/types/src/ScriptPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DebugPanel.d.ts.map +1 -0
- package/dist/types/src/components/{FrameContainer → ScriptBlock/FrameContainer}/FrameContainer.d.ts +1 -1
- package/dist/types/src/components/ScriptBlock/FrameContainer/FrameContainer.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/FrameContainer/frame.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/FrameContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts +3 -1
- package/dist/types/src/components/ScriptBlock/ScriptBlock.d.ts.map +1 -1
- package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts +1 -1
- package/dist/types/src/components/ScriptBlock/ScriptBlock.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScriptBlock/Splitter/Splitter.d.ts +15 -0
- package/dist/types/src/components/ScriptBlock/Splitter/Splitter.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/Splitter/Splitter.stories.d.ts +13 -0
- package/dist/types/src/components/ScriptBlock/Splitter/Splitter.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScriptBlock/Splitter/index.d.ts +2 -0
- package/dist/types/src/components/ScriptBlock/Splitter/index.d.ts.map +1 -0
- package/dist/types/src/components/ScriptEditor.d.ts +5 -4
- package/dist/types/src/components/ScriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar.d.ts +13 -0
- package/dist/types/src/components/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar.stories.d.ts +14 -0
- package/dist/types/src/components/Toolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/{TypescriptEditor/TypescriptEditor.d.ts → TypescriptEditor.d.ts} +2 -1
- package/dist/types/src/components/TypescriptEditor.d.ts.map +1 -0
- package/dist/types/src/components/TypescriptEditor.stories.d.ts +10 -0
- package/dist/types/src/components/TypescriptEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/edge/functions.d.ts +0 -1
- package/dist/types/src/edge/functions.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +4 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +0 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/script.d.ts +4 -4
- package/dist/types/src/types/types.d.ts +3 -4
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/package.json +55 -61
- package/src/ScriptPlugin.tsx +38 -22
- package/src/bundler/bundler.test.ts +2 -12
- package/src/components/{DebugPanel/DebugPanel.tsx → DebugPanel.tsx} +41 -48
- package/src/components/{FrameContainer → ScriptBlock/FrameContainer}/FrameContainer.tsx +1 -1
- package/src/components/ScriptBlock/ScriptBlock.stories.tsx +3 -4
- package/src/components/ScriptBlock/ScriptBlock.tsx +36 -10
- package/src/components/ScriptBlock/Splitter/Splitter.stories.tsx +37 -0
- package/src/components/ScriptBlock/Splitter/Splitter.tsx +52 -0
- package/src/components/{Toolbar → ScriptBlock/Splitter}/index.ts +1 -1
- package/src/components/ScriptEditor.tsx +46 -47
- package/src/components/{Toolbar/Toolbar.stories.tsx → Toolbar.stories.tsx} +1 -10
- package/src/components/Toolbar.tsx +147 -0
- package/src/components/{TypescriptEditor/TypescriptEditor.stories.tsx → TypescriptEditor.stories.tsx} +28 -7
- package/src/components/{TypescriptEditor/TypescriptEditor.tsx → TypescriptEditor.tsx} +3 -1
- package/src/components/index.ts +2 -3
- package/src/edge/functions.ts +0 -1
- package/src/meta.tsx +6 -2
- package/src/translations.ts +0 -2
- package/src/types/types.ts +5 -9
- package/dist/lib/browser/ScriptContainer-AGDWRBHJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-G6FWCTGT.mjs.map +0 -7
- package/dist/lib/browser/chunk-MDX7ACIK.mjs.map +0 -7
- package/dist/lib/node/ScriptContainer-5R3NWYKS.cjs +0 -668
- package/dist/lib/node/ScriptContainer-5R3NWYKS.cjs.map +0 -7
- package/dist/lib/node/chunk-ACLCRWDB.cjs.map +0 -7
- package/dist/lib/node/chunk-OJ77BZRH.cjs.map +0 -7
- package/dist/lib/node/chunk-UZ3ZXEBF.cjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-ZY2XG3GH.mjs +0 -666
- package/dist/lib/node-esm/ScriptContainer-ZY2XG3GH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2NX3HWPM.mjs +0 -245
- package/dist/lib/node-esm/chunk-2NX3HWPM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7BZDZF7Z.mjs +0 -47
- package/dist/lib/node-esm/chunk-7BZDZF7Z.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LDLNTVAK.mjs +0 -280
- package/dist/lib/node-esm/chunk-LDLNTVAK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TZ3Z4SII.mjs +0 -20
- package/dist/lib/node-esm/chunk-TZ3Z4SII.mjs.map +0 -7
- package/dist/lib/node-esm/edge/index.mjs +0 -22
- package/dist/lib/node-esm/index.mjs +0 -310
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -13
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- package/dist/types/src/components/DebugPanel/DebugPanel.d.ts.map +0 -1
- package/dist/types/src/components/DebugPanel/index.d.ts +0 -2
- package/dist/types/src/components/DebugPanel/index.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/frame.d.ts.map +0 -1
- package/dist/types/src/components/FrameContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/ScriptContainer.d.ts +0 -5
- package/dist/types/src/components/ScriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/ScriptSettings/ScriptSettings.d.ts +0 -6
- package/dist/types/src/components/ScriptSettings/ScriptSettings.d.ts.map +0 -1
- package/dist/types/src/components/ScriptSettings/index.d.ts +0 -2
- package/dist/types/src/components/ScriptSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -23
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +0 -17
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +0 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +0 -10
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/TypescriptEditor/index.d.ts +0 -2
- package/dist/types/src/components/TypescriptEditor/index.d.ts.map +0 -1
- package/dist/types/src/templates/chat.d.ts +0 -6
- package/dist/types/src/templates/chat.d.ts.map +0 -1
- package/dist/types/src/templates/chess.d.ts +0 -6
- package/dist/types/src/templates/chess.d.ts.map +0 -1
- package/dist/types/src/templates/echo.d.ts +0 -6
- package/dist/types/src/templates/echo.d.ts.map +0 -1
- package/dist/types/src/templates/email.d.ts +0 -6
- package/dist/types/src/templates/email.d.ts.map +0 -1
- package/dist/types/src/templates/forex.d.ts +0 -6
- package/dist/types/src/templates/forex.d.ts.map +0 -1
- package/dist/types/src/templates.d.ts +0 -8
- package/dist/types/src/templates.d.ts.map +0 -1
- package/src/components/DebugPanel/index.ts +0 -5
- package/src/components/ScriptContainer.tsx +0 -22
- package/src/components/ScriptSettings/ScriptSettings.tsx +0 -47
- package/src/components/ScriptSettings/index.ts +0 -5
- package/src/components/Toolbar/Toolbar.tsx +0 -180
- package/src/components/TypescriptEditor/index.ts +0 -5
- package/src/templates/chat.ts +0 -102
- package/src/templates/chess.ts +0 -41
- package/src/templates/echo.ts +0 -15
- package/src/templates/email.ts +0 -38
- package/src/templates/forex.ts +0 -21
- package/src/templates.ts +0 -54
- /package/dist/lib/{node-esm/edge/index.mjs.map → browser/TypescriptEditor-GPE72Y6I.mjs.map} +0 -0
- /package/dist/types/src/components/{DebugPanel/DebugPanel.d.ts → DebugPanel.d.ts} +0 -0
- /package/dist/types/src/components/{FrameContainer → ScriptBlock/FrameContainer}/frame.d.ts +0 -0
- /package/dist/types/src/components/{FrameContainer → ScriptBlock/FrameContainer}/index.d.ts +0 -0
- /package/src/components/{FrameContainer → ScriptBlock/FrameContainer}/frame.html +0 -0
- /package/src/components/{FrameContainer → ScriptBlock/FrameContainer}/frame.tsx +0 -0
- /package/src/components/{FrameContainer → ScriptBlock/FrameContainer}/index.ts +0 -0
|
@@ -1,47 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
|
-
USERFUNCTIONS_PRESET_META_KEY,
|
|
3
2
|
getUserFunctionUrlInMetadata,
|
|
4
3
|
publicKeyToDid,
|
|
5
4
|
setUserFunctionUrlInMetadata,
|
|
6
5
|
uploadWorkerFunction
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DL5XQRQM.mjs";
|
|
8
7
|
import {
|
|
9
|
-
Bundler
|
|
10
|
-
|
|
11
|
-
} from "./chunk-G6H56WFS.mjs";
|
|
8
|
+
Bundler
|
|
9
|
+
} from "./chunk-RHEZ5LUU.mjs";
|
|
12
10
|
import {
|
|
13
11
|
FunctionType
|
|
14
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-O4LWBX6A.mjs";
|
|
15
13
|
import {
|
|
16
14
|
SCRIPT_PLUGIN
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
22
|
-
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
23
|
-
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
15
|
+
} from "./chunk-JBACGDOJ.mjs";
|
|
16
|
+
import {
|
|
17
|
+
TypescriptEditor
|
|
18
|
+
} from "./chunk-MRGOT5RF.mjs";
|
|
24
19
|
|
|
25
20
|
// packages/plugins/experimental/plugin-script/src/components/ScriptEditor.tsx
|
|
26
21
|
import { format } from "prettier";
|
|
27
22
|
import prettierPluginEstree from "prettier/plugins/estree";
|
|
28
23
|
import prettierPluginTypescript from "prettier/plugins/typescript";
|
|
29
|
-
import
|
|
24
|
+
import React3, { useCallback, useMemo, useState as useState3 } from "react";
|
|
30
25
|
import { log as log2 } from "@dxos/log";
|
|
31
26
|
import { useClient } from "@dxos/react-client";
|
|
32
|
-
import { create, createDocAccessor, Filter, getMeta, getSpace, useQuery } from "@dxos/react-client/echo";
|
|
27
|
+
import { create, createDocAccessor, Filter, fullyQualifiedId, getMeta, getSpace, useQuery } from "@dxos/react-client/echo";
|
|
33
28
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
34
29
|
import { useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
30
|
+
import { useHasAttention } from "@dxos/react-ui-attention";
|
|
35
31
|
import { createDataExtensions, listener } from "@dxos/react-ui-editor";
|
|
36
32
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
37
33
|
|
|
38
|
-
// packages/plugins/experimental/plugin-script/src/components/DebugPanel
|
|
34
|
+
// packages/plugins/experimental/plugin-script/src/components/DebugPanel.tsx
|
|
39
35
|
import React, { useEffect, useRef, useState } from "react";
|
|
40
36
|
import { log } from "@dxos/log";
|
|
41
37
|
import { Avatar, DensityProvider, Icon, Input, Toolbar, useControlledValue, useTranslation } from "@dxos/react-ui";
|
|
42
38
|
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
43
39
|
import { mx } from "@dxos/react-ui-theme";
|
|
44
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/components/DebugPanel
|
|
40
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/components/DebugPanel.tsx";
|
|
45
41
|
var DebugPanel = ({ classNames, functionUrl, binding: _binding, onBindingChange }) => {
|
|
46
42
|
const { t } = useTranslation(SCRIPT_PLUGIN);
|
|
47
43
|
const bindingInputRef = useRef(null);
|
|
@@ -225,62 +221,52 @@ var DebugPanel = ({ classNames, functionUrl, binding: _binding, onBindingChange
|
|
|
225
221
|
size: 4
|
|
226
222
|
})))));
|
|
227
223
|
};
|
|
224
|
+
var RobotAvatar = () => /* @__PURE__ */ React.createElement(Avatar.Root, {
|
|
225
|
+
size: 6,
|
|
226
|
+
variant: "circle"
|
|
227
|
+
}, /* @__PURE__ */ React.createElement(Avatar.Frame, null, /* @__PURE__ */ React.createElement(Avatar.Icon, {
|
|
228
|
+
icon: "ph--robot--regular"
|
|
229
|
+
})));
|
|
230
|
+
var MessageItem = ({ classNames, message }) => {
|
|
231
|
+
const { text, data, error } = message;
|
|
232
|
+
if (error) {
|
|
233
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
234
|
+
className: mx(classNames, "whitespace-pre text-error")
|
|
235
|
+
}, String(error));
|
|
236
|
+
} else if (data) {
|
|
237
|
+
return /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
|
|
238
|
+
language: "json",
|
|
239
|
+
className: mx("text-xs", classNames)
|
|
240
|
+
}, JSON.stringify(data, null, 2));
|
|
241
|
+
}
|
|
242
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
243
|
+
className: mx(classNames)
|
|
244
|
+
}, text || "\xD8");
|
|
245
|
+
};
|
|
228
246
|
var MessageThread = ({ state, result, history }) => {
|
|
229
247
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, history.map((message, i) => /* @__PURE__ */ React.createElement("div", {
|
|
230
248
|
key: i,
|
|
231
|
-
className: "grid grid-cols-[
|
|
232
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
233
|
-
className: "
|
|
234
|
-
}, message.type === "response" && /* @__PURE__ */ React.createElement(RobotAvatar, null)), /* @__PURE__ */ React.createElement("div", {
|
|
235
|
-
className: "overflow-auto"
|
|
249
|
+
className: "grid grid-cols-[3rem_1fr]"
|
|
250
|
+
}, /* @__PURE__ */ React.createElement("div", null, message.type === "response" && /* @__PURE__ */ React.createElement(RobotAvatar, null)), /* @__PURE__ */ React.createElement("div", {
|
|
251
|
+
className: mx("flex", message.type === "request" && "justify-end")
|
|
236
252
|
}, /* @__PURE__ */ React.createElement(MessageItem, {
|
|
253
|
+
classNames: [
|
|
254
|
+
message.type === "request" && "p-1 px-2 rounded-lg bg-hoverSurface"
|
|
255
|
+
],
|
|
237
256
|
message
|
|
238
|
-
})))),
|
|
239
|
-
className: "grid grid-cols-[
|
|
240
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
241
|
-
className: "p-1"
|
|
242
|
-
}, state === "pending" && /* @__PURE__ */ React.createElement(Icon, {
|
|
257
|
+
})))), /* @__PURE__ */ React.createElement("div", {
|
|
258
|
+
className: "grid grid-cols-[3rem_1fr]"
|
|
259
|
+
}, /* @__PURE__ */ React.createElement("div", null, state === "pending" && /* @__PURE__ */ React.createElement(Icon, {
|
|
243
260
|
icon: "ph--spinner--regular",
|
|
244
261
|
size: 6,
|
|
245
|
-
classNames: "animate-spin"
|
|
246
|
-
}) || /* @__PURE__ */ React.createElement(
|
|
247
|
-
icon: "ph--robot--regular",
|
|
248
|
-
size: 6,
|
|
249
|
-
classNames: "animate-[pulse_1s_ease-in-out_infinite]"
|
|
250
|
-
})), /* @__PURE__ */ React.createElement("div", {
|
|
251
|
-
className: "overflow-auto"
|
|
252
|
-
}, /* @__PURE__ */ React.createElement(MessageItem, {
|
|
253
|
-
message: {
|
|
254
|
-
type: "response",
|
|
255
|
-
text: result
|
|
256
|
-
}
|
|
257
|
-
}))));
|
|
258
|
-
};
|
|
259
|
-
var MessageItem = ({ classNames, message }) => {
|
|
260
|
-
const { type, text, data, error } = message;
|
|
261
|
-
const wrapper = "p-1 px-2 rounded-lg bg-hoverSurface overflow-auto";
|
|
262
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
263
|
-
className: mx("flex", type === "request" ? "ml-[8rem] justify-end" : "mr-[8rem]", classNames)
|
|
264
|
-
}, error && /* @__PURE__ */ React.createElement("div", {
|
|
265
|
-
className: mx(wrapper, "whitespace-pre text-error")
|
|
266
|
-
}, String(error)), text !== void 0 && /* @__PURE__ */ React.createElement("div", {
|
|
267
|
-
className: mx(wrapper, type === "request" && "bg-primary-400 dark:bg-primary-600")
|
|
268
|
-
}, text || "\xD8"), data && /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
|
|
269
|
-
language: "json",
|
|
270
|
-
className: mx(wrapper, "px-8 py-2 text-xs")
|
|
271
|
-
}, JSON.stringify(data, null, 2)));
|
|
262
|
+
classNames: "animate-spin-slow"
|
|
263
|
+
}) || result.length > 0 && /* @__PURE__ */ React.createElement(RobotAvatar, null)), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", null, result))));
|
|
272
264
|
};
|
|
273
|
-
var RobotAvatar = () => /* @__PURE__ */ React.createElement(Avatar.Root, {
|
|
274
|
-
size: 6,
|
|
275
|
-
variant: "circle"
|
|
276
|
-
}, /* @__PURE__ */ React.createElement(Avatar.Frame, null, /* @__PURE__ */ React.createElement(Avatar.Icon, {
|
|
277
|
-
icon: "ph--robot--regular"
|
|
278
|
-
})));
|
|
279
265
|
|
|
280
|
-
// packages/plugins/experimental/plugin-script/src/components/Toolbar
|
|
266
|
+
// packages/plugins/experimental/plugin-script/src/components/Toolbar.tsx
|
|
281
267
|
import React2, { useState as useState2 } from "react";
|
|
282
|
-
import { DensityProvider as DensityProvider2, ElevationProvider, Icon as Icon2,
|
|
283
|
-
var Toolbar2 = ({ classNames, deployed, error, functionUrl,
|
|
268
|
+
import { DensityProvider as DensityProvider2, ElevationProvider, Icon as Icon2, Toolbar as NaturalToolbar, Tooltip, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
269
|
+
var Toolbar2 = ({ classNames, deployed, error, functionUrl, showPanel, onDeploy, onFormat, onTogglePanel }) => {
|
|
284
270
|
const { t } = useTranslation2(SCRIPT_PLUGIN);
|
|
285
271
|
const [pending, setPending] = useState2(false);
|
|
286
272
|
const handleCopyLink = async () => {
|
|
@@ -290,11 +276,9 @@ var Toolbar2 = ({ classNames, deployed, error, functionUrl, view, templates: tem
|
|
|
290
276
|
await navigator.clipboard.writeText(functionUrl);
|
|
291
277
|
};
|
|
292
278
|
const handleDeploy = async () => {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
setPending(false);
|
|
297
|
-
}
|
|
279
|
+
setPending(true);
|
|
280
|
+
await onDeploy?.();
|
|
281
|
+
setPending(false);
|
|
298
282
|
};
|
|
299
283
|
return /* @__PURE__ */ React2.createElement(DensityProvider2, {
|
|
300
284
|
density: "fine"
|
|
@@ -308,161 +292,57 @@ var Toolbar2 = ({ classNames, deployed, error, functionUrl, view, templates: tem
|
|
|
308
292
|
style: {
|
|
309
293
|
contain: "layout"
|
|
310
294
|
}
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
icon: "ph--magic-wand--regular",
|
|
316
|
-
text: t("format label"),
|
|
295
|
+
}, onFormat && /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
296
|
+
asChild: true
|
|
297
|
+
}, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
|
|
298
|
+
variant: "ghost",
|
|
317
299
|
onClick: onFormat
|
|
318
|
-
}
|
|
300
|
+
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
301
|
+
icon: "ph--magic-wand--regular",
|
|
302
|
+
size: 4
|
|
303
|
+
}))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, null, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), t("format label")))), /* @__PURE__ */ React2.createElement("div", {
|
|
319
304
|
role: "separator",
|
|
320
305
|
className: "grow"
|
|
321
306
|
}), error ? /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, null, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
322
307
|
icon: "ph--warning-circle--regular",
|
|
323
308
|
size: 4
|
|
324
|
-
})), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, null, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), error))) : null, functionUrl && deployed && /* @__PURE__ */ React2.createElement(
|
|
325
|
-
icon: "ph--link--regular",
|
|
326
|
-
text: t("copy link label"),
|
|
327
|
-
onClick: handleCopyLink
|
|
328
|
-
}), onDeploy && /* @__PURE__ */ React2.createElement(ToolbarIconButton, {
|
|
329
|
-
icon: pending ? "ph--spinner-gap--regular" : "ph--cloud-arrow-up--regular",
|
|
330
|
-
classNames: [
|
|
331
|
-
pending && "animate-spin"
|
|
332
|
-
],
|
|
333
|
-
text: pending ? t("pending label") : t("deploy label"),
|
|
334
|
-
onClick: handleDeploy
|
|
335
|
-
}), /* @__PURE__ */ React2.createElement(ViewSelector, {
|
|
336
|
-
view,
|
|
337
|
-
onViewChange
|
|
338
|
-
}))));
|
|
339
|
-
};
|
|
340
|
-
var ToolbarIconButton = ({ icon, text, classNames, disabled, onClick }) => {
|
|
341
|
-
return /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
309
|
+
})), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, null, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), error))) : null, functionUrl && deployed && /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
342
310
|
asChild: true
|
|
343
311
|
}, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
|
|
344
312
|
variant: "ghost",
|
|
345
|
-
|
|
346
|
-
onClick
|
|
347
|
-
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
348
|
-
icon,
|
|
349
|
-
size: 4,
|
|
350
|
-
classNames
|
|
351
|
-
}))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, null, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), text)));
|
|
352
|
-
};
|
|
353
|
-
var TemplateSelect = ({ templates: templates2 = [], onTemplateSelect }) => {
|
|
354
|
-
return /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
355
|
-
value: "",
|
|
356
|
-
onValueChange: onTemplateSelect
|
|
357
|
-
}, /* @__PURE__ */ React2.createElement(Select.TriggerButton, null), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.Viewport, null, /* @__PURE__ */ React2.createElement(Select.Option, {
|
|
358
|
-
value: ""
|
|
359
|
-
}, "Template"), templates2.map(({ id, name }) => /* @__PURE__ */ React2.createElement(Select.Option, {
|
|
360
|
-
key: id,
|
|
361
|
-
value: id
|
|
362
|
-
}, name))))));
|
|
363
|
-
};
|
|
364
|
-
var ViewSelector = ({ view, onViewChange }) => {
|
|
365
|
-
return /* @__PURE__ */ React2.createElement(ToggleGroup, {
|
|
366
|
-
type: "single",
|
|
367
|
-
value: view,
|
|
368
|
-
onValueChange: (value) => onViewChange?.(value)
|
|
369
|
-
}, /* @__PURE__ */ React2.createElement(ToggleGroupItem, {
|
|
370
|
-
value: "editor",
|
|
371
|
-
classNames: "bg-transparent text-subdued"
|
|
313
|
+
onClick: handleCopyLink
|
|
372
314
|
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
373
|
-
icon: "ph--
|
|
315
|
+
icon: "ph--link--regular",
|
|
374
316
|
size: 4
|
|
375
|
-
})), /* @__PURE__ */ React2.createElement(
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
317
|
+
}))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, null, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), t("copy link label")))), /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
318
|
+
asChild: true
|
|
319
|
+
}, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
|
|
320
|
+
variant: "ghost",
|
|
321
|
+
onClick: handleDeploy,
|
|
322
|
+
disabled: pending
|
|
323
|
+
}, pending ? /* @__PURE__ */ React2.createElement(Icon2, {
|
|
324
|
+
icon: "ph--spinner--regular",
|
|
325
|
+
size: 4,
|
|
326
|
+
classNames: "animate-spin-slow"
|
|
327
|
+
}) : /* @__PURE__ */ React2.createElement(Icon2, {
|
|
328
|
+
icon: "ph--cloud-arrow-up--regular",
|
|
380
329
|
size: 4
|
|
381
|
-
})), /* @__PURE__ */ React2.createElement(
|
|
382
|
-
|
|
383
|
-
|
|
330
|
+
}))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, null, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), pending ? t("pending label") : t("deploy label")))), onTogglePanel && /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
331
|
+
asChild: true
|
|
332
|
+
}, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
|
|
333
|
+
variant: "ghost",
|
|
334
|
+
onClick: onTogglePanel
|
|
384
335
|
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
385
|
-
icon: "ph--
|
|
336
|
+
icon: showPanel ? "ph--caret-down--regular" : "ph--caret-up--regular",
|
|
386
337
|
size: 4
|
|
387
|
-
})));
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
// packages/plugins/experimental/plugin-script/src/components/TypescriptEditor/TypescriptEditor.tsx
|
|
391
|
-
import { javascript } from "@codemirror/lang-javascript";
|
|
392
|
-
import { tsSync, tsFacet, tsLinter, tsAutocomplete, tsHover } from "@valtown/codemirror-ts";
|
|
393
|
-
import React3 from "react";
|
|
394
|
-
import { useThemeContext } from "@dxos/react-ui";
|
|
395
|
-
import { autocomplete, createBasicExtensions, createThemeExtensions, editorFullWidth, editorGutter, editorMonospace, InputModeExtensions, useTextEditor } from "@dxos/react-ui-editor";
|
|
396
|
-
import { nonNullable } from "@dxos/util";
|
|
397
|
-
var TypescriptEditor = ({ id, env, className, initialValue, extensions, scrollTo, selection }) => {
|
|
398
|
-
const { themeMode } = useThemeContext();
|
|
399
|
-
const { parentRef, focusAttributes } = useTextEditor(() => ({
|
|
400
|
-
id,
|
|
401
|
-
initialValue,
|
|
402
|
-
extensions: [
|
|
403
|
-
extensions,
|
|
404
|
-
createBasicExtensions({
|
|
405
|
-
highlightActiveLine: true,
|
|
406
|
-
indentWithTab: true,
|
|
407
|
-
lineNumbers: true,
|
|
408
|
-
lineWrapping: false,
|
|
409
|
-
scrollPastEnd: true
|
|
410
|
-
}),
|
|
411
|
-
createThemeExtensions({
|
|
412
|
-
themeMode,
|
|
413
|
-
syntaxHighlighting: true,
|
|
414
|
-
slots: {
|
|
415
|
-
content: {
|
|
416
|
-
className: editorFullWidth
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}),
|
|
420
|
-
editorGutter,
|
|
421
|
-
// TODO(burdon): Factor out.
|
|
422
|
-
[
|
|
423
|
-
editorMonospace,
|
|
424
|
-
javascript({
|
|
425
|
-
typescript: true
|
|
426
|
-
}),
|
|
427
|
-
// https://github.com/val-town/codemirror-ts
|
|
428
|
-
autocomplete({
|
|
429
|
-
override: env ? [
|
|
430
|
-
tsAutocomplete()
|
|
431
|
-
] : []
|
|
432
|
-
}),
|
|
433
|
-
env ? [
|
|
434
|
-
tsFacet.of({
|
|
435
|
-
env,
|
|
436
|
-
path: `/src/${id}.ts`
|
|
437
|
-
}),
|
|
438
|
-
tsSync(),
|
|
439
|
-
tsLinter(),
|
|
440
|
-
tsHover()
|
|
441
|
-
] : [],
|
|
442
|
-
InputModeExtensions.vscode
|
|
443
|
-
]
|
|
444
|
-
].filter(nonNullable),
|
|
445
|
-
selection,
|
|
446
|
-
scrollTo
|
|
447
|
-
}), [
|
|
448
|
-
id,
|
|
449
|
-
initialValue,
|
|
450
|
-
extensions,
|
|
451
|
-
themeMode,
|
|
452
|
-
selection,
|
|
453
|
-
scrollTo
|
|
454
|
-
]);
|
|
455
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
456
|
-
ref: parentRef,
|
|
457
|
-
className,
|
|
458
|
-
...focusAttributes
|
|
459
|
-
});
|
|
338
|
+
}))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, null, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null), t("toggle details label")))))));
|
|
460
339
|
};
|
|
461
340
|
|
|
462
341
|
// packages/plugins/experimental/plugin-script/src/components/ScriptEditor.tsx
|
|
463
342
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-script/src/components/ScriptEditor.tsx";
|
|
464
|
-
var ScriptEditor = ({
|
|
343
|
+
var ScriptEditor = ({ env, script, role }) => {
|
|
465
344
|
const { t } = useTranslation3(SCRIPT_PLUGIN);
|
|
345
|
+
const hasAttention = useHasAttention(fullyQualifiedId(script));
|
|
466
346
|
const client = useClient();
|
|
467
347
|
const identity = useIdentity();
|
|
468
348
|
const space = getSpace(script);
|
|
@@ -489,7 +369,7 @@ var ScriptEditor = ({ classNames, script, env }) => {
|
|
|
489
369
|
space,
|
|
490
370
|
identity
|
|
491
371
|
]);
|
|
492
|
-
const [
|
|
372
|
+
const [showPanel, setShowPanel] = useState3(false);
|
|
493
373
|
const initialValue = useMemo(() => script.source?.content, [
|
|
494
374
|
script.source
|
|
495
375
|
]);
|
|
@@ -517,7 +397,7 @@ var ScriptEditor = ({ classNames, script, env }) => {
|
|
|
517
397
|
} catch (err) {
|
|
518
398
|
log2.catch(err, void 0, {
|
|
519
399
|
F: __dxlog_file2,
|
|
520
|
-
L:
|
|
400
|
+
L: 102,
|
|
521
401
|
S: void 0,
|
|
522
402
|
C: (f, a) => f(...a)
|
|
523
403
|
});
|
|
@@ -525,24 +405,6 @@ var ScriptEditor = ({ classNames, script, env }) => {
|
|
|
525
405
|
}, [
|
|
526
406
|
script.source
|
|
527
407
|
]);
|
|
528
|
-
const handleTemplateChange = (id) => {
|
|
529
|
-
const template = templates.find((template2) => template2.id === id);
|
|
530
|
-
if (template) {
|
|
531
|
-
script.name = template.name;
|
|
532
|
-
script.source.content = template.source;
|
|
533
|
-
const metaKeys = getMeta(script).keys;
|
|
534
|
-
const oldPresetIndex = metaKeys.findIndex((key) => key.source === USERFUNCTIONS_PRESET_META_KEY);
|
|
535
|
-
if (oldPresetIndex >= 0) {
|
|
536
|
-
metaKeys.splice(oldPresetIndex, 1);
|
|
537
|
-
}
|
|
538
|
-
if (template.presetId) {
|
|
539
|
-
metaKeys.push({
|
|
540
|
-
source: USERFUNCTIONS_PRESET_META_KEY,
|
|
541
|
-
id: template.presetId
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
408
|
const handleDeploy = useCallback(async () => {
|
|
547
409
|
if (!script.source || !identity || !space) {
|
|
548
410
|
return;
|
|
@@ -575,7 +437,7 @@ var ScriptEditor = ({ classNames, script, env }) => {
|
|
|
575
437
|
functionVersionNumber
|
|
576
438
|
}, {
|
|
577
439
|
F: __dxlog_file2,
|
|
578
|
-
L:
|
|
440
|
+
L: 137,
|
|
579
441
|
S: void 0,
|
|
580
442
|
C: (f, a) => f(...a)
|
|
581
443
|
});
|
|
@@ -587,13 +449,12 @@ var ScriptEditor = ({ classNames, script, env }) => {
|
|
|
587
449
|
source: script
|
|
588
450
|
}));
|
|
589
451
|
const meta = getMeta(deployedFunction);
|
|
590
|
-
script.changed = false;
|
|
591
452
|
setUserFunctionUrlInMetadata(meta, `/${ownerDid}/${functionId}`);
|
|
592
|
-
|
|
453
|
+
script.changed = false;
|
|
593
454
|
} catch (err) {
|
|
594
455
|
log2.catch(err, void 0, {
|
|
595
456
|
F: __dxlog_file2,
|
|
596
|
-
L:
|
|
457
|
+
L: 147,
|
|
597
458
|
S: void 0,
|
|
598
459
|
C: (f, a) => f(...a)
|
|
599
460
|
});
|
|
@@ -620,46 +481,33 @@ var ScriptEditor = ({ classNames, script, env }) => {
|
|
|
620
481
|
existingFunctionUrl,
|
|
621
482
|
space
|
|
622
483
|
]);
|
|
623
|
-
return /* @__PURE__ */
|
|
484
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
624
485
|
role: "none",
|
|
625
|
-
className: mx2("flex flex-col
|
|
626
|
-
}, /* @__PURE__ */
|
|
627
|
-
deployed: Boolean(existingFunctionUrl) && !script.changed,
|
|
628
|
-
functionUrl,
|
|
629
|
-
error,
|
|
630
|
-
view,
|
|
631
|
-
templates,
|
|
632
|
-
onDeploy: handleDeploy,
|
|
633
|
-
onFormat: handleFormat,
|
|
634
|
-
onViewChange: setView,
|
|
635
|
-
onTemplateSelect: handleTemplateChange
|
|
636
|
-
}), view !== "preview" && /* @__PURE__ */ React4.createElement(TypescriptEditor, {
|
|
486
|
+
className: mx2("flex flex-col is-full bs-full overflow-hidden", role === "article" && "row-span-2", hasAttention && "attention-surface")
|
|
487
|
+
}, /* @__PURE__ */ React3.createElement(TypescriptEditor, {
|
|
637
488
|
id: script.id,
|
|
638
489
|
env,
|
|
639
490
|
initialValue,
|
|
640
491
|
extensions,
|
|
641
492
|
className: "flex is-full bs-full overflow-hidden ch-focus-ring-inset-over-all"
|
|
642
|
-
}),
|
|
493
|
+
}), /* @__PURE__ */ React3.createElement(Toolbar2, {
|
|
494
|
+
classNames: "border-t border-separator",
|
|
495
|
+
deployed: Boolean(existingFunctionUrl) && !script.changed,
|
|
496
|
+
functionUrl,
|
|
497
|
+
error,
|
|
498
|
+
showPanel,
|
|
499
|
+
onDeploy: handleDeploy,
|
|
500
|
+
onFormat: handleFormat,
|
|
501
|
+
onTogglePanel: async () => setShowPanel((showDetails) => !showDetails)
|
|
502
|
+
}), showPanel && /* @__PURE__ */ React3.createElement(DebugPanel, {
|
|
643
503
|
functionUrl,
|
|
644
504
|
binding: fn?.binding,
|
|
645
505
|
onBindingChange: handleBindingChange
|
|
646
506
|
}));
|
|
647
507
|
};
|
|
648
|
-
|
|
649
|
-
// packages/plugins/experimental/plugin-script/src/components/ScriptContainer.tsx
|
|
650
|
-
var ScriptContainer = ({ script, ...props }) => {
|
|
651
|
-
const attendableAttrs = useAttendableAttributes(fullyQualifiedId(script));
|
|
652
|
-
return /* @__PURE__ */ React5.createElement("div", {
|
|
653
|
-
role: "none",
|
|
654
|
-
className: mx3("flex row-span-2 w-full overflow-hidden attention-surface"),
|
|
655
|
-
...attendableAttrs
|
|
656
|
-
}, /* @__PURE__ */ React5.createElement(ScriptEditor, {
|
|
657
|
-
...props,
|
|
658
|
-
script
|
|
659
|
-
}));
|
|
660
|
-
};
|
|
661
|
-
var ScriptContainer_default = ScriptContainer;
|
|
508
|
+
var ScriptEditor_default = ScriptEditor;
|
|
662
509
|
export {
|
|
663
|
-
|
|
510
|
+
ScriptEditor,
|
|
511
|
+
ScriptEditor_default as default
|
|
664
512
|
};
|
|
665
|
-
//# sourceMappingURL=
|
|
513
|
+
//# sourceMappingURL=ScriptEditor-5Y3EROG3.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ScriptEditor.tsx", "../../../src/components/DebugPanel.tsx", "../../../src/components/Toolbar.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type DID } from 'iso-did/types';\nimport { format } from 'prettier';\nimport prettierPluginEstree from 'prettier/plugins/estree';\nimport prettierPluginTypescript from 'prettier/plugins/typescript';\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { log } from '@dxos/log';\nimport { useClient } from '@dxos/react-client';\nimport {\n create,\n createDocAccessor,\n Filter,\n fullyQualifiedId,\n getMeta,\n getSpace,\n useQuery,\n} from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { useHasAttention } from '@dxos/react-ui-attention';\nimport { createDataExtensions, listener } from '@dxos/react-ui-editor';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { DebugPanel } from './DebugPanel';\nimport { Toolbar } from './Toolbar';\nimport { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';\nimport { Bundler } from '../bundler';\nimport {\n getUserFunctionUrlInMetadata,\n publicKeyToDid,\n setUserFunctionUrlInMetadata,\n uploadWorkerFunction,\n} from '../edge';\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { FunctionType, type ScriptType } from '../types';\n\nexport type ScriptEditorProps = {\n script: ScriptType;\n role?: string;\n} & Pick<TypescriptEditorProps, 'env'>;\n\nexport const ScriptEditor = ({ env, script, role }: ScriptEditorProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const hasAttention = useHasAttention(fullyQualifiedId(script));\n const client = useClient();\n const identity = useIdentity();\n const space = getSpace(script);\n const [fn] = useQuery(\n space,\n Filter.schema(FunctionType, (fn) => fn.source === script),\n );\n\n const extensions = useMemo(\n () => [\n listener({\n onChange: (text) => {\n if (script.source && script.source?.content !== text) {\n script.changed = true;\n }\n },\n }),\n createDataExtensions({\n id: script.id,\n text: script.source && createDocAccessor(script.source, ['content']),\n space,\n identity,\n }),\n ],\n [script, script.source, space, identity],\n );\n\n const [showPanel, setShowPanel] = useState(false);\n const initialValue = useMemo(() => script.source?.content, [script.source]);\n const existingFunctionUrl = fn && getUserFunctionUrlInMetadata(getMeta(fn));\n const [error, setError] = useState<string>();\n\n const handleBindingChange = useCallback(\n (binding: string) => {\n fn.binding = binding;\n },\n [fn],\n );\n\n const handleFormat = useCallback(async () => {\n if (!script.source) {\n return;\n }\n\n try {\n script.source.content = await format(script.source.content, {\n parser: 'typescript',\n plugins: [prettierPluginEstree, prettierPluginTypescript],\n semi: true,\n singleQuote: true,\n });\n } catch (err: any) {\n // TODO(wittjosiah): Show error in UI.\n log.catch(err);\n }\n }, [script.source]);\n\n const handleDeploy = useCallback(async () => {\n if (!script.source || !identity || !space) {\n return;\n }\n\n setError(undefined);\n\n try {\n const existingFunctionId = existingFunctionUrl?.split('/').at(-1);\n const ownerDid = (existingFunctionUrl?.split('/').at(-2) as DID) ?? publicKeyToDid(identity.identityKey);\n\n const bundler = new Bundler({\n platform: 'browser',\n sandboxedModules: [],\n remoteModules: {},\n });\n const buildResult = await bundler.bundle(script.source.content);\n if (buildResult.error || !buildResult.bundle) {\n throw buildResult.error;\n }\n\n const { result, functionId, functionVersionNumber, errorMessage } = await uploadWorkerFunction({\n clientConfig: client.config,\n halo: client.halo,\n ownerDid,\n functionId: existingFunctionId,\n source: buildResult.bundle,\n });\n if (result !== 'success' || functionId === undefined || functionVersionNumber === undefined) {\n throw new Error(errorMessage);\n }\n log.info('function uploaded', { functionId, functionVersionNumber });\n if (fn) {\n fn.version = functionVersionNumber;\n }\n const deployedFunction =\n fn ?? space.db.add(create(FunctionType, { version: functionVersionNumber, source: script }));\n const meta = getMeta(deployedFunction);\n setUserFunctionUrlInMetadata(meta, `/${ownerDid}/${functionId}`);\n script.changed = false;\n } catch (err: any) {\n log.catch(err);\n setError(t('upload failed label'));\n }\n }, [fn, existingFunctionUrl, script, script.name, script.source]);\n\n const functionUrl = useMemo(() => {\n if (!existingFunctionUrl) {\n return;\n }\n\n const baseUrl = new URL('functions/', client.config.values.runtime?.services?.edge?.url);\n\n // Leading slashes cause the URL to be treated as an absolute path.\n const relativeUrl = existingFunctionUrl.replace(/^\\//, '');\n const url = new URL(`./${relativeUrl}`, baseUrl.toString());\n space && url.searchParams.set('spaceId', space.id);\n url.protocol = 'https';\n return url.toString();\n }, [existingFunctionUrl, space]);\n\n return (\n <div\n role='none'\n className={mx(\n 'flex flex-col is-full bs-full overflow-hidden',\n role === 'article' && 'row-span-2',\n hasAttention && 'attention-surface',\n )}\n >\n <TypescriptEditor\n id={script.id}\n env={env}\n initialValue={initialValue}\n extensions={extensions}\n className='flex is-full bs-full overflow-hidden ch-focus-ring-inset-over-all'\n />\n\n <Toolbar\n classNames='border-t border-separator'\n deployed={Boolean(existingFunctionUrl) && !script.changed}\n functionUrl={functionUrl}\n error={error}\n showPanel={showPanel}\n onDeploy={handleDeploy}\n onFormat={handleFormat}\n onTogglePanel={async () => setShowPanel((showDetails) => !showDetails)}\n />\n\n {showPanel && (\n <DebugPanel functionUrl={functionUrl} binding={fn?.binding} onBindingChange={handleBindingChange} />\n )}\n </div>\n );\n};\n\nexport default ScriptEditor;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { log } from '@dxos/log';\nimport {\n Avatar,\n DensityProvider,\n Icon,\n Input,\n type ThemedClassName,\n Toolbar,\n useControlledValue,\n useTranslation,\n} from '@dxos/react-ui';\nimport { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\ntype State = 'pending' | 'responding';\n\n/**\n * Request or response.\n */\ntype Message = { type: 'request' | 'response'; text?: string; data?: any; error?: Error };\n\nexport type DebugPanelProps = ThemedClassName<{\n functionUrl?: string;\n binding?: string;\n onBindingChange?: (binding: string) => void;\n}>;\n\nexport const DebugPanel = ({ classNames, functionUrl, binding: _binding, onBindingChange }: DebugPanelProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n\n const bindingInputRef = useRef<HTMLInputElement>(null);\n const [binding, setBinding] = useControlledValue(_binding ?? '');\n const handleBlur = () => {\n onBindingChange?.(binding);\n };\n\n const inputRef = useRef<HTMLInputElement>(null);\n const [input, setInput] = useState('');\n const [result, setResult] = useState('');\n const [state, setState] = useState<State | null>(null);\n\n // TODO(burdon): Persistent history (non-space ECHO data?)\n const [history, setHistory] = useState<Message[]>([]);\n\n const scrollerRef = useRef<HTMLDivElement>(null);\n const handleScroll = () => {\n if (scrollerRef.current) {\n scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;\n }\n };\n\n const controller = useRef<AbortController>();\n useEffect(() => {\n return () => {\n handleStop();\n };\n }, []);\n\n const handleStop = () => {\n controller.current?.abort('stop');\n controller.current = undefined;\n };\n\n const handleClear = () => {\n handleStop();\n setInput('');\n setResult('');\n setHistory([]);\n inputRef.current?.focus();\n };\n\n const handleResponse = ({ text, data, error }: { text?: string; data?: any; error?: Error } = {}) => {\n controller.current = undefined;\n setHistory((history) => [...history, { type: 'response', text, data, error } satisfies Message]);\n setResult('');\n setState(null);\n handleScroll();\n };\n\n const handleRequest = async (input: string) => {\n // Returns a promise that resolves when a value has been received.\n try {\n setState('pending');\n\n let data = null;\n // Detect JSON input.\n if (input.charAt(0) === '{') {\n try {\n const validJsonString = input.replace(/'/g, '\"').replace(/([{,]\\s*)([a-zA-Z0-9_]+)(\\s*:)/g, '$1\"$2\"$3');\n data = JSON.parse(validJsonString);\n input = JSON.stringify(data, null, 2);\n } catch (err) {\n inputRef.current?.focus();\n return;\n }\n }\n\n setInput('');\n setResult('');\n setHistory((history) => [...history, { type: 'request', text: input }]);\n setTimeout(() => {\n handleScroll();\n });\n\n // Throws DOMException when aborted.\n controller.current = new AbortController();\n const response = await fetch(functionUrl!, {\n signal: controller.current.signal,\n method: 'POST',\n body: input,\n headers: {\n 'Content-Type': data ? 'application/json' : 'text/plain',\n },\n });\n\n // Check for error.\n if (!response.ok) {\n const text = await response.text();\n handleResponse({ error: new Error(text || response.statusText || String(response.status)) });\n return;\n }\n\n // Check for JSON.\n const contentType = response.headers.get('content-type');\n if (contentType === 'application/json') {\n const data = await response.json();\n handleResponse({ data });\n return;\n }\n\n // Text (including streaming).\n setState('responding');\n let text = '';\n const reader = response.body!.getReader();\n const pump = async ({ done, value }: ReadableStreamReadResult<Uint8Array>): Promise<void> => {\n text = text + new TextDecoder().decode(value);\n if (!controller.current || done) {\n handleResponse({ text });\n return;\n }\n\n setResult(text);\n setTimeout(() => {\n handleScroll();\n });\n\n return reader.read().then(pump);\n };\n\n void reader\n .read()\n .then(pump)\n .catch((err) => {\n if (err.name !== 'AbortError') {\n log.catch(err);\n }\n });\n } catch (err: any) {\n if (err !== 'stop') {\n const error = err instanceof Error ? err : new Error(err);\n handleResponse({ error });\n log.catch(err);\n } else {\n handleResponse();\n }\n }\n };\n\n return (\n <DensityProvider density='fine'>\n <div className={mx('flex flex-col h-full overflow-hidden', classNames)}>\n {/* TODO(burdon): Replace with Thread? */}\n <div ref={scrollerRef} className='flex flex-col gap-6 h-full p-4 overflow-x-hidden overflow-y-auto'>\n <MessageThread state={state} result={result} history={history} />\n </div>\n\n <Toolbar.Root classNames='p-2'>\n <Input.Root>\n <Input.TextInput\n ref={inputRef}\n autoFocus\n placeholder={t('function request placeholder')}\n value={input}\n onChange={(ev) => setInput(ev.target.value)}\n onKeyDown={(ev) => ev.key === 'Enter' && handleRequest(input)}\n />\n </Input.Root>\n <Input.Root>\n <Input.TextInput\n ref={bindingInputRef}\n classNames='!w-[10rem]'\n placeholder={t('binding placeholder')}\n value={binding}\n onChange={(ev) => setBinding(ev.target.value.toUpperCase())}\n onBlur={handleBlur}\n />\n </Input.Root>\n <Toolbar.Button onClick={() => handleRequest(input)}>\n <Icon icon='ph--play--regular' size={4} />\n </Toolbar.Button>\n <Toolbar.Button onClick={() => (state ? handleStop() : handleClear())}>\n <Icon icon={state ? 'ph--stop--regular' : 'ph--trash--regular'} size={4} />\n </Toolbar.Button>\n </Toolbar.Root>\n </div>\n </DensityProvider>\n );\n};\n\nconst RobotAvatar = () => (\n <Avatar.Root size={6} variant='circle'>\n <Avatar.Frame>\n <Avatar.Icon icon='ph--robot--regular' />\n </Avatar.Frame>\n </Avatar.Root>\n);\n\nconst MessageItem = ({ classNames, message }: ThemedClassName<{ message: Message }>) => {\n const { text, data, error } = message;\n if (error) {\n return <span className={mx(classNames, 'whitespace-pre text-error')}>{String(error)}</span>;\n } else if (data) {\n return (\n <SyntaxHighlighter language='json' className={mx('text-xs', classNames)}>\n {JSON.stringify(data, null, 2)}\n </SyntaxHighlighter>\n );\n }\n\n return <span className={mx(classNames)}>{text || '\\u00D8'}</span>;\n};\n\n// TODO(burdon): Replace with thread?\n// TODO(burdon): Button to delete individual messages.\n// TODO(burdon): Button to re-run question.\nconst MessageThread = ({ state, result, history }: { state: State | null; result: string; history: Message[] }) => {\n return (\n <>\n {history.map((message, i) => (\n <div key={i} className='grid grid-cols-[3rem_1fr]'>\n <div>{message.type === 'response' && <RobotAvatar />}</div>\n <div className={mx('flex', message.type === 'request' && 'justify-end')}>\n <MessageItem\n classNames={[message.type === 'request' && 'p-1 px-2 rounded-lg bg-hoverSurface']}\n message={message}\n />\n </div>\n </div>\n ))}\n <div className='grid grid-cols-[3rem_1fr]'>\n <div>\n {(state === 'pending' && <Icon icon='ph--spinner--regular' size={6} classNames='animate-spin-slow' />) ||\n (result.length > 0 && <RobotAvatar />)}\n </div>\n <div>\n <span>{result}</span>\n </div>\n </div>\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport {\n DensityProvider,\n ElevationProvider,\n Icon,\n type ThemedClassName,\n Toolbar as NaturalToolbar,\n Tooltip,\n useTranslation,\n} from '@dxos/react-ui';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport type ToolbarProps = ThemedClassName<{\n deployed?: boolean;\n error?: string;\n functionUrl?: string;\n showPanel?: boolean;\n onDeploy?: () => Promise<void>;\n onFormat?: () => Promise<void>;\n onTogglePanel?: () => Promise<void>;\n}>;\n\nexport const Toolbar = ({\n classNames,\n deployed,\n error,\n functionUrl,\n showPanel,\n onDeploy,\n onFormat,\n onTogglePanel,\n}: ToolbarProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const [pending, setPending] = useState(false);\n\n const handleCopyLink = async () => {\n if (!functionUrl) {\n return;\n }\n\n await navigator.clipboard.writeText(functionUrl);\n };\n\n const handleDeploy = async () => {\n setPending(true);\n await onDeploy?.();\n setPending(false);\n };\n\n // TODO(burdon): Simplify tooltips.\n // TODO(burdon): Factor out common toolbar components with sheet/editor?\n return (\n <DensityProvider density='fine'>\n <ElevationProvider elevation='chrome'>\n <NaturalToolbar.Root classNames={['p-1', classNames]} style={{ contain: 'layout' }}>\n {onFormat && (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <NaturalToolbar.Button variant='ghost' onClick={onFormat}>\n <Icon icon='ph--magic-wand--regular' size={4} />\n </NaturalToolbar.Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n <Tooltip.Arrow />\n {t('format label')}\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n )}\n\n <div role='separator' className='grow' />\n\n {error ? (\n <Tooltip.Root>\n <Tooltip.Trigger>\n <Icon icon='ph--warning-circle--regular' size={4} />\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n <Tooltip.Arrow />\n {error}\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n ) : null}\n\n {functionUrl && deployed && (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <NaturalToolbar.Button variant='ghost' onClick={handleCopyLink}>\n <Icon icon='ph--link--regular' size={4} />\n </NaturalToolbar.Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n <Tooltip.Arrow />\n {t('copy link label')}\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n )}\n\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <NaturalToolbar.Button variant='ghost' onClick={handleDeploy} disabled={pending}>\n {pending ? (\n <Icon icon='ph--spinner--regular' size={4} classNames='animate-spin-slow' />\n ) : (\n <Icon icon='ph--cloud-arrow-up--regular' size={4} />\n )}\n </NaturalToolbar.Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n <Tooltip.Arrow />\n {pending ? t('pending label') : t('deploy label')}\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n\n {onTogglePanel && (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <NaturalToolbar.Button variant='ghost' onClick={onTogglePanel}>\n <Icon icon={showPanel ? 'ph--caret-down--regular' : 'ph--caret-up--regular'} size={4} />\n </NaturalToolbar.Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n <Tooltip.Arrow />\n {t('toggle details label')}\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n )}\n </NaturalToolbar.Root>\n </ElevationProvider>\n </DensityProvider>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAKA,SAASA,cAAc;AACvB,OAAOC,0BAA0B;AACjC,OAAOC,8BAA8B;AACrC,OAAOC,UAASC,aAAaC,SAASC,YAAAA,iBAAgB;AAEtD,SAASC,OAAAA,YAAW;AACpB,SAASC,iBAAiB;AAC1B,SACEC,QACAC,mBACAC,QACAC,kBACAC,SACAC,UACAC,gBACK;AACP,SAASC,mBAAmB;AAC5B,SAASC,kBAAAA,uBAAsB;AAC/B,SAASC,uBAAuB;AAChC,SAASC,sBAAsBC,gBAAgB;AAC/C,SAASC,MAAAA,WAAU;;;ACrBnB,OAAOC,SAASC,WAAWC,QAAQC,gBAAgB;AAEnD,SAASC,WAAW;AACpB,SACEC,QACAC,iBACAC,MACAC,OAEAC,SACAC,oBACAC,sBACK;AACP,SAASC,yBAAyB;AAClC,SAASC,UAAU;;AAiBZ,IAAMC,aAAa,CAAC,EAAEC,YAAYC,aAAaC,SAASC,UAAUC,gBAAe,MAAmB;AACzG,QAAM,EAAEC,EAAC,IAAKC,eAAeC,aAAAA;AAE7B,QAAMC,kBAAkBC,OAAyB,IAAA;AACjD,QAAM,CAACP,SAASQ,UAAAA,IAAcC,mBAAmBR,YAAY,EAAA;AAC7D,QAAMS,aAAa,MAAA;AACjBR,sBAAkBF,OAAAA;EACpB;AAEA,QAAMW,WAAWJ,OAAyB,IAAA;AAC1C,QAAM,CAACK,OAAOC,QAAAA,IAAYC,SAAS,EAAA;AACnC,QAAM,CAACC,QAAQC,SAAAA,IAAaF,SAAS,EAAA;AACrC,QAAM,CAACG,OAAOC,QAAAA,IAAYJ,SAAuB,IAAA;AAGjD,QAAM,CAACK,SAASC,UAAAA,IAAcN,SAAoB,CAAA,CAAE;AAEpD,QAAMO,cAAcd,OAAu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GAAM;AAE/B,SACE,gBAAAwF,OAAA,cAACC,OAAAA;IACCpG,MAAK;IACLqG,WAAWC,IACT,iDACAtG,SAAS,aAAa,cACtBI,gBAAgB,mBAAA;KAGlB,gBAAA+F,OAAA,cAACI,kBAAAA;IACC5E,IAAI5B,OAAO4B;IACX7B;IACAkC;IACAb;IACAkF,WAAU;MAGZ,gBAAAF,OAAA,cAACK,UAAAA;IACCC,YAAW;IACXC,UAAUC,QAAQ1E,mBAAAA,KAAwB,CAAClC,OAAO0B;IAClD4D;IACAjD;IACAP;IACA+E,UAAUxD;IACVyD,UAAUpE;IACVqE,eAAe,YAAYhF,aAAa,CAACiF,gBAAgB,CAACA,WAAAA;MAG3DlF,aACC,gBAAAsE,OAAA,cAACa,YAAAA;IAAW3B;IAA0B7C,SAAS3B,IAAI2B;IAASyE,iBAAiB3E;;AAIrF;AAEA,IAAA,uBAAezC;",
|
|
6
|
+
"names": ["format", "prettierPluginEstree", "prettierPluginTypescript", "React", "useCallback", "useMemo", "useState", "log", "useClient", "create", "createDocAccessor", "Filter", "fullyQualifiedId", "getMeta", "getSpace", "useQuery", "useIdentity", "useTranslation", "useHasAttention", "createDataExtensions", "listener", "mx", "React", "useEffect", "useRef", "useState", "log", "Avatar", "DensityProvider", "Icon", "Input", "Toolbar", "useControlledValue", "useTranslation", "SyntaxHighlighter", "mx", "DebugPanel", "classNames", "functionUrl", "binding", "_binding", "onBindingChange", "t", "useTranslation", "SCRIPT_PLUGIN", "bindingInputRef", "useRef", "setBinding", "useControlledValue", "handleBlur", "inputRef", "input", "setInput", "useState", "result", "setResult", "state", "setState", "history", "setHistory", "scrollerRef", "handleScroll", "current", "scrollTop", "scrollHeight", "controller", "useEffect", "handleStop", "abort", "undefined", "handleClear", "focus", "handleResponse", "text", "data", "error", "type", "handleRequest", "charAt", "validJsonString", "replace", "JSON", "parse", "stringify", "err", "setTimeout", "AbortController", "response", "fetch", "signal", "method", "body", "headers", "ok", "Error", "statusText", "String", "status", "contentType", "get", "json", "reader", "getReader", "pump", "done", "value", "TextDecoder", "decode", "read", "then", "catch", "name", "log", "DensityProvider", "density", "div", "className", "mx", "ref", "MessageThread", "Toolbar", "Root", "Input", "TextInput", "autoFocus", "placeholder", "onChange", "ev", "target", "onKeyDown", "key", "toUpperCase", "onBlur", "Button", "onClick", "Icon", "icon", "size", "RobotAvatar", "Avatar", "variant", "Frame", "MessageItem", "message", "span", "SyntaxHighlighter", "language", "map", "i", "length", "React", "useState", "DensityProvider", "ElevationProvider", "Icon", "Toolbar", "NaturalToolbar", "Tooltip", "useTranslation", "Toolbar", "classNames", "deployed", "error", "functionUrl", "showPanel", "onDeploy", "onFormat", "onTogglePanel", "t", "useTranslation", "SCRIPT_PLUGIN", "pending", "setPending", "useState", "handleCopyLink", "navigator", "clipboard", "writeText", "handleDeploy", "React", "DensityProvider", "density", "ElevationProvider", "elevation", "NaturalToolbar", "Root", "style", "contain", "Tooltip", "Trigger", "asChild", "Button", "variant", "onClick", "Icon", "icon", "size", "Portal", "Content", "Arrow", "div", "role", "className", "disabled", "ScriptEditor", "env", "script", "role", "t", "useTranslation", "SCRIPT_PLUGIN", "hasAttention", "useHasAttention", "fullyQualifiedId", "client", "useClient", "identity", "useIdentity", "space", "getSpace", "fn", "useQuery", "Filter", "schema", "FunctionType", "source", "extensions", "useMemo", "listener", "onChange", "text", "content", "changed", "createDataExtensions", "id", "createDocAccessor", "showPanel", "setShowPanel", "useState", "initialValue", "existingFunctionUrl", "getUserFunctionUrlInMetadata", "getMeta", "error", "setError", "handleBindingChange", "useCallback", "binding", "handleFormat", "format", "parser", "plugins", "prettierPluginEstree", "prettierPluginTypescript", "semi", "singleQuote", "err", "log", "catch", "handleDeploy", "undefined", "existingFunctionId", "split", "at", "ownerDid", "publicKeyToDid", "identityKey", "bundler", "Bundler", "platform", "sandboxedModules", "remoteModules", "buildResult", "bundle", "result", "functionId", "functionVersionNumber", "errorMessage", "uploadWorkerFunction", "clientConfig", "config", "halo", "Error", "info", "version", "deployedFunction", "db", "add", "create", "meta", "setUserFunctionUrlInMetadata", "name", "functionUrl", "baseUrl", "URL", "values", "runtime", "services", "edge", "url", "relativeUrl", "replace", "toString", "searchParams", "set", "protocol", "React", "div", "className", "mx", "TypescriptEditor", "Toolbar", "classNames", "deployed", "Boolean", "onDeploy", "onFormat", "onTogglePanel", "showDetails", "DebugPanel", "onBindingChange"]
|
|
7
|
+
}
|