@dxos/plugin-automation 0.8.2-main.2f9c567 → 0.8.2-main.5885341
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/{AutomationContainer-3MP23OGQ.mjs → AutomationContainer-KEQ5RNIW.mjs} +3 -3
- package/dist/lib/browser/{AutomationPanel-75HVBBNG.mjs → AutomationPanel-G3OB6ELR.mjs} +3 -3
- package/dist/lib/browser/{FunctionsContainer-HLISW5QI.mjs → FunctionsContainer-STXBW4CX.mjs} +2 -2
- package/dist/lib/browser/{FunctionsPanel-OKFRBXLO.mjs → FunctionsPanel-JJPLIAJW.mjs} +2 -2
- package/dist/lib/browser/{chunk-IDCVJ2JW.mjs → chunk-65VL4EYS.mjs} +4 -4
- package/dist/lib/browser/chunk-65VL4EYS.mjs.map +7 -0
- package/dist/lib/browser/chunk-FALBBJNO.mjs +138 -0
- package/dist/lib/browser/chunk-FALBBJNO.mjs.map +7 -0
- package/dist/lib/browser/chunk-FCLWFVFX.mjs +39 -0
- package/dist/lib/browser/chunk-FCLWFVFX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HTVXRMNH.mjs → chunk-NGG4ICAQ.mjs} +7 -7
- package/dist/lib/browser/chunk-NGG4ICAQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-N4PTKEWO.mjs → chunk-QJPKWYTL.mjs} +5 -5
- package/dist/lib/browser/index.mjs +5 -5
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/{intent-resolver-YH4YPX52.mjs → intent-resolver-SNIAQ7V5.mjs} +8 -7
- package/dist/lib/browser/intent-resolver-SNIAQ7V5.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-GA67CQBV.mjs → react-surface-L22QIANU.mjs} +4 -4
- package/dist/lib/browser/{react-surface-GA67CQBV.mjs.map → react-surface-L22QIANU.mjs.map} +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{AutomationContainer-RIDHNHPT.cjs → AutomationContainer-E5I76FPP.cjs} +7 -7
- package/dist/lib/node/{AutomationPanel-6RLBWAGL.cjs → AutomationPanel-YLXAFJDP.cjs} +8 -8
- package/dist/lib/node/{AutomationPanel-6RLBWAGL.cjs.map → AutomationPanel-YLXAFJDP.cjs.map} +2 -2
- package/dist/lib/node/{FunctionsContainer-RNZTNQEU.cjs → FunctionsContainer-3HCURMEB.cjs} +6 -6
- package/dist/lib/node/{FunctionsPanel-7I7YCHPJ.cjs → FunctionsPanel-SYIZHPGU.cjs} +7 -7
- package/dist/lib/node/{FunctionsPanel-7I7YCHPJ.cjs.map → FunctionsPanel-SYIZHPGU.cjs.map} +2 -2
- package/dist/lib/node/{chunk-GLXGAIZC.cjs → chunk-BSK5SHTR.cjs} +9 -9
- package/dist/lib/node/chunk-BSK5SHTR.cjs.map +7 -0
- package/dist/lib/node/chunk-FTEDH5Q6.cjs +167 -0
- package/dist/lib/node/chunk-FTEDH5Q6.cjs.map +7 -0
- package/dist/lib/node/{chunk-HZTVNN4S.cjs → chunk-L5TWLPGA.cjs} +8 -8
- package/dist/lib/node/{chunk-GDCG2BML.cjs → chunk-PSIJDHAX.cjs} +19 -19
- package/dist/lib/node/chunk-PSIJDHAX.cjs.map +7 -0
- package/dist/lib/node/{chunk-52JFIUOD.cjs → chunk-SRXHHBDE.cjs} +18 -18
- package/dist/lib/node/chunk-SRXHHBDE.cjs.map +7 -0
- package/dist/lib/node/index.cjs +12 -12
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/{intent-resolver-6FJ6PJJI.cjs → intent-resolver-A44BNFEG.cjs} +15 -14
- package/dist/lib/node/intent-resolver-A44BNFEG.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-UJDYSHZ5.cjs → react-surface-PCZCHIET.cjs} +11 -11
- package/dist/lib/node/react-surface-PCZCHIET.cjs.map +7 -0
- package/dist/lib/node/types.cjs +2 -2
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{AutomationContainer-MCUWF267.mjs → AutomationContainer-22PUFPSE.mjs} +3 -3
- package/dist/lib/node-esm/{AutomationPanel-U34H2Q7Z.mjs → AutomationPanel-6UXIAJVS.mjs} +3 -3
- package/dist/lib/node-esm/{FunctionsContainer-435FW56J.mjs → FunctionsContainer-XG5WVAN3.mjs} +2 -2
- package/dist/lib/node-esm/{FunctionsPanel-NXXT5ERU.mjs → FunctionsPanel-J3QGUESH.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-VYSTWH6Q.mjs → chunk-4UPGANGV.mjs} +4 -4
- package/dist/lib/node-esm/chunk-4UPGANGV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WYXWQFPK.mjs → chunk-HMYAQLGF.mjs} +7 -7
- package/dist/lib/node-esm/chunk-HMYAQLGF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M4QXMIIB.mjs +139 -0
- package/dist/lib/node-esm/chunk-M4QXMIIB.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RG3M42SO.mjs → chunk-TMMB5ETD.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-EEA6CZ6B.mjs → chunk-YYBCQXB2.mjs} +16 -16
- package/dist/lib/node-esm/chunk-YYBCQXB2.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -5
- package/dist/lib/node-esm/index.mjs.map +1 -1
- package/dist/lib/node-esm/{intent-resolver-PVY22PBL.mjs → intent-resolver-JFLTVJ7D.mjs} +8 -7
- package/dist/lib/node-esm/intent-resolver-JFLTVJ7D.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-R72A4EHM.mjs → react-surface-VSO4NWC6.mjs} +4 -4
- package/dist/lib/node-esm/{react-surface-R72A4EHM.mjs.map → react-surface-VSO4NWC6.mjs.map} +1 -1
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- 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/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +15 -15
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +24 -28
- package/src/AutomationPlugin.tsx +1 -1
- package/src/capabilities/intent-resolver.ts +7 -4
- package/src/capabilities/react-surface.tsx +1 -1
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -1
- package/src/components/AutomationPanel/AutomationPanel.tsx +5 -6
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +3 -3
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +6 -15
- package/src/components/TriggerEditor/TriggerEditor.tsx +89 -49
- package/src/testing/test-functions.ts +9 -23
- package/src/types.ts +10 -11
- package/dist/lib/browser/chunk-ADYCSC6Y.mjs +0 -39
- package/dist/lib/browser/chunk-ADYCSC6Y.mjs.map +0 -7
- package/dist/lib/browser/chunk-HTVXRMNH.mjs.map +0 -7
- package/dist/lib/browser/chunk-IDCVJ2JW.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q2ACSERA.mjs +0 -211
- package/dist/lib/browser/chunk-Q2ACSERA.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-YH4YPX52.mjs.map +0 -7
- package/dist/lib/node/chunk-52JFIUOD.cjs.map +0 -7
- package/dist/lib/node/chunk-ESVJ2X6U.cjs +0 -234
- package/dist/lib/node/chunk-ESVJ2X6U.cjs.map +0 -7
- package/dist/lib/node/chunk-GDCG2BML.cjs.map +0 -7
- package/dist/lib/node/chunk-GLXGAIZC.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-6FJ6PJJI.cjs.map +0 -7
- package/dist/lib/node/react-surface-UJDYSHZ5.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-5JC4JVYZ.mjs +0 -212
- package/dist/lib/node-esm/chunk-5JC4JVYZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EEA6CZ6B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VYSTWH6Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WYXWQFPK.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-PVY22PBL.mjs.map +0 -7
- package/dist/types/src/components/TriggerEditor/FunctionPayloadEditor.d.ts +0 -12
- package/dist/types/src/components/TriggerEditor/FunctionPayloadEditor.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/src/components/TriggerEditor/FunctionPayloadEditor.tsx +0 -77
- package/src/components/TriggerEditor/SpecSelector.tsx +0 -59
- /package/dist/lib/browser/{AutomationContainer-3MP23OGQ.mjs.map → AutomationContainer-KEQ5RNIW.mjs.map} +0 -0
- /package/dist/lib/browser/{AutomationPanel-75HVBBNG.mjs.map → AutomationPanel-G3OB6ELR.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsContainer-HLISW5QI.mjs.map → FunctionsContainer-STXBW4CX.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-OKFRBXLO.mjs.map → FunctionsPanel-JJPLIAJW.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-N4PTKEWO.mjs.map → chunk-QJPKWYTL.mjs.map} +0 -0
- /package/dist/lib/node/{AutomationContainer-RIDHNHPT.cjs.map → AutomationContainer-E5I76FPP.cjs.map} +0 -0
- /package/dist/lib/node/{FunctionsContainer-RNZTNQEU.cjs.map → FunctionsContainer-3HCURMEB.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-HZTVNN4S.cjs.map → chunk-L5TWLPGA.cjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationContainer-MCUWF267.mjs.map → AutomationContainer-22PUFPSE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-U34H2Q7Z.mjs.map → AutomationPanel-6UXIAJVS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsContainer-435FW56J.mjs.map → FunctionsContainer-XG5WVAN3.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-NXXT5ERU.mjs.map → FunctionsPanel-J3QGUESH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-RG3M42SO.mjs.map → chunk-TMMB5ETD.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface, useLayout } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions';\nimport { getSpace, parseId, useSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { AutomationContainer, AutomationPanel, FunctionsContainer } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n 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 || !spaceId) {\n return null;\n }\n\n return <AutomationContainer space={space} />;\n },\n }),\n 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 || !spaceId) {\n return null;\n }\n\n return <FunctionsContainer space={space} />;\n },\n }),\n createSurface({\n id: `${meta.id}/companion/automation`,\n role: 'article',\n filter: (data): data is { companionTo: ScriptType; subject: 'automation' } =>\n isInstanceOf(ScriptType, data.companionTo) && data.subject === 'automation',\n component: ({ data, role }) => {\n return (\n <StackItem.Content role={role}>\n <AutomationPanel space={getSpace(data.companionTo)!} object={data.companionTo} />\n </StackItem.Content>\n );\n },\n }),\n ]);\n"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface, useLayout } from '@dxos/app-framework';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { ScriptType } from '@dxos/functions/types';\nimport { getSpace, parseId, useSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { AutomationContainer, AutomationPanel, FunctionsContainer } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n 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 || !spaceId) {\n return null;\n }\n\n return <AutomationContainer space={space} />;\n },\n }),\n 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 || !spaceId) {\n return null;\n }\n\n return <FunctionsContainer space={space} />;\n },\n }),\n createSurface({\n id: `${meta.id}/companion/automation`,\n role: 'article',\n filter: (data): data is { companionTo: ScriptType; subject: 'automation' } =>\n isInstanceOf(ScriptType, data.companionTo) && data.subject === 'automation',\n component: ({ data, role }) => {\n return (\n <StackItem.Content role={role}>\n <AutomationPanel space={getSpace(data.companionTo)!} object={data.companionTo} />\n </StackItem.Content>\n );\n },\n }),\n ]);\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,eAAeC,iBAAiB;AACpE,SAASC,oBAAoB;AAC7B,SAASC,kBAAkB;AAC3B,SAASC,UAAUC,SAASC,gBAAgB;AAC5C,SAASC,iBAAiB;AAK1B,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,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,SAAS,CAACH,SAAS;AACtB,eAAO;MACT;AAEA,aAAO,sBAAA,cAACK,qBAAAA;QAAoBF;;IAC9B;EACF,CAAA;EACAb,cAAc;IACZC,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,SAAS,CAACH,SAAS;AACtB,eAAO;MACT;AAEA,aAAO,sBAAA,cAACM,oBAAAA;QAAmBH;;IAC7B;EACF,CAAA;EACAb,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SACPY,aAAaC,YAAYb,KAAKc,WAAW,KAAKd,KAAKC,YAAY;IACjEC,WAAW,CAAC,EAAEF,MAAMF,KAAI,MAAE;AACxB,aACE,sBAAA,cAACiB,UAAUC,SAAO;QAAClB;SACjB,sBAAA,cAACmB,iBAAAA;QAAgBT,OAAOU,SAASlB,KAAKc,WAAW;QAAIK,QAAQnB,KAAKc;;IAGxE;EACF,CAAA;CACD;",
|
|
6
6
|
"names": ["React", "Capabilities", "contributes", "createSurface", "useLayout", "isInstanceOf", "ScriptType", "getSpace", "parseId", "useSpace", "StackItem", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "subject", "component", "layout", "useLayout", "spaceId", "parseId", "workspace", "space", "useSpace", "AutomationContainer", "FunctionsContainer", "isInstanceOf", "ScriptType", "companionTo", "StackItem", "Content", "AutomationPanel", "getSpace", "object"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-graph-builder.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/app-graph-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrF,OAAO,EAAmB,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;kCAMvC,cAAc;;
|
|
1
|
+
{"version":3,"file":"app-graph-builder.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/app-graph-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrF,OAAO,EAAmB,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;kCAMvC,cAAc;;qBAgDkvC,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;AAhDhkS,wBA+CK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;qBAGklG,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAwF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;;;qBAAqF,YAAY;sBAAsC,iBAAiB;uBAAgD,iBAAiB;sBAAgD,iBAAiB;;2BAAkE,iBAAiB;qFAH70V,CAAC;AACzE,eAAO,MAAM,cAAc,mPAA0C,CAAC;AACtE,eAAO,MAAM,YAAY,gMAAwC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,YAAY,EAEZ,KAAK,cAAc,EAGpB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,YAAY,EAEZ,KAAK,cAAc,EAGpB,MAAM,qBAAqB,CAAC;kCAUJ,cAAc;AAAvC,wBAsDK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type FunctionTriggerType } from '@dxos/functions';
|
|
2
|
+
import { type FunctionTriggerType } from '@dxos/functions/types';
|
|
3
3
|
import { type Space, type Live } from '@dxos/react-client/echo';
|
|
4
4
|
export type AutomationPanelProps = {
|
|
5
5
|
space: Space;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutomationPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/AutomationPanel/AutomationPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AutomationPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/AutomationPanel/AutomationPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAKL,KAAK,mBAAmB,EAEzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAA0B,KAAK,KAAK,EAAE,KAAK,IAAI,EAAY,MAAM,yBAAyB,CAAC;AAWlG,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAGF,eAAO,MAAM,eAAe,8CAA+C,oBAAoB,sBAoG9F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/FunctionsPanel/FunctionsPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FunctionsPanel.d.ts","sourceRoot":"","sources":["../../../../../src/components/FunctionsPanel/FunctionsPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAKpD,OAAO,EAAsC,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAUzF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,cAAc,cAAe,mBAAmB,sBAuE5D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type FunctionTriggerType, type FunctionTrigger } from '@dxos/functions';
|
|
2
|
+
import { type FunctionTriggerType, type FunctionTrigger } from '@dxos/functions/types';
|
|
3
3
|
import { type Space } from '@dxos/react-client/echo';
|
|
4
4
|
export type TriggerEditorProps = {
|
|
5
5
|
space: Space;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TriggerEditor/TriggerEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"TriggerEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/TriggerEditor/TriggerEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EAGrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAoB,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAMvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;IACxD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AA0BF,eAAO,MAAM,aAAa,yCAA0C,kBAAkB,sBAkFrF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TriggerEditor/TriggerEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"TriggerEditor.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TriggerEditor/TriggerEditor.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAqC7C,QAAA,MAAM,IAAI,EAAE,IAqBX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-functions.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test-functions.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-functions.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS;;;;;;;;;;IA2BrB,CAAC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S } from '@dxos/echo-schema';
|
|
2
2
|
export declare namespace AutomationAction {
|
|
3
|
-
const CreateTriggerFromTemplate_base:
|
|
4
|
-
readonly _tag:
|
|
3
|
+
const CreateTriggerFromTemplate_base: S.TaggedClass<CreateTriggerFromTemplate, "dxos.org/plugin/automation/action/create-trigger-from-template", {
|
|
4
|
+
readonly _tag: S.tag<"dxos.org/plugin/automation/action/create-trigger-from-template">;
|
|
5
5
|
} & {
|
|
6
|
-
input:
|
|
7
|
-
space:
|
|
8
|
-
template:
|
|
9
|
-
type:
|
|
10
|
-
cron: typeof
|
|
11
|
-
}>,
|
|
12
|
-
type:
|
|
13
|
-
queueDXN: typeof
|
|
6
|
+
input: S.Struct<{
|
|
7
|
+
space: S.Schema<import("@dxos/client-protocol").Space, import("@dxos/client-protocol").Space, never>;
|
|
8
|
+
template: S.Union<[S.Struct<{
|
|
9
|
+
type: S.Literal<["timer"]>;
|
|
10
|
+
cron: typeof S.String;
|
|
11
|
+
}>, S.Struct<{
|
|
12
|
+
type: S.Literal<["queue"]>;
|
|
13
|
+
queueDXN: typeof S.Any;
|
|
14
14
|
}>]>;
|
|
15
|
-
enabled:
|
|
16
|
-
scriptName:
|
|
17
|
-
|
|
15
|
+
enabled: S.optional<typeof S.Boolean>;
|
|
16
|
+
scriptName: S.optional<typeof S.String>;
|
|
17
|
+
payload: S.optional<S.Record$<typeof S.String, typeof S.Any>>;
|
|
18
18
|
}>;
|
|
19
|
-
output: typeof
|
|
19
|
+
output: typeof S.Void;
|
|
20
20
|
}>;
|
|
21
21
|
export class CreateTriggerFromTemplate extends CreateTriggerFromTemplate_base {
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAUtC,yBAAiB,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;IAGhC,MAAM,OAAO,yBAA0B,SAAQ,8BAa9C;KAAG;;CACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-automation",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.5885341",
|
|
4
4
|
"description": "Prompt chain plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -31,27 +31,24 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@preact/signals-core": "^1.6.0",
|
|
34
|
-
"
|
|
35
|
-
"@dxos/app-framework": "0.8.2-main.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/echo": "0.8.2-main.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/plugin-
|
|
45
|
-
"@dxos/plugin-
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-
|
|
50
|
-
"@dxos/react-ui-
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-ui-stack": "0.8.2-main.2f9c567",
|
|
53
|
-
"@dxos/util": "0.8.2-main.2f9c567",
|
|
54
|
-
"@dxos/react-ui-list": "0.8.2-main.2f9c567"
|
|
34
|
+
"@dxos/async": "0.8.2-main.5885341",
|
|
35
|
+
"@dxos/app-framework": "0.8.2-main.5885341",
|
|
36
|
+
"@dxos/conductor": "0.8.2-main.5885341",
|
|
37
|
+
"@dxos/functions": "0.8.2-main.5885341",
|
|
38
|
+
"@dxos/echo-schema": "0.8.2-main.5885341",
|
|
39
|
+
"@dxos/live-object": "0.8.2-main.5885341",
|
|
40
|
+
"@dxos/log": "0.8.2-main.5885341",
|
|
41
|
+
"@dxos/plugin-client": "0.8.2-main.5885341",
|
|
42
|
+
"@dxos/plugin-deck": "0.8.2-main.5885341",
|
|
43
|
+
"@dxos/invariant": "0.8.2-main.5885341",
|
|
44
|
+
"@dxos/plugin-script": "0.8.2-main.5885341",
|
|
45
|
+
"@dxos/plugin-graph": "0.8.2-main.5885341",
|
|
46
|
+
"@dxos/plugin-space": "0.8.2-main.5885341",
|
|
47
|
+
"@dxos/react-client": "0.8.2-main.5885341",
|
|
48
|
+
"@dxos/react-ui-form": "0.8.2-main.5885341",
|
|
49
|
+
"@dxos/react-ui-stack": "0.8.2-main.5885341",
|
|
50
|
+
"@dxos/react-ui-list": "0.8.2-main.5885341",
|
|
51
|
+
"@dxos/util": "0.8.2-main.5885341"
|
|
55
52
|
},
|
|
56
53
|
"devDependencies": {
|
|
57
54
|
"@types/react": "~18.2.0",
|
|
@@ -59,16 +56,15 @@
|
|
|
59
56
|
"react": "~18.2.0",
|
|
60
57
|
"react-dom": "~18.2.0",
|
|
61
58
|
"vite": "5.4.7",
|
|
62
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
59
|
+
"@dxos/react-ui-theme": "0.8.2-main.5885341",
|
|
60
|
+
"@dxos/storybook-utils": "0.8.2-main.5885341",
|
|
61
|
+
"@dxos/react-ui": "0.8.2-main.5885341"
|
|
65
62
|
},
|
|
66
63
|
"peerDependencies": {
|
|
67
|
-
"effect": "^3.13.3",
|
|
68
64
|
"react": "~18.2.0",
|
|
69
65
|
"react-dom": "~18.2.0",
|
|
70
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
71
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
66
|
+
"@dxos/react-ui": "0.8.2-main.5885341",
|
|
67
|
+
"@dxos/react-ui-theme": "0.8.2-main.5885341"
|
|
72
68
|
},
|
|
73
69
|
"publishConfig": {
|
|
74
70
|
"access": "public"
|
package/src/AutomationPlugin.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';
|
|
6
|
-
import { FunctionType, FunctionTrigger } from '@dxos/functions';
|
|
6
|
+
import { FunctionType, FunctionTrigger } from '@dxos/functions/types';
|
|
7
7
|
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
8
8
|
|
|
9
9
|
import { AppGraphBuilder, IntentResolver, ReactSurface } from './capabilities';
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
createIntent,
|
|
11
11
|
LayoutAction,
|
|
12
12
|
} from '@dxos/app-framework';
|
|
13
|
-
import { Type } from '@dxos/echo';
|
|
14
13
|
import { FunctionTrigger, FunctionType, ScriptType, TriggerKind } from '@dxos/functions';
|
|
15
14
|
import { type DXN } from '@dxos/keys';
|
|
16
15
|
import { live } from '@dxos/live-object';
|
|
@@ -24,8 +23,8 @@ export default (context: PluginsContext) =>
|
|
|
24
23
|
contributes(Capabilities.IntentResolver, [
|
|
25
24
|
createResolver({
|
|
26
25
|
intent: AutomationAction.CreateTriggerFromTemplate,
|
|
27
|
-
resolve: async ({ space, template, enabled = false, scriptName,
|
|
28
|
-
const trigger = live(FunctionTrigger, { enabled
|
|
26
|
+
resolve: async ({ space, template, enabled = false, scriptName, payload }) => {
|
|
27
|
+
const trigger = live(FunctionTrigger, { enabled });
|
|
29
28
|
|
|
30
29
|
// TODO(wittjosiah): Factor out function lookup by script name?
|
|
31
30
|
if (scriptName) {
|
|
@@ -37,11 +36,15 @@ export default (context: PluginsContext) =>
|
|
|
37
36
|
objects: [fn],
|
|
38
37
|
} = await space.db.query(Filter.schema(FunctionType, { source: script })).run();
|
|
39
38
|
if (fn) {
|
|
40
|
-
trigger.function =
|
|
39
|
+
trigger.function = `dxn:worker:${fn.name}`;
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
|
|
44
|
+
if (payload) {
|
|
45
|
+
trigger.meta = payload;
|
|
46
|
+
}
|
|
47
|
+
|
|
45
48
|
switch (template.type) {
|
|
46
49
|
case 'timer': {
|
|
47
50
|
trigger.spec = { type: TriggerKind.Timer, cron: template.cron };
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, createSurface, useLayout } from '@dxos/app-framework';
|
|
8
8
|
import { isInstanceOf } from '@dxos/echo-schema';
|
|
9
|
-
import { ScriptType } from '@dxos/functions';
|
|
9
|
+
import { ScriptType } from '@dxos/functions/types';
|
|
10
10
|
import { getSpace, parseId, useSpace } from '@dxos/react-client/echo';
|
|
11
11
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
12
12
|
|
|
@@ -7,7 +7,7 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta } from '@storybook/react';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import { FunctionType, FunctionTrigger } from '@dxos/functions';
|
|
10
|
+
import { FunctionType, FunctionTrigger } from '@dxos/functions/types';
|
|
11
11
|
import { live, useSpaces } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
5
|
import React, { useState } from 'react';
|
|
7
6
|
|
|
7
|
+
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import {
|
|
9
9
|
FunctionType,
|
|
10
10
|
FunctionTrigger,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
TriggerKind,
|
|
13
13
|
type FunctionTriggerType,
|
|
14
14
|
ScriptType,
|
|
15
|
-
} from '@dxos/functions';
|
|
15
|
+
} from '@dxos/functions/types';
|
|
16
16
|
import { type Client, useClient } from '@dxos/react-client';
|
|
17
17
|
import { live, Filter, useQuery, type Space, type Live, getSpace } from '@dxos/react-client/echo';
|
|
18
18
|
import { Clipboard, IconButton, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
@@ -85,7 +85,7 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
85
85
|
</ControlItem>
|
|
86
86
|
) : (
|
|
87
87
|
<div role='none' className={controlItemClasses}>
|
|
88
|
-
<List.Root<FunctionTrigger> items={triggers} isItem={
|
|
88
|
+
<List.Root<FunctionTrigger> items={triggers} isItem={S.is(FunctionTrigger)} getId={(field) => field.id}>
|
|
89
89
|
{({ items: triggers }) => (
|
|
90
90
|
<div role='list' className='flex flex-col w-full'>
|
|
91
91
|
{triggers?.map((trigger) => {
|
|
@@ -158,11 +158,10 @@ const getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {
|
|
|
158
158
|
const getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTriggerType) => {
|
|
159
159
|
// TODO(wittjosiah): Truncation should be done in the UI.
|
|
160
160
|
// Warning that the List component is currently a can of worms.
|
|
161
|
-
const shortId = trigger.function && `${trigger.function
|
|
162
|
-
const functionObject = functions.find((fn) => fn === trigger.function
|
|
161
|
+
const shortId = trigger.function && `${trigger.function?.slice(0, 16)}…`;
|
|
162
|
+
const functionObject = functions.find((fn) => `dxn:worker:${fn.name}` === trigger.function);
|
|
163
163
|
if (!functionObject) {
|
|
164
164
|
return shortId;
|
|
165
165
|
}
|
|
166
|
-
|
|
167
166
|
return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;
|
|
168
167
|
};
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
5
|
import React, { useCallback, useMemo } from 'react';
|
|
7
6
|
|
|
8
7
|
import { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
-
import {
|
|
8
|
+
import { S } from '@dxos/echo-schema';
|
|
9
|
+
import { FunctionType, ScriptType } from '@dxos/functions/types';
|
|
10
10
|
import { Filter, fullyQualifiedId, useQuery, type Space } from '@dxos/react-client/echo';
|
|
11
11
|
import { Button, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { controlItemClasses } from '@dxos/react-ui-form';
|
|
@@ -65,7 +65,7 @@ export const FunctionsPanel = ({ space }: FunctionsPanelProps) => {
|
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
67
|
<div role='none' className={mx(controlItemClasses)}>
|
|
68
|
-
<List.Root<FunctionType> items={functions} isItem={
|
|
68
|
+
<List.Root<FunctionType> items={functions} isItem={S.is(FunctionType)} getId={(func) => func.id}>
|
|
69
69
|
{({ items }) => (
|
|
70
70
|
<div role='list' className='flex flex-col w-full'>
|
|
71
71
|
{items?.map((func) => (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
@@ -7,11 +7,10 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta } from '@storybook/react';
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { FunctionType, FunctionTrigger, TriggerKind } from '@dxos/functions';
|
|
10
|
+
import { FunctionType, FunctionTrigger, TriggerKind } from '@dxos/functions/types';
|
|
11
11
|
import { live } from '@dxos/live-object';
|
|
12
|
-
import { faker } from '@dxos/random';
|
|
13
12
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
14
|
-
import {
|
|
13
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
14
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
16
15
|
|
|
17
16
|
import { TriggerEditor } from './TriggerEditor';
|
|
@@ -36,8 +35,8 @@ const DefaultStory = () => {
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
return (
|
|
39
|
-
<div role='none' className='w-[
|
|
40
|
-
<TriggerEditor space={space} trigger={trigger}
|
|
38
|
+
<div role='none' className='flex w-[350px] border border-separator overflow-hidden'>
|
|
39
|
+
<TriggerEditor space={space} trigger={trigger} />
|
|
41
40
|
</div>
|
|
42
41
|
);
|
|
43
42
|
};
|
|
@@ -50,19 +49,11 @@ const meta: Meta = {
|
|
|
50
49
|
withClientProvider({
|
|
51
50
|
createIdentity: true,
|
|
52
51
|
createSpace: true,
|
|
53
|
-
types: [FunctionType, FunctionTrigger
|
|
52
|
+
types: [FunctionType, FunctionTrigger],
|
|
54
53
|
onSpaceCreated: ({ space }) => {
|
|
55
54
|
for (const fn of functions) {
|
|
56
55
|
space.db.add(live(FunctionType, fn));
|
|
57
56
|
}
|
|
58
|
-
Array.from({ length: 10 }).map(() => {
|
|
59
|
-
return space.db.add(
|
|
60
|
-
live(ContactType, {
|
|
61
|
-
name: faker.person.fullName(),
|
|
62
|
-
identifiers: [],
|
|
63
|
-
}),
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
57
|
},
|
|
67
58
|
}),
|
|
68
59
|
withLayout({ fullscreen: true, tooltips: true, classNames: 'flex justify-center m-2' }),
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback, useMemo } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { ComputeGraph } from '@dxos/conductor';
|
|
8
|
-
import { DXN } from '@dxos/echo';
|
|
9
8
|
import {
|
|
10
9
|
FunctionType,
|
|
11
10
|
FunctionTriggerSchema,
|
|
12
11
|
type FunctionTriggerType,
|
|
13
12
|
type FunctionTrigger,
|
|
14
13
|
ScriptType,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
14
|
+
TriggerKind,
|
|
15
|
+
} from '@dxos/functions/types';
|
|
16
|
+
import { Filter, useQuery, type Space } from '@dxos/react-client/echo';
|
|
17
|
+
import { IconButton, Input, useTranslation } from '@dxos/react-ui';
|
|
18
|
+
import { type CustomInputMap, Form, type InputProps, SelectInput, TextInput, useInputProps } from '@dxos/react-ui-form';
|
|
19
19
|
|
|
20
|
-
import { FunctionPayloadEditor } from './FunctionPayloadEditor';
|
|
21
|
-
import { SpecSelector } from './SpecSelector';
|
|
22
20
|
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
23
21
|
|
|
24
22
|
export type TriggerEditorProps = {
|
|
@@ -28,6 +26,30 @@ export type TriggerEditorProps = {
|
|
|
28
26
|
onCancel?: () => void;
|
|
29
27
|
};
|
|
30
28
|
|
|
29
|
+
const PayloadInput = (props: InputProps & { property: string }) => {
|
|
30
|
+
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
31
|
+
// TODO(dmaretskyi): Prop name (`meta`) should be passed in.
|
|
32
|
+
const inputProps = useInputProps(['meta', props.property]);
|
|
33
|
+
return (
|
|
34
|
+
<div role='none' className='flex items-center mt-2 gap-1'>
|
|
35
|
+
<div role='none' className='flex-1'>
|
|
36
|
+
<TextInput {...inputProps} type='string' label={props.property} />
|
|
37
|
+
</div>
|
|
38
|
+
<IconButton
|
|
39
|
+
icon='ph--trash--regular'
|
|
40
|
+
iconOnly
|
|
41
|
+
classNames={'mt-6'}
|
|
42
|
+
label={t('trigger meta remove')}
|
|
43
|
+
onClick={() => {
|
|
44
|
+
const newValues: any = { ...props.getValue() };
|
|
45
|
+
delete newValues[props.property];
|
|
46
|
+
props.onValueChange('object', newValues);
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
31
53
|
export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {
|
|
32
54
|
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
33
55
|
|
|
@@ -39,58 +61,76 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEdito
|
|
|
39
61
|
onSave?.(values);
|
|
40
62
|
};
|
|
41
63
|
|
|
42
|
-
const handleRefQueryLookup = useRefQueryLookupHandler({ space });
|
|
43
|
-
|
|
44
64
|
const Custom = useMemo(
|
|
45
65
|
(): CustomInputMap => ({
|
|
46
|
-
['function' satisfies keyof FunctionTriggerType]: (props) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
['function' satisfies keyof FunctionTriggerType]: (props) => (
|
|
67
|
+
<SelectInput
|
|
68
|
+
{...props}
|
|
69
|
+
options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}
|
|
70
|
+
/>
|
|
71
|
+
),
|
|
72
|
+
['spec.type' as const]: (props) => (
|
|
73
|
+
<SelectInput
|
|
74
|
+
{...props}
|
|
75
|
+
options={Object.values(TriggerKind).map((kind) => ({
|
|
76
|
+
value: kind,
|
|
77
|
+
label: t(`trigger type ${kind}`),
|
|
78
|
+
}))}
|
|
79
|
+
/>
|
|
80
|
+
),
|
|
81
|
+
// TODO(wittjosiah): Form should be able to handle arbitrary records by default.
|
|
82
|
+
['meta' as const]: (props) => {
|
|
83
|
+
const payload = props.getValue() ?? {};
|
|
84
|
+
useEffect(() => props.onValueChange('object', { ...payload }), []);
|
|
85
|
+
const [newPayloadFieldName, setNewPayloadFieldName] = useState('');
|
|
54
86
|
|
|
55
|
-
const
|
|
56
|
-
(
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
[props.onValueChange],
|
|
64
|
-
);
|
|
87
|
+
const handleAddPayload = useCallback(() => {
|
|
88
|
+
if (newPayloadFieldName.length) {
|
|
89
|
+
const payload = props.getValue() ?? {};
|
|
90
|
+
const payloadWithNewProp = { ...payload, [newPayloadFieldName]: '' };
|
|
91
|
+
setNewPayloadFieldName('');
|
|
92
|
+
props.onValueChange('object', payloadWithNewProp);
|
|
93
|
+
}
|
|
94
|
+
}, [newPayloadFieldName, props.getValue, props.onValueChange]);
|
|
65
95
|
|
|
66
96
|
return (
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
97
|
+
<>
|
|
98
|
+
<div>{/* TODO(wittjosiah): props.label */ 'Payload'}</div>
|
|
99
|
+
{[...Object.keys(payload)].map((key) => (
|
|
100
|
+
<PayloadInput key={key} property={key} {...props} />
|
|
101
|
+
))}
|
|
102
|
+
<div role='none' className='flex items-center mt-2 gap-1 plb-1'>
|
|
103
|
+
<div role='none' className='flex-1'>
|
|
104
|
+
<Input.Root>
|
|
105
|
+
<Input.TextInput
|
|
106
|
+
placeholder={t('trigger payload prop name placeholder')}
|
|
107
|
+
value={newPayloadFieldName}
|
|
108
|
+
onChange={(event) => setNewPayloadFieldName(event.target.value)}
|
|
109
|
+
/>
|
|
110
|
+
</Input.Root>
|
|
111
|
+
</div>
|
|
112
|
+
<IconButton
|
|
113
|
+
icon='ph--plus--regular'
|
|
114
|
+
iconOnly
|
|
115
|
+
label={t('trigger payload add')}
|
|
116
|
+
onClick={handleAddPayload}
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
</>
|
|
73
120
|
);
|
|
74
121
|
},
|
|
75
|
-
['spec.type' as const]: SpecSelector,
|
|
76
|
-
['payload' as const]: (props) => (
|
|
77
|
-
<FunctionPayloadEditor {...props} functions={functions} onQueryRefOptions={handleRefQueryLookup} />
|
|
78
|
-
),
|
|
79
122
|
}),
|
|
80
123
|
[workflows, scripts, functions, t],
|
|
81
124
|
);
|
|
82
125
|
|
|
83
126
|
return (
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
onQueryRefOptions={handleRefQueryLookup}
|
|
92
|
-
/>
|
|
93
|
-
</div>
|
|
127
|
+
<Form<FunctionTriggerType>
|
|
128
|
+
schema={FunctionTriggerSchema}
|
|
129
|
+
values={trigger}
|
|
130
|
+
onSave={handleSave}
|
|
131
|
+
onCancel={onCancel}
|
|
132
|
+
Custom={Custom}
|
|
133
|
+
/>
|
|
94
134
|
);
|
|
95
135
|
};
|
|
96
136
|
|