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