@powerhousedao/workflow 6.2.3-dev.44 → 6.2.3-dev.45
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-C-C56Wcf.js → BlockSelector-B41mSc0W.js} +431 -411
- package/dist/browser/BlockSelector-B41mSc0W.js.map +1 -0
- package/dist/browser/assets/{entry-KqlcH_wb.js → entry-CtB3hwiW.js} +99 -3
- package/dist/browser/assets/{projection-entry-CumnZXAR.js → projection-entry-Cd33KgnS.js} +2 -3
- package/dist/browser/{connection-BUum0hJI.js → connection-BP17lpt3.js} +2 -2
- package/dist/browser/{connection-BUum0hJI.js.map → connection-BP17lpt3.js.map} +1 -1
- package/dist/browser/{connection-form-C9iDnI6H.js → connection-form-CkRzKggD.js} +524 -13
- package/dist/browser/connection-form-CkRzKggD.js.map +1 -0
- package/dist/browser/{data-tree-B4W7ZUmG.js → data-tree-BugZMgLk.js} +2 -2
- package/dist/browser/{data-tree-B4W7ZUmG.js.map → data-tree-BugZMgLk.js.map} +1 -1
- package/dist/browser/document-models/connection/index.js +3 -3
- package/dist/browser/document-models/index.js +3 -3
- package/dist/browser/document-models/workflow/index.js +2 -2
- package/dist/browser/{document-models-C1ZgIZyV.js → document-models-B7IwLbfO.js} +3 -3
- package/dist/browser/{document-models-C1ZgIZyV.js.map → document-models-B7IwLbfO.js.map} +1 -1
- package/dist/browser/{editor-cEmJfc9W.js → editor-9eSmoDTm.js} +331 -39
- package/dist/browser/editor-9eSmoDTm.js.map +1 -0
- package/dist/browser/{editor-4BJf6hN7.js → editor-DvK4LPwF.js} +7 -10
- package/dist/browser/editor-DvK4LPwF.js.map +1 -0
- package/dist/browser/{editor-Crt3ZeGd.js → editor-ldDYxtLV.js} +166 -43
- package/dist/browser/editor-ldDYxtLV.js.map +1 -0
- package/dist/browser/editors/connection-editor/module.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/graphql-Cr1ia6fo.js +2474 -0
- package/dist/browser/graphql-Cr1ia6fo.js.map +1 -0
- package/dist/browser/index.js +9 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{module-jDZ4pq3W.js → module-B2BMwu5E.js} +129 -17
- package/dist/browser/module-B2BMwu5E.js.map +1 -0
- package/dist/browser/{module-DU2vb3FH.js → module-D4UiG9ii.js} +13 -5
- package/dist/browser/module-D4UiG9ii.js.map +1 -0
- package/dist/browser/reactor/index.js +2 -2
- package/dist/browser/{runtime-queries-Ds2kk-Ow.js → runtime-queries-IZG_nonR.js} +85 -11
- package/dist/browser/runtime-queries-IZG_nonR.js.map +1 -0
- package/dist/browser/{trigger-text-5CT870cu.js → trigger-text-C37YRggR.js} +142 -20
- package/dist/browser/trigger-text-C37YRggR.js.map +1 -0
- package/dist/browser/upgrade-manifests-C_9cyumV.js +8 -0
- package/dist/browser/{upgrade-manifests-BpakVE9l.js.map → upgrade-manifests-C_9cyumV.js.map} +1 -1
- package/dist/browser/{workflow-BxShRhVy.js → workflow-DFLQ2cFr.js} +2 -2
- package/dist/browser/{workflow-BxShRhVy.js.map → workflow-DFLQ2cFr.js.map} +1 -1
- package/dist/node/{BlockSelector-C9_1wbx4.mjs → BlockSelector-BMnBzXcA.mjs} +431 -411
- package/dist/node/BlockSelector-BMnBzXcA.mjs.map +1 -0
- package/dist/node/{connection-D544oqVW.mjs → connection-BxJoL8js.mjs} +2 -2
- package/dist/node/{connection-D544oqVW.mjs.map → connection-BxJoL8js.mjs.map} +1 -1
- package/dist/node/{connection-form-DUOXUqBz.mjs → connection-form-DZFudcoD.mjs} +524 -13
- package/dist/node/connection-form-DZFudcoD.mjs.map +1 -0
- package/dist/node/{data-tree-CoV-swZZ.mjs → data-tree-CR8IOshA.mjs} +2 -2
- package/dist/node/{data-tree-CoV-swZZ.mjs.map → data-tree-CR8IOshA.mjs.map} +1 -1
- package/dist/node/document-models/connection/index.mjs +3 -3
- package/dist/node/document-models/index.mjs +3 -3
- package/dist/node/document-models/workflow/index.mjs +2 -2
- package/dist/node/{editor-BFDE4Q3v.mjs → editor-BV5CYmUI.mjs} +7 -10
- package/dist/node/editor-BV5CYmUI.mjs.map +1 -0
- package/dist/node/{editor-D2jRtRNl.mjs → editor-D_P9-st9.mjs} +166 -43
- package/dist/node/editor-D_P9-st9.mjs.map +1 -0
- package/dist/node/{editor-BwOQIwVw.mjs → editor-NUaiiO4B.mjs} +331 -39
- package/dist/node/editor-NUaiiO4B.mjs.map +1 -0
- package/dist/node/editors/connection-editor/module.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/graphql-BGVLRhC1.mjs +14554 -0
- package/dist/node/graphql-BGVLRhC1.mjs.map +1 -0
- package/dist/node/index.mjs +9 -6
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{module-BMwJQh65.mjs → module-BlT-atBQ.mjs} +129 -17
- package/dist/node/module-BlT-atBQ.mjs.map +1 -0
- package/dist/node/{module-Dhe5E-VA.mjs → module-BsqRZox1.mjs} +13 -5
- package/dist/node/module-BsqRZox1.mjs.map +1 -0
- package/dist/node/pieces/reactor/descriptor.json +34 -17
- package/dist/node/pieces/reactor/index.mjs +67 -67
- package/dist/node/pieces/reactor/package.json +1 -1
- package/dist/node/{runtime-queries-D5EGaCrH.mjs → runtime-queries-BM6I7dDA.mjs} +85 -11
- package/dist/node/runtime-queries-BM6I7dDA.mjs.map +1 -0
- package/dist/node/{trigger-text-CXnnanWC.mjs → trigger-text-78ZhfT-b.mjs} +142 -20
- package/dist/node/trigger-text-78ZhfT-b.mjs.map +1 -0
- package/dist/node/upgrade-manifests-CYZfts3a.mjs +8 -0
- package/dist/node/{upgrade-manifests-CmNd742Y.mjs.map → upgrade-manifests-CYZfts3a.mjs.map} +1 -1
- package/dist/node/{workflow-CGzYGZnr.mjs → workflow-BpfdBHyS.mjs} +2 -2
- package/dist/node/{workflow-CGzYGZnr.mjs.map → workflow-BpfdBHyS.mjs.map} +1 -1
- package/dist/powerhouse.manifest.json +1 -1
- package/dist/style.css +44 -0
- package/dist/types/ai/workflow-tools.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/config/error.d.ts +15 -1
- package/dist/types/document-models/connection/v1/gen/config/error.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/connection/error.d.ts +13 -1
- package/dist/types/document-models/connection/v1/gen/connection/error.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/document-model.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/reducer.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/schema/types.d.ts +11 -2
- package/dist/types/document-models/connection/v1/gen/schema/types.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts +3 -1
- package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts +17 -0
- package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts.map +1 -0
- package/dist/types/document-models/connection/v1/src/reducers/config.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/src/reducers/connection.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/src/utils.d.ts +1 -1
- package/dist/types/document-models/connection/v1/src/utils.d.ts.map +1 -1
- package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts +2 -0
- package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts.map +1 -0
- package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +7 -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.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
- package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts +2 -0
- package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts +1 -1
- package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/ReactorBindings.d.ts +6 -0
- package/dist/types/editors/connection-editor/ReactorBindings.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts +7 -0
- package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts.map +1 -0
- package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/connection-form.d.ts +4 -1
- package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/connection-usage.d.ts +13 -3
- package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
- package/dist/types/editors/shared/data-viewer.d.ts.map +1 -1
- package/dist/types/editors/shared/document-ref.d.ts +5 -0
- package/dist/types/editors/shared/document-ref.d.ts.map +1 -0
- 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/reactor-hooks.d.ts +25 -0
- package/dist/types/editors/workflow-editor/reactor-hooks.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +16 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-persist.d.ts +1 -1
- package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +3 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +13 -0
- package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts +9 -0
- package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts +6 -0
- package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/StepError.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/StepError.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/design-time.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/document-options.d.ts +24 -0
- package/dist/types/editors/workflow-editor/ui/document-options.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/document-shape.d.ts +8 -0
- package/dist/types/editors/workflow-editor/ui/document-shape.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/forms.d.ts +5 -1
- package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/model.d.ts +14 -0
- package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +6 -3
- package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts +43 -0
- package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts +25 -0
- package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/use-validity.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/validation.d.ts +3 -1
- package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunsTable.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 -3
- 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 +2 -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 +3 -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 +2 -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 +2 -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 +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/documents.d.ts +32 -0
- package/dist/types/pieces/reactor/lib/documents.d.ts.map +1 -0
- package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/reactor.d.ts +15 -4
- package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts +6 -6
- package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts.map +1 -1
- package/dist/types/pieces/reactor/reactor.test.d.ts +2 -0
- package/dist/types/pieces/reactor/reactor.test.d.ts.map +1 -0
- package/dist/types/pieces/reactor/test-signer.d.ts +3 -0
- package/dist/types/pieces/reactor/test-signer.d.ts.map +1 -0
- package/dist/types/scripts/ui-stack.d.ts +4 -1
- package/dist/types/scripts/ui-stack.d.ts.map +1 -1
- package/dist/types/test/ui/reactor-connection.spec.d.ts +2 -0
- package/dist/types/test/ui/reactor-connection.spec.d.ts.map +1 -0
- package/package.json +8 -8
- package/dist/browser/BlockSelector-C-C56Wcf.js.map +0 -1
- package/dist/browser/connection-form-C9iDnI6H.js.map +0 -1
- package/dist/browser/editor-4BJf6hN7.js.map +0 -1
- package/dist/browser/editor-Crt3ZeGd.js.map +0 -1
- package/dist/browser/editor-cEmJfc9W.js.map +0 -1
- package/dist/browser/module-DU2vb3FH.js.map +0 -1
- package/dist/browser/module-jDZ4pq3W.js.map +0 -1
- package/dist/browser/runtime-queries-Ds2kk-Ow.js.map +0 -1
- package/dist/browser/trigger-text-5CT870cu.js.map +0 -1
- package/dist/browser/upgrade-manifests-BpakVE9l.js +0 -8
- package/dist/node/BlockSelector-C9_1wbx4.mjs.map +0 -1
- package/dist/node/connection-form-DUOXUqBz.mjs.map +0 -1
- package/dist/node/editor-BFDE4Q3v.mjs.map +0 -1
- package/dist/node/editor-BwOQIwVw.mjs.map +0 -1
- package/dist/node/editor-D2jRtRNl.mjs.map +0 -1
- package/dist/node/module-BMwJQh65.mjs.map +0 -1
- package/dist/node/module-Dhe5E-VA.mjs.map +0 -1
- package/dist/node/runtime-queries-D5EGaCrH.mjs.map +0 -1
- package/dist/node/trigger-text-CXnnanWC.mjs.map +0 -1
- package/dist/node/upgrade-manifests-CmNd742Y.mjs +0 -8
- package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts +0 -2
- package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts.map +0 -1
package/dist/node/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as isConfigValueMissing, c as planFromAuth, o as packageFromConnectorId, r as connectorIdForPiece } from "./piece-auth-BS5CtQOG.mjs";
|
|
2
|
-
import { H as createRuntimeClient, K as CORE_PIECE, V as DEFAULT_RUNTIME_URL,
|
|
3
|
-
import { t as Workflow } from "./module-
|
|
4
|
-
import { t as Connection } from "./module-
|
|
5
|
-
import { t as upgradeManifests } from "./upgrade-manifests-
|
|
2
|
+
import { H as createRuntimeClient, J as REACTOR_PIECE, K as CORE_PIECE, V as DEFAULT_RUNTIME_URL, ft as flowPorts, n as catalogQuery, r as createRuntimeQueryClient, t as blockFormQuery } from "./runtime-queries-BM6I7dDA.mjs";
|
|
3
|
+
import { t as Workflow } from "./module-BsqRZox1.mjs";
|
|
4
|
+
import { A as REACTOR_CONNECTOR_ID, t as Connection } from "./module-BlT-atBQ.mjs";
|
|
5
|
+
import { t as upgradeManifests } from "./upgrade-manifests-CYZfts3a.mjs";
|
|
6
6
|
import { ConnectionEditor } from "./editors/connection-editor/module.mjs";
|
|
7
7
|
import { WorkflowEditor } from "./editors/workflow-editor/module.mjs";
|
|
8
8
|
import { WorkflowStudio } from "./editors/workflow-studio/module.mjs";
|
|
@@ -157,6 +157,7 @@ const EXPRESSIONS = [
|
|
|
157
157
|
"Step configs and edge conditions may contain expressions in double braces.",
|
|
158
158
|
"{{trigger.payload.<field>}} reads the trigger payload: for the core manual trigger the payload passed to fireWorkflow; for the reactor piece's document triggers it carries documentId, documentType, driveId and name.",
|
|
159
159
|
"{{steps.<key>.output.<path>}} reads an upstream step's output by that step's key, e.g. {{steps.fetch.output.body.title}}.",
|
|
160
|
+
"The reactor piece's document-create and document-dispatch output a reference { documentId, documentType, branch, revision }, e.g. {{steps.create.output.documentId}}; read the document with document-get to use its state. document-get outputs the document as { header, state }, e.g. {{steps.get.output.state.global.name}} or {{steps.get.output.header.id}}. document-find outputs { results, nextCursor }: each result has a header (and state with includeState), and nextCursor, present while more match, goes in a later find's cursor.",
|
|
160
161
|
"{{variables.<key>}} reads a workflow variable.",
|
|
161
162
|
"'a' || 'b' picks the first non-empty value, e.g. {{trigger.payload.url || 'https://example.com'}}.",
|
|
162
163
|
"A whole-string expression yields the raw value; text around expressions is interpolated."
|
|
@@ -167,6 +168,7 @@ const GRAPH_RULES = [
|
|
|
167
168
|
"A step names its block with pieceName, pieceVersion and actionName; the trigger with pieceName, pieceVersion and triggerName. pieceVersion is an exact semver: copy the fields getWorkflowPieceBlocks or listWorkflowCoreBlocks return.",
|
|
168
169
|
`The built-in blocks (manual, schedule and webhook triggers, branch and assert) belong to the piece ${CORE_PIECE}.`,
|
|
169
170
|
"Steps whose piece needs a connection must set connectionId to a powerhouse/connection document id (see getConnections).",
|
|
171
|
+
`Every step and trigger whose block reports requireReactor (getWorkflowBlockConfig) must set reactorConnectionId to a powerhouse/connection document with authType REACTOR and connectorId ${REACTOR_CONNECTOR_ID} (see getConnections); the ${REACTOR_PIECE} blocks all do. Without one the block gets no reactor access and fails. The connection's config { endpoint: "local", access?: "read", filter?: { documentType?, documentId?, driveId?, actionType? } } limits which documents it reads and writes. connectionId stays for credentials; a document block normally needs none.`,
|
|
170
172
|
"Runs execute the published snapshot, not the draft. PUBLISH_WORKFLOW only snapshots the draft, so publish again after every edit that should run.",
|
|
171
173
|
"Only ENABLED workflows get trigger instances and can be fired. PUBLISH_WORKFLOW does not enable: to turn a workflow on, dispatch SET_WORKFLOW_STATUS ENABLED after PUBLISH_WORKFLOW (the same batch works). SET_WORKFLOW_STATUS ENABLED is refused until the workflow has been published once."
|
|
172
174
|
];
|
|
@@ -205,7 +207,7 @@ const workflowTools = [
|
|
|
205
207
|
},
|
|
206
208
|
{
|
|
207
209
|
name: "getWorkflowBlockConfig",
|
|
208
|
-
description: "Describes the config of one block (a core block or a piece's action or trigger): prop names, types, whether required, allowed options, the output ports,
|
|
210
|
+
description: "Describes the config of one block (a core block or a piece's action or trigger): prop names, types, whether required, allowed options, the output ports, whether a connection is needed, and requireReactor (read | write) when it needs a reactor connection. Use it before writing a step or trigger config.",
|
|
209
211
|
inputSchema: {
|
|
210
212
|
pieceName: z.string().describe(`Piece package name, e.g. ${CORE_PIECE} or @activepieces/piece-http.`),
|
|
211
213
|
pieceVersion: z.string().describe("Exact semver of the piece."),
|
|
@@ -234,6 +236,7 @@ const workflowTools = [
|
|
|
234
236
|
title: form.title,
|
|
235
237
|
kind: kindOf(block),
|
|
236
238
|
requiresConnection: form.auth === "required",
|
|
239
|
+
requireReactor: form.requireReactor ?? null,
|
|
237
240
|
props: form.props.map(describeProp),
|
|
238
241
|
ports: portsFor(form)
|
|
239
242
|
};
|
|
@@ -440,7 +443,7 @@ const aiTools = [
|
|
|
440
443
|
},
|
|
441
444
|
{
|
|
442
445
|
name: "getConnections",
|
|
443
|
-
description: "Lists the project's connection documents with their credential status: which required secrets and config values are still missing, and the last account label. Secret values are never included.",
|
|
446
|
+
description: "Lists the project's connection documents with their credential status: which required secrets and config values are still missing, and the last account label. Secret values are never included. A connection with authType REACTOR is bound through a step's or trigger's reactorConnectionId, never connectionId.",
|
|
444
447
|
inputSchema: {},
|
|
445
448
|
annotations: {
|
|
446
449
|
title: "Get Connections",
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["READ_ONLY","runConnectionCheck","ConnectionV1","WorkflowV1","manifestJson"],"sources":["../../powerhouse.manifest.json","../../editors/workflow-editor/runtime-api.ts","../../ai/runtime-url.ts","../../ai/workflow-tools.ts","../../ai/tools.ts","../../document-models/document-models.ts","../../editors/editors.ts","../../index.ts"],"sourcesContent":["","// Ambient runtime client for the AI tools, which run outside any editor.\n// Editors never import this: each one gets its own client from RuntimeProvider.\nimport type { BlockRef } from \"@powerhousedao/pieces-framework/block-type\";\nimport {\n createRuntimeClient,\n DEFAULT_RUNTIME_URL,\n type RunsScope,\n type RuntimeClient,\n} from \"./runtime-client.js\";\nimport {\n blockFormQuery,\n catalogQuery,\n createRuntimeQueryClient,\n} from \"./runtime-queries.js\";\n\nexport type * from \"./runtime-client.js\";\nexport { DEFAULT_RUNTIME_URL };\n\nlet ambient: RuntimeClient = createRuntimeClient(DEFAULT_RUNTIME_URL);\n// Keys start with the URL, so switching runtimes needs no cache reset.\nconst ambientQueries = createRuntimeQueryClient();\n\nexport function setRuntimeUrl(url: string): void {\n if (url !== ambient.url) ambient = createRuntimeClient(url);\n}\n\nexport const getBlockForm = (block: BlockRef) =>\n ambientQueries.fetchQuery(blockFormQuery(ambient, block));\nexport const fetchPieceCatalog = () =>\n ambientQueries.fetchQuery(catalogQuery(ambient));\nexport const fetchPieceActions = (packageName: string) =>\n ambient.fetchPieceActions(packageName);\nexport const fetchPieceTriggers = (packageName: string) =>\n ambient.fetchPieceTriggers(packageName);\nexport const fetchConnections = () => ambient.fetchConnections();\nexport const checkConnection = (connectionId: string) =>\n ambient.checkConnection(connectionId);\nexport const fetchRuns = (scope?: RunsScope) => ambient.fetchRuns(scope);\nexport const fireWorkflow = (workflowId: string, payload?: unknown) =>\n ambient.fireWorkflow(workflowId, payload);\n","// Points the module-level runtime client at the selected drive's\n// workflow-runtime subgraph before an AI tool talks to it.\nimport { resolveDriveSwitchboard } from \"@powerhousedao/reactor-browser/ai\";\nimport {\n DEFAULT_RUNTIME_URL,\n setRuntimeUrl,\n} from \"../editors/workflow-editor/runtime-api.js\";\n\nexport function syncRuntimeUrl(): void {\n if (typeof window === \"undefined\") return;\n const switchboard = resolveDriveSwitchboard(window.ph?.selectedDriveId);\n // No resolvable switchboard (no selection, or a local/unsynced drive):\n // reset to the default rather than leaving a prior drive's URL attached.\n setRuntimeUrl(\n switchboard\n ? `${switchboard.graphqlUrl}/workflow-runtime`\n : DEFAULT_RUNTIME_URL,\n );\n}\n","// AI tool descriptors for authoring and running workflows: the pinned blocks\n// a piece offers, a block's config props, the built-in core blocks with\n// the expression syntax, run history and manual firing. Complements the\n// connector/connection tools in tools.ts, which cover the catalog and auth.\nimport type { PhAiToolDescriptor } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\nimport {\n fetchPieceActions,\n fetchPieceTriggers,\n fetchRuns,\n fireWorkflow,\n getBlockForm,\n} from \"../editors/workflow-editor/runtime-api.js\";\nimport type { BlockFormProp } from \"../editors/workflow-editor/ui/forms.js\";\nimport {\n CORE_PIECE,\n type BlockRef,\n} from \"../editors/workflow-editor/ui/blocks.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\nimport { flowPorts } from \"@powerhousedao/pieces-framework/workflow\";\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nfunction kindOf(block: BlockRef): \"trigger\" | \"step\" {\n return block.kind === \"trigger\" ? \"trigger\" : \"step\";\n}\n\n// The fields ADD_STEP or SET_TRIGGER takes for the block.\nfunction blockFields(block: BlockRef) {\n return {\n pieceName: block.pieceName,\n pieceVersion: block.pieceVersion,\n ...(block.kind === \"trigger\"\n ? { triggerName: block.name }\n : { actionName: block.name }),\n };\n}\n\n// The onward ports the block's descriptor declares; \"error\" is a failure route.\nfunction portsFor(form: { ports?: readonly string[] }): string[] {\n return flowPorts(form.ports ?? []);\n}\n\nfunction describeProp(prop: BlockFormProp) {\n return {\n name: prop.name,\n label: prop.displayName,\n type: prop.type,\n required: prop.required,\n ...(prop.description ? { description: prop.description } : {}),\n ...(prop.defaultValue !== undefined ? { default: prop.defaultValue } : {}),\n ...(prop.staticOptions\n ? { options: prop.staticOptions.map((option) => option.value) }\n : {}),\n ...(prop.hasDynamicResolver ? { dynamicOptions: true } : {}),\n };\n}\n\nconst EXPRESSIONS = [\n \"Step configs and edge conditions may contain expressions in double braces.\",\n \"{{trigger.payload.<field>}} reads the trigger payload: for the core manual trigger the payload passed to fireWorkflow; for the reactor piece's document triggers it carries documentId, documentType, driveId and name.\",\n \"{{steps.<key>.output.<path>}} reads an upstream step's output by that step's key, e.g. {{steps.fetch.output.body.title}}.\",\n \"{{variables.<key>}} reads a workflow variable.\",\n \"'a' || 'b' picks the first non-empty value, e.g. {{trigger.payload.url || 'https://example.com'}}.\",\n \"A whole-string expression yields the raw value; text around expressions is interpolated.\",\n];\n\nconst GRAPH_RULES = [\n \"A workflow is a powerhouse/workflow document. Build it with SET_TRIGGER once, ADD_STEP per step (each with a unique id and key), and ADD_EDGE from the trigger id to the first step and between steps.\",\n \"An edge must leave on a port its source declares (getWorkflowBlockConfig lists them): 'next' for the trigger and ordinary steps, 'true' and 'false' for the core branch action, 'error' to route a failure. An edge on any other port is never taken, and the run is flagged with a warning.\",\n \"A step names its block with pieceName, pieceVersion and actionName; the trigger with pieceName, pieceVersion and triggerName. pieceVersion is an exact semver: copy the fields getWorkflowPieceBlocks or listWorkflowCoreBlocks return.\",\n `The built-in blocks (manual, schedule and webhook triggers, branch and assert) belong to the piece ${CORE_PIECE}.`,\n \"Steps whose piece needs a connection must set connectionId to a powerhouse/connection document id (see getConnections).\",\n \"Runs execute the published snapshot, not the draft. PUBLISH_WORKFLOW only snapshots the draft, so publish again after every edit that should run.\",\n \"Only ENABLED workflows get trigger instances and can be fired. PUBLISH_WORKFLOW does not enable: to turn a workflow on, dispatch SET_WORKFLOW_STATUS ENABLED after PUBLISH_WORKFLOW (the same batch works). SET_WORKFLOW_STATUS ENABLED is refused until the workflow has been published once.\",\n];\n\nexport const getWorkflowPieceBlocksTool: PhAiToolDescriptor = {\n name: \"getWorkflowPieceBlocks\",\n description:\n \"Lists the actions and triggers of one piece, each with the pieceName, pieceVersion and actionName or triggerName to use in ADD_STEP or SET_TRIGGER. Takes the piece package name from getConnectors. Call getWorkflowBlockConfig next for a block's config props.\",\n inputSchema: {\n packageName: z\n .string()\n .describe(\"Piece package name, e.g. @activepieces/piece-http.\"),\n },\n annotations: { title: \"Get Workflow Piece Blocks\", ...READ_ONLY },\n callback: async (args: { packageName: string }) => {\n syncRuntimeUrl();\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(args.packageName),\n fetchPieceTriggers(args.packageName),\n ]);\n return {\n packageName: args.packageName,\n actions: actions.map((action) => ({\n pieceName: action.pieceName,\n pieceVersion: action.pieceVersion,\n actionName: action.name,\n displayName: action.displayName,\n description: action.description,\n })),\n triggers: triggers.map((trigger) => ({\n pieceName: trigger.pieceName,\n pieceVersion: trigger.pieceVersion,\n triggerName: trigger.name,\n displayName: trigger.displayName,\n description: trigger.description,\n strategy: trigger.strategy,\n })),\n };\n },\n};\n\nexport const getWorkflowBlockConfigTool: PhAiToolDescriptor = {\n name: \"getWorkflowBlockConfig\",\n description:\n \"Describes the config of one block (a core block or a piece's action or trigger): prop names, types, whether required, allowed options, the output ports, and whether a connection is needed. Use it before writing a step or trigger config.\",\n inputSchema: {\n pieceName: z\n .string()\n .describe(\n `Piece package name, e.g. ${CORE_PIECE} or @activepieces/piece-http.`,\n ),\n pieceVersion: z.string().describe(\"Exact semver of the piece.\"),\n name: z\n .string()\n .describe(\"Action or trigger name, e.g. branch or send_request.\"),\n kind: z.enum([\"action\", \"trigger\"]).describe(\"action or trigger.\"),\n },\n annotations: { title: \"Get Workflow Block Config\", ...READ_ONLY },\n callback: async (args: BlockRef) => {\n const block: BlockRef = {\n pieceName: args.pieceName,\n pieceVersion: args.pieceVersion,\n name: args.name,\n kind: args.kind,\n };\n syncRuntimeUrl();\n const form = await getBlockForm(block);\n if (!form) {\n return {\n ...blockFields(block),\n error:\n \"Unknown block. Use getConnectors and getWorkflowPieceBlocks to find valid blocks (documents live in @powerhousedao/piece-reactor), or listWorkflowCoreBlocks for built-ins.\",\n };\n }\n return {\n ...blockFields(block),\n title: form.title,\n kind: kindOf(block),\n requiresConnection: form.auth === \"required\",\n props: form.props.map(describeProp),\n ports: portsFor(form),\n };\n },\n};\n\nexport const listWorkflowCoreBlocksTool: PhAiToolDescriptor = {\n name: \"listWorkflowCoreBlocks\",\n description: `Lists the built-in blocks of the ${CORE_PIECE} piece (manual, schedule and webhook triggers, branch and assert) with their pinned fields and config props, plus the expression syntax and the rules for building a powerhouse/workflow document. Documents are read and written by the @powerhousedao/piece-reactor blocks; list those with getWorkflowPieceBlocks.`,\n inputSchema: {},\n annotations: { title: \"List Workflow Core Blocks\", ...READ_ONLY },\n callback: async () => {\n syncRuntimeUrl();\n // The reactor serves the core piece's descriptors, as it does any piece's.\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(CORE_PIECE),\n fetchPieceTriggers(CORE_PIECE),\n ]);\n const blocks: BlockRef[] = [\n ...triggers.map((entry) => ({ ...entry, kind: \"trigger\" as const })),\n ...actions.map((entry) => ({ ...entry, kind: \"action\" as const })),\n ].map((entry) => ({\n pieceName: entry.pieceName,\n pieceVersion: entry.pieceVersion,\n name: entry.name,\n kind: entry.kind,\n }));\n const forms = await Promise.all(blocks.map(getBlockForm));\n return {\n blocks: blocks.flatMap((block, index) => {\n const form = forms[index];\n if (!form) return [];\n return [\n {\n ...blockFields(block),\n title: form.title,\n kind: kindOf(block),\n props: form.props.map(describeProp),\n ports: portsFor(form),\n },\n ];\n }),\n expressions: EXPRESSIONS,\n rules: GRAPH_RULES,\n };\n },\n};\n\nexport const listWorkflowRunsTool: PhAiToolDescriptor = {\n name: \"listWorkflowRuns\",\n description:\n \"Lists recent workflow runs, newest first, with status, error and each step's outcome. Filter by workflowId to inspect one workflow, or by driveId for every workflow in a drive.\",\n inputSchema: {\n workflowId: z\n .string()\n .optional()\n .describe(\"Workflow document id to filter by.\"),\n driveId: z\n .string()\n .optional()\n .describe(\"Drive id to filter by (all workflows in that drive).\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\"Maximum runs to return (default 10).\"),\n },\n annotations: { title: \"List Workflow Runs\", ...READ_ONLY },\n callback: async (args: {\n workflowId?: string;\n driveId?: string;\n limit?: number;\n }) => {\n syncRuntimeUrl();\n const runs = await fetchRuns({\n workflowId: args.workflowId,\n driveId: args.driveId,\n limit: args.limit ?? 10,\n });\n return {\n runs: runs.map((run) => ({\n id: run.id,\n workflowId: run.workflowId,\n workflowName: run.workflowName,\n status: run.status,\n error: run.error,\n triggerKind: run.triggerKind,\n startedAt: run.startedAt,\n endedAt: run.endedAt,\n steps: run.steps.map((step) => ({\n key: step.stepKey,\n status: step.status,\n error: step.error,\n })),\n })),\n };\n },\n};\n\nexport const fireWorkflowTool: PhAiToolDescriptor = {\n name: \"fireWorkflow\",\n description:\n \"Fires an ENABLED workflow whose trigger is the core manual trigger and runs its published snapshot to completion. The payload becomes {{trigger.payload}}. Returns the run id and final status.\",\n inputSchema: {\n workflowId: z.string().describe(\"Workflow document id.\"),\n payload: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\"Trigger payload object.\"),\n },\n annotations: {\n title: \"Fire Workflow\",\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n },\n callback: (args: {\n workflowId: string;\n payload?: Record<string, unknown>;\n }) => {\n syncRuntimeUrl();\n return fireWorkflow(args.workflowId, args.payload ?? {});\n },\n};\n\n/** Workflow authoring and run tools, merged into `aiTools` in tools.ts. */\nexport const workflowTools: PhAiToolDescriptor[] = [\n getWorkflowPieceBlocksTool,\n getWorkflowBlockConfigTool,\n listWorkflowCoreBlocksTool,\n listWorkflowRunsTool,\n fireWorkflowTool,\n];\n","// Read-only AI tool descriptors for the Connect assistant: the project's\n// piece catalog, connection documents, and connection health. The `aiTools`\n// export is how the host app discovers this package's tools (the line in the\n// project index is synced by `ph generate`).\nimport type { PhAiToolDescriptor } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\nimport {\n connectorIdForPiece,\n isConfigValueMissing,\n packageFromConnectorId,\n planFromAuth,\n type AuthField,\n} from \"../editors/connection-editor/piece-auth.js\";\nimport {\n checkConnection as runConnectionCheck,\n fetchConnections,\n fetchPieceActions,\n fetchPieceCatalog,\n fetchPieceTriggers,\n type PieceSummary,\n} from \"../editors/workflow-editor/runtime-api.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\nimport { workflowTools } from \"./workflow-tools.js\";\n\nconst MAX_CONNECTORS = 20;\n\nexport interface ConnectorField {\n name: string;\n label: string;\n required: boolean;\n description?: string;\n secret: boolean;\n}\n\nexport interface ConnectorDetail {\n connectorId: string;\n pieceName: string;\n displayName: string;\n description: string;\n version: string;\n authType: string;\n /** False for auth kinds the runtime cannot execute yet (OIDC). */\n supported: boolean;\n /** OAUTH2: a person finishes it by signing in from the connection editor. */\n signIn?: \"oauth2\";\n fields: ConnectorField[];\n actions: string[];\n triggers: string[];\n}\n\nfunction toField(field: AuthField, secret: boolean): ConnectorField {\n return {\n name: field.name,\n label: field.displayName,\n required: field.required,\n description: field.description,\n secret,\n };\n}\n\nasync function connectorDetail(piece: PieceSummary): Promise<ConnectorDetail> {\n const plan = planFromAuth(piece.auth);\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(piece.name),\n fetchPieceTriggers(piece.name),\n ]);\n return {\n connectorId: connectorIdForPiece(piece.name),\n pieceName: piece.name,\n displayName: piece.displayName,\n description: piece.description,\n version: piece.version,\n authType: plan.authType,\n supported: plan.supported,\n ...(plan.oauth2 ? { signIn: \"oauth2\" as const } : {}),\n fields: [\n ...plan.configFields.map((field) => toField(field, false)),\n ...plan.secretFields.map((field) => toField(field, true)),\n ],\n actions: actions.map((action) => action.name),\n triggers: triggers.map((trigger) => trigger.name),\n };\n}\n\n/**\n * Stage one of connector discovery: the catalog, optionally narrowed to a\n * case-insensitive substring match on name, display name, or description,\n * capped at {@link MAX_CONNECTORS}. Full auth/action/trigger detail is\n * fetched only for the surviving entries (stage two).\n */\nexport async function getConnectors(query?: string): Promise<{\n total: number;\n matches: number;\n truncated: boolean;\n connectors: ConnectorDetail[];\n}> {\n syncRuntimeUrl();\n const catalog = await fetchPieceCatalog();\n const needle = query?.trim().toLowerCase();\n const matches = needle\n ? catalog.filter((piece) =>\n [piece.name, piece.displayName, piece.description].some((field) =>\n field.toLowerCase().includes(needle),\n ),\n )\n : [...catalog];\n const page = matches.slice(0, MAX_CONNECTORS);\n const connectors = await Promise.all(page.map(connectorDetail));\n return {\n total: catalog.length,\n matches: matches.length,\n truncated: matches.length > page.length,\n connectors,\n };\n}\n\ninterface ConnectionState {\n config?: unknown;\n secretRefs?: { name: string }[];\n}\n\nexport interface ConnectionDetail {\n id: string;\n name: string;\n connectorId: string;\n authType: string;\n status: string;\n accountLabel: string | null;\n /** Required secret fields with no stored ref, by auth property name. */\n missingSecrets: string[];\n /** Required config fields with no value, by auth property name. */\n missingConfig: string[];\n}\n\n/**\n * Every connection document with its credential state compared against the\n * piece's auth plan. Only field names and opaque refs are surfaced; secret\n * values never do.\n */\nexport async function getConnections(): Promise<{\n connections: ConnectionDetail[];\n}> {\n syncRuntimeUrl();\n const [catalog, summaries] = await Promise.all([\n fetchPieceCatalog(),\n fetchConnections(),\n ]);\n const client =\n typeof window !== \"undefined\" ? window.ph?.reactorClient : undefined;\n const connections = await Promise.all(\n summaries.map(async (summary) => {\n const piece = catalog.find(\n (entry) => entry.name === packageFromConnectorId(summary.connectorId),\n );\n const plan = planFromAuth(piece?.auth ?? null);\n let state: ConnectionState | undefined;\n if (client) {\n try {\n const document = await client.get(summary.id);\n state = (document.state as { global?: ConnectionState }).global;\n } catch {\n state = undefined;\n }\n }\n const refNames = new Set(\n (state?.secretRefs ?? []).map((ref) => ref.name),\n );\n const config = (state?.config ?? {}) as Record<string, unknown>;\n return {\n id: summary.id,\n name: summary.name,\n connectorId: summary.connectorId,\n authType: summary.authType,\n status: summary.status,\n accountLabel: summary.accountLabel,\n missingSecrets: plan.secretFields\n .filter((field) => field.required && !refNames.has(field.name))\n .map((field) => field.name),\n missingConfig: plan.configFields\n .filter(\n (field) =>\n field.required && isConfigValueMissing(config[field.name]),\n )\n .map((field) => field.name),\n };\n }),\n );\n return { connections };\n}\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nexport const getConnectorsTool: PhAiToolDescriptor = {\n name: \"getConnectors\",\n description:\n \"Lists the connectors (Activepieces pieces) available to the workflow runtime with their auth fields, actions, and triggers. Without a query it returns up to 20 connectors; pass `query` to search by name or description. Secret fields are listed by name only, never by value.\",\n inputSchema: { query: z.string().optional() },\n annotations: { title: \"Get Connectors\", ...READ_ONLY },\n callback: (args: { query?: string }) => getConnectors(args.query),\n};\n\nexport const getConnectionsTool: PhAiToolDescriptor = {\n name: \"getConnections\",\n description:\n \"Lists the project's connection documents with their credential status: which required secrets and config values are still missing, and the last account label. Secret values are never included.\",\n inputSchema: {},\n annotations: { title: \"Get Connections\", ...READ_ONLY },\n callback: () => getConnections(),\n};\n\nexport const checkConnectionTool: PhAiToolDescriptor = {\n name: \"checkConnection\",\n description:\n \"Runs a connection's own check against its stored credentials to verify they work. Takes a connection id (from getConnections) and reports success, the failure detail, and the account label when the provider returns one.\",\n inputSchema: { connectionId: z.string() },\n annotations: { title: \"Check Connection\", ...READ_ONLY },\n callback: (args: { connectionId: string }) => {\n syncRuntimeUrl();\n return runConnectionCheck(args.connectionId);\n },\n};\n\n/** Tool descriptors the host app offers the AI assistant. */\nexport const aiTools: PhAiToolDescriptor[] = [\n getConnectorsTool,\n getConnectionsTool,\n checkConnectionTool,\n ...workflowTools,\n];\n","import { Connection as ConnectionV1 } from \"document-models/connection/v1\";\nimport { Workflow as WorkflowV1 } from \"document-models/workflow/v1\";\n\n/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\n\nexport const documentModels = [ConnectionV1, WorkflowV1] as const;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { ConnectionEditor } from \"./connection-editor/module.js\";\nimport { WorkflowEditor } from \"./workflow-editor/module.js\";\nimport { WorkflowStudio } from \"./workflow-studio/module.js\";\n\nexport const editors: EditorModule[] = [\n ConnectionEditor,\n WorkflowEditor,\n WorkflowStudio,\n];\n","import type { Manifest } from \"document-model\";\nimport manifestJson from \"./powerhouse.manifest.json\" with { type: \"json\" };\n\nexport { aiTools } from \"./ai/tools.js\";\nexport { documentModels } from \"./document-models/document-models.js\";\nexport { upgradeManifests } from \"./document-models/upgrade-manifests.js\";\nexport { editors } from \"./editors/editors.js\";\nexport const manifest = manifestJson as Manifest;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACkBA,IAAI,UAAyB,oBAAoB,mBAAmB;AAEpE,MAAM,iBAAiB,yBAAyB;AAEhD,SAAgB,cAAc,KAAmB;CAC/C,IAAI,QAAQ,QAAQ,KAAK,UAAU,oBAAoB,GAAG;AAC5D;AAEA,MAAa,gBAAgB,UAC3B,eAAe,WAAW,eAAe,SAAS,KAAK,CAAC;AAC1D,MAAa,0BACX,eAAe,WAAW,aAAa,OAAO,CAAC;AACjD,MAAa,qBAAqB,gBAChC,QAAQ,kBAAkB,WAAW;AACvC,MAAa,sBAAsB,gBACjC,QAAQ,mBAAmB,WAAW;AACxC,MAAa,yBAAyB,QAAQ,iBAAiB;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AAM;EACN,aACE;EACF,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE;EACxC,aAAa;GAAE,OAAO;GAAoB,GAAG;EAAU;EACvD,WAAW,SAAmC;GAC5C,eAAe;GACf,OAAOC,gBAAmB,KAAK,YAAY;EAC7C;CAOA;CACA,GAAG;AACL;;;;;;;ACjOA,MAAa,iBAAiB,CAACC,YAAcC,QAAU;;;ACCvD,MAAa,UAA0B;CACrC;CACA;CACA;AACF;;;ACNA,MAAa,WAAWC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["READ_ONLY","runConnectionCheck","ConnectionV1","WorkflowV1","manifestJson"],"sources":["../../powerhouse.manifest.json","../../editors/workflow-editor/runtime-api.ts","../../ai/runtime-url.ts","../../ai/workflow-tools.ts","../../ai/tools.ts","../../document-models/document-models.ts","../../editors/editors.ts","../../index.ts"],"sourcesContent":["","// Ambient runtime client for the AI tools, which run outside any editor.\n// Editors never import this: each one gets its own client from RuntimeProvider.\nimport type { BlockRef } from \"@powerhousedao/pieces-framework/block-type\";\nimport {\n createRuntimeClient,\n DEFAULT_RUNTIME_URL,\n type RunsScope,\n type RuntimeClient,\n} from \"./runtime-client.js\";\nimport {\n blockFormQuery,\n catalogQuery,\n createRuntimeQueryClient,\n} from \"./runtime-queries.js\";\n\nexport type * from \"./runtime-client.js\";\nexport { DEFAULT_RUNTIME_URL };\n\nlet ambient: RuntimeClient = createRuntimeClient(DEFAULT_RUNTIME_URL);\n// Keys start with the URL, so switching runtimes needs no cache reset.\nconst ambientQueries = createRuntimeQueryClient();\n\nexport function setRuntimeUrl(url: string): void {\n if (url !== ambient.url) ambient = createRuntimeClient(url);\n}\n\nexport const getBlockForm = (block: BlockRef) =>\n ambientQueries.fetchQuery(blockFormQuery(ambient, block));\nexport const fetchPieceCatalog = () =>\n ambientQueries.fetchQuery(catalogQuery(ambient));\nexport const fetchPieceActions = (packageName: string) =>\n ambient.fetchPieceActions(packageName);\nexport const fetchPieceTriggers = (packageName: string) =>\n ambient.fetchPieceTriggers(packageName);\nexport const fetchConnections = () => ambient.fetchConnections();\nexport const checkConnection = (connectionId: string) =>\n ambient.checkConnection(connectionId);\nexport const fetchRuns = (scope?: RunsScope) => ambient.fetchRuns(scope);\nexport const fireWorkflow = (workflowId: string, payload?: unknown) =>\n ambient.fireWorkflow(workflowId, payload);\n","// Points the module-level runtime client at the selected drive's\n// workflow-runtime subgraph before an AI tool talks to it.\nimport { resolveDriveSwitchboard } from \"@powerhousedao/reactor-browser/ai\";\nimport {\n DEFAULT_RUNTIME_URL,\n setRuntimeUrl,\n} from \"../editors/workflow-editor/runtime-api.js\";\n\nexport function syncRuntimeUrl(): void {\n if (typeof window === \"undefined\") return;\n const switchboard = resolveDriveSwitchboard(window.ph?.selectedDriveId);\n // No resolvable switchboard (no selection, or a local/unsynced drive):\n // reset to the default rather than leaving a prior drive's URL attached.\n setRuntimeUrl(\n switchboard\n ? `${switchboard.graphqlUrl}/workflow-runtime`\n : DEFAULT_RUNTIME_URL,\n );\n}\n","// AI tool descriptors for authoring and running workflows: the pinned blocks\n// a piece offers, a block's config props, the built-in core blocks with\n// the expression syntax, run history and manual firing. Complements the\n// connector/connection tools in tools.ts, which cover the catalog and auth.\nimport type { PhAiToolDescriptor } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\nimport {\n fetchPieceActions,\n fetchPieceTriggers,\n fetchRuns,\n fireWorkflow,\n getBlockForm,\n} from \"../editors/workflow-editor/runtime-api.js\";\nimport type { BlockFormProp } from \"../editors/workflow-editor/ui/forms.js\";\nimport { REACTOR_CONNECTOR_ID } from \"../document-models/connection/v1/src/reactor-connection.js\";\nimport {\n CORE_PIECE,\n REACTOR_PIECE,\n type BlockRef,\n} from \"../editors/workflow-editor/ui/blocks.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\nimport { flowPorts } from \"@powerhousedao/pieces-framework/workflow\";\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nfunction kindOf(block: BlockRef): \"trigger\" | \"step\" {\n return block.kind === \"trigger\" ? \"trigger\" : \"step\";\n}\n\n// The fields ADD_STEP or SET_TRIGGER takes for the block.\nfunction blockFields(block: BlockRef) {\n return {\n pieceName: block.pieceName,\n pieceVersion: block.pieceVersion,\n ...(block.kind === \"trigger\"\n ? { triggerName: block.name }\n : { actionName: block.name }),\n };\n}\n\n// The onward ports the block's descriptor declares; \"error\" is a failure route.\nfunction portsFor(form: { ports?: readonly string[] }): string[] {\n return flowPorts(form.ports ?? []);\n}\n\nfunction describeProp(prop: BlockFormProp) {\n return {\n name: prop.name,\n label: prop.displayName,\n type: prop.type,\n required: prop.required,\n ...(prop.description ? { description: prop.description } : {}),\n ...(prop.defaultValue !== undefined ? { default: prop.defaultValue } : {}),\n ...(prop.staticOptions\n ? { options: prop.staticOptions.map((option) => option.value) }\n : {}),\n ...(prop.hasDynamicResolver ? { dynamicOptions: true } : {}),\n };\n}\n\nconst EXPRESSIONS = [\n \"Step configs and edge conditions may contain expressions in double braces.\",\n \"{{trigger.payload.<field>}} reads the trigger payload: for the core manual trigger the payload passed to fireWorkflow; for the reactor piece's document triggers it carries documentId, documentType, driveId and name.\",\n \"{{steps.<key>.output.<path>}} reads an upstream step's output by that step's key, e.g. {{steps.fetch.output.body.title}}.\",\n \"The reactor piece's document-create and document-dispatch output a reference { documentId, documentType, branch, revision }, e.g. {{steps.create.output.documentId}}; read the document with document-get to use its state. document-get outputs the document as { header, state }, e.g. {{steps.get.output.state.global.name}} or {{steps.get.output.header.id}}. document-find outputs { results, nextCursor }: each result has a header (and state with includeState), and nextCursor, present while more match, goes in a later find's cursor.\",\n \"{{variables.<key>}} reads a workflow variable.\",\n \"'a' || 'b' picks the first non-empty value, e.g. {{trigger.payload.url || 'https://example.com'}}.\",\n \"A whole-string expression yields the raw value; text around expressions is interpolated.\",\n];\n\nconst GRAPH_RULES = [\n \"A workflow is a powerhouse/workflow document. Build it with SET_TRIGGER once, ADD_STEP per step (each with a unique id and key), and ADD_EDGE from the trigger id to the first step and between steps.\",\n \"An edge must leave on a port its source declares (getWorkflowBlockConfig lists them): 'next' for the trigger and ordinary steps, 'true' and 'false' for the core branch action, 'error' to route a failure. An edge on any other port is never taken, and the run is flagged with a warning.\",\n \"A step names its block with pieceName, pieceVersion and actionName; the trigger with pieceName, pieceVersion and triggerName. pieceVersion is an exact semver: copy the fields getWorkflowPieceBlocks or listWorkflowCoreBlocks return.\",\n `The built-in blocks (manual, schedule and webhook triggers, branch and assert) belong to the piece ${CORE_PIECE}.`,\n \"Steps whose piece needs a connection must set connectionId to a powerhouse/connection document id (see getConnections).\",\n `Every step and trigger whose block reports requireReactor (getWorkflowBlockConfig) must set reactorConnectionId to a powerhouse/connection document with authType REACTOR and connectorId ${REACTOR_CONNECTOR_ID} (see getConnections); the ${REACTOR_PIECE} blocks all do. Without one the block gets no reactor access and fails. The connection's config { endpoint: \"local\", access?: \"read\", filter?: { documentType?, documentId?, driveId?, actionType? } } limits which documents it reads and writes. connectionId stays for credentials; a document block normally needs none.`,\n \"Runs execute the published snapshot, not the draft. PUBLISH_WORKFLOW only snapshots the draft, so publish again after every edit that should run.\",\n \"Only ENABLED workflows get trigger instances and can be fired. PUBLISH_WORKFLOW does not enable: to turn a workflow on, dispatch SET_WORKFLOW_STATUS ENABLED after PUBLISH_WORKFLOW (the same batch works). SET_WORKFLOW_STATUS ENABLED is refused until the workflow has been published once.\",\n];\n\nexport const getWorkflowPieceBlocksTool: PhAiToolDescriptor = {\n name: \"getWorkflowPieceBlocks\",\n description:\n \"Lists the actions and triggers of one piece, each with the pieceName, pieceVersion and actionName or triggerName to use in ADD_STEP or SET_TRIGGER. Takes the piece package name from getConnectors. Call getWorkflowBlockConfig next for a block's config props.\",\n inputSchema: {\n packageName: z\n .string()\n .describe(\"Piece package name, e.g. @activepieces/piece-http.\"),\n },\n annotations: { title: \"Get Workflow Piece Blocks\", ...READ_ONLY },\n callback: async (args: { packageName: string }) => {\n syncRuntimeUrl();\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(args.packageName),\n fetchPieceTriggers(args.packageName),\n ]);\n return {\n packageName: args.packageName,\n actions: actions.map((action) => ({\n pieceName: action.pieceName,\n pieceVersion: action.pieceVersion,\n actionName: action.name,\n displayName: action.displayName,\n description: action.description,\n })),\n triggers: triggers.map((trigger) => ({\n pieceName: trigger.pieceName,\n pieceVersion: trigger.pieceVersion,\n triggerName: trigger.name,\n displayName: trigger.displayName,\n description: trigger.description,\n strategy: trigger.strategy,\n })),\n };\n },\n};\n\nexport const getWorkflowBlockConfigTool: PhAiToolDescriptor = {\n name: \"getWorkflowBlockConfig\",\n description:\n \"Describes the config of one block (a core block or a piece's action or trigger): prop names, types, whether required, allowed options, the output ports, whether a connection is needed, and requireReactor (read | write) when it needs a reactor connection. Use it before writing a step or trigger config.\",\n inputSchema: {\n pieceName: z\n .string()\n .describe(\n `Piece package name, e.g. ${CORE_PIECE} or @activepieces/piece-http.`,\n ),\n pieceVersion: z.string().describe(\"Exact semver of the piece.\"),\n name: z\n .string()\n .describe(\"Action or trigger name, e.g. branch or send_request.\"),\n kind: z.enum([\"action\", \"trigger\"]).describe(\"action or trigger.\"),\n },\n annotations: { title: \"Get Workflow Block Config\", ...READ_ONLY },\n callback: async (args: BlockRef) => {\n const block: BlockRef = {\n pieceName: args.pieceName,\n pieceVersion: args.pieceVersion,\n name: args.name,\n kind: args.kind,\n };\n syncRuntimeUrl();\n const form = await getBlockForm(block);\n if (!form) {\n return {\n ...blockFields(block),\n error:\n \"Unknown block. Use getConnectors and getWorkflowPieceBlocks to find valid blocks (documents live in @powerhousedao/piece-reactor), or listWorkflowCoreBlocks for built-ins.\",\n };\n }\n return {\n ...blockFields(block),\n title: form.title,\n kind: kindOf(block),\n requiresConnection: form.auth === \"required\",\n // read | write: the block needs a reactorConnectionId granting this.\n requireReactor: form.requireReactor ?? null,\n props: form.props.map(describeProp),\n ports: portsFor(form),\n };\n },\n};\n\nexport const listWorkflowCoreBlocksTool: PhAiToolDescriptor = {\n name: \"listWorkflowCoreBlocks\",\n description: `Lists the built-in blocks of the ${CORE_PIECE} piece (manual, schedule and webhook triggers, branch and assert) with their pinned fields and config props, plus the expression syntax and the rules for building a powerhouse/workflow document. Documents are read and written by the @powerhousedao/piece-reactor blocks; list those with getWorkflowPieceBlocks.`,\n inputSchema: {},\n annotations: { title: \"List Workflow Core Blocks\", ...READ_ONLY },\n callback: async () => {\n syncRuntimeUrl();\n // The reactor serves the core piece's descriptors, as it does any piece's.\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(CORE_PIECE),\n fetchPieceTriggers(CORE_PIECE),\n ]);\n const blocks: BlockRef[] = [\n ...triggers.map((entry) => ({ ...entry, kind: \"trigger\" as const })),\n ...actions.map((entry) => ({ ...entry, kind: \"action\" as const })),\n ].map((entry) => ({\n pieceName: entry.pieceName,\n pieceVersion: entry.pieceVersion,\n name: entry.name,\n kind: entry.kind,\n }));\n const forms = await Promise.all(blocks.map(getBlockForm));\n return {\n blocks: blocks.flatMap((block, index) => {\n const form = forms[index];\n if (!form) return [];\n return [\n {\n ...blockFields(block),\n title: form.title,\n kind: kindOf(block),\n props: form.props.map(describeProp),\n ports: portsFor(form),\n },\n ];\n }),\n expressions: EXPRESSIONS,\n rules: GRAPH_RULES,\n };\n },\n};\n\nexport const listWorkflowRunsTool: PhAiToolDescriptor = {\n name: \"listWorkflowRuns\",\n description:\n \"Lists recent workflow runs, newest first, with status, error and each step's outcome. Filter by workflowId to inspect one workflow, or by driveId for every workflow in a drive.\",\n inputSchema: {\n workflowId: z\n .string()\n .optional()\n .describe(\"Workflow document id to filter by.\"),\n driveId: z\n .string()\n .optional()\n .describe(\"Drive id to filter by (all workflows in that drive).\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\"Maximum runs to return (default 10).\"),\n },\n annotations: { title: \"List Workflow Runs\", ...READ_ONLY },\n callback: async (args: {\n workflowId?: string;\n driveId?: string;\n limit?: number;\n }) => {\n syncRuntimeUrl();\n const runs = await fetchRuns({\n workflowId: args.workflowId,\n driveId: args.driveId,\n limit: args.limit ?? 10,\n });\n return {\n runs: runs.map((run) => ({\n id: run.id,\n workflowId: run.workflowId,\n workflowName: run.workflowName,\n status: run.status,\n error: run.error,\n triggerKind: run.triggerKind,\n startedAt: run.startedAt,\n endedAt: run.endedAt,\n steps: run.steps.map((step) => ({\n key: step.stepKey,\n status: step.status,\n error: step.error,\n })),\n })),\n };\n },\n};\n\nexport const fireWorkflowTool: PhAiToolDescriptor = {\n name: \"fireWorkflow\",\n description:\n \"Fires an ENABLED workflow whose trigger is the core manual trigger and runs its published snapshot to completion. The payload becomes {{trigger.payload}}. Returns the run id and final status.\",\n inputSchema: {\n workflowId: z.string().describe(\"Workflow document id.\"),\n payload: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\"Trigger payload object.\"),\n },\n annotations: {\n title: \"Fire Workflow\",\n readOnlyHint: false,\n destructiveHint: true,\n idempotentHint: false,\n openWorldHint: false,\n },\n callback: (args: {\n workflowId: string;\n payload?: Record<string, unknown>;\n }) => {\n syncRuntimeUrl();\n return fireWorkflow(args.workflowId, args.payload ?? {});\n },\n};\n\n/** Workflow authoring and run tools, merged into `aiTools` in tools.ts. */\nexport const workflowTools: PhAiToolDescriptor[] = [\n getWorkflowPieceBlocksTool,\n getWorkflowBlockConfigTool,\n listWorkflowCoreBlocksTool,\n listWorkflowRunsTool,\n fireWorkflowTool,\n];\n","// Read-only AI tool descriptors for the Connect assistant: the project's\n// piece catalog, connection documents, and connection health. The `aiTools`\n// export is how the host app discovers this package's tools (the line in the\n// project index is synced by `ph generate`).\nimport type { PhAiToolDescriptor } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\nimport {\n connectorIdForPiece,\n isConfigValueMissing,\n packageFromConnectorId,\n planFromAuth,\n type AuthField,\n} from \"../editors/connection-editor/piece-auth.js\";\nimport {\n checkConnection as runConnectionCheck,\n fetchConnections,\n fetchPieceActions,\n fetchPieceCatalog,\n fetchPieceTriggers,\n type PieceSummary,\n} from \"../editors/workflow-editor/runtime-api.js\";\nimport { syncRuntimeUrl } from \"./runtime-url.js\";\nimport { workflowTools } from \"./workflow-tools.js\";\n\nconst MAX_CONNECTORS = 20;\n\nexport interface ConnectorField {\n name: string;\n label: string;\n required: boolean;\n description?: string;\n secret: boolean;\n}\n\nexport interface ConnectorDetail {\n connectorId: string;\n pieceName: string;\n displayName: string;\n description: string;\n version: string;\n authType: string;\n /** False for auth kinds the runtime cannot execute yet (OIDC). */\n supported: boolean;\n /** OAUTH2: a person finishes it by signing in from the connection editor. */\n signIn?: \"oauth2\";\n fields: ConnectorField[];\n actions: string[];\n triggers: string[];\n}\n\nfunction toField(field: AuthField, secret: boolean): ConnectorField {\n return {\n name: field.name,\n label: field.displayName,\n required: field.required,\n description: field.description,\n secret,\n };\n}\n\nasync function connectorDetail(piece: PieceSummary): Promise<ConnectorDetail> {\n const plan = planFromAuth(piece.auth);\n const [actions, triggers] = await Promise.all([\n fetchPieceActions(piece.name),\n fetchPieceTriggers(piece.name),\n ]);\n return {\n connectorId: connectorIdForPiece(piece.name),\n pieceName: piece.name,\n displayName: piece.displayName,\n description: piece.description,\n version: piece.version,\n authType: plan.authType,\n supported: plan.supported,\n ...(plan.oauth2 ? { signIn: \"oauth2\" as const } : {}),\n fields: [\n ...plan.configFields.map((field) => toField(field, false)),\n ...plan.secretFields.map((field) => toField(field, true)),\n ],\n actions: actions.map((action) => action.name),\n triggers: triggers.map((trigger) => trigger.name),\n };\n}\n\n/**\n * Stage one of connector discovery: the catalog, optionally narrowed to a\n * case-insensitive substring match on name, display name, or description,\n * capped at {@link MAX_CONNECTORS}. Full auth/action/trigger detail is\n * fetched only for the surviving entries (stage two).\n */\nexport async function getConnectors(query?: string): Promise<{\n total: number;\n matches: number;\n truncated: boolean;\n connectors: ConnectorDetail[];\n}> {\n syncRuntimeUrl();\n const catalog = await fetchPieceCatalog();\n const needle = query?.trim().toLowerCase();\n const matches = needle\n ? catalog.filter((piece) =>\n [piece.name, piece.displayName, piece.description].some((field) =>\n field.toLowerCase().includes(needle),\n ),\n )\n : [...catalog];\n const page = matches.slice(0, MAX_CONNECTORS);\n const connectors = await Promise.all(page.map(connectorDetail));\n return {\n total: catalog.length,\n matches: matches.length,\n truncated: matches.length > page.length,\n connectors,\n };\n}\n\ninterface ConnectionState {\n config?: unknown;\n secretRefs?: { name: string }[];\n}\n\nexport interface ConnectionDetail {\n id: string;\n name: string;\n connectorId: string;\n authType: string;\n status: string;\n accountLabel: string | null;\n /** Required secret fields with no stored ref, by auth property name. */\n missingSecrets: string[];\n /** Required config fields with no value, by auth property name. */\n missingConfig: string[];\n}\n\n/**\n * Every connection document with its credential state compared against the\n * piece's auth plan. Only field names and opaque refs are surfaced; secret\n * values never do.\n */\nexport async function getConnections(): Promise<{\n connections: ConnectionDetail[];\n}> {\n syncRuntimeUrl();\n const [catalog, summaries] = await Promise.all([\n fetchPieceCatalog(),\n fetchConnections(),\n ]);\n const client =\n typeof window !== \"undefined\" ? window.ph?.reactorClient : undefined;\n const connections = await Promise.all(\n summaries.map(async (summary) => {\n const piece = catalog.find(\n (entry) => entry.name === packageFromConnectorId(summary.connectorId),\n );\n const plan = planFromAuth(piece?.auth ?? null);\n let state: ConnectionState | undefined;\n if (client) {\n try {\n const document = await client.get(summary.id);\n state = (document.state as { global?: ConnectionState }).global;\n } catch {\n state = undefined;\n }\n }\n const refNames = new Set(\n (state?.secretRefs ?? []).map((ref) => ref.name),\n );\n const config = (state?.config ?? {}) as Record<string, unknown>;\n return {\n id: summary.id,\n name: summary.name,\n connectorId: summary.connectorId,\n authType: summary.authType,\n status: summary.status,\n accountLabel: summary.accountLabel,\n missingSecrets: plan.secretFields\n .filter((field) => field.required && !refNames.has(field.name))\n .map((field) => field.name),\n missingConfig: plan.configFields\n .filter(\n (field) =>\n field.required && isConfigValueMissing(config[field.name]),\n )\n .map((field) => field.name),\n };\n }),\n );\n return { connections };\n}\n\nconst READ_ONLY = {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n} as const;\n\nexport const getConnectorsTool: PhAiToolDescriptor = {\n name: \"getConnectors\",\n description:\n \"Lists the connectors (Activepieces pieces) available to the workflow runtime with their auth fields, actions, and triggers. Without a query it returns up to 20 connectors; pass `query` to search by name or description. Secret fields are listed by name only, never by value.\",\n inputSchema: { query: z.string().optional() },\n annotations: { title: \"Get Connectors\", ...READ_ONLY },\n callback: (args: { query?: string }) => getConnectors(args.query),\n};\n\nexport const getConnectionsTool: PhAiToolDescriptor = {\n name: \"getConnections\",\n description:\n \"Lists the project's connection documents with their credential status: which required secrets and config values are still missing, and the last account label. Secret values are never included. A connection with authType REACTOR is bound through a step's or trigger's reactorConnectionId, never connectionId.\",\n inputSchema: {},\n annotations: { title: \"Get Connections\", ...READ_ONLY },\n callback: () => getConnections(),\n};\n\nexport const checkConnectionTool: PhAiToolDescriptor = {\n name: \"checkConnection\",\n description:\n \"Runs a connection's own check against its stored credentials to verify they work. Takes a connection id (from getConnections) and reports success, the failure detail, and the account label when the provider returns one.\",\n inputSchema: { connectionId: z.string() },\n annotations: { title: \"Check Connection\", ...READ_ONLY },\n callback: (args: { connectionId: string }) => {\n syncRuntimeUrl();\n return runConnectionCheck(args.connectionId);\n },\n};\n\n/** Tool descriptors the host app offers the AI assistant. */\nexport const aiTools: PhAiToolDescriptor[] = [\n getConnectorsTool,\n getConnectionsTool,\n checkConnectionTool,\n ...workflowTools,\n];\n","import { Connection as ConnectionV1 } from \"document-models/connection/v1\";\nimport { Workflow as WorkflowV1 } from \"document-models/workflow/v1\";\n\n/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\n\nexport const documentModels = [ConnectionV1, WorkflowV1] as const;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { ConnectionEditor } from \"./connection-editor/module.js\";\nimport { WorkflowEditor } from \"./workflow-editor/module.js\";\nimport { WorkflowStudio } from \"./workflow-studio/module.js\";\n\nexport const editors: EditorModule[] = [\n ConnectionEditor,\n WorkflowEditor,\n WorkflowStudio,\n];\n","import type { Manifest } from \"document-model\";\nimport manifestJson from \"./powerhouse.manifest.json\" with { type: \"json\" };\n\nexport { aiTools } from \"./ai/tools.js\";\nexport { documentModels } from \"./document-models/document-models.js\";\nexport { upgradeManifests } from \"./document-models/upgrade-manifests.js\";\nexport { editors } from \"./editors/editors.js\";\nexport const manifest = manifestJson as Manifest;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACkBA,IAAI,UAAyB,oBAAoB,mBAAmB;AAEpE,MAAM,iBAAiB,yBAAyB;AAEhD,SAAgB,cAAc,KAAmB;CAC/C,IAAI,QAAQ,QAAQ,KAAK,UAAU,oBAAoB,GAAG;AAC5D;AAEA,MAAa,gBAAgB,UAC3B,eAAe,WAAW,eAAe,SAAS,KAAK,CAAC;AAC1D,MAAa,0BACX,eAAe,WAAW,aAAa,OAAO,CAAC;AACjD,MAAa,qBAAqB,gBAChC,QAAQ,kBAAkB,WAAW;AACvC,MAAa,sBAAsB,gBACjC,QAAQ,mBAAmB,WAAW;AACxC,MAAa,yBAAyB,QAAQ,iBAAiB;AAC/D,MAAa,mBAAmB,iBAC9B,QAAQ,gBAAgB,YAAY;AACtC,MAAa,aAAa,UAAsB,QAAQ,UAAU,KAAK;AACvE,MAAa,gBAAgB,YAAoB,YAC/C,QAAQ,aAAa,YAAY,OAAO;;;AC/B1C,SAAgB,iBAAuB;CACrC,IAAI,OAAO,WAAW,aAAa;CACnC,MAAM,cAAc,wBAAwB,OAAO,IAAI,eAAe;CAGtE,cACE,cACI,GAAG,YAAY,WAAW,qBAC1B,mBACN;AACF;;;ACKA,MAAMA,cAAY;CAChB,cAAc;CACd,iBAAiB;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ACNA,MAAa,WAAWC"}
|
|
@@ -11,6 +11,7 @@ const ConnectionAuthTypeSchema = z$1.enum([
|
|
|
11
11
|
"NONE",
|
|
12
12
|
"OAUTH2",
|
|
13
13
|
"OIDC",
|
|
14
|
+
"REACTOR",
|
|
14
15
|
"SECRET_TEXT"
|
|
15
16
|
]);
|
|
16
17
|
const ConnectionStatusSchema = z$1.enum([
|
|
@@ -33,6 +34,13 @@ function ConnectionStateSchema() {
|
|
|
33
34
|
status: ConnectionStatusSchema
|
|
34
35
|
});
|
|
35
36
|
}
|
|
37
|
+
function ReactorConnectionConfigSchema() {
|
|
38
|
+
return z$1.object({
|
|
39
|
+
__typename: z$1.literal("ReactorConnectionConfig").optional(),
|
|
40
|
+
access: z$1.string().nullish(),
|
|
41
|
+
endpoint: z$1.string()
|
|
42
|
+
});
|
|
43
|
+
}
|
|
36
44
|
function RecordCheckResultInputSchema() {
|
|
37
45
|
return z$1.object({
|
|
38
46
|
checkedAt: z$1.iso.datetime(),
|
|
@@ -74,6 +82,48 @@ function SetSecretRefInputSchema() {
|
|
|
74
82
|
});
|
|
75
83
|
}
|
|
76
84
|
//#endregion
|
|
85
|
+
//#region document-models/connection/v1/src/reactor-connection.ts
|
|
86
|
+
const REACTOR_CONNECTOR_ID = "@powerhousedao/reactor#reactor";
|
|
87
|
+
const REACTOR_LOCAL_ENDPOINT = "local";
|
|
88
|
+
const CONFIG_KEYS = /* @__PURE__ */ new Set(["endpoint", "access"]);
|
|
89
|
+
function isReactorConnectorId(connectorId) {
|
|
90
|
+
return connectorId === REACTOR_CONNECTOR_ID;
|
|
91
|
+
}
|
|
92
|
+
function defaultReactorConnectionConfig() {
|
|
93
|
+
return { endpoint: REACTOR_LOCAL_ENDPOINT };
|
|
94
|
+
}
|
|
95
|
+
function parseReactorConnectionConfig(config) {
|
|
96
|
+
if (config === null || typeof config !== "object" || Array.isArray(config)) return {
|
|
97
|
+
ok: false,
|
|
98
|
+
error: "A reactor connection config must be an object"
|
|
99
|
+
};
|
|
100
|
+
const unknownKey = Object.keys(config).find((key) => !CONFIG_KEYS.has(key));
|
|
101
|
+
if (unknownKey) return {
|
|
102
|
+
ok: false,
|
|
103
|
+
error: `Unknown reactor connection field "${unknownKey}"`
|
|
104
|
+
};
|
|
105
|
+
const parsed = ReactorConnectionConfigSchema().safeParse(config);
|
|
106
|
+
if (!parsed.success) return {
|
|
107
|
+
ok: false,
|
|
108
|
+
error: parsed.error.issues[0]?.message ?? "Invalid"
|
|
109
|
+
};
|
|
110
|
+
const { endpoint, access } = parsed.data;
|
|
111
|
+
if (endpoint !== "local") return {
|
|
112
|
+
ok: false,
|
|
113
|
+
error: `Reactor endpoint must be "${REACTOR_LOCAL_ENDPOINT}"`
|
|
114
|
+
};
|
|
115
|
+
if (access !== void 0 && access !== null && access !== "read") return {
|
|
116
|
+
ok: false,
|
|
117
|
+
error: `Reactor access must be "read" or absent`
|
|
118
|
+
};
|
|
119
|
+
const value = { endpoint };
|
|
120
|
+
if (access === "read") value.access = access;
|
|
121
|
+
return {
|
|
122
|
+
ok: true,
|
|
123
|
+
config: value
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
77
127
|
//#region document-models/connection/v1/gen/config/creators.ts
|
|
78
128
|
/**
|
|
79
129
|
* WARNING: DO NOT EDIT
|
|
@@ -141,7 +191,7 @@ const documentModel = {
|
|
|
141
191
|
initialValue: ""
|
|
142
192
|
},
|
|
143
193
|
global: {
|
|
144
|
-
schema: "enum ConnectionAuthType {\n SECRET_TEXT\n BASIC_AUTH\n CUSTOM_AUTH\n OAUTH2\n OIDC\n NONE\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\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.\"\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}",
|
|
194
|
+
schema: "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}",
|
|
145
195
|
examples: [],
|
|
146
196
|
initialValue: "{\n \"name\": \"\",\n \"connectorId\": \"\",\n \"authType\": \"NONE\",\n \"config\": {},\n \"secretRefs\": [],\n \"status\": \"UNCONFIGURED\",\n \"lastCheckedAt\": null,\n \"lastError\": null,\n \"accountLabel\": null\n}"
|
|
147
197
|
}
|
|
@@ -166,11 +216,17 @@ const documentModel = {
|
|
|
166
216
|
{
|
|
167
217
|
id: "e668be97-82c8-433e-8af7-1644cfa25723",
|
|
168
218
|
name: "SET_CONNECTOR",
|
|
169
|
-
description: "Binds the connection to a connector and auth kind; resets status to UNCONFIGURED.",
|
|
219
|
+
description: "Binds the connection to a connector and auth kind; resets status to UNCONFIGURED. REACTOR goes only with the reserved reactor connector id.",
|
|
170
220
|
schema: "input SetConnectorInput {\n connectorId: String!\n authType: ConnectionAuthType!\n}",
|
|
171
221
|
template: "Binds the connection to a connector and auth kind; resets status to UNCONFIGURED.",
|
|
172
222
|
reducer: "state.connectorId = action.input.connectorId;\nstate.authType = action.input.authType;\nstate.status = \"UNCONFIGURED\";",
|
|
173
|
-
errors: [
|
|
223
|
+
errors: [{
|
|
224
|
+
id: "6e550820-9d17-447d-9378-a17d38262bc8",
|
|
225
|
+
name: "ReservedConnectorError",
|
|
226
|
+
code: "RESERVED_CONNECTOR",
|
|
227
|
+
description: "The reserved reactor connector id goes only with authType REACTOR, and REACTOR only with it.",
|
|
228
|
+
template: ""
|
|
229
|
+
}],
|
|
174
230
|
examples: [],
|
|
175
231
|
scope: "global"
|
|
176
232
|
},
|
|
@@ -199,7 +255,13 @@ const documentModel = {
|
|
|
199
255
|
schema: "input SetConfigInput {\n config: Unknown!\n}",
|
|
200
256
|
template: "Replaces the non-secret configuration.",
|
|
201
257
|
reducer: "state.config = action.input.config;",
|
|
202
|
-
errors: [
|
|
258
|
+
errors: [{
|
|
259
|
+
id: "b9911ea4-4168-4080-b05e-8687928dc309",
|
|
260
|
+
name: "InvalidReactorConfigError",
|
|
261
|
+
code: "INVALID_REACTOR_CONFIG",
|
|
262
|
+
description: "A REACTOR connection's config is not a valid ReactorConnectionConfig.",
|
|
263
|
+
template: ""
|
|
264
|
+
}],
|
|
203
265
|
examples: [],
|
|
204
266
|
scope: "global"
|
|
205
267
|
},
|
|
@@ -210,7 +272,13 @@ const documentModel = {
|
|
|
210
272
|
schema: "input SetSecretRefInput {\n id: OID!\n name: String!\n ref: String!\n}",
|
|
211
273
|
template: "Creates or updates a secret handle, keyed by its auth property name.",
|
|
212
274
|
reducer: "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}",
|
|
213
|
-
errors: [
|
|
275
|
+
errors: [{
|
|
276
|
+
id: "e3c42e5b-80c6-4020-8cfd-2ccc797d82b7",
|
|
277
|
+
name: "ReactorSecretRefError",
|
|
278
|
+
code: "REACTOR_SECRET_REF",
|
|
279
|
+
description: "A REACTOR connection holds no secrets.",
|
|
280
|
+
template: ""
|
|
281
|
+
}],
|
|
214
282
|
examples: [],
|
|
215
283
|
scope: "global"
|
|
216
284
|
},
|
|
@@ -256,6 +324,18 @@ const documentModel = {
|
|
|
256
324
|
};
|
|
257
325
|
//#endregion
|
|
258
326
|
//#region document-models/connection/v1/gen/config/error.ts
|
|
327
|
+
var InvalidReactorConfigError = class extends Error {
|
|
328
|
+
errorCode = "InvalidReactorConfigError";
|
|
329
|
+
constructor(message = "InvalidReactorConfigError") {
|
|
330
|
+
super(message);
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
var ReactorSecretRefError = class extends Error {
|
|
334
|
+
errorCode = "ReactorSecretRefError";
|
|
335
|
+
constructor(message = "ReactorSecretRefError") {
|
|
336
|
+
super(message);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
259
339
|
var SecretRefNotFoundError = class extends Error {
|
|
260
340
|
errorCode = "SecretRefNotFoundError";
|
|
261
341
|
constructor(message = "SecretRefNotFoundError") {
|
|
@@ -266,9 +346,16 @@ var SecretRefNotFoundError = class extends Error {
|
|
|
266
346
|
//#region document-models/connection/v1/src/reducers/config.ts
|
|
267
347
|
const connectionConfigOperations = {
|
|
268
348
|
setConfigOperation(state, action) {
|
|
269
|
-
state.
|
|
349
|
+
if (state.authType !== "REACTOR") {
|
|
350
|
+
state.config = action.input.config;
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const parsed = parseReactorConnectionConfig(action.input.config);
|
|
354
|
+
if (!parsed.ok) throw new InvalidReactorConfigError(parsed.error);
|
|
355
|
+
state.config = parsed.config;
|
|
270
356
|
},
|
|
271
357
|
setSecretRefOperation(state, action) {
|
|
358
|
+
if (state.authType === "REACTOR") throw new ReactorSecretRefError("A reactor connection holds no secrets");
|
|
272
359
|
const existing = state.secretRefs.find((secretRef) => secretRef.name === action.input.name);
|
|
273
360
|
if (existing) existing.ref = action.input.ref;
|
|
274
361
|
else state.secretRefs.push({
|
|
@@ -284,18 +371,28 @@ const connectionConfigOperations = {
|
|
|
284
371
|
}
|
|
285
372
|
};
|
|
286
373
|
//#endregion
|
|
374
|
+
//#region document-models/connection/v1/gen/connection/error.ts
|
|
375
|
+
var ReservedConnectorError = class extends Error {
|
|
376
|
+
errorCode = "ReservedConnectorError";
|
|
377
|
+
constructor(message = "ReservedConnectorError") {
|
|
378
|
+
super(message);
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
//#endregion
|
|
287
382
|
//#region document-models/connection/v1/src/reducers/connection.ts
|
|
288
383
|
const connectionConnectionOperations = {
|
|
289
384
|
setConnectionNameOperation(state, action) {
|
|
290
385
|
state.name = action.input.name;
|
|
291
386
|
},
|
|
292
387
|
setConnectorOperation(state, action) {
|
|
388
|
+
const reactor = action.input.authType === "REACTOR";
|
|
389
|
+
if (reactor !== isReactorConnectorId(action.input.connectorId)) throw new ReservedConnectorError("The reactor connector id goes only with authType REACTOR");
|
|
293
390
|
const rebinding = action.input.connectorId !== state.connectorId;
|
|
294
391
|
state.connectorId = action.input.connectorId;
|
|
295
392
|
state.authType = action.input.authType;
|
|
296
393
|
state.status = "UNCONFIGURED";
|
|
297
394
|
if (rebinding) {
|
|
298
|
-
state.config = {};
|
|
395
|
+
state.config = reactor ? defaultReactorConnectionConfig() : {};
|
|
299
396
|
state.secretRefs = [];
|
|
300
397
|
state.accountLabel = null;
|
|
301
398
|
state.lastCheckedAt = null;
|
|
@@ -315,35 +412,44 @@ const connectionHealthOperations = { recordCheckResultOperation(state, action) {
|
|
|
315
412
|
} };
|
|
316
413
|
//#endregion
|
|
317
414
|
//#region document-models/connection/v1/gen/reducer.ts
|
|
415
|
+
const schemaMemo = /* @__PURE__ */ new Map();
|
|
416
|
+
function memoizedSchema(makeSchema) {
|
|
417
|
+
let schema = schemaMemo.get(makeSchema);
|
|
418
|
+
if (schema === void 0) {
|
|
419
|
+
schema = makeSchema();
|
|
420
|
+
schemaMemo.set(makeSchema, schema);
|
|
421
|
+
}
|
|
422
|
+
return schema;
|
|
423
|
+
}
|
|
318
424
|
const stateReducer = (state, action, dispatch) => {
|
|
319
425
|
if (isDocumentAction(action)) return state;
|
|
320
426
|
switch (action.type) {
|
|
321
427
|
case "SET_CONNECTION_NAME":
|
|
322
|
-
SetConnectionNameInputSchema
|
|
428
|
+
memoizedSchema(SetConnectionNameInputSchema).parse(action.input);
|
|
323
429
|
connectionConnectionOperations.setConnectionNameOperation(state[action.scope], action, dispatch);
|
|
324
430
|
break;
|
|
325
431
|
case "SET_CONNECTOR":
|
|
326
|
-
SetConnectorInputSchema
|
|
432
|
+
memoizedSchema(SetConnectorInputSchema).parse(action.input);
|
|
327
433
|
connectionConnectionOperations.setConnectorOperation(state[action.scope], action, dispatch);
|
|
328
434
|
break;
|
|
329
435
|
case "SET_ACCOUNT_LABEL":
|
|
330
|
-
SetAccountLabelInputSchema
|
|
436
|
+
memoizedSchema(SetAccountLabelInputSchema).parse(action.input);
|
|
331
437
|
connectionConnectionOperations.setAccountLabelOperation(state[action.scope], action, dispatch);
|
|
332
438
|
break;
|
|
333
439
|
case "SET_CONFIG":
|
|
334
|
-
SetConfigInputSchema
|
|
440
|
+
memoizedSchema(SetConfigInputSchema).parse(action.input);
|
|
335
441
|
connectionConfigOperations.setConfigOperation(state[action.scope], action, dispatch);
|
|
336
442
|
break;
|
|
337
443
|
case "SET_SECRET_REF":
|
|
338
|
-
SetSecretRefInputSchema
|
|
444
|
+
memoizedSchema(SetSecretRefInputSchema).parse(action.input);
|
|
339
445
|
connectionConfigOperations.setSecretRefOperation(state[action.scope], action, dispatch);
|
|
340
446
|
break;
|
|
341
447
|
case "REMOVE_SECRET_REF":
|
|
342
|
-
RemoveSecretRefInputSchema
|
|
448
|
+
memoizedSchema(RemoveSecretRefInputSchema).parse(action.input);
|
|
343
449
|
connectionConfigOperations.removeSecretRefOperation(state[action.scope], action, dispatch);
|
|
344
450
|
break;
|
|
345
451
|
case "RECORD_CHECK_RESULT":
|
|
346
|
-
RecordCheckResultInputSchema
|
|
452
|
+
memoizedSchema(RecordCheckResultInputSchema).parse(action.input);
|
|
347
453
|
connectionHealthOperations.recordCheckResultOperation(state[action.scope], action, dispatch);
|
|
348
454
|
break;
|
|
349
455
|
default: return state;
|
|
@@ -459,7 +565,13 @@ const utils$1 = {
|
|
|
459
565
|
};
|
|
460
566
|
//#endregion
|
|
461
567
|
//#region document-models/connection/v1/src/utils.ts
|
|
462
|
-
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
568
|
+
var utils_exports = /* @__PURE__ */ __exportAll({
|
|
569
|
+
REACTOR_CONNECTOR_ID: () => REACTOR_CONNECTOR_ID,
|
|
570
|
+
REACTOR_LOCAL_ENDPOINT: () => REACTOR_LOCAL_ENDPOINT,
|
|
571
|
+
defaultReactorConnectionConfig: () => defaultReactorConnectionConfig,
|
|
572
|
+
isReactorConnectorId: () => isReactorConnectorId,
|
|
573
|
+
parseReactorConnectionConfig: () => parseReactorConnectionConfig
|
|
574
|
+
});
|
|
463
575
|
//#endregion
|
|
464
576
|
//#region document-models/connection/v1/utils.ts
|
|
465
577
|
/** Utils for the Connection document model */
|
|
@@ -478,6 +590,6 @@ const Connection = {
|
|
|
478
590
|
documentModel: createState(defaultBaseState(), documentModel)
|
|
479
591
|
};
|
|
480
592
|
//#endregion
|
|
481
|
-
export {
|
|
593
|
+
export { REACTOR_CONNECTOR_ID as A, RemoveSecretRefInputSchema as B, setAccountLabel as C, removeSecretRef as D, creators_exports$2 as E, ConnectionAuthTypeSchema as F, SetConnectorInputSchema as G, SetAccountLabelInputSchema as H, ConnectionStateSchema as I, isDefinedNonNullAny as J, SetSecretRefInputSchema as K, ConnectionStatusSchema as L, defaultReactorConnectionConfig as M, isReactorConnectorId as N, setConfig as O, parseReactorConnectionConfig as P, ReactorConnectionConfigSchema as R, creators_exports$1 as S, setConnector as T, SetConfigInputSchema as U, SecretRefSchema as V, SetConnectionNameInputSchema as W, reducer as _, utils$1 as a, creators_exports as b, ConnectionPHStateSchema as c, isConnectionDocument as d, isConnectionState as f, supportedVersions as g, latestVersion as h, initialLocalState as i, REACTOR_LOCAL_ENDPOINT as j, setSecretRef as k, assertIsConnectionDocument as l, connectionUpgradeManifest as m, utils as n, ConnectionDocumentHeaderSchema as o, connectionDocumentType as p, definedNonNullAnySchema as q, initialGlobalState as r, ConnectionDocumentSchema as s, Connection as t, assertIsConnectionState as u, documentModel as v, setConnectionName as w, recordCheckResult as x, actions as y, RecordCheckResultInputSchema as z };
|
|
482
594
|
|
|
483
|
-
//# sourceMappingURL=module-
|
|
595
|
+
//# sourceMappingURL=module-BlT-atBQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-BlT-atBQ.mjs","names":["z","connectionConnectionActions","connectionConfigActions","connectionHealthActions","utils","genUtils","customUtils"],"sources":["../../document-models/connection/v1/gen/schema/zod.ts","../../document-models/connection/v1/src/reactor-connection.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/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/upgrades/versions.ts","../../document-models/connection/upgrades/upgrade-manifest.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":["/* 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 RemoveSecretRefInput,\n SecretRef,\n SetAccountLabelInput,\n SetConfigInput,\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 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 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","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","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n RemoveSecretRefInputSchema,\n SetConfigInputSchema,\n SetSecretRefInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n RemoveSecretRefInput,\n SetConfigInput,\n SetSecretRefInput,\n} from \"../types.js\";\nimport type {\n RemoveSecretRefAction,\n SetConfigAction,\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 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: \"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 | \"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 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 SetSecretRef: { ReactorSecretRefError },\n\n RemoveSecretRef: { SecretRefNotFoundError },\n};\n","import type { ConnectionConfigOperations } from \"document-models/connection/v1\";\nimport {\n InvalidReactorConfigError,\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};\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 RemoveSecretRefInputSchema,\n SetAccountLabelInputSchema,\n SetConfigInputSchema,\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_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","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","/**\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":";;;;;AAwBA,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,WAA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AAE,GAAG,MAAM,GACX,KAAA,GACA,4BACA,QACF;;;;;;;;;;;;ACzBF,MAAa,qBAAqB,UAChC,aACE,uBACA,EAAE,GAAG,MAAM,GACX,KAAA,GACA,8BACA,QACF;AAEF,MAAa,gBAAgB,UAC3B,aACE,iBACA,EAAE,GAAG,MAAM,GACX,KAAA,GACA,yBACA,QACF;AAEF,MAAa,mBAAmB,UAC9B,aACE,qBACA,EAAE,GAAG,MAAM,GACX,KAAA,GACA,4BACA,QACF;;;;;;;;ACrCF,MAAa,qBAAqB,UAChC,aACE,uBACA,EAAE,GAAG,MAAM,GACX,KAAA,GACA,8BACA,QACF;;;;;;;;ACHF,MAAa,UAAU;CACrB,GAAG;CACH,GAAGC;CACH,GAAGC;CACH,GAAGC;AACL;;;AChBA,MAAa,gBAA0C;CACrD,IAAI;CACJ,MAAM;CACN,QAAQ;EACN,MAAM;EACN,SAAS;CACX;CACA,WAAW;CACX,aACE;CACF,gBAAgB,CACd;EACE,OAAO;GACL,OAAO;IACL,QAAQ;IACR,UAAU,CAAC;IACX,cAAc;GAChB;GACA,QAAQ;IACN,QACE;IACF,UAAU,CAAC;IACX,cACE;GACJ;EACF;EACA,SAAS;GACP;IACE,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SAAS;MACT,QAAQ,CAAC;MACT,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,aACE;OACF,UAAU;MACZ,CACF;MACA,UAAU,CAAC;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,IAA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