@dxos/plugin-automation 0.8.4-main.fd6878d → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/PLUGIN.mdl +428 -0
- package/README.md +1 -1
- package/dist/lib/neutral/AutomationArticle-GN36NUX2.mjs +17 -0
- package/dist/lib/neutral/AutomationCompanion-M26WR6VP.mjs +165 -0
- package/dist/lib/neutral/AutomationCompanion-M26WR6VP.mjs.map +7 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs +1132 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs +36 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/AutomationSettings-YXUJDRQA.mjs +27 -0
- package/dist/lib/neutral/AutomationSettings-YXUJDRQA.mjs.map +7 -0
- package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
- package/dist/lib/neutral/app-graph-builder-BTTHS4VK.mjs +102 -0
- package/dist/lib/neutral/app-graph-builder-BTTHS4VK.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +25 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +19 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-24JKY6NU.mjs +21 -0
- package/dist/lib/neutral/chunk-24JKY6NU.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs +42 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DUGOIM7G.mjs +36 -0
- package/dist/lib/neutral/chunk-DUGOIM7G.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FE7YFBX7.mjs +486 -0
- package/dist/lib/neutral/chunk-FE7YFBX7.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GARB7S5R.mjs +157 -0
- package/dist/lib/neutral/chunk-GARB7S5R.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HPUHQ3L6.mjs +64 -0
- package/dist/lib/neutral/chunk-HPUHQ3L6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-SONGOJRB.mjs +8 -0
- package/dist/lib/neutral/chunk-SONGOJRB.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +48 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +15 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-automation-OE3TNXYE.mjs +41 -0
- package/dist/lib/neutral/create-automation-OE3TNXYE.mjs.map +7 -0
- package/dist/lib/neutral/create-object-MEJOWGMH.mjs +25 -0
- package/dist/lib/neutral/create-object-MEJOWGMH.mjs.map +7 -0
- package/dist/lib/neutral/create-trigger-from-template-TERHKWJM.mjs +68 -0
- package/dist/lib/neutral/create-trigger-from-template-TERHKWJM.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +47 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +22 -0
- package/dist/lib/neutral/layer-specs-G6GCH7BE.mjs +137 -0
- package/dist/lib/neutral/layer-specs-G6GCH7BE.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/navigation-resolver-I3L5FHJO.mjs +14 -0
- package/dist/lib/neutral/navigation-resolver-I3L5FHJO.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-IBRWUKPC.mjs +54 -0
- package/dist/lib/neutral/react-surface-IBRWUKPC.mjs.map +7 -0
- package/dist/lib/neutral/registry-sync-G6TKKZGK.mjs +86 -0
- package/dist/lib/neutral/registry-sync-G6TKKZGK.mjs.map +7 -0
- package/dist/lib/neutral/templates-ETXVD3VE.mjs +16 -0
- package/dist/lib/neutral/templates-ETXVD3VE.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +64 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs +77 -0
- package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +18 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts +3 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/AutomationPlugin.node.d.ts +4 -0
- package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
- package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.workerd.d.ts +4 -0
- package/dist/types/src/AutomationPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.test.d.ts +2 -0
- package/dist/types/src/capabilities/create-object.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +16 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/layer-specs.d.ts +6 -0
- package/dist/types/src/capabilities/layer-specs.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation-resolver.d.ts +6 -0
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/node.d.ts +9 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/registry-sync.d.ts +21 -0
- package/dist/types/src/capabilities/registry-sync.d.ts.map +1 -0
- package/dist/types/src/capabilities/templates.d.ts +6 -0
- package/dist/types/src/capabilities/templates.d.ts.map +1 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.d.ts +5 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.d.ts.map +1 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts +2 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts.map +1 -0
- package/dist/types/src/commands/index.d.ts +2 -0
- package/dist/types/src/commands/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/index.d.ts +25 -0
- package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/queue.d.ts +13 -0
- package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/subscription.d.ts +15 -0
- package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/timer.d.ts +13 -0
- package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/index.d.ts +57 -0
- package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/list.d.ts +7 -0
- package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/options.d.ts +10 -0
- package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/remove.d.ts +8 -0
- package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/index.d.ts +28 -0
- package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/queue.d.ts +11 -0
- package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts +13 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts +11 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/util.d.ts +85 -0
- package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/components/CreateAutomationPanel/CreateAutomationPanel.d.ts +14 -0
- package/dist/types/src/components/CreateAutomationPanel/CreateAutomationPanel.d.ts.map +1 -0
- package/dist/types/src/components/CreateAutomationPanel/index.d.ts +2 -0
- package/dist/types/src/components/CreateAutomationPanel/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -7
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationArticle/AutomationArticle.d.ts +35 -0
- package/dist/types/src/containers/AutomationArticle/AutomationArticle.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationArticle/index.d.ts +3 -0
- package/dist/types/src/containers/AutomationArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationCompanion/AutomationCompanion.d.ts +13 -0
- package/dist/types/src/containers/AutomationCompanion/AutomationCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationCompanion/index.d.ts +3 -0
- package/dist/types/src/containers/AutomationCompanion/index.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +10 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +6 -0
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +12 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
- 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 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-automation.d.ts +5 -0
- package/dist/types/src/operations/create-automation.d.ts.map +1 -0
- package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
- package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/paths.d.ts +3 -0
- package/dist/types/src/paths.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/templates/index.d.ts +10 -0
- package/dist/types/src/templates/index.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +318 -3
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +2 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +90 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Automation.d.ts +41 -0
- package/dist/types/src/types/Automation.d.ts.map +1 -0
- package/dist/types/src/types/Automation.test.d.ts +2 -0
- package/dist/types/src/types/Automation.test.d.ts.map +1 -0
- package/dist/types/src/types/AutomationCapabilities.d.ts +42 -0
- package/dist/types/src/types/AutomationCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AutomationOperation.d.ts +31 -0
- package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
- package/dist/types/src/types/Runnable.d.ts +14 -0
- package/dist/types/src/types/Runnable.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +14 -6
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/util/automations-for-object.d.ts +20 -0
- package/dist/types/src/util/automations-for-object.d.ts.map +1 -0
- package/dist/types/src/util/automations-for-object.test.d.ts +2 -0
- package/dist/types/src/util/automations-for-object.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +140 -52
- package/src/AutomationPlugin.node.ts +48 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +52 -34
- package/src/AutomationPlugin.workerd.ts +24 -0
- package/src/capabilities/app-graph-builder.ts +82 -78
- package/src/capabilities/create-object.test.ts +18 -0
- package/src/capabilities/create-object.ts +26 -0
- package/src/capabilities/index.ts +17 -4
- package/src/capabilities/layer-specs.ts +196 -0
- package/src/capabilities/navigation-resolver.ts +19 -0
- package/src/capabilities/node.ts +19 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +45 -46
- package/src/capabilities/registry-sync.ts +114 -0
- package/src/capabilities/templates.ts +17 -0
- package/src/capabilities/trigger-runtime-controller.test.ts +107 -0
- package/src/capabilities/trigger-runtime-controller.ts +126 -0
- package/src/commands/index.ts +5 -0
- package/src/commands/trigger/create/index.ts +14 -0
- package/src/commands/trigger/create/queue.ts +87 -0
- package/src/commands/trigger/create/subscription.ts +126 -0
- package/src/commands/trigger/create/timer.ts +90 -0
- package/src/commands/trigger/index.ts +16 -0
- package/src/commands/trigger/list.ts +69 -0
- package/src/commands/trigger/options.ts +47 -0
- package/src/commands/trigger/remove.ts +45 -0
- package/src/commands/trigger/update/index.ts +14 -0
- package/src/commands/trigger/update/queue.ts +191 -0
- package/src/commands/trigger/update/subscription.ts +279 -0
- package/src/commands/trigger/update/timer.ts +195 -0
- package/src/commands/trigger/util.ts +410 -0
- package/src/components/CreateAutomationPanel/CreateAutomationPanel.tsx +68 -0
- package/src/components/CreateAutomationPanel/index.ts +5 -0
- package/src/components/index.ts +1 -8
- package/src/containers/AutomationArticle/AutomationArticle.tsx +586 -0
- package/src/containers/AutomationArticle/index.ts +6 -0
- package/src/containers/AutomationCompanion/AutomationCompanion.tsx +183 -0
- package/src/containers/AutomationCompanion/index.ts +6 -0
- package/src/containers/AutomationSettings/AutomationSettings.tsx +34 -0
- package/src/containers/AutomationSettings/index.ts +5 -0
- package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
- package/src/containers/TriggerSettings/index.ts +6 -0
- package/src/containers/index.ts +10 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useTriggerRuntimeControls.ts +72 -0
- package/src/index.ts +1 -3
- package/src/meta.ts +26 -9
- package/src/operations/create-automation.ts +38 -0
- package/src/operations/create-trigger-from-template.ts +70 -0
- package/src/operations/index.ts +10 -0
- package/src/paths.ts +13 -0
- package/src/plugin.ts +11 -0
- package/src/templates/index.ts +22 -0
- package/src/testing/test-functions.ts +44 -10
- package/src/testing.ts +7 -0
- package/src/translations.ts +49 -26
- package/src/types/Automation.test.ts +37 -0
- package/src/types/Automation.ts +45 -0
- package/src/types/AutomationCapabilities.ts +52 -0
- package/src/types/AutomationOperation.ts +61 -0
- package/src/types/Runnable.ts +14 -0
- package/src/types/index.ts +5 -0
- package/src/types/schema.ts +7 -7
- package/src/util/automations-for-object.test.ts +86 -0
- package/src/util/automations-for-object.ts +72 -0
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/AutomationContainer-5UYKI7EG.mjs +0 -38
- package/dist/lib/browser/AutomationContainer-5UYKI7EG.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-YYERBNYJ.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-VOGKIPHA.mjs +0 -39
- package/dist/lib/browser/FunctionsContainer-VOGKIPHA.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-I443Y6KB.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-4OFKIRAI.mjs +0 -80
- package/dist/lib/browser/app-graph-builder-4OFKIRAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-7EE4SA6M.mjs +0 -230
- package/dist/lib/browser/chunk-7EE4SA6M.mjs.map +0 -7
- package/dist/lib/browser/chunk-CHENFUQ6.mjs +0 -14
- package/dist/lib/browser/chunk-CHENFUQ6.mjs.map +0 -7
- package/dist/lib/browser/chunk-GW5U2DGT.mjs +0 -15
- package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
- package/dist/lib/browser/chunk-HN7OHFCB.mjs +0 -38
- package/dist/lib/browser/chunk-HN7OHFCB.mjs.map +0 -7
- package/dist/lib/browser/chunk-OX6OW6XP.mjs +0 -147
- package/dist/lib/browser/chunk-OX6OW6XP.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z5DT4MHW.mjs +0 -94
- package/dist/lib/browser/chunk-Z5DT4MHW.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -101
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-YZP6RKTR.mjs +0 -76
- package/dist/lib/browser/intent-resolver-YZP6RKTR.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-WNOIIT4O.mjs +0 -64
- package/dist/lib/browser/react-surface-WNOIIT4O.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/node-esm/AutomationContainer-EZMY6DTD.mjs +0 -39
- package/dist/lib/node-esm/AutomationContainer-EZMY6DTD.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-5EQQF5S2.mjs +0 -12
- package/dist/lib/node-esm/FunctionsContainer-IHLMLXHH.mjs +0 -40
- package/dist/lib/node-esm/FunctionsContainer-IHLMLXHH.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-ELINCXPW.mjs +0 -11
- package/dist/lib/node-esm/app-graph-builder-555IHYOB.mjs +0 -81
- package/dist/lib/node-esm/app-graph-builder-555IHYOB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CX2AILIS.mjs +0 -95
- package/dist/lib/node-esm/chunk-CX2AILIS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D4VWZD53.mjs +0 -16
- package/dist/lib/node-esm/chunk-D4VWZD53.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GHRG4NQV.mjs +0 -148
- package/dist/lib/node-esm/chunk-GHRG4NQV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NK5N3QKD.mjs +0 -17
- package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OEZNHUL2.mjs +0 -39
- package/dist/lib/node-esm/chunk-OEZNHUL2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YPUO4IVX.mjs +0 -231
- package/dist/lib/node-esm/chunk-YPUO4IVX.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -102
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-TSLQE27W.mjs +0 -77
- package/dist/lib/node-esm/intent-resolver-TSLQE27W.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-K6MQFIAS.mjs +0 -65
- package/dist/lib/node-esm/react-surface-K6MQFIAS.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- 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/components/AutomationContainer.d.ts +0 -5
- package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +0 -12
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +0 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +0 -6
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +0 -1
- package/dist/types/src/components/AutomationPanel/index.d.ts +0 -4
- package/dist/types/src/components/AutomationPanel/index.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
- package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts +0 -7
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsPanel/index.d.ts +0 -4
- package/dist/types/src/components/FunctionsPanel/index.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +0 -12
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +0 -5
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +0 -11
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +0 -6
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/index.d.ts +0 -2
- package/dist/types/src/components/TriggerEditor/index.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/components/AutomationContainer.tsx +0 -31
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +0 -58
- package/src/components/AutomationPanel/AutomationPanel.tsx +0 -171
- package/src/components/AutomationPanel/index.ts +0 -9
- package/src/components/FunctionsContainer.tsx +0 -32
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +0 -97
- package/src/components/FunctionsPanel/index.ts +0 -8
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +0 -78
- package/src/components/TriggerEditor/SpecSelector.tsx +0 -59
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +0 -79
- package/src/components/TriggerEditor/TriggerEditor.tsx +0 -107
- package/src/components/TriggerEditor/index.ts +0 -5
- /package/dist/lib/{browser/AutomationPanel-YYERBNYJ.mjs.map → neutral/AutomationArticle-GN36NUX2.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-I443Y6KB.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-5EQQF5S2.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-ELINCXPW.mjs.map → neutral/meta.mjs.map} +0 -0
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { Filter, Obj } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
FunctionTrigger,
|
|
11
|
-
FunctionTriggerSchema,
|
|
12
|
-
type FunctionTriggerType,
|
|
13
|
-
FunctionType,
|
|
14
|
-
ScriptType,
|
|
15
|
-
TriggerKind,
|
|
16
|
-
} from '@dxos/functions';
|
|
17
|
-
import { type Client, useClient } from '@dxos/react-client';
|
|
18
|
-
import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
19
|
-
import { Clipboard, IconButton, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
20
|
-
import { ControlItem, controlItemClasses } from '@dxos/react-ui-form';
|
|
21
|
-
import { List } from '@dxos/react-ui-list';
|
|
22
|
-
import { ghostHover, mx } from '@dxos/react-ui-theme';
|
|
23
|
-
|
|
24
|
-
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
25
|
-
import { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';
|
|
26
|
-
|
|
27
|
-
const grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';
|
|
28
|
-
|
|
29
|
-
export type AutomationPanelProps = {
|
|
30
|
-
space: Space;
|
|
31
|
-
object?: Obj.Any;
|
|
32
|
-
initialTrigger?: FunctionTriggerType;
|
|
33
|
-
onDone?: () => void;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// TODO(burdon): Factor out common layout with ViewEditor.
|
|
37
|
-
export const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {
|
|
38
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
39
|
-
const client = useClient();
|
|
40
|
-
const triggers = useQuery(space, Filter.type(FunctionTrigger));
|
|
41
|
-
const functions = useQuery(space, Filter.type(FunctionType));
|
|
42
|
-
const scripts = useQuery(space, Filter.type(ScriptType));
|
|
43
|
-
|
|
44
|
-
const [trigger, setTrigger] = useState<FunctionTriggerType | undefined>(initialTrigger);
|
|
45
|
-
const [selected, setSelected] = useState<FunctionTrigger>();
|
|
46
|
-
|
|
47
|
-
const handleSelect = (trigger: FunctionTrigger) => {
|
|
48
|
-
const { id: _, ...values } = trigger;
|
|
49
|
-
setTrigger(values);
|
|
50
|
-
setSelected(trigger);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const handleAdd = () => {
|
|
54
|
-
setTrigger(Obj.make(FunctionTriggerSchema, {}));
|
|
55
|
-
setSelected(undefined);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const handleDelete = (trigger: FunctionTrigger) => {
|
|
59
|
-
space.db.remove(trigger);
|
|
60
|
-
setTrigger(undefined);
|
|
61
|
-
setSelected(undefined);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const handleSave: TriggerEditorProps['onSave'] = (trigger) => {
|
|
65
|
-
if (selected) {
|
|
66
|
-
Object.assign(selected, trigger);
|
|
67
|
-
} else {
|
|
68
|
-
space.db.add(Obj.make(FunctionTrigger, trigger));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
setTrigger(undefined);
|
|
72
|
-
setSelected(undefined);
|
|
73
|
-
onDone?.();
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const handleCancel: TriggerEditorProps['onCancel'] = () => {
|
|
77
|
-
setTrigger(undefined);
|
|
78
|
-
onDone?.();
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
if (trigger) {
|
|
82
|
-
return (
|
|
83
|
-
<ControlItem title={t('trigger editor title')}>
|
|
84
|
-
<TriggerEditor space={space} trigger={trigger} onSave={handleSave} onCancel={handleCancel} />
|
|
85
|
-
</ControlItem>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div className={controlItemClasses}>
|
|
91
|
-
{triggers.length > 0 && (
|
|
92
|
-
<List.Root<FunctionTrigger> items={triggers} isItem={Schema.is(FunctionTrigger)} getId={(field) => field.id}>
|
|
93
|
-
{({ items: triggers }) => (
|
|
94
|
-
<div role='list' className='flex flex-col w-full'>
|
|
95
|
-
{triggers?.map((trigger) => {
|
|
96
|
-
const copyAction = getCopyAction(client, trigger);
|
|
97
|
-
return (
|
|
98
|
-
<List.Item<FunctionTrigger>
|
|
99
|
-
key={trigger.id}
|
|
100
|
-
item={trigger}
|
|
101
|
-
classNames={mx(grid, ghostHover, 'items-center', 'px-2')}
|
|
102
|
-
>
|
|
103
|
-
<Input.Root>
|
|
104
|
-
<Input.Switch
|
|
105
|
-
checked={trigger.enabled}
|
|
106
|
-
onCheckedChange={(checked) => (trigger.enabled = checked)}
|
|
107
|
-
/>
|
|
108
|
-
</Input.Root>
|
|
109
|
-
|
|
110
|
-
<div className={'flex'}>
|
|
111
|
-
<List.ItemTitle
|
|
112
|
-
classNames='px-1 cursor-pointer w-0 shrink truncate'
|
|
113
|
-
onClick={() => handleSelect(trigger)}
|
|
114
|
-
>
|
|
115
|
-
{getFunctionName(scripts, functions, trigger) ?? '∅'}
|
|
116
|
-
</List.ItemTitle>
|
|
117
|
-
|
|
118
|
-
{/* TODO: a better way to expose copy action */}
|
|
119
|
-
{copyAction && (
|
|
120
|
-
<Clipboard.IconButton
|
|
121
|
-
label={t(copyAction.translationKey)}
|
|
122
|
-
value={copyAction.contentProvider()}
|
|
123
|
-
/>
|
|
124
|
-
)}
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<List.ItemDeleteButton onClick={() => handleDelete(trigger)} />
|
|
128
|
-
</List.Item>
|
|
129
|
-
);
|
|
130
|
-
})}
|
|
131
|
-
</div>
|
|
132
|
-
)}
|
|
133
|
-
</List.Root>
|
|
134
|
-
)}
|
|
135
|
-
{triggers.length > 0 && <Separator classNames='mlb-4' />}
|
|
136
|
-
<IconButton icon='ph--plus--regular' label={t('new trigger label')} onClick={handleAdd} />
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {
|
|
142
|
-
if (trigger?.spec?.kind === TriggerKind.Email) {
|
|
143
|
-
return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (trigger?.spec?.kind === TriggerKind.Webhook) {
|
|
147
|
-
return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return undefined;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {
|
|
154
|
-
const spaceId = getSpace(trigger)!.id;
|
|
155
|
-
const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);
|
|
156
|
-
const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');
|
|
157
|
-
edgeUrl.protocol = isSecure ? 'https' : 'http';
|
|
158
|
-
return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTriggerType) => {
|
|
162
|
-
// TODO(wittjosiah): Truncation should be done in the UI.
|
|
163
|
-
// Warning that the List component is currently a can of worms.
|
|
164
|
-
const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;
|
|
165
|
-
const functionObject = functions.find((fn) => fn === trigger.function?.target);
|
|
166
|
-
if (!functionObject) {
|
|
167
|
-
return shortId;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;
|
|
171
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
8
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
10
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
11
|
-
|
|
12
|
-
import { AUTOMATION_PLUGIN } from '../meta';
|
|
13
|
-
|
|
14
|
-
import { FunctionsPanel } from './FunctionsPanel';
|
|
15
|
-
|
|
16
|
-
export const FunctionsContainer = ({ space }: { space: Space }) => {
|
|
17
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
18
|
-
return (
|
|
19
|
-
<StackItem.Content classNames='block overflow-y-auto'>
|
|
20
|
-
<ControlPage>
|
|
21
|
-
<ControlSection
|
|
22
|
-
title={t('functions verbose label', { ns: AUTOMATION_PLUGIN })}
|
|
23
|
-
description={t('functions description', { ns: AUTOMATION_PLUGIN })}
|
|
24
|
-
>
|
|
25
|
-
<FunctionsPanel space={space} />
|
|
26
|
-
</ControlSection>
|
|
27
|
-
</ControlPage>
|
|
28
|
-
</StackItem.Content>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default FunctionsContainer;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
import React, { useCallback, useMemo } from 'react';
|
|
7
|
-
|
|
8
|
-
import { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
-
import { FunctionType, ScriptType } from '@dxos/functions';
|
|
10
|
-
import { Filter, type Space, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';
|
|
11
|
-
import { Button, useTranslation } from '@dxos/react-ui';
|
|
12
|
-
import { controlItemClasses } from '@dxos/react-ui-form';
|
|
13
|
-
import { List } from '@dxos/react-ui-list';
|
|
14
|
-
import { ghostHover, mx } from '@dxos/react-ui-theme';
|
|
15
|
-
|
|
16
|
-
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
17
|
-
|
|
18
|
-
const grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';
|
|
19
|
-
|
|
20
|
-
export type FunctionsPanelProps = {
|
|
21
|
-
space: Space;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
25
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
26
|
-
const functions = useQuery(space, Filter.type(FunctionType));
|
|
27
|
-
const scripts = useQuery(space, Filter.type(ScriptType));
|
|
28
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
29
|
-
|
|
30
|
-
const functionToScriptMap = useMemo(
|
|
31
|
-
() =>
|
|
32
|
-
functions.reduce(
|
|
33
|
-
(map, func) => {
|
|
34
|
-
const scriptId = func.source?.target?.id;
|
|
35
|
-
if (scriptId) {
|
|
36
|
-
const script = scripts.find((s) => s.id === scriptId);
|
|
37
|
-
if (script) {
|
|
38
|
-
map[func.id] = script;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return map;
|
|
42
|
-
},
|
|
43
|
-
{} as Record<string, ScriptType>,
|
|
44
|
-
),
|
|
45
|
-
[functions, scripts],
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const getScriptName = useCallback(
|
|
49
|
-
(func: FunctionType) => {
|
|
50
|
-
const script = functionToScriptMap[func.id];
|
|
51
|
-
return script?.name;
|
|
52
|
-
},
|
|
53
|
-
[functionToScriptMap],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const handleGoToScript = useCallback(
|
|
57
|
-
(func: FunctionType) => {
|
|
58
|
-
const script = functionToScriptMap[func.id];
|
|
59
|
-
if (script) {
|
|
60
|
-
void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(script)] }));
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
[functionToScriptMap, dispatch],
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div role='none' className={mx(controlItemClasses)}>
|
|
68
|
-
{functions.length > 0 && (
|
|
69
|
-
<List.Root<FunctionType> items={functions} isItem={Schema.is(FunctionType)} getId={(func) => func.id}>
|
|
70
|
-
{({ items }) => (
|
|
71
|
-
<div role='list' className='flex flex-col w-full'>
|
|
72
|
-
{items?.map((func) => (
|
|
73
|
-
<List.Item<FunctionType>
|
|
74
|
-
key={func.id}
|
|
75
|
-
item={func}
|
|
76
|
-
classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}
|
|
77
|
-
>
|
|
78
|
-
<div className='flex flex-col truncate'>
|
|
79
|
-
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
80
|
-
{getScriptName(func) && (
|
|
81
|
-
<div className='text-xs text-description truncate'>{getScriptName(func)}</div>
|
|
82
|
-
)}
|
|
83
|
-
</div>
|
|
84
|
-
{functionToScriptMap[func.id] && (
|
|
85
|
-
<Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>
|
|
86
|
-
)}
|
|
87
|
-
</List.Item>
|
|
88
|
-
))}
|
|
89
|
-
</div>
|
|
90
|
-
)}
|
|
91
|
-
</List.Root>
|
|
92
|
-
)}
|
|
93
|
-
|
|
94
|
-
{functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Ref, Type } from '@dxos/echo';
|
|
8
|
-
import { type JsonPath } from '@dxos/echo-schema';
|
|
9
|
-
import { type FunctionType } from '@dxos/functions';
|
|
10
|
-
import { useOnTransition } from '@dxos/react-ui';
|
|
11
|
-
import { Form, type FormInputStateProps, type QueryRefOptions, useFormValues } from '@dxos/react-ui-form';
|
|
12
|
-
|
|
13
|
-
export type FunctionInputEditorProps = {
|
|
14
|
-
functions: FunctionType[];
|
|
15
|
-
onQueryRefOptions: QueryRefOptions;
|
|
16
|
-
} & FormInputStateProps;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Editor component for function input parameters.
|
|
20
|
-
*/
|
|
21
|
-
export const FunctionInputEditor = ({
|
|
22
|
-
functions,
|
|
23
|
-
getValue,
|
|
24
|
-
onValueChange,
|
|
25
|
-
onQueryRefOptions,
|
|
26
|
-
}: FunctionInputEditorProps) => {
|
|
27
|
-
const selectedFunctionValue = useFormValues(['function' as JsonPath]);
|
|
28
|
-
const selectedFunctionId = useMemo(() => {
|
|
29
|
-
if (Ref.isRef(selectedFunctionValue)) {
|
|
30
|
-
return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);
|
|
31
|
-
}
|
|
32
|
-
}, [selectedFunctionValue]);
|
|
33
|
-
|
|
34
|
-
const selectedFunction = useMemo(
|
|
35
|
-
() => functions.find((fn) => fn.id === selectedFunctionId),
|
|
36
|
-
[functions, selectedFunctionId],
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
useOnTransition(
|
|
40
|
-
// Clear function parameter input when the function changes.
|
|
41
|
-
selectedFunctionValue,
|
|
42
|
-
(prevValue) => prevValue !== undefined && prevValue !== selectedFunctionValue,
|
|
43
|
-
(currValue) => currValue !== undefined,
|
|
44
|
-
() => onValueChange('object', {}),
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);
|
|
48
|
-
const effectSchema = useMemo(() => (inputSchema ? Type.toEffectSchema(inputSchema) : undefined), [inputSchema]);
|
|
49
|
-
const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
|
|
50
|
-
|
|
51
|
-
const values = useMemo(() => getValue() ?? {}, [getValue]);
|
|
52
|
-
|
|
53
|
-
const handleValuesChanged = useCallback(
|
|
54
|
-
(values: any) => {
|
|
55
|
-
onValueChange('object', values);
|
|
56
|
-
},
|
|
57
|
-
[onValueChange],
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<>
|
|
66
|
-
<h3 className='text-md'>Function parameters</h3>
|
|
67
|
-
{/* TODO(ZaymonFC): Try using <FormFields /> internal component for this nesting.
|
|
68
|
-
This would allow errors to flow up to the root context. */}
|
|
69
|
-
<Form
|
|
70
|
-
schema={effectSchema}
|
|
71
|
-
values={values}
|
|
72
|
-
onValuesChanged={handleValuesChanged}
|
|
73
|
-
onQueryRefOptions={onQueryRefOptions}
|
|
74
|
-
outerSpacing={false}
|
|
75
|
-
/>
|
|
76
|
-
</>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type FunctionTriggerType, TriggerKind, type TriggerType } from '@dxos/functions';
|
|
8
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { type InputProps, SelectInput, useInputProps } from '@dxos/react-ui-form';
|
|
10
|
-
|
|
11
|
-
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
12
|
-
|
|
13
|
-
export type SpecSelectorProps = InputProps;
|
|
14
|
-
|
|
15
|
-
export const SpecSelector = (props: SpecSelectorProps) => {
|
|
16
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
17
|
-
const specProps = useInputProps(['spec' satisfies keyof FunctionTriggerType]);
|
|
18
|
-
|
|
19
|
-
const handleTypeChange = useCallback(
|
|
20
|
-
(_type: any, value: string): TriggerType | undefined => {
|
|
21
|
-
const getDefaultTriggerSpec = (kind: string) => {
|
|
22
|
-
switch (kind) {
|
|
23
|
-
case TriggerKind.Timer:
|
|
24
|
-
return { kind: TriggerKind.Timer, cron: '' };
|
|
25
|
-
case TriggerKind.Subscription:
|
|
26
|
-
return { kind: TriggerKind.Subscription, filter: {} };
|
|
27
|
-
case TriggerKind.Queue:
|
|
28
|
-
return { kind: TriggerKind.Queue, queue: '' };
|
|
29
|
-
case TriggerKind.Email:
|
|
30
|
-
return { kind: TriggerKind.Email };
|
|
31
|
-
case TriggerKind.Webhook:
|
|
32
|
-
return { kind: TriggerKind.Webhook };
|
|
33
|
-
default:
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const defaultSpec = getDefaultTriggerSpec(value);
|
|
39
|
-
if (!defaultSpec) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Update the entire spec object, not just the `spec.kind`.
|
|
44
|
-
specProps.onValueChange('object', defaultSpec);
|
|
45
|
-
},
|
|
46
|
-
[specProps],
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const options = useMemo(
|
|
50
|
-
() =>
|
|
51
|
-
Object.values(TriggerKind).map((kind) => ({
|
|
52
|
-
value: kind,
|
|
53
|
-
label: t(`trigger type ${kind}`),
|
|
54
|
-
})),
|
|
55
|
-
[t],
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return <SelectInput {...props} options={options} onValueChange={handleTypeChange} />;
|
|
59
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
8
|
-
import React, { useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { FunctionTrigger, FunctionType, TriggerKind } from '@dxos/functions';
|
|
12
|
-
import { faker } from '@dxos/random';
|
|
13
|
-
import { useSpaces } from '@dxos/react-client/echo';
|
|
14
|
-
import { ContactType, withClientProvider } from '@dxos/react-client/testing';
|
|
15
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
16
|
-
|
|
17
|
-
import { functions } from '../../testing';
|
|
18
|
-
import { translations } from '../../translations';
|
|
19
|
-
|
|
20
|
-
import { TriggerEditor } from './TriggerEditor';
|
|
21
|
-
|
|
22
|
-
const DefaultStory = () => {
|
|
23
|
-
const spaces = useSpaces();
|
|
24
|
-
const space = spaces[1];
|
|
25
|
-
const [trigger, setTrigger] = useState<FunctionTrigger>();
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (!space) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const trigger = space.db.add(Obj.make(FunctionTrigger, { spec: { kind: TriggerKind.Timer, cron: '' } }));
|
|
32
|
-
setTrigger(trigger);
|
|
33
|
-
}, [space]);
|
|
34
|
-
|
|
35
|
-
if (!space || !trigger) {
|
|
36
|
-
return <div />;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div role='none' className='w-[32rem] bs-fit border border-separator rounded-sm'>
|
|
41
|
-
<TriggerEditor space={space} trigger={trigger} onSave={(values) => console.log('on save', values)} />
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const meta: Meta = {
|
|
47
|
-
title: 'plugins/plugin-automation/TriggerEditor',
|
|
48
|
-
component: TriggerEditor,
|
|
49
|
-
render: DefaultStory,
|
|
50
|
-
decorators: [
|
|
51
|
-
withClientProvider({
|
|
52
|
-
createIdentity: true,
|
|
53
|
-
createSpace: true,
|
|
54
|
-
types: [FunctionType, FunctionTrigger, ContactType],
|
|
55
|
-
onSpaceCreated: ({ space }) => {
|
|
56
|
-
for (const fn of functions) {
|
|
57
|
-
space.db.add(Obj.make(FunctionType, fn));
|
|
58
|
-
}
|
|
59
|
-
Array.from({ length: 10 }).map(() => {
|
|
60
|
-
return space.db.add(
|
|
61
|
-
Obj.make(ContactType, {
|
|
62
|
-
name: faker.person.fullName(),
|
|
63
|
-
identifiers: [],
|
|
64
|
-
}),
|
|
65
|
-
);
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center m-2' }),
|
|
70
|
-
withTheme,
|
|
71
|
-
],
|
|
72
|
-
parameters: {
|
|
73
|
-
translations,
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export default meta;
|
|
78
|
-
|
|
79
|
-
export const Default = {};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { ComputeGraph } from '@dxos/conductor';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
type FunctionTrigger,
|
|
11
|
-
FunctionTriggerSchema,
|
|
12
|
-
type FunctionTriggerType,
|
|
13
|
-
FunctionType,
|
|
14
|
-
ScriptType,
|
|
15
|
-
} from '@dxos/functions';
|
|
16
|
-
import { Filter, Ref, type Space, useQuery } from '@dxos/react-client/echo';
|
|
17
|
-
import { type CustomInputMap, Form, SelectInput, useRefQueryLookupHandler } from '@dxos/react-ui-form';
|
|
18
|
-
|
|
19
|
-
import { FunctionInputEditor, type FunctionInputEditorProps } from './FunctionInputEditor';
|
|
20
|
-
import { SpecSelector } from './SpecSelector';
|
|
21
|
-
|
|
22
|
-
export type TriggerEditorProps = {
|
|
23
|
-
space: Space;
|
|
24
|
-
trigger: FunctionTriggerType;
|
|
25
|
-
onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;
|
|
26
|
-
onCancel?: () => void;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {
|
|
30
|
-
const handleSave = (values: FunctionTriggerType) => {
|
|
31
|
-
onSave?.(values);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
35
|
-
const Custom = useCustomInputs(space, handleRefQueryLookup);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Form
|
|
39
|
-
outerSpacing={false}
|
|
40
|
-
Custom={Custom}
|
|
41
|
-
schema={FunctionTriggerSchema}
|
|
42
|
-
values={trigger}
|
|
43
|
-
onSave={handleSave}
|
|
44
|
-
onCancel={onCancel}
|
|
45
|
-
onQueryRefOptions={handleRefQueryLookup}
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorProps['onQueryRefOptions']) => {
|
|
51
|
-
const functions = useQuery(space, Filter.type(FunctionType));
|
|
52
|
-
const workflows = useQuery(space, Filter.type(ComputeGraph));
|
|
53
|
-
const scripts = useQuery(space, Filter.type(ScriptType));
|
|
54
|
-
|
|
55
|
-
return useMemo(
|
|
56
|
-
(): CustomInputMap => ({
|
|
57
|
-
// Function selector.
|
|
58
|
-
['function' satisfies keyof FunctionTriggerType]: (props) => {
|
|
59
|
-
const getValue = useCallback(() => {
|
|
60
|
-
const formValue = props.getValue();
|
|
61
|
-
if (Ref.isRef(formValue)) {
|
|
62
|
-
return formValue.dxn.toString() as string;
|
|
63
|
-
}
|
|
64
|
-
return undefined;
|
|
65
|
-
}, [props]);
|
|
66
|
-
|
|
67
|
-
const handleOnValueChange = useCallback(
|
|
68
|
-
(_type: any, dxnString: string) => {
|
|
69
|
-
const dxn = Type.DXN.parse(dxnString);
|
|
70
|
-
if (dxn) {
|
|
71
|
-
const ref = Ref.fromDXN(dxn);
|
|
72
|
-
props.onValueChange('object', ref);
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
[props.onValueChange],
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<SelectInput
|
|
80
|
-
{...props}
|
|
81
|
-
getValue={getValue as any}
|
|
82
|
-
onValueChange={handleOnValueChange}
|
|
83
|
-
options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}
|
|
84
|
-
/>
|
|
85
|
-
);
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
// Spec selector.
|
|
89
|
-
['spec.kind' as const]: SpecSelector,
|
|
90
|
-
|
|
91
|
-
// Function input editor.
|
|
92
|
-
['input' as const]: (props) => (
|
|
93
|
-
<FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />
|
|
94
|
-
),
|
|
95
|
-
}),
|
|
96
|
-
[workflows, scripts, functions],
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const getWorkflowOptions = (graphs: ComputeGraph[]) => {
|
|
101
|
-
return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const getFunctionOptions = (scripts: ScriptType[], functions: FunctionType[]) => {
|
|
105
|
-
const getLabel = (fn: FunctionType) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
106
|
-
return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));
|
|
107
|
-
};
|
|
File without changes
|
/package/dist/lib/{browser/FunctionsPanel-I443Y6KB.mjs.map → neutral/AutomationPlugin.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/lib/{node-esm/AutomationPanel-5EQQF5S2.mjs.map → neutral/chunk-J5LGTIGS.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|