@powerhousedao/workflow 6.2.3-dev.44 → 6.2.3-dev.46
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-contract.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts.map +1 -0
- 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/drive-window.d.ts +6 -0
- package/dist/types/test/drive-window.d.ts.map +1 -0
- package/dist/types/test/runtime-schema.d.ts +17 -0
- package/dist/types/test/runtime-schema.d.ts.map +1 -0
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as utils, d as isConnectionDocument, l as assertIsConnectionDocument, t as Connection } from "./module-
|
|
1
|
+
import { a as utils, d as isConnectionDocument, l as assertIsConnectionDocument, t as Connection } from "./module-BlT-atBQ.mjs";
|
|
2
2
|
import { PHDocumentController, createBaseState, defaultBaseState } from "document-model";
|
|
3
3
|
import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument } from "@powerhousedao/reactor-browser";
|
|
4
4
|
//#region document-models/connection/v1/gen/controller.ts
|
|
@@ -87,4 +87,4 @@ function useConnectionDocumentsInSelectedFolder() {
|
|
|
87
87
|
//#endregion
|
|
88
88
|
export { createConnectionDocument as a, defaultLocalState as c, useSelectedConnectionDocument as i, defaultPHState as l, useConnectionDocumentsInSelectedDrive as n, createState$1 as o, useConnectionDocumentsInSelectedFolder as r, defaultGlobalState as s, useConnectionDocumentById as t, ConnectionController as u };
|
|
89
89
|
|
|
90
|
-
//# sourceMappingURL=connection-
|
|
90
|
+
//# sourceMappingURL=connection-BxJoL8js.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-
|
|
1
|
+
{"version":3,"file":"connection-BxJoL8js.mjs","names":["createState"],"sources":["../../document-models/connection/v1/gen/controller.ts","../../document-models/connection/v1/gen/ph-factories.ts","../../document-models/connection/v1/hooks.ts"],"sourcesContent":["/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { PHDocumentController } from \"document-model\";\nimport { Connection } from \"../module.js\";\nimport type { ConnectionAction, ConnectionPHState } from \"./types.js\";\n\nexport const ConnectionController = PHDocumentController.forDocumentModel<\n ConnectionPHState,\n ConnectionAction\n>(Connection);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n * Factory methods for creating ConnectionDocument instances\n */\nimport type { PHAuthState, PHBaseState, PHDocumentState } from \"document-model\";\nimport { createBaseState, defaultBaseState } from \"document-model\";\nimport type {\n ConnectionDocument,\n ConnectionGlobalState,\n ConnectionLocalState,\n ConnectionPHState,\n} from \"./types.js\";\nimport { utils } from \"./utils.js\";\n\nexport function defaultGlobalState(): ConnectionGlobalState {\n return {\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\nexport function defaultLocalState(): ConnectionLocalState {\n return {};\n}\n\nexport function defaultPHState(): ConnectionPHState {\n return {\n ...defaultBaseState(),\n global: defaultGlobalState(),\n local: defaultLocalState(),\n };\n}\n\nexport function createGlobalState(\n state?: Partial<ConnectionGlobalState>,\n): ConnectionGlobalState {\n return {\n ...defaultGlobalState(),\n ...(state || {}),\n };\n}\n\nexport function createLocalState(\n state?: Partial<ConnectionLocalState>,\n): ConnectionLocalState {\n return {\n ...defaultLocalState(),\n ...(state || {}),\n } as ConnectionLocalState;\n}\n\nexport function createState(\n baseState?: Partial<PHBaseState>,\n globalState?: Partial<ConnectionGlobalState>,\n localState?: Partial<ConnectionLocalState>,\n): ConnectionPHState {\n return {\n ...createBaseState(baseState?.auth, baseState?.document),\n global: createGlobalState(globalState),\n local: createLocalState(localState),\n };\n}\n\n/**\n * Creates a ConnectionDocument with custom global and local state\n * This properly handles the PHBaseState requirements while allowing\n * document-specific state to be set.\n */\nexport function createConnectionDocument(\n state?: Partial<{\n auth?: Partial<PHAuthState>;\n document?: Partial<PHDocumentState>;\n global?: Partial<ConnectionGlobalState>;\n local?: Partial<ConnectionLocalState>;\n }>,\n): ConnectionDocument {\n const document = utils.createDocument(\n createState(\n createBaseState(state?.auth, { version: 1, ...state?.document }),\n state?.global,\n state?.local,\n ),\n );\n\n return document;\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n useDocumentById,\n useDocumentsInSelectedDrive,\n useDocumentsInSelectedFolder,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n ConnectionAction,\n ConnectionDocument,\n} from \"document-models/connection/v1\";\nimport {\n assertIsConnectionDocument,\n isConnectionDocument,\n} from \"./gen/document-schema.js\";\n\n/** Hook to get a Connection document by its id */\nexport function useConnectionDocumentById(\n documentId: string | null | undefined,\n):\n | [ConnectionDocument, DocumentDispatch<ConnectionAction>]\n | [undefined, undefined] {\n const [document, dispatch] = useDocumentById(documentId);\n if (!isConnectionDocument(document)) return [undefined, undefined];\n return [document, dispatch];\n}\n\n/** Hook to get the selected Connection document */\nexport function useSelectedConnectionDocument(): [\n ConnectionDocument,\n DocumentDispatch<ConnectionAction>,\n] {\n const [document, dispatch] = useSelectedDocument();\n\n assertIsConnectionDocument(document);\n return [document, dispatch] as const;\n}\n\n/** Hook to get all Connection documents in the selected drive */\nexport function useConnectionDocumentsInSelectedDrive() {\n const documentsInSelectedDrive = useDocumentsInSelectedDrive();\n return documentsInSelectedDrive?.filter(isConnectionDocument);\n}\n\n/** Hook to get all Connection documents in the selected folder */\nexport function useConnectionDocumentsInSelectedFolder() {\n const documentsInSelectedFolder = useDocumentsInSelectedFolder();\n return documentsInSelectedFolder?.filter(isConnectionDocument);\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,uBAAuB,qBAAqB,iBAGvD,UAAU;;;ACIZ,SAAgB,qBAA4C;CAC1D,OAAO;EACL,MAAM;EACN,aAAa;EACb,UAAU;EACV,QAAQ,CAAC;EACT,YAAY,CAAC;EACb,QAAQ;EACR,eAAe;EACf,WAAW;EACX,cAAc;CAChB;AACF;AAEA,SAAgB,oBAA0C;CACxD,OAAO,CAAC;AACV;AAEA,SAAgB,iBAAoC;CAClD,OAAO;EACL,GAAG,iBAAiB;EACpB,QAAQ,mBAAmB;EAC3B,OAAO,kBAAkB;CAC3B;AACF;AAEA,SAAgB,kBACd,OACuB;CACvB,OAAO;EACL,GAAG,mBAAmB;EACtB,GAAI,SAAS,CAAC;CAChB;AACF;AAEA,SAAgB,iBACd,OACsB;CACtB,OAAO;EACL,GAAG,kBAAkB;EACrB,GAAI,SAAS,CAAC;CAChB;AACF;AAEA,SAAgBA,cACd,WACA,aACA,YACmB;CACnB,OAAO;EACL,GAAG,gBAAgB,WAAW,MAAM,WAAW,QAAQ;EACvD,QAAQ,kBAAkB,WAAW;EACrC,OAAO,iBAAiB,UAAU;CACpC;AACF;;;;;;AAOA,SAAgB,yBACd,OAMoB;CASpB,OARiB,MAAM,eACrBA,cACE,gBAAgB,OAAO,MAAM;EAAE,SAAS;EAAG,GAAG,OAAO;CAAS,CAAC,GAC/D,OAAO,QACP,OAAO,KACT,CAGY;AAChB;;;;ACxEA,SAAgB,0BACd,YAGyB;CACzB,MAAM,CAAC,UAAU,YAAY,gBAAgB,UAAU;CACvD,IAAI,CAAC,qBAAqB,QAAQ,GAAG,OAAO,CAAC,KAAA,GAAW,KAAA,CAAS;CACjE,OAAO,CAAC,UAAU,QAAQ;AAC5B;;AAGA,SAAgB,gCAGd;CACA,MAAM,CAAC,UAAU,YAAY,oBAAoB;CAEjD,2BAA2B,QAAQ;CACnC,OAAO,CAAC,UAAU,QAAQ;AAC5B;;AAGA,SAAgB,wCAAwC;CAEtD,OADiC,4BACH,CAAC,EAAE,OAAO,oBAAoB;AAC9D;;AAGA,SAAgB,yCAAyC;CAEvD,OADkC,6BACH,CAAC,EAAE,OAAO,oBAAoB;AAC/D"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { c as planFromAuth, i as isAuthComplete, l as plansFromAuth, n as UNKNOWN_AUTH, o as packageFromConnectorId, r as connectorIdForPiece, s as planForConnection, t as OAUTH_TOKEN } from "./piece-auth-BS5CtQOG.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { _ as runtimeKeys } from "./runtime-queries-BM6I7dDA.mjs";
|
|
3
|
+
import { Ct as Hint$1, Dt as Switch, E as formatWhen, Et as Select, Nt as textInputClass, Pt as Icon, St as FieldLabel$1, Tt as Segmented, _t as useRuntime, bt as Button, dt as useOAuthAttempt, ft as useOAuthRedirectUri, pt as usePieceCatalog, vt as useRuntimeActions, wt as IconButton, xt as FieldError, yt as useSecretStat, zt as useQuery } from "./BlockSelector-BMnBzXcA.mjs";
|
|
4
|
+
import { A as REACTOR_CONNECTOR_ID, M as defaultReactorConnectionConfig, N as isReactorConnectorId, P as parseReactorConnectionConfig, y as actions } from "./module-BlT-atBQ.mjs";
|
|
4
5
|
import { useEffect, useId, useRef, useState } from "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { generateId } from "document-model";
|
|
7
|
-
import { setSelectedNode, useDocumentById } from "@powerhousedao/reactor-browser";
|
|
8
|
-
import { baseReducerVersion, garbageCollect, garbageCollectV2, generateId as generateId$1, sortOperations, undo } from "@powerhousedao/shared/document-model";
|
|
8
|
+
import { dispatchActions, setSelectedNode, useDid, useDocumentById, useDrives, useReactorClient, useRenownAuth } from "@powerhousedao/reactor-browser";
|
|
9
|
+
import { baseReducerVersion, decide, garbageCollect, garbageCollectV2, generateId as generateId$1, setGrant, sortOperations, undo } from "@powerhousedao/shared/document-model";
|
|
9
10
|
//#region editors/shared/undo-plan.ts
|
|
10
11
|
const GROUP_PREFIX = "undo-group:";
|
|
11
12
|
function newUndoGroup() {
|
|
@@ -276,6 +277,24 @@ function connectionCallbacks(state, dispatch) {
|
|
|
276
277
|
status,
|
|
277
278
|
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
278
279
|
}));
|
|
280
|
+
},
|
|
281
|
+
pickReactor: () => {
|
|
282
|
+
dispatch(actions.setConnector({
|
|
283
|
+
connectorId: REACTOR_CONNECTOR_ID,
|
|
284
|
+
authType: "REACTOR"
|
|
285
|
+
}));
|
|
286
|
+
dispatch(actions.setConfig({ config: defaultReactorConnectionConfig() }));
|
|
287
|
+
dispatch(actions.recordCheckResult({
|
|
288
|
+
status: "OK",
|
|
289
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
290
|
+
}));
|
|
291
|
+
},
|
|
292
|
+
setReactorConfig: (config) => {
|
|
293
|
+
dispatch(actions.setConfig({ config }));
|
|
294
|
+
if (state.status === "UNCONFIGURED") dispatch(actions.recordCheckResult({
|
|
295
|
+
status: "OK",
|
|
296
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
297
|
+
}));
|
|
279
298
|
}
|
|
280
299
|
};
|
|
281
300
|
}
|
|
@@ -300,8 +319,487 @@ const AUTH_TYPE_LABEL = {
|
|
|
300
319
|
BASIC_AUTH: "Username and password",
|
|
301
320
|
CUSTOM_AUTH: "Keys and tokens",
|
|
302
321
|
OAUTH2: "OAuth 2",
|
|
303
|
-
OIDC: "OpenID Connect"
|
|
322
|
+
OIDC: "OpenID Connect",
|
|
323
|
+
REACTOR: "Reactor access"
|
|
304
324
|
};
|
|
325
|
+
function isReactorConnection(connection) {
|
|
326
|
+
return connection.authType === "REACTOR" && connection.connectorId === "@powerhousedao/reactor#reactor";
|
|
327
|
+
}
|
|
328
|
+
function reactorConnections(connections) {
|
|
329
|
+
return connections.filter(isReactorConnection);
|
|
330
|
+
}
|
|
331
|
+
function signInRequired(access, signedIn) {
|
|
332
|
+
return access?.authEnforcement === true && !signedIn;
|
|
333
|
+
}
|
|
334
|
+
function switchboardGrantId(identity) {
|
|
335
|
+
return `switchboard:${identity.address ?? identity.key}`;
|
|
336
|
+
}
|
|
337
|
+
const SWITCHBOARD_DOCUMENT_OPERATIONS = [
|
|
338
|
+
"DELETE_DOCUMENT",
|
|
339
|
+
"ADD_RELATIONSHIP",
|
|
340
|
+
"REMOVE_RELATIONSHIP"
|
|
341
|
+
];
|
|
342
|
+
function switchboardGrants(identity, authConditions) {
|
|
343
|
+
if (!identity) return [];
|
|
344
|
+
const principal = authConditions ? { match: { eq: [{ attr: "subject.key" }, { lit: identity.key }] } } : identity.address ? { address: identity.address } : null;
|
|
345
|
+
if (!principal) return [];
|
|
346
|
+
const grant = (id, capability) => ({
|
|
347
|
+
id,
|
|
348
|
+
description: "Lets the Switchboard apply workflow writes",
|
|
349
|
+
effect: "allow",
|
|
350
|
+
principal,
|
|
351
|
+
capability
|
|
352
|
+
});
|
|
353
|
+
return [grant(switchboardGrantId(identity), {
|
|
354
|
+
can: "execute",
|
|
355
|
+
scope: "global"
|
|
356
|
+
}), grant(`${switchboardGrantId(identity)}:document`, {
|
|
357
|
+
can: "execute",
|
|
358
|
+
scope: "document",
|
|
359
|
+
operation: [...SWITCHBOARD_DOCUMENT_OPERATIONS]
|
|
360
|
+
})];
|
|
361
|
+
}
|
|
362
|
+
function switchboardMayWrite(auth, identity) {
|
|
363
|
+
const id = switchboardGrantId(identity);
|
|
364
|
+
const ids = new Set(auth?.grants.map((grant) => grant.id));
|
|
365
|
+
if (ids.has(id) && ids.has(`${id}:document`)) return true;
|
|
366
|
+
const subject = identity.address ? { address: identity.address } : {};
|
|
367
|
+
return decide(auth, subject, {
|
|
368
|
+
verb: "execute",
|
|
369
|
+
scope: "global"
|
|
370
|
+
}) === "allow" && SWITCHBOARD_DOCUMENT_OPERATIONS.every((operation) => decide(auth, subject, {
|
|
371
|
+
verb: "execute",
|
|
372
|
+
scope: "document",
|
|
373
|
+
operation
|
|
374
|
+
}) === "allow");
|
|
375
|
+
}
|
|
376
|
+
function canChangeGrants(auth, subject) {
|
|
377
|
+
return decide(auth, subject, {
|
|
378
|
+
verb: "execute",
|
|
379
|
+
scope: "auth",
|
|
380
|
+
operation: "SET_GRANT"
|
|
381
|
+
}) === "allow";
|
|
382
|
+
}
|
|
383
|
+
function planGrants(ids, authOf, subject) {
|
|
384
|
+
const plan = {
|
|
385
|
+
grantable: [],
|
|
386
|
+
noPermission: [],
|
|
387
|
+
notHere: []
|
|
388
|
+
};
|
|
389
|
+
for (const id of ids) {
|
|
390
|
+
const auth = authOf(id);
|
|
391
|
+
if (auth === null) plan.notHere.push(id);
|
|
392
|
+
else if (canChangeGrants(auth, subject)) plan.grantable.push(id);
|
|
393
|
+
else plan.noPermission.push(id);
|
|
394
|
+
}
|
|
395
|
+
return plan;
|
|
396
|
+
}
|
|
397
|
+
function withReactorConfig(current, patch) {
|
|
398
|
+
const access = patch.access === void 0 ? current.access : patch.access === "read" ? "read" : void 0;
|
|
399
|
+
return {
|
|
400
|
+
endpoint: "local",
|
|
401
|
+
...access ? { access } : {}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function accessMismatch(requireReactor, access) {
|
|
405
|
+
return requireReactor === "write" && access === "read" ? "Writes, but this connection allows reads only" : null;
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
408
|
+
//#region editors/workflow-editor/ui/reactor-view.ts
|
|
409
|
+
function shortAddress(address) {
|
|
410
|
+
return address.length <= 12 ? address : `${address.slice(0, 6)}…${address.slice(-4)}`;
|
|
411
|
+
}
|
|
412
|
+
function publisherOf(operations) {
|
|
413
|
+
let latest;
|
|
414
|
+
for (const operation of operations) {
|
|
415
|
+
if (operation.action.type !== "PUBLISH_WORKFLOW") continue;
|
|
416
|
+
if (operation.error) continue;
|
|
417
|
+
if (!latest || operation.index > latest.index) latest = operation;
|
|
418
|
+
}
|
|
419
|
+
if (!latest) return void 0;
|
|
420
|
+
const signer = latest.action.context?.signer;
|
|
421
|
+
const address = signer?.user?.address;
|
|
422
|
+
return address && signer.signatures?.length ? address : null;
|
|
423
|
+
}
|
|
424
|
+
function runsAsText(publisher, loading, hostAddress) {
|
|
425
|
+
if (loading) return null;
|
|
426
|
+
if (publisher && hostAddress && publisher.toLowerCase() === hostAddress.toLowerCase()) return "Published by the Switchboard: runs get no reactor access while document permissions are enforced.";
|
|
427
|
+
if (publisher === void 0) return "Not published yet: runs will act as whoever publishes.";
|
|
428
|
+
if (publisher === null) return "Published unsigned: runs get no reactor access while document permissions are enforced.";
|
|
429
|
+
return `Runs as ${shortAddress(publisher)} (last publisher)`;
|
|
430
|
+
}
|
|
431
|
+
function missingInPublished(blocks) {
|
|
432
|
+
return blocks.filter((block) => block.requireReactor && !block.reactorConnectionId).map((block) => block.label);
|
|
433
|
+
}
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region editors/workflow-editor/reactor-hooks.ts
|
|
436
|
+
function useReactorAccess() {
|
|
437
|
+
const { client, queryClient } = useRuntime();
|
|
438
|
+
const { address } = useRenownAuth();
|
|
439
|
+
return useQuery({
|
|
440
|
+
queryKey: runtimeKeys.reactorAccess(client.url, address ?? null),
|
|
441
|
+
queryFn: () => client.fetchReactorAccess(),
|
|
442
|
+
staleTime: 3e5
|
|
443
|
+
}, queryClient).data;
|
|
444
|
+
}
|
|
445
|
+
function useSignInGate() {
|
|
446
|
+
const access = useReactorAccess();
|
|
447
|
+
const auth = useRenownAuth();
|
|
448
|
+
const did = useDid();
|
|
449
|
+
const signedIn = auth.status === "authorized" && Boolean(auth.address);
|
|
450
|
+
return {
|
|
451
|
+
required: signInRequired(access, signedIn),
|
|
452
|
+
signedIn,
|
|
453
|
+
pending: auth.pending || auth.status === "checking",
|
|
454
|
+
login: () => auth.login(),
|
|
455
|
+
access,
|
|
456
|
+
subject: {
|
|
457
|
+
...auth.address ? { address: auth.address } : {},
|
|
458
|
+
...did ? { key: did } : {}
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
function useDocumentAuths(ids) {
|
|
463
|
+
const { client: runtime, queryClient } = useRuntime();
|
|
464
|
+
const reactor = useReactorClient();
|
|
465
|
+
const query = useQuery({
|
|
466
|
+
queryKey: [
|
|
467
|
+
runtime.url,
|
|
468
|
+
"documentAuth",
|
|
469
|
+
[...ids].sort()
|
|
470
|
+
],
|
|
471
|
+
queryFn: async () => new Map(await Promise.all(ids.map(async (id) => {
|
|
472
|
+
try {
|
|
473
|
+
return [id, (await reactor.get(id)).state.auth];
|
|
474
|
+
} catch {
|
|
475
|
+
return [id, null];
|
|
476
|
+
}
|
|
477
|
+
}))),
|
|
478
|
+
enabled: ids.length > 0 && Boolean(reactor),
|
|
479
|
+
staleTime: 0,
|
|
480
|
+
gcTime: 0
|
|
481
|
+
}, queryClient);
|
|
482
|
+
if (ids.length === 0) return /* @__PURE__ */ new Map();
|
|
483
|
+
if (!reactor) return new Map(ids.map((id) => [id, null]));
|
|
484
|
+
return query.data;
|
|
485
|
+
}
|
|
486
|
+
async function grantOnDocuments(ids, grants) {
|
|
487
|
+
return Promise.all(ids.map(async (id) => {
|
|
488
|
+
let failure;
|
|
489
|
+
try {
|
|
490
|
+
if (!await dispatchActions(grants.map((grant) => setGrant({ grant })), id, (errors) => {
|
|
491
|
+
failure = errors[0]?.message ?? "The grant was refused";
|
|
492
|
+
}) && !failure) failure = "The grant was not applied";
|
|
493
|
+
} catch (error) {
|
|
494
|
+
failure = error instanceof Error ? error.message : String(error);
|
|
495
|
+
}
|
|
496
|
+
return failure ? {
|
|
497
|
+
id,
|
|
498
|
+
error: failure
|
|
499
|
+
} : { id };
|
|
500
|
+
}));
|
|
501
|
+
}
|
|
502
|
+
function useReactorAccessDenial(workflowId, refresh) {
|
|
503
|
+
const { client, queryClient } = useRuntime();
|
|
504
|
+
return useQuery({
|
|
505
|
+
queryKey: [...runtimeKeys.reactorDenial(client.url, workflowId ?? ""), refresh],
|
|
506
|
+
queryFn: () => client.fetchReactorAccessDenial(workflowId),
|
|
507
|
+
enabled: Boolean(workflowId),
|
|
508
|
+
refetchInterval: 15e3,
|
|
509
|
+
staleTime: 0
|
|
510
|
+
}, queryClient).data ?? null;
|
|
511
|
+
}
|
|
512
|
+
function usePublisher(workflowId, publishedVersion) {
|
|
513
|
+
const { client: runtime, queryClient } = useRuntime();
|
|
514
|
+
const reactor = useReactorClient();
|
|
515
|
+
const query = useQuery({
|
|
516
|
+
queryKey: [
|
|
517
|
+
runtime.url,
|
|
518
|
+
"publisher",
|
|
519
|
+
workflowId,
|
|
520
|
+
publishedVersion ?? 0
|
|
521
|
+
],
|
|
522
|
+
queryFn: async () => {
|
|
523
|
+
const operations = [];
|
|
524
|
+
let page = await reactor.getOperations(workflowId, { scopes: ["global"] }, { actionTypes: ["PUBLISH_WORKFLOW"] });
|
|
525
|
+
for (;;) {
|
|
526
|
+
operations.push(...page.results);
|
|
527
|
+
if (!page.next || page.results.length === 0) break;
|
|
528
|
+
try {
|
|
529
|
+
page = await page.next();
|
|
530
|
+
} catch {
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
const found = publisherOf(operations);
|
|
535
|
+
return found === void 0 ? "" : found;
|
|
536
|
+
},
|
|
537
|
+
enabled: Boolean(workflowId && reactor),
|
|
538
|
+
staleTime: Infinity
|
|
539
|
+
}, queryClient);
|
|
540
|
+
if (query.status === "error") return {
|
|
541
|
+
publisher: void 0,
|
|
542
|
+
loading: false
|
|
543
|
+
};
|
|
544
|
+
if (query.status === "pending") return {
|
|
545
|
+
publisher: void 0,
|
|
546
|
+
loading: Boolean(workflowId && reactor)
|
|
547
|
+
};
|
|
548
|
+
return {
|
|
549
|
+
publisher: query.data === "" ? void 0 : query.data,
|
|
550
|
+
loading: false
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region editors/workflow-editor/ui/document-options.ts
|
|
555
|
+
function documentOptions(drives) {
|
|
556
|
+
const seen = /* @__PURE__ */ new Map();
|
|
557
|
+
for (const drive of drives) {
|
|
558
|
+
const driveName = drive.state.global.name || drive.header.name || "";
|
|
559
|
+
for (const node of drive.state.global.nodes) {
|
|
560
|
+
if (node.kind.toUpperCase() !== "FILE" || seen.has(node.id)) continue;
|
|
561
|
+
seen.set(node.id, {
|
|
562
|
+
value: node.id,
|
|
563
|
+
label: node.name || node.id,
|
|
564
|
+
description: [node.documentType, driveName].filter(Boolean).join(" · ")
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return [...seen.values()].sort((a, b) => a.label.localeCompare(b.label));
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region editors/workflow-editor/ui/SignInPrompt.tsx
|
|
572
|
+
function SignInPrompt(props) {
|
|
573
|
+
const { gate } = props;
|
|
574
|
+
if (!gate.required) return null;
|
|
575
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
576
|
+
role: "note",
|
|
577
|
+
"aria-label": "Sign in required",
|
|
578
|
+
className: "flex items-start gap-2.5 rounded-md border border-solid border-wf-warn/30 bg-wf-warn/10 px-3 py-2.5",
|
|
579
|
+
children: [
|
|
580
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
581
|
+
name: "lock",
|
|
582
|
+
className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-wf-warn"
|
|
583
|
+
}),
|
|
584
|
+
/* @__PURE__ */ jsxs("p", {
|
|
585
|
+
className: "min-w-0 flex-1 text-xs leading-relaxed text-foreground",
|
|
586
|
+
children: ["This Switchboard enforces document permissions. ", props.reason]
|
|
587
|
+
}),
|
|
588
|
+
/* @__PURE__ */ jsx(Button, {
|
|
589
|
+
size: "sm",
|
|
590
|
+
variant: "primary",
|
|
591
|
+
disabled: gate.pending,
|
|
592
|
+
onClick: gate.login,
|
|
593
|
+
children: gate.pending ? "Signing in…" : "Sign in"
|
|
594
|
+
})
|
|
595
|
+
]
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region editors/workflow-editor/ui/SwitchboardGrants.tsx
|
|
600
|
+
function NamedList(props) {
|
|
601
|
+
if (props.ids.length === 0) return null;
|
|
602
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
603
|
+
/* @__PURE__ */ jsx("p", {
|
|
604
|
+
className: "text-xs font-medium text-foreground",
|
|
605
|
+
children: props.heading
|
|
606
|
+
}),
|
|
607
|
+
/* @__PURE__ */ jsx("ul", {
|
|
608
|
+
"aria-label": props.label,
|
|
609
|
+
className: "mt-1",
|
|
610
|
+
children: props.ids.map((id) => /* @__PURE__ */ jsx("li", {
|
|
611
|
+
className: "truncate text-xs text-foreground",
|
|
612
|
+
children: props.names.get(id) ?? id
|
|
613
|
+
}, id))
|
|
614
|
+
}),
|
|
615
|
+
/* @__PURE__ */ jsx("p", {
|
|
616
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
617
|
+
children: props.next
|
|
618
|
+
})
|
|
619
|
+
] });
|
|
620
|
+
}
|
|
621
|
+
function SwitchboardGrants() {
|
|
622
|
+
const gate = useSignInGate();
|
|
623
|
+
const options = documentOptions(useDrives() ?? []);
|
|
624
|
+
const [chosen, setChosen] = useState([]);
|
|
625
|
+
const auths = useDocumentAuths(chosen);
|
|
626
|
+
const [busy, setBusy] = useState(false);
|
|
627
|
+
const [outcomes, setOutcomes] = useState([]);
|
|
628
|
+
const access = gate.access;
|
|
629
|
+
if (!access?.authEnforcement) return null;
|
|
630
|
+
const identity = access.reactorIdentity;
|
|
631
|
+
const grants = switchboardGrants(identity, access.authConditions);
|
|
632
|
+
const names = new Map(options.map((option) => [option.value, option.label]));
|
|
633
|
+
const header = /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h4", {
|
|
634
|
+
className: "text-[13px] font-medium text-foreground",
|
|
635
|
+
children: "Switchboard grants"
|
|
636
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
637
|
+
className: "mt-0.5 text-xs text-muted-foreground",
|
|
638
|
+
children: "With document permissions enforced, a write lands only when the Switchboard may make it too. Grant it on each document steps write."
|
|
639
|
+
})] });
|
|
640
|
+
if (!gate.signedIn) return /* @__PURE__ */ jsxs("section", {
|
|
641
|
+
"aria-label": "Switchboard grants",
|
|
642
|
+
className: "flex flex-col gap-3",
|
|
643
|
+
children: [header, /* @__PURE__ */ jsx(SignInPrompt, {
|
|
644
|
+
gate: {
|
|
645
|
+
...gate,
|
|
646
|
+
required: true
|
|
647
|
+
},
|
|
648
|
+
reason: "Sign in to grant the Switchboard on documents."
|
|
649
|
+
})]
|
|
650
|
+
});
|
|
651
|
+
if (!identity || grants.length === 0) return /* @__PURE__ */ jsxs("section", {
|
|
652
|
+
"aria-label": "Switchboard grants",
|
|
653
|
+
className: "flex flex-col gap-3",
|
|
654
|
+
children: [header, /* @__PURE__ */ jsx("p", {
|
|
655
|
+
className: "text-xs text-wf-warn",
|
|
656
|
+
children: "The Switchboard does not say who it signs as, so it can't be granted from here."
|
|
657
|
+
})]
|
|
658
|
+
});
|
|
659
|
+
const done = new Set(outcomes.filter((outcome) => !outcome.error).map((outcome) => outcome.id));
|
|
660
|
+
const failed = new Map(outcomes.flatMap((outcome) => outcome.error ? [[outcome.id, outcome.error]] : []));
|
|
661
|
+
const granted = chosen.filter((id) => {
|
|
662
|
+
if (done.has(id)) return true;
|
|
663
|
+
const auth = auths?.get(id);
|
|
664
|
+
return auths?.has(id) && auth !== null && switchboardMayWrite(auth, identity);
|
|
665
|
+
});
|
|
666
|
+
const pending = chosen.filter((id) => !granted.includes(id));
|
|
667
|
+
const plan = auths ? planGrants(pending, (id) => auths.get(id), gate.subject) : null;
|
|
668
|
+
const grantOn = (ids) => {
|
|
669
|
+
setBusy(true);
|
|
670
|
+
grantOnDocuments(ids, grants).then((next) => setOutcomes((previous) => [...previous.filter((outcome) => !ids.includes(outcome.id)), ...next])).finally(() => setBusy(false));
|
|
671
|
+
};
|
|
672
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
673
|
+
"aria-label": "Switchboard grants",
|
|
674
|
+
className: "flex flex-col gap-3",
|
|
675
|
+
children: [
|
|
676
|
+
header,
|
|
677
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
678
|
+
/* @__PURE__ */ jsx(FieldLabel$1, {
|
|
679
|
+
label: "Documents",
|
|
680
|
+
optional: true
|
|
681
|
+
}),
|
|
682
|
+
/* @__PURE__ */ jsx(Select, {
|
|
683
|
+
ariaLabel: "Documents to grant on",
|
|
684
|
+
multiple: true,
|
|
685
|
+
searchable: true,
|
|
686
|
+
value: chosen,
|
|
687
|
+
options,
|
|
688
|
+
placeholder: "Choose documents",
|
|
689
|
+
emptyText: "No documents in this Connect's drives.",
|
|
690
|
+
onChange: setChosen
|
|
691
|
+
}),
|
|
692
|
+
/* @__PURE__ */ jsx(Hint$1, { text: "Grants are per document; a drive's grants do not cover its documents." })
|
|
693
|
+
] }),
|
|
694
|
+
chosen.length > 0 && !plan ? /* @__PURE__ */ jsx("div", { className: "h-10 animate-pulse rounded-md bg-foreground/5" }) : null,
|
|
695
|
+
granted.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
696
|
+
"aria-label": "Documents the Switchboard may write",
|
|
697
|
+
className: "flex flex-col gap-1",
|
|
698
|
+
children: granted.map((id) => /* @__PURE__ */ jsxs("li", {
|
|
699
|
+
className: "flex items-center gap-2 text-xs",
|
|
700
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
701
|
+
className: "min-w-0 flex-1 truncate text-foreground",
|
|
702
|
+
children: names.get(id) ?? id
|
|
703
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
704
|
+
className: "text-wf-ok",
|
|
705
|
+
children: "Granted"
|
|
706
|
+
})]
|
|
707
|
+
}, id))
|
|
708
|
+
}) : null,
|
|
709
|
+
plan && plan.grantable.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
710
|
+
className: "flex flex-col gap-1",
|
|
711
|
+
children: plan.grantable.map((id) => /* @__PURE__ */ jsxs("li", {
|
|
712
|
+
className: "flex items-center gap-2 text-xs",
|
|
713
|
+
children: [
|
|
714
|
+
/* @__PURE__ */ jsx("span", {
|
|
715
|
+
className: "min-w-0 flex-1 truncate text-foreground",
|
|
716
|
+
children: names.get(id) ?? id
|
|
717
|
+
}),
|
|
718
|
+
failed.has(id) ? /* @__PURE__ */ jsx("span", {
|
|
719
|
+
className: "truncate text-wf-fail",
|
|
720
|
+
title: failed.get(id),
|
|
721
|
+
children: failed.get(id)
|
|
722
|
+
}) : null,
|
|
723
|
+
/* @__PURE__ */ jsx(Button, {
|
|
724
|
+
size: "sm",
|
|
725
|
+
disabled: busy,
|
|
726
|
+
"aria-label": `Grant the Switchboard on ${names.get(id) ?? id}`,
|
|
727
|
+
onClick: () => grantOn([id]),
|
|
728
|
+
children: "Grant"
|
|
729
|
+
})
|
|
730
|
+
]
|
|
731
|
+
}, id))
|
|
732
|
+
}) : null,
|
|
733
|
+
plan && plan.grantable.length > 1 ? /* @__PURE__ */ jsx(Button, {
|
|
734
|
+
size: "sm",
|
|
735
|
+
variant: "primary",
|
|
736
|
+
disabled: busy,
|
|
737
|
+
className: "self-start",
|
|
738
|
+
onClick: () => grantOn(plan.grantable),
|
|
739
|
+
children: busy ? "Granting…" : `Grant all ${plan.grantable.length}`
|
|
740
|
+
}) : null,
|
|
741
|
+
plan ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(NamedList, {
|
|
742
|
+
label: "Documents you may not grant on",
|
|
743
|
+
heading: "You don't have permission to change grants on these:",
|
|
744
|
+
next: "Ask each document's admin to grant the Switchboard.",
|
|
745
|
+
ids: plan.noPermission,
|
|
746
|
+
names
|
|
747
|
+
}), /* @__PURE__ */ jsx(NamedList, {
|
|
748
|
+
label: "Documents not in this drive",
|
|
749
|
+
heading: "Not in this Connect, so they can't be granted from here:",
|
|
750
|
+
next: "Open the drive that holds them and grant there, or ask its admin.",
|
|
751
|
+
ids: plan.notHere,
|
|
752
|
+
names
|
|
753
|
+
})] }) : null
|
|
754
|
+
]
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region editors/connection-editor/ReactorConnectionSettings.tsx
|
|
759
|
+
function ReactorConnectionSettings(props) {
|
|
760
|
+
const parsed = parseReactorConnectionConfig(props.state.config);
|
|
761
|
+
const current = parsed.ok ? parsed.config : { endpoint: "local" };
|
|
762
|
+
const [error, setError] = useState(parsed.ok ? null : parsed.error);
|
|
763
|
+
const save = (patch) => {
|
|
764
|
+
const next = withReactorConfig(current, patch);
|
|
765
|
+
const check = parseReactorConnectionConfig(next);
|
|
766
|
+
if (!check.ok) {
|
|
767
|
+
setError(check.error);
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
setError(null);
|
|
771
|
+
props.callbacks.setReactorConfig(check.config);
|
|
772
|
+
};
|
|
773
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
774
|
+
className: "flex flex-col gap-5 border-t border-solid border-foreground/10 pt-5",
|
|
775
|
+
children: [
|
|
776
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
777
|
+
className: "text-[13px] font-semibold text-foreground",
|
|
778
|
+
children: "Reactor access"
|
|
779
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
780
|
+
className: "mt-0.5 text-xs text-muted-foreground",
|
|
781
|
+
children: "Each workflow's runs act as its last publisher, and reach only what this connection allows and that person may do."
|
|
782
|
+
})] }),
|
|
783
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
784
|
+
/* @__PURE__ */ jsx(FieldLabel$1, { label: "Access" }),
|
|
785
|
+
/* @__PURE__ */ jsx(Segmented, {
|
|
786
|
+
value: current.access === "read" ? "read" : "write",
|
|
787
|
+
options: [{
|
|
788
|
+
value: "write",
|
|
789
|
+
label: "Read and write"
|
|
790
|
+
}, {
|
|
791
|
+
value: "read",
|
|
792
|
+
label: "Read only"
|
|
793
|
+
}],
|
|
794
|
+
onChange: (value) => save({ access: value === "read" ? "read" : "write" })
|
|
795
|
+
}),
|
|
796
|
+
/* @__PURE__ */ jsx(Hint$1, { text: "Read only refuses every write, whatever the step declares." })
|
|
797
|
+
] }),
|
|
798
|
+
/* @__PURE__ */ jsx(FieldError, { children: error }),
|
|
799
|
+
/* @__PURE__ */ jsx(SwitchboardGrants, {})
|
|
800
|
+
]
|
|
801
|
+
});
|
|
802
|
+
}
|
|
305
803
|
//#endregion
|
|
306
804
|
//#region editors/connection-editor/connection-form.tsx
|
|
307
805
|
const inputClass = textInputClass;
|
|
@@ -690,6 +1188,7 @@ function methodLabel(plan) {
|
|
|
690
1188
|
}
|
|
691
1189
|
function ConnectionForm(props) {
|
|
692
1190
|
const { state, callbacks } = props;
|
|
1191
|
+
const reactor = isReactorConnectorId(state.connectorId);
|
|
693
1192
|
const catalogQuery = usePieceCatalog();
|
|
694
1193
|
const catalog = catalogQuery.data ?? (catalogQuery.isError ? [] : null);
|
|
695
1194
|
const packageName = packageFromConnectorId(state.connectorId);
|
|
@@ -719,10 +1218,14 @@ function ConnectionForm(props) {
|
|
|
719
1218
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
720
1219
|
/* @__PURE__ */ jsx(FieldLabel$1, { label: "Service" }),
|
|
721
1220
|
/* @__PURE__ */ jsx(Select, {
|
|
722
|
-
value: packageName,
|
|
1221
|
+
value: reactor ? REACTOR_CONNECTOR_ID : packageName,
|
|
723
1222
|
loading: catalog === null,
|
|
724
1223
|
placeholder: "Choose the service to connect",
|
|
725
|
-
options:
|
|
1224
|
+
options: [...props.offerReactor !== false || reactor ? [{
|
|
1225
|
+
value: REACTOR_CONNECTOR_ID,
|
|
1226
|
+
label: "Powerhouse documents",
|
|
1227
|
+
description: "Lets a step read or write documents on this Switchboard"
|
|
1228
|
+
}] : [], ...(catalog ?? []).map((entry) => ({
|
|
726
1229
|
value: entry.name,
|
|
727
1230
|
label: entry.displayName,
|
|
728
1231
|
...planFromAuth(entry.auth).authType === "UNKNOWN" ? {
|
|
@@ -735,15 +1238,23 @@ function ConnectionForm(props) {
|
|
|
735
1238
|
loading: "lazy",
|
|
736
1239
|
className: "h-4 w-4 shrink-0 object-contain"
|
|
737
1240
|
}) : void 0
|
|
738
|
-
})),
|
|
1241
|
+
}))],
|
|
739
1242
|
onChange: (name) => {
|
|
1243
|
+
if (name === "@powerhousedao/reactor#reactor") {
|
|
1244
|
+
callbacks.pickReactor();
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
740
1247
|
const picked = catalog?.find((entry) => entry.name === name);
|
|
741
1248
|
if (picked) callbacks.pickPiece(picked);
|
|
742
1249
|
}
|
|
743
1250
|
}),
|
|
744
1251
|
piece ? /* @__PURE__ */ jsx(Hint$1, { text: piece.description }) : null
|
|
745
1252
|
] }),
|
|
746
|
-
|
|
1253
|
+
reactor ? /* @__PURE__ */ jsx(ReactorConnectionSettings, {
|
|
1254
|
+
state,
|
|
1255
|
+
callbacks
|
|
1256
|
+
}) : null,
|
|
1257
|
+
!reactor && plans.length > 1 ? /* @__PURE__ */ jsxs("div", { children: [
|
|
747
1258
|
/* @__PURE__ */ jsx(FieldLabel$1, { label: "Sign in with" }),
|
|
748
1259
|
/* @__PURE__ */ jsx(Select, {
|
|
749
1260
|
value: plan.authType,
|
|
@@ -766,7 +1277,7 @@ function ConnectionForm(props) {
|
|
|
766
1277
|
}),
|
|
767
1278
|
plan.description ? /* @__PURE__ */ jsx(Hint$1, { text: plan.description }) : null
|
|
768
1279
|
] }) : null,
|
|
769
|
-
plan.supported ? null : /* @__PURE__ */ jsx("p", {
|
|
1280
|
+
plan.supported || reactor ? null : /* @__PURE__ */ jsx("p", {
|
|
770
1281
|
className: "rounded-md bg-wf-warn/10 px-3 py-2 text-xs text-wf-warn",
|
|
771
1282
|
children: plan.authType === "UNKNOWN" ? `${plan.declaredType ?? "This sign-in method"}: not supported by this runtime.` : `${plan.authType} connections are not executable by the workflow runtime yet.`
|
|
772
1283
|
}),
|
|
@@ -826,6 +1337,6 @@ function ConnectionForm(props) {
|
|
|
826
1337
|
});
|
|
827
1338
|
}
|
|
828
1339
|
//#endregion
|
|
829
|
-
export {
|
|
1340
|
+
export { useSignInGate as a, accessMismatch as c, CONNECTION_STATUS_STYLES as d, connectionCallbacks as f, newUndoGroup as g, groupedAction as h, useReactorAccessDenial as i, reactorConnections as l, UndoRedo as m, SignInPrompt as n, missingInPublished as o, BackButton as p, usePublisher as r, runsAsText as s, ConnectionForm as t, CONNECTION_STATUS_LABEL as u };
|
|
830
1341
|
|
|
831
|
-
//# sourceMappingURL=connection-form-
|
|
1342
|
+
//# sourceMappingURL=connection-form-DZFudcoD.mjs.map
|