@dxos/plugin-automation 0.8.4-main.66e292d → 0.8.4-main.69d29f4
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/AutomationPanel-FAS6ADCW.mjs +11 -0
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs +56 -0
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs.map +7 -0
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs +129 -0
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs → FunctionsPanel-ZX4J75UM.mjs} +3 -3
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs +84 -0
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CZVA5NMD.mjs → chunk-54PANILA.mjs} +5 -5
- package/dist/lib/browser/chunk-BFUIVUQH.mjs +102 -0
- package/dist/lib/browser/chunk-BFUIVUQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-BKFQBKYO.mjs +8 -0
- package/dist/lib/browser/chunk-BKFQBKYO.mjs.map +7 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs +83 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LZQFZO3B.mjs → chunk-PZNBEKO5.mjs} +1 -1
- package/dist/lib/browser/chunk-PZNBEKO5.mjs.map +7 -0
- package/dist/lib/browser/chunk-QW3EM35H.mjs +248 -0
- package/dist/lib/browser/chunk-QW3EM35H.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4MBM6C6A.mjs → chunk-RAF2FJST.mjs} +14 -28
- package/dist/lib/browser/chunk-RAF2FJST.mjs.map +7 -0
- package/dist/lib/browser/chunk-YWLEY2FD.mjs +200 -0
- package/dist/lib/browser/chunk-YWLEY2FD.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +1107 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs +114 -0
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +3 -3
- package/dist/lib/browser/index.mjs +49 -57
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs +82 -0
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-TKU2EQ5A.mjs → react-surface-EV3AC62F.mjs} +12 -11
- package/dist/lib/browser/react-surface-EV3AC62F.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -4
- package/dist/lib/node-esm/{AutomationPanel-F5CTC6AT.mjs → AutomationPanel-B7NAGDFA.mjs} +4 -4
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs +57 -0
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs.map +7 -0
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs +130 -0
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-RVVCS6VH.mjs → FunctionsPanel-SS6GIVNU.mjs} +3 -3
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs +85 -0
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs +201 -0
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CEVIVRTY.mjs → chunk-5FXNN3MV.mjs} +1 -1
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3IYSC75Z.mjs → chunk-7QRUPEHH.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-7B6NAAI6.mjs → chunk-HQLVREIX.mjs} +14 -28
- package/dist/lib/node-esm/chunk-HQLVREIX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K7GCM342.mjs +10 -0
- package/dist/lib/node-esm/chunk-K7GCM342.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs +103 -0
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs +249 -0
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs +84 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +1108 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs +115 -0
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +3 -3
- package/dist/lib/node-esm/index.mjs +49 -57
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs +83 -0
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-7QROSEGH.mjs → react-surface-S6VZJCEZ.mjs} +12 -11
- package/dist/lib/node-esm/react-surface-S6VZJCEZ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -4
- package/dist/types/src/AutomationPlugin.d.ts +2 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +6 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +3 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/commands/index.d.ts +2 -0
- package/dist/types/src/cli/commands/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +10 -7
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +7 -6
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +70 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerSettings.d.ts +3 -3
- package/dist/types/src/components/TriggerSettings.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +6 -6
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +2 -2
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +202 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +30 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -49
- package/src/AutomationPlugin.tsx +13 -33
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +71 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{compute-runtime.ts → compute-runtime/compute-runtime.ts} +48 -44
- package/src/capabilities/compute-runtime/index.ts +7 -0
- package/src/capabilities/index.ts +4 -8
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +79 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +60 -0
- package/src/cli/commands/index.ts +5 -0
- package/src/cli/commands/trigger/create/index.ts +14 -0
- package/src/cli/commands/trigger/create/queue.ts +89 -0
- package/src/cli/commands/trigger/create/subscription.ts +128 -0
- package/src/cli/commands/trigger/create/timer.ts +93 -0
- package/src/cli/commands/trigger/index.ts +16 -0
- package/src/cli/commands/trigger/list.ts +67 -0
- package/src/cli/commands/trigger/options.ts +59 -0
- package/src/cli/commands/trigger/remove.ts +45 -0
- package/src/cli/commands/trigger/update/index.ts +14 -0
- package/src/cli/commands/trigger/update/queue.ts +195 -0
- package/src/cli/commands/trigger/update/subscription.ts +278 -0
- package/src/cli/commands/trigger/update/timer.ts +193 -0
- package/src/cli/commands/trigger/util.ts +395 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +23 -0
- package/src/components/AutomationPanel/AutomationPanel.tsx +33 -12
- package/src/components/AutomationSettings.tsx +1 -1
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +11 -16
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +8 -24
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +23 -31
- package/src/components/TriggerEditor/SpecSelector.tsx +8 -6
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +27 -24
- package/src/components/TriggerEditor/TriggerEditor.tsx +55 -42
- package/src/components/TriggerSettings.tsx +3 -3
- package/src/hooks/useComputeRuntimeCallback.ts +9 -10
- package/src/hooks/useTriggerRuntimeControls.ts +7 -7
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/translations.ts +2 -0
- package/src/{capabilities → types}/capabilities.ts +8 -7
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +23 -2
- package/dist/lib/browser/AutomationPanel-M4M77L4V.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-4HCI6KJR.mjs +0 -68
- package/dist/lib/browser/AutomationSettings-4HCI6KJR.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-CDVBRQCT.mjs +0 -144
- package/dist/lib/browser/FunctionsContainer-CDVBRQCT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs +0 -81
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +0 -7
- package/dist/lib/browser/chunk-4MBM6C6A.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W6QMY3L.mjs +0 -267
- package/dist/lib/browser/chunk-7W6QMY3L.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-T6ZESHDY.mjs +0 -191
- package/dist/lib/browser/chunk-T6ZESHDY.mjs.map +0 -7
- package/dist/lib/browser/chunk-TWWFNOIR.mjs +0 -109
- package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs +0 -15
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +0 -7
- package/dist/lib/browser/chunk-YBPJCY3F.mjs +0 -38
- package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-B4XJVY4Y.mjs +0 -113
- package/dist/lib/browser/compute-runtime-B4XJVY4Y.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs +0 -77
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TKU2EQ5A.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationSettings-BQLJIFRT.mjs +0 -69
- package/dist/lib/node-esm/AutomationSettings-BQLJIFRT.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-ZHHJPQAZ.mjs +0 -145
- package/dist/lib/node-esm/FunctionsContainer-ZHHJPQAZ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs +0 -82
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7B6NAAI6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CF2SWXPW.mjs +0 -268
- package/dist/lib/node-esm/chunk-CF2SWXPW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs +0 -39
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F76XVENA.mjs +0 -192
- package/dist/lib/node-esm/chunk-F76XVENA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs +0 -16
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs +0 -110
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-JUWTQXOV.mjs +0 -114
- package/dist/lib/node-esm/compute-runtime-JUWTQXOV.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7QROSEGH.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -20
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -87
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/capabilities/react-surface.tsx +0 -56
- package/src/events.ts +0 -11
- /package/dist/lib/browser/{AutomationPanel-M4M77L4V.mjs.map → AutomationPanel-FAS6ADCW.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs.map → FunctionsPanel-ZX4J75UM.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-CZVA5NMD.mjs.map → chunk-54PANILA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-F5CTC6AT.mjs.map → AutomationPanel-B7NAGDFA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-RVVCS6VH.mjs.map → FunctionsPanel-SS6GIVNU.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-3IYSC75Z.mjs.map → chunk-7QRUPEHH.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/react-surface/react-surface.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { useLayout } from '@dxos/app-framework/react';\nimport { Obj } from '@dxos/echo';\nimport { getSpace, parseId, useSpace } from '@dxos/react-client/echo';\n\nimport { AutomationSettings, FunctionsContainer } from '../../components';\nimport { meta } from '../../meta';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.ReactSurface, [\n Common.createSurface({\n id: `${meta.id}/space-settings-functions`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space) {\n return null;\n }\n\n return <FunctionsContainer space={space} />;\n },\n }),\n Common.createSurface({\n id: `${meta.id}/space-settings-automation`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space) {\n return null;\n }\n\n return <AutomationSettings space={space} />;\n },\n }),\n Common.createSurface({\n id: `${meta.id}/companion/automation`,\n role: 'article',\n filter: (data): data is { companionTo: Obj.Unknown; subject: 'automation' } =>\n Obj.isObject(data.companionTo) && data.subject === 'automation',\n component: ({ data }) => {\n return <AutomationSettings space={getSpace(data.companionTo)!} object={data.companionTo} />;\n },\n }),\n ]),\n ),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,WAAW;AAElB,SAASC,YAAYC,cAAc;AACnC,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,UAAUC,SAASC,gBAAgB;AAK5C,IAAA,wBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,OAAOJ,WAAWK,cAAc;EACrDD,OAAOE,cAAc;IACnBC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,OAAO;AACV,eAAO;MACT;AAEA,aAAO,sBAAA,cAACE,oBAAAA;QAAmBF;;IAC7B;EACF,CAAA;EACAf,OAAOE,cAAc;IACnBC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,OAAO;AACV,eAAO;MACT;AAEA,aAAO,sBAAA,cAACG,oBAAAA;QAAmBH;;IAC7B;EACF,CAAA;EACAf,OAAOE,cAAc;IACnBC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SACPY,IAAIC,SAASb,KAAKc,WAAW,KAAKd,KAAKC,YAAY;IACrDC,WAAW,CAAC,EAAEF,KAAI,MAAE;AAClB,aAAO,sBAAA,cAACW,oBAAAA;QAAmBH,OAAOO,SAASf,KAAKc,WAAW;QAAIE,QAAQhB,KAAKc;;IAC9E;EACF,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "React", "Capability", "Common", "useLayout", "Obj", "getSpace", "parseId", "useSpace", "Capability", "makeModule", "succeed", "contributes", "Common", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "subject", "component", "layout", "useLayout", "spaceId", "parseId", "workspace", "space", "useSpace", "FunctionsContainer", "AutomationSettings", "Obj", "isObject", "companionTo", "getSpace", "object"]
|
|
7
|
+
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AutomationAction
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
AutomationAction,
|
|
3
|
+
AutomationCapabilities,
|
|
4
|
+
AutomationEvents,
|
|
5
|
+
AutomationOperation
|
|
6
|
+
} from "../chunk-JOXPQ27I.mjs";
|
|
7
|
+
import "../chunk-PZNBEKO5.mjs";
|
|
5
8
|
export {
|
|
6
|
-
AutomationAction
|
|
9
|
+
AutomationAction,
|
|
10
|
+
AutomationCapabilities,
|
|
11
|
+
AutomationEvents,
|
|
12
|
+
AutomationOperation
|
|
7
13
|
};
|
|
8
14
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -2,11 +2,11 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
AutomationPanel,
|
|
4
4
|
AutomationPanel_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-2CKVH7JC.mjs";
|
|
6
|
+
import "./chunk-LJAXQ6CX.mjs";
|
|
7
|
+
import "./chunk-5FXNN3MV.mjs";
|
|
8
8
|
export {
|
|
9
9
|
AutomationPanel,
|
|
10
10
|
AutomationPanel_default as default
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=AutomationPanel-
|
|
12
|
+
//# sourceMappingURL=AutomationPanel-B7NAGDFA.mjs.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
useTriggerRuntimeControls
|
|
4
|
+
} from "./chunk-HQLVREIX.mjs";
|
|
5
|
+
import "./chunk-RX52VKI2.mjs";
|
|
6
|
+
import {
|
|
7
|
+
AutomationPanel
|
|
8
|
+
} from "./chunk-2CKVH7JC.mjs";
|
|
9
|
+
import "./chunk-LJAXQ6CX.mjs";
|
|
10
|
+
import {
|
|
11
|
+
meta
|
|
12
|
+
} from "./chunk-5FXNN3MV.mjs";
|
|
13
|
+
|
|
14
|
+
// src/components/AutomationSettings.tsx
|
|
15
|
+
import React2 from "react";
|
|
16
|
+
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
17
|
+
import { ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
18
|
+
|
|
19
|
+
// src/components/TriggerSettings.tsx
|
|
20
|
+
import React from "react";
|
|
21
|
+
import { Input, useTranslation } from "@dxos/react-ui";
|
|
22
|
+
import { ControlItemInput } from "@dxos/react-ui-form";
|
|
23
|
+
var TriggersSettings = ({ db }) => {
|
|
24
|
+
const { triggers, isRunning, start, stop } = useTriggerRuntimeControls(db);
|
|
25
|
+
const { t } = useTranslation(meta.id);
|
|
26
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
27
|
+
className: "container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
|
|
28
|
+
}, /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
29
|
+
title: t("runtime label"),
|
|
30
|
+
description: t("runtime description")
|
|
31
|
+
}, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
32
|
+
classNames: "justify-self-end",
|
|
33
|
+
checked: isRunning,
|
|
34
|
+
onCheckedChange: isRunning ? stop : start
|
|
35
|
+
})));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/components/AutomationSettings.tsx
|
|
39
|
+
var AutomationSettings = (props) => {
|
|
40
|
+
const { t } = useTranslation2(meta.id);
|
|
41
|
+
return /* @__PURE__ */ React2.createElement(ControlPage, null, /* @__PURE__ */ React2.createElement(ControlSection, {
|
|
42
|
+
title: t("automation verbose label", {
|
|
43
|
+
ns: meta.id
|
|
44
|
+
}),
|
|
45
|
+
description: t("automation description", {
|
|
46
|
+
ns: meta.id
|
|
47
|
+
})
|
|
48
|
+
}, /* @__PURE__ */ React2.createElement(AutomationPanel, props), /* @__PURE__ */ React2.createElement(TriggersSettings, {
|
|
49
|
+
db: props.space.db
|
|
50
|
+
})));
|
|
51
|
+
};
|
|
52
|
+
var AutomationSettings_default = AutomationSettings;
|
|
53
|
+
export {
|
|
54
|
+
AutomationSettings,
|
|
55
|
+
AutomationSettings_default as default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=AutomationSettings-M5PMZJ6P.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/AutomationSettings.tsx", "../../../src/components/TriggerSettings.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlPage, ControlSection } from '@dxos/react-ui-form';\n\nimport { meta } from '../meta';\n\nimport { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';\nimport { TriggersSettings } from './TriggerSettings';\n\nexport const AutomationSettings = (props: AutomationPanelProps) => {\n const { t } = useTranslation(meta.id);\n return (\n <ControlPage>\n <ControlSection\n title={t('automation verbose label', { ns: meta.id })}\n description={t('automation description', { ns: meta.id })}\n >\n <AutomationPanel {...props} />\n <TriggersSettings db={props.space.db} />\n </ControlSection>\n </ControlPage>\n );\n};\n\nexport default AutomationSettings;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Database } from '@dxos/echo';\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { ControlItemInput } from '@dxos/react-ui-form';\n\nimport { useTriggerRuntimeControls } from '../hooks';\nimport { meta } from '../meta';\n\nexport const TriggersSettings = ({ db }: { db: Database.Database }) => {\n const { triggers, isRunning, start, stop } = useTriggerRuntimeControls(db);\n const { t } = useTranslation(meta.id);\n\n return (\n <div className='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]'>\n <ControlItemInput title={t('runtime label')} description={t('runtime description')}>\n <Input.Switch classNames='justify-self-end' checked={isRunning} onCheckedChange={isRunning ? stop : start} />\n </ControlItemInput>\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,kBAAAA,uBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;;;ACH5C,OAAOC,WAAW;AAGlB,SAASC,OAAOC,sBAAsB;AACtC,SAASC,wBAAwB;AAK1B,IAAMC,mBAAmB,CAAC,EAAEC,GAAE,MAA6B;AAChE,QAAM,EAAEC,UAAUC,WAAWC,OAAOC,KAAI,IAAKC,0BAA0BL,EAAAA;AACvE,QAAM,EAAEM,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,SACE,sBAAA,cAACC,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACC,kBAAAA;IAAiBC,OAAOP,EAAE,eAAA;IAAkBQ,aAAaR,EAAE,qBAAA;KAC1D,sBAAA,cAACS,MAAMC,QAAM;IAACC,YAAW;IAAmBC,SAAShB;IAAWiB,iBAAiBjB,YAAYE,OAAOD;;AAI5G;;;ADVO,IAAMiB,qBAAqB,CAACC,UAAAA;AACjC,QAAM,EAAEC,EAAC,IAAKC,gBAAeC,KAAKC,EAAE;AACpC,SACE,gBAAAC,OAAA,cAACC,aAAAA,MACC,gBAAAD,OAAA,cAACE,gBAAAA;IACCC,OAAOP,EAAE,4BAA4B;MAAEQ,IAAIN,KAAKC;IAAG,CAAA;IACnDM,aAAaT,EAAE,0BAA0B;MAAEQ,IAAIN,KAAKC;IAAG,CAAA;KAEvD,gBAAAC,OAAA,cAACM,iBAAoBX,KAAAA,GACrB,gBAAAK,OAAA,cAACO,kBAAAA;IAAiBC,IAAIb,MAAMc,MAAMD;;AAI1C;AAEA,IAAA,6BAAed;",
|
|
6
|
+
"names": ["React", "useTranslation", "ControlPage", "ControlSection", "React", "Input", "useTranslation", "ControlItemInput", "TriggersSettings", "db", "triggers", "isRunning", "start", "stop", "useTriggerRuntimeControls", "t", "useTranslation", "meta", "id", "div", "className", "ControlItemInput", "title", "description", "Input", "Switch", "classNames", "checked", "onCheckedChange", "AutomationSettings", "props", "t", "useTranslation", "meta", "id", "React", "ControlPage", "ControlSection", "title", "ns", "description", "AutomationPanel", "TriggersSettings", "db", "space"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
FunctionsPanel
|
|
4
|
+
} from "./chunk-KWKWOGS5.mjs";
|
|
5
|
+
import {
|
|
6
|
+
meta
|
|
7
|
+
} from "./chunk-5FXNN3MV.mjs";
|
|
8
|
+
|
|
9
|
+
// src/components/FunctionsContainer.tsx
|
|
10
|
+
import React2 from "react";
|
|
11
|
+
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
12
|
+
import { ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
13
|
+
|
|
14
|
+
// src/components/FunctionsRegistry/FunctionsRegistry.tsx
|
|
15
|
+
import * as Schema from "effect/Schema";
|
|
16
|
+
import { useState } from "react";
|
|
17
|
+
import React, { useCallback } from "react";
|
|
18
|
+
import { Function } from "@dxos/functions";
|
|
19
|
+
import { getDeployedFunctions } from "@dxos/functions-runtime/edge";
|
|
20
|
+
import { useClient } from "@dxos/react-client";
|
|
21
|
+
import { Filter, Query, useQuery } from "@dxos/react-client/echo";
|
|
22
|
+
import { useAsyncEffect } from "@dxos/react-ui";
|
|
23
|
+
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
24
|
+
import { controlItemClasses } from "@dxos/react-ui-form";
|
|
25
|
+
import { List } from "@dxos/react-ui-list";
|
|
26
|
+
import { ghostHover, mx } from "@dxos/ui-theme";
|
|
27
|
+
var grid = "grid grid-cols-[1fr_1fr_auto] min-bs-[2.5rem]";
|
|
28
|
+
var FunctionsRegistry = ({ space }) => {
|
|
29
|
+
const client = useClient();
|
|
30
|
+
const [loading, setLoading] = useState(true);
|
|
31
|
+
const [functions, setFunctions] = useState([]);
|
|
32
|
+
const { t } = useTranslation(meta.id);
|
|
33
|
+
const dbFunctions = useQuery(space.db, Filter.type(Function.Function));
|
|
34
|
+
const state = (func) => {
|
|
35
|
+
const dbFunction = dbFunctions.find((f) => f.key === func.key);
|
|
36
|
+
if (!dbFunction) {
|
|
37
|
+
return "import";
|
|
38
|
+
}
|
|
39
|
+
if (dbFunction.version === func.version && dbFunction.updated === func.updated) {
|
|
40
|
+
return "none";
|
|
41
|
+
}
|
|
42
|
+
return "update";
|
|
43
|
+
};
|
|
44
|
+
useAsyncEffect(async () => {
|
|
45
|
+
setLoading(true);
|
|
46
|
+
const functions2 = await getDeployedFunctions(client, true);
|
|
47
|
+
setFunctions(functions2);
|
|
48
|
+
setLoading(false);
|
|
49
|
+
}, []);
|
|
50
|
+
const hanleImportOrUpdate = useCallback(async (func) => {
|
|
51
|
+
const functions2 = await space.db.query(Query.type(Function.Function, {
|
|
52
|
+
key: func.key
|
|
53
|
+
})).run();
|
|
54
|
+
const [existingFunc] = functions2;
|
|
55
|
+
if (!existingFunc) {
|
|
56
|
+
space.db.add(func);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
Function.setFrom(existingFunc, func);
|
|
60
|
+
}, [
|
|
61
|
+
space
|
|
62
|
+
]);
|
|
63
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
64
|
+
role: "none",
|
|
65
|
+
className: mx(controlItemClasses)
|
|
66
|
+
}, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
67
|
+
items: functions,
|
|
68
|
+
isItem: Schema.is(Function.Function),
|
|
69
|
+
getId: (func) => func.id
|
|
70
|
+
}, ({ items }) => /* @__PURE__ */ React.createElement("div", {
|
|
71
|
+
role: "list",
|
|
72
|
+
className: "flex flex-col is-full"
|
|
73
|
+
}, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
|
|
74
|
+
key: func.id,
|
|
75
|
+
item: func,
|
|
76
|
+
classNames: mx(grid, ghostHover, "items-center", "pli-2", "min-bs-[3rem]")
|
|
77
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
78
|
+
className: "flex flex-col truncate"
|
|
79
|
+
}, /* @__PURE__ */ React.createElement(List.ItemTitle, {
|
|
80
|
+
classNames: "truncate"
|
|
81
|
+
}, func.name), /* @__PURE__ */ React.createElement("div", {
|
|
82
|
+
className: "text-xs text-description truncate"
|
|
83
|
+
}, func.key)), /* @__PURE__ */ React.createElement("div", {
|
|
84
|
+
className: "flex flex-col truncate"
|
|
85
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
86
|
+
className: "text-xs text-description truncate"
|
|
87
|
+
}, func.version), /* @__PURE__ */ React.createElement("div", {
|
|
88
|
+
className: "text-xs text-description truncate"
|
|
89
|
+
}, func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : "")), /* @__PURE__ */ React.createElement(IconButton, {
|
|
90
|
+
iconOnly: true,
|
|
91
|
+
icon: state(func) === "update" ? "ph--arrows-clockwise--regular" : "ph--download--regular",
|
|
92
|
+
label: state(func) === "update" ? t("update function button label") : t("import function button label"),
|
|
93
|
+
disabled: state(func) === "none",
|
|
94
|
+
onClick: () => hanleImportOrUpdate(func)
|
|
95
|
+
}))))), functions.length === 0 && !loading && /* @__PURE__ */ React.createElement("div", {
|
|
96
|
+
className: "text-center plb-4 text-gray-500"
|
|
97
|
+
}, t("no functions found")), loading && /* @__PURE__ */ React.createElement("div", {
|
|
98
|
+
className: "text-center plb-4 text-gray-500"
|
|
99
|
+
}, t("loading functions")));
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/components/FunctionsContainer.tsx
|
|
103
|
+
var FunctionsContainer = ({ space }) => {
|
|
104
|
+
const { t } = useTranslation2(meta.id);
|
|
105
|
+
return /* @__PURE__ */ React2.createElement(ControlPage, null, /* @__PURE__ */ React2.createElement(ControlSection, {
|
|
106
|
+
title: t("functions verbose label", {
|
|
107
|
+
ns: meta.id
|
|
108
|
+
}),
|
|
109
|
+
description: t("functions description", {
|
|
110
|
+
ns: meta.id
|
|
111
|
+
})
|
|
112
|
+
}, /* @__PURE__ */ React2.createElement(FunctionsPanel, {
|
|
113
|
+
space
|
|
114
|
+
})), /* @__PURE__ */ React2.createElement(ControlSection, {
|
|
115
|
+
title: t("functions registry verbose label", {
|
|
116
|
+
ns: meta.id
|
|
117
|
+
}),
|
|
118
|
+
description: t("functions registry description", {
|
|
119
|
+
ns: meta.id
|
|
120
|
+
})
|
|
121
|
+
}, /* @__PURE__ */ React2.createElement(FunctionsRegistry, {
|
|
122
|
+
space
|
|
123
|
+
})));
|
|
124
|
+
};
|
|
125
|
+
var FunctionsContainer_default = FunctionsContainer;
|
|
126
|
+
export {
|
|
127
|
+
FunctionsContainer,
|
|
128
|
+
FunctionsContainer_default as default
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=FunctionsContainer-J4O2ULWR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/FunctionsContainer.tsx", "../../../src/components/FunctionsRegistry/FunctionsRegistry.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlPage, ControlSection } from '@dxos/react-ui-form';\n\nimport { meta } from '../meta';\n\nimport { FunctionsPanel } from './FunctionsPanel';\nimport { FunctionsRegistry } from './FunctionsRegistry';\n\nexport const FunctionsContainer = ({ space }: { space: Space }) => {\n const { t } = useTranslation(meta.id);\n return (\n <ControlPage>\n <ControlSection\n title={t('functions verbose label', { ns: meta.id })}\n description={t('functions description', { ns: meta.id })}\n >\n <FunctionsPanel space={space} />\n </ControlSection>\n <ControlSection\n title={t('functions registry verbose label', { ns: meta.id })}\n description={t('functions registry description', { ns: meta.id })}\n >\n <FunctionsRegistry space={space} />\n </ControlSection>\n </ControlPage>\n );\n};\n\nexport default FunctionsContainer;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport { useState } from 'react';\nimport React, { useCallback } from 'react';\n\nimport { Function } from '@dxos/functions';\nimport { getDeployedFunctions } from '@dxos/functions-runtime/edge';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';\nimport { useAsyncEffect } from '@dxos/react-ui';\nimport { IconButton, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/ui-theme';\n\nimport { meta } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_1fr_auto] min-bs-[2.5rem]';\n\ntype FunctionsRegistryProps = {\n space: Space;\n};\n\nexport const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {\n const client = useClient();\n const [loading, setLoading] = useState(true);\n const [functions, setFunctions] = useState<Function.Function[]>([]);\n const { t } = useTranslation(meta.id);\n\n const dbFunctions = useQuery(space.db, Filter.type(Function.Function));\n\n const state = (func: Function.Function) => {\n const dbFunction = dbFunctions.find((f) => f.key === func.key);\n if (!dbFunction) {\n return 'import';\n }\n if (dbFunction.version === func.version && dbFunction.updated === func.updated) {\n return 'none';\n }\n return 'update';\n };\n\n useAsyncEffect(async () => {\n setLoading(true);\n const functions = await getDeployedFunctions(client, true);\n setFunctions(functions);\n setLoading(false);\n }, []);\n\n const hanleImportOrUpdate = useCallback(\n async (func: Function.Function) => {\n const functions = await space.db.query(Query.type(Function.Function, { key: func.key })).run();\n const [existingFunc] = functions;\n if (!existingFunc) {\n space.db.add(func);\n return;\n }\n Function.setFrom(existingFunc, func);\n },\n [space],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n {functions.length > 0 && (\n <List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col is-full'>\n {items?.map((func) => (\n <List.Item<Function.Function>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n <div className='text-xs text-description truncate'>{func.key}</div>\n </div>\n <div className='flex flex-col truncate'>\n <div className='text-xs text-description truncate'>{func.version}</div>\n <div className='text-xs text-description truncate'>\n {func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}\n </div>\n </div>\n\n <IconButton\n iconOnly\n icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}\n label={\n state(func) === 'update' ? t('update function button label') : t('import function button label')\n }\n disabled={state(func) === 'none'}\n onClick={() => hanleImportOrUpdate(func)}\n />\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && !loading && (\n <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>\n )}\n {loading && <div className='text-center plb-4 text-gray-500'>{t('loading functions')}</div>}\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,YAAW;AAGlB,SAASC,kBAAAA,uBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;;;ACJ5C,YAAYC,YAAY;AACxB,SAASC,gBAAgB;AACzB,OAAOC,SAASC,mBAAmB;AAEnC,SAASC,gBAAgB;AACzB,SAASC,4BAA4B;AACrC,SAASC,iBAAiB;AAC1B,SAASC,QAAQC,OAAmBC,gBAAgB;AACpD,SAASC,sBAAsB;AAC/B,SAASC,YAAYC,sBAAsB;AAC3C,SAASC,0BAA0B;AACnC,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,oBAAoB,CAAC,EAAEC,MAAK,MAA0B;AACjE,QAAMC,SAASC,UAAAA;AACf,QAAM,CAACC,SAASC,UAAAA,IAAcC,SAAS,IAAA;AACvC,QAAM,CAACC,WAAWC,YAAAA,IAAgBF,SAA8B,CAAA,CAAE;AAClE,QAAM,EAAEG,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,QAAMC,cAAcC,SAASb,MAAMc,IAAIC,OAAOC,KAAKC,SAASA,QAAQ,CAAA;AAEpE,QAAMC,QAAQ,CAACC,SAAAA;AACb,UAAMC,aAAaR,YAAYS,KAAK,CAACC,MAAMA,EAAEC,QAAQJ,KAAKI,GAAG;AAC7D,QAAI,CAACH,YAAY;AACf,aAAO;IACT;AACA,QAAIA,WAAWI,YAAYL,KAAKK,WAAWJ,WAAWK,YAAYN,KAAKM,SAAS;AAC9E,aAAO;IACT;AACA,WAAO;EACT;AAEAC,iBAAe,YAAA;AACbtB,eAAW,IAAA;AACX,UAAME,aAAY,MAAMqB,qBAAqB1B,QAAQ,IAAA;AACrDM,iBAAaD,UAAAA;AACbF,eAAW,KAAA;EACb,GAAG,CAAA,CAAE;AAEL,QAAMwB,sBAAsBC,YAC1B,OAAOV,SAAAA;AACL,UAAMb,aAAY,MAAMN,MAAMc,GAAGgB,MAAMC,MAAMf,KAAKC,SAASA,UAAU;MAAEM,KAAKJ,KAAKI;IAAI,CAAA,CAAA,EAAIS,IAAG;AAC5F,UAAM,CAACC,YAAAA,IAAgB3B;AACvB,QAAI,CAAC2B,cAAc;AACjBjC,YAAMc,GAAGoB,IAAIf,IAAAA;AACb;IACF;AACAF,aAASkB,QAAQF,cAAcd,IAAAA;EACjC,GACA;IAACnB;GAAM;AAGT,SACE,sBAAA,cAACoC,OAAAA;IAAIC,MAAK;IAAOC,WAAWC,GAAGC,kBAAAA;KAC5BlC,UAAUmC,SAAS,KAClB,sBAAA,cAACC,KAAKC,MAAI;IAAoBC,OAAOtC;IAAWuC,QAAeC,UAAG7B,SAASA,QAAQ;IAAG8B,OAAO,CAAC5B,SAASA,KAAKR;KACzG,CAAC,EAAEiC,MAAK,MACP,sBAAA,cAACR,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACxBM,OAAOI,IAAI,CAAC7B,SACX,sBAAA,cAACuB,KAAKO,MAAI;IACR1B,KAAKJ,KAAKR;IACVuC,MAAM/B;IACNgC,YAAYZ,GAAGzC,MAAMsD,YAAY,gBAAgB,SAAS,eAAA;KAE1D,sBAAA,cAAChB,OAAAA;IAAIE,WAAU;KACb,sBAAA,cAACI,KAAKW,WAAS;IAACF,YAAW;KAAYhC,KAAKmC,IAAI,GAChD,sBAAA,cAAClB,OAAAA;IAAIE,WAAU;KAAqCnB,KAAKI,GAAG,CAAA,GAE9D,sBAAA,cAACa,OAAAA;IAAIE,WAAU;KACb,sBAAA,cAACF,OAAAA;IAAIE,WAAU;KAAqCnB,KAAKK,OAAO,GAChE,sBAAA,cAACY,OAAAA;IAAIE,WAAU;KACZnB,KAAKM,UAAU,YAAY,IAAI8B,KAAKpC,KAAKM,OAAO,EAAE+B,eAAc,CAAA,KAAO,EAAA,CAAA,GAI5E,sBAAA,cAACC,YAAAA;IACCC,UAAAA;IACAC,MAAMzC,MAAMC,IAAAA,MAAU,WAAW,kCAAkC;IACnEyC,OACE1C,MAAMC,IAAAA,MAAU,WAAWX,EAAE,8BAAA,IAAkCA,EAAE,8BAAA;IAEnEqD,UAAU3C,MAAMC,IAAAA,MAAU;IAC1B2C,SAAS,MAAMlC,oBAAoBT,IAAAA;UAShDb,UAAUmC,WAAW,KAAK,CAACtC,WAC1B,sBAAA,cAACiC,OAAAA;IAAIE,WAAU;KAAmC9B,EAAE,oBAAA,CAAA,GAErDL,WAAW,sBAAA,cAACiC,OAAAA;IAAIE,WAAU;KAAmC9B,EAAE,mBAAA,CAAA,CAAA;AAGtE;;;AD/FO,IAAMuD,qBAAqB,CAAC,EAAEC,MAAK,MAAoB;AAC5D,QAAM,EAAEC,EAAC,IAAKC,gBAAeC,KAAKC,EAAE;AACpC,SACE,gBAAAC,OAAA,cAACC,aAAAA,MACC,gBAAAD,OAAA,cAACE,gBAAAA;IACCC,OAAOP,EAAE,2BAA2B;MAAEQ,IAAIN,KAAKC;IAAG,CAAA;IAClDM,aAAaT,EAAE,yBAAyB;MAAEQ,IAAIN,KAAKC;IAAG,CAAA;KAEtD,gBAAAC,OAAA,cAACM,gBAAAA;IAAeX;OAElB,gBAAAK,OAAA,cAACE,gBAAAA;IACCC,OAAOP,EAAE,oCAAoC;MAAEQ,IAAIN,KAAKC;IAAG,CAAA;IAC3DM,aAAaT,EAAE,kCAAkC;MAAEQ,IAAIN,KAAKC;IAAG,CAAA;KAE/D,gBAAAC,OAAA,cAACO,mBAAAA;IAAkBZ;;AAI3B;AAEA,IAAA,6BAAeD;",
|
|
6
|
+
"names": ["React", "useTranslation", "ControlPage", "ControlSection", "Schema", "useState", "React", "useCallback", "Function", "getDeployedFunctions", "useClient", "Filter", "Query", "useQuery", "useAsyncEffect", "IconButton", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsRegistry", "space", "client", "useClient", "loading", "setLoading", "useState", "functions", "setFunctions", "t", "useTranslation", "meta", "id", "dbFunctions", "useQuery", "db", "Filter", "type", "Function", "state", "func", "dbFunction", "find", "f", "key", "version", "updated", "useAsyncEffect", "getDeployedFunctions", "hanleImportOrUpdate", "useCallback", "query", "Query", "run", "existingFunc", "add", "setFrom", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "is", "getId", "map", "Item", "item", "classNames", "ghostHover", "ItemTitle", "name", "Date", "toLocaleString", "IconButton", "iconOnly", "icon", "label", "disabled", "onClick", "FunctionsContainer", "space", "t", "useTranslation", "meta", "id", "React", "ControlPage", "ControlSection", "title", "ns", "description", "FunctionsPanel", "FunctionsRegistry"]
|
|
7
|
+
}
|
|
@@ -2,10 +2,10 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
FunctionsPanel,
|
|
4
4
|
FunctionsPanel_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-KWKWOGS5.mjs";
|
|
6
|
+
import "./chunk-5FXNN3MV.mjs";
|
|
7
7
|
export {
|
|
8
8
|
FunctionsPanel,
|
|
9
9
|
FunctionsPanel_default as default
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=FunctionsPanel-
|
|
11
|
+
//# sourceMappingURL=FunctionsPanel-SS6GIVNU.mjs.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
meta
|
|
4
|
+
} from "./chunk-5FXNN3MV.mjs";
|
|
5
|
+
|
|
6
|
+
// src/capabilities/app-graph-builder/app-graph-builder.ts
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import { Capability, Common } from "@dxos/app-framework";
|
|
9
|
+
import { Script } from "@dxos/functions";
|
|
10
|
+
import { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
|
|
11
|
+
import { GraphBuilder, NodeMatcher } from "@dxos/plugin-graph";
|
|
12
|
+
import { meta as spaceMeta } from "@dxos/plugin-space";
|
|
13
|
+
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
14
|
+
const extensions = yield* Effect.all([
|
|
15
|
+
GraphBuilder.createExtension({
|
|
16
|
+
id: `${meta.id}/space-settings-automation`,
|
|
17
|
+
match: NodeMatcher.whenNodeType(`${spaceMeta.id}/settings`),
|
|
18
|
+
connector: (node) => Effect.succeed([
|
|
19
|
+
{
|
|
20
|
+
id: `automation-${node.id}`,
|
|
21
|
+
type: `${meta.id}/space-settings-automation`,
|
|
22
|
+
data: `${meta.id}/space-settings-automation`,
|
|
23
|
+
properties: {
|
|
24
|
+
label: [
|
|
25
|
+
"automation panel label",
|
|
26
|
+
{
|
|
27
|
+
ns: meta.id
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
icon: "ph--lightning--regular"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
])
|
|
34
|
+
}),
|
|
35
|
+
GraphBuilder.createExtension({
|
|
36
|
+
id: `${meta.id}/space-settings-functions`,
|
|
37
|
+
match: NodeMatcher.whenNodeType(`${spaceMeta.id}/settings`),
|
|
38
|
+
connector: (node) => Effect.succeed([
|
|
39
|
+
{
|
|
40
|
+
id: `functions-${node.id}`,
|
|
41
|
+
type: `${meta.id}/space-settings-functions`,
|
|
42
|
+
data: `${meta.id}/space-settings-functions`,
|
|
43
|
+
properties: {
|
|
44
|
+
label: [
|
|
45
|
+
"functions panel label",
|
|
46
|
+
{
|
|
47
|
+
ns: meta.id
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
icon: "ph--function--regular"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
])
|
|
54
|
+
}),
|
|
55
|
+
GraphBuilder.createTypeExtension({
|
|
56
|
+
id: `${meta.id}/script-companion`,
|
|
57
|
+
type: Script.Script,
|
|
58
|
+
connector: (script) => Effect.succeed([
|
|
59
|
+
{
|
|
60
|
+
id: [
|
|
61
|
+
script.id,
|
|
62
|
+
"automation"
|
|
63
|
+
].join(ATTENDABLE_PATH_SEPARATOR),
|
|
64
|
+
type: PLANK_COMPANION_TYPE,
|
|
65
|
+
data: "automation",
|
|
66
|
+
properties: {
|
|
67
|
+
label: [
|
|
68
|
+
"script automation label",
|
|
69
|
+
{
|
|
70
|
+
ns: meta.id
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
icon: "ph--lightning--regular",
|
|
74
|
+
disposition: "hidden"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
])
|
|
78
|
+
})
|
|
79
|
+
]);
|
|
80
|
+
return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);
|
|
81
|
+
}));
|
|
82
|
+
export {
|
|
83
|
+
app_graph_builder_default as default
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=app-graph-builder-4UCMXHYY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/app-graph-builder/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Script } from '@dxos/functions';\nimport { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';\nimport { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';\nimport { meta as spaceMeta } from '@dxos/plugin-space';\n\nimport { meta } from '../../meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n GraphBuilder.createExtension({\n id: `${meta.id}/space-settings-automation`,\n match: NodeMatcher.whenNodeType(`${spaceMeta.id}/settings`),\n connector: (node) =>\n Effect.succeed([\n {\n id: `automation-${node.id}`,\n type: `${meta.id}/space-settings-automation`,\n data: `${meta.id}/space-settings-automation`,\n properties: {\n label: ['automation panel label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n },\n },\n ]),\n }),\n GraphBuilder.createExtension({\n id: `${meta.id}/space-settings-functions`,\n match: NodeMatcher.whenNodeType(`${spaceMeta.id}/settings`),\n connector: (node) =>\n Effect.succeed([\n {\n id: `functions-${node.id}`,\n type: `${meta.id}/space-settings-functions`,\n data: `${meta.id}/space-settings-functions`,\n properties: {\n label: ['functions panel label', { ns: meta.id }],\n icon: 'ph--function--regular',\n },\n },\n ]),\n }),\n GraphBuilder.createTypeExtension({\n id: `${meta.id}/script-companion`,\n type: Script.Script,\n connector: (script) =>\n Effect.succeed([\n {\n id: [script.id, 'automation'].join(ATTENDABLE_PATH_SEPARATOR),\n type: PLANK_COMPANION_TYPE,\n data: 'automation',\n properties: {\n label: ['script automation label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n disposition: 'hidden',\n },\n },\n ]),\n }),\n ]);\n\n return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,cAAc;AACvB,SAASC,2BAA2BC,4BAA4B;AAChE,SAASC,cAAcC,mBAAmB;AAC1C,SAASC,QAAQC,iBAAiB;AAIlC,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAcC,WAAI;IACnCC,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYC,aAAa,GAAGC,UAAUL,EAAE,WAAW;MAC1DM,WAAW,CAACC,SACHC,eAAQ;QACb;UACER,IAAI,cAAcO,KAAKP,EAAE;UACzBS,MAAM,GAAGR,KAAKD,EAAE;UAChBU,MAAM,GAAGT,KAAKD,EAAE;UAChBW,YAAY;YACVC,OAAO;cAAC;cAA0B;gBAAEC,IAAIZ,KAAKD;cAAG;;YAChDc,MAAM;UACR;QACF;OACD;IACL,CAAA;IACAhB,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYC,aAAa,GAAGC,UAAUL,EAAE,WAAW;MAC1DM,WAAW,CAACC,SACHC,eAAQ;QACb;UACER,IAAI,aAAaO,KAAKP,EAAE;UACxBS,MAAM,GAAGR,KAAKD,EAAE;UAChBU,MAAM,GAAGT,KAAKD,EAAE;UAChBW,YAAY;YACVC,OAAO;cAAC;cAAyB;gBAAEC,IAAIZ,KAAKD;cAAG;;YAC/Cc,MAAM;UACR;QACF;OACD;IACL,CAAA;IACAhB,aAAaiB,oBAAoB;MAC/Bf,IAAI,GAAGC,KAAKD,EAAE;MACdS,MAAMO,OAAOA;MACbV,WAAW,CAACW,WACHT,eAAQ;QACb;UACER,IAAI;YAACiB,OAAOjB;YAAI;YAAckB,KAAKC,yBAAAA;UACnCV,MAAMW;UACNV,MAAM;UACNC,YAAY;YACVC,OAAO;cAAC;cAA2B;gBAAEC,IAAIZ,KAAKD;cAAG;;YACjDc,MAAM;YACNO,aAAa;UACf;QACF;OACD;IACL,CAAA;GACD;AAED,SAAO5B,WAAW6B,YAAYC,OAAO9B,WAAW+B,iBAAiB5B,UAAAA;AACnE,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capability", "Common", "Script", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "GraphBuilder", "NodeMatcher", "meta", "spaceMeta", "Capability", "makeModule", "fnUntraced", "extensions", "all", "GraphBuilder", "createExtension", "id", "meta", "match", "NodeMatcher", "whenNodeType", "spaceMeta", "connector", "node", "succeed", "type", "data", "properties", "label", "ns", "icon", "createTypeExtension", "Script", "script", "join", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "disposition", "contributes", "Common", "AppGraphBuilder"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
TriggerEditor
|
|
4
|
+
} from "./chunk-LJAXQ6CX.mjs";
|
|
5
|
+
import {
|
|
6
|
+
meta
|
|
7
|
+
} from "./chunk-5FXNN3MV.mjs";
|
|
8
|
+
|
|
9
|
+
// src/components/AutomationPanel/AutomationPanel.tsx
|
|
10
|
+
import * as Array from "effect/Array";
|
|
11
|
+
import * as EFn from "effect/Function";
|
|
12
|
+
import * as Match from "effect/Match";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import React, { useMemo, useState } from "react";
|
|
15
|
+
import { Filter, Obj, Tag } from "@dxos/echo";
|
|
16
|
+
import { Function, Script, Trigger } from "@dxos/functions";
|
|
17
|
+
import { FunctionsServiceClient } from "@dxos/functions-runtime/edge";
|
|
18
|
+
import { useTypeOptions } from "@dxos/plugin-space";
|
|
19
|
+
import { useClient } from "@dxos/react-client";
|
|
20
|
+
import { useQuery } from "@dxos/react-client/echo";
|
|
21
|
+
import { Clipboard, IconButton, Input, Separator, useTranslation } from "@dxos/react-ui";
|
|
22
|
+
import { ControlItem, controlItemClasses } from "@dxos/react-ui-form";
|
|
23
|
+
import { List } from "@dxos/react-ui-list";
|
|
24
|
+
import { Project } from "@dxos/types";
|
|
25
|
+
import { ghostHover, mx } from "@dxos/ui-theme";
|
|
26
|
+
import { isNonNullable } from "@dxos/util";
|
|
27
|
+
var grid = "grid grid-cols-[40px_1fr_32px_32px] min-bs-[2.5rem]";
|
|
28
|
+
var AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }) => {
|
|
29
|
+
const { t } = useTranslation(meta.id);
|
|
30
|
+
const client = useClient();
|
|
31
|
+
const functionsServiceClient = useMemo(() => FunctionsServiceClient.fromClient(client), [
|
|
32
|
+
client
|
|
33
|
+
]);
|
|
34
|
+
const functions = useQuery(space.db, Filter.type(Function.Function));
|
|
35
|
+
const triggers = useQuery(space.db, Filter.type(Trigger.Trigger));
|
|
36
|
+
const filteredTriggers = useMemo(() => {
|
|
37
|
+
return object ? triggers.filter(triggerMatch(object)) : triggers;
|
|
38
|
+
}, [
|
|
39
|
+
object,
|
|
40
|
+
triggers
|
|
41
|
+
]);
|
|
42
|
+
const tags = useQuery(space.db, Filter.type(Tag.Tag));
|
|
43
|
+
const types = useTypeOptions({
|
|
44
|
+
space,
|
|
45
|
+
annotation: {
|
|
46
|
+
location: [
|
|
47
|
+
"database",
|
|
48
|
+
"runtime"
|
|
49
|
+
],
|
|
50
|
+
kind: [
|
|
51
|
+
"user"
|
|
52
|
+
],
|
|
53
|
+
registered: [
|
|
54
|
+
"registered"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const [trigger, setTrigger] = useState(initialTrigger);
|
|
59
|
+
const [selected, setSelected] = useState();
|
|
60
|
+
const handleSelect = (trigger2) => {
|
|
61
|
+
setTrigger(trigger2);
|
|
62
|
+
setSelected(trigger2);
|
|
63
|
+
};
|
|
64
|
+
const handleAdd = () => {
|
|
65
|
+
setTrigger(Trigger.make({}));
|
|
66
|
+
setSelected(void 0);
|
|
67
|
+
};
|
|
68
|
+
const handleDelete = (trigger2) => {
|
|
69
|
+
space.db.remove(trigger2);
|
|
70
|
+
setTrigger(void 0);
|
|
71
|
+
setSelected(void 0);
|
|
72
|
+
};
|
|
73
|
+
const handleSave = (trigger2) => {
|
|
74
|
+
if (selected) {
|
|
75
|
+
Object.assign(selected, trigger2);
|
|
76
|
+
} else {
|
|
77
|
+
space.db.add(Trigger.make(trigger2));
|
|
78
|
+
}
|
|
79
|
+
setTrigger(void 0);
|
|
80
|
+
setSelected(void 0);
|
|
81
|
+
onDone?.();
|
|
82
|
+
};
|
|
83
|
+
const handleCancel = () => {
|
|
84
|
+
setTrigger(void 0);
|
|
85
|
+
onDone?.();
|
|
86
|
+
};
|
|
87
|
+
const handleForceRunTrigger = async (trigger2) => {
|
|
88
|
+
await functionsServiceClient.forceRunCronTrigger(space.id, trigger2.id);
|
|
89
|
+
};
|
|
90
|
+
if (trigger) {
|
|
91
|
+
return /* @__PURE__ */ React.createElement(ControlItem, {
|
|
92
|
+
title: t("trigger editor title")
|
|
93
|
+
}, /* @__PURE__ */ React.createElement(TriggerEditor, {
|
|
94
|
+
db: space.db,
|
|
95
|
+
trigger,
|
|
96
|
+
readonlySpec: Boolean(object),
|
|
97
|
+
tags,
|
|
98
|
+
types,
|
|
99
|
+
onSave: handleSave,
|
|
100
|
+
onCancel: handleCancel
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
104
|
+
className: mx(controlItemClasses, classNames)
|
|
105
|
+
}, filteredTriggers.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
106
|
+
items: filteredTriggers,
|
|
107
|
+
isItem: Schema.is(Trigger.Trigger),
|
|
108
|
+
getId: (field) => field.id
|
|
109
|
+
}, ({ items: filteredTriggers2 }) => /* @__PURE__ */ React.createElement("div", {
|
|
110
|
+
role: "list",
|
|
111
|
+
className: "flex flex-col is-full"
|
|
112
|
+
}, filteredTriggers2?.map((trigger2) => {
|
|
113
|
+
const copyAction = getCopyAction(client, trigger2);
|
|
114
|
+
return /* @__PURE__ */ React.createElement(List.Item, {
|
|
115
|
+
key: trigger2.id,
|
|
116
|
+
item: trigger2,
|
|
117
|
+
classNames: mx(grid, ghostHover, "items-center", "pli-2")
|
|
118
|
+
}, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
119
|
+
checked: trigger2.enabled,
|
|
120
|
+
onCheckedChange: (checked) => Obj.change(trigger2, (t2) => {
|
|
121
|
+
t2.enabled = checked;
|
|
122
|
+
})
|
|
123
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
124
|
+
className: "flex"
|
|
125
|
+
}, /* @__PURE__ */ React.createElement(List.ItemTitle, {
|
|
126
|
+
classNames: "pli-1 cursor-pointer is-0 shrink truncate",
|
|
127
|
+
onClick: () => handleSelect(trigger2)
|
|
128
|
+
}, getFunctionName(functions, trigger2) ?? "\u2205"), copyAction && /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
|
|
129
|
+
label: t(copyAction.translationKey),
|
|
130
|
+
value: copyAction.contentProvider()
|
|
131
|
+
})), /* @__PURE__ */ React.createElement(List.ItemButton, {
|
|
132
|
+
autoHide: false,
|
|
133
|
+
disabled: !trigger2.enabled || trigger2.spec?.kind !== "timer",
|
|
134
|
+
icon: "ph--play--regular",
|
|
135
|
+
label: "Force run",
|
|
136
|
+
onClick: () => handleForceRunTrigger(trigger2)
|
|
137
|
+
}), /* @__PURE__ */ React.createElement(List.ItemDeleteButton, {
|
|
138
|
+
onClick: () => handleDelete(trigger2)
|
|
139
|
+
}));
|
|
140
|
+
}))), filteredTriggers.length > 0 && /* @__PURE__ */ React.createElement(Separator, {
|
|
141
|
+
classNames: "mlb-4"
|
|
142
|
+
}), /* @__PURE__ */ React.createElement(IconButton, {
|
|
143
|
+
icon: "ph--plus--regular",
|
|
144
|
+
label: t("new trigger label"),
|
|
145
|
+
onClick: handleAdd
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
148
|
+
var getCopyAction = (client, trigger) => {
|
|
149
|
+
if (trigger?.spec?.kind === "email") {
|
|
150
|
+
return {
|
|
151
|
+
translationKey: "trigger copy email",
|
|
152
|
+
contentProvider: () => `${Obj.getDatabase(trigger).spaceId}@dxos.network`
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if (trigger?.spec?.kind === "webhook") {
|
|
156
|
+
return {
|
|
157
|
+
translationKey: "trigger copy url",
|
|
158
|
+
contentProvider: () => getWebhookUrl(client, trigger)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return void 0;
|
|
162
|
+
};
|
|
163
|
+
var getWebhookUrl = (client, trigger) => {
|
|
164
|
+
const spaceId = Obj.getDatabase(trigger).spaceId;
|
|
165
|
+
const edgeUrl = new URL(client.config.values.runtime.services.edge.url);
|
|
166
|
+
const isSecure = edgeUrl.protocol.startsWith("https") || edgeUrl.protocol.startsWith("wss");
|
|
167
|
+
edgeUrl.protocol = isSecure ? "https" : "http";
|
|
168
|
+
return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
|
|
169
|
+
};
|
|
170
|
+
var getFunctionName = (functions, trigger) => {
|
|
171
|
+
const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}\u2026`;
|
|
172
|
+
const functionObject = functions.find((fn) => fn === trigger.function?.target);
|
|
173
|
+
return functionObject?.name ?? shortId;
|
|
174
|
+
};
|
|
175
|
+
var scriptMatch = (script) => (trigger) => {
|
|
176
|
+
const fn = trigger.function?.target;
|
|
177
|
+
if (!Obj.instanceOf(Function.Function, fn)) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
return fn.source?.target === script;
|
|
181
|
+
};
|
|
182
|
+
var projectMatch = (project) => {
|
|
183
|
+
const viewQueries = EFn.pipe(project.columns, Array.map((column) => column.view.target), Array.filter(isNonNullable), Array.map((view) => Obj.getSnapshot(view).query.ast), Array.map((ast) => JSON.stringify(ast)));
|
|
184
|
+
return (trigger) => {
|
|
185
|
+
const spec = Obj.getSnapshot(trigger).spec;
|
|
186
|
+
if (spec?.kind !== "subscription") {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
return viewQueries.some((query) => JSON.stringify(spec.query) === query);
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
var triggerMatch = Match.type().pipe(Match.withReturnType(), Match.when((obj) => Obj.instanceOf(Script.Script, obj), (obj) => scriptMatch(obj)), Match.when((obj) => Obj.instanceOf(Project.Project, obj), (obj) => projectMatch(obj)), Match.orElse((_obj) => () => true));
|
|
193
|
+
|
|
194
|
+
// src/components/AutomationPanel/index.ts
|
|
195
|
+
var AutomationPanel_default = AutomationPanel;
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
AutomationPanel,
|
|
199
|
+
AutomationPanel_default
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=chunk-2CKVH7JC.mjs.map
|