@dxos/plugin-script 0.8.3-staging.0fa589b → 0.8.4-main.1da679c
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/DeploymentDialog-QZSTVNIS.mjs +12 -0
- package/dist/lib/browser/{ScriptContainer-RSN52NH7.mjs → ScriptContainer-IA7YJMFR.mjs} +20 -16
- package/dist/lib/browser/ScriptContainer-IA7YJMFR.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-5Z3MUX4N.mjs → app-graph-builder-5NIA7SLT.mjs} +6 -6
- package/dist/lib/{node-esm/app-graph-builder-IOOUTHV2.mjs.map → browser/app-graph-builder-5NIA7SLT.mjs.map} +3 -3
- package/dist/lib/browser/blueprint-definition-ET5KZ46I.mjs +28 -0
- package/dist/lib/browser/blueprint-definition-ET5KZ46I.mjs.map +7 -0
- package/dist/lib/browser/chunk-4AUQEB2I.mjs +88 -0
- package/dist/lib/browser/chunk-4AUQEB2I.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YSQMXTYO.mjs → chunk-5TVBECWH.mjs} +3 -3
- package/dist/lib/browser/{chunk-3JLR2SHJ.mjs → chunk-B5QYN3AG.mjs} +52 -53
- package/dist/lib/browser/chunk-B5QYN3AG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WB3X5Z7Q.mjs → chunk-IS4OG2UW.mjs} +5 -6
- package/dist/lib/browser/chunk-IS4OG2UW.mjs.map +7 -0
- package/dist/lib/browser/chunk-KLGK77UK.mjs +283 -0
- package/dist/lib/browser/chunk-KLGK77UK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QJH7I2UV.mjs → chunk-NXKU3BNX.mjs} +40 -51
- package/dist/lib/browser/chunk-NXKU3BNX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6ZHHWU6S.mjs → chunk-QYAREHGH.mjs} +2 -2
- package/dist/lib/browser/{chunk-LA66DQGU.mjs → chunk-YCZPTTFO.mjs} +6 -6
- package/dist/lib/browser/chunk-YCZPTTFO.mjs.map +7 -0
- package/dist/lib/browser/{compiler-W4BYJYTL.mjs → compiler-O7MNN3XT.mjs} +28 -12
- package/dist/lib/browser/compiler-O7MNN3XT.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +34 -31
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-JOJNH4UX.mjs → intent-resolver-GGGTXYMB.mjs} +13 -14
- package/dist/lib/browser/intent-resolver-GGGTXYMB.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-7BKUWL2U.mjs → react-surface-C4ZTW4QA.mjs} +15 -16
- package/dist/lib/browser/react-surface-C4ZTW4QA.mjs.map +7 -0
- package/dist/lib/browser/{settings-Z22D6JVJ.mjs → settings-A4E4R7VL.mjs} +6 -6
- package/dist/lib/browser/{settings-Z22D6JVJ.mjs.map → settings-A4E4R7VL.mjs.map} +1 -1
- package/dist/lib/browser/templates/index.mjs +9 -0
- package/dist/lib/browser/types/index.mjs +10 -0
- package/dist/lib/node-esm/{DeploymentDialog-IA4CH6WZ.mjs → DeploymentDialog-G6EHEPXN.mjs} +5 -5
- package/dist/lib/node-esm/{ScriptContainer-4IOOIPBF.mjs → ScriptContainer-6AVJSLU4.mjs} +20 -16
- package/dist/lib/node-esm/ScriptContainer-6AVJSLU4.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-IOOUTHV2.mjs → app-graph-builder-V7QF54LT.mjs} +6 -6
- package/dist/lib/{browser/app-graph-builder-5Z3MUX4N.mjs.map → node-esm/app-graph-builder-V7QF54LT.mjs.map} +3 -3
- package/dist/lib/node-esm/blueprint-definition-AIYFOT7Q.mjs +30 -0
- package/dist/lib/node-esm/blueprint-definition-AIYFOT7Q.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2KJYPUQD.mjs → chunk-35M3CHYE.mjs} +3 -3
- package/dist/lib/node-esm/chunk-5OGRMRLA.mjs +90 -0
- package/dist/lib/node-esm/chunk-5OGRMRLA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AEB5TPEW.mjs → chunk-AHXJ6NQU.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UESZKXLR.mjs → chunk-JIPFLBYA.mjs} +5 -6
- package/dist/lib/node-esm/chunk-JIPFLBYA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MJJQBUOL.mjs → chunk-M642JUOZ.mjs} +40 -51
- package/dist/lib/node-esm/chunk-M642JUOZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-B4TP3LSZ.mjs → chunk-MPN2DI4P.mjs} +52 -53
- package/dist/lib/node-esm/chunk-MPN2DI4P.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WXKOIREL.mjs +284 -0
- package/dist/lib/node-esm/chunk-WXKOIREL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-T7XDCUTF.mjs → chunk-ZA36GO4T.mjs} +6 -6
- package/dist/lib/node-esm/chunk-ZA36GO4T.mjs.map +7 -0
- package/dist/lib/node-esm/{compiler-7PQ4D43R.mjs → compiler-TZUZ7I6H.mjs} +28 -12
- package/dist/lib/node-esm/compiler-TZUZ7I6H.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +34 -31
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-HTM5PSRZ.mjs → intent-resolver-DUJWXCRR.mjs} +13 -14
- package/dist/lib/{browser/intent-resolver-JOJNH4UX.mjs.map → node-esm/intent-resolver-DUJWXCRR.mjs.map} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-6UO64YOS.mjs → react-surface-5CM3KXFE.mjs} +15 -16
- package/dist/lib/node-esm/react-surface-5CM3KXFE.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-KZEGCDYX.mjs → settings-FZ25DUX4.mjs} +6 -6
- package/dist/lib/node-esm/{settings-KZEGCDYX.mjs.map → settings-FZ25DUX4.mjs.map} +1 -1
- package/dist/lib/node-esm/templates/index.mjs +10 -0
- package/dist/lib/node-esm/templates/index.mjs.map +7 -0
- package/dist/lib/node-esm/{types.mjs → types/index.mjs} +3 -6
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/compiler.d.ts +1 -1
- package/dist/types/src/capabilities/compiler.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/compiler/compiler.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts +139 -12
- package/dist/types/src/components/DeploymentDialog/DeploymentDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/DeploymentDialog/index.d.ts +1 -1
- package/dist/types/src/components/DeploymentDialog/index.d.ts.map +1 -1
- package/dist/types/src/components/FrameContainer/FrameContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptContainer.d.ts +3 -3
- package/dist/types/src/components/ScriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.d.ts.map +1 -1
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts +7 -10
- package/dist/types/src/components/ScriptToolbar/ScriptToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptObjectSettings.d.ts.map +1 -1
- package/dist/types/src/components/Settings/ScriptPluginSettings.d.ts.map +1 -1
- package/dist/types/src/components/TestPanel/TestContainer.d.ts +4 -3
- package/dist/types/src/components/TestPanel/TestContainer.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.d.ts.map +1 -1
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts +10 -3
- package/dist/types/src/components/TypescriptEditor/TypescriptEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/deploy.d.ts +4 -3
- package/dist/types/src/hooks/deploy.d.ts.map +1 -1
- package/dist/types/src/hooks/template.d.ts.map +1 -1
- package/dist/types/src/hooks/useCreateAndDeployScriptTemplates.d.ts.map +1 -1
- package/dist/types/src/templates/data-generator.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +2 -0
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +68 -176
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/schema.d.ts} +3 -5
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/util/deploy.d.ts +3 -3
- package/dist/types/src/util/deploy.d.ts.map +1 -1
- package/dist/types/src/util/functions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +79 -70
- package/src/ScriptPlugin.tsx +7 -7
- package/src/capabilities/app-graph-builder.ts +2 -2
- package/src/capabilities/artifact-definition.ts +9 -12
- package/src/capabilities/blueprint-definition.ts +30 -0
- package/src/capabilities/compiler.ts +2 -1
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +2 -5
- package/src/capabilities/react-surface.tsx +6 -5
- package/src/compiler/compiler.ts +1 -1
- package/src/components/DeploymentDialog/DeploymentDialog.stories.tsx +29 -17
- package/src/components/DeploymentDialog/DeploymentDialog.tsx +5 -5
- package/src/components/DeploymentDialog/index.ts +1 -1
- package/src/components/FrameContainer/FrameContainer.tsx +3 -2
- package/src/components/FrameContainer/frame.tsx +1 -1
- package/src/components/ScriptContainer.tsx +6 -4
- package/src/components/ScriptToolbar/ScriptToolbar.stories.tsx +19 -14
- package/src/components/ScriptToolbar/ScriptToolbar.tsx +14 -4
- package/src/components/Settings/ScriptObjectSettings.tsx +19 -23
- package/src/components/Settings/ScriptPluginSettings.tsx +33 -28
- package/src/components/TestPanel/TestContainer.tsx +9 -3
- package/src/components/TestPanel/TestPanel.tsx +1 -1
- package/src/components/TypescriptEditor/TypescriptEditor.stories.tsx +9 -16
- package/src/components/TypescriptEditor/TypescriptEditor.tsx +6 -4
- package/src/hooks/deploy.ts +11 -11
- package/src/hooks/template.ts +3 -3
- package/src/hooks/useCreateAndDeployScriptTemplates.ts +1 -0
- package/src/templates/chess.ts +1 -1
- package/src/templates/data-generator.ts +8 -4
- package/src/templates/discord.ts +4 -4
- package/src/templates/email.ts +2 -2
- package/src/templates/forex-effect.ts +3 -3
- package/src/templates/forex.ts +1 -1
- package/src/templates/gmail.ts +14 -55
- package/src/templates/index.ts +2 -0
- package/src/translations.ts +9 -6
- package/src/types/index.ts +5 -0
- package/src/{types.ts → types/schema.ts} +2 -7
- package/src/util/deploy.ts +20 -33
- package/src/util/functions.ts +4 -4
- package/dist/lib/browser/DeploymentDialog-RPPPWEEL.mjs +0 -12
- package/dist/lib/browser/ScriptContainer-RSN52NH7.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-A4TBQL75.mjs +0 -249
- package/dist/lib/browser/artifact-definition-A4TBQL75.mjs.map +0 -7
- package/dist/lib/browser/chunk-3FU4QZVP.mjs +0 -364
- package/dist/lib/browser/chunk-3FU4QZVP.mjs.map +0 -7
- package/dist/lib/browser/chunk-3JLR2SHJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-LA66DQGU.mjs.map +0 -7
- package/dist/lib/browser/chunk-QJH7I2UV.mjs.map +0 -7
- package/dist/lib/browser/chunk-WB3X5Z7Q.mjs.map +0 -7
- package/dist/lib/browser/compiler-W4BYJYTL.mjs.map +0 -7
- package/dist/lib/browser/react-surface-7BKUWL2U.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -13
- package/dist/lib/node/DeploymentDialog-C3EEYGRH.cjs +0 -33
- package/dist/lib/node/DeploymentDialog-C3EEYGRH.cjs.map +0 -7
- package/dist/lib/node/ScriptContainer-CAC7AISY.cjs +0 -278
- package/dist/lib/node/ScriptContainer-CAC7AISY.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-25OOTBW4.cjs +0 -80
- package/dist/lib/node/app-graph-builder-25OOTBW4.cjs.map +0 -7
- package/dist/lib/node/artifact-definition-QKZI6PTO.cjs +0 -265
- package/dist/lib/node/artifact-definition-QKZI6PTO.cjs.map +0 -7
- package/dist/lib/node/chunk-AU2FOE26.cjs +0 -369
- package/dist/lib/node/chunk-AU2FOE26.cjs.map +0 -7
- package/dist/lib/node/chunk-BUOBOT3V.cjs +0 -179
- package/dist/lib/node/chunk-BUOBOT3V.cjs.map +0 -7
- package/dist/lib/node/chunk-HCRW6T3G.cjs +0 -60
- package/dist/lib/node/chunk-HCRW6T3G.cjs.map +0 -7
- package/dist/lib/node/chunk-OSBMUJ4T.cjs +0 -580
- package/dist/lib/node/chunk-OSBMUJ4T.cjs.map +0 -7
- package/dist/lib/node/chunk-QG2X6J74.cjs +0 -52
- package/dist/lib/node/chunk-QG2X6J74.cjs.map +0 -7
- package/dist/lib/node/chunk-YO5W2IPQ.cjs +0 -251
- package/dist/lib/node/chunk-YO5W2IPQ.cjs.map +0 -7
- package/dist/lib/node/chunk-ZEV3VARQ.cjs +0 -34
- package/dist/lib/node/chunk-ZEV3VARQ.cjs.map +0 -7
- package/dist/lib/node/compiler-TFSJRLL4.cjs +0 -104
- package/dist/lib/node/compiler-TFSJRLL4.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -225
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-BQ2NKEM7.cjs +0 -100
- package/dist/lib/node/intent-resolver-BQ2NKEM7.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-EUKPDFU3.cjs +0 -120
- package/dist/lib/node/react-surface-EUKPDFU3.cjs.map +0 -7
- package/dist/lib/node/settings-WO53FLYZ.cjs +0 -38
- package/dist/lib/node/settings-WO53FLYZ.cjs.map +0 -7
- package/dist/lib/node/types.cjs +0 -34
- package/dist/lib/node/types.cjs.map +0 -7
- package/dist/lib/node-esm/ScriptContainer-4IOOIPBF.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-4XRYAP54.mjs +0 -250
- package/dist/lib/node-esm/artifact-definition-4XRYAP54.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-B4TP3LSZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MJJQBUOL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T7XDCUTF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UESZKXLR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W2DAXWHA.mjs +0 -365
- package/dist/lib/node-esm/chunk-W2DAXWHA.mjs.map +0 -7
- package/dist/lib/node-esm/compiler-7PQ4D43R.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HTM5PSRZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-6UO64YOS.mjs.map +0 -7
- package/dist/types/src/types.d.ts.map +0 -1
- /package/dist/lib/browser/{DeploymentDialog-RPPPWEEL.mjs.map → DeploymentDialog-QZSTVNIS.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-YSQMXTYO.mjs.map → chunk-5TVBECWH.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-6ZHHWU6S.mjs.map → chunk-QYAREHGH.mjs.map} +0 -0
- /package/dist/lib/browser/{types.mjs.map → templates/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/DeploymentDialog-IA4CH6WZ.mjs.map → browser/types/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{types.mjs.map → DeploymentDialog-G6EHEPXN.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-2KJYPUQD.mjs.map → chunk-35M3CHYE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-AEB5TPEW.mjs.map → chunk-AHXJ6NQU.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/deploy.ts", "../../../src/hooks/useToolbarState.ts", "../../../src/hooks/format.ts", "../../../src/hooks/template.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useMemo } from 'react';\n\nimport { FunctionType, type ScriptType, getUserFunctionIdInMetadata } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { Query, Ref, type Space, getMeta, getSpace, useQuery } from '@dxos/react-client/echo';\nimport { type TFunction } from '@dxos/react-ui';\nimport { createMenuAction } from '@dxos/react-ui-menu';\nimport { errorMessageColors } from '@dxos/react-ui-theme';\n\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { deployScript, getFunctionUrl, isScriptDeployed } from '../util';\n\nexport type DeployActionProperties = { type: 'deploy' } | { type: 'copy' };\n\nexport type DeployState = {\n deploying: boolean;\n deployed: boolean;\n functionUrl: string;\n error: string;\n};\n\nexport type CreateDeployOptions = {\n state: Partial<DeployState>;\n script: ScriptType;\n fn: FunctionType;\n space?: Space;\n existingFunctionId?: string;\n client: Client;\n t: TFunction;\n};\n\nexport const createDeploy = ({ state, script, space, fn, client, existingFunctionId, t }: CreateDeployOptions) => {\n // TODO(wittjosiah): Should this be an action?\n const errorItem = createMenuAction('error', () => {}, {\n label: state.error ?? ['no error label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--warning-circle--regular',\n hidden: !state.error,\n classNames: state.error && errorMessageColors,\n });\n\n const deployAction = createMenuAction<DeployActionProperties>(\n 'deploy',\n async () => {\n if (!script.source || !space) {\n return;\n }\n\n state.error = undefined;\n state.deploying = true;\n\n const result = await deployScript({ script, client, space, fn, existingFunctionId });\n\n if (!result.success) {\n log.catch(result.error);\n state.error = t('upload failed label');\n }\n\n state.deploying = false;\n },\n {\n type: 'deploy',\n label: [state.deploying ? 'pending label' : 'deploy label', { ns: SCRIPT_PLUGIN }],\n icon: state.deploying ? 'ph--spinner-gap--regular' : 'ph--cloud-arrow-up--regular',\n disabled: state.deploying,\n classNames: state.deploying ? '[&_svg]:animate-spin' : '',\n },\n );\n\n const copyAction = createMenuAction<DeployActionProperties>(\n 'copy',\n async () => {\n if (!state.functionUrl) {\n return;\n }\n await navigator.clipboard.writeText(state.functionUrl);\n },\n {\n type: 'copy',\n label: ['copy link label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--link--regular',\n disabled: !state.functionUrl,\n },\n );\n\n return {\n nodes: [errorItem, deployAction, copyAction],\n edges: [\n { source: 'root', target: 'error' },\n { source: 'root', target: 'deploy' },\n { source: 'root', target: 'copy' },\n ],\n };\n};\n\nexport const useDeployState = ({ state, script }: { state: Partial<DeployState>; script: ScriptType }) => {\n const { space, client, fn, existingFunctionId } = useDeployDeps({ script });\n useEffect(() => {\n if (!existingFunctionId) {\n return;\n }\n\n state.functionUrl = getFunctionUrl({\n script,\n fn,\n edgeUrl: client.config.values.runtime?.services?.edge?.url ?? '',\n });\n }, [existingFunctionId, space, fn, script, client.config.values.runtime?.services?.edge?.url]);\n\n useEffect(() => {\n state.deployed = isScriptDeployed({ script, fn });\n }, [script.changed, existingFunctionId, fn, script]);\n};\n\nexport const useDeployDeps = ({ script }: { script: ScriptType }) => {\n const space = getSpace(script);\n const [fn] = useQuery(space, Query.type(FunctionType, { source: Ref.make(script) }));\n const client = useClient();\n const existingFunctionId = useMemo(() => fn && getUserFunctionIdInMetadata(getMeta(fn)), [fn]);\n return { space, fn, client, existingFunctionId };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { live } from '@dxos/live-object';\n\nimport { type DeployState } from './deploy';\n\nexport type ScriptToolbarState = Partial<DeployState>;\n\n// TODO(burdon): Replace with context provider?\nexport const useToolbarState = (initialState: ScriptToolbarState = {}) => {\n return useMemo(() => live<ScriptToolbarState>(initialState), []);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { format } from 'prettier';\nimport prettierPluginEstree from 'prettier/plugins/estree';\nimport prettierPluginTypescript from 'prettier/plugins/typescript';\n\nimport { type ScriptType } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { createMenuAction } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\n\nexport type FormatActionProperties = { type: 'format' };\n\nexport const createFormat = (script: ScriptType) => {\n const formatAction = createMenuAction(\n 'format',\n async () => {\n if (!script.source) {\n return;\n }\n\n try {\n script.source.target!.content = await format(script.source.target!.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 },\n {\n label: ['format label', { ns: SCRIPT_PLUGIN }],\n icon: 'ph--magic-wand--regular',\n },\n );\n\n return {\n nodes: [formatAction],\n edges: [\n {\n source: 'root',\n target: 'format',\n },\n ],\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Obj } from '@dxos/echo';\nimport { FUNCTIONS_PRESET_META_KEY, type ScriptType } from '@dxos/functions';\nimport { createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';\n\nimport { SCRIPT_PLUGIN } from '../meta';\nimport { templates } from '../templates';\n\nexport type TemplateActionProperties = { type: 'template'; value: string };\n\nconst createTemplateSelectGroup = () => {\n return createMenuItemGroup('template-select', {\n label: ['template select group label', { ns: SCRIPT_PLUGIN }],\n variant: 'dropdownMenu',\n });\n};\n\nconst createTemplateSelectActions = (script: ScriptType) => {\n return templates.map((template) => {\n return createMenuAction<TemplateActionProperties>(\n `template--${template.id}`,\n () => {\n script.name = template.name;\n script.source!.target!.content = template.source;\n const metaKeys = Obj.getMeta(script).keys;\n const oldPresetIndex = metaKeys.findIndex((key) => key.source === FUNCTIONS_PRESET_META_KEY);\n if (oldPresetIndex >= 0) {\n metaKeys.splice(oldPresetIndex, 1);\n }\n if (template.presetId) {\n metaKeys.push({ source: FUNCTIONS_PRESET_META_KEY, id: template.presetId });\n }\n },\n {\n label: template.name,\n value: template.id,\n type: 'template',\n },\n );\n });\n};\n\nexport const createTemplateSelect = (script: ScriptType) => {\n const templateSelectGroup = createTemplateSelectGroup();\n const templateSelectActions = createTemplateSelectActions(script);\n return {\n nodes: [templateSelectGroup, ...templateSelectActions],\n edges: [\n { source: 'root', target: 'template-select' },\n ...templateSelectActions.map((action) => ({ source: 'template-select', target: action.id })),\n ],\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAIA,SAASA,WAAWC,eAAe;AAEnC,SAASC,cAA+BC,mCAAmC;AAC3E,SAASC,WAAW;AACpB,SAAsBC,iBAAiB;AACvC,SAASC,OAAOC,KAAiBC,SAASC,UAAUC,gBAAgB;AAEpE,SAASC,wBAAwB;AACjC,SAASC,0BAA0B;;AAwB5B,IAAMC,eAAe,CAAC,EAAEC,OAAOC,QAAQC,OAAOC,IAAIC,QAAQC,oBAAoBC,EAAC,MAAuB;AAE3G,QAAMC,YAAYC,iBAAiB,SAAS,MAAA;EAAO,GAAG;IACpDC,OAAOT,MAAMU,SAAS;MAAC;MAAkB;QAAEC,IAAIC;MAAc;;IAC7DC,MAAM;IACNC,QA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B,WAAAA;AACnC,QAAMwB,sBAAsB/B,0BAAAA;AAC5B,QAAMgC,wBAAwB1B,4BAA4BC,MAAAA;AAC1D,SAAO;IACL0B,OAAO;MAACF;SAAwBC;;IAChCE,OAAO;MACL;QAAEpB,QAAQ;QAAQC,QAAQ;MAAkB;SACzCiB,sBAAsBvB,IAAI,CAAC0B,YAAY;QAAErB,QAAQ;QAAmBC,QAAQoB,OAAOvB;MAAG,EAAA;;EAE7F;AACF;",
|
|
6
|
+
"names": ["useEffect", "useMemo", "FunctionType", "getUserFunctionIdInMetadata", "log", "useClient", "Query", "Ref", "getMeta", "getSpace", "useQuery", "createMenuAction", "errorMessageColors", "createDeploy", "state", "script", "space", "fn", "client", "existingFunctionId", "t", "errorItem", "createMenuAction", "label", "error", "ns", "SCRIPT_PLUGIN", "icon", "hidden", "classNames", "errorMessageColors", "deployAction", "source", "undefined", "deploying", "result", "deployScript", "success", "log", "catch", "type", "disabled", "copyAction", "functionUrl", "navigator", "clipboard", "writeText", "nodes", "edges", "target", "useDeployState", "useDeployDeps", "useEffect", "getFunctionUrl", "edgeUrl", "config", "values", "runtime", "services", "edge", "url", "deployed", "isScriptDeployed", "changed", "getSpace", "useQuery", "Query", "FunctionType", "Ref", "make", "useClient", "useMemo", "getUserFunctionIdInMetadata", "getMeta", "useMemo", "live", "useToolbarState", "initialState", "useMemo", "live", "format", "prettierPluginEstree", "prettierPluginTypescript", "log", "createMenuAction", "createFormat", "script", "formatAction", "createMenuAction", "source", "target", "content", "format", "parser", "plugins", "prettierPluginEstree", "prettierPluginTypescript", "semi", "singleQuote", "err", "log", "catch", "label", "ns", "SCRIPT_PLUGIN", "icon", "nodes", "edges", "Obj", "FUNCTIONS_PRESET_META_KEY", "createMenuAction", "createMenuItemGroup", "createTemplateSelectGroup", "createMenuItemGroup", "label", "ns", "SCRIPT_PLUGIN", "variant", "createTemplateSelectActions", "script", "templates", "map", "template", "createMenuAction", "id", "name", "source", "target", "content", "metaKeys", "Obj", "getMeta", "keys", "oldPresetIndex", "findIndex", "key", "FUNCTIONS_PRESET_META_KEY", "splice", "presetId", "push", "value", "type", "createTemplateSelect", "templateSelectGroup", "templateSelectActions", "nodes", "edges", "action"]
|
|
7
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ScriptAction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IS4OG2UW.mjs";
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
import { getInvocationUrl,
|
|
5
|
+
// src/util/functions.ts
|
|
6
|
+
import { getInvocationUrl, getUserFunctionIdInMetadata } from "@dxos/functions";
|
|
7
7
|
import { log } from "@dxos/log";
|
|
8
8
|
import { getMeta, getSpace } from "@dxos/react-client/echo";
|
|
9
|
-
var __dxlog_file = "/
|
|
9
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/util/functions.ts";
|
|
10
10
|
var getFunctionUrl = ({ script, fn, edgeUrl }) => {
|
|
11
11
|
const space = getSpace(script);
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
12
|
+
const existingFunctionId = fn && getUserFunctionIdInMetadata(getMeta(fn));
|
|
13
|
+
if (!existingFunctionId) {
|
|
14
14
|
return void 0;
|
|
15
15
|
}
|
|
16
|
-
return getInvocationUrl(
|
|
16
|
+
return getInvocationUrl(existingFunctionId, edgeUrl, {
|
|
17
17
|
spaceId: space?.id
|
|
18
18
|
});
|
|
19
19
|
};
|
|
@@ -58,18 +58,18 @@ var updateFunctionMetadata = (script, storedFunction, meta, functionId) => {
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
//
|
|
61
|
+
// src/util/deploy.ts
|
|
62
62
|
import { Obj, Ref } from "@dxos/echo";
|
|
63
|
-
import { FunctionType,
|
|
63
|
+
import { FunctionType, getUserFunctionIdInMetadata as getUserFunctionIdInMetadata2, setUserFunctionIdInMetadata } from "@dxos/functions";
|
|
64
64
|
import { Bundler } from "@dxos/functions/bundler";
|
|
65
65
|
import { incrementSemverPatch, uploadWorkerFunction } from "@dxos/functions/edge";
|
|
66
66
|
import { log as log2 } from "@dxos/log";
|
|
67
|
-
var __dxlog_file2 = "/
|
|
67
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/util/deploy.ts";
|
|
68
68
|
var isScriptDeployed = ({ script, fn }) => {
|
|
69
|
-
const
|
|
70
|
-
return Boolean(
|
|
69
|
+
const existingFunctionId = fn && getUserFunctionIdInMetadata2(Obj.getMeta(fn));
|
|
70
|
+
return Boolean(existingFunctionId) && !script.changed;
|
|
71
71
|
};
|
|
72
|
-
var deployScript = async ({ script, client, space, fn,
|
|
72
|
+
var deployScript = async ({ script, client, space, fn, existingFunctionId }) => {
|
|
73
73
|
const validationError = validateDeployInputs(script, space);
|
|
74
74
|
if (validationError) {
|
|
75
75
|
return {
|
|
@@ -78,17 +78,26 @@ var deployScript = async ({ script, client, space, fn, existingFunctionUrl }) =>
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
try {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
const bundler = new Bundler({
|
|
82
|
+
platform: "browser",
|
|
83
|
+
sandboxedModules: [],
|
|
84
|
+
remoteModules: {}
|
|
85
|
+
});
|
|
86
|
+
const buildResult = await bundler.bundle({
|
|
87
|
+
source: script.source.target.content
|
|
88
|
+
});
|
|
89
|
+
if ("error" in buildResult) {
|
|
90
|
+
throw buildResult.error || new Error("Bundle creation failed");
|
|
85
91
|
}
|
|
86
92
|
const { functionId, version, meta } = await uploadWorkerFunction({
|
|
87
93
|
client,
|
|
88
94
|
ownerPublicKey: space.key,
|
|
89
95
|
version: fn ? incrementSemverPatch(fn.version) : "0.0.1",
|
|
90
96
|
functionId: existingFunctionId,
|
|
91
|
-
|
|
97
|
+
entryPoint: buildResult.entryPoint,
|
|
98
|
+
assets: {
|
|
99
|
+
[buildResult.entryPoint]: buildResult.asset
|
|
100
|
+
}
|
|
92
101
|
});
|
|
93
102
|
if (functionId === void 0 || version === void 0) {
|
|
94
103
|
throw new Error(`Upload didn't return expected data: ${JSON.stringify({
|
|
@@ -99,18 +108,15 @@ var deployScript = async ({ script, client, space, fn, existingFunctionUrl }) =>
|
|
|
99
108
|
const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, functionId, version);
|
|
100
109
|
script.changed = false;
|
|
101
110
|
updateFunctionMetadata(script, storedFunction, meta, functionId);
|
|
102
|
-
|
|
103
|
-
functionId
|
|
104
|
-
});
|
|
105
|
-
setUserFunctionUrlInMetadata(Obj.getMeta(storedFunction), functionUrl);
|
|
111
|
+
setUserFunctionIdInMetadata(Obj.getMeta(storedFunction), functionId);
|
|
106
112
|
return {
|
|
107
113
|
success: true,
|
|
108
|
-
|
|
114
|
+
functionId
|
|
109
115
|
};
|
|
110
116
|
} catch (err) {
|
|
111
117
|
log2.catch(err, void 0, {
|
|
112
118
|
F: __dxlog_file2,
|
|
113
|
-
L:
|
|
119
|
+
L: 78,
|
|
114
120
|
S: void 0,
|
|
115
121
|
C: (f, a) => f(...a)
|
|
116
122
|
});
|
|
@@ -126,41 +132,24 @@ var validateDeployInputs = (script, space) => {
|
|
|
126
132
|
}
|
|
127
133
|
return null;
|
|
128
134
|
};
|
|
129
|
-
var extractFunctionId = (functionUrl) => {
|
|
130
|
-
return functionUrl?.split("/").at(-1);
|
|
131
|
-
};
|
|
132
|
-
var bundleScript = async (source) => {
|
|
133
|
-
const bundler = new Bundler({
|
|
134
|
-
platform: "browser",
|
|
135
|
-
sandboxedModules: [],
|
|
136
|
-
remoteModules: {}
|
|
137
|
-
});
|
|
138
|
-
const buildResult = await bundler.bundle({
|
|
139
|
-
source
|
|
140
|
-
});
|
|
141
|
-
if (buildResult.error || !buildResult.bundle) {
|
|
142
|
-
return {
|
|
143
|
-
error: buildResult.error || new Error("Bundle creation failed")
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
bundle: buildResult.bundle
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
135
|
var createOrUpdateFunctionInSpace = (space, fn, script, functionId, version) => {
|
|
151
136
|
if (fn) {
|
|
137
|
+
fn.name = script.name ?? "New Function";
|
|
152
138
|
fn.version = version;
|
|
153
139
|
return fn;
|
|
154
140
|
} else {
|
|
155
|
-
|
|
156
|
-
name:
|
|
141
|
+
const fn2 = Obj.make(FunctionType, {
|
|
142
|
+
name: script.name ?? "New Function",
|
|
157
143
|
version,
|
|
158
144
|
source: Ref.make(script)
|
|
159
|
-
})
|
|
145
|
+
});
|
|
146
|
+
space.db.add(fn2);
|
|
147
|
+
setUserFunctionIdInMetadata(Obj.getMeta(fn2), functionId);
|
|
148
|
+
return fn2;
|
|
160
149
|
}
|
|
161
150
|
};
|
|
162
151
|
|
|
163
|
-
//
|
|
152
|
+
// src/hooks/useCreateAndDeployScriptTemplates.ts
|
|
164
153
|
import { pipe } from "effect/Function";
|
|
165
154
|
import { useCallback, useState } from "react";
|
|
166
155
|
import { chain, createIntent, useIntentDispatcher } from "@dxos/app-framework";
|
|
@@ -169,7 +158,7 @@ import { ScriptType } from "@dxos/functions";
|
|
|
169
158
|
import { invariant } from "@dxos/invariant";
|
|
170
159
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
171
160
|
import { useClient } from "@dxos/react-client";
|
|
172
|
-
var __dxlog_file3 = "/
|
|
161
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-script/src/hooks/useCreateAndDeployScriptTemplates.ts";
|
|
173
162
|
var useCreateAndDeployScriptTemplates = (space, scriptTemplates) => {
|
|
174
163
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
175
164
|
const client = useClient();
|
|
@@ -230,4 +219,4 @@ export {
|
|
|
230
219
|
deployScript,
|
|
231
220
|
useCreateAndDeployScriptTemplates
|
|
232
221
|
};
|
|
233
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-NXKU3BNX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/util/functions.ts", "../../../src/util/deploy.ts", "../../../src/hooks/useCreateAndDeployScriptTemplates.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ScriptType, getInvocationUrl, getUserFunctionIdInMetadata } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { getMeta, getSpace } from '@dxos/react-client/echo';\n\n/**\n * Get the function URL for a given script and client configuration\n */\nexport const getFunctionUrl = ({\n script,\n fn,\n edgeUrl,\n}: {\n script: ScriptType;\n fn: any;\n edgeUrl: string;\n}): string | undefined => {\n const space = getSpace(script);\n const existingFunctionId = fn && getUserFunctionIdInMetadata(getMeta(fn));\n\n if (!existingFunctionId) {\n return undefined;\n }\n\n return getInvocationUrl(existingFunctionId, edgeUrl, {\n spaceId: space?.id,\n });\n};\n\nexport const updateFunctionMetadata = (script: ScriptType, storedFunction: any, meta: any, functionId: string) => {\n if (script.description !== undefined && script.description.trim() !== '') {\n storedFunction.description = script.description;\n } else if (meta.description) {\n storedFunction.description = meta.description;\n } else {\n log.verbose('no description in function metadata', { functionId });\n }\n\n if (meta.inputSchema) {\n storedFunction.inputSchema = meta.inputSchema;\n } else {\n log.verbose('no input schema in function metadata', { functionId });\n }\n\n if (meta.outputSchema) {\n storedFunction.outputSchema = meta.outputSchema;\n } else {\n log.verbose('no output schema in function metadata', { functionId });\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Client } from '@dxos/client';\nimport { Obj, Ref } from '@dxos/echo';\nimport {\n FunctionType,\n type ScriptType,\n getUserFunctionIdInMetadata,\n setUserFunctionIdInMetadata,\n} from '@dxos/functions';\nimport { Bundler } from '@dxos/functions/bundler';\nimport { incrementSemverPatch, uploadWorkerFunction } from '@dxos/functions/edge';\nimport { log } from '@dxos/log';\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { updateFunctionMetadata } from './functions';\n\nexport const isScriptDeployed = ({ script, fn }: { script: ScriptType; fn: any }): boolean => {\n const existingFunctionId = fn && getUserFunctionIdInMetadata(Obj.getMeta(fn));\n return Boolean(existingFunctionId) && !script.changed;\n};\n\ntype DeployScriptProps = {\n script: ScriptType;\n client: Client;\n space: Space;\n fn?: FunctionType;\n existingFunctionId?: string;\n};\n\ntype DeployScriptResult = { success: boolean; error?: Error; functionId?: string };\n\n/**\n * Deploy a script to a space, handling bundling and uploading to the FaaS infrastructure.\n */\nexport const deployScript = async ({\n script,\n client,\n space,\n fn,\n existingFunctionId,\n}: DeployScriptProps): Promise<DeployScriptResult> => {\n const validationError = validateDeployInputs(script, space);\n if (validationError) {\n return { success: false, error: validationError };\n }\n\n try {\n const bundler = new Bundler({ platform: 'browser', sandboxedModules: [], remoteModules: {} });\n const buildResult = await bundler.bundle({ source: script.source!.target!.content });\n if ('error' in buildResult) {\n throw buildResult.error || new Error('Bundle creation failed');\n }\n\n const { functionId, version, meta } = await uploadWorkerFunction({\n client,\n ownerPublicKey: space.key,\n version: fn ? incrementSemverPatch(fn.version) : '0.0.1',\n functionId: existingFunctionId,\n entryPoint: buildResult.entryPoint,\n assets: { [buildResult.entryPoint]: buildResult.asset },\n });\n\n if (functionId === undefined || version === undefined) {\n throw new Error(`Upload didn't return expected data: ${JSON.stringify({ functionId, version })}`);\n }\n\n const storedFunction = createOrUpdateFunctionInSpace(space, fn, script, functionId, version);\n script.changed = false;\n updateFunctionMetadata(script, storedFunction, meta, functionId);\n\n setUserFunctionIdInMetadata(Obj.getMeta(storedFunction), functionId);\n\n return { success: true, functionId };\n } catch (err: any) {\n log.catch(err);\n return { success: false, error: err };\n }\n};\n\n/**\n * Validate inputs for script deployment.\n */\nconst validateDeployInputs = (script: ScriptType, space: Space): Error | null => {\n if (!script.source || !space) {\n return new Error('Script source or space not available');\n }\n return null;\n};\n\nconst createOrUpdateFunctionInSpace = (\n space: Space,\n fn: FunctionType | undefined,\n script: ScriptType,\n functionId: string,\n version: string,\n): FunctionType => {\n if (fn) {\n fn.name = script.name ?? 'New Function';\n fn.version = version;\n return fn;\n } else {\n const fn = Obj.make(FunctionType, { name: script.name ?? 'New Function', version, source: Ref.make(script) });\n space.db.add(fn);\n setUserFunctionIdInMetadata(Obj.getMeta(fn), functionId);\n return fn;\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { pipe } from 'effect/Function';\nimport { useCallback, useState } from 'react';\n\nimport { chain, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { ScriptType } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { useClient } from '@dxos/react-client';\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { type Template } from '../templates';\nimport { ScriptAction } from '../types';\nimport { deployScript } from '../util';\n\ntype DeploymentStatus = 'idle' | 'pending' | 'success' | 'error';\n\n/**\n * Hook for creating and deploying multiple script templates concurrently.\n *\n * Takes a space and an array of script template IDs, then provides a callback\n * function that creates each script from its template and deploys it to the space.\n * All creation / deployment operations run concurrently for improved performance.\n */\nexport const useCreateAndDeployScriptTemplates = (space: Space | undefined, scriptTemplates: Template[]) => {\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n const client = useClient();\n const [status, setStatus] = useState<DeploymentStatus>('idle');\n const [error, setError] = useState<Error | undefined>(undefined);\n\n const handleCreateAndDeployScripts = useCallback(async () => {\n invariant(space);\n setStatus('pending');\n setError(undefined);\n\n const deploymentResults = await Promise.all(\n scriptTemplates.map(async (template) => {\n const result = await dispatch(\n pipe(\n createIntent(ScriptAction.Create, { space, initialTemplateId: template.id }),\n chain(SpaceAction.AddObject, { target: space }),\n ),\n );\n invariant(Obj.instanceOf(ScriptType, result.data?.object));\n\n return deployScript({ space, client, script: result.data.object });\n }),\n );\n\n const hasErrors = deploymentResults.some((result) => !result.success);\n setStatus(hasErrors ? 'error' : 'success');\n }, [space, dispatch, client, scriptTemplates]);\n\n // TODO(burdon): Return onCreateAndDeployScripts.\n return { handleCreateAndDeployScripts, status, error };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAA0BA,kBAAkBC,mCAAmC;AAC/E,SAASC,WAAW;AACpB,SAASC,SAASC,gBAAgB;;AAK3B,IAAMC,iBAAiB,CAAC,EAC7BC,QACAC,IACAC,QAAO,MAKR;AACC,QAAMC,QAAQL,SAASE,MAAAA;AACvB,QAAMI,qBAAqBH,MAAMN,4BAA4BE,QAAQI,EAAAA,CAAAA;AAErE,MAAI,CAACG,oBAAoB;AACvB,WAAOC;EACT;AAEA,SAAOX,iBAAiBU,oBAAoBF,SAAS;IACnDI,SAASH,OAAOI;EAClB,CAAA;AACF;AAEO,IAAMC,yBAAyB,CAACR,QAAoBS,gBAAqBC,MAAWC,eAAAA;AACzF,MAAIX,OAAOY,gBAAgBP,UAAaL,OAAOY,YAAYC,KAAI,MAAO,IAAI;AACxEJ,mBAAeG,cAAcZ,OAAOY;EACtC,WAAWF,KAAKE,aAAa;AAC3BH,mBAAeG,cAAcF,KAAKE;EACpC,OAAO;AACLhB,QAAIkB,QAAQ,uCAAuC;MAAEH;IAAW,GAAA;;;;;;EAClE;AAEA,MAAID,KAAKK,aAAa;AACpBN,mBAAeM,cAAcL,KAAKK;EACpC,OAAO;AACLnB,QAAIkB,QAAQ,wCAAwC;MAAEH;IAAW,GAAA;;;;;;EACnE;AAEA,MAAID,KAAKM,cAAc;AACrBP,mBAAeO,eAAeN,KAAKM;EACrC,OAAO;AACLpB,QAAIkB,QAAQ,yCAAyC;MAAEH;IAAW,GAAA;;;;;;EACpE;AACF;;;AC/CA,SAASM,KAAKC,WAAW;AACzB,SACEC,cAEAC,+BAAAA,8BACAC,mCACK;AACP,SAASC,eAAe;AACxB,SAASC,sBAAsBC,4BAA4B;AAC3D,SAASC,OAAAA,YAAW;;AAKb,IAAMC,mBAAmB,CAAC,EAAEC,QAAQC,GAAE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cAAU,SAAA;AACVG,aAASC,MAAAA;AAET,UAAMI,oBAAoB,MAAMC,QAAQC,IACtCjB,gBAAgBkB,IAAI,OAAOC,aAAAA;AACzB,YAAMC,SAAS,MAAMlB,SACnBmB,KACEC,aAAaC,aAAaC,QAAQ;QAAEzB;QAAO0B,mBAAmBN,SAASO;MAAG,CAAA,GAC1EC,MAAMC,YAAYC,WAAW;QAAEC,QAAQ/B;MAAM,CAAA,CAAA,CAAA;AAGjDe,gBAAUiB,KAAIC,WAAWC,YAAYb,OAAOc,MAAMC,MAAAA,GAAAA,QAAAA;;;;;;;;;AAElD,aAAOC,aAAa;QAAErC;QAAOK;QAAQiC,QAAQjB,OAAOc,KAAKC;MAAO,CAAA;IAClE,CAAA,CAAA;AAGF,UAAMG,YAAYvB,kBAAkBwB,KAAK,CAACnB,WAAW,CAACA,OAAOoB,OAAO;AACpEjC,cAAU+B,YAAY,UAAU,SAAA;EAClC,GAAG;IAACvC;IAAOG;IAAUE;IAAQJ;GAAgB;AAG7C,SAAO;IAAEY;IAA8BN;IAAQG;EAAM;AACvD;",
|
|
6
|
+
"names": ["getInvocationUrl", "getUserFunctionIdInMetadata", "log", "getMeta", "getSpace", "getFunctionUrl", "script", "fn", "edgeUrl", "space", "existingFunctionId", "undefined", "spaceId", "id", "updateFunctionMetadata", "storedFunction", "meta", "functionId", "description", "trim", "verbose", "inputSchema", "outputSchema", "Obj", "Ref", "FunctionType", "getUserFunctionIdInMetadata", "setUserFunctionIdInMetadata", "Bundler", "incrementSemverPatch", "uploadWorkerFunction", "log", "isScriptDeployed", "script", "fn", "existingFunctionId", "getUserFunctionIdInMetadata", "Obj", "getMeta", "Boolean", "changed", "deployScript", "client", "space", "validationError", "validateDeployInputs", "success", "error", "bundler", "Bundler", "platform", "sandboxedModules", "remoteModules", "buildResult", "bundle", "source", "target", "content", "Error", "functionId", "version", "meta", "uploadWorkerFunction", "ownerPublicKey", "key", "incrementSemverPatch", "entryPoint", "assets", "asset", "undefined", "JSON", "stringify", "storedFunction", "createOrUpdateFunctionInSpace", "updateFunctionMetadata", "setUserFunctionIdInMetadata", "err", "log", "catch", "name", "make", "FunctionType", "Ref", "db", "add", "pipe", "useCallback", "useState", "chain", "createIntent", "useIntentDispatcher", "Obj", "ScriptType", "invariant", "SpaceAction", "useClient", "useCreateAndDeployScriptTemplates", "space", "scriptTemplates", "dispatchPromise", "dispatch", "useIntentDispatcher", "client", "useClient", "status", "setStatus", "useState", "error", "setError", "undefined", "handleCreateAndDeployScripts", "useCallback", "invariant", "deploymentResults", "Promise", "all", "map", "template", "result", "pipe", "createIntent", "ScriptAction", "Create", "initialTemplateId", "id", "chain", "SpaceAction", "AddObject", "target", "Obj", "instanceOf", "ScriptType", "data", "object", "deployScript", "script", "hasErrors", "some", "success"]
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/meta.ts
|
|
2
2
|
var SCRIPT_PLUGIN = "dxos.org/plugin/script";
|
|
3
3
|
var meta = {
|
|
4
4
|
id: SCRIPT_PLUGIN,
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
meta,
|
|
26
26
|
defaultScriptsForIntegration
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-QYAREHGH.mjs.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCreateAndDeployScriptTemplates
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NXKU3BNX.mjs";
|
|
4
4
|
import {
|
|
5
5
|
SCRIPT_PLUGIN
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QYAREHGH.mjs";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// src/components/DeploymentDialog/DeploymentDialog.tsx
|
|
9
9
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
10
10
|
import React, { useEffect, useMemo } from "react";
|
|
11
|
-
import {
|
|
11
|
+
import { LayoutAction, createIntent, useIntentDispatcher } from "@dxos/app-framework";
|
|
12
12
|
import { getSpace } from "@dxos/react-client/echo";
|
|
13
13
|
import { Button, Dialog, Icon, useTranslation } from "@dxos/react-ui";
|
|
14
14
|
var DEPLOYMENT_DIALOG = `${SCRIPT_PLUGIN}/deployment/dialog`;
|
|
@@ -143,11 +143,11 @@ var DeploymentDialog = ({ accessToken, scriptTemplates }) => {
|
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
//
|
|
146
|
+
// src/components/DeploymentDialog/index.ts
|
|
147
147
|
var DeploymentDialog_default = DeploymentDialog;
|
|
148
148
|
|
|
149
149
|
export {
|
|
150
150
|
DEPLOYMENT_DIALOG,
|
|
151
151
|
DeploymentDialog_default
|
|
152
152
|
};
|
|
153
|
-
//# sourceMappingURL=chunk-
|
|
153
|
+
//# sourceMappingURL=chunk-YCZPTTFO.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DeploymentDialog/DeploymentDialog.tsx", "../../../src/components/DeploymentDialog/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useEffect, useMemo } from 'react';\n\nimport { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';\nimport { type DataType } from '@dxos/schema';\n\nimport { useCreateAndDeployScriptTemplates } from '../../hooks/useCreateAndDeployScriptTemplates';\nimport { SCRIPT_PLUGIN } from '../../meta';\nimport { type Template } from '../../templates';\n\nexport const DEPLOYMENT_DIALOG = `${SCRIPT_PLUGIN}/deployment/dialog`;\n\n// TODO(ZaymonFC):\n// - Show activity and feedback to the user.\n// - Only take an array of templateIds and get the name from the data.\n// - Pending / onError states.\n\nexport type DeploymentDialogProps = {\n accessToken: DataType.AccessToken;\n scriptTemplates: Template[];\n};\n\nexport const DeploymentDialog = ({ accessToken, scriptTemplates }: DeploymentDialogProps) => {\n const { t } = useTranslation(SCRIPT_PLUGIN);\n const space = useMemo(() => getSpace(accessToken), [accessToken]);\n\n // TODO(ZaymonFC): Thinking further. All of this should get moved to intents to run async in the background.\n // Deployment shouldn't be tied to the lifecycle of the dialogue component.\n const { handleCreateAndDeployScripts, status } = useCreateAndDeployScriptTemplates(space, scriptTemplates);\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n useEffect(() => {\n if (status === 'success') {\n // TODO(ZaymonFC): We can probably re-use this toast for normal script deployment.\n void dispatch(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${SCRIPT_PLUGIN}/deployment-success`,\n icon: 'ph--check--regular',\n duration: Infinity,\n title: ['script deployment toast label', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],\n description: ['script deployment toast description', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],\n closeLabel: ['script deployment toast close label', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],\n },\n }),\n );\n void dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));\n }\n if (status === 'error') {\n void dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));\n void dispatch(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${SCRIPT_PLUGIN}/deployment-error`,\n icon: 'ph--warning--regular',\n duration: Infinity,\n title: ['script deployment error toast label', { ns: SCRIPT_PLUGIN, count: scriptTemplates.length }],\n description: [\n 'script deployment error toast description',\n { ns: SCRIPT_PLUGIN, count: scriptTemplates.length },\n ],\n closeLabel: [\n 'script deployment error toast close label',\n { ns: SCRIPT_PLUGIN, count: scriptTemplates.length },\n ],\n },\n }),\n );\n }\n }, [status, dispatch]);\n\n return (\n <Dialog.Content>\n <div className='flex justify-between items-center'>\n <Dialog.Title>{t('deployment dialog title')}</Dialog.Title>\n <Dialog.Close asChild>\n <Button density='fine' variant='ghost'>\n <Icon icon='ph--x--regular' size={4} />\n </Button>\n </Dialog.Close>\n </div>\n <div role='none' className='plb-4'>\n {/* TODO: Implement deployment logic and UI. */}\n <p>{t('deployment dialog scripts found message', { count: scriptTemplates.length })}</p>\n <ul className='pbs-2'>\n {scriptTemplates.map((template) => {\n return <li key={template.id}>{template.name}</li>;\n })}\n </ul>\n </div>\n <div role='none' className='flex flex-row-reverse gap-1'>\n <Button variant='primary' onClick={handleCreateAndDeployScripts} disabled={status === 'pending'}>\n {status === 'pending'\n ? t('deployment dialog deploy functions pending button label', { count: scriptTemplates.length })\n : t('deployment dialog deploy functions button label', { count: scriptTemplates.length })}\n </Button>\n <Dialog.Close asChild disabled={status === 'pending'}>\n <Button disabled={status === 'pending'}>{t('deployment dialog skip button label')}</Button>\n </Dialog.Close>\n </div>\n </Dialog.Content>\n );\n};\n\nexport default DeploymentDialog;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { DEPLOYMENT_DIALOG, DeploymentDialog } from './DeploymentDialog';\n\nexport { DEPLOYMENT_DIALOG };\n\nexport default DeploymentDialog;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,SAASC,WAAWC,eAAe;AAE1C,SAASC,cAAcC,cAAcC,2BAA2B;AAChE,SAASC,gBAAgB;AACzB,SAASC,QAAQC,QAAQC,MAAMC,sBAAsB;AAO9C,IAAMC,oBAAoB,GAAGC,aAAAA;AAY7B,IAAMC,mBAAmB,CAAC,EAAEC,aAAaC,gBAAe,MAAyB;;;AACtF,UAAM,EAAEC,EAAC,IAAKC,eAAeL,aAAAA;AAC7B,UAAMM,QAAQC,QAAQ,MAAMC,SAASN,WAAAA,GAAc;MAACA;KAAY;AAIhE,UAAM,EAAEO,8BAA8BC,OAAM,IAAKC,kCAAkCL,OAAOH,eAAAA;AAC1F,UAAM,EAAES,iBAAiBC,SAAQ,IAAKC,oBAAAA;AAEtCC,cA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ACC,SAAAA;OACZ,sBAAA,cAACC,QAAAA;MAAOC,SAAQ;MAAOC,SAAQ;OAC7B,sBAAA,cAACC,MAAAA;MAAKtB,MAAK;MAAiBuB,MAAM;WAIxC,sBAAA,cAACT,OAAAA;MAAIU,MAAK;MAAOT,WAAU;OAEzB,sBAAA,cAACU,KAAAA,MAAG3C,EAAE,2CAA2C;MAAEuB,OAAOxB,gBAAgByB;IAAO,CAAA,CAAA,GACjF,sBAAA,cAACoB,MAAAA;MAAGX,WAAU;OACXlC,gBAAgB8C,IAAI,CAACC,aAAAA;AACpB,aAAO,sBAAA,cAACC,MAAAA;QAAGC,KAAKF,SAAS7B;SAAK6B,SAASG,IAAI;IAC7C,CAAA,CAAA,CAAA,GAGJ,sBAAA,cAACjB,OAAAA;MAAIU,MAAK;MAAOT,WAAU;OACzB,sBAAA,cAACI,QAAAA;MAAOE,SAAQ;MAAUW,SAAS7C;MAA8B8C,UAAU7C,WAAW;OACnFA,WAAW,YACRN,EAAE,2DAA2D;MAAEuB,OAAOxB,gBAAgByB;IAAO,CAAA,IAC7FxB,EAAE,mDAAmD;MAAEuB,OAAOxB,gBAAgByB;IAAO,CAAA,CAAA,GAE3F,sBAAA,cAACM,OAAOK,OAAK;MAACC,SAAAA;MAAQe,UAAU7C,WAAW;OACzC,sBAAA,cAAC+B,QAAAA;MAAOc,UAAU7C,WAAW;OAAYN,EAAE,qCAAA,CAAA,CAAA,CAAA,CAAA;;;;AAKrD;;;ACrGA,IAAA,2BAAeoD;",
|
|
6
|
+
"names": ["React", "useEffect", "useMemo", "LayoutAction", "createIntent", "useIntentDispatcher", "getSpace", "Button", "Dialog", "Icon", "useTranslation", "DEPLOYMENT_DIALOG", "SCRIPT_PLUGIN", "DeploymentDialog", "accessToken", "scriptTemplates", "t", "useTranslation", "space", "useMemo", "getSpace", "handleCreateAndDeployScripts", "status", "useCreateAndDeployScriptTemplates", "dispatchPromise", "dispatch", "useIntentDispatcher", "useEffect", "createIntent", "LayoutAction", "AddToast", "part", "subject", "id", "icon", "duration", "Infinity", "title", "ns", "count", "length", "description", "closeLabel", "UpdateDialog", "options", "state", "Dialog", "Content", "div", "className", "Title", "Close", "asChild", "Button", "density", "variant", "Icon", "size", "role", "p", "ul", "map", "template", "li", "key", "name", "onClick", "disabled", "DeploymentDialog"]
|
|
7
|
+
}
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ScriptCapabilities
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5TVBECWH.mjs";
|
|
4
|
+
import "./chunk-QYAREHGH.mjs";
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// src/capabilities/compiler.ts
|
|
7
7
|
import wasmUrl from "esbuild-wasm/esbuild.wasm?url";
|
|
8
8
|
import { contributes } from "@dxos/app-framework";
|
|
9
9
|
import { initializeBundler } from "@dxos/functions/bundler";
|
|
10
10
|
|
|
11
|
-
//
|
|
11
|
+
// src/compiler/compiler.ts
|
|
12
12
|
import { createDefaultMapFromCDN, createSystem, createVirtualTypeScriptEnvironment } from "@typescript/vfs";
|
|
13
13
|
import ts from "typescript";
|
|
14
14
|
import { invariant } from "@dxos/invariant";
|
|
15
|
-
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-script/src/compiler/compiler.ts";
|
|
16
29
|
var defaultOptions = {
|
|
17
30
|
lib: [
|
|
18
31
|
"DOM",
|
|
@@ -21,9 +34,6 @@ var defaultOptions = {
|
|
|
21
34
|
target: ts.ScriptTarget.ES2022
|
|
22
35
|
};
|
|
23
36
|
var Compiler = class {
|
|
24
|
-
constructor(_options = defaultOptions) {
|
|
25
|
-
this._options = _options;
|
|
26
|
-
}
|
|
27
37
|
async initialize() {
|
|
28
38
|
if (this._env) {
|
|
29
39
|
return;
|
|
@@ -59,10 +69,16 @@ var Compiler = class {
|
|
|
59
69
|
compile(fileName) {
|
|
60
70
|
return this.environment.languageService.getEmitOutput(fileName);
|
|
61
71
|
}
|
|
72
|
+
constructor(_options = defaultOptions) {
|
|
73
|
+
_define_property(this, "_options", void 0);
|
|
74
|
+
_define_property(this, "_env", void 0);
|
|
75
|
+
_define_property(this, "_fsMap", void 0);
|
|
76
|
+
this._options = _options;
|
|
77
|
+
}
|
|
62
78
|
};
|
|
63
79
|
|
|
64
|
-
//
|
|
65
|
-
var compiler_default = async () => {
|
|
80
|
+
// src/capabilities/compiler.ts
|
|
81
|
+
var compiler_default = (async () => {
|
|
66
82
|
const compiler = new Compiler();
|
|
67
83
|
await compiler.initialize();
|
|
68
84
|
compiler.setFile("/src/typings.d.ts", "declare module 'https://*';");
|
|
@@ -75,8 +91,8 @@ var compiler_default = async () => {
|
|
|
75
91
|
wasmUrl
|
|
76
92
|
});
|
|
77
93
|
return contributes(ScriptCapabilities.Compiler, compiler);
|
|
78
|
-
};
|
|
94
|
+
});
|
|
79
95
|
export {
|
|
80
96
|
compiler_default as default
|
|
81
97
|
};
|
|
82
|
-
//# sourceMappingURL=compiler-
|
|
98
|
+
//# sourceMappingURL=compiler-O7MNN3XT.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/compiler.ts", "../../../src/compiler/compiler.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @ts-ignore\nimport wasmUrl from 'esbuild-wasm/esbuild.wasm?url';\n\nimport { contributes } from '@dxos/app-framework';\nimport { initializeBundler } from '@dxos/functions/bundler';\n\nimport { Compiler } from '../compiler';\n\nimport { ScriptCapabilities } from './capabilities';\n\nexport default async () => {\n const compiler = new Compiler();\n\n await compiler.initialize();\n // TODO(wittjosiah): Fetch types for https modules.\n compiler.setFile('/src/typings.d.ts', \"declare module 'https://*';\");\n // TODO(wittjosiah): Proper function handler types.\n // TODO(wittjosiah): Remove.\n compiler.setFile(\n '/src/runtime.ts',\n `\n export const Filter: any = {};\n export type FunctionHandler = ({ event, context }: { event: any; context: any }) => Promise<Response>;\n export const functionHandler = (handler: FunctionHandler) => handler;\n `,\n );\n await initializeBundler({ wasmUrl });\n\n return contributes(ScriptCapabilities.Compiler, compiler);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport {\n type VirtualTypeScriptEnvironment,\n createDefaultMapFromCDN,\n createSystem,\n createVirtualTypeScriptEnvironment,\n} from '@typescript/vfs';\nimport ts from 'typescript';\n\nimport { invariant } from '@dxos/invariant';\n\nconst defaultOptions: ts.CompilerOptions = {\n lib: ['DOM', 'es2022'],\n target: ts.ScriptTarget.ES2022,\n};\n\nexport class Compiler {\n private _env: VirtualTypeScriptEnvironment | undefined;\n private _fsMap: Map<string, string> | undefined;\n\n constructor(private readonly _options: ts.CompilerOptions = defaultOptions) {}\n\n async initialize(): Promise<void> {\n if (this._env) {\n return;\n }\n\n // TODO(wittjosiah): Figure out how to get workers working in plugin packages.\n // https://github.com/val-town/codemirror-ts?tab=readme-ov-file#setup-worker\n this._fsMap = await createDefaultMapFromCDN(this._options, '5.5.4', true, ts);\n const system = createSystem(this._fsMap);\n this._env = createVirtualTypeScriptEnvironment(system, [], ts, this._options);\n }\n\n get environment() {\n invariant(this._env, 'Compiler environment not initialized.');\n return this._env;\n }\n\n setFile(fileName: string, content: string): void {\n invariant(this._fsMap, 'File system map not initialized.');\n this.environment.createFile(fileName, content);\n }\n\n compile(fileName: string): ts.EmitOutput {\n return this.environment.languageService.getEmitOutput(fileName);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAKA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MapFromCDN", "createSystem", "createVirtualTypeScriptEnvironment", "ts", "invariant", "defaultOptions", "lib", "target", "ScriptTarget", "ES2022", "Compiler", "initialize", "_env", "_fsMap", "_options", "system", "environment", "setFile", "fileName", "content", "createFile", "compile", "languageService", "getEmitOutput", "compiler", "Compiler", "initialize", "setFile", "initializeBundler", "wasmUrl", "contributes", "ScriptCapabilities"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ScriptCapabilities
|
|
3
|
-
} from "./chunk-YSQMXTYO.mjs";
|
|
4
1
|
import {
|
|
5
2
|
DeploymentDialog,
|
|
6
3
|
ScriptContainer,
|
|
@@ -9,61 +6,67 @@ import {
|
|
|
9
6
|
ScriptProperties,
|
|
10
7
|
TestContainer,
|
|
11
8
|
TestPanel
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-B5QYN3AG.mjs";
|
|
10
|
+
import {
|
|
11
|
+
ScriptCapabilities
|
|
12
|
+
} from "./chunk-5TVBECWH.mjs";
|
|
13
13
|
import {
|
|
14
14
|
DEPLOYMENT_DIALOG
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-YCZPTTFO.mjs";
|
|
16
|
+
import "./chunk-KLGK77UK.mjs";
|
|
17
|
+
import "./chunk-4AUQEB2I.mjs";
|
|
18
|
+
import "./chunk-NXKU3BNX.mjs";
|
|
18
19
|
import {
|
|
19
20
|
ScriptAction
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-IS4OG2UW.mjs";
|
|
21
22
|
import {
|
|
22
23
|
SCRIPT_PLUGIN,
|
|
23
24
|
defaultScriptsForIntegration,
|
|
24
25
|
meta
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-QYAREHGH.mjs";
|
|
26
27
|
|
|
27
|
-
//
|
|
28
|
+
// src/capabilities/index.ts
|
|
28
29
|
import { lazy } from "@dxos/app-framework";
|
|
29
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-
|
|
30
|
-
var
|
|
31
|
-
var Compiler = lazy(() => import("./compiler-
|
|
32
|
-
var IntentResolver = lazy(() => import("./intent-resolver-
|
|
33
|
-
var ReactSurface = lazy(() => import("./react-surface-
|
|
34
|
-
var ScriptSettings = lazy(() => import("./settings-
|
|
30
|
+
var AppGraphBuilder = lazy(() => import("./app-graph-builder-5NIA7SLT.mjs"));
|
|
31
|
+
var BlueprintDefinition = lazy(() => import("./blueprint-definition-ET5KZ46I.mjs"));
|
|
32
|
+
var Compiler = lazy(() => import("./compiler-O7MNN3XT.mjs"));
|
|
33
|
+
var IntentResolver = lazy(() => import("./intent-resolver-GGGTXYMB.mjs"));
|
|
34
|
+
var ReactSurface = lazy(() => import("./react-surface-C4ZTW4QA.mjs"));
|
|
35
|
+
var ScriptSettings = lazy(() => import("./settings-A4E4R7VL.mjs"));
|
|
35
36
|
|
|
36
|
-
//
|
|
37
|
+
// src/ScriptPlugin.tsx
|
|
37
38
|
import { Schema } from "effect";
|
|
38
|
-
import { Capabilities, contributes, createIntent, defineModule, definePlugin
|
|
39
|
+
import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from "@dxos/app-framework";
|
|
40
|
+
import { Ref } from "@dxos/echo";
|
|
39
41
|
import { ScriptType as ScriptType2 } from "@dxos/functions";
|
|
40
|
-
import { RefArray } from "@dxos/live-object";
|
|
41
42
|
import { ClientEvents } from "@dxos/plugin-client";
|
|
42
43
|
import { SpaceCapabilities } from "@dxos/plugin-space";
|
|
43
44
|
import { defineObjectForm } from "@dxos/plugin-space/types";
|
|
44
45
|
|
|
45
|
-
//
|
|
46
|
+
// src/events.ts
|
|
46
47
|
import { defineEvent } from "@dxos/app-framework";
|
|
47
48
|
(function(ScriptEvents2) {
|
|
48
49
|
ScriptEvents2.SetupCompiler = defineEvent(`${SCRIPT_PLUGIN}/event/setup-compiler`);
|
|
49
50
|
})(ScriptEvents || (ScriptEvents = {}));
|
|
50
51
|
var ScriptEvents;
|
|
51
52
|
|
|
52
|
-
//
|
|
53
|
-
import { Type } from "@dxos/echo";
|
|
53
|
+
// src/translations.ts
|
|
54
54
|
import { ScriptType } from "@dxos/functions";
|
|
55
|
-
var
|
|
55
|
+
var translations = [
|
|
56
56
|
{
|
|
57
57
|
"en-US": {
|
|
58
|
-
[
|
|
58
|
+
[ScriptType.typename]: {
|
|
59
59
|
"typename label": "Script",
|
|
60
60
|
"typename label_zero": "Scripts",
|
|
61
61
|
"typename label_one": "Script",
|
|
62
62
|
"typename label_other": "Scripts",
|
|
63
|
-
"object name placeholder": "New script"
|
|
63
|
+
"object name placeholder": "New script",
|
|
64
|
+
"rename object label": "Rename script",
|
|
65
|
+
"delete object label": "Delete script"
|
|
64
66
|
},
|
|
65
|
-
[
|
|
67
|
+
[meta.id]: {
|
|
66
68
|
"plugin name": "Scripts",
|
|
69
|
+
"settings title": "Scripts plugin settings",
|
|
67
70
|
"description label": "Description",
|
|
68
71
|
"description placeholder": "Enter description",
|
|
69
72
|
"binding placeholder": "Function name",
|
|
@@ -121,7 +124,7 @@ var translations_default = [
|
|
|
121
124
|
}
|
|
122
125
|
];
|
|
123
126
|
|
|
124
|
-
//
|
|
127
|
+
// src/ScriptPlugin.tsx
|
|
125
128
|
var ScriptPlugin = () => definePlugin(meta, [
|
|
126
129
|
defineModule({
|
|
127
130
|
id: `${meta.id}/module/settings`,
|
|
@@ -136,7 +139,7 @@ var ScriptPlugin = () => definePlugin(meta, [
|
|
|
136
139
|
defineModule({
|
|
137
140
|
id: `${meta.id}/module/translations`,
|
|
138
141
|
activatesOn: Events.SetupTranslations,
|
|
139
|
-
activate: () => contributes(Capabilities.Translations,
|
|
142
|
+
activate: () => contributes(Capabilities.Translations, translations)
|
|
140
143
|
}),
|
|
141
144
|
defineModule({
|
|
142
145
|
id: `${meta.id}/module/metadata`,
|
|
@@ -146,7 +149,7 @@ var ScriptPlugin = () => definePlugin(meta, [
|
|
|
146
149
|
metadata: {
|
|
147
150
|
icon: "ph--code--regular",
|
|
148
151
|
// TODO(wittjosiah): Move out of metadata.
|
|
149
|
-
loadReferences: async (script) => await
|
|
152
|
+
loadReferences: async (script) => await Ref.Array.loadAll([
|
|
150
153
|
script.source
|
|
151
154
|
])
|
|
152
155
|
}
|
|
@@ -184,9 +187,9 @@ var ScriptPlugin = () => definePlugin(meta, [
|
|
|
184
187
|
activate: IntentResolver
|
|
185
188
|
}),
|
|
186
189
|
defineModule({
|
|
187
|
-
id: `${meta.id}/module/
|
|
190
|
+
id: `${meta.id}/module/blueprint`,
|
|
188
191
|
activatesOn: Events.SetupArtifactDefinition,
|
|
189
|
-
activate:
|
|
192
|
+
activate: BlueprintDefinition
|
|
190
193
|
})
|
|
191
194
|
]);
|
|
192
195
|
export {
|