@dxos/plugin-script 0.7.1 → 0.7.2-staging.6d26b2a

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.
Files changed (43) hide show
  1. package/dist/lib/browser/{AutomationPanel-RYJJQ5QX.mjs → AutomationPanel-BZCRRLOQ.mjs} +2 -2
  2. package/dist/lib/browser/{AutomationPanel-RYJJQ5QX.mjs.map → AutomationPanel-BZCRRLOQ.mjs.map} +1 -1
  3. package/dist/lib/browser/{ScriptContainer-RLBVHRCW.mjs → ScriptContainer-GQ2KJ5BM.mjs} +7 -10
  4. package/dist/lib/browser/ScriptContainer-GQ2KJ5BM.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-VEW5BERN.mjs → chunk-DTVOXLPP.mjs} +9 -9
  6. package/dist/lib/browser/chunk-DTVOXLPP.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +3 -3
  8. package/dist/lib/browser/meta.json +1 -1
  9. package/dist/lib/browser/types/index.mjs +1 -1
  10. package/dist/lib/node/{AutomationPanel-3B5AGQQV.cjs → AutomationPanel-VNLNP3EE.cjs} +9 -9
  11. package/dist/lib/node/{AutomationPanel-3B5AGQQV.cjs.map → AutomationPanel-VNLNP3EE.cjs.map} +1 -1
  12. package/dist/lib/node/{ScriptContainer-7VX44TH6.cjs → ScriptContainer-K67ZWCKL.cjs} +12 -15
  13. package/dist/lib/node/ScriptContainer-K67ZWCKL.cjs.map +7 -0
  14. package/dist/lib/node/{chunk-XJOH225K.cjs → chunk-T4PYTKIW.cjs} +12 -12
  15. package/dist/lib/node/chunk-T4PYTKIW.cjs.map +7 -0
  16. package/dist/lib/node/index.cjs +18 -18
  17. package/dist/lib/node/meta.json +1 -1
  18. package/dist/lib/node/types/index.cjs +4 -4
  19. package/dist/lib/node/types/index.cjs.map +1 -1
  20. package/dist/lib/node-esm/{AutomationPanel-EEGLOILM.mjs → AutomationPanel-NWE2QCOE.mjs} +2 -2
  21. package/dist/lib/node-esm/{AutomationPanel-EEGLOILM.mjs.map → AutomationPanel-NWE2QCOE.mjs.map} +1 -1
  22. package/dist/lib/node-esm/{ScriptContainer-NGYXDSLQ.mjs → ScriptContainer-BVDYLJZI.mjs} +7 -10
  23. package/dist/lib/node-esm/ScriptContainer-BVDYLJZI.mjs.map +7 -0
  24. package/dist/lib/node-esm/{chunk-P7ULFJ4T.mjs → chunk-2HYWFUEN.mjs} +9 -9
  25. package/dist/lib/node-esm/chunk-2HYWFUEN.mjs.map +7 -0
  26. package/dist/lib/node-esm/index.mjs +3 -3
  27. package/dist/lib/node-esm/meta.json +1 -1
  28. package/dist/lib/node-esm/types/index.mjs +1 -1
  29. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -3
  30. package/dist/types/src/components/ScriptEditor.d.ts.map +1 -1
  31. package/dist/types/src/types/schema.d.ts +8 -8
  32. package/dist/types/src/types/schema.d.ts.map +1 -1
  33. package/package.json +36 -36
  34. package/src/components/AutomationPanel/AutomationPanel.tsx +3 -3
  35. package/src/components/ScriptEditor.tsx +4 -3
  36. package/src/components/TypescriptEditor/TypescriptEditor.tsx +1 -1
  37. package/src/types/schema.ts +10 -6
  38. package/dist/lib/browser/ScriptContainer-RLBVHRCW.mjs.map +0 -7
  39. package/dist/lib/browser/chunk-VEW5BERN.mjs.map +0 -7
  40. package/dist/lib/node/ScriptContainer-7VX44TH6.cjs.map +0 -7
  41. package/dist/lib/node/chunk-XJOH225K.cjs.map +0 -7
  42. package/dist/lib/node-esm/ScriptContainer-NGYXDSLQ.mjs.map +0 -7
  43. package/dist/lib/node-esm/chunk-P7ULFJ4T.mjs.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/AutomationPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useMemo, useState } from 'react';\n\nimport { type EchoReactiveObject } from '@dxos/client/echo';\nimport { failUndefined } from '@dxos/debug';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { Select } from '@dxos/react-ui';\n\nimport { getInvocationUrl, getUserFunctionUrlInMetadata } from '../../edge';\nimport { FunctionType, ScriptType } from '../../types';\nimport { DebugPanel } from '../DebugPanel';\n\nexport interface AutomationPanelProps {\n subject: EchoReactiveObject<any>;\n}\n\nexport const AutomationPanel = ({ subject }: AutomationPanelProps) => {\n const space = getSpace(subject);\n\n // TODO(dmaretskyi): Parametric query.\n const functions = useQuery(\n space ?? undefined,\n Filter.schema(FunctionType, (fn) => (subject instanceof ScriptType ? fn.source === subject : fn.binding != null)),\n {},\n [subject],\n );\n const [selectedFunction, setSelectedFunction] = useState<FunctionType | null>(null);\n const functionToChatWith = subject instanceof ScriptType ? functions[0] : selectedFunction;\n\n return (\n <div className='h-full flex flex-col'>\n {!(subject instanceof ScriptType) && (\n <BindingSelect\n selectedFunction={selectedFunction}\n setSelectedFunction={setSelectedFunction}\n functions={functions}\n />\n )}\n {functionToChatWith && <ChatPanel fn={functionToChatWith} subject={subject} />}\n {subject instanceof ScriptType && functions.length === 0 && <p>Deploy function to interact with it.</p>}\n </div>\n );\n};\n\nexport interface ChatPanelProps {\n fn: FunctionType;\n subject: EchoReactiveObject<any>;\n}\n\nconst ChatPanel = ({ fn, subject }: ChatPanelProps) => {\n const client = useClient();\n const space = getSpace(fn);\n const existingFunctionUrl = getUserFunctionUrlInMetadata(getMeta(fn));\n const functionUrl = useMemo(() => {\n if (!existingFunctionUrl) {\n return;\n }\n\n return getInvocationUrl(existingFunctionUrl, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: space?.id,\n subjectId: subject?.id,\n });\n }, [existingFunctionUrl, space, subject]);\n\n return <DebugPanel functionUrl={functionUrl} classNames='flex-1' />;\n};\n\nexport interface BindingSelectProps {\n selectedFunction: FunctionType | null;\n setSelectedFunction: (fn: FunctionType) => void;\n functions: FunctionType[];\n}\n\nconst BindingSelect = ({ selectedFunction, setSelectedFunction, functions }: BindingSelectProps) => {\n return (\n <Select.Root\n value={selectedFunction?.id}\n onValueChange={(id) => setSelectedFunction(functions.find((fn) => fn.id === id) ?? failUndefined())}\n >\n <Select.TriggerButton placeholder='Select value' />\n <Select.Portal>\n <Select.Content>\n <Select.ScrollUpButton />\n <Select.Viewport>\n {functions.map(({ id, binding }) => (\n <Select.Option key={id} value={id}>\n {binding}\n </Select.Option>\n ))}\n </Select.Viewport>\n <Select.ScrollDownButton />\n <Select.Arrow />\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useMemo, useState } from 'react';\n\nimport { type ReactiveEchoObject } from '@dxos/client/echo';\nimport { failUndefined } from '@dxos/debug';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { Select } from '@dxos/react-ui';\n\nimport { getInvocationUrl, getUserFunctionUrlInMetadata } from '../../edge';\nimport { FunctionType, ScriptType } from '../../types';\nimport { DebugPanel } from '../DebugPanel';\n\nexport interface AutomationPanelProps {\n subject: ReactiveEchoObject<any>;\n}\n\nexport const AutomationPanel = ({ subject }: AutomationPanelProps) => {\n const space = getSpace(subject);\n\n // TODO(dmaretskyi): Parametric query.\n const functions = useQuery(\n space ?? undefined,\n Filter.schema(FunctionType, (fn) => (subject instanceof ScriptType ? fn.source === subject : fn.binding != null)),\n {},\n [subject],\n );\n const [selectedFunction, setSelectedFunction] = useState<FunctionType | null>(null);\n const functionToChatWith = subject instanceof ScriptType ? functions[0] : selectedFunction;\n\n return (\n <div className='h-full flex flex-col'>\n {!(subject instanceof ScriptType) && (\n <BindingSelect\n selectedFunction={selectedFunction}\n setSelectedFunction={setSelectedFunction}\n functions={functions}\n />\n )}\n {functionToChatWith && <ChatPanel fn={functionToChatWith} subject={subject} />}\n {subject instanceof ScriptType && functions.length === 0 && <p>Deploy function to interact with it.</p>}\n </div>\n );\n};\n\nexport interface ChatPanelProps {\n fn: FunctionType;\n subject: ReactiveEchoObject<any>;\n}\n\nconst ChatPanel = ({ fn, subject }: ChatPanelProps) => {\n const client = useClient();\n const space = getSpace(fn);\n const existingFunctionUrl = getUserFunctionUrlInMetadata(getMeta(fn));\n const functionUrl = useMemo(() => {\n if (!existingFunctionUrl) {\n return;\n }\n\n return getInvocationUrl(existingFunctionUrl, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: space?.id,\n subjectId: subject?.id,\n });\n }, [existingFunctionUrl, space, subject]);\n\n return <DebugPanel functionUrl={functionUrl} classNames='flex-1' />;\n};\n\nexport interface BindingSelectProps {\n selectedFunction: FunctionType | null;\n setSelectedFunction: (fn: FunctionType) => void;\n functions: FunctionType[];\n}\n\nconst BindingSelect = ({ selectedFunction, setSelectedFunction, functions }: BindingSelectProps) => {\n return (\n <Select.Root\n value={selectedFunction?.id}\n onValueChange={(id) => setSelectedFunction(functions.find((fn) => fn.id === id) ?? failUndefined())}\n >\n <Select.TriggerButton placeholder='Select value' />\n <Select.Portal>\n <Select.Content>\n <Select.ScrollUpButton />\n <Select.Viewport>\n {functions.map(({ id, binding }) => (\n <Select.Option key={id} value={id}>\n {binding}\n </Select.Option>\n ))}\n </Select.Viewport>\n <Select.ScrollDownButton />\n <Select.Arrow />\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport * from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAyC;AAGzC,mBAA8B;AAC9B,0BAA0B;AAC1B,kBAAoD;AACpD,sBAAu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AAkBC,qBAAqBX,UAAS,MAAsB;AAC7F,SACE,6BAAAc,QAAA,cAAC0B,uBAAOC,MAAI;IACVC,OAAOhC,kBAAkB0B;IACzBO,eAAe,CAACP,OAAOzB,oBAAoBX,UAAU4C,KAAK,CAACtC,OAAOA,GAAG8B,OAAOA,EAAAA,SAAOS,4BAAAA,CAAAA;KAEnF,6BAAA/B,QAAA,cAAC0B,uBAAOM,eAAa;IAACC,aAAY;MAClC,6BAAAjC,QAAA,cAAC0B,uBAAOQ,QAAM,MACZ,6BAAAlC,QAAA,cAAC0B,uBAAOS,SAAO,MACb,6BAAAnC,QAAA,cAAC0B,uBAAOU,gBAAc,IAAA,GACtB,6BAAApC,QAAA,cAAC0B,uBAAOW,UAAQ,MACbnD,UAAUoD,IAAI,CAAC,EAAEhB,IAAI3B,QAAO,MAC3B,6BAAAK,QAAA,cAAC0B,uBAAOa,QAAM;IAACC,KAAKlB;IAAIM,OAAON;KAC5B3B,OAAAA,CAAAA,CAAAA,GAIP,6BAAAK,QAAA,cAAC0B,uBAAOe,kBAAgB,IAAA,GACxB,6BAAAzC,QAAA,cAAC0B,uBAAOgB,OAAK,IAAA,CAAA,CAAA,CAAA;AAKvB;AC5FA,IAAA,0BAAe5D;",
6
6
  "names": ["AutomationPanel", "subject", "space", "getSpace", "functions", "useQuery", "undefined", "Filter", "schema", "FunctionType", "fn", "ScriptType", "source", "binding", "selectedFunction", "setSelectedFunction", "useState", "functionToChatWith", "React", "div", "className", "BindingSelect", "ChatPanel", "length", "p", "client", "useClient", "existingFunctionUrl", "getUserFunctionUrlInMetadata", "getMeta", "functionUrl", "useMemo", "getInvocationUrl", "config", "values", "runtime", "services", "edge", "url", "spaceId", "id", "subjectId", "DebugPanel", "classNames", "Select", "Root", "value", "onValueChange", "find", "failUndefined", "TriggerButton", "placeholder", "Portal", "Content", "ScrollUpButton", "Viewport", "map", "Option", "key", "ScrollDownButton", "Arrow"]
7
7
  }
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var ScriptContainer_7VX44TH6_exports = {};
30
- __export(ScriptContainer_7VX44TH6_exports, {
29
+ var ScriptContainer_K67ZWCKL_exports = {};
30
+ __export(ScriptContainer_K67ZWCKL_exports, {
31
31
  default: () => ScriptContainer_default
32
32
  });
33
- module.exports = __toCommonJS(ScriptContainer_7VX44TH6_exports);
33
+ module.exports = __toCommonJS(ScriptContainer_K67ZWCKL_exports);
34
34
  var import_chunk_WPP65EYS = require("./chunk-WPP65EYS.cjs");
35
35
  var import_chunk_BJ4WIWCP = require("./chunk-BJ4WIWCP.cjs");
36
36
  var import_chunk_XS6GEYYH = require("./chunk-XS6GEYYH.cjs");
37
- var import_chunk_XJOH225K = require("./chunk-XJOH225K.cjs");
37
+ var import_chunk_T4PYTKIW = require("./chunk-T4PYTKIW.cjs");
38
38
  var import_chunk_6LYX73ZT = require("./chunk-6LYX73ZT.cjs");
39
39
  var import_react = __toESM(require("react"));
40
40
  var import_echo = require("@dxos/react-client/echo");
@@ -215,7 +215,6 @@ var TypescriptEditor = ({ id, env, className, initialValue, extensions, scrollTo
215
215
  scrollTo
216
216
  }), [
217
217
  id,
218
- initialValue,
219
218
  extensions,
220
219
  themeMode,
221
220
  selection,
@@ -233,7 +232,7 @@ var ScriptEditor = ({ classNames, script, env }) => {
233
232
  const client = (0, import_react_client.useClient)();
234
233
  const identity = (0, import_halo.useIdentity)();
235
234
  const space = (0, import_echo2.getSpace)(script);
236
- const [fn] = (0, import_echo2.useQuery)(space, import_echo2.Filter.schema(import_chunk_XJOH225K.FunctionType, (fn2) => fn2.source === script));
235
+ const [fn] = (0, import_echo2.useQuery)(space, import_echo2.Filter.schema(import_chunk_T4PYTKIW.FunctionType, (fn2) => fn2.source === script));
237
236
  const extensions = (0, import_react2.useMemo)(() => [
238
237
  (0, import_react_ui_editor.listener)({
239
238
  onChange: (text) => {
@@ -257,9 +256,6 @@ var ScriptEditor = ({ classNames, script, env }) => {
257
256
  identity
258
257
  ]);
259
258
  const [view, setView] = (0, import_react2.useState)("editor");
260
- const initialValue = (0, import_react2.useMemo)(() => script.source?.content, [
261
- script.source
262
- ]);
263
259
  const existingFunctionUrl = fn && (0, import_chunk_XS6GEYYH.getUserFunctionUrlInMetadata)((0, import_echo2.getMeta)(fn));
264
260
  const [error, setError] = (0, import_react2.useState)();
265
261
  const handleFormat = (0, import_react2.useCallback)(async () => {
@@ -279,7 +275,7 @@ var ScriptEditor = ({ classNames, script, env }) => {
279
275
  } catch (err) {
280
276
  import_log.log.catch(err, void 0, {
281
277
  F: __dxlog_file,
282
- L: 89,
278
+ L: 88,
283
279
  S: void 0,
284
280
  C: (f, a) => f(...a)
285
281
  });
@@ -337,14 +333,15 @@ var ScriptEditor = ({ classNames, script, env }) => {
337
333
  functionVersionNumber
338
334
  }, {
339
335
  F: __dxlog_file,
340
- L: 137,
336
+ L: 136,
341
337
  S: void 0,
342
338
  C: (f, a) => f(...a)
343
339
  });
344
340
  if (fn) {
345
341
  fn.version = functionVersionNumber;
346
342
  }
347
- const deployedFunction = fn ?? space.db.add((0, import_echo2.create)(import_chunk_XJOH225K.FunctionType, {
343
+ const deployedFunction = fn ?? space.db.add((0, import_echo2.create)(import_chunk_T4PYTKIW.FunctionType, {
344
+ name: functionId,
348
345
  version: functionVersionNumber,
349
346
  source: script
350
347
  }));
@@ -366,7 +363,7 @@ var ScriptEditor = ({ classNames, script, env }) => {
366
363
  } catch (err) {
367
364
  import_log.log.catch(err, void 0, {
368
365
  F: __dxlog_file,
369
- L: 155,
366
+ L: 156,
370
367
  S: void 0,
371
368
  C: (f, a) => f(...a)
372
369
  });
@@ -406,7 +403,7 @@ var ScriptEditor = ({ classNames, script, env }) => {
406
403
  }), view !== "preview" && /* @__PURE__ */ import_react2.default.createElement(TypescriptEditor, {
407
404
  id: script.id,
408
405
  env,
409
- initialValue,
406
+ initialValue: script.source?.content,
410
407
  extensions,
411
408
  className: "flex is-full bs-full overflow-hidden ch-focus-ring-inset-over-all"
412
409
  }), view !== "editor" && /* @__PURE__ */ import_react2.default.createElement(import_chunk_BJ4WIWCP.DebugPanel, {
@@ -425,4 +422,4 @@ var ScriptContainer = ({ script, ...props }) => {
425
422
  }));
426
423
  };
427
424
  var ScriptContainer_default = ScriptContainer;
428
- //# sourceMappingURL=ScriptContainer-7VX44TH6.cjs.map
425
+ //# sourceMappingURL=ScriptContainer-K67ZWCKL.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/ScriptContainer.tsx", "../../../src/components/ScriptEditor.tsx", "../../../src/components/Toolbar/Toolbar.tsx", "../../../src/components/TypescriptEditor/TypescriptEditor.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { fullyQualifiedId } from '@dxos/react-client/echo';\nimport { useAttendableAttributes } from '@dxos/react-ui-attention';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { ScriptEditor, type ScriptEditorProps } from './ScriptEditor';\n\nconst ScriptContainer = ({ script, ...props }: ScriptEditorProps) => {\n const attendableAttrs = useAttendableAttributes(fullyQualifiedId(script));\n return (\n <div role='none' className={mx('flex row-span-2 w-full overflow-hidden attention-surface')} {...attendableAttrs}>\n <ScriptEditor {...props} script={script} />\n </div>\n );\n};\n\nexport default ScriptContainer;\n", "//\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 { create, createDocAccessor, Filter, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { useTranslation, type ThemedClassName } from '@dxos/react-ui';\nimport { createDataExtensions, listener } from '@dxos/react-ui-editor';\nimport { mx } from '@dxos/react-ui-theme';\n\nimport { DebugPanel } from './DebugPanel';\nimport { type TemplateSelectProps, Toolbar, type ViewType } from './Toolbar';\nimport { TypescriptEditor, type TypescriptEditorProps } from './TypescriptEditor';\nimport { Bundler } from '../bundler';\nimport {\n getInvocationUrl,\n getUserFunctionUrlInMetadata,\n publicKeyToDid,\n setUserFunctionUrlInMetadata,\n uploadWorkerFunction,\n USERFUNCTIONS_PRESET_META_KEY,\n} from '../edge';\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { templates } from '../templates';\nimport { FunctionType, type ScriptType } from '../types';\n\nexport type ScriptEditorProps = ThemedClassName<{\n script: ScriptType;\n}> &\n Pick<TypescriptEditorProps, 'env'>;\n\nexport const ScriptEditor = ({ classNames, script, env }: ScriptEditorProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const client = useClient();\n const identity = useIdentity();\n const space = getSpace(script);\n // TODO(dmaretskyi): Parametric query.\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 [view, setView] = useState<ViewType>('editor');\n const existingFunctionUrl = fn && getUserFunctionUrlInMetadata(getMeta(fn));\n const [error, setError] = useState<string>();\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 handleTemplateChange: TemplateSelectProps['onTemplateSelect'] = (id) => {\n const template = templates.find((template) => template.id === id);\n if (template) {\n script.name = template.name;\n script.source!.content = template.source;\n const metaKeys = getMeta(script).keys;\n const oldPresetIndex = metaKeys.findIndex((key) => key.source === USERFUNCTIONS_PRESET_META_KEY);\n if (oldPresetIndex >= 0) {\n metaKeys.splice(oldPresetIndex, 1);\n }\n if (template.presetId) {\n metaKeys.push({ source: USERFUNCTIONS_PRESET_META_KEY, id: template.presetId });\n }\n }\n };\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({ platform: 'browser', sandboxedModules: [], remoteModules: {} });\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, meta } = 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\n log.info('function uploaded', { functionId, functionVersionNumber });\n if (fn) {\n fn.version = functionVersionNumber;\n }\n\n const deployedFunction =\n fn ?? space.db.add(create(FunctionType, { name: functionId, version: functionVersionNumber, source: script }));\n\n script.changed = false;\n\n if (meta.inputSchema) {\n deployedFunction.inputSchema = meta.inputSchema;\n } else {\n log.verbose('no input schema in function metadata', { functionId });\n }\n\n setUserFunctionUrlInMetadata(getMeta(deployedFunction), `/${ownerDid}/${functionId}`);\n\n setView('split');\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 return getInvocationUrl(existingFunctionUrl, client.config.values.runtime?.services?.edge?.url ?? '', {\n spaceId: space?.id,\n });\n }, [existingFunctionUrl, space]);\n\n return (\n <div role='none' className={mx('flex flex-col w-full overflow-hidden divide-y divide-separator', classNames)}>\n <Toolbar\n deployed={Boolean(existingFunctionUrl) && !script.changed}\n functionUrl={functionUrl}\n error={error}\n view={view}\n templates={templates}\n onDeploy={handleDeploy}\n onFormat={handleFormat}\n onViewChange={setView}\n onTemplateSelect={handleTemplateChange}\n />\n\n {view !== 'preview' && (\n <TypescriptEditor\n id={script.id}\n env={env}\n initialValue={script.source?.content}\n extensions={extensions}\n className='flex is-full bs-full overflow-hidden ch-focus-ring-inset-over-all'\n />\n )}\n\n {view !== 'editor' && <DebugPanel functionUrl={functionUrl} />}\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport {\n ElevationProvider,\n Icon,\n Select,\n type ThemedClassName,\n ToggleGroup,\n ToggleGroupItem,\n type ToolbarButtonProps,\n Toolbar as NaturalToolbar,\n Tooltip,\n useTranslation,\n} from '@dxos/react-ui';\n\nimport { SCRIPT_PLUGIN } from '../../meta';\nimport { type Template } from '../../templates';\n\nexport type ToolbarProps = ThemedClassName<\n {\n deployed?: boolean;\n error?: string;\n functionUrl?: string;\n onDeploy?: () => Promise<void>;\n onFormat?: () => Promise<void>;\n } & TemplateSelectProps &\n ViewSelectorProps\n>;\n\nexport const Toolbar = ({\n classNames,\n deployed,\n error,\n functionUrl,\n view,\n templates,\n onDeploy,\n onFormat,\n onViewChange,\n onTemplateSelect,\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 if (!pending) {\n setPending(true);\n await onDeploy?.();\n setPending(false);\n }\n };\n\n // TODO(burdon): Factor out common toolbar components with sheet/editor?\n return (\n <ElevationProvider elevation='chrome'>\n <NaturalToolbar.Root classNames={['p-1', classNames]} style={{ contain: 'layout' }}>\n {templates && <TemplateSelect templates={templates} onTemplateSelect={onTemplateSelect} />}\n {onFormat && <ToolbarIconButton icon='ph--magic-wand--regular' text={t('format label')} onClick={onFormat} />}\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 <ToolbarIconButton icon='ph--link--regular' text={t('copy link label')} onClick={handleCopyLink} />\n )}\n\n {onDeploy && (\n <ToolbarIconButton\n icon={pending ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular'}\n classNames={[pending && 'animate-spin']}\n text={pending ? t('pending label') : t('deploy label')}\n onClick={handleDeploy}\n />\n )}\n\n <ViewSelector view={view} onViewChange={onViewChange} />\n </NaturalToolbar.Root>\n </ElevationProvider>\n );\n};\n\nconst ToolbarIconButton = ({\n icon,\n text,\n classNames,\n disabled,\n onClick,\n}: { icon: string; text: string } & Pick<ToolbarButtonProps, 'classNames' | 'disabled' | 'onClick'>) => {\n return (\n <Tooltip.Root>\n <Tooltip.Trigger asChild>\n <NaturalToolbar.Button variant='ghost' disabled={disabled} onClick={onClick}>\n <Icon icon={icon} size={4} classNames={classNames} />\n </NaturalToolbar.Button>\n </Tooltip.Trigger>\n <Tooltip.Portal>\n <Tooltip.Content>\n <Tooltip.Arrow />\n {text}\n </Tooltip.Content>\n </Tooltip.Portal>\n </Tooltip.Root>\n );\n};\n\nexport type ViewType = 'editor' | 'split' | 'preview';\n\nexport type TemplateSelectProps = {\n templates?: Template[];\n onTemplateSelect?: (id: string) => void;\n};\n\nexport const TemplateSelect = ({ templates = [], onTemplateSelect }: TemplateSelectProps) => {\n return (\n <Select.Root value={''} onValueChange={onTemplateSelect}>\n <Select.TriggerButton />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n <Select.Option value={''}>Template</Select.Option>\n {templates.map(({ id, name }) => (\n <Select.Option key={id} value={id}>\n {name}\n </Select.Option>\n ))}\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n};\n\nexport type ViewSelectorProps = {\n view?: ViewType;\n onViewChange?: (view: ViewType) => void;\n};\n\nexport const ViewSelector = ({ view, onViewChange }: ViewSelectorProps) => {\n return (\n <ToggleGroup type='single' value={view} onValueChange={(value) => onViewChange?.(value as ViewType)}>\n <ToggleGroupItem value='editor' classNames='bg-transparent text-subdued'>\n <Icon icon='ph--code--regular' size={4} />\n </ToggleGroupItem>\n <ToggleGroupItem value='split' classNames='bg-transparent text-subdued'>\n <Icon icon='ph--square-split-vertical--regular' size={4} />\n </ToggleGroupItem>\n <ToggleGroupItem value='preview' classNames='bg-transparent text-subdued'>\n <Icon icon='ph--eye--regular' size={4} />\n </ToggleGroupItem>\n </ToggleGroup>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { javascript } from '@codemirror/lang-javascript';\nimport { type VirtualTypeScriptEnvironment } from '@typescript/vfs';\nimport { tsSync, tsFacet, tsLinter, tsAutocomplete, tsHover } from '@valtown/codemirror-ts';\nimport React from 'react';\n\nimport { useThemeContext } from '@dxos/react-ui';\nimport {\n autocomplete,\n createBasicExtensions,\n createThemeExtensions,\n editorFullWidth,\n editorGutter,\n editorMonospace,\n InputModeExtensions,\n useTextEditor,\n type UseTextEditorProps,\n} from '@dxos/react-ui-editor';\nimport { nonNullable } from '@dxos/util';\n\nexport type TypescriptEditorProps = {\n id: string;\n env?: VirtualTypeScriptEnvironment;\n} & Pick<UseTextEditorProps, 'className' | 'initialValue' | 'extensions' | 'scrollTo' | 'selection'>;\n\nexport const TypescriptEditor = ({\n id,\n env,\n className,\n initialValue,\n extensions,\n scrollTo,\n selection,\n}: TypescriptEditorProps) => {\n const { themeMode } = useThemeContext();\n const { parentRef, focusAttributes } = useTextEditor(\n () => ({\n id,\n initialValue,\n extensions: [\n extensions,\n createBasicExtensions({\n highlightActiveLine: true,\n indentWithTab: true,\n lineNumbers: true,\n lineWrapping: false,\n scrollPastEnd: true,\n }),\n createThemeExtensions({\n themeMode,\n syntaxHighlighting: true,\n slots: {\n content: { className: editorFullWidth },\n },\n }),\n editorGutter,\n // TODO(burdon): Factor out.\n [\n editorMonospace,\n javascript({ typescript: true }),\n // https://github.com/val-town/codemirror-ts\n autocomplete({ override: env ? [tsAutocomplete()] : [] }),\n env ? [tsFacet.of({ env, path: `/src/${id}.ts` }), tsSync(), tsLinter(), tsHover()] : [],\n InputModeExtensions.vscode,\n ],\n ].filter(nonNullable),\n selection,\n scrollTo,\n }),\n [id, extensions, themeMode, selection, scrollTo],\n );\n\n return <div ref={parentRef} className={className} {...focusAttributes} />;\n};\n\nexport default TypescriptEditor;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,kBAAiC;AACjC,gCAAwC;AACxC,4BAAmB;ACHnB,sBAAuB;AACvB,oBAAiC;AACjC,wBAAqC;AACrC,IAAAA,gBAAsD;AAEtD,iBAAoB;AACpB,0BAA0B;AAC1B,IAAAC,eAA+E;AAC/E,kBAA4B;AAC5B,sBAAqD;AACrD,6BAA+C;AAC/C,IAAAC,yBAAmB;ACZnB,IAAAF,gBAAgC;AAEhC,IAAAG,mBAWO;ACbP,6BAA2B;AAE3B,2BAAmE;AACnE,IAAAH,gBAAkB;AAElB,IAAAG,mBAAgC;AAChC,IAAAC,0BAUO;AACP,kBAA4B;ADYrB,IAAMC,UAAU,CAAC,EACtBC,YACAC,UACAC,OACAC,aACAC,MACAC,WAAAA,YACAC,UACAC,UACAC,cACAC,iBAAgB,MACH;AACb,QAAM,EAAEC,EAAC,QAAKC,iCAAeC,mCAAAA;AAC7B,QAAM,CAACC,SAASC,UAAAA,QAAc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K;IAAOC,eAAW0J,2BAAG,kEAAkE7L,UAAAA;KAC/FqB,8BAAAA,QAAA,cAACtB,SAAAA;IACCE,UAAU6L,QAAQpE,mBAAAA,KAAwB,CAACpB,OAAOgB;IAClDnH;IACAD;IACAE;IACAC;IACAC,UAAUc;IACVb,UAAUuH;IACVtH,cAAciH;IACdhH,kBAAkBiI;MAGnBtI,SAAS,aACRiB,8BAAAA,QAAA,cAACwC,kBAAAA;IACCN,IAAI+C,OAAO/C;IACXO;IACAC,cAAcuC,OAAOY,QAAQjC;IAC7BjB;IACA7B,WAAU;MAIb/B,SAAS,YAAYiB,8BAAAA,QAAA,cAAC0K,kCAAAA;IAAW5L;;AAGxC;ADzLA,IAAM6L,kBAAkB,CAAC,EAAE1F,QAAQ,GAAG2F,MAAAA,MAA0B;AAC9D,QAAMC,sBAAkBC,uDAAwBC,8BAAiB9F,MAAAA,CAAAA;AACjE,SACEjF,6BAAAA,QAAA,cAACY,OAAAA;IAAIC,MAAK;IAAOC,eAAW0J,sBAAAA,IAAG,0DAAA;IAA8D,GAAGK;KAC9F7K,6BAAAA,QAAA,cAACgF,cAAAA;IAAc,GAAG4F;IAAO3F;;AAG/B;AAEA,IAAA,0BAAe0F;",
6
+ "names": ["import_react", "import_echo", "import_react_ui_theme", "import_react_ui", "import_react_ui_editor", "Toolbar", "classNames", "deployed", "error", "functionUrl", "view", "templates", "onDeploy", "onFormat", "onViewChange", "onTemplateSelect", "t", "useTranslation", "SCRIPT_PLUGIN", "pending", "setPending", "useState", "handleCopyLink", "navigator", "clipboard", "writeText", "handleDeploy", "React", "ElevationProvider", "elevation", "NaturalToolbar", "Root", "style", "contain", "TemplateSelect", "ToolbarIconButton", "icon", "text", "onClick", "div", "role", "className", "Tooltip", "Trigger", "Icon", "size", "Portal", "Content", "Arrow", "ViewSelector", "disabled", "asChild", "Button", "variant", "Select", "value", "onValueChange", "TriggerButton", "Viewport", "Option", "map", "id", "name", "key", "ToggleGroup", "type", "ToggleGroupItem", "TypescriptEditor", "env", "initialValue", "extensions", "scrollTo", "selection", "themeMode", "useThemeContext", "parentRef", "focusAttributes", "useTextEditor", "createBasicExtensions", "highlightActiveLine", "indentWithTab", "lineNumbers", "lineWrapping", "scrollPastEnd", "createThemeExtensions", "syntaxHighlighting", "slots", "content", "editorFullWidth", "editorGutter", "editorMonospace", "javascript", "typescript", "autocomplete", "override", "tsAutocomplete", "tsFacet", "of", "path", "tsSync", "tsLinter", "tsHover", "InputModeExtensions", "vscode", "filter", "nonNullable", "ref", "ScriptEditor", "script", "client", "useClient", "identity", "useIdentity", "space", "getSpace", "fn", "useQuery", "Filter", "schema", "FunctionType", "source", "useMemo", "listener", "onChange", "changed", "createDataExtensions", "createDocAccessor", "setView", "existingFunctionUrl", "getUserFunctionUrlInMetadata", "getMeta", "setError", "handleFormat", "useCallback", "format", "parser", "plugins", "prettierPluginEstree", "prettierPluginTypescript", "semi", "singleQuote", "err", "log", "catch", "handleTemplateChange", "template", "find", "metaKeys", "keys", "oldPresetIndex", "findIndex", "USERFUNCTIONS_PRESET_META_KEY", "splice", "presetId", "push", "undefined", "existingFunctionId", "split", "at", "ownerDid", "publicKeyToDid", "identityKey", "bundler", "Bundler", "platform", "sandboxedModules", "remoteModules", "buildResult", "bundle", "result", "functionId", "functionVersionNumber", "errorMessage", "meta", "uploadWorkerFunction", "clientConfig", "config", "halo", "Error", "info", "version", "deployedFunction", "db", "add", "create", "inputSchema", "verbose", "setUserFunctionUrlInMetadata", "getInvocationUrl", "values", "runtime", "services", "edge", "url", "spaceId", "mx", "Boolean", "DebugPanel", "ScriptContainer", "props", "attendableAttrs", "useAttendableAttributes", "fullyQualifiedId"]
7
+ }
@@ -16,13 +16,13 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_XJOH225K_exports = {};
20
- __export(chunk_XJOH225K_exports, {
19
+ var chunk_T4PYTKIW_exports = {};
20
+ __export(chunk_T4PYTKIW_exports, {
21
21
  FunctionType: () => FunctionType,
22
22
  ScriptAction: () => ScriptAction,
23
23
  ScriptType: () => ScriptType
24
24
  });
25
- module.exports = __toCommonJS(chunk_XJOH225K_exports);
25
+ module.exports = __toCommonJS(chunk_T4PYTKIW_exports);
26
26
  var import_chunk_6LYX73ZT = require("./chunk-6LYX73ZT.cjs");
27
27
  var import_echo_schema = require("@dxos/echo-schema");
28
28
  var import_types = require("@dxos/plugin-markdown/types");
@@ -33,25 +33,25 @@ var ScriptType = class extends (0, import_echo_schema.TypedObject)({
33
33
  // TODO(burdon): Change to URI?
34
34
  name: import_echo_schema.S.optional(import_echo_schema.S.String),
35
35
  description: import_echo_schema.S.optional(import_echo_schema.S.String),
36
- source: (0, import_echo_schema.ref)(import_types.TextType),
37
36
  // TODO(burdon): Change to hash of deployed content.
38
37
  // Whether source has changed since last deploy.
39
- changed: import_echo_schema.S.optional(import_echo_schema.S.Boolean)
38
+ changed: import_echo_schema.S.optional(import_echo_schema.S.Boolean),
39
+ source: (0, import_echo_schema.ref)(import_types.TextType)
40
40
  }) {
41
41
  };
42
42
  var FunctionType = class extends (0, import_echo_schema.TypedObject)({
43
43
  typename: "dxos.org/type/Function",
44
44
  version: "0.1.0"
45
45
  })({
46
- // TODO(burdon): Change to id?
47
- name: import_echo_schema.S.optional(import_echo_schema.S.String),
46
+ // TODO(burdon): Rename to id/uri?
47
+ name: import_echo_schema.S.NonEmptyString,
48
48
  version: import_echo_schema.S.Number,
49
- // Local binding to a function name.
50
- // TODO(burdon): Move binding to inner type.
51
- binding: import_echo_schema.S.optional(import_echo_schema.S.String),
52
49
  // Reference to a source script if it exists within ECHO.
50
+ // TODO(burdon): Don't ref ScriptType directly (core).
53
51
  source: import_echo_schema.S.optional((0, import_echo_schema.ref)(ScriptType)),
54
- inputSchema: import_echo_schema.S.optional(import_echo_schema.JsonSchemaType)
52
+ inputSchema: import_echo_schema.S.optional(import_echo_schema.JsonSchemaType),
53
+ // Local binding to a function name.
54
+ binding: import_echo_schema.S.optional(import_echo_schema.S.String)
55
55
  }) {
56
56
  };
57
57
  var ScriptAction;
@@ -64,4 +64,4 @@ var ScriptAction;
64
64
  ScriptAction,
65
65
  ScriptType
66
66
  });
67
- //# sourceMappingURL=chunk-XJOH225K.cjs.map
67
+ //# sourceMappingURL=chunk-T4PYTKIW.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { JsonSchemaType, ref, S, TypedObject } from '@dxos/echo-schema';\nimport { TextType } from '@dxos/plugin-markdown/types';\n\n/**\n * Source script.\n */\nexport class ScriptType extends TypedObject({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n})({\n // TODO(burdon): Change to URI?\n name: S.optional(S.String),\n description: S.optional(S.String),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: S.optional(S.Boolean),\n source: ref(TextType),\n}) {}\n\n/**\n * Function deployment.\n */\n// TODO(burdon): Move to core/functions.\nexport class FunctionType extends TypedObject({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n})({\n // TODO(burdon): Rename to id/uri?\n name: S.NonEmptyString,\n version: S.Number,\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: S.optional(ref(ScriptType)),\n\n inputSchema: S.optional(JsonSchemaType),\n\n // Local binding to a function name.\n binding: S.optional(S.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type {\n GraphBuilderProvides,\n IntentResolverProvides,\n MetadataRecordsProvides,\n SettingsProvides,\n SurfaceProvides,\n TranslationsProvides,\n} from '@dxos/app-framework';\nimport { type SchemaProvides } from '@dxos/plugin-client';\nimport { type SpaceInitProvides } from '@dxos/plugin-space';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport enum ScriptAction {\n CREATE = `${SCRIPT_PLUGIN}/create`,\n}\n\nexport type ScriptSettingsProps = {};\n\nexport type ScriptPluginProvides = GraphBuilderProvides &\n IntentResolverProvides &\n MetadataRecordsProvides &\n SchemaProvides &\n SettingsProvides<ScriptSettingsProps> &\n SpaceInitProvides &\n SurfaceProvides &\n TranslationsProvides;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAoD;AACpD,mBAAyB;AAKlB,IAAMA,aAAN,kBAAyBC,gCAAY;EAC1CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;;EAEDC,MAAMC,qBAAEC,SAASD,qBAAEE,MAAM;EACzBC,aAAaH,qBAAEC,SAASD,qBAAEE,MAAM;;;EAGhCE,SAASJ,qBAAEC,SAASD,qBAAEK,OAAO;EAC7BC,YAAQC,wBAAIC,qBAAAA;AACd,CAAA,EAAA;AAAI;AAMG,IAAMC,eAAN,kBAA2Bb,gCAAY;EAC5CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;;EAEDC,MAAMC,qBAAEU;EACRZ,SAASE,qBAAEW;;;EAIXL,QAAQN,qBAAEC,aAASM,wBAAIZ,UAAAA,CAAAA;EAEvBiB,aAAaZ,qBAAEC,SAASY,iCAAAA;;EAGxBC,SAASd,qBAAEC,SAASD,qBAAEE,MAAM;AAC9B,CAAA,EAAA;AAAI;;UC1BQa,eAAAA;0CACD,GAAGC,mCAAAA,SAAsB,IAAA;GADxBD,iBAAAA,eAAAA,CAAAA,EAAAA;",
6
+ "names": ["ScriptType", "TypedObject", "typename", "version", "name", "S", "optional", "String", "description", "changed", "Boolean", "source", "ref", "TextType", "FunctionType", "NonEmptyString", "Number", "inputSchema", "JsonSchemaType", "binding", "ScriptAction", "SCRIPT_PLUGIN"]
7
+ }
@@ -31,20 +31,20 @@ __export(node_exports, {
31
31
  AutomationPanel: () => AutomationPanel,
32
32
  Bundler: () => import_chunk_WPP65EYS.Bundler,
33
33
  Compiler: () => Compiler,
34
- FunctionType: () => import_chunk_XJOH225K.FunctionType,
35
- ScriptAction: () => import_chunk_XJOH225K.ScriptAction,
34
+ FunctionType: () => import_chunk_T4PYTKIW.FunctionType,
35
+ ScriptAction: () => import_chunk_T4PYTKIW.ScriptAction,
36
36
  ScriptContainer: () => ScriptContainer,
37
37
  ScriptPlugin: () => ScriptPlugin,
38
38
  ScriptSettings: () => ScriptSettings,
39
39
  ScriptSettingsPanel: () => ScriptSettingsPanel,
40
- ScriptType: () => import_chunk_XJOH225K.ScriptType,
40
+ ScriptType: () => import_chunk_T4PYTKIW.ScriptType,
41
41
  default: () => src_default,
42
42
  initializeBundler: () => import_chunk_WPP65EYS.initializeBundler
43
43
  });
44
44
  module.exports = __toCommonJS(node_exports);
45
45
  var import_chunk_WPP65EYS = require("./chunk-WPP65EYS.cjs");
46
46
  var import_chunk_XS6GEYYH = require("./chunk-XS6GEYYH.cjs");
47
- var import_chunk_XJOH225K = require("./chunk-XJOH225K.cjs");
47
+ var import_chunk_T4PYTKIW = require("./chunk-T4PYTKIW.cjs");
48
48
  var import_chunk_6LYX73ZT = require("./chunk-6LYX73ZT.cjs");
49
49
  var import_esbuild = __toESM(require("esbuild-wasm/esbuild.wasm?url"));
50
50
  var import_react = __toESM(require("react"));
@@ -149,7 +149,7 @@ var ScriptSettingsPanel = ({ script }) => {
149
149
  const { t } = (0, import_react_ui2.useTranslation)(import_chunk_6LYX73ZT.SCRIPT_PLUGIN);
150
150
  const client = (0, import_react_client2.useClient)();
151
151
  const space = (0, import_echo2.getSpace)(script);
152
- const [fn] = (0, import_echo2.useQuery)(space, import_echo2.Filter.schema(import_chunk_XJOH225K.FunctionType, (fn2) => fn2.source === script));
152
+ const [fn] = (0, import_echo2.useQuery)(space, import_echo2.Filter.schema(import_chunk_T4PYTKIW.FunctionType, (fn2) => fn2.source === script));
153
153
  const handleNameChange = (0, import_react4.useCallback)((event) => {
154
154
  script.name = event.target.value;
155
155
  }, [
@@ -213,8 +213,8 @@ var ScriptSettingsPanel = ({ script }) => {
213
213
  onBlur: handleBindingBlur
214
214
  })))));
215
215
  };
216
- var AutomationPanel = (0, import_react2.lazy)(() => import("./AutomationPanel-3B5AGQQV.cjs"));
217
- var ScriptContainer = (0, import_react2.lazy)(() => import("./ScriptContainer-7VX44TH6.cjs"));
216
+ var AutomationPanel = (0, import_react2.lazy)(() => import("./AutomationPanel-VNLNP3EE.cjs"));
217
+ var ScriptContainer = (0, import_react2.lazy)(() => import("./ScriptContainer-K67ZWCKL.cjs"));
218
218
  var translations_default = [
219
219
  {
220
220
  "en-US": {
@@ -262,7 +262,7 @@ var ScriptPlugin = () => {
262
262
  settings: {},
263
263
  metadata: {
264
264
  records: {
265
- [import_chunk_XJOH225K.ScriptType.typename]: {
265
+ [import_chunk_T4PYTKIW.ScriptType.typename]: {
266
266
  placeholder: [
267
267
  "object title placeholder",
268
268
  {
@@ -280,8 +280,8 @@ var ScriptPlugin = () => {
280
280
  translations: translations_default,
281
281
  echo: {
282
282
  schema: [
283
- import_chunk_XJOH225K.ScriptType,
284
- import_chunk_XJOH225K.FunctionType
283
+ import_chunk_T4PYTKIW.ScriptType,
284
+ import_chunk_T4PYTKIW.FunctionType
285
285
  ]
286
286
  },
287
287
  space: {
@@ -292,7 +292,7 @@ var ScriptPlugin = () => {
292
292
  ns: import_chunk_6LYX73ZT.SCRIPT_PLUGIN
293
293
  }
294
294
  ],
295
- action: import_chunk_XJOH225K.ScriptAction.CREATE
295
+ action: import_chunk_T4PYTKIW.ScriptAction.CREATE
296
296
  }
297
297
  },
298
298
  graph: {
@@ -303,7 +303,7 @@ var ScriptPlugin = () => {
303
303
  return [];
304
304
  }
305
305
  return (0, import_plugin_graph.createExtension)({
306
- id: import_chunk_XJOH225K.ScriptAction.CREATE,
306
+ id: import_chunk_T4PYTKIW.ScriptAction.CREATE,
307
307
  filter: (node) => (0, import_plugin_graph.isActionGroup)(node) && node.id.startsWith(import_plugin_space.SpaceAction.ADD_OBJECT),
308
308
  actions: ({ node }) => {
309
309
  const id = node.id.split("/").at(-1);
@@ -321,7 +321,7 @@ var ScriptPlugin = () => {
321
321
  await dispatch([
322
322
  {
323
323
  plugin: import_chunk_6LYX73ZT.SCRIPT_PLUGIN,
324
- action: import_chunk_XJOH225K.ScriptAction.CREATE
324
+ action: import_chunk_T4PYTKIW.ScriptAction.CREATE
325
325
  },
326
326
  {
327
327
  action: import_plugin_space.SpaceAction.ADD_OBJECT,
@@ -359,7 +359,7 @@ var ScriptPlugin = () => {
359
359
  }) : null;
360
360
  }
361
361
  case "article": {
362
- if (data.object instanceof import_chunk_XJOH225K.ScriptType) {
362
+ if (data.object instanceof import_chunk_T4PYTKIW.ScriptType) {
363
363
  return /* @__PURE__ */ import_react.default.createElement(ScriptContainer, {
364
364
  script: data.object,
365
365
  env: compiler.environment
@@ -368,7 +368,7 @@ var ScriptPlugin = () => {
368
368
  break;
369
369
  }
370
370
  case "complementary--automation": {
371
- if (data.subject instanceof import_chunk_XJOH225K.ScriptType) {
371
+ if (data.subject instanceof import_chunk_T4PYTKIW.ScriptType) {
372
372
  return {
373
373
  node: /* @__PURE__ */ import_react.default.createElement(AutomationPanel, {
374
374
  subject: data.subject
@@ -379,7 +379,7 @@ var ScriptPlugin = () => {
379
379
  break;
380
380
  }
381
381
  case "complementary--settings": {
382
- if (data.subject instanceof import_chunk_XJOH225K.ScriptType) {
382
+ if (data.subject instanceof import_chunk_T4PYTKIW.ScriptType) {
383
383
  return /* @__PURE__ */ import_react.default.createElement(ScriptSettingsPanel, {
384
384
  script: data.subject
385
385
  });
@@ -393,9 +393,9 @@ var ScriptPlugin = () => {
393
393
  intent: {
394
394
  resolver: (intent) => {
395
395
  switch (intent.action) {
396
- case import_chunk_XJOH225K.ScriptAction.CREATE: {
396
+ case import_chunk_T4PYTKIW.ScriptAction.CREATE: {
397
397
  return {
398
- data: (0, import_echo_schema.create)(import_chunk_XJOH225K.ScriptType, {
398
+ data: (0, import_echo_schema.create)(import_chunk_T4PYTKIW.ScriptType, {
399
399
  source: (0, import_echo_schema.create)(import_types.TextType, {
400
400
  content: import_chunk_WPP65EYS.templates[0].source
401
401
  })