@powerhousedao/workflow 6.2.3-dev.79 → 6.2.3-dev.81
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/browser/{BlockSelector-DFX-DZHl.js → BlockSelector-DHVzUGjW.js} +3 -3
- package/dist/browser/BlockSelector-DHVzUGjW.js.map +1 -0
- package/dist/browser/{connection-Ci_pI3kD.js → connection-PaKXHYz9.js} +2 -2
- package/dist/browser/{connection-Ci_pI3kD.js.map → connection-PaKXHYz9.js.map} +1 -1
- package/dist/browser/{connection-form-BuW6qOAF.js → connection-form-D2qAEHsl.js} +33 -13
- package/dist/browser/connection-form-D2qAEHsl.js.map +1 -0
- package/dist/browser/{data-tree-BLn565V5.js → data-tree-BOuPR-2J.js} +2 -2
- package/dist/browser/{data-tree-BLn565V5.js.map → data-tree-BOuPR-2J.js.map} +1 -1
- package/dist/browser/document-models/connection/index.js +2 -2
- package/dist/browser/document-models/index.js +3 -3
- package/dist/browser/document-models/workflow/index.js +3 -3
- package/dist/browser/{document-models-B2IDRvBZ.js → document-models-DSK5cn8B.js} +6 -3
- package/dist/browser/{document-models-B2IDRvBZ.js.map → document-models-DSK5cn8B.js.map} +1 -1
- package/dist/browser/{editor-DBcq58Fr.js → editor--59WtNaj.js} +271 -87
- package/dist/browser/editor--59WtNaj.js.map +1 -0
- package/dist/browser/{editor-B1-_KRbr.js → editor-0XPrGeLT.js} +8 -8
- package/dist/browser/{editor-B1-_KRbr.js.map → editor-0XPrGeLT.js.map} +1 -1
- package/dist/browser/{editor-DPGuck1V.js → editor-BD-5ClkW.js} +10 -10
- package/dist/browser/editor-BD-5ClkW.js.map +1 -0
- package/dist/browser/editors/connection-editor/module.js +1 -1
- package/dist/browser/editors/runtime/index.js +1 -1
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/index.js +5 -5
- package/dist/browser/{module-FuSfFXPT.js → module-DJz6oTX0.js} +56 -56
- package/dist/browser/module-DJz6oTX0.js.map +1 -0
- package/dist/browser/{module-DFCANOuI.js → module-eOpxJVIl.js} +48 -6
- package/dist/browser/module-eOpxJVIl.js.map +1 -0
- package/dist/{node/piece-auth-BS5CtQOG.mjs → browser/piece-auth-63iuNFTs.js} +11 -3
- package/dist/browser/piece-auth-63iuNFTs.js.map +1 -0
- package/dist/browser/reactor/index.js +2 -2
- package/dist/browser/{runtime-queries-C9SoXGm2.js → runtime-queries-LAcyniYz.js} +18 -7
- package/dist/browser/runtime-queries-LAcyniYz.js.map +1 -0
- package/dist/browser/{trigger-text-B2mo1fiB.js → trigger-text-Co-dn9x-.js} +25 -5
- package/dist/browser/trigger-text-Co-dn9x-.js.map +1 -0
- package/dist/browser/upgrade-manifests-CLYUPqBs.js +8 -0
- package/dist/browser/{upgrade-manifests-B62uqKVp.js.map → upgrade-manifests-CLYUPqBs.js.map} +1 -1
- package/dist/browser/{workflow-DjTleFFO.js → workflow-Cn1UP-eJ.js} +4 -3
- package/dist/browser/workflow-Cn1UP-eJ.js.map +1 -0
- package/dist/node/{BlockSelector-DosVPXzD.mjs → BlockSelector-D2UAnFpN.mjs} +3 -3
- package/dist/node/BlockSelector-D2UAnFpN.mjs.map +1 -0
- package/dist/node/{connection-i6ISRY0F.mjs → connection-BZxipUlb.mjs} +2 -2
- package/dist/node/{connection-i6ISRY0F.mjs.map → connection-BZxipUlb.mjs.map} +1 -1
- package/dist/node/{connection-form-Z-pLxxrT.mjs → connection-form-Btmejfyn.mjs} +33 -13
- package/dist/node/connection-form-Btmejfyn.mjs.map +1 -0
- package/dist/node/{data-tree-CqBvXMpm.mjs → data-tree-rZiK2Ev-.mjs} +2 -2
- package/dist/node/{data-tree-CqBvXMpm.mjs.map → data-tree-rZiK2Ev-.mjs.map} +1 -1
- package/dist/node/document-models/connection/index.mjs +2 -2
- package/dist/node/document-models/index.mjs +3 -3
- package/dist/node/document-models/workflow/index.mjs +3 -3
- package/dist/node/{editor-DF1FOgnC.mjs → editor-C_eWGGi8.mjs} +11 -11
- package/dist/node/editor-C_eWGGi8.mjs.map +1 -0
- package/dist/node/{editor-BIpWFiaF.mjs → editor-ChJMxbeM.mjs} +8 -8
- package/dist/node/{editor-BIpWFiaF.mjs.map → editor-ChJMxbeM.mjs.map} +1 -1
- package/dist/node/{editor-DM9cnkfv.mjs → editor-U6trS0QO.mjs} +271 -87
- package/dist/node/editor-U6trS0QO.mjs.map +1 -0
- package/dist/node/editors/connection-editor/module.mjs +1 -1
- package/dist/node/editors/runtime/index.mjs +1 -1
- package/dist/node/editors/workflow-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-studio/module.mjs +1 -1
- package/dist/node/index.mjs +8 -5
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{module-weVJEMpP.mjs → module-BEEASith.mjs} +56 -56
- package/dist/node/module-BEEASith.mjs.map +1 -0
- package/dist/node/{module-DV3LLvxo.mjs → module-D9Zx5Zow.mjs} +47 -5
- package/dist/node/module-D9Zx5Zow.mjs.map +1 -0
- package/dist/{browser/piece-auth-BS5CtQOG.js → node/piece-auth-C0u0XTO8.mjs} +11 -3
- package/dist/node/piece-auth-C0u0XTO8.mjs.map +1 -0
- package/dist/node/pieces/ai/descriptor.json +788 -0
- package/dist/node/pieces/ai/index.mjs +401 -0
- package/dist/node/pieces/ai/package.json +9 -0
- package/dist/node/pieces/index.mjs +3 -0
- package/dist/node/pieces/index.mjs.map +1 -1
- package/dist/node/pieces/reactor/descriptor.json +37 -2
- package/dist/node/pieces/reactor/index.mjs +39 -250
- package/dist/node/pieces/reactor/package.json +2 -2
- package/dist/node/{runtime-queries-CJSpbsBq.mjs → runtime-queries-CmrHBPRw.mjs} +18 -7
- package/dist/node/runtime-queries-CmrHBPRw.mjs.map +1 -0
- package/dist/node/{trigger-text-BRqIHmRS.mjs → trigger-text-CAiRCG2X.mjs} +25 -5
- package/dist/node/trigger-text-CAiRCG2X.mjs.map +1 -0
- package/dist/node/upgrade-manifests-C4akaA_X.mjs +8 -0
- package/dist/node/{upgrade-manifests-CO9zzPnE.mjs.map → upgrade-manifests-C4akaA_X.mjs.map} +1 -1
- package/dist/node/{workflow-BS5m4jtr.mjs → workflow-DqF9VsBQ.mjs} +4 -3
- package/dist/node/workflow-DqF9VsBQ.mjs.map +1 -0
- package/dist/powerhouse.manifest.json +10 -2
- package/dist/style.css +1 -1
- package/dist/types/document-models/document-models.d.ts +1 -0
- package/dist/types/document-models/document-models.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/actions.d.ts +1 -0
- package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
- package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +16 -0
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +3 -1
- package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts +6 -2
- package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts +3 -2
- package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts +2 -1
- package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/module.d.ts +1 -0
- package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/piece-auth.d.ts +6 -1
- package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
- package/dist/types/editors/shared/DocumentErrorBoundary.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +3 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts +1 -1
- package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts +12 -0
- package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/forms.d.ts +5 -0
- package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/model.d.ts +6 -0
- package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts +8 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai-actions.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai-actions.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai-documents.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai-documents.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/ai.test.d.ts +2 -0
- package/dist/types/pieces/ai/ai.test.d.ts.map +1 -0
- package/dist/types/pieces/ai/index.d.ts +7 -0
- package/dist/types/pieces/ai/index.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/action-schema.d.ts +11 -0
- package/dist/types/pieces/ai/lib/action-schema.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts +38 -0
- package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts +45 -0
- package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/decide.d.ts +39 -0
- package/dist/types/pieces/ai/lib/actions/decide.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/extract.d.ts +41 -0
- package/dist/types/pieces/ai/lib/actions/extract.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts +55 -0
- package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/actions/summarize.d.ts +38 -0
- package/dist/types/pieces/ai/lib/actions/summarize.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/auth.d.ts +16 -0
- package/dist/types/pieces/ai/lib/auth.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/decision-model.d.ts +17 -0
- package/dist/types/pieces/ai/lib/decision-model.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/documents.d.ts +11 -0
- package/dist/types/pieces/ai/lib/documents.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/model-list.d.ts +8 -0
- package/dist/types/pieces/ai/lib/model-list.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/models.d.ts +19 -0
- package/dist/types/pieces/ai/lib/models.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/props.d.ts +16 -0
- package/dist/types/pieces/ai/lib/props.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/providers.d.ts +9 -0
- package/dist/types/pieces/ai/lib/providers.d.ts.map +1 -0
- package/dist/types/pieces/ai/lib/questions.d.ts +7 -0
- package/dist/types/pieces/ai/lib/questions.d.ts.map +1 -0
- package/dist/types/pieces/index.d.ts.map +1 -1
- package/dist/types/pieces/reactor/index.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +4 -2
- package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts +3 -1
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/index-query.d.ts +14 -0
- package/dist/types/pieces/reactor/lib/actions/index-query.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/reactor.d.ts +12 -0
- package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/writes.d.ts +7 -0
- package/dist/types/pieces/reactor/lib/writes.d.ts.map +1 -0
- package/dist/types/scripts/ui-stack.d.ts +8 -2
- package/dist/types/scripts/ui-stack.d.ts.map +1 -1
- package/package.json +15 -8
- package/dist/browser/BlockSelector-DFX-DZHl.js.map +0 -1
- package/dist/browser/connection-form-BuW6qOAF.js.map +0 -1
- package/dist/browser/editor-DBcq58Fr.js.map +0 -1
- package/dist/browser/editor-DPGuck1V.js.map +0 -1
- package/dist/browser/module-DFCANOuI.js.map +0 -1
- package/dist/browser/module-FuSfFXPT.js.map +0 -1
- package/dist/browser/piece-auth-BS5CtQOG.js.map +0 -1
- package/dist/browser/runtime-queries-C9SoXGm2.js.map +0 -1
- package/dist/browser/trigger-text-B2mo1fiB.js.map +0 -1
- package/dist/browser/upgrade-manifests-B62uqKVp.js +0 -8
- package/dist/browser/workflow-DjTleFFO.js.map +0 -1
- package/dist/node/BlockSelector-DosVPXzD.mjs.map +0 -1
- package/dist/node/connection-form-Z-pLxxrT.mjs.map +0 -1
- package/dist/node/editor-DF1FOgnC.mjs.map +0 -1
- package/dist/node/editor-DM9cnkfv.mjs.map +0 -1
- package/dist/node/module-DV3LLvxo.mjs.map +0 -1
- package/dist/node/module-weVJEMpP.mjs.map +0 -1
- package/dist/node/piece-auth-BS5CtQOG.mjs.map +0 -1
- package/dist/node/runtime-queries-CJSpbsBq.mjs.map +0 -1
- package/dist/node/trigger-text-BRqIHmRS.mjs.map +0 -1
- package/dist/node/upgrade-manifests-CO9zzPnE.mjs +0 -8
- package/dist/node/workflow-BS5m4jtr.mjs.map +0 -1
|
@@ -2,6 +2,18 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
|
2
2
|
import * as z$1 from "zod";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { BaseDocumentHeaderSchema, BaseDocumentStateSchema, baseActions, baseCreateDocument, baseLoadFromInputVersioned, baseSaveToFileHandle, createAction, createBaseState, createReducer, createState, defaultBaseState, isDocumentAction } from "document-model";
|
|
5
|
+
//#region document-models/connection/upgrades/versions.ts
|
|
6
|
+
const supportedVersions = [1];
|
|
7
|
+
const latestVersion = supportedVersions[0];
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region document-models/connection/upgrades/upgrade-manifest.ts
|
|
10
|
+
const connectionUpgradeManifest = {
|
|
11
|
+
documentType: "powerhouse/connection",
|
|
12
|
+
latestVersion,
|
|
13
|
+
supportedVersions,
|
|
14
|
+
upgrades: {}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
5
17
|
//#region document-models/connection/v1/gen/schema/zod.ts
|
|
6
18
|
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
|
|
7
19
|
const definedNonNullAnySchema = z$1.any().refine((v) => isDefinedNonNullAny(v));
|
|
@@ -91,48 +103,6 @@ function SetSecretRefInputSchema() {
|
|
|
91
103
|
});
|
|
92
104
|
}
|
|
93
105
|
//#endregion
|
|
94
|
-
//#region document-models/connection/v1/src/reactor-connection.ts
|
|
95
|
-
const REACTOR_CONNECTOR_ID = "@powerhousedao/reactor#reactor";
|
|
96
|
-
const REACTOR_LOCAL_ENDPOINT = "local";
|
|
97
|
-
const CONFIG_KEYS = /* @__PURE__ */ new Set(["endpoint", "access"]);
|
|
98
|
-
function isReactorConnectorId(connectorId) {
|
|
99
|
-
return connectorId === REACTOR_CONNECTOR_ID;
|
|
100
|
-
}
|
|
101
|
-
function defaultReactorConnectionConfig() {
|
|
102
|
-
return { endpoint: REACTOR_LOCAL_ENDPOINT };
|
|
103
|
-
}
|
|
104
|
-
function parseReactorConnectionConfig(config) {
|
|
105
|
-
if (config === null || typeof config !== "object" || Array.isArray(config)) return {
|
|
106
|
-
ok: false,
|
|
107
|
-
error: "A reactor connection config must be an object"
|
|
108
|
-
};
|
|
109
|
-
const unknownKey = Object.keys(config).find((key) => !CONFIG_KEYS.has(key));
|
|
110
|
-
if (unknownKey) return {
|
|
111
|
-
ok: false,
|
|
112
|
-
error: `Unknown reactor connection field "${unknownKey}"`
|
|
113
|
-
};
|
|
114
|
-
const parsed = ReactorConnectionConfigSchema().safeParse(config);
|
|
115
|
-
if (!parsed.success) return {
|
|
116
|
-
ok: false,
|
|
117
|
-
error: parsed.error.issues[0]?.message ?? "Invalid"
|
|
118
|
-
};
|
|
119
|
-
const { endpoint, access } = parsed.data;
|
|
120
|
-
if (endpoint !== "local") return {
|
|
121
|
-
ok: false,
|
|
122
|
-
error: `Reactor endpoint must be "${REACTOR_LOCAL_ENDPOINT}"`
|
|
123
|
-
};
|
|
124
|
-
if (access !== void 0 && access !== null && access !== "read") return {
|
|
125
|
-
ok: false,
|
|
126
|
-
error: `Reactor access must be "read" or absent`
|
|
127
|
-
};
|
|
128
|
-
const value = { endpoint };
|
|
129
|
-
if (access === "read") value.access = access;
|
|
130
|
-
return {
|
|
131
|
-
ok: true,
|
|
132
|
-
config: value
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
//#endregion
|
|
136
106
|
//#region document-models/connection/v1/gen/config/creators.ts
|
|
137
107
|
/**
|
|
138
108
|
* WARNING: DO NOT EDIT
|
|
@@ -402,6 +372,48 @@ var SecretRefNotFoundError = class extends Error {
|
|
|
402
372
|
}
|
|
403
373
|
};
|
|
404
374
|
//#endregion
|
|
375
|
+
//#region document-models/connection/v1/src/reactor-connection.ts
|
|
376
|
+
const REACTOR_CONNECTOR_ID = "@powerhousedao/reactor#reactor";
|
|
377
|
+
const REACTOR_LOCAL_ENDPOINT = "local";
|
|
378
|
+
const CONFIG_KEYS = /* @__PURE__ */ new Set(["endpoint", "access"]);
|
|
379
|
+
function isReactorConnectorId(connectorId) {
|
|
380
|
+
return connectorId === REACTOR_CONNECTOR_ID;
|
|
381
|
+
}
|
|
382
|
+
function defaultReactorConnectionConfig() {
|
|
383
|
+
return { endpoint: REACTOR_LOCAL_ENDPOINT };
|
|
384
|
+
}
|
|
385
|
+
function parseReactorConnectionConfig(config) {
|
|
386
|
+
if (config === null || typeof config !== "object" || Array.isArray(config)) return {
|
|
387
|
+
ok: false,
|
|
388
|
+
error: "A reactor connection config must be an object"
|
|
389
|
+
};
|
|
390
|
+
const unknownKey = Object.keys(config).find((key) => !CONFIG_KEYS.has(key));
|
|
391
|
+
if (unknownKey) return {
|
|
392
|
+
ok: false,
|
|
393
|
+
error: `Unknown reactor connection field "${unknownKey}"`
|
|
394
|
+
};
|
|
395
|
+
const parsed = ReactorConnectionConfigSchema().safeParse(config);
|
|
396
|
+
if (!parsed.success) return {
|
|
397
|
+
ok: false,
|
|
398
|
+
error: parsed.error.issues[0]?.message ?? "Invalid"
|
|
399
|
+
};
|
|
400
|
+
const { endpoint, access } = parsed.data;
|
|
401
|
+
if (endpoint !== "local") return {
|
|
402
|
+
ok: false,
|
|
403
|
+
error: `Reactor endpoint must be "${REACTOR_LOCAL_ENDPOINT}"`
|
|
404
|
+
};
|
|
405
|
+
if (access !== void 0 && access !== null && access !== "read") return {
|
|
406
|
+
ok: false,
|
|
407
|
+
error: `Reactor access must be "read" or absent`
|
|
408
|
+
};
|
|
409
|
+
const value = { endpoint };
|
|
410
|
+
if (access === "read") value.access = access;
|
|
411
|
+
return {
|
|
412
|
+
ok: true,
|
|
413
|
+
config: value
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
//#endregion
|
|
405
417
|
//#region document-models/connection/v1/src/reducers/config.ts
|
|
406
418
|
const connectionConfigOperations = {
|
|
407
419
|
setConfigOperation(state, action) {
|
|
@@ -552,18 +564,6 @@ const stateReducer = (state, action, dispatch) => {
|
|
|
552
564
|
};
|
|
553
565
|
const reducer = createReducer(stateReducer);
|
|
554
566
|
//#endregion
|
|
555
|
-
//#region document-models/connection/upgrades/versions.ts
|
|
556
|
-
const supportedVersions = [1];
|
|
557
|
-
const latestVersion = supportedVersions[0];
|
|
558
|
-
//#endregion
|
|
559
|
-
//#region document-models/connection/upgrades/upgrade-manifest.ts
|
|
560
|
-
const connectionUpgradeManifest = {
|
|
561
|
-
documentType: "powerhouse/connection",
|
|
562
|
-
latestVersion,
|
|
563
|
-
supportedVersions,
|
|
564
|
-
upgrades: {}
|
|
565
|
-
};
|
|
566
|
-
//#endregion
|
|
567
567
|
//#region document-models/connection/v1/gen/document-type.ts
|
|
568
568
|
/**
|
|
569
569
|
* WARNING: DO NOT EDIT
|
|
@@ -685,6 +685,6 @@ const Connection = {
|
|
|
685
685
|
documentModel: createState(defaultBaseState(), documentModel)
|
|
686
686
|
};
|
|
687
687
|
//#endregion
|
|
688
|
-
export {
|
|
688
|
+
export { removeSecretRef as A, RemoveSecretRefInputSchema as B, recordCheckResult as C, setConnector as D, setConnectionName as E, ConnectionStateSchema as F, SetConnectionNameInputSchema as G, SetAccountLabelInputSchema as H, ConnectionStatusSchema as I, definedNonNullAnySchema as J, SetConnectorInputSchema as K, ReactorConnectionConfigSchema as L, setConfigValue as M, setSecretRef as N, creators_exports$2 as O, ConnectionAuthTypeSchema as P, supportedVersions as Q, RecordCheckResultInputSchema as R, creators_exports as S, setAccountLabel as T, SetConfigInputSchema as U, SecretRefSchema as V, SetConfigValueInputSchema as W, connectionUpgradeManifest as X, isDefinedNonNullAny as Y, latestVersion as Z, defaultReactorConnectionConfig as _, utils$1 as a, documentModel as b, ConnectionPHStateSchema as c, isConnectionDocument as d, isConnectionState as f, REACTOR_LOCAL_ENDPOINT as g, REACTOR_CONNECTOR_ID as h, initialLocalState as i, setConfig as j, removeConfigValue as k, assertIsConnectionDocument as l, reducer as m, utils as n, ConnectionDocumentHeaderSchema as o, connectionDocumentType as p, SetSecretRefInputSchema as q, initialGlobalState as r, ConnectionDocumentSchema as s, Connection as t, assertIsConnectionState as u, isReactorConnectorId as v, creators_exports$1 as w, actions as x, parseReactorConnectionConfig as y, RemoveConfigValueInputSchema as z };
|
|
689
689
|
|
|
690
|
-
//# sourceMappingURL=module-
|
|
690
|
+
//# sourceMappingURL=module-DJz6oTX0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-DJz6oTX0.js","names":["z","connectionConnectionActions","connectionConfigActions","connectionHealthActions","utils","genUtils","customUtils"],"sources":["../../document-models/connection/upgrades/versions.ts","../../document-models/connection/upgrades/upgrade-manifest.ts","../../document-models/connection/v1/gen/schema/zod.ts","../../document-models/connection/v1/gen/config/creators.ts","../../document-models/connection/v1/gen/connection/creators.ts","../../document-models/connection/v1/gen/health/creators.ts","../../document-models/connection/v1/actions.ts","../../document-models/connection/v1/gen/document-model.ts","../../document-models/connection/v1/gen/config/error.ts","../../document-models/connection/v1/src/reactor-connection.ts","../../document-models/connection/v1/src/reducers/config.ts","../../document-models/connection/v1/gen/connection/error.ts","../../document-models/connection/v1/src/reducers/connection.ts","../../document-models/connection/v1/src/reducers/health.ts","../../document-models/connection/v1/gen/reducer.ts","../../document-models/connection/v1/gen/document-type.ts","../../document-models/connection/v1/gen/document-schema.ts","../../document-models/connection/v1/gen/utils.ts","../../document-models/connection/v1/src/utils.ts","../../document-models/connection/v1/utils.ts","../../document-models/connection/v1/module.ts"],"sourcesContent":["export const supportedVersions = [1] as const;\n\nexport const latestVersion = supportedVersions[0];\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { UpgradeManifest } from \"document-model\";\nimport { latestVersion, supportedVersions } from \"./versions.js\";\n\nexport const connectionUpgradeManifest: UpgradeManifest<\n typeof supportedVersions\n> = {\n documentType: \"powerhouse/connection\",\n latestVersion,\n supportedVersions,\n upgrades: {},\n};\n","/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n ConnectionAuthType,\n ConnectionState,\n ConnectionStatus,\n ReactorConnectionConfig,\n RecordCheckResultInput,\n RemoveConfigValueInput,\n RemoveSecretRefInput,\n SecretRef,\n SetAccountLabelInput,\n SetConfigInput,\n SetConfigValueInput,\n SetConnectionNameInput,\n SetConnectorInput,\n SetSecretRefInput,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const ConnectionAuthTypeSchema = z.enum([\n \"BASIC_AUTH\",\n \"CUSTOM_AUTH\",\n \"NONE\",\n \"OAUTH2\",\n \"OIDC\",\n \"REACTOR\",\n \"SECRET_TEXT\",\n]);\n\nexport const ConnectionStatusSchema = z.enum([\n \"ERROR\",\n \"OK\",\n \"REVOKED\",\n \"UNCONFIGURED\",\n]);\n\nexport function ConnectionStateSchema(): z.ZodObject<\n Properties<ConnectionState>\n> {\n return z.object({\n __typename: z.literal(\"ConnectionState\").optional(),\n accountLabel: z.string().nullish(),\n authType: ConnectionAuthTypeSchema,\n config: z.unknown(),\n connectorId: z.string(),\n lastCheckedAt: z.iso.datetime().nullish(),\n lastError: z.string().nullish(),\n name: z.string(),\n secretRefs: z.array(z.lazy(() => SecretRefSchema())),\n status: ConnectionStatusSchema,\n });\n}\n\nexport function ReactorConnectionConfigSchema(): z.ZodObject<\n Properties<ReactorConnectionConfig>\n> {\n return z.object({\n __typename: z.literal(\"ReactorConnectionConfig\").optional(),\n access: z.string().nullish(),\n endpoint: z.string(),\n });\n}\n\nexport function RecordCheckResultInputSchema(): z.ZodObject<\n Properties<RecordCheckResultInput>\n> {\n return z.object({\n checkedAt: z.iso.datetime(),\n error: z.string().nullish(),\n status: ConnectionStatusSchema,\n });\n}\n\nexport function RemoveConfigValueInputSchema(): z.ZodObject<\n Properties<RemoveConfigValueInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function RemoveSecretRefInputSchema(): z.ZodObject<\n Properties<RemoveSecretRefInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function SecretRefSchema(): z.ZodObject<Properties<SecretRef>> {\n return z.object({\n __typename: z.literal(\"SecretRef\").optional(),\n id: z.string(),\n name: z.string(),\n ref: z.string(),\n });\n}\n\nexport function SetAccountLabelInputSchema(): z.ZodObject<\n Properties<SetAccountLabelInput>\n> {\n return z.object({\n accountLabel: z.string().nullish(),\n });\n}\n\nexport function SetConfigInputSchema(): z.ZodObject<\n Properties<SetConfigInput>\n> {\n return z.object({\n config: z.unknown(),\n });\n}\n\nexport function SetConfigValueInputSchema(): z.ZodObject<\n Properties<SetConfigValueInput>\n> {\n return z.object({\n name: z.string(),\n value: z.unknown(),\n });\n}\n\nexport function SetConnectionNameInputSchema(): z.ZodObject<\n Properties<SetConnectionNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetConnectorInputSchema(): z.ZodObject<\n Properties<SetConnectorInput>\n> {\n return z.object({\n authType: ConnectionAuthTypeSchema,\n connectorId: z.string(),\n });\n}\n\nexport function SetSecretRefInputSchema(): z.ZodObject<\n Properties<SetSecretRefInput>\n> {\n return z.object({\n id: z.string(),\n name: z.string(),\n ref: z.string(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n RemoveConfigValueInputSchema,\n RemoveSecretRefInputSchema,\n SetConfigInputSchema,\n SetConfigValueInputSchema,\n SetSecretRefInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n RemoveConfigValueInput,\n RemoveSecretRefInput,\n SetConfigInput,\n SetConfigValueInput,\n SetSecretRefInput,\n} from \"../types.js\";\nimport type {\n RemoveConfigValueAction,\n RemoveSecretRefAction,\n SetConfigAction,\n SetConfigValueAction,\n SetSecretRefAction,\n} from \"./actions.js\";\n\nexport const setConfig = (input: SetConfigInput) =>\n createAction<SetConfigAction>(\n \"SET_CONFIG\",\n { ...input },\n undefined,\n SetConfigInputSchema,\n \"global\",\n );\n\nexport const setConfigValue = (input: SetConfigValueInput) =>\n createAction<SetConfigValueAction>(\n \"SET_CONFIG_VALUE\",\n { ...input },\n undefined,\n SetConfigValueInputSchema,\n \"global\",\n );\n\nexport const removeConfigValue = (input: RemoveConfigValueInput) =>\n createAction<RemoveConfigValueAction>(\n \"REMOVE_CONFIG_VALUE\",\n { ...input },\n undefined,\n RemoveConfigValueInputSchema,\n \"global\",\n );\n\nexport const setSecretRef = (input: SetSecretRefInput) =>\n createAction<SetSecretRefAction>(\n \"SET_SECRET_REF\",\n { ...input },\n undefined,\n SetSecretRefInputSchema,\n \"global\",\n );\n\nexport const removeSecretRef = (input: RemoveSecretRefInput) =>\n createAction<RemoveSecretRefAction>(\n \"REMOVE_SECRET_REF\",\n { ...input },\n undefined,\n RemoveSecretRefInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetAccountLabelInputSchema,\n SetConnectionNameInputSchema,\n SetConnectorInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n SetAccountLabelInput,\n SetConnectionNameInput,\n SetConnectorInput,\n} from \"../types.js\";\nimport type {\n SetAccountLabelAction,\n SetConnectionNameAction,\n SetConnectorAction,\n} from \"./actions.js\";\n\nexport const setConnectionName = (input: SetConnectionNameInput) =>\n createAction<SetConnectionNameAction>(\n \"SET_CONNECTION_NAME\",\n { ...input },\n undefined,\n SetConnectionNameInputSchema,\n \"global\",\n );\n\nexport const setConnector = (input: SetConnectorInput) =>\n createAction<SetConnectorAction>(\n \"SET_CONNECTOR\",\n { ...input },\n undefined,\n SetConnectorInputSchema,\n \"global\",\n );\n\nexport const setAccountLabel = (input: SetAccountLabelInput) =>\n createAction<SetAccountLabelAction>(\n \"SET_ACCOUNT_LABEL\",\n { ...input },\n undefined,\n SetAccountLabelInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { RecordCheckResultInputSchema } from \"../schema/zod.js\";\nimport type { RecordCheckResultInput } from \"../types.js\";\nimport type { RecordCheckResultAction } from \"./actions.js\";\n\nexport const recordCheckResult = (input: RecordCheckResultInput) =>\n createAction<RecordCheckResultAction>(\n \"RECORD_CHECK_RESULT\",\n { ...input },\n undefined,\n RecordCheckResultInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport {\n connectionConfigActions,\n connectionConnectionActions,\n connectionHealthActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the Connection document model */\n\nexport const actions = {\n ...baseActions,\n ...connectionConnectionActions,\n ...connectionConfigActions,\n ...connectionHealthActions,\n};\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/connection\",\n name: \"Connection\",\n author: {\n name: \"Powerhouse\",\n website: \"https://www.powerhouse.inc\",\n },\n extension: \".conn\",\n description:\n \"A configured connector instance: auth kind, non-secret config and secret handles, shared by many workflows.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n 'enum ConnectionAuthType {\\n SECRET_TEXT\\n BASIC_AUTH\\n CUSTOM_AUTH\\n OAUTH2\\n OIDC\\n NONE\\n \"Reactor access for a piece\\'s ctx.reactor; any piece may bind it.\"\\n REACTOR\\n}\\n\\nenum ConnectionStatus {\\n UNCONFIGURED\\n OK\\n ERROR\\n REVOKED\\n}\\n\\ntype SecretRef {\\n id: OID!\\n \"Matches an auth property name in the connector\\'s config schema.\"\\n name: String!\\n \"Opaque handle into the host secret provider. Not the secret.\"\\n ref: String!\\n}\\n\\n\"Config of a REACTOR connection. It holds no secrets.\"\\ntype ReactorConnectionConfig {\\n \"Which reactor the connection reaches; \\'local\\' is the only value.\"\\n endpoint: String!\\n \"\\'read\\' limits the connection to reads; absent allows what the step declares.\"\\n access: String\\n}\\n\\ntype ConnectionState {\\n name: String!\\n \"Fully-qualified connector id: \\'@acme/connector-imap#imap\\'.\"\\n connectorId: String!\\n \"Activepieces auth kind, so a piece\\'s PieceAuth maps directly.\"\\n authType: ConnectionAuthType!\\n \"Non-secret configuration, validated against the connector\\'s auth schema; a ReactorConnectionConfig for REACTOR.\"\\n config: Unknown!\\n \"Secret handles; values never appear in state, operations, or the run journal.\"\\n secretRefs: [SecretRef!]!\\n status: ConnectionStatus!\\n lastCheckedAt: DateTime\\n lastError: String\\n \"Populated by the connector\\'s own metadata call. Display only.\"\\n accountLabel: String\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": \"\",\\n \"connectorId\": \"\",\\n \"authType\": \"NONE\",\\n \"config\": {},\\n \"secretRefs\": [],\\n \"status\": \"UNCONFIGURED\",\\n \"lastCheckedAt\": null,\\n \"lastError\": null,\\n \"accountLabel\": null\\n}',\n },\n },\n modules: [\n {\n id: \"d723a91b-329c-46c3-acbf-85533c47b5a4\",\n name: \"connection\",\n description: \"Connection identity and connector binding.\",\n operations: [\n {\n id: \"ece5a33d-0bc1-46ff-87f4-c763d298cb3a\",\n name: \"SET_CONNECTION_NAME\",\n description: \"Sets the connection's display name.\",\n schema: \"input SetConnectionNameInput {\\n name: String!\\n}\",\n template: \"Sets the connection's display name.\",\n reducer: \"state.name = action.input.name;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"e668be97-82c8-433e-8af7-1644cfa25723\",\n name: \"SET_CONNECTOR\",\n description:\n \"Binds the connection to a connector and auth kind; resets status to UNCONFIGURED. REACTOR goes only with the reserved reactor connector id.\",\n schema:\n \"input SetConnectorInput {\\n connectorId: String!\\n authType: ConnectionAuthType!\\n}\",\n template:\n \"Binds the connection to a connector and auth kind; resets status to UNCONFIGURED.\",\n reducer:\n 'state.connectorId = action.input.connectorId;\\nstate.authType = action.input.authType;\\nstate.status = \"UNCONFIGURED\";',\n errors: [\n {\n id: \"6e550820-9d17-447d-9378-a17d38262bc8\",\n name: \"ReservedConnectorError\",\n code: \"RESERVED_CONNECTOR\",\n description:\n \"The reserved reactor connector id goes only with authType REACTOR, and REACTOR only with it.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"01a28e56-4406-4160-9547-f6239e728afd\",\n name: \"SET_ACCOUNT_LABEL\",\n description: \"Sets or clears the display-only account label.\",\n schema:\n \"input SetAccountLabelInput {\\n accountLabel: String\\n}\",\n template: \"Sets or clears the display-only account label.\",\n reducer:\n \"state.accountLabel = action.input.accountLabel || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"728ec59f-db15-4c52-aa9d-fbe1a6d6a6f9\",\n name: \"config\",\n description: \"Non-secret configuration and secret handles.\",\n operations: [\n {\n id: \"c26f7cd8-c280-4e85-be65-83c3c1217358\",\n name: \"SET_CONFIG\",\n description: \"Replaces the non-secret configuration.\",\n schema: \"input SetConfigInput {\\n config: Unknown!\\n}\",\n template: \"Replaces the non-secret configuration.\",\n reducer: \"state.config = action.input.config;\",\n errors: [\n {\n id: \"b9911ea4-4168-4080-b05e-8687928dc309\",\n name: \"InvalidReactorConfigError\",\n code: \"INVALID_REACTOR_CONFIG\",\n description:\n \"A REACTOR connection's config is not a valid ReactorConnectionConfig.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"32f1c6e9-1bba-4c99-bd20-311b16f95fa9\",\n name: \"SET_CONFIG_VALUE\",\n description:\n \"Sets one non-secret config field, leaving the others as they are.\",\n schema:\n \"input SetConfigValueInput {\\n name: String!\\n value: Unknown!\\n}\",\n template:\n \"Sets one non-secret config field, leaving the others as they are.\",\n reducer: \"\",\n errors: [\n {\n id: \"6db3a25a-a3b2-4751-9470-3c122ff9abcd\",\n name: \"InvalidReactorConfigValueError\",\n code: \"INVALID_REACTOR_CONFIG_VALUE\",\n description:\n \"The field would leave a REACTOR connection's config invalid.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"bcb390f6-f8fc-4a09-99e6-1d84b272d7b6\",\n name: \"REMOVE_CONFIG_VALUE\",\n description:\n \"Removes one non-secret config field. Removing an absent field changes nothing.\",\n schema: \"input RemoveConfigValueInput {\\n name: String!\\n}\",\n template:\n \"Removes one non-secret config field. Removing an absent field changes nothing.\",\n reducer: \"\",\n errors: [\n {\n id: \"24496230-4088-4994-a6d5-b7651c718f63\",\n name: \"InvalidReactorConfigRemovalError\",\n code: \"INVALID_REACTOR_CONFIG_REMOVAL\",\n description:\n \"The removal would leave a REACTOR connection's config invalid.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"1a90e020-6dc5-49e0-9be1-732028dd10d3\",\n name: \"SET_SECRET_REF\",\n description:\n \"Creates or updates a secret handle, keyed by its auth property name.\",\n schema:\n \"input SetSecretRefInput {\\n id: OID!\\n name: String!\\n ref: String!\\n}\",\n template:\n \"Creates or updates a secret handle, keyed by its auth property name.\",\n reducer:\n \"const existing = state.secretRefs.find(\\n (secretRef) => secretRef.name === action.input.name,\\n);\\nif (existing) {\\n existing.ref = action.input.ref;\\n} else {\\n state.secretRefs.push({\\n id: action.input.id,\\n name: action.input.name,\\n ref: action.input.ref,\\n });\\n}\",\n errors: [\n {\n id: \"e3c42e5b-80c6-4020-8cfd-2ccc797d82b7\",\n name: \"ReactorSecretRefError\",\n code: \"REACTOR_SECRET_REF\",\n description: \"A REACTOR connection holds no secrets.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"0c7214b1-0494-49d8-913f-39ad59ca2a3b\",\n name: \"REMOVE_SECRET_REF\",\n description: \"Removes a secret handle.\",\n schema: \"input RemoveSecretRefInput {\\n id: OID!\\n}\",\n template: \"Removes a secret handle.\",\n reducer:\n 'const index = state.secretRefs.findIndex(\\n (secretRef) => secretRef.id === action.input.id,\\n);\\nif (index === -1) {\\n throw new SecretRefNotFoundError(\"Secret ref not found\");\\n}\\nstate.secretRefs.splice(index, 1);',\n errors: [\n {\n id: \"0c5d799d-d71d-4a75-ab0e-136ea72f1a3b\",\n name: \"SecretRefNotFoundError\",\n code: \"SECRET_REF_NOT_FOUND\",\n description: \"No secret ref exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"3b02be29-0e8b-400d-ba05-1305e28c86b5\",\n name: \"health\",\n description: \"Connection health, written by connector checks.\",\n operations: [\n {\n id: \"2e8e9df7-3939-425c-9e28-7c8fa5de7d3f\",\n name: \"RECORD_CHECK_RESULT\",\n description:\n \"Records the outcome of a connection check, including revocation.\",\n schema:\n \"input RecordCheckResultInput {\\n status: ConnectionStatus!\\n checkedAt: DateTime!\\n error: String\\n}\",\n template:\n \"Records the outcome of a connection check, including revocation.\",\n reducer:\n \"state.status = action.input.status;\\nstate.lastCheckedAt = action.input.checkedAt;\\nstate.lastError = action.input.error || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","export type ErrorCode =\n | \"InvalidReactorConfigError\"\n | \"InvalidReactorConfigValueError\"\n | \"InvalidReactorConfigRemovalError\"\n | \"ReactorSecretRefError\"\n | \"SecretRefNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidReactorConfigError extends Error implements ReducerError {\n errorCode = \"InvalidReactorConfigError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigError\") {\n super(message);\n }\n}\n\nexport class InvalidReactorConfigValueError\n extends Error\n implements ReducerError\n{\n errorCode = \"InvalidReactorConfigValueError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigValueError\") {\n super(message);\n }\n}\n\nexport class InvalidReactorConfigRemovalError\n extends Error\n implements ReducerError\n{\n errorCode = \"InvalidReactorConfigRemovalError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigRemovalError\") {\n super(message);\n }\n}\n\nexport class ReactorSecretRefError extends Error implements ReducerError {\n errorCode = \"ReactorSecretRefError\" as ErrorCode;\n constructor(message = \"ReactorSecretRefError\") {\n super(message);\n }\n}\n\nexport class SecretRefNotFoundError extends Error implements ReducerError {\n errorCode = \"SecretRefNotFoundError\" as ErrorCode;\n constructor(message = \"SecretRefNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetConfig: { InvalidReactorConfigError },\n\n SetConfigValue: { InvalidReactorConfigValueError },\n\n RemoveConfigValue: { InvalidReactorConfigRemovalError },\n\n SetSecretRef: { ReactorSecretRefError },\n\n RemoveSecretRef: { SecretRefNotFoundError },\n};\n","import { ReactorConnectionConfigSchema } from \"../gen/schema/zod.js\";\n\n// Reserved for REACTOR connections; any piece may bind it.\nexport const REACTOR_CONNECTOR_ID = \"@powerhousedao/reactor#reactor\";\nexport const REACTOR_LOCAL_ENDPOINT = \"local\";\n\n// A REACTOR connection's config with absent fields left out.\nexport interface ReactorConnectionConfigValue {\n endpoint: typeof REACTOR_LOCAL_ENDPOINT;\n access?: \"read\";\n}\n\nexport type ReactorConnectionConfigResult =\n | { ok: true; config: ReactorConnectionConfigValue }\n | { ok: false; error: string };\n\nconst CONFIG_KEYS = new Set([\"endpoint\", \"access\"]);\n\nexport function isReactorConnectorId(connectorId: string): boolean {\n return connectorId === REACTOR_CONNECTOR_ID;\n}\n\nexport function defaultReactorConnectionConfig(): ReactorConnectionConfigValue {\n return { endpoint: REACTOR_LOCAL_ENDPOINT };\n}\n\n// Unknown keys are refused, so a misspelt field is never ignored.\nexport function parseReactorConnectionConfig(\n config: unknown,\n): ReactorConnectionConfigResult {\n if (config === null || typeof config !== \"object\" || Array.isArray(config)) {\n return {\n ok: false,\n error: \"A reactor connection config must be an object\",\n };\n }\n const unknownKey = Object.keys(config).find((key) => !CONFIG_KEYS.has(key));\n if (unknownKey) {\n return {\n ok: false,\n error: `Unknown reactor connection field \"${unknownKey}\"`,\n };\n }\n const parsed = ReactorConnectionConfigSchema().safeParse(config);\n if (!parsed.success) {\n return { ok: false, error: parsed.error.issues[0]?.message ?? \"Invalid\" };\n }\n const { endpoint, access } = parsed.data;\n if (endpoint !== REACTOR_LOCAL_ENDPOINT) {\n return {\n ok: false,\n error: `Reactor endpoint must be \"${REACTOR_LOCAL_ENDPOINT}\"`,\n };\n }\n if (access !== undefined && access !== null && access !== \"read\") {\n return { ok: false, error: `Reactor access must be \"read\" or absent` };\n }\n const value: ReactorConnectionConfigValue = { endpoint };\n if (access === \"read\") value.access = access;\n return { ok: true, config: value };\n}\n","import type { ConnectionConfigOperations } from \"document-models/connection/v1\";\nimport {\n InvalidReactorConfigError,\n InvalidReactorConfigRemovalError,\n InvalidReactorConfigValueError,\n ReactorSecretRefError,\n SecretRefNotFoundError,\n} from \"../../gen/config/error.js\";\nimport { parseReactorConnectionConfig } from \"../reactor-connection.js\";\n\nexport const connectionConfigOperations: ConnectionConfigOperations = {\n setConfigOperation(state, action) {\n if (state.authType !== \"REACTOR\") {\n state.config = action.input.config;\n return;\n }\n const parsed = parseReactorConnectionConfig(action.input.config);\n if (!parsed.ok) throw new InvalidReactorConfigError(parsed.error);\n state.config = parsed.config;\n },\n setSecretRefOperation(state, action) {\n if (state.authType === \"REACTOR\") {\n throw new ReactorSecretRefError(\"A reactor connection holds no secrets\");\n }\n const existing = state.secretRefs.find(\n (secretRef) => secretRef.name === action.input.name,\n );\n if (existing) {\n existing.ref = action.input.ref;\n } else {\n state.secretRefs.push({\n id: action.input.id,\n name: action.input.name,\n ref: action.input.ref,\n });\n }\n },\n removeSecretRefOperation(state, action) {\n const index = state.secretRefs.findIndex(\n (secretRef) => secretRef.id === action.input.id,\n );\n if (index === -1) {\n throw new SecretRefNotFoundError(\"Secret ref not found\");\n }\n state.secretRefs.splice(index, 1);\n },\n setConfigValueOperation(state, action) {\n const { name, value } = action.input;\n const config = { ...configRecord(state.config) };\n if (value === undefined) delete config[name];\n else config[name] = value;\n if (state.authType !== \"REACTOR\") {\n state.config = config;\n return;\n }\n const parsed = parseReactorConnectionConfig(config);\n if (!parsed.ok) throw new InvalidReactorConfigValueError(parsed.error);\n state.config = parsed.config;\n },\n removeConfigValueOperation(state, action) {\n const current = configRecord(state.config);\n if (!(action.input.name in current)) return;\n const { [action.input.name]: _removed, ...config } = current;\n if (state.authType !== \"REACTOR\") {\n state.config = config;\n return;\n }\n const parsed = parseReactorConnectionConfig(config);\n if (!parsed.ok) throw new InvalidReactorConfigRemovalError(parsed.error);\n state.config = parsed.config;\n },\n};\n\n// A config that is not an object holds no fields to keep.\nfunction configRecord(config: unknown): Record<string, unknown> {\n return config !== null && typeof config === \"object\" && !Array.isArray(config)\n ? (config as Record<string, unknown>)\n : {};\n}\n","export type ErrorCode = \"ReservedConnectorError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class ReservedConnectorError extends Error implements ReducerError {\n errorCode = \"ReservedConnectorError\" as ErrorCode;\n constructor(message = \"ReservedConnectorError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetConnector: { ReservedConnectorError },\n};\n","import type { ConnectionConnectionOperations } from \"document-models/connection/v1\";\nimport { ReservedConnectorError } from \"../../gen/connection/error.js\";\nimport {\n defaultReactorConnectionConfig,\n isReactorConnectorId,\n} from \"../reactor-connection.js\";\n\nexport const connectionConnectionOperations: ConnectionConnectionOperations = {\n setConnectionNameOperation(state, action) {\n state.name = action.input.name;\n },\n setConnectorOperation(state, action) {\n const reactor = action.input.authType === \"REACTOR\";\n if (reactor !== isReactorConnectorId(action.input.connectorId)) {\n throw new ReservedConnectorError(\n \"The reactor connector id goes only with authType REACTOR\",\n );\n }\n const rebinding = action.input.connectorId !== state.connectorId;\n state.connectorId = action.input.connectorId;\n state.authType = action.input.authType;\n state.status = \"UNCONFIGURED\";\n // A different connector invalidates the old one's config/secrets/health;\n // a same-connector call (e.g. re-declaring authType) leaves them alone.\n if (rebinding) {\n state.config = reactor ? defaultReactorConnectionConfig() : {};\n state.secretRefs = [];\n state.accountLabel = null;\n state.lastCheckedAt = null;\n state.lastError = null;\n }\n },\n setAccountLabelOperation(state, action) {\n state.accountLabel = action.input.accountLabel || null;\n },\n};\n","import type { ConnectionHealthOperations } from \"document-models/connection/v1\";\n\nexport const connectionHealthOperations: ConnectionHealthOperations = {\n recordCheckResultOperation(state, action) {\n state.status = action.input.status;\n state.lastCheckedAt = action.input.checkedAt;\n state.lastError = action.input.error || null;\n },\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { ConnectionPHState } from \"document-models/connection/v1\";\n\nimport { connectionConfigOperations } from \"../src/reducers/config.js\";\nimport { connectionConnectionOperations } from \"../src/reducers/connection.js\";\nimport { connectionHealthOperations } from \"../src/reducers/health.js\";\n\nimport {\n RecordCheckResultInputSchema,\n RemoveConfigValueInputSchema,\n RemoveSecretRefInputSchema,\n SetAccountLabelInputSchema,\n SetConfigInputSchema,\n SetConfigValueInputSchema,\n SetConnectionNameInputSchema,\n SetConnectorInputSchema,\n SetSecretRefInputSchema,\n} from \"./schema/zod.js\";\n\nconst schemaMemo = new Map<() => unknown, unknown>();\n\nfunction memoizedSchema<T>(makeSchema: () => T): T {\n let schema = schemaMemo.get(makeSchema) as T | undefined;\n if (schema === undefined) {\n schema = makeSchema();\n schemaMemo.set(makeSchema, schema);\n }\n return schema;\n}\n\nconst stateReducer: StateReducer<ConnectionPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_CONNECTION_NAME\": {\n memoizedSchema(SetConnectionNameInputSchema).parse(action.input);\n\n connectionConnectionOperations.setConnectionNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONNECTOR\": {\n memoizedSchema(SetConnectorInputSchema).parse(action.input);\n\n connectionConnectionOperations.setConnectorOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_ACCOUNT_LABEL\": {\n memoizedSchema(SetAccountLabelInputSchema).parse(action.input);\n\n connectionConnectionOperations.setAccountLabelOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONFIG\": {\n memoizedSchema(SetConfigInputSchema).parse(action.input);\n\n connectionConfigOperations.setConfigOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONFIG_VALUE\": {\n memoizedSchema(SetConfigValueInputSchema).parse(action.input);\n\n connectionConfigOperations.setConfigValueOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_CONFIG_VALUE\": {\n memoizedSchema(RemoveConfigValueInputSchema).parse(action.input);\n\n connectionConfigOperations.removeConfigValueOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_SECRET_REF\": {\n memoizedSchema(SetSecretRefInputSchema).parse(action.input);\n\n connectionConfigOperations.setSecretRefOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_SECRET_REF\": {\n memoizedSchema(RemoveSecretRefInputSchema).parse(action.input);\n\n connectionConfigOperations.removeSecretRefOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"RECORD_CHECK_RESULT\": {\n memoizedSchema(RecordCheckResultInputSchema).parse(action.input);\n\n connectionHealthOperations.recordCheckResultOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<ConnectionPHState> = createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const connectionDocumentType = \"powerhouse/connection\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { connectionDocumentType } from \"./document-type.js\";\nimport { ConnectionStateSchema } from \"./schema/zod.js\";\nimport type { ConnectionDocument, ConnectionPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a Connection document */\nexport const ConnectionDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({\n documentType: z.literal(connectionDocumentType),\n});\n\n/** Schema for validating the state object of a Connection document */\nexport const ConnectionPHStateSchema = BaseDocumentStateSchema.extend({\n global: ConnectionStateSchema(),\n});\n\nexport const ConnectionDocumentSchema = z.object({\n header: ConnectionDocumentHeaderSchema,\n state: ConnectionPHStateSchema,\n initialState: ConnectionPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a Connection document state object */\nexport function isConnectionState(state: unknown): state is ConnectionPHState {\n return ConnectionPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a Connection document state object */\nexport function assertIsConnectionState(\n state: unknown,\n): asserts state is ConnectionPHState {\n ConnectionPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a Connection document */\nexport function isConnectionDocument(\n document: unknown,\n): document is ConnectionDocument {\n return ConnectionDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a Connection document */\nexport function assertIsConnectionDocument(\n document: unknown,\n): asserts document is ConnectionDocument {\n ConnectionDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils, PHBaseState, Reducer } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInputVersioned,\n baseSaveToFileHandle,\n createBaseState,\n} from \"document-model\";\nimport { connectionUpgradeManifest } from \"../../upgrades/upgrade-manifest.js\";\nimport {\n assertIsConnectionDocument,\n assertIsConnectionState,\n isConnectionDocument,\n isConnectionState,\n} from \"./document-schema.js\";\nimport { connectionDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n ConnectionGlobalState,\n ConnectionLocalState,\n ConnectionPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: ConnectionGlobalState = {\n name: \"\",\n connectorId: \"\",\n authType: \"NONE\",\n config: {},\n secretRefs: [],\n status: \"UNCONFIGURED\",\n lastCheckedAt: null,\n lastError: null,\n accountLabel: null,\n};\nexport const initialLocalState: ConnectionLocalState = {};\n\nexport const utils: DocumentModelUtils<ConnectionPHState> = {\n fileExtension: \".conn\",\n createState(state) {\n return {\n ...createBaseState(state?.auth, { version: 1, ...state?.document }),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n return baseCreateDocument(utils.createState, state, connectionDocumentType);\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInputVersioned(input, {\n reducers: { 1: reducer as unknown as Reducer<PHBaseState> },\n upgradeManifest: connectionUpgradeManifest,\n });\n },\n isStateOfType(state) {\n return isConnectionState(state);\n },\n assertIsStateOfType(state) {\n return assertIsConnectionState(state);\n },\n isDocumentOfType(document) {\n return isConnectionDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsConnectionDocument(document);\n },\n};\n","export * from \"./reactor-connection.js\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport type { ConnectionPHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the Connection document model */\nexport const utils: DocumentModelUtils<ConnectionPHState> = {\n ...genUtils,\n ...customUtils,\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelModule } from \"document-model\";\nimport { createState, defaultBaseState } from \"document-model\";\nimport { actions } from \"./actions.js\";\nimport { documentModel } from \"./gen/document-model.js\";\nimport { reducer } from \"./gen/reducer.js\";\nimport type { ConnectionPHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the Connection document type */\nexport const Connection = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<ConnectionPHState>;\n"],"mappings":";;;;;AAAA,MAAa,oBAAoB,CAAC,CAAC;AAEnC,MAAa,gBAAgB,kBAAkB;;;ACK/C,MAAa,4BAET;CACF,cAAc;CACd;CACA;CACA,UAAU,CAAC;AACb;;;ACYA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,IAAI,CAAC,CACL,QAAQ,MAAM,oBAAoB,CAAC,CAAC;AAEvC,MAAa,2BAA2BA,IAAE,KAAK;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,yBAAyBA,IAAE,KAAK;CAC3C;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgB,wBAEd;CACA,OAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,iBAAiB,CAAC,CAAC,SAAS;EAClD,cAAcA,IAAE,OAAO,CAAC,CAAC,QAAQ;EACjC,UAAU;EACV,QAAQA,IAAE,QAAQ;EAClB,aAAaA,IAAE,OAAO;EACtB,eAAeA,IAAE,IAAI,SAAS,CAAC,CAAC,QAAQ;EACxC,WAAWA,IAAE,OAAO,CAAC,CAAC,QAAQ;EAC9B,MAAMA,IAAE,OAAO;EACf,YAAYA,IAAE,MAAMA,IAAE,WAAW,gBAAgB,CAAC,CAAC;EACnD,QAAQ;CACV,CAAC;AACH;AAEA,SAAgB,gCAEd;CACA,OAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,yBAAyB,CAAC,CAAC,SAAS;EAC1D,QAAQA,IAAE,OAAO,CAAC,CAAC,QAAQ;EAC3B,UAAUA,IAAE,OAAO;CACrB,CAAC;AACH;AAEA,SAAgB,+BAEd;CACA,OAAOA,IAAE,OAAO;EACd,WAAWA,IAAE,IAAI,SAAS;EAC1B,OAAOA,IAAE,OAAO,CAAC,CAAC,Q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AC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QACE;MACF,UAAU;MACV,SACE;MACF,QAAQ,CAAC;MACT,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QAAQ;MACR,UACE;MACF,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SACE;MACF,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aAAa;OACb,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;IACF;GACF;GACA;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY,CACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UACE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ACA,MAAa,oBAA0C,CAAC;AAExD,MAAaC,UAA+C;CAC1D,eAAe;CACf,YAAY,OAAO;EACjB,OAAO;GACL,GAAG,gBAAgB,OAAO,MAAM;IAAE,SAAS;IAAG,GAAG,OAAO;GAAS,CAAC;GAClE,QAAQ;IAAE,GAAG;IAAoB,GAAG,OAAO;GAAO;GAClD,OAAO;IAAE,GAAG;IAAmB,GAAG,OAAO;GAAM;EACjD;CACF;CACA,eAAe,OAAO;EACpB,OAAO,mBAAmBA,QAAM,aAAa,OAAO,sBAAsB;CAC5E;CACA,iBAAiB,UAAU,OAAO;EAChC,OAAO,qBAAqB,UAAU,KAAK;CAC7C;CACA,cAAc,OAAO;EACnB,OAAO,2BAA2B,OAAO;GACvC,UAAU,EAAE,GAAG,QAA2C;GAC1D,iBAAiB;EACnB,CAAC;CACH;CACA,cAAc,OAAO;EACnB,OAAO,kBAAkB,KAAK;CAChC;CACA,oBAAoB,OAAO;EACzB,OAAO,wBAAwB,KAAK;CACtC;CACA,iBAAiB,UAAU;EACzB,OAAO,qBAAqB,QAAQ;CACtC;CACA,uBAAuB,UAAU;EAC/B,OAAO,2BAA2B,QAAQ;CAC5C;AACF;;;;;;;;;;;;;AE9DA,MAAa,QAA+C;CAC1D,GAAGC;CACH,GAAGC;AACL;;;;ACAA,MAAa,aAAa;CACxB,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import * as z$1 from "zod";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { isExactVersion } from "@powerhousedao/pieces-framework/block-type";
|
|
5
4
|
import { BaseDocumentHeaderSchema, BaseDocumentStateSchema, baseActions, baseCreateDocument, baseLoadFromInputVersioned, baseSaveToFileHandle, createAction, createBaseState, createReducer, createState, defaultBaseState, isDocumentAction } from "document-model";
|
|
5
|
+
import { isExactVersion } from "@powerhousedao/pieces-framework/block-type";
|
|
6
6
|
//#region document-models/workflow/v1/gen/schema/zod.ts
|
|
7
7
|
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
|
|
8
8
|
const definedNonNullAnySchema = z$1.any().refine((v) => isDefinedNonNullAny(v));
|
|
@@ -158,6 +158,13 @@ function SetLastTestInputSchema() {
|
|
|
158
158
|
testedAt: z$1.iso.datetime()
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
+
function SetManagedByInputSchema() {
|
|
162
|
+
return z$1.object({
|
|
163
|
+
documentId: z$1.string().nullish(),
|
|
164
|
+
documentType: z$1.string().nullish(),
|
|
165
|
+
label: z$1.string().nullish()
|
|
166
|
+
});
|
|
167
|
+
}
|
|
161
168
|
function SetPolicyInputSchema() {
|
|
162
169
|
return z$1.object({
|
|
163
170
|
concurrency: ConcurrencyModeSchema.nullish(),
|
|
@@ -317,6 +324,14 @@ function WorkflowEdgeSchema() {
|
|
|
317
324
|
to: z$1.string()
|
|
318
325
|
});
|
|
319
326
|
}
|
|
327
|
+
function WorkflowManagerSchema() {
|
|
328
|
+
return z$1.object({
|
|
329
|
+
__typename: z$1.literal("WorkflowManager").optional(),
|
|
330
|
+
documentId: z$1.string(),
|
|
331
|
+
documentType: z$1.string(),
|
|
332
|
+
label: z$1.string()
|
|
333
|
+
});
|
|
334
|
+
}
|
|
320
335
|
function WorkflowPolicySchema() {
|
|
321
336
|
return z$1.object({
|
|
322
337
|
__typename: z$1.literal("WorkflowPolicy").optional(),
|
|
@@ -337,6 +352,7 @@ function WorkflowStateSchema() {
|
|
|
337
352
|
edges: z$1.array(z$1.lazy(() => WorkflowEdgeSchema())),
|
|
338
353
|
lastRunAt: z$1.iso.datetime().nullish(),
|
|
339
354
|
lastRunStatus: RunStatusSchema.nullish(),
|
|
355
|
+
managedBy: z$1.lazy(() => WorkflowManagerSchema().nullish()),
|
|
340
356
|
name: z$1.string(),
|
|
341
357
|
policy: z$1.lazy(() => WorkflowPolicySchema()),
|
|
342
358
|
published: z$1.lazy(() => PublishedWorkflowSchema().nullish()),
|
|
@@ -476,6 +492,7 @@ const removeVariable = (input) => createAction("REMOVE_VARIABLE", { ...input },
|
|
|
476
492
|
* This file is auto-generated and updated by codegen
|
|
477
493
|
*/
|
|
478
494
|
var creators_exports = /* @__PURE__ */ __exportAll({
|
|
495
|
+
setManagedBy: () => setManagedBy,
|
|
479
496
|
setWorkflowDescription: () => setWorkflowDescription,
|
|
480
497
|
setWorkflowName: () => setWorkflowName,
|
|
481
498
|
setWorkflowStatus: () => setWorkflowStatus
|
|
@@ -483,6 +500,7 @@ var creators_exports = /* @__PURE__ */ __exportAll({
|
|
|
483
500
|
const setWorkflowName = (input) => createAction("SET_WORKFLOW_NAME", { ...input }, void 0, SetWorkflowNameInputSchema, "global");
|
|
484
501
|
const setWorkflowDescription = (input) => createAction("SET_WORKFLOW_DESCRIPTION", { ...input }, void 0, SetWorkflowDescriptionInputSchema, "global");
|
|
485
502
|
const setWorkflowStatus = (input) => createAction("SET_WORKFLOW_STATUS", { ...input }, void 0, SetWorkflowStatusInputSchema, "global");
|
|
503
|
+
const setManagedBy = (input) => createAction("SET_MANAGED_BY", { ...input }, void 0, SetManagedByInputSchema, "global");
|
|
486
504
|
//#endregion
|
|
487
505
|
//#region document-models/workflow/v1/actions.ts
|
|
488
506
|
/**
|
|
@@ -520,9 +538,9 @@ const documentModel = {
|
|
|
520
538
|
initialValue: ""
|
|
521
539
|
},
|
|
522
540
|
global: {
|
|
523
|
-
schema: "enum WorkflowStatus {\n DRAFT\n ENABLED\n DISABLED\n ARCHIVED\n}\n\nenum RunStatus {\n PENDING\n RUNNING\n WAITING\n SUCCEEDED\n FAILED\n CANCELLED\n PARKED\n}\n\nenum ConcurrencyMode {\n SINGLETON\n QUEUE\n PARALLEL\n}\n\nenum FailureMode {\n PARK\n NOTIFY\n IGNORE\n}\n\nenum BackoffKind {\n FIXED\n EXPONENTIAL\n}\n\ntype RetryPolicy {\n \"Attempts, not retries: 1 is no retry. Clamped to 10 by the runtime, since each attempt re-runs a side effect and holds the run's worker slot.\"\n maxAttempts: Int!\n backoff: BackoffKind!\n initialDelaySeconds: Int!\n maxDelaySeconds: Int!\n \"Error classes that are retryable, matched against the error's class name or anywhere in its message, case-insensitively. EMPTY admits every error: an empty list with maxAttempts > 1 means retry, not never-retry.\"\n retryOn: [String!]!\n}\n\nenum PropertyMode {\n \"The field's own control.\"\n MANUAL\n \"The author switched the field to a free {{…}} expression.\"\n EXPRESSION\n}\n\ntype PropertySetting {\n prop: String!\n mode: PropertyMode!\n \"Resolved DynamicProperties children, options stripped.\"\n schema: Unknown\n}\n\n\"Reference to the latest test run in the run store.\"\ntype StepTestRecord {\n runId: String!\n testedAt: DateTime!\n}\n\n\"Layout only. The runtime ignores it.\"\ntype Point {\n x: Float!\n y: Float!\n}\n\ntype TriggerBinding {\n id: OID!\n \"Package name of the trigger's piece, e.g. '@powerhousedao/piece-core' or '@acme/piece-imap'.\"\n pieceName: String!\n \"Exact semver of the piece, e.g. '1.2.0'.\"\n pieceVersion: String!\n \"Trigger name within the piece, e.g. 'schedule' or 'new_message'.\"\n triggerName: String!\n \"Connection document id, when the trigger's connector requires one.\"\n connectionId: PHID\n \"Reactor connection document id, when the trigger declares requireReactor.\"\n reactorConnectionId: PHID\n \"Validated against the trigger's configSchema.\"\n config: Unknown!\n propertySettings: [PropertySetting!]\n lastTest: StepTestRecord\n \"Timestamp of the last real edit; a lastTest before it is stale.\"\n updatedAt: DateTime\n}\n\ntype WorkflowStep {\n id: OID!\n \"Author-visible label; unique within the workflow; used in expressions.\"\n key: String!\n name: String!\n \"Package name of the step's piece, e.g. '@powerhousedao/piece-core' or '@activepieces/piece-http'.\"\n pieceName: String!\n \"Exact semver of the piece, e.g. '0.11.19'.\"\n pieceVersion: String!\n \"Action name within the piece, e.g. 'branch' or 'send_request'.\"\n actionName: String!\n connectionId: PHID\n \"Reactor connection document id, when the action declares requireReactor.\"\n reactorConnectionId: PHID\n config: Unknown!\n \"ENFORCED. Per-step override of the workflow default retry policy.\"\n retry: RetryPolicy\n \"ENFORCED. Also raises the cap on each host call the step's piece makes, which is never shorter than the step's own timeout.\"\n timeoutSeconds: Int\n \"NOT YET ENFORCED. Expression yielding a stable key; two executions with the same key are one side effect. A fire is deduplicated on its trigger operation or a trigger item's _dedupe_key, never on a step expression.\"\n idempotencyKeyExpression: String\n position: Point\n propertySettings: [PropertySetting!]\n lastTest: StepTestRecord\n \"Skipped steps are passed over at run time.\"\n skip: Boolean\n \"Timestamp of the last real edit; a lastTest before it is stale.\"\n updatedAt: DateTime\n}\n\ntype WorkflowEdge {\n id: OID!\n \"Source step id, or the trigger id for the entry edge.\"\n from: OID!\n to: OID!\n \"Output port of the source, one it declares: 'next' and 'error' for a piece action, 'next' for the trigger, 'true', 'false' and 'error' for a branch.\"\n port: String!\n \"Optional guard expression; the edge is taken only when it evaluates truthy.\"\n condition: String\n}\n\nenum VariableType {\n TEXT\n NUMBER\n BOOLEAN\n JSON\n \"value is a secret-provider handle (the format of a connection SecretRef.ref), never the plaintext.\"\n SECRET\n}\n\ntype WorkflowVariable {\n id: OID!\n \"Name used in expressions.\"\n key: String!\n \"The value a run reads as variables.<key>.\"\n value: Unknown\n description: String\n \"Null means untyped; consumers infer the kind of value it holds.\"\n type: VariableType\n}\n\ntype WorkflowPolicy {\n \"ENFORCED. SINGLETON drops a firing while a run is active (journaled CANCELLED, not dropped silently); QUEUE serialises; PARALLEL runs concurrently.\"\n concurrency: ConcurrencyMode!\n \"ENFORCED under PARALLEL: how many runs of this workflow may execute at once; null is unbounded. SINGLETON and QUEUE are 1 by definition.\"\n maxParallelRuns: Int\n \"ENFORCED. Checked between steps and while a retry waits; past it the run ends CANCELLED.\"\n runTimeoutSeconds: Int!\n \"NOT YET ENFORCED. Bounds how long a run may stay suspended on a waitpoint - but nothing suspends: waitpoints, run.pause and generateResumeUrl all throw, so there is no suspended state to bound.\"\n maxSuspensionDays: Int!\n \"ENFORCED. The fallback for a step with no retry of its own.\"\n defaultRetry: RetryPolicy!\n \"ENFORCED. What happens to a run whose steps have all failed terminally: PARK takes the trigger out of the supervisor's ENABLED set until the workflow is re-published or re-enabled, NOTIFY logs at error level (the only notification channel this engine has), IGNORE does nothing.\"\n onFailure: FailureMode!\n \"NOT YET ENFORCED per workflow. Retention is a journal-wide sweep on the relational handle, which has no reactor read to resolve a per-workflow window with; PH_WORKFLOWS_RUN_RETENTION_DAYS (30 days by default) is the control that applies.\"\n retainRunsDays: Int!\n \"NOT YET ENFORCED. The run journal is relational; there is no run document model to write.\"\n journalAsDocument: Boolean!\n}\n\n\"Snapshot of the draft taken by PUBLISH_WORKFLOW.\"\ntype PublishedWorkflow {\n \"Draft version the snapshot was taken at.\"\n version: Int!\n publishedAt: DateTime!\n trigger: TriggerBinding\n steps: [WorkflowStep!]!\n edges: [WorkflowEdge!]!\n variables: [WorkflowVariable!]!\n policy: WorkflowPolicy!\n}\n\ntype WorkflowState {\n name: String!\n description: String\n \"Only ENABLED workflows get trigger instances.\"\n status: WorkflowStatus!\n \"Bumped on every draft edit; REVERT_TO_PUBLISHED resets it to published.version. A run records the version it executed.\"\n version: Int!\n trigger: TriggerBinding\n steps: [WorkflowStep!]!\n edges: [WorkflowEdge!]!\n variables: [WorkflowVariable!]!\n policy: WorkflowPolicy!\n \"Last published snapshot; version !== published.version means unpublished changes.\"\n published: PublishedWorkflow\n \"Denormalised for inspectors; written by the runtime.\"\n lastRunAt: DateTime\n lastRunStatus: RunStatus\n}",
|
|
541
|
+
schema: "enum WorkflowStatus {\n DRAFT\n ENABLED\n DISABLED\n ARCHIVED\n}\n\nenum RunStatus {\n PENDING\n RUNNING\n WAITING\n SUCCEEDED\n FAILED\n CANCELLED\n PARKED\n}\n\nenum ConcurrencyMode {\n SINGLETON\n QUEUE\n PARALLEL\n}\n\nenum FailureMode {\n PARK\n NOTIFY\n IGNORE\n}\n\nenum BackoffKind {\n FIXED\n EXPONENTIAL\n}\n\ntype RetryPolicy {\n \"Attempts, not retries: 1 is no retry. Clamped to 10 by the runtime, since each attempt re-runs a side effect and holds the run's worker slot.\"\n maxAttempts: Int!\n backoff: BackoffKind!\n initialDelaySeconds: Int!\n maxDelaySeconds: Int!\n \"Error classes that are retryable, matched against the error's class name or anywhere in its message, case-insensitively. EMPTY admits every error: an empty list with maxAttempts > 1 means retry, not never-retry.\"\n retryOn: [String!]!\n}\n\nenum PropertyMode {\n \"The field's own control.\"\n MANUAL\n \"The author switched the field to a free {{…}} expression.\"\n EXPRESSION\n}\n\ntype PropertySetting {\n prop: String!\n mode: PropertyMode!\n \"Resolved DynamicProperties children, options stripped.\"\n schema: Unknown\n}\n\n\"Reference to the latest test run in the run store.\"\ntype StepTestRecord {\n runId: String!\n testedAt: DateTime!\n}\n\n\"Layout only. The runtime ignores it.\"\ntype Point {\n x: Float!\n y: Float!\n}\n\ntype TriggerBinding {\n id: OID!\n \"Package name of the trigger's piece, e.g. '@powerhousedao/piece-core' or '@acme/piece-imap'.\"\n pieceName: String!\n \"Exact semver of the piece, e.g. '1.2.0'.\"\n pieceVersion: String!\n \"Trigger name within the piece, e.g. 'schedule' or 'new_message'.\"\n triggerName: String!\n \"Connection document id, when the trigger's connector requires one.\"\n connectionId: PHID\n \"Reactor connection document id, when the trigger declares requireReactor.\"\n reactorConnectionId: PHID\n \"Validated against the trigger's configSchema.\"\n config: Unknown!\n propertySettings: [PropertySetting!]\n lastTest: StepTestRecord\n \"Timestamp of the last real edit; a lastTest before it is stale.\"\n updatedAt: DateTime\n}\n\ntype WorkflowStep {\n id: OID!\n \"Author-visible label; unique within the workflow; used in expressions.\"\n key: String!\n name: String!\n \"Package name of the step's piece, e.g. '@powerhousedao/piece-core' or '@activepieces/piece-http'.\"\n pieceName: String!\n \"Exact semver of the piece, e.g. '0.11.19'.\"\n pieceVersion: String!\n \"Action name within the piece, e.g. 'branch' or 'send_request'.\"\n actionName: String!\n connectionId: PHID\n \"Reactor connection document id, when the action declares requireReactor.\"\n reactorConnectionId: PHID\n config: Unknown!\n \"ENFORCED. Per-step override of the workflow default retry policy.\"\n retry: RetryPolicy\n \"ENFORCED. Also raises the cap on each host call the step's piece makes, which is never shorter than the step's own timeout.\"\n timeoutSeconds: Int\n \"NOT YET ENFORCED. Expression yielding a stable key; two executions with the same key are one side effect. A fire is deduplicated on its trigger operation or a trigger item's _dedupe_key, never on a step expression.\"\n idempotencyKeyExpression: String\n position: Point\n propertySettings: [PropertySetting!]\n lastTest: StepTestRecord\n \"Skipped steps are passed over at run time.\"\n skip: Boolean\n \"Timestamp of the last real edit; a lastTest before it is stale.\"\n updatedAt: DateTime\n}\n\ntype WorkflowEdge {\n id: OID!\n \"Source step id, or the trigger id for the entry edge.\"\n from: OID!\n to: OID!\n \"Output port of the source, one it declares: 'next' and 'error' for a piece action, 'next' for the trigger, 'true', 'false' and 'error' for a branch.\"\n port: String!\n \"Optional guard expression; the edge is taken only when it evaluates truthy.\"\n condition: String\n}\n\nenum VariableType {\n TEXT\n NUMBER\n BOOLEAN\n JSON\n \"value is a secret-provider handle (the format of a connection SecretRef.ref), never the plaintext.\"\n SECRET\n}\n\ntype WorkflowVariable {\n id: OID!\n \"Name used in expressions.\"\n key: String!\n \"The value a run reads as variables.<key>.\"\n value: Unknown\n description: String\n \"Null means untyped; consumers infer the kind of value it holds.\"\n type: VariableType\n}\n\ntype WorkflowPolicy {\n \"ENFORCED. SINGLETON drops a firing while a run is active (journaled CANCELLED, not dropped silently); QUEUE serialises; PARALLEL runs concurrently.\"\n concurrency: ConcurrencyMode!\n \"ENFORCED under PARALLEL: how many runs of this workflow may execute at once; null is unbounded. SINGLETON and QUEUE are 1 by definition.\"\n maxParallelRuns: Int\n \"ENFORCED. Checked between steps and while a retry waits; past it the run ends CANCELLED.\"\n runTimeoutSeconds: Int!\n \"NOT YET ENFORCED. Bounds how long a run may stay suspended on a waitpoint - but nothing suspends: waitpoints, run.pause and generateResumeUrl all throw, so there is no suspended state to bound.\"\n maxSuspensionDays: Int!\n \"ENFORCED. The fallback for a step with no retry of its own.\"\n defaultRetry: RetryPolicy!\n \"ENFORCED. What happens to a run whose steps have all failed terminally: PARK takes the trigger out of the supervisor's ENABLED set until the workflow is re-published or re-enabled, NOTIFY logs at error level (the only notification channel this engine has), IGNORE does nothing.\"\n onFailure: FailureMode!\n \"NOT YET ENFORCED per workflow. Retention is a journal-wide sweep on the relational handle, which has no reactor read to resolve a per-workflow window with; PH_WORKFLOWS_RUN_RETENTION_DAYS (30 days by default) is the control that applies.\"\n retainRunsDays: Int!\n \"NOT YET ENFORCED. The run journal is relational; there is no run document model to write.\"\n journalAsDocument: Boolean!\n}\n\n\"Snapshot of the draft taken by PUBLISH_WORKFLOW.\"\ntype PublishedWorkflow {\n \"Draft version the snapshot was taken at.\"\n version: Int!\n publishedAt: DateTime!\n trigger: TriggerBinding\n steps: [WorkflowStep!]!\n edges: [WorkflowEdge!]!\n variables: [WorkflowVariable!]!\n policy: WorkflowPolicy!\n}\n\ntype WorkflowState {\n name: String!\n description: String\n \"Only ENABLED workflows get trigger instances.\"\n status: WorkflowStatus!\n \"Bumped on every draft edit; REVERT_TO_PUBLISHED resets it to published.version. A run records the version it executed.\"\n version: Int!\n trigger: TriggerBinding\n steps: [WorkflowStep!]!\n edges: [WorkflowEdge!]!\n variables: [WorkflowVariable!]!\n policy: WorkflowPolicy!\n \"Last published snapshot; version !== published.version means unpublished changes.\"\n published: PublishedWorkflow\n \"Who keeps this workflow as it is, e.g. an app's integration; null: people edit it. Editors show a managed workflow read-only.\"\n managedBy: WorkflowManager\n \"Denormalised for inspectors; written by the runtime.\"\n lastRunAt: DateTime\n lastRunStatus: RunStatus\n}\n\n\"What manages a workflow: the document that defines it, and how to name it to a person.\"\ntype WorkflowManager {\n documentId: PHID!\n \"e.g. sektar/integration\"\n documentType: String!\n \"e.g. Powerhouse - Google Calendar\"\n label: String!\n}\n",
|
|
524
542
|
examples: [],
|
|
525
|
-
initialValue: "{\n
|
|
543
|
+
initialValue: "{\n \"name\": \"\",\n \"description\": null,\n \"status\": \"DRAFT\",\n \"version\": 0,\n \"trigger\": null,\n \"steps\": [],\n \"edges\": [],\n \"variables\": [],\n \"policy\": {\n \"concurrency\": \"QUEUE\",\n \"maxParallelRuns\": null,\n \"runTimeoutSeconds\": 3600,\n \"maxSuspensionDays\": 30,\n \"defaultRetry\": {\n \"maxAttempts\": 1,\n \"backoff\": \"FIXED\",\n \"initialDelaySeconds\": 5,\n \"maxDelaySeconds\": 300,\n \"retryOn\": []\n },\n \"onFailure\": \"PARK\",\n \"retainRunsDays\": 30,\n \"journalAsDocument\": false\n },\n \"published\": null,\n \"lastRunAt\": null,\n \"lastRunStatus\": null,\n \"managedBy\": null\n}"
|
|
526
544
|
}
|
|
527
545
|
},
|
|
528
546
|
modules: [
|
|
@@ -569,6 +587,17 @@ const documentModel = {
|
|
|
569
587
|
}],
|
|
570
588
|
examples: [],
|
|
571
589
|
scope: "global"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
id: "28cad19f-be13-4f42-81fa-fdb8d0d00f47",
|
|
593
|
+
name: "SET_MANAGED_BY",
|
|
594
|
+
description: "Marks the workflow as kept by another document (an app's integration), or clears that with no documentId. Not a draft edit: the version stays.",
|
|
595
|
+
schema: "input SetManagedByInput {\n \"The managing document; omit to clear\"\n documentId: PHID\n documentType: String\n label: String\n}",
|
|
596
|
+
template: "Marks who manages the workflow.",
|
|
597
|
+
reducer: "const i = action.input;\nstate.managedBy = i.documentId\n ? { documentId: i.documentId, documentType: i.documentType ?? \"\", label: i.label ?? \"\" }\n : null;",
|
|
598
|
+
errors: [],
|
|
599
|
+
examples: [],
|
|
600
|
+
scope: "global"
|
|
572
601
|
}
|
|
573
602
|
]
|
|
574
603
|
},
|
|
@@ -1502,6 +1531,14 @@ const workflowWorkflowOperations = {
|
|
|
1502
1531
|
setWorkflowStatusOperation(state, action) {
|
|
1503
1532
|
if (action.input.status === "ENABLED" && !state.published) throw new WorkflowNotPublishedError("Publish the workflow before enabling it");
|
|
1504
1533
|
state.status = action.input.status;
|
|
1534
|
+
},
|
|
1535
|
+
setManagedByOperation(state, action) {
|
|
1536
|
+
const i = action.input;
|
|
1537
|
+
state.managedBy = i.documentId ? {
|
|
1538
|
+
documentId: i.documentId,
|
|
1539
|
+
documentType: i.documentType ?? "",
|
|
1540
|
+
label: i.label ?? ""
|
|
1541
|
+
} : null;
|
|
1505
1542
|
}
|
|
1506
1543
|
};
|
|
1507
1544
|
//#endregion
|
|
@@ -1530,6 +1567,10 @@ const stateReducer = (state, action, dispatch) => {
|
|
|
1530
1567
|
memoizedSchema(SetWorkflowStatusInputSchema).parse(action.input);
|
|
1531
1568
|
workflowWorkflowOperations.setWorkflowStatusOperation(state[action.scope], action, dispatch);
|
|
1532
1569
|
break;
|
|
1570
|
+
case "SET_MANAGED_BY":
|
|
1571
|
+
memoizedSchema(SetManagedByInputSchema).parse(action.input);
|
|
1572
|
+
workflowWorkflowOperations.setManagedByOperation(state[action.scope], action, dispatch);
|
|
1573
|
+
break;
|
|
1533
1574
|
case "SET_TRIGGER":
|
|
1534
1575
|
memoizedSchema(SetTriggerInputSchema).parse(action.input);
|
|
1535
1576
|
workflowTriggerOperations.setTriggerOperation(state[action.scope], action, dispatch);
|
|
@@ -1685,7 +1726,8 @@ const initialGlobalState = {
|
|
|
1685
1726
|
},
|
|
1686
1727
|
published: null,
|
|
1687
1728
|
lastRunAt: null,
|
|
1688
|
-
lastRunStatus: null
|
|
1729
|
+
lastRunStatus: null,
|
|
1730
|
+
managedBy: null
|
|
1689
1731
|
};
|
|
1690
1732
|
const initialLocalState = {};
|
|
1691
1733
|
const utils$1 = {
|
|
@@ -1752,6 +1794,6 @@ const Workflow = {
|
|
|
1752
1794
|
documentModel: createState(defaultBaseState(), documentModel)
|
|
1753
1795
|
};
|
|
1754
1796
|
//#endregion
|
|
1755
|
-
export {
|
|
1797
|
+
export { AddStepPropertySettingInputSchema as $, setTrigger as A, SetWorkflowDescriptionInputSchema as At, setLastRun as B, WorkflowManagerSchema as Bt, setWorkflowName as C, SetTriggerConfigInputSchema as Ct, setVariable as D, SetTriggerPieceVersionInputSchema as Dt, removeVariable as E, SetTriggerInputSchema as Et, creators_exports$3 as F, UpdateStepInputSchema as Ft, creators_exports$6 as G, WorkflowVariableSchema as Gt, creators_exports$5 as H, WorkflowStateSchema as Ht, removeStep as I, UpdateStepPositionInputSchema as It, creators_exports$7 as J, setPolicy as K, definedNonNullAnySchema as Kt, setStepConfig as L, UpdateStepRetryPolicyInputSchema as Lt, setTriggerConnection as M, SetWorkflowStatusInputSchema as Mt, setTriggerPieceVersion as N, StepTestRecordSchema as Nt, clearTrigger as O, SetTriggerPropertySettingInputSchema as Ot, addStep as P, TriggerBindingSchema as Pt, AddStepPositionInputSchema as Q, updateStep as R, VariableTypeSchema as Rt, setWorkflowDescription as S, SetStepConfigPropertySettingInputSchema as St, creators_exports$1 as T, SetTriggerConnectionInputSchema as Tt, publishWorkflow as U, WorkflowStatusSchema as Ut, setLastTest as V, WorkflowPolicySchema as Vt, revertToPublished as W, WorkflowStepSchema as Wt, AddEdgeInputSchema as X, removeEdge as Y, AddStepInputSchema as Z, reducer as _, SetLastTestInputSchema as _t, utils$1 as a, PointSchema as at, creators_exports as b, SetPolicyRetryPolicyInputSchema as bt, WorkflowPHStateSchema as c, PublishWorkflowInputSchema as ct, isWorkflowDocument as d, RemoveStepInputSchema as dt, AddStepRetryPolicyInputSchema as et, isWorkflowState as f, RemoveVariableInputSchema as ft, supportedVersions as g, SetLastRunInputSchema as gt, latestVersion as h, RunStatusSchema as ht, initialLocalState as i, FailureModeSchema as it, setTriggerConfig as j, SetWorkflowNameInputSchema as jt, creators_exports$2 as k, SetVariableInputSchema as kt, assertIsWorkflowDocument as l, PublishedWorkflowSchema as lt, workflowUpgradeManifest as m, RevertToPublishedInputSchema as mt, utils as n, ClearTriggerInputSchema as nt, WorkflowDocumentHeaderSchema as o, PropertyModeSchema as ot, workflowDocumentType as p, RetryPolicySchema as pt, addEdge as q, isDefinedNonNullAny as qt, initialGlobalState as r, ConcurrencyModeSchema as rt, WorkflowDocumentSchema as s, PropertySettingSchema as st, Workflow as t, BackoffKindSchema as tt, assertIsWorkflowState as u, RemoveEdgeInputSchema as ut, documentModel as v, SetManagedByInputSchema as vt, setWorkflowStatus as w, SetTriggerConfigPropertySettingInputSchema as wt, setManagedBy as x, SetStepConfigInputSchema as xt, actions as y, SetPolicyInputSchema as yt, creators_exports$4 as z, WorkflowEdgeSchema as zt };
|
|
1756
1798
|
|
|
1757
|
-
//# sourceMappingURL=module-
|
|
1799
|
+
//# sourceMappingURL=module-eOpxJVIl.js.map
|