@dxos/plugin-automation 0.8.4-main.b97322e → 0.8.4-main.bc2380dfbc
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/README.md +1 -1
- package/dist/lib/neutral/AutomationPanel-T5O4DNQF.mjs +11 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs +1112 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs +23 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/AutomationSettings-UVS5STCS.mjs +31 -0
- package/dist/lib/neutral/AutomationSettings-UVS5STCS.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsContainer-CDCM65U4.mjs +38 -0
- package/dist/lib/neutral/FunctionsContainer-CDCM65U4.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsPanel-SVRKRUXZ.mjs +97 -0
- package/dist/lib/neutral/FunctionsPanel-SVRKRUXZ.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsRegistry-7ITCFJCW.mjs +95 -0
- package/dist/lib/neutral/FunctionsRegistry-7ITCFJCW.mjs.map +7 -0
- package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
- package/dist/lib/neutral/app-graph-builder-GDCGRYEP.mjs +75 -0
- package/dist/lib/neutral/app-graph-builder-GDCGRYEP.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +15 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +13 -0
- package/dist/lib/neutral/capabilities/node.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-2UYFDJO6.mjs +12 -0
- package/dist/lib/neutral/chunk-2UYFDJO6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ATECY555.mjs +20 -0
- package/dist/lib/neutral/chunk-ATECY555.mjs.map +7 -0
- package/dist/lib/neutral/chunk-CNFKEN7S.mjs +37 -0
- package/dist/lib/neutral/chunk-CNFKEN7S.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DSCOLDT5.mjs +93 -0
- package/dist/lib/neutral/chunk-DSCOLDT5.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-JKVVCWSL.mjs +307 -0
- package/dist/lib/neutral/chunk-JKVVCWSL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-K3C5ZTZA.mjs +285 -0
- package/dist/lib/neutral/chunk-K3C5ZTZA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-M3TIHFXN.mjs +8 -0
- package/dist/lib/neutral/chunk-M3TIHFXN.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +16 -0
- package/dist/lib/neutral/compute-runtime-D7MPZJ4R.mjs +222 -0
- package/dist/lib/neutral/compute-runtime-D7MPZJ4R.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-trigger-from-template-7K3OYOHQ.mjs +68 -0
- package/dist/lib/neutral/create-trigger-from-template-7K3OYOHQ.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +129 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +20 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.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-3OGMAMKV.mjs +57 -0
- package/dist/lib/neutral/react-surface-3OGMAMKV.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 +47 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +16 -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/compute-runtime.d.ts +14 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +6 -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/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 +11 -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 +12 -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 +46 -0
- package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -3
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +50 -4
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +4 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
- 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 +11 -8
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +121 -4
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +6 -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/FunctionsContainer/FunctionsContainer.d.ts +4 -0
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts +2 -0
- package/dist/types/src/containers/FunctionsContainer/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 +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntime.d.ts +8 -0
- package/dist/types/src/hooks/useComputeRuntime.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +9 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts +17 -0
- package/dist/types/src/hooks/useComputeRuntimeService.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-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/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +204 -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 +32 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AutomationCapabilities.d.ts +22 -0
- package/dist/types/src/types/AutomationCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AutomationEvents.d.ts +3 -0
- package/dist/types/src/types/AutomationEvents.d.ts.map +1 -0
- package/dist/types/src/types/AutomationOperation.d.ts +19 -0
- package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +12 -4
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +147 -50
- package/src/AutomationPlugin.node.ts +29 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +23 -34
- package/src/AutomationPlugin.workerd.ts +18 -0
- package/src/capabilities/app-graph-builder.ts +59 -79
- package/src/capabilities/compute-runtime.ts +326 -0
- package/src/capabilities/index.ts +9 -4
- package/src/capabilities/node.ts +13 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +49 -46
- package/src/commands/index.ts +5 -0
- package/src/commands/trigger/create/index.ts +14 -0
- package/src/commands/trigger/create/queue.ts +86 -0
- package/src/commands/trigger/create/subscription.ts +125 -0
- package/src/commands/trigger/create/timer.ts +90 -0
- package/src/commands/trigger/index.ts +16 -0
- package/src/commands/trigger/list.ts +70 -0
- package/src/commands/trigger/options.ts +59 -0
- package/src/commands/trigger/remove.ts +44 -0
- package/src/commands/trigger/update/index.ts +14 -0
- package/src/commands/trigger/update/queue.ts +194 -0
- package/src/commands/trigger/update/subscription.ts +278 -0
- package/src/commands/trigger/update/timer.ts +193 -0
- package/src/commands/trigger/util.ts +412 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +23 -17
- package/src/components/AutomationPanel/AutomationPanel.tsx +289 -94
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +52 -32
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +119 -0
- package/src/components/FunctionsRegistry/index.ts +8 -0
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +42 -35
- package/src/components/TriggerEditor/SpecSelector.tsx +34 -22
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +134 -40
- package/src/components/TriggerEditor/TriggerEditor.tsx +109 -48
- package/src/components/index.ts +1 -2
- package/src/containers/AutomationSettings/AutomationSettings.tsx +31 -0
- package/src/containers/AutomationSettings/index.ts +5 -0
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +33 -0
- package/src/containers/FunctionsContainer/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 +9 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useComputeRuntime.ts +30 -0
- package/src/hooks/useComputeRuntimeCallback.ts +31 -0
- package/src/hooks/useComputeRuntimeService.ts +64 -0
- package/src/hooks/useTriggerRuntimeControls.ts +70 -0
- package/src/index.ts +1 -3
- package/src/meta.ts +10 -8
- package/src/operations/create-trigger-from-template.ts +71 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/testing/test-functions.ts +13 -10
- package/src/testing.ts +7 -0
- package/src/translations.ts +39 -29
- package/src/types/AutomationCapabilities.ts +48 -0
- package/src/types/AutomationEvents.ts +11 -0
- package/src/types/AutomationOperation.ts +30 -0
- package/src/types/index.ts +4 -0
- package/src/types/schema.ts +6 -6
- package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs +0 -38
- package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-ZWA6GOFY.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs +0 -39
- package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-56ZKRVM5.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-ZTAUTFI4.mjs +0 -80
- package/dist/lib/browser/app-graph-builder-ZTAUTFI4.mjs.map +0 -7
- package/dist/lib/browser/chunk-ECSTS2UI.mjs +0 -14
- package/dist/lib/browser/chunk-ECSTS2UI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ERTIGJYE.mjs +0 -147
- package/dist/lib/browser/chunk-ERTIGJYE.mjs.map +0 -7
- package/dist/lib/browser/chunk-FSJZXTS2.mjs +0 -230
- package/dist/lib/browser/chunk-FSJZXTS2.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-LYJVTIVD.mjs +0 -94
- package/dist/lib/browser/chunk-LYJVTIVD.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-U3ZAQEFW.mjs +0 -76
- package/dist/lib/browser/intent-resolver-U3ZAQEFW.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-4DFSM7OX.mjs +0 -64
- package/dist/lib/browser/react-surface-4DFSM7OX.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs +0 -39
- package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-YYUMSK2W.mjs +0 -12
- package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs +0 -40
- package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-KGIOZSPZ.mjs +0 -11
- package/dist/lib/node-esm/app-graph-builder-3FP63ZSG.mjs +0 -81
- package/dist/lib/node-esm/app-graph-builder-3FP63ZSG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AZH66CED.mjs +0 -231
- package/dist/lib/node-esm/chunk-AZH66CED.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HIMYPGHF.mjs +0 -148
- package/dist/lib/node-esm/chunk-HIMYPGHF.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-SGZPTJ47.mjs +0 -16
- package/dist/lib/node-esm/chunk-SGZPTJ47.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZGPUV5VS.mjs +0 -95
- package/dist/lib/node-esm/chunk-ZGPUV5VS.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-3QWXEBPX.mjs +0 -77
- package/dist/lib/node-esm/intent-resolver-3QWXEBPX.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-3PNW7NDW.mjs +0 -65
- package/dist/lib/node-esm/react-surface-3PNW7NDW.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/FunctionsContainer.d.ts +0 -7
- package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/components/AutomationContainer.tsx +0 -30
- package/src/components/FunctionsContainer.tsx +0 -31
- /package/dist/lib/{browser/AutomationPanel-ZWA6GOFY.mjs.map → neutral/AutomationPanel-T5O4DNQF.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-56ZKRVM5.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-YYUMSK2W.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral/components}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-KGIOZSPZ.mjs.map → neutral/index.mjs.map} +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import React, { useCallback } from 'react';
|
|
8
|
+
|
|
9
|
+
import * as OperationModule from '@dxos/compute';
|
|
10
|
+
import { Context } from '@dxos/context';
|
|
11
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
12
|
+
import { getDeployedFunctions } from '@dxos/functions-runtime/edge';
|
|
13
|
+
import { useClient } from '@dxos/react-client';
|
|
14
|
+
import { type Space, useQuery } from '@dxos/react-client/echo';
|
|
15
|
+
import { IconButton, useAsyncEffect, useTranslation } from '@dxos/react-ui';
|
|
16
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
17
|
+
import { List } from '@dxos/react-ui-list';
|
|
18
|
+
import { ghostHover, mx } from '@dxos/ui-theme';
|
|
19
|
+
|
|
20
|
+
import { meta } from '#meta';
|
|
21
|
+
|
|
22
|
+
const grid = 'grid grid-cols-[1fr_1fr_auto] min-h-[2.5rem]';
|
|
23
|
+
|
|
24
|
+
type FunctionsRegistryProps = {
|
|
25
|
+
space: Space;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {
|
|
29
|
+
const client = useClient();
|
|
30
|
+
const [loading, setLoading] = useState(true);
|
|
31
|
+
const [functions, setFunctions] = useState<OperationModule.Operation.PersistentOperation[]>([]);
|
|
32
|
+
const { t } = useTranslation(meta.id);
|
|
33
|
+
|
|
34
|
+
const dbFunctions = useQuery(space.db, Filter.type(OperationModule.Operation.PersistentOperation));
|
|
35
|
+
|
|
36
|
+
const state = (func: OperationModule.Operation.PersistentOperation) => {
|
|
37
|
+
const funcKey = Obj.getMeta(func).key;
|
|
38
|
+
const dbFunction = dbFunctions.find((f) => Obj.getMeta(f).key === funcKey);
|
|
39
|
+
if (!dbFunction) {
|
|
40
|
+
return 'import';
|
|
41
|
+
}
|
|
42
|
+
if (Obj.getMeta(dbFunction).version === Obj.getMeta(func).version && dbFunction.updated === func.updated) {
|
|
43
|
+
return 'none';
|
|
44
|
+
}
|
|
45
|
+
return 'update';
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
useAsyncEffect(async () => {
|
|
49
|
+
setLoading(true);
|
|
50
|
+
const functions = await getDeployedFunctions(Context.default(), client, true);
|
|
51
|
+
setFunctions(functions);
|
|
52
|
+
setLoading(false);
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
55
|
+
const hanleImportOrUpdate = useCallback(
|
|
56
|
+
async (func: OperationModule.Operation.PersistentOperation) => {
|
|
57
|
+
const funcKey = Obj.getMeta(func).key;
|
|
58
|
+
const functions = funcKey
|
|
59
|
+
? await space.db
|
|
60
|
+
.query(Filter.and(Filter.type(OperationModule.Operation.PersistentOperation), Filter.key(funcKey)))
|
|
61
|
+
.run()
|
|
62
|
+
: [];
|
|
63
|
+
const [existingFunc] = functions;
|
|
64
|
+
if (!existingFunc) {
|
|
65
|
+
space.db.add(func);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
OperationModule.Operation.setFrom(existingFunc, func);
|
|
69
|
+
},
|
|
70
|
+
[space],
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Settings.Panel>
|
|
75
|
+
{functions.length > 0 && (
|
|
76
|
+
<List.Root<OperationModule.Operation.PersistentOperation>
|
|
77
|
+
items={functions}
|
|
78
|
+
isItem={Schema.is(OperationModule.Operation.PersistentOperation)}
|
|
79
|
+
getId={(func) => func.id}
|
|
80
|
+
>
|
|
81
|
+
{({ items }) => (
|
|
82
|
+
<div role='list' className='flex flex-col w-full'>
|
|
83
|
+
{items?.map((func) => (
|
|
84
|
+
<List.Item<OperationModule.Operation.PersistentOperation>
|
|
85
|
+
key={func.id}
|
|
86
|
+
item={func}
|
|
87
|
+
classNames={mx(grid, ghostHover, 'items-center', 'px-2', 'min-h-[3rem]')}
|
|
88
|
+
>
|
|
89
|
+
<div className='flex flex-col truncate'>
|
|
90
|
+
<List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>
|
|
91
|
+
<div className='text-xs text-description truncate'>{Obj.getMeta(func).key}</div>
|
|
92
|
+
</div>
|
|
93
|
+
<div className='flex flex-col truncate'>
|
|
94
|
+
<div className='text-xs text-description truncate'>{Obj.getMeta(func).version}</div>
|
|
95
|
+
<div className='text-xs text-description truncate'>
|
|
96
|
+
{func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<IconButton
|
|
101
|
+
iconOnly
|
|
102
|
+
icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}
|
|
103
|
+
label={
|
|
104
|
+
state(func) === 'update' ? t('update-function-button.label') : t('import-function-button.label')
|
|
105
|
+
}
|
|
106
|
+
disabled={state(func) === 'none'}
|
|
107
|
+
onClick={() => hanleImportOrUpdate(func)}
|
|
108
|
+
/>
|
|
109
|
+
</List.Item>
|
|
110
|
+
))}
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
</List.Root>
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
{loading && <div className='text-center py-4 text-gray-500'>{t('loading-functions.message')}</div>}
|
|
117
|
+
</Settings.Panel>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -2,29 +2,26 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type * as SchemaAST from 'effect/SchemaAST';
|
|
5
6
|
import React, { useCallback, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import { type
|
|
9
|
-
import { type
|
|
10
|
-
import { useOnTransition } from '@dxos/react-ui';
|
|
11
|
-
import { Form, type
|
|
8
|
+
import { type Operation } from '@dxos/compute';
|
|
9
|
+
import { type Database, JsonSchema, Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { type JsonPath } from '@dxos/echo/internal';
|
|
11
|
+
import { useOnTransition, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { Form, type FormFieldStateProps, type FormRootProps, useFormValues } from '@dxos/react-ui-form';
|
|
13
|
+
|
|
14
|
+
import { meta } from '#meta';
|
|
12
15
|
|
|
13
16
|
export type FunctionInputEditorProps = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
type: SchemaAST.AST;
|
|
18
|
+
functions: Operation.PersistentOperation[];
|
|
19
|
+
db?: Database.Database;
|
|
20
|
+
} & FormFieldStateProps;
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const FunctionInputEditor = ({
|
|
22
|
-
functions,
|
|
23
|
-
getValue,
|
|
24
|
-
onValueChange,
|
|
25
|
-
onQueryRefOptions,
|
|
26
|
-
}: FunctionInputEditorProps) => {
|
|
27
|
-
const selectedFunctionValue = useFormValues(['function' as JsonPath]);
|
|
22
|
+
export const FunctionInputEditor = ({ type, functions, db, getValue, onValueChange }: FunctionInputEditorProps) => {
|
|
23
|
+
const { t } = useTranslation(meta.id);
|
|
24
|
+
const selectedFunctionValue = useFormValues(FunctionInputEditor.displayName, ['function' as JsonPath]);
|
|
28
25
|
const selectedFunctionId = useMemo(() => {
|
|
29
26
|
if (Ref.isRef(selectedFunctionValue)) {
|
|
30
27
|
return selectedFunctionValue.dxn.toString().split('dxn:echo:@:').at(1);
|
|
@@ -39,22 +36,30 @@ export const FunctionInputEditor = ({
|
|
|
39
36
|
useOnTransition(
|
|
40
37
|
// Clear function parameter input when the function changes.
|
|
41
38
|
selectedFunctionValue,
|
|
42
|
-
(prevValue) =>
|
|
39
|
+
(prevValue) => {
|
|
40
|
+
if (!Ref.isRef(prevValue) || !Ref.isRef(selectedFunctionValue)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return prevValue.dxn.toString() !== selectedFunctionValue.dxn.toString();
|
|
45
|
+
},
|
|
43
46
|
(currValue) => currValue !== undefined,
|
|
44
|
-
() => onValueChange(
|
|
47
|
+
() => onValueChange(type, {}),
|
|
45
48
|
);
|
|
46
49
|
|
|
47
50
|
const inputSchema = useMemo(() => selectedFunction?.inputSchema, [selectedFunction]);
|
|
48
|
-
const effectSchema = useMemo(() => (inputSchema ?
|
|
51
|
+
const effectSchema = useMemo(() => (inputSchema ? JsonSchema.toEffectSchema(inputSchema) : undefined), [inputSchema]);
|
|
49
52
|
const propertyCount = inputSchema?.properties ? Object.keys(inputSchema.properties).length : 0;
|
|
53
|
+
const defaultValues = useMemo(() => {
|
|
54
|
+
const raw = getValue() ?? {};
|
|
55
|
+
return Obj.isObject(raw) ? { ...Obj.getSnapshot(raw) } : { ...raw };
|
|
56
|
+
}, [getValue]);
|
|
50
57
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(values: any) => {
|
|
55
|
-
onValueChange('object', values);
|
|
58
|
+
const handleValuesChanged = useCallback<NonNullable<FormRootProps['onValuesChanged']>>(
|
|
59
|
+
(values) => {
|
|
60
|
+
onValueChange(type, values);
|
|
56
61
|
},
|
|
57
|
-
[onValueChange],
|
|
62
|
+
[type, onValueChange],
|
|
58
63
|
);
|
|
59
64
|
|
|
60
65
|
if (selectedFunction === undefined || effectSchema === undefined || propertyCount === 0) {
|
|
@@ -63,16 +68,18 @@ export const FunctionInputEditor = ({
|
|
|
63
68
|
|
|
64
69
|
return (
|
|
65
70
|
<>
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<Form
|
|
71
|
+
<Form.Label label={t('function-parameters.label')} asChild />
|
|
72
|
+
<Form.Root
|
|
73
|
+
key={selectedFunction.id}
|
|
70
74
|
schema={effectSchema}
|
|
71
|
-
|
|
75
|
+
defaultValues={defaultValues}
|
|
76
|
+
db={db}
|
|
72
77
|
onValuesChanged={handleValuesChanged}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
>
|
|
79
|
+
<Form.FieldSet />
|
|
80
|
+
</Form.Root>
|
|
76
81
|
</>
|
|
77
82
|
);
|
|
78
83
|
};
|
|
84
|
+
|
|
85
|
+
FunctionInputEditor.displayName = 'AutomationTrigger.FunctionInputEditor';
|
|
@@ -4,32 +4,33 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Trigger } from '@dxos/compute';
|
|
8
|
+
import { Filter, Query } from '@dxos/echo';
|
|
8
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
10
|
+
import { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { meta } from '#meta';
|
|
12
13
|
|
|
13
|
-
export type SpecSelectorProps =
|
|
14
|
+
export type SpecSelectorProps = FormFieldComponentProps;
|
|
14
15
|
|
|
15
16
|
export const SpecSelector = (props: SpecSelectorProps) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
17
|
-
const specProps =
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
|
+
const specProps = useFormFieldState(SpecSelector.displayName, ['spec' satisfies keyof Trigger.Trigger]);
|
|
18
19
|
|
|
19
20
|
const handleTypeChange = useCallback(
|
|
20
|
-
(_type: any, value: string):
|
|
21
|
+
(_type: any, value: string): Trigger.Spec | undefined => {
|
|
21
22
|
const getDefaultTriggerSpec = (kind: string) => {
|
|
22
23
|
switch (kind) {
|
|
23
|
-
case
|
|
24
|
-
return
|
|
25
|
-
case
|
|
26
|
-
return
|
|
27
|
-
case
|
|
28
|
-
return
|
|
29
|
-
case
|
|
30
|
-
return
|
|
31
|
-
case
|
|
32
|
-
return
|
|
24
|
+
case 'timer':
|
|
25
|
+
return Trigger.specTimer('');
|
|
26
|
+
case 'subscription':
|
|
27
|
+
return Trigger.specSubscription(Query.select(Filter.nothing()));
|
|
28
|
+
case 'queue':
|
|
29
|
+
return Trigger.specQueue('dxn:queue:default');
|
|
30
|
+
case 'email':
|
|
31
|
+
return Trigger.specEmail();
|
|
32
|
+
case 'webhook':
|
|
33
|
+
return Trigger.specWebhook();
|
|
33
34
|
default:
|
|
34
35
|
return undefined;
|
|
35
36
|
}
|
|
@@ -41,19 +42,30 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
// Update the entire spec object, not just the `spec.kind`.
|
|
44
|
-
specProps.onValueChange(
|
|
45
|
+
specProps.onValueChange(props.type, defaultSpec);
|
|
45
46
|
},
|
|
46
|
-
[specProps],
|
|
47
|
+
[props.type, specProps],
|
|
47
48
|
);
|
|
48
49
|
|
|
50
|
+
const kindLabels: Record<string, string> = {
|
|
51
|
+
timer: t('trigger-type.timer.label'),
|
|
52
|
+
webhook: t('trigger-type.webhook.label'),
|
|
53
|
+
websocket: t('trigger-type.websocket.label'),
|
|
54
|
+
subscription: t('trigger-type.subscription.label'),
|
|
55
|
+
email: t('trigger-type.email.label'),
|
|
56
|
+
queue: t('trigger-type.queue.label'),
|
|
57
|
+
};
|
|
58
|
+
|
|
49
59
|
const options = useMemo(
|
|
50
60
|
() =>
|
|
51
|
-
|
|
61
|
+
Trigger.Kinds.map((kind) => ({
|
|
52
62
|
value: kind,
|
|
53
|
-
label:
|
|
63
|
+
label: kindLabels[kind],
|
|
54
64
|
})),
|
|
55
65
|
[t],
|
|
56
66
|
);
|
|
57
67
|
|
|
58
|
-
return <
|
|
68
|
+
return <SelectField {...props} options={options} onValueChange={handleTypeChange} />;
|
|
59
69
|
};
|
|
70
|
+
|
|
71
|
+
SpecSelector.displayName = 'Form.SpecSelector';
|
|
@@ -2,32 +2,57 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
8
|
+
|
|
9
|
+
import { Operation, Trigger } from '@dxos/compute';
|
|
10
|
+
import { Filter, Obj, Ref, Tag, Type } from '@dxos/echo';
|
|
11
|
+
import { invariant } from '@dxos/invariant';
|
|
12
|
+
import { random } from '@dxos/random';
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { TestSchema, useClientStory, withClientProvider } from '@dxos/react-client/testing';
|
|
15
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
16
|
+
import { translations as formTranslations } from '@dxos/react-ui-form/translations';
|
|
17
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
18
|
+
import { Employer, Organization, Person, Pipeline } from '@dxos/types';
|
|
19
|
+
|
|
20
|
+
import { functions } from '#testing';
|
|
21
|
+
import { translations } from '#translations';
|
|
22
|
+
|
|
23
|
+
import { TriggerEditor, type TriggerEditorProps } from './TriggerEditor';
|
|
24
|
+
|
|
25
|
+
const types = [
|
|
26
|
+
// TODO(burdon): Get label from annotation.
|
|
27
|
+
{ value: Organization.Organization.typename, label: 'Organization' },
|
|
28
|
+
{ value: Person.Person.typename, label: 'Person' },
|
|
29
|
+
{ value: Type.getTypename(Pipeline.Pipeline), label: 'Project' },
|
|
30
|
+
{ value: Employer.Employer.typename, label: 'Employer' },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
34
|
+
const { space } = useClientStory();
|
|
35
|
+
const [trigger, setTrigger] = useState<Trigger.Trigger>();
|
|
36
|
+
const tags = useQuery(space?.db, Filter.type(Tag.Tag));
|
|
37
|
+
|
|
38
|
+
useAsyncEffect(async () => {
|
|
26
39
|
if (!space) {
|
|
27
40
|
return;
|
|
28
41
|
}
|
|
29
42
|
|
|
30
|
-
const
|
|
43
|
+
const functions = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
|
|
44
|
+
const fn = functions.find((fn) => fn.name === 'com.example.function.forex');
|
|
45
|
+
invariant(fn);
|
|
46
|
+
const trigger = space.db.add(
|
|
47
|
+
Trigger.make({
|
|
48
|
+
function: Ref.make(fn),
|
|
49
|
+
spec: Trigger.specWebhook(),
|
|
50
|
+
input: {
|
|
51
|
+
from: 'USD',
|
|
52
|
+
to: 'JPY',
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
31
56
|
setTrigger(trigger);
|
|
32
57
|
}, [space]);
|
|
33
58
|
|
|
@@ -36,43 +61,112 @@ const DefaultStory = () => {
|
|
|
36
61
|
}
|
|
37
62
|
|
|
38
63
|
return (
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
64
|
+
<TriggerEditor
|
|
65
|
+
db={space.db}
|
|
66
|
+
trigger={trigger}
|
|
67
|
+
types={types}
|
|
68
|
+
tags={tags}
|
|
69
|
+
onSave={(values) => console.log('on save', values)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
42
72
|
);
|
|
43
73
|
};
|
|
44
74
|
|
|
45
|
-
const meta
|
|
46
|
-
title: 'plugins/plugin-automation/TriggerEditor',
|
|
47
|
-
component: TriggerEditor,
|
|
75
|
+
const meta = {
|
|
76
|
+
title: 'plugins/plugin-automation/components/TriggerEditor',
|
|
77
|
+
component: TriggerEditor as any,
|
|
48
78
|
render: DefaultStory,
|
|
49
79
|
decorators: [
|
|
80
|
+
withTheme(),
|
|
81
|
+
withLayout({ layout: 'column' }),
|
|
50
82
|
withClientProvider({
|
|
51
83
|
createIdentity: true,
|
|
52
84
|
createSpace: true,
|
|
53
|
-
types: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
85
|
+
types: [Tag.Tag, Operation.PersistentOperation, Trigger.Trigger, TestSchema.ContactType],
|
|
86
|
+
onCreateSpace: ({ space }) => {
|
|
87
|
+
// Tags.
|
|
88
|
+
['Important', 'Investor', 'New'].forEach((label) => {
|
|
89
|
+
space.db.add(Tag.make({ label }));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Functions.
|
|
93
|
+
functions.forEach((fn) => {
|
|
94
|
+
const { key, version, ...data } = fn;
|
|
95
|
+
space.db.add(
|
|
96
|
+
Obj.make(Operation.PersistentOperation, {
|
|
97
|
+
[Obj.Meta]: { key, version: version ?? '0.1.0' },
|
|
98
|
+
...data,
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Objects.
|
|
58
104
|
Array.from({ length: 10 }).map(() => {
|
|
59
105
|
return space.db.add(
|
|
60
|
-
Obj.make(ContactType, {
|
|
61
|
-
name:
|
|
106
|
+
Obj.make(TestSchema.ContactType, {
|
|
107
|
+
name: random.person.fullName(),
|
|
62
108
|
identifiers: [],
|
|
63
109
|
}),
|
|
64
110
|
);
|
|
65
111
|
});
|
|
66
112
|
},
|
|
67
113
|
}),
|
|
68
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center m-2' }),
|
|
69
|
-
withTheme,
|
|
70
114
|
],
|
|
71
115
|
parameters: {
|
|
72
|
-
|
|
116
|
+
layout: 'fullscreen',
|
|
117
|
+
translations: [...formTranslations, ...translations],
|
|
73
118
|
},
|
|
74
|
-
}
|
|
119
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
75
120
|
|
|
76
121
|
export default meta;
|
|
77
122
|
|
|
78
|
-
|
|
123
|
+
type Story = StoryObj<typeof meta>;
|
|
124
|
+
|
|
125
|
+
export const Default: Story = {};
|
|
126
|
+
|
|
127
|
+
export const ReadonlySpec: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
readonlySpec: true,
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const Spec: Story = {
|
|
134
|
+
play: async ({ canvasElement }) => {
|
|
135
|
+
const canvas = within(canvasElement);
|
|
136
|
+
const webhookText = await canvas.findByText('Webhook', {}, { timeout: 10_000 });
|
|
137
|
+
const combobox = webhookText.closest('[role="combobox"]') as HTMLElement;
|
|
138
|
+
await expect(combobox).not.toBeDisabled();
|
|
139
|
+
|
|
140
|
+
// Helper to switch to a kind via keyboard.
|
|
141
|
+
// TODO(wittjosiah): Radix Select in popper mode doesn't close on click.
|
|
142
|
+
// Use keyboard navigation: open, type first letter to jump, Enter to select.
|
|
143
|
+
const selectKind = async (combobox: HTMLElement, firstLetter: string) => {
|
|
144
|
+
combobox.focus();
|
|
145
|
+
await userEvent.keyboard('{Enter}');
|
|
146
|
+
await userEvent.keyboard(firstLetter);
|
|
147
|
+
await userEvent.keyboard('{Enter}');
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// Timer — should show "Cron" field.
|
|
151
|
+
await selectKind(combobox, 't');
|
|
152
|
+
await expect(canvas.findByLabelText('Cron')).resolves.toBeInTheDocument();
|
|
153
|
+
|
|
154
|
+
// Email — no extra fields; Cron should be gone.
|
|
155
|
+
await selectKind(combobox, 'e');
|
|
156
|
+
await expect(combobox).not.toBeDisabled();
|
|
157
|
+
await expect(canvas.queryByLabelText('Cron')).not.toBeInTheDocument();
|
|
158
|
+
|
|
159
|
+
// Webhook — should show "Method" field.
|
|
160
|
+
await selectKind(combobox, 'w');
|
|
161
|
+
await expect(canvas.findByLabelText('Method')).resolves.toBeInTheDocument();
|
|
162
|
+
|
|
163
|
+
// Subscription — should show query editor.
|
|
164
|
+
await selectKind(combobox, 's');
|
|
165
|
+
await expect(combobox).not.toBeDisabled();
|
|
166
|
+
await expect(canvas.queryByLabelText('Method')).not.toBeInTheDocument();
|
|
167
|
+
|
|
168
|
+
// Feed — should show DXN field (the queue address). DXN is a combobox, not an input, so use getByText.
|
|
169
|
+
await selectKind(combobox, 'f');
|
|
170
|
+
await expect(canvas.findByText('DXN')).resolves.toBeInTheDocument();
|
|
171
|
+
},
|
|
172
|
+
};
|