@powerhousedao/workflow 6.2.3-dev.80 → 6.2.3-dev.82

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.
Files changed (181) hide show
  1. package/dist/browser/{BlockSelector-DFX-DZHl.js → BlockSelector-DHVzUGjW.js} +3 -3
  2. package/dist/browser/BlockSelector-DHVzUGjW.js.map +1 -0
  3. package/dist/browser/{connection-Ci_pI3kD.js → connection-PaKXHYz9.js} +2 -2
  4. package/dist/browser/{connection-Ci_pI3kD.js.map → connection-PaKXHYz9.js.map} +1 -1
  5. package/dist/browser/{connection-form-BuW6qOAF.js → connection-form-D2qAEHsl.js} +33 -13
  6. package/dist/browser/connection-form-D2qAEHsl.js.map +1 -0
  7. package/dist/browser/{data-tree-BLn565V5.js → data-tree-BOuPR-2J.js} +2 -2
  8. package/dist/browser/{data-tree-BLn565V5.js.map → data-tree-BOuPR-2J.js.map} +1 -1
  9. package/dist/browser/document-models/connection/index.js +2 -2
  10. package/dist/browser/document-models/index.js +3 -3
  11. package/dist/browser/document-models/workflow/index.js +2 -2
  12. package/dist/browser/{document-models-DUSvG-I2.js → document-models-DSK5cn8B.js} +6 -3
  13. package/dist/browser/{document-models-DUSvG-I2.js.map → document-models-DSK5cn8B.js.map} +1 -1
  14. package/dist/browser/{editor-NLSJ5rWx.js → editor--59WtNaj.js} +265 -84
  15. package/dist/browser/editor--59WtNaj.js.map +1 -0
  16. package/dist/browser/{editor-BhHN0OWh.js → editor-0XPrGeLT.js} +8 -8
  17. package/dist/browser/{editor-BhHN0OWh.js.map → editor-0XPrGeLT.js.map} +1 -1
  18. package/dist/browser/{editor-CnW8q20z.js → editor-BD-5ClkW.js} +6 -6
  19. package/dist/browser/{editor-CnW8q20z.js.map → editor-BD-5ClkW.js.map} +1 -1
  20. package/dist/browser/editors/connection-editor/module.js +1 -1
  21. package/dist/browser/editors/runtime/index.js +1 -1
  22. package/dist/browser/editors/workflow-editor/module.js +1 -1
  23. package/dist/browser/editors/workflow-studio/module.js +1 -1
  24. package/dist/browser/index.js +5 -5
  25. package/dist/browser/{module-FuSfFXPT.js → module-DJz6oTX0.js} +56 -56
  26. package/dist/browser/module-DJz6oTX0.js.map +1 -0
  27. package/dist/browser/{module-DxRdnkW2.js → module-eOpxJVIl.js} +2 -2
  28. package/dist/browser/{module-DxRdnkW2.js.map → module-eOpxJVIl.js.map} +1 -1
  29. package/dist/{node/piece-auth-BS5CtQOG.mjs → browser/piece-auth-63iuNFTs.js} +11 -3
  30. package/dist/browser/piece-auth-63iuNFTs.js.map +1 -0
  31. package/dist/browser/reactor/index.js +2 -2
  32. package/dist/browser/{runtime-queries-C9SoXGm2.js → runtime-queries-LAcyniYz.js} +18 -7
  33. package/dist/browser/runtime-queries-LAcyniYz.js.map +1 -0
  34. package/dist/browser/{trigger-text-BIeZ9W1H.js → trigger-text-Co-dn9x-.js} +4 -4
  35. package/dist/browser/trigger-text-Co-dn9x-.js.map +1 -0
  36. package/dist/browser/upgrade-manifests-CLYUPqBs.js +8 -0
  37. package/dist/browser/{upgrade-manifests-bahiFXsr.js.map → upgrade-manifests-CLYUPqBs.js.map} +1 -1
  38. package/dist/browser/{workflow-DZt1eS1f.js → workflow-Cn1UP-eJ.js} +2 -2
  39. package/dist/browser/{workflow-DZt1eS1f.js.map → workflow-Cn1UP-eJ.js.map} +1 -1
  40. package/dist/node/{BlockSelector-DosVPXzD.mjs → BlockSelector-D2UAnFpN.mjs} +3 -3
  41. package/dist/node/{BlockSelector-DosVPXzD.mjs.map → BlockSelector-D2UAnFpN.mjs.map} +1 -1
  42. package/dist/node/{connection-i6ISRY0F.mjs → connection-BZxipUlb.mjs} +2 -2
  43. package/dist/node/{connection-i6ISRY0F.mjs.map → connection-BZxipUlb.mjs.map} +1 -1
  44. package/dist/node/{connection-form-Z-pLxxrT.mjs → connection-form-Btmejfyn.mjs} +33 -13
  45. package/dist/node/connection-form-Btmejfyn.mjs.map +1 -0
  46. package/dist/node/{data-tree-CqBvXMpm.mjs → data-tree-rZiK2Ev-.mjs} +2 -2
  47. package/dist/node/{data-tree-CqBvXMpm.mjs.map → data-tree-rZiK2Ev-.mjs.map} +1 -1
  48. package/dist/node/document-models/connection/index.mjs +2 -2
  49. package/dist/node/document-models/index.mjs +2 -2
  50. package/dist/node/{editor-D9S3pWvR.mjs → editor-C_eWGGi8.mjs} +5 -5
  51. package/dist/node/{editor-D9S3pWvR.mjs.map → editor-C_eWGGi8.mjs.map} +1 -1
  52. package/dist/node/{editor-D4-ZHfHJ.mjs → editor-ChJMxbeM.mjs} +7 -7
  53. package/dist/node/{editor-D4-ZHfHJ.mjs.map → editor-ChJMxbeM.mjs.map} +1 -1
  54. package/dist/node/{editor-C3OhQ_xs.mjs → editor-U6trS0QO.mjs} +263 -82
  55. package/dist/node/editor-U6trS0QO.mjs.map +1 -0
  56. package/dist/node/editors/connection-editor/module.mjs +1 -1
  57. package/dist/node/editors/runtime/index.mjs +1 -1
  58. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  59. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  60. package/dist/node/index.mjs +7 -4
  61. package/dist/node/index.mjs.map +1 -1
  62. package/dist/node/{module-weVJEMpP.mjs → module-BEEASith.mjs} +56 -56
  63. package/dist/node/module-BEEASith.mjs.map +1 -0
  64. package/dist/{browser/piece-auth-BS5CtQOG.js → node/piece-auth-C0u0XTO8.mjs} +11 -3
  65. package/dist/node/piece-auth-C0u0XTO8.mjs.map +1 -0
  66. package/dist/node/pieces/ai/descriptor.json +788 -0
  67. package/dist/node/pieces/ai/index.mjs +401 -0
  68. package/dist/node/pieces/ai/package.json +9 -0
  69. package/dist/node/pieces/index.mjs +3 -0
  70. package/dist/node/pieces/index.mjs.map +1 -1
  71. package/dist/node/pieces/reactor/descriptor.json +1 -1
  72. package/dist/node/pieces/reactor/index.mjs +39 -250
  73. package/dist/node/pieces/reactor/package.json +1 -1
  74. package/dist/node/{runtime-queries-CJSpbsBq.mjs → runtime-queries-CmrHBPRw.mjs} +18 -7
  75. package/dist/node/runtime-queries-CmrHBPRw.mjs.map +1 -0
  76. package/dist/node/{trigger-text-CmYejeFN.mjs → trigger-text-CAiRCG2X.mjs} +4 -4
  77. package/dist/node/trigger-text-CAiRCG2X.mjs.map +1 -0
  78. package/dist/node/{upgrade-manifests-VF8Jt_YR.mjs → upgrade-manifests-C4akaA_X.mjs} +2 -2
  79. package/dist/node/{upgrade-manifests-VF8Jt_YR.mjs.map → upgrade-manifests-C4akaA_X.mjs.map} +1 -1
  80. package/dist/powerhouse.manifest.json +9 -1
  81. package/dist/style.css +1 -1
  82. package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
  83. package/dist/types/editors/connection-editor/piece-auth.d.ts +6 -1
  84. package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
  85. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  86. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  87. package/dist/types/editors/workflow-editor/runtime-client.d.ts +3 -1
  88. package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
  89. package/dist/types/editors/workflow-editor/runtime-context.d.ts +1 -1
  90. package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
  91. package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts +12 -0
  92. package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts.map +1 -0
  93. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +1 -0
  94. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  95. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  96. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  97. package/dist/types/editors/workflow-editor/ui/forms.d.ts +5 -0
  98. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  99. package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts +2 -0
  100. package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts.map +1 -0
  101. package/dist/types/editors/workflow-editor/ui/model.d.ts +1 -0
  102. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  103. package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts +8 -0
  104. package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts.map +1 -0
  105. package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts +2 -0
  106. package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts.map +1 -0
  107. package/dist/types/pieces/ai/ai-actions.test.d.ts +2 -0
  108. package/dist/types/pieces/ai/ai-actions.test.d.ts.map +1 -0
  109. package/dist/types/pieces/ai/ai-documents.test.d.ts +2 -0
  110. package/dist/types/pieces/ai/ai-documents.test.d.ts.map +1 -0
  111. package/dist/types/pieces/ai/ai.test.d.ts +2 -0
  112. package/dist/types/pieces/ai/ai.test.d.ts.map +1 -0
  113. package/dist/types/pieces/ai/index.d.ts +7 -0
  114. package/dist/types/pieces/ai/index.d.ts.map +1 -0
  115. package/dist/types/pieces/ai/lib/action-schema.d.ts +11 -0
  116. package/dist/types/pieces/ai/lib/action-schema.d.ts.map +1 -0
  117. package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts +38 -0
  118. package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts.map +1 -0
  119. package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts +45 -0
  120. package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts.map +1 -0
  121. package/dist/types/pieces/ai/lib/actions/decide.d.ts +39 -0
  122. package/dist/types/pieces/ai/lib/actions/decide.d.ts.map +1 -0
  123. package/dist/types/pieces/ai/lib/actions/extract.d.ts +41 -0
  124. package/dist/types/pieces/ai/lib/actions/extract.d.ts.map +1 -0
  125. package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts +55 -0
  126. package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts.map +1 -0
  127. package/dist/types/pieces/ai/lib/actions/summarize.d.ts +38 -0
  128. package/dist/types/pieces/ai/lib/actions/summarize.d.ts.map +1 -0
  129. package/dist/types/pieces/ai/lib/auth.d.ts +16 -0
  130. package/dist/types/pieces/ai/lib/auth.d.ts.map +1 -0
  131. package/dist/types/pieces/ai/lib/decision-model.d.ts +17 -0
  132. package/dist/types/pieces/ai/lib/decision-model.d.ts.map +1 -0
  133. package/dist/types/pieces/ai/lib/documents.d.ts +11 -0
  134. package/dist/types/pieces/ai/lib/documents.d.ts.map +1 -0
  135. package/dist/types/pieces/ai/lib/model-list.d.ts +8 -0
  136. package/dist/types/pieces/ai/lib/model-list.d.ts.map +1 -0
  137. package/dist/types/pieces/ai/lib/models.d.ts +19 -0
  138. package/dist/types/pieces/ai/lib/models.d.ts.map +1 -0
  139. package/dist/types/pieces/ai/lib/props.d.ts +16 -0
  140. package/dist/types/pieces/ai/lib/props.d.ts.map +1 -0
  141. package/dist/types/pieces/ai/lib/providers.d.ts +9 -0
  142. package/dist/types/pieces/ai/lib/providers.d.ts.map +1 -0
  143. package/dist/types/pieces/ai/lib/questions.d.ts +7 -0
  144. package/dist/types/pieces/ai/lib/questions.d.ts.map +1 -0
  145. package/dist/types/pieces/index.d.ts.map +1 -1
  146. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +4 -2
  147. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  148. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +4 -2
  149. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  150. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts +4 -2
  151. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
  152. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +4 -2
  153. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
  154. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +4 -2
  155. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
  156. package/dist/types/pieces/reactor/lib/actions/document-types.d.ts +3 -1
  157. package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -1
  158. package/dist/types/pieces/reactor/lib/actions/index-query.d.ts +4 -2
  159. package/dist/types/pieces/reactor/lib/actions/index-query.d.ts.map +1 -1
  160. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
  161. package/dist/types/pieces/reactor/lib/reactor.d.ts +12 -0
  162. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  163. package/dist/types/pieces/reactor/lib/writes.d.ts +7 -0
  164. package/dist/types/pieces/reactor/lib/writes.d.ts.map +1 -0
  165. package/dist/types/scripts/ui-stack.d.ts +8 -2
  166. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  167. package/package.json +15 -8
  168. package/dist/browser/BlockSelector-DFX-DZHl.js.map +0 -1
  169. package/dist/browser/connection-form-BuW6qOAF.js.map +0 -1
  170. package/dist/browser/editor-NLSJ5rWx.js.map +0 -1
  171. package/dist/browser/module-FuSfFXPT.js.map +0 -1
  172. package/dist/browser/piece-auth-BS5CtQOG.js.map +0 -1
  173. package/dist/browser/runtime-queries-C9SoXGm2.js.map +0 -1
  174. package/dist/browser/trigger-text-BIeZ9W1H.js.map +0 -1
  175. package/dist/browser/upgrade-manifests-bahiFXsr.js +0 -8
  176. package/dist/node/connection-form-Z-pLxxrT.mjs.map +0 -1
  177. package/dist/node/editor-C3OhQ_xs.mjs.map +0 -1
  178. package/dist/node/module-weVJEMpP.mjs.map +0 -1
  179. package/dist/node/piece-auth-BS5CtQOG.mjs.map +0 -1
  180. package/dist/node/runtime-queries-CJSpbsBq.mjs.map +0 -1
  181. package/dist/node/trigger-text-CmYejeFN.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-FuSfFXPT.js","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 RemoveConfigValueInput,\n RemoveSecretRefInput,\n SecretRef,\n SetAccountLabelInput,\n SetConfigInput,\n SetConfigValueInput,\n SetConnectionNameInput,\n SetConnectorInput,\n SetSecretRefInput,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const ConnectionAuthTypeSchema = z.enum([\n \"BASIC_AUTH\",\n \"CUSTOM_AUTH\",\n \"NONE\",\n \"OAUTH2\",\n \"OIDC\",\n \"REACTOR\",\n \"SECRET_TEXT\",\n]);\n\nexport const ConnectionStatusSchema = z.enum([\n \"ERROR\",\n \"OK\",\n \"REVOKED\",\n \"UNCONFIGURED\",\n]);\n\nexport function ConnectionStateSchema(): z.ZodObject<\n Properties<ConnectionState>\n> {\n return z.object({\n __typename: z.literal(\"ConnectionState\").optional(),\n accountLabel: z.string().nullish(),\n authType: ConnectionAuthTypeSchema,\n config: z.unknown(),\n connectorId: z.string(),\n lastCheckedAt: z.iso.datetime().nullish(),\n lastError: z.string().nullish(),\n name: z.string(),\n secretRefs: z.array(z.lazy(() => SecretRefSchema())),\n status: ConnectionStatusSchema,\n });\n}\n\nexport function ReactorConnectionConfigSchema(): z.ZodObject<\n Properties<ReactorConnectionConfig>\n> {\n return z.object({\n __typename: z.literal(\"ReactorConnectionConfig\").optional(),\n access: z.string().nullish(),\n endpoint: z.string(),\n });\n}\n\nexport function RecordCheckResultInputSchema(): z.ZodObject<\n Properties<RecordCheckResultInput>\n> {\n return z.object({\n checkedAt: z.iso.datetime(),\n error: z.string().nullish(),\n status: ConnectionStatusSchema,\n });\n}\n\nexport function RemoveConfigValueInputSchema(): z.ZodObject<\n Properties<RemoveConfigValueInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function RemoveSecretRefInputSchema(): z.ZodObject<\n Properties<RemoveSecretRefInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function SecretRefSchema(): z.ZodObject<Properties<SecretRef>> {\n return z.object({\n __typename: z.literal(\"SecretRef\").optional(),\n id: z.string(),\n name: z.string(),\n ref: z.string(),\n });\n}\n\nexport function SetAccountLabelInputSchema(): z.ZodObject<\n Properties<SetAccountLabelInput>\n> {\n return z.object({\n accountLabel: z.string().nullish(),\n });\n}\n\nexport function SetConfigInputSchema(): z.ZodObject<\n Properties<SetConfigInput>\n> {\n return z.object({\n config: z.unknown(),\n });\n}\n\nexport function SetConfigValueInputSchema(): z.ZodObject<\n Properties<SetConfigValueInput>\n> {\n return z.object({\n name: z.string(),\n value: z.unknown(),\n });\n}\n\nexport function SetConnectionNameInputSchema(): z.ZodObject<\n Properties<SetConnectionNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetConnectorInputSchema(): z.ZodObject<\n Properties<SetConnectorInput>\n> {\n return z.object({\n authType: ConnectionAuthTypeSchema,\n connectorId: z.string(),\n });\n}\n\nexport function SetSecretRefInputSchema(): z.ZodObject<\n Properties<SetSecretRefInput>\n> {\n return z.object({\n id: z.string(),\n name: z.string(),\n ref: z.string(),\n });\n}\n","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 RemoveConfigValueInputSchema,\n RemoveSecretRefInputSchema,\n SetConfigInputSchema,\n SetConfigValueInputSchema,\n SetSecretRefInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n RemoveConfigValueInput,\n RemoveSecretRefInput,\n SetConfigInput,\n SetConfigValueInput,\n SetSecretRefInput,\n} from \"../types.js\";\nimport type {\n RemoveConfigValueAction,\n RemoveSecretRefAction,\n SetConfigAction,\n SetConfigValueAction,\n SetSecretRefAction,\n} from \"./actions.js\";\n\nexport const setConfig = (input: SetConfigInput) =>\n createAction<SetConfigAction>(\n \"SET_CONFIG\",\n { ...input },\n undefined,\n SetConfigInputSchema,\n \"global\",\n );\n\nexport const setConfigValue = (input: SetConfigValueInput) =>\n createAction<SetConfigValueAction>(\n \"SET_CONFIG_VALUE\",\n { ...input },\n undefined,\n SetConfigValueInputSchema,\n \"global\",\n );\n\nexport const removeConfigValue = (input: RemoveConfigValueInput) =>\n createAction<RemoveConfigValueAction>(\n \"REMOVE_CONFIG_VALUE\",\n { ...input },\n undefined,\n RemoveConfigValueInputSchema,\n \"global\",\n );\n\nexport const setSecretRef = (input: SetSecretRefInput) =>\n createAction<SetSecretRefAction>(\n \"SET_SECRET_REF\",\n { ...input },\n undefined,\n SetSecretRefInputSchema,\n \"global\",\n );\n\nexport const removeSecretRef = (input: RemoveSecretRefInput) =>\n createAction<RemoveSecretRefAction>(\n \"REMOVE_SECRET_REF\",\n { ...input },\n undefined,\n RemoveSecretRefInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n SetAccountLabelInputSchema,\n SetConnectionNameInputSchema,\n SetConnectorInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n SetAccountLabelInput,\n SetConnectionNameInput,\n SetConnectorInput,\n} from \"../types.js\";\nimport type {\n SetAccountLabelAction,\n SetConnectionNameAction,\n SetConnectorAction,\n} from \"./actions.js\";\n\nexport const setConnectionName = (input: SetConnectionNameInput) =>\n createAction<SetConnectionNameAction>(\n \"SET_CONNECTION_NAME\",\n { ...input },\n undefined,\n SetConnectionNameInputSchema,\n \"global\",\n );\n\nexport const setConnector = (input: SetConnectorInput) =>\n createAction<SetConnectorAction>(\n \"SET_CONNECTOR\",\n { ...input },\n undefined,\n SetConnectorInputSchema,\n \"global\",\n );\n\nexport const setAccountLabel = (input: SetAccountLabelInput) =>\n createAction<SetAccountLabelAction>(\n \"SET_ACCOUNT_LABEL\",\n { ...input },\n undefined,\n SetAccountLabelInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { RecordCheckResultInputSchema } from \"../schema/zod.js\";\nimport type { RecordCheckResultInput } from \"../types.js\";\nimport type { RecordCheckResultAction } from \"./actions.js\";\n\nexport const recordCheckResult = (input: RecordCheckResultInput) =>\n createAction<RecordCheckResultAction>(\n \"RECORD_CHECK_RESULT\",\n { ...input },\n undefined,\n RecordCheckResultInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport {\n connectionConfigActions,\n connectionConnectionActions,\n connectionHealthActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the Connection document model */\n\nexport const actions = {\n ...baseActions,\n ...connectionConnectionActions,\n ...connectionConfigActions,\n ...connectionHealthActions,\n};\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/connection\",\n name: \"Connection\",\n author: {\n name: \"Powerhouse\",\n website: \"https://www.powerhouse.inc\",\n },\n extension: \".conn\",\n description:\n \"A configured connector instance: auth kind, non-secret config and secret handles, shared by many workflows.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n 'enum ConnectionAuthType {\\n SECRET_TEXT\\n BASIC_AUTH\\n CUSTOM_AUTH\\n OAUTH2\\n OIDC\\n NONE\\n \"Reactor access for a piece\\'s ctx.reactor; any piece may bind it.\"\\n REACTOR\\n}\\n\\nenum ConnectionStatus {\\n UNCONFIGURED\\n OK\\n ERROR\\n REVOKED\\n}\\n\\ntype SecretRef {\\n id: OID!\\n \"Matches an auth property name in the connector\\'s config schema.\"\\n name: String!\\n \"Opaque handle into the host secret provider. Not the secret.\"\\n ref: String!\\n}\\n\\n\"Config of a REACTOR connection. It holds no secrets.\"\\ntype ReactorConnectionConfig {\\n \"Which reactor the connection reaches; \\'local\\' is the only value.\"\\n endpoint: String!\\n \"\\'read\\' limits the connection to reads; absent allows what the step declares.\"\\n access: String\\n}\\n\\ntype ConnectionState {\\n name: String!\\n \"Fully-qualified connector id: \\'@acme/connector-imap#imap\\'.\"\\n connectorId: String!\\n \"Activepieces auth kind, so a piece\\'s PieceAuth maps directly.\"\\n authType: ConnectionAuthType!\\n \"Non-secret configuration, validated against the connector\\'s auth schema; a ReactorConnectionConfig for REACTOR.\"\\n config: Unknown!\\n \"Secret handles; values never appear in state, operations, or the run journal.\"\\n secretRefs: [SecretRef!]!\\n status: ConnectionStatus!\\n lastCheckedAt: DateTime\\n lastError: String\\n \"Populated by the connector\\'s own metadata call. Display only.\"\\n accountLabel: String\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": \"\",\\n \"connectorId\": \"\",\\n \"authType\": \"NONE\",\\n \"config\": {},\\n \"secretRefs\": [],\\n \"status\": \"UNCONFIGURED\",\\n \"lastCheckedAt\": null,\\n \"lastError\": null,\\n \"accountLabel\": null\\n}',\n },\n },\n modules: [\n {\n id: \"d723a91b-329c-46c3-acbf-85533c47b5a4\",\n name: \"connection\",\n description: \"Connection identity and connector binding.\",\n operations: [\n {\n id: \"ece5a33d-0bc1-46ff-87f4-c763d298cb3a\",\n name: \"SET_CONNECTION_NAME\",\n description: \"Sets the connection's display name.\",\n schema: \"input SetConnectionNameInput {\\n name: String!\\n}\",\n template: \"Sets the connection's display name.\",\n reducer: \"state.name = action.input.name;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"e668be97-82c8-433e-8af7-1644cfa25723\",\n name: \"SET_CONNECTOR\",\n description:\n \"Binds the connection to a connector and auth kind; resets status to UNCONFIGURED. REACTOR goes only with the reserved reactor connector id.\",\n schema:\n \"input SetConnectorInput {\\n connectorId: String!\\n authType: ConnectionAuthType!\\n}\",\n template:\n \"Binds the connection to a connector and auth kind; resets status to UNCONFIGURED.\",\n reducer:\n 'state.connectorId = action.input.connectorId;\\nstate.authType = action.input.authType;\\nstate.status = \"UNCONFIGURED\";',\n errors: [\n {\n id: \"6e550820-9d17-447d-9378-a17d38262bc8\",\n name: \"ReservedConnectorError\",\n code: \"RESERVED_CONNECTOR\",\n description:\n \"The reserved reactor connector id goes only with authType REACTOR, and REACTOR only with it.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"01a28e56-4406-4160-9547-f6239e728afd\",\n name: \"SET_ACCOUNT_LABEL\",\n description: \"Sets or clears the display-only account label.\",\n schema:\n \"input SetAccountLabelInput {\\n accountLabel: String\\n}\",\n template: \"Sets or clears the display-only account label.\",\n reducer:\n \"state.accountLabel = action.input.accountLabel || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"728ec59f-db15-4c52-aa9d-fbe1a6d6a6f9\",\n name: \"config\",\n description: \"Non-secret configuration and secret handles.\",\n operations: [\n {\n id: \"c26f7cd8-c280-4e85-be65-83c3c1217358\",\n name: \"SET_CONFIG\",\n description: \"Replaces the non-secret configuration.\",\n schema: \"input SetConfigInput {\\n config: Unknown!\\n}\",\n template: \"Replaces the non-secret configuration.\",\n reducer: \"state.config = action.input.config;\",\n errors: [\n {\n id: \"b9911ea4-4168-4080-b05e-8687928dc309\",\n name: \"InvalidReactorConfigError\",\n code: \"INVALID_REACTOR_CONFIG\",\n description:\n \"A REACTOR connection's config is not a valid ReactorConnectionConfig.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"32f1c6e9-1bba-4c99-bd20-311b16f95fa9\",\n name: \"SET_CONFIG_VALUE\",\n description:\n \"Sets one non-secret config field, leaving the others as they are.\",\n schema:\n \"input SetConfigValueInput {\\n name: String!\\n value: Unknown!\\n}\",\n template:\n \"Sets one non-secret config field, leaving the others as they are.\",\n reducer: \"\",\n errors: [\n {\n id: \"6db3a25a-a3b2-4751-9470-3c122ff9abcd\",\n name: \"InvalidReactorConfigValueError\",\n code: \"INVALID_REACTOR_CONFIG_VALUE\",\n description:\n \"The field would leave a REACTOR connection's config invalid.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"bcb390f6-f8fc-4a09-99e6-1d84b272d7b6\",\n name: \"REMOVE_CONFIG_VALUE\",\n description:\n \"Removes one non-secret config field. Removing an absent field changes nothing.\",\n schema: \"input RemoveConfigValueInput {\\n name: String!\\n}\",\n template:\n \"Removes one non-secret config field. Removing an absent field changes nothing.\",\n reducer: \"\",\n errors: [\n {\n id: \"24496230-4088-4994-a6d5-b7651c718f63\",\n name: \"InvalidReactorConfigRemovalError\",\n code: \"INVALID_REACTOR_CONFIG_REMOVAL\",\n description:\n \"The removal would leave a REACTOR connection's config invalid.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"1a90e020-6dc5-49e0-9be1-732028dd10d3\",\n name: \"SET_SECRET_REF\",\n description:\n \"Creates or updates a secret handle, keyed by its auth property name.\",\n schema:\n \"input SetSecretRefInput {\\n id: OID!\\n name: String!\\n ref: String!\\n}\",\n template:\n \"Creates or updates a secret handle, keyed by its auth property name.\",\n reducer:\n \"const existing = state.secretRefs.find(\\n (secretRef) => secretRef.name === action.input.name,\\n);\\nif (existing) {\\n existing.ref = action.input.ref;\\n} else {\\n state.secretRefs.push({\\n id: action.input.id,\\n name: action.input.name,\\n ref: action.input.ref,\\n });\\n}\",\n errors: [\n {\n id: \"e3c42e5b-80c6-4020-8cfd-2ccc797d82b7\",\n name: \"ReactorSecretRefError\",\n code: \"REACTOR_SECRET_REF\",\n description: \"A REACTOR connection holds no secrets.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"0c7214b1-0494-49d8-913f-39ad59ca2a3b\",\n name: \"REMOVE_SECRET_REF\",\n description: \"Removes a secret handle.\",\n schema: \"input RemoveSecretRefInput {\\n id: OID!\\n}\",\n template: \"Removes a secret handle.\",\n reducer:\n 'const index = state.secretRefs.findIndex(\\n (secretRef) => secretRef.id === action.input.id,\\n);\\nif (index === -1) {\\n throw new SecretRefNotFoundError(\"Secret ref not found\");\\n}\\nstate.secretRefs.splice(index, 1);',\n errors: [\n {\n id: \"0c5d799d-d71d-4a75-ab0e-136ea72f1a3b\",\n name: \"SecretRefNotFoundError\",\n code: \"SECRET_REF_NOT_FOUND\",\n description: \"No secret ref exists with the given id.\",\n template: \"\",\n },\n ],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"3b02be29-0e8b-400d-ba05-1305e28c86b5\",\n name: \"health\",\n description: \"Connection health, written by connector checks.\",\n operations: [\n {\n id: \"2e8e9df7-3939-425c-9e28-7c8fa5de7d3f\",\n name: \"RECORD_CHECK_RESULT\",\n description:\n \"Records the outcome of a connection check, including revocation.\",\n schema:\n \"input RecordCheckResultInput {\\n status: ConnectionStatus!\\n checkedAt: DateTime!\\n error: String\\n}\",\n template:\n \"Records the outcome of a connection check, including revocation.\",\n reducer:\n \"state.status = action.input.status;\\nstate.lastCheckedAt = action.input.checkedAt;\\nstate.lastError = action.input.error || null;\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","export type ErrorCode =\n | \"InvalidReactorConfigError\"\n | \"InvalidReactorConfigValueError\"\n | \"InvalidReactorConfigRemovalError\"\n | \"ReactorSecretRefError\"\n | \"SecretRefNotFoundError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class InvalidReactorConfigError extends Error implements ReducerError {\n errorCode = \"InvalidReactorConfigError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigError\") {\n super(message);\n }\n}\n\nexport class InvalidReactorConfigValueError\n extends Error\n implements ReducerError\n{\n errorCode = \"InvalidReactorConfigValueError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigValueError\") {\n super(message);\n }\n}\n\nexport class InvalidReactorConfigRemovalError\n extends Error\n implements ReducerError\n{\n errorCode = \"InvalidReactorConfigRemovalError\" as ErrorCode;\n constructor(message = \"InvalidReactorConfigRemovalError\") {\n super(message);\n }\n}\n\nexport class ReactorSecretRefError extends Error implements ReducerError {\n errorCode = \"ReactorSecretRefError\" as ErrorCode;\n constructor(message = \"ReactorSecretRefError\") {\n super(message);\n }\n}\n\nexport class SecretRefNotFoundError extends Error implements ReducerError {\n errorCode = \"SecretRefNotFoundError\" as ErrorCode;\n constructor(message = \"SecretRefNotFoundError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetConfig: { InvalidReactorConfigError },\n\n SetConfigValue: { InvalidReactorConfigValueError },\n\n RemoveConfigValue: { InvalidReactorConfigRemovalError },\n\n SetSecretRef: { ReactorSecretRefError },\n\n RemoveSecretRef: { SecretRefNotFoundError },\n};\n","import type { ConnectionConfigOperations } from \"document-models/connection/v1\";\nimport {\n InvalidReactorConfigError,\n InvalidReactorConfigRemovalError,\n InvalidReactorConfigValueError,\n ReactorSecretRefError,\n SecretRefNotFoundError,\n} from \"../../gen/config/error.js\";\nimport { parseReactorConnectionConfig } from \"../reactor-connection.js\";\n\nexport const connectionConfigOperations: ConnectionConfigOperations = {\n setConfigOperation(state, action) {\n if (state.authType !== \"REACTOR\") {\n state.config = action.input.config;\n return;\n }\n const parsed = parseReactorConnectionConfig(action.input.config);\n if (!parsed.ok) throw new InvalidReactorConfigError(parsed.error);\n state.config = parsed.config;\n },\n setSecretRefOperation(state, action) {\n if (state.authType === \"REACTOR\") {\n throw new ReactorSecretRefError(\"A reactor connection holds no secrets\");\n }\n const existing = state.secretRefs.find(\n (secretRef) => secretRef.name === action.input.name,\n );\n if (existing) {\n existing.ref = action.input.ref;\n } else {\n state.secretRefs.push({\n id: action.input.id,\n name: action.input.name,\n ref: action.input.ref,\n });\n }\n },\n removeSecretRefOperation(state, action) {\n const index = state.secretRefs.findIndex(\n (secretRef) => secretRef.id === action.input.id,\n );\n if (index === -1) {\n throw new SecretRefNotFoundError(\"Secret ref not found\");\n }\n state.secretRefs.splice(index, 1);\n },\n setConfigValueOperation(state, action) {\n const { name, value } = action.input;\n const config = { ...configRecord(state.config) };\n if (value === undefined) delete config[name];\n else config[name] = value;\n if (state.authType !== \"REACTOR\") {\n state.config = config;\n return;\n }\n const parsed = parseReactorConnectionConfig(config);\n if (!parsed.ok) throw new InvalidReactorConfigValueError(parsed.error);\n state.config = parsed.config;\n },\n removeConfigValueOperation(state, action) {\n const current = configRecord(state.config);\n if (!(action.input.name in current)) return;\n const { [action.input.name]: _removed, ...config } = current;\n if (state.authType !== \"REACTOR\") {\n state.config = config;\n return;\n }\n const parsed = parseReactorConnectionConfig(config);\n if (!parsed.ok) throw new InvalidReactorConfigRemovalError(parsed.error);\n state.config = parsed.config;\n },\n};\n\n// A config that is not an object holds no fields to keep.\nfunction configRecord(config: unknown): Record<string, unknown> {\n return config !== null && typeof config === \"object\" && !Array.isArray(config)\n ? (config as Record<string, unknown>)\n : {};\n}\n","export type ErrorCode = \"ReservedConnectorError\";\n\nexport interface ReducerError {\n errorCode: ErrorCode;\n}\n\nexport class ReservedConnectorError extends Error implements ReducerError {\n errorCode = \"ReservedConnectorError\" as ErrorCode;\n constructor(message = \"ReservedConnectorError\") {\n super(message);\n }\n}\n\nexport const errors = {\n SetConnector: { ReservedConnectorError },\n};\n","import type { ConnectionConnectionOperations } from \"document-models/connection/v1\";\nimport { ReservedConnectorError } from \"../../gen/connection/error.js\";\nimport {\n defaultReactorConnectionConfig,\n isReactorConnectorId,\n} from \"../reactor-connection.js\";\n\nexport const connectionConnectionOperations: ConnectionConnectionOperations = {\n setConnectionNameOperation(state, action) {\n state.name = action.input.name;\n },\n setConnectorOperation(state, action) {\n const reactor = action.input.authType === \"REACTOR\";\n if (reactor !== isReactorConnectorId(action.input.connectorId)) {\n throw new ReservedConnectorError(\n \"The reactor connector id goes only with authType REACTOR\",\n );\n }\n const rebinding = action.input.connectorId !== state.connectorId;\n state.connectorId = action.input.connectorId;\n state.authType = action.input.authType;\n state.status = \"UNCONFIGURED\";\n // A different connector invalidates the old one's config/secrets/health;\n // a same-connector call (e.g. re-declaring authType) leaves them alone.\n if (rebinding) {\n state.config = reactor ? defaultReactorConnectionConfig() : {};\n state.secretRefs = [];\n state.accountLabel = null;\n state.lastCheckedAt = null;\n state.lastError = null;\n }\n },\n setAccountLabelOperation(state, action) {\n state.accountLabel = action.input.accountLabel || null;\n },\n};\n","import type { ConnectionHealthOperations } from \"document-models/connection/v1\";\n\nexport const connectionHealthOperations: ConnectionHealthOperations = {\n recordCheckResultOperation(state, action) {\n state.status = action.input.status;\n state.lastCheckedAt = action.input.checkedAt;\n state.lastError = action.input.error || null;\n },\n};\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { ConnectionPHState } from \"document-models/connection/v1\";\n\nimport { connectionConfigOperations } from \"../src/reducers/config.js\";\nimport { connectionConnectionOperations } from \"../src/reducers/connection.js\";\nimport { connectionHealthOperations } from \"../src/reducers/health.js\";\n\nimport {\n RecordCheckResultInputSchema,\n RemoveConfigValueInputSchema,\n RemoveSecretRefInputSchema,\n SetAccountLabelInputSchema,\n SetConfigInputSchema,\n SetConfigValueInputSchema,\n SetConnectionNameInputSchema,\n SetConnectorInputSchema,\n SetSecretRefInputSchema,\n} from \"./schema/zod.js\";\n\nconst schemaMemo = new Map<() => unknown, unknown>();\n\nfunction memoizedSchema<T>(makeSchema: () => T): T {\n let schema = schemaMemo.get(makeSchema) as T | undefined;\n if (schema === undefined) {\n schema = makeSchema();\n schemaMemo.set(makeSchema, schema);\n }\n return schema;\n}\n\nconst stateReducer: StateReducer<ConnectionPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_CONNECTION_NAME\": {\n memoizedSchema(SetConnectionNameInputSchema).parse(action.input);\n\n connectionConnectionOperations.setConnectionNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONNECTOR\": {\n memoizedSchema(SetConnectorInputSchema).parse(action.input);\n\n connectionConnectionOperations.setConnectorOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_ACCOUNT_LABEL\": {\n memoizedSchema(SetAccountLabelInputSchema).parse(action.input);\n\n connectionConnectionOperations.setAccountLabelOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONFIG\": {\n memoizedSchema(SetConfigInputSchema).parse(action.input);\n\n connectionConfigOperations.setConfigOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_CONFIG_VALUE\": {\n memoizedSchema(SetConfigValueInputSchema).parse(action.input);\n\n connectionConfigOperations.setConfigValueOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_CONFIG_VALUE\": {\n memoizedSchema(RemoveConfigValueInputSchema).parse(action.input);\n\n connectionConfigOperations.removeConfigValueOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_SECRET_REF\": {\n memoizedSchema(SetSecretRefInputSchema).parse(action.input);\n\n connectionConfigOperations.setSecretRefOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_SECRET_REF\": {\n memoizedSchema(RemoveSecretRefInputSchema).parse(action.input);\n\n connectionConfigOperations.removeSecretRefOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"RECORD_CHECK_RESULT\": {\n memoizedSchema(RecordCheckResultInputSchema).parse(action.input);\n\n connectionHealthOperations.recordCheckResultOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<ConnectionPHState> = createReducer(stateReducer);\n","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":";;;;;AA0BA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM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A,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,IAAI;IACJ,MAAM;IACN,aAAa;IACb,YAAY;KACV;MACE,IAAI;MACJ,MAAM;MACN,aAAa;MACb,QAAQ;MACR,UAAU;MACV,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ,CACF;MACA,UAAU,CAAC;MACX,OAAO;KACT;KACA;MACE,IAAI;MACJ,MAAM;MACN,aACE;MACF,QACE;MACF,UACE;MACF,SAAS;MACT,QAAQ,CACN;OACE,IAAI;OACJ,MAAM;OACN,MAAM;OACN,aACE;OACF,UAAU;MACZ,CACF;MACA,UA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QAAQ;IAAE,GAAG;IAAoB,GAAG,OAAO;GAAO;GAClD,OAAO;IAAE,GAAG;IAAmB,GAAG,OAAO;GAAM;EACjD;CACF;CACA,eAAe,OAAO;EACpB,OAAO,mBAAmBA,QAAM,aAAa,OAAO,sBAAsB;CAC5E;CACA,iBAAiB,UAAU,OAAO;EAChC,OAAO,qBAAqB,UAAU,KAAK;CAC7C;CACA,cAAc,OAAO;EACnB,OAAO,2BAA2B,OAAO;GACvC,UAAU,EAAE,GAAG,QAA2C;GAC1D,iBAAiB;EACnB,CAAC;CACH;CACA,cAAc,OAAO;EACnB,OAAO,kBAAkB,KAAK;CAChC;CACA,oBAAoB,OAAO;EACzB,OAAO,wBAAwB,KAAK;CACtC;CACA,iBAAiB,UAAU;EACzB,OAAO,qBAAqB,QAAQ;CACtC;CACA,uBAAuB,UAAU;EAC/B,OAAO,2BAA2B,QAAQ;CAC5C;AACF;;;;;;;;;;;;;AE9DA,MAAa,QAA+C;CAC1D,GAAGC;CACH,GAAGC;AACL;;;;ACAA,MAAa,aAAa;CACxB,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"piece-auth-BS5CtQOG.js","names":[],"sources":["../../editors/connection-editor/piece-auth.ts"],"sourcesContent":["// Turns a piece's PieceAuth descriptor into a concrete field plan that maps\n// onto powerhouse/connection state: config fields vs secret refs.\nimport type { ConnectionAuthType } from \"document-models/connection\";\n\nexport interface AuthField {\n name: string;\n displayName: string;\n required: boolean;\n description?: string;\n // Non-secret fields only: SHORT_TEXT | NUMBER | CHECKBOX | STATIC_DROPDOWN.\n inputType?: string;\n options?: { label: string; value: unknown }[];\n}\n\n// A piece auth type this runtime doesn't know: shown, never saved.\nexport const UNKNOWN_AUTH = \"UNKNOWN\";\n\nexport interface AuthPlan {\n authType: ConnectionAuthType | typeof UNKNOWN_AUTH;\n displayName?: string;\n description?: string;\n configFields: AuthField[];\n secretFields: AuthField[];\n // OIDC is declared but not executable by the runtime yet.\n supported: boolean;\n // Signed in through the provider; the token is stored by the switchboard.\n oauth2?: boolean;\n // The piece's own name for an UNKNOWN auth type.\n declaredType?: string;\n}\n\n// Missing means unset, explicitly null, or emptied to \"\" - not `false`/`0`.\nexport function isConfigValueMissing(value: unknown): boolean {\n return value === undefined || value === null || value === \"\";\n}\n\n// Whether every required config/secret field of the plan is filled; pure so\n// it can drive a live re-check as the user edits, not just a one-time mark.\nexport function isAuthComplete(\n plan: AuthPlan,\n config: Record<string, unknown>,\n refs: Map<string, string>,\n): boolean {\n const configOk = plan.configFields.every(\n (field) => !field.required || !isConfigValueMissing(config[field.name]),\n );\n const secretsOk = plan.secretFields.every(\n (field) => !field.required || Boolean(refs.get(field.name)),\n );\n return configOk && secretsOk;\n}\n\ninterface AuthPropDescriptor {\n displayName?: string;\n description?: string;\n required?: boolean;\n type?: string;\n options?: { options?: { label?: string; value?: unknown }[] };\n}\n\ninterface PieceAuthDescriptor {\n type?: string;\n unsupported?: string;\n displayName?: string;\n description?: string;\n required?: boolean;\n // A record in a published listing; a named list from a loaded piece.\n props?:\n | Partial<Record<string, AuthPropDescriptor>>\n | (AuthPropDescriptor & { name?: string })[];\n}\n\n// Names the connection's config and secretRefs use for an OAuth2 app.\nexport const OAUTH_CLIENT_ID = \"client_id\";\nexport const OAUTH_CLIENT_SECRET = \"client_secret\";\nexport const OAUTH_TOKEN = \"token\";\n\nfunction propEntries(\n props: PieceAuthDescriptor[\"props\"],\n): [string, AuthPropDescriptor][] {\n if (Array.isArray(props)) {\n return props.flatMap((prop) => (prop.name ? [[prop.name, prop]] : []));\n }\n return Object.entries(props ?? {}).filter(\n (entry): entry is [string, AuthPropDescriptor] => entry[1] !== undefined,\n );\n}\n\nfunction toField(name: string, prop: AuthPropDescriptor): AuthField {\n return {\n name,\n displayName: prop.displayName ?? name,\n required: prop.required ?? false,\n description: prop.description,\n inputType: prop.type,\n options: prop.options?.options\n ?.filter((option) => option.value !== undefined)\n .map((option) => ({\n label: option.label ?? String(option.value as string),\n value: option.value,\n })),\n };\n}\n\n// Every sign-in method a piece offers, in its order, one per auth type.\nexport function plansFromAuth(auth: unknown): AuthPlan[] {\n const plans = (Array.isArray(auth) ? auth : [auth]).map(planFromAuth);\n return plans.filter(\n (plan, index) =>\n plans.findIndex((other) => other.authType === plan.authType) === index,\n );\n}\n\n// The method a connection signs in with: the one of its auth type when the\n// runtime can run it, otherwise the piece's default.\nexport function planForConnection(\n auth: unknown,\n authType: ConnectionAuthType,\n): AuthPlan {\n return (\n plansFromAuth(auth).find(\n (plan) => plan.authType === authType && plan.supported,\n ) ?? planFromAuth(auth)\n );\n}\n\nexport function planFromAuth(auth: unknown): AuthPlan {\n // Some pieces declare multiple auth methods; prefer one the runtime supports.\n if (Array.isArray(auth)) {\n const plans = auth.map(planFromAuth);\n return (\n plans.find((plan) => plan.supported && plan.authType !== \"NONE\") ??\n plans.at(0) ??\n planFromAuth(null)\n );\n }\n const descriptor = (auth ?? null) as PieceAuthDescriptor | null;\n const plan = planForDescriptor(descriptor);\n // The runtime's own verdict, e.g. a CUSTOM_AUTH that needs token refresh.\n return descriptor?.unsupported ? { ...plan, supported: false } : plan;\n}\n\nfunction planForDescriptor(descriptor: PieceAuthDescriptor | null): AuthPlan {\n const base = {\n displayName: descriptor?.displayName,\n description: descriptor?.description,\n };\n switch (descriptor?.type) {\n case \"SECRET_TEXT\":\n return {\n ...base,\n authType: \"SECRET_TEXT\",\n configFields: [],\n secretFields: [\n {\n name: \"value\",\n displayName: descriptor.displayName ?? \"Secret\",\n required: descriptor.required ?? true,\n description: descriptor.description,\n },\n ],\n supported: true,\n };\n case \"BASIC_AUTH\": {\n const props: Partial<Record<string, AuthPropDescriptor>> =\n Object.fromEntries(propEntries(descriptor.props));\n return {\n ...base,\n authType: \"BASIC_AUTH\",\n configFields: [\n toField(\"username\", props.username ?? { displayName: \"Username\" }),\n ],\n secretFields: [\n toField(\"password\", props.password ?? { displayName: \"Password\" }),\n ],\n supported: true,\n };\n }\n case \"CUSTOM_AUTH\": {\n const entries = propEntries(descriptor.props);\n return {\n ...base,\n authType: \"CUSTOM_AUTH\",\n configFields: entries\n .filter(([, prop]) => prop.type !== \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n secretFields: entries\n .filter(([, prop]) => prop.type === \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n supported: true,\n };\n }\n case \"OAUTH2\": {\n const entries = propEntries(descriptor.props);\n return {\n ...base,\n authType: \"OAUTH2\",\n configFields: [\n {\n name: OAUTH_CLIENT_ID,\n displayName: \"Client ID\",\n required: true,\n description: \"From the OAuth app you registered with the service.\",\n },\n ...entries\n .filter(([, prop]) => prop.type !== \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n ],\n secretFields: [\n {\n name: OAUTH_CLIENT_SECRET,\n displayName: \"Client secret\",\n required: true,\n },\n ...entries\n .filter(([, prop]) => prop.type === \"SECRET_TEXT\")\n .map(([name, prop]) => toField(name, prop)),\n ],\n supported: true,\n oauth2: true,\n };\n }\n case \"OIDC\":\n return {\n ...base,\n authType: \"OIDC\",\n configFields: [],\n secretFields: [],\n supported: false,\n };\n case undefined:\n case \"NONE\":\n return {\n ...base,\n authType: \"NONE\",\n configFields: [],\n secretFields: [],\n supported: true,\n };\n default:\n return {\n ...base,\n authType: UNKNOWN_AUTH,\n declaredType: descriptor?.type,\n configFields: [],\n secretFields: [],\n supported: false,\n };\n }\n}\n\n// \"@activepieces/piece-gotify\" -> \"@activepieces/piece-gotify#gotify\"\nexport function connectorIdForPiece(packageName: string): string {\n const short =\n packageName\n .split(\"/\")\n .pop()\n ?.replace(/^piece-/, \"\") ?? packageName;\n return `${packageName}#${short}`;\n}\n\n// \"<piece package>#<short name>\" -> the package; a bare name is its own.\nexport function packageFromConnectorId(connectorId: string): string {\n const separator = connectorId.lastIndexOf(\"#\");\n if (separator <= 0) return connectorId;\n const spec = connectorId.slice(0, separator);\n const at =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SAAS;CAC3C,MAAM,KAAK,KAAK,QAAQ,KAAK,CAAC;CAC9B,OAAO,KAAK,IAAI,KAAK,MAAM,GAAG,EAAE,IAAI;AACtC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-queries-C9SoXGm2.js","names":[],"sources":["../../editors/workflow-editor/ui/forms.ts","../../editors/workflow-editor/ui/blocks.ts","../../editors/workflow-editor/runtime-client.ts","../../editors/workflow-editor/run-kinds.ts","../../editors/workflow-editor/ui/query-keys.ts","../../editors/workflow-editor/runtime-queries.ts"],"sourcesContent":["// Form descriptors driving property panels; pure data, mirrors the\n// ConnectorPropDescriptor shape from the workflow runtime.\nimport type { BlockRef } from \"@powerhousedao/pieces-framework/block-type\";\nimport type { TriggerDelivery } from \"@powerhousedao/pieces-framework/workflow\";\n\nexport interface BlockFormProp {\n name: string;\n displayName: string;\n type: string;\n required: boolean;\n defaultValue?: unknown;\n staticOptions?: FormOption[];\n // A STATIC_DROPDOWN's own state, beside its options.\n staticDisabled?: boolean;\n staticPlaceholder?: string;\n hasDynamicResolver?: boolean;\n description?: string;\n placeholder?: string;\n // Sibling prop names whose values feed the resolver; a change re-runs it.\n refreshers?: string[];\n // Nested shape: ARRAY item fields, or what a DYNAMIC resolver produced.\n properties?: BlockFormProp[];\n // Folded behind \"Advanced\": fields with a working default, so the common\n // case is short. Opens expanded when set, else live config would be hidden.\n advanced?: boolean;\n // Shown only while a sibling prop holds one of these values; data, not a\n // predicate, so a form arriving as JSON can express it.\n showWhen?: { prop: string; oneOf: unknown[] };\n // Activepieces layout and control hints, as the piece declared them.\n width?: \"half\" | \"full\";\n icon?: string;\n // CHECKBOX: sibling props shown only while it is checked.\n reveals?: string[];\n // MARKDOWN: BORDERLESS | INFO | WARNING | TIP.\n variant?: string;\n // STATIC_DROPDOWN \"cards\", NUMBER \"stepper\", DATE_RANGE \"dropdown\",\n // LONG_TEXT \"code\" (monospace).\n display?: string;\n min?: number;\n max?: number;\n step?: number;\n // DROPDOWN: options() is re-run with what the author types.\n refreshOnSearch?: boolean;\n // RICH_TEXT: the sibling whose value picks plain, markdown or html.\n formatProperty?: string;\n // SHORT_TEXT: a checkbox with this label that stores \"\" on purpose.\n emptyChoice?: string;\n}\n\nexport interface FormOption {\n label: string;\n value: unknown;\n description?: string;\n icon?: string;\n}\n\nexport interface PropertyGroup {\n key: string;\n // tabs | section | summary | builder | footer\n display: string;\n label?: string;\n description?: string;\n icon?: string;\n props: string[];\n}\n\nexport interface ErrorHandlingDefaults {\n retryOnFailure?: { defaultValue?: boolean; hide?: boolean };\n continueOnFailure?: { defaultValue?: boolean; hide?: boolean };\n}\n\nexport interface BlockForm {\n title: string;\n requireAuth: boolean;\n // The block needs a reactor connection granting this much.\n requireReactor?: \"read\" | \"write\";\n // Whether the block takes a connection: none hides the field entirely.\n auth?: \"none\" | \"optional\" | \"required\";\n props: BlockFormProp[];\n // Output ports the block declares; edges on any other are never taken.\n ports?: readonly string[];\n // A form drawn instead of the props, e.g. \"schedule\" for the builder.\n display?: string;\n // Triggers only, from checkTriggerStrategy. A webhook trigger is fed by a\n // request, so the panel shows its endpoint URL.\n triggerDelivery?: TriggerDelivery;\n // What the step does, as the piece describes it.\n description?: string;\n propertyGroups?: PropertyGroup[];\n // READ | SEARCH | WRITE | DESTRUCTIVE\n classification?: string;\n errorHandling?: ErrorHandlingDefaults;\n}\n\nexport interface ConnectionSummary {\n id: string;\n name: string;\n connectorId: string;\n authType: string;\n status: string;\n accountLabel: string | null;\n}\n\nexport interface SecretStat {\n ref: string;\n label: string | null;\n version: number;\n status: string;\n createdAt: string;\n updatedAt: string;\n}\n\n// Minting seam for PH_SECRET_REF props: the field takes a value and the\n// document only ever receives the ref that comes back.\nexport interface SecretFormService {\n save: (input: {\n ref?: string;\n value: string;\n label: string;\n }) => Promise<SecretStat>;\n stat: (ref: string) => Promise<SecretStat | null>;\n}\n\nexport interface WebhookEndpoint {\n workflowId: string;\n url: string;\n // False when `url` is a bare path because the reactor has no public origin.\n absoluteUrl: boolean;\n armed: boolean;\n createdAt: string;\n}\n\nexport interface DesignTimeService {\n getBlockForm: (block: BlockRef) => Promise<BlockForm | null>;\n loadOptions: (\n block: BlockRef,\n propName: string,\n input: Record<string, unknown>,\n connectionId?: string,\n searchValue?: string,\n reactorConnectionId?: string,\n ) => Promise<unknown>;\n // Runs the current workflow's piece trigger test hook; sample items back.\n testTrigger?: () => Promise<unknown>;\n // Runs one draft step against the last tests of the blocks it reads.\n testStep?: (stepId: string) => Promise<StepTestOutcome>;\n // The current workflow's webhook endpoint, for the core webhook trigger.\n webhookEndpoint?: () => Promise<WebhookEndpoint | null>;\n // Backs PH_SECRET_REF props; absent when the runtime refuses secret writes.\n secrets?: SecretFormService;\n // powerhouse/connection documents for the connection picker.\n listConnections?: () => Promise<ConnectionSummary[]>;\n // Tells apart listings narrowed differently, e.g. per drive; part of the key.\n connectionScope?: string;\n // The workflow being edited; keys its run and endpoint queries.\n workflowId?: string;\n // The current workflow's most recent run, for a step's \"Last run\" preview.\n latestRun?: () => Promise<LatestRun | null>;\n // One journaled run by id, e.g. the trigger's last test.\n fetchRun?: (runId: string) => Promise<LatestRun | null>;\n // The piece version each draft block runs, trigger first.\n blockResolutions?: () => Promise<BlockResolutionView[]>;\n}\n\nexport type BlockMatchView =\n | \"exact\"\n | \"compatible\"\n | \"fallback\"\n | \"installed\"\n | \"missing\";\n\n// A draft block as the runtime would run it; host-bound pieces are \"installed\".\nexport interface BlockResolutionView {\n stepId: string;\n pieceName: string;\n // The version the block pins.\n pieceVersion: string;\n name: string;\n kind: \"action\" | \"trigger\";\n resolvedVersion: string | null;\n source: string | null;\n match: BlockMatchView;\n note: string | null;\n latestVersion: string | null;\n}\n\nexport interface StepTestOutcome {\n // Null when nothing ran, e.g. `Test \"fetch\" first`.\n runId: string | null;\n // INDETERMINATE: a write the step asked for may have landed.\n status: \"SUCCEEDED\" | \"FAILED\" | \"INDETERMINATE\";\n output?: unknown;\n error: string | null;\n // The thrown error's name, e.g. ReactorAccessDeniedError.\n errorName?: string | null;\n durationMs: number;\n}\n\nexport interface LatestRun {\n id?: string;\n status: string;\n error?: string | null;\n errorName?: string | null;\n startedAt: string;\n triggerPayload: unknown;\n steps: {\n stepKey: string;\n status: string;\n input: unknown;\n output: unknown;\n error: string | null;\n errorName?: string | null;\n }[];\n}\n\n// Ours, not the piece's: the reactor's poll cadence for a piece trigger.\n// Appended to every piece trigger's form; see splitPollInterval in the runtime.\nexport const POLL_INTERVAL_PROP: BlockFormProp = {\n name: \"pollEverySeconds\",\n displayName: \"Poll every (seconds)\",\n type: \"NUMBER\",\n required: false,\n description:\n \"How often the reactor checks this trigger; 60 at the least. Omit to follow the piece's own cadence.\",\n};\n","// Block helpers and palette presets; pure data used by the UI to seed new\n// triggers and steps.\nimport {\n blockKey,\n type BlockIdentity,\n type BlockKind,\n type BlockRef,\n} from \"@powerhousedao/pieces-framework/block-type\";\nimport { CORE_PIECE_NAME } from \"@powerhousedao/pieces-framework/workflow\";\n\nexport type { BlockIdentity, BlockKind, BlockRef };\n\nexport const CORE_PIECE = CORE_PIECE_NAME;\n\n// The reactor piece this package ships, named as pieces/index.ts declares it.\nexport const REACTOR_PIECE = \"@powerhousedao/piece-reactor\";\n\nconst core = (kind: BlockKind, name: string): BlockIdentity => ({\n pieceName: CORE_PIECE,\n kind,\n name,\n});\n\nexport const MANUAL_TRIGGER = core(\"trigger\", \"manual\");\nexport const SCHEDULE_TRIGGER = core(\"trigger\", \"schedule\");\nexport const WEBHOOK_TRIGGER = core(\"trigger\", \"webhook\");\nexport const BRANCH_BLOCK = core(\"action\", \"branch\");\nexport const ASSERT_BLOCK = core(\"action\", \"assert\");\n\n// A block to add: pinned already, or pinned to the installed version on pick.\nexport type BlockPick = BlockIdentity & { pieceVersion?: string };\n\nexport function sameBlock(\n a: BlockIdentity | undefined | null,\n b: BlockIdentity | undefined | null,\n): boolean {\n return Boolean(a && b && blockKey(a) === blockKey(b));\n}\n\nexport function isCoreBlock(block: { pieceName: string }): boolean {\n return block.pieceName === CORE_PIECE;\n}\n\n// The document blocks live in the reactor piece, and are offered here too:\n// they are what most workflows on a reactor are built from.\nexport function isReactorPieceBlock(block: { pieceName: string }): boolean {\n return block.pieceName === REACTOR_PIECE;\n}\n\nexport function stepBlock(step: {\n pieceName: string;\n pieceVersion: string;\n actionName: string;\n}): BlockRef {\n return {\n pieceName: step.pieceName,\n pieceVersion: step.pieceVersion,\n kind: \"action\",\n name: step.actionName,\n };\n}\n\nexport function triggerBlock(trigger: {\n pieceName: string;\n pieceVersion: string;\n triggerName: string;\n}): BlockRef {\n return {\n pieceName: trigger.pieceName,\n pieceVersion: trigger.pieceVersion,\n kind: \"trigger\",\n name: trigger.triggerName,\n };\n}\n\n// The fields a step or the trigger stores for a block.\nexport function stepFields(block: BlockRef) {\n return {\n pieceName: block.pieceName,\n pieceVersion: block.pieceVersion,\n actionName: block.name,\n };\n}\n\nexport function triggerFields(block: BlockRef) {\n return {\n pieceName: block.pieceName,\n pieceVersion: block.pieceVersion,\n triggerName: block.name,\n };\n}\n\n// A pinned pick passes through; an unpinned one takes the installed version,\n// and undefined means the piece isn't installed.\nexport function pinBlock(\n pick: BlockPick,\n installedVersion: (piece: string) => string | undefined,\n): BlockRef | undefined {\n const pieceVersion = pick.pieceVersion ?? installedVersion(pick.pieceName);\n if (!pieceVersion) return undefined;\n return {\n pieceName: pick.pieceName,\n pieceVersion,\n kind: pick.kind,\n name: pick.name,\n };\n}\n\nexport interface BlockPreset {\n label: string;\n block: BlockPick;\n description: string;\n defaultConfig: unknown;\n // Which section of the picker it belongs to: \"core\" is the core piece,\n // \"powerhouse\" the reactor piece, listed right after it.\n\n // Optional because a pick built from a search hit or an existing step is\n // the same shape but belongs to no section.\n group?: \"core\" | \"powerhouse\";\n}\n\nconst reactor = (kind: BlockKind, name: string): BlockIdentity => ({\n pieceName: REACTOR_PIECE,\n kind,\n name,\n});\n\nexport const TRIGGER_PRESETS: BlockPreset[] = [\n {\n label: \"Manual\",\n block: MANUAL_TRIGGER,\n group: \"core\",\n description: \"Fired on demand with a payload.\",\n defaultConfig: {},\n },\n {\n label: \"Schedule\",\n block: SCHEDULE_TRIGGER,\n group: \"core\",\n description: \"Fires on a cron expression or fixed interval.\",\n defaultConfig: { mode: \"cron\", cron: \"0 9 * * 1-5\", timezone: \"UTC\" },\n },\n {\n label: \"Webhook\",\n block: WEBHOOK_TRIGGER,\n group: \"core\",\n description: \"Fires when a provider POSTs to this workflow's URL.\",\n defaultConfig: { methods: \"POST\", scheme: \"none\", responseMode: \"async\" },\n },\n {\n label: \"Document event\",\n block: reactor(\"trigger\", \"document-event\"),\n group: \"powerhouse\",\n description: \"Fires when a matching document operation lands.\",\n defaultConfig: {},\n },\n {\n label: \"Document created\",\n block: reactor(\"trigger\", \"document-created\"),\n group: \"powerhouse\",\n description: \"Fires when a document is added to a drive.\",\n defaultConfig: {},\n },\n {\n label: \"Document deleted\",\n block: reactor(\"trigger\", \"document-deleted\"),\n group: \"powerhouse\",\n description: \"Fires when a document is removed from a drive.\",\n defaultConfig: {},\n },\n];\n\nexport const STEP_PRESETS: BlockPreset[] = [\n {\n label: \"Branch\",\n block: BRANCH_BLOCK,\n group: \"core\",\n description: \"Routes true/false on a condition.\",\n defaultConfig: {},\n },\n {\n label: \"Assert\",\n block: ASSERT_BLOCK,\n group: \"core\",\n description:\n \"Fails the run when a value is blank, rejected or not allowed.\",\n defaultConfig: { value: \"\", allowValues: [] },\n },\n {\n label: \"Create document\",\n block: reactor(\"action\", \"document-create\"),\n group: \"powerhouse\",\n description: \"Creates a Powerhouse document.\",\n defaultConfig: { documentType: \"\", name: \"\" },\n },\n {\n label: \"Dispatch actions\",\n block: reactor(\"action\", \"document-dispatch\"),\n group: \"powerhouse\",\n description: \"Sends actions to a document.\",\n defaultConfig: { documentId: \"\" },\n },\n {\n label: \"Get document\",\n block: reactor(\"action\", \"document-get\"),\n group: \"powerhouse\",\n description: \"Reads a document's current state.\",\n defaultConfig: { documentId: \"\" },\n },\n {\n label: \"Find documents\",\n block: reactor(\"action\", \"document-find\"),\n group: \"powerhouse\",\n description: \"Lists documents by type and name.\",\n defaultConfig: { documentType: \"\" },\n },\n {\n label: \"List document types\",\n block: reactor(\"action\", \"document-types\"),\n group: \"powerhouse\",\n description: \"Document models installed on this reactor.\",\n defaultConfig: {},\n },\n {\n label: \"Get document schema\",\n block: reactor(\"action\", \"document-schema\"),\n group: \"powerhouse\",\n description: \"Action and state schemas of a document type.\",\n defaultConfig: { documentType: \"\" },\n },\n];\n\n// A preset as the picker hands it over: pinned to a version.\nexport interface PickedPreset extends BlockPreset {\n block: BlockRef;\n}\n","// Design-time channel to the workflow-runtime subgraph: piece descriptors,\n// option resolution, runs and secrets. Not document-model coupled.\nimport { ambientRenownTokenProvider } from \"@powerhousedao/reactor-browser/graphql-client\";\nimport {\n POLL_INTERVAL_PROP,\n type BlockForm,\n type BlockFormProp,\n type ErrorHandlingDefaults,\n type PropertyGroup,\n} from \"./ui/forms.js\";\nimport {\n isCoreBlock,\n isReactorPieceBlock,\n type BlockRef,\n} from \"./ui/blocks.js\";\nimport { checkTriggerStrategy } from \"@powerhousedao/pieces-framework/workflow\";\n\nexport const DEFAULT_RUNTIME_URL =\n \"http://localhost:4001/graphql/workflow-runtime\";\n\nexport interface Transport {\n url: string;\n gql: <T>(query: string, variables: Record<string, unknown>) => Promise<T>;\n}\n\nexport interface RuntimeClientOptions {\n fetch?: typeof fetch;\n // Bearer token source; defaults to the ambient Renown token.\n token?: () => Promise<string | null | undefined>;\n}\n\nfunction createTransport(\n url: string,\n options: RuntimeClientOptions,\n): Transport {\n const doFetch = options.fetch ?? ((input, init) => fetch(input, init));\n const tokenOf = options.token ?? ambientRenownTokenProvider;\n return {\n url,\n gql: (query, variables) => gql(url, doFetch, tokenOf, query, variables),\n };\n}\n\n// A runtime error with its GraphQL extension code, when the server sent one.\nexport class RuntimeRequestError extends Error {\n constructor(\n message: string,\n readonly code?: string,\n ) {\n super(message);\n this.name = \"RuntimeRequestError\";\n }\n}\n\n// The workflow document hasn't reached the runtime yet; the call can be retried.\nexport function isSyncingError(error: unknown): boolean {\n return (\n error instanceof RuntimeRequestError && error.code === \"WORKFLOW_SYNCING\"\n );\n}\n\nasync function gql<T>(\n url: string,\n doFetch: typeof fetch,\n tokenOf: () => Promise<string | null | undefined>,\n query: string,\n variables: Record<string, unknown>,\n): Promise<T> {\n // Mirrors the reactor-browser switchboard AI tool's auth: attach the\n // Renown bearer token when one is available, else go out anonymously.\n const token = await tokenOf();\n const response = await doFetch(url, {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n ...(token ? { authorization: `Bearer ${token}` } : {}),\n },\n body: JSON.stringify({ query, variables }),\n });\n const body = (await response.json()) as {\n data?: T;\n errors?: { message: string; extensions?: { code?: unknown } }[];\n };\n const first = body.errors?.[0];\n if (first) {\n const code = first.extensions?.code;\n throw new RuntimeRequestError(\n first.message,\n typeof code === \"string\" ? code : undefined,\n );\n }\n if (!body.data) throw new Error(\"Empty GraphQL response\");\n return body.data;\n}\n\ninterface BlockEntryDescriptor {\n displayName: string;\n description?: string;\n requireAuth: boolean;\n requireReactor?: string;\n props: BlockFormProp[];\n ports?: string[];\n // Triggers only; read through checkTriggerStrategy.\n strategy?: string;\n display?: string;\n propertyGroups?: PropertyGroup[];\n classification?: string;\n errorHandlingOptions?: ErrorHandlingDefaults;\n}\n\ninterface BlockDescriptorResult {\n workflowRuntime: {\n blockDescriptor: {\n displayName: string;\n auth?: unknown;\n action?: BlockEntryDescriptor;\n trigger?: BlockEntryDescriptor;\n } | null;\n };\n}\n\n// The GraphQL BlockInput for a block.\nexport function blockInput(block: BlockRef) {\n return {\n pieceName: block.pieceName,\n pieceVersion: block.pieceVersion,\n name: block.name,\n kind: block.kind,\n };\n}\n\nexport function getBlockForm(\n t: Transport,\n block: BlockRef,\n): Promise<BlockForm | null> {\n return t\n .gql<BlockDescriptorResult>(\n `query Descriptor($block: BlockInput!) {\n workflowRuntime { blockDescriptor(block: $block) }\n }`,\n { block: blockInput(block) },\n )\n .then((data) => {\n const descriptor = data.workflowRuntime.blockDescriptor;\n const entry = descriptor?.action ?? descriptor?.trigger;\n if (!descriptor || !entry) return null;\n const isTrigger = !descriptor.action && Boolean(descriptor.trigger);\n const strategy = isTrigger\n ? checkTriggerStrategy(entry.strategy)\n : undefined;\n // The runtime refuses it too, so no form is drawn for it.\n if (strategy && \"issue\" in strategy) throw new Error(strategy.issue);\n const delivery = strategy?.delivery;\n // A poll cadence only means something for a piece trigger the reactor\n // polls; the reactor piece's are fed by the host, core ones fire themselves.\n const polled =\n delivery === \"poll\" &&\n !isCoreBlock(block) &&\n !isReactorPieceBlock(block);\n const props = entry.props;\n return {\n // A core block belongs to no piece worth naming.\n title: isCoreBlock(block)\n ? entry.displayName\n : `${descriptor.displayName} · ${entry.displayName}`,\n requireAuth: entry.requireAuth,\n ...(entry.requireReactor === \"read\" || entry.requireReactor === \"write\"\n ? { requireReactor: entry.requireReactor }\n : {}),\n auth: !descriptor.auth\n ? (\"none\" as const)\n : entry.requireAuth\n ? (\"required\" as const)\n : (\"optional\" as const),\n props: polled ? [...props, POLL_INTERVAL_PROP] : props,\n ...(entry.ports ? { ports: entry.ports } : {}),\n ...(delivery ? { triggerDelivery: delivery } : {}),\n ...(entry.display ? { display: entry.display } : {}),\n ...(entry.description ? { description: entry.description } : {}),\n ...(entry.propertyGroups\n ? { propertyGroups: entry.propertyGroups }\n : {}),\n ...(entry.classification\n ? { classification: entry.classification }\n : {}),\n ...(entry.errorHandlingOptions\n ? { errorHandling: entry.errorHandlingOptions }\n : {}),\n };\n });\n}\n\nexport interface PieceSummary {\n name: string;\n displayName: string;\n description: string;\n logoUrl: string;\n version: string;\n actionCount: number;\n triggerCount: number;\n // Activepieces category ids, e.g. ARTIFICIAL_INTELLIGENCE, SALES_AND_CRM.\n categories: string[];\n // Absent from runtimes older than the field; read as \"activepieces\".\n source?: PieceSource;\n // PieceAuth descriptor, verbatim from the piece; null when authless.\n auth?: unknown;\n // Why none of the piece's blocks can run on this reactor.\n unsupported?: string | null;\n deprecated?: boolean;\n // A package piece shadowing a published one: the version published.\n publishedVersion?: string;\n}\n\n// One action of a piece, at the version the listing answered with.\nexport interface PieceActionEntry {\n pieceName: string;\n pieceVersion: string;\n name: string;\n displayName: string;\n description: string;\n unsupported?: string | null;\n}\n\ninterface PieceListing<T> {\n name: string;\n version: string;\n entries: T[];\n}\n\nfunction atVersion<T>(listing: PieceListing<T>) {\n return listing.entries.map((entry) => ({\n ...entry,\n pieceName: listing.name,\n pieceVersion: listing.version,\n }));\n}\n\nexport function fetchPieceCatalog(t: Transport): Promise<PieceSummary[]> {\n return t\n .gql<{\n workflowRuntime: { pieceCatalog: PieceSummary[] };\n }>(`query Catalog { workflowRuntime { pieceCatalog } }`, {})\n .then((data) => data.workflowRuntime.pieceCatalog);\n}\n\nexport async function fetchPieceActions(\n t: Transport,\n packageName: string,\n): Promise<PieceActionEntry[]> {\n const data = await t.gql<{\n workflowRuntime: {\n pieceActions: {\n name: string;\n version: string;\n actions: Omit<PieceActionEntry, \"pieceName\" | \"pieceVersion\">[];\n };\n };\n }>(\n `query Actions($packageName: String!) {\n workflowRuntime { pieceActions(packageName: $packageName) }\n }`,\n { packageName },\n );\n const listing = data.workflowRuntime.pieceActions;\n return atVersion({ ...listing, entries: listing.actions });\n}\n\nexport interface PieceTriggerEntry {\n pieceName: string;\n pieceVersion: string;\n name: string;\n displayName: string;\n description: string;\n strategy: string;\n unsupported?: string | null;\n}\n\nexport async function fetchPieceTriggers(\n t: Transport,\n packageName: string,\n): Promise<PieceTriggerEntry[]> {\n const data = await t.gql<{\n workflowRuntime: {\n pieceTriggers: {\n name: string;\n version: string;\n triggers: Omit<PieceTriggerEntry, \"pieceName\" | \"pieceVersion\">[];\n };\n };\n }>(\n `query Triggers($packageName: String!) {\n workflowRuntime { pieceTriggers(packageName: $packageName) }\n }`,\n { packageName },\n );\n const listing = data.workflowRuntime.pieceTriggers;\n return atVersion({ ...listing, entries: listing.triggers });\n}\n\nexport interface BlockSearchHit {\n pieceName: string;\n pieceVersion: string;\n // The action or trigger name.\n name: string;\n pieceDisplayName: string;\n logoUrl: string;\n displayName: string;\n description: string;\n kind: \"action\" | \"trigger\";\n strategy: string | null;\n unsupported: string | null;\n}\n\nexport type PieceSource = \"local\" | \"registry\" | \"activepieces\";\n\nexport interface PieceSearchMatch {\n pieceName: string;\n pieceVersion: string;\n displayName: string;\n description: string;\n logoUrl: string;\n categories: string[];\n source: PieceSource;\n deprecated: boolean | null;\n unsupported: string | null;\n // Every query token matched the piece's own name.\n namedPiece: boolean;\n blocks: BlockSearchHit[];\n}\n\nexport interface PieceSearchResult {\n status: \"ready\" | \"indexing\" | \"error\";\n pieces: PieceSearchMatch[];\n indexedPieces: number;\n error: string | null;\n}\n\nexport interface PieceSearchFilter {\n kind: \"action\" | \"trigger\";\n sources?: readonly PieceSource[];\n categories?: readonly string[];\n limit?: number;\n}\n\n// Catalog-wide search grouped by piece; \"indexing\" on the very first calls.\nexport async function searchPieces(\n t: Transport,\n query: string,\n filter: PieceSearchFilter,\n): Promise<PieceSearchResult> {\n const data = await t.gql<{\n workflowRuntime: { searchPieces: PieceSearchResult };\n }>(\n `query SearchPieces($query: String!, $kind: String!, $sources: [String!], $categories: [String!], $limit: Int) {\n workflowRuntime { searchPieces(query: $query, kind: $kind, sources: $sources, categories: $categories, limit: $limit) {\n status indexedPieces error\n pieces {\n pieceName pieceVersion displayName description logoUrl categories source deprecated unsupported namedPiece\n blocks { pieceName pieceVersion name pieceDisplayName logoUrl displayName description kind strategy unsupported }\n }\n } }\n }`,\n {\n query,\n kind: filter.kind,\n sources: filter.sources ?? null,\n categories: filter.categories ?? null,\n limit: filter.limit ?? null,\n },\n );\n return data.workflowRuntime.searchPieces;\n}\n\nexport interface OutputTreeNode {\n name: string;\n type: string;\n description?: string;\n children?: OutputTreeNode[];\n}\n\nexport interface OutputTree {\n source: \"schema\" | \"sample\" | \"static\" | \"none\" | \"test\";\n nodes: OutputTreeNode[];\n // source \"test\" only: the last test's output and when it ran.\n sample?: unknown;\n testedAt?: string;\n runId?: string;\n}\n\nexport function fetchBlockOutputTree(\n t: Transport,\n block: BlockRef,\n config: unknown,\n): Promise<OutputTree> {\n return t\n .gql<{ workflowRuntime: { blockOutputTree: OutputTree } }>(\n `query OutputTree($block: BlockInput!, $config: Unknown) {\n workflowRuntime { blockOutputTree(block: $block, config: $config) }\n }`,\n { block: blockInput(block), config: config ?? {} },\n )\n .then((data) => data.workflowRuntime.blockOutputTree);\n}\n\n// A draft step's or trigger's tree: its last test output, else its shape.\nexport function fetchStepOutputTree(\n t: Transport,\n workflowId: string,\n stepId: string,\n): Promise<OutputTree> {\n return t\n .gql<{ workflowRuntime: { stepOutputTree: OutputTree } }>(\n `query StepOutputTree($workflowId: String!, $stepId: String!) {\n workflowRuntime { stepOutputTree(workflowId: $workflowId, stepId: $stepId) }\n }`,\n { workflowId, stepId },\n )\n .then((data) => data.workflowRuntime.stepOutputTree);\n}\n\nexport interface ConnectionSummary {\n id: string;\n name: string;\n connectorId: string;\n authType: string;\n status: string;\n accountLabel: string | null;\n}\n\n// Never persisted: the server scopes this list to the caller's read access.\nexport function fetchConnections(t: Transport): Promise<ConnectionSummary[]> {\n return t\n .gql<{\n workflowRuntime: { connections: ConnectionSummary[] };\n }>(\n `query Connections { workflowRuntime { connections { id name connectorId authType status accountLabel } } }`,\n {},\n )\n .then((data) => data.workflowRuntime.connections);\n}\n\nexport interface ConnectionCheckResult {\n ok: boolean;\n detail: string;\n accountLabel: string | null;\n}\n\n// Runs the piece's own connection check against a document's stored credentials.\n// No secrets cross this boundary: the subgraph resolves refs server-side.\nexport function checkConnection(\n t: Transport,\n connectionId: string,\n): Promise<ConnectionCheckResult> {\n return t\n .gql<{\n workflowRuntime: { checkConnection: ConnectionCheckResult };\n }>(\n `mutation CheckConnection($connectionId: String!) {\n workflowRuntime {\n checkConnection(connectionId: $connectionId) {\n ok\n detail\n accountLabel\n }\n }\n }`,\n { connectionId },\n )\n .then((data) => data.workflowRuntime.checkConnection);\n}\n\n// What the editor needs to decide on sign-in.\nexport interface ReactorAccessInfo {\n authEnforcement: boolean;\n // Null for a caller who is not signed in.\n reactorIdentity: { address: string | null; key: string } | null;\n authConditions: boolean | null;\n}\n\nexport function fetchReactorAccess(t: Transport): Promise<ReactorAccessInfo> {\n return t\n .gql<{ workflowRuntime: ReactorAccessInfo }>(\n `query ReactorAccess {\n workflowRuntime { authEnforcement reactorIdentity { address key } authConditions }\n }`,\n {},\n )\n .then((data) => data.workflowRuntime);\n}\n\n// Why the runtime would not arm the workflow's reactor access; null when it would.\nexport function fetchReactorAccessDenial(\n t: Transport,\n workflowId: string,\n): Promise<string | null> {\n return t\n .gql<{ workflowRuntime: { reactorAccessDenial: string | null } }>(\n `query ReactorAccessDenial($workflowId: String!) {\n workflowRuntime { reactorAccessDenial(workflowId: $workflowId) }\n }`,\n { workflowId },\n )\n .then((data) => data.workflowRuntime.reactorAccessDenial);\n}\n\nexport interface OAuthStart {\n state: string;\n authorizationUrl: string;\n redirectUri: string;\n expiresAt: string;\n}\n\nexport interface OAuthAttempt {\n connectionId: string;\n status: \"PENDING\" | \"EXCHANGING\" | \"OK\" | \"ERROR\";\n error: string | null;\n}\n\n// The redirect an OAuth2 app registers, absolute: a bare path from a host\n// that doesn't know its origin is resolved against the URL it is reached at.\nexport async function fetchOAuthRedirectUri(\n t: Transport,\n): Promise<string | null> {\n const data = await t.gql<{\n workflowRuntime: { oauthRedirectUri: string | null };\n }>(`query OAuthRedirectUri { workflowRuntime { oauthRedirectUri } }`, {});\n const uri = data.workflowRuntime.oauthRedirectUri;\n return uri === null ? null : new URL(uri, t.url).href;\n}\n\nexport async function startOAuth(\n t: Transport,\n connectionId: string,\n options: { redirectUri?: string; returnUrl?: string } = {},\n): Promise<OAuthStart> {\n const data = await t.gql<{ workflowRuntime: { startOAuth: OAuthStart } }>(\n `mutation StartOAuth($connectionId: String!, $redirectUri: String, $returnUrl: String) {\n workflowRuntime {\n startOAuth(connectionId: $connectionId, redirectUri: $redirectUri, returnUrl: $returnUrl) {\n state authorizationUrl redirectUri expiresAt\n }\n }\n }`,\n {\n connectionId,\n redirectUri: options.redirectUri ?? null,\n returnUrl: options.returnUrl ?? null,\n },\n );\n return data.workflowRuntime.startOAuth;\n}\n\nexport async function fetchOAuthAttempt(\n t: Transport,\n state: string,\n): Promise<OAuthAttempt | null> {\n const data = await t.gql<{\n workflowRuntime: { oauthAttempt: OAuthAttempt | null };\n }>(\n `query OAuthAttempt($state: String!) {\n workflowRuntime { oauthAttempt(state: $state) { connectionId status error } }\n }`,\n { state },\n );\n return data.workflowRuntime.oauthAttempt;\n}\n\nexport interface SecretStat {\n ref: string;\n label: string | null;\n version: number;\n status: \"ACTIVE\" | \"DELETED\";\n createdAt: string;\n updatedAt: string;\n}\n\nconst SECRET_FIELDS = \"ref label version status createdAt updatedAt\";\n\n// Mints a managed secret; only the returned ref ever enters a document.\nexport async function createSecret(\n t: Transport,\n value: string,\n label?: string,\n): Promise<SecretStat> {\n const data = await t.gql<{ workflowRuntime: { createSecret: SecretStat } }>(\n `mutation CreateSecret($value: String!, $label: String) {\n workflowRuntime { createSecret(value: $value, label: $label) { ${SECRET_FIELDS} } }\n }`,\n { value, label: label ?? null },\n );\n return data.workflowRuntime.createSecret;\n}\n\n// Same ref, version+1; referencing documents stay untouched.\nexport async function rotateSecret(\n t: Transport,\n ref: string,\n value: string,\n): Promise<SecretStat> {\n const data = await t.gql<{ workflowRuntime: { rotateSecret: SecretStat } }>(\n `mutation RotateSecret($ref: String!, $value: String!) {\n workflowRuntime { rotateSecret(ref: $ref, value: $value) { ${SECRET_FIELDS} } }\n }`,\n { ref, value },\n );\n return data.workflowRuntime.rotateSecret;\n}\n\n// Metadata only; null for unknown or legacy refs.\nexport async function fetchSecretStat(\n t: Transport,\n ref: string,\n): Promise<SecretStat | null> {\n const data = await t.gql<{ workflowRuntime: { secret: SecretStat | null } }>(\n `query Secret($ref: String!) {\n workflowRuntime { secret(ref: $ref) { ${SECRET_FIELDS} } }\n }`,\n { ref },\n );\n return data.workflowRuntime.secret;\n}\n\nexport interface WebhookEndpointRecord {\n workflowId: string;\n url: string;\n // False when `url` is a bare path because the reactor has no public origin.\n absoluteUrl: boolean;\n armed: boolean;\n createdAt: string;\n}\n\n// Never cached: the runtime mints the endpoint on the first call and `armed`\n// tracks the workflow's status.\nexport async function fetchWebhookEndpoint(\n t: Transport,\n workflowId: string,\n driveId?: string,\n): Promise<WebhookEndpointRecord | null> {\n const data = await t.gql<{\n workflowRuntime: { webhookEndpoint: WebhookEndpointRecord | null };\n }>(\n `query WebhookEndpoint($workflowId: String!, $driveId: String) {\n workflowRuntime {\n webhookEndpoint(workflowId: $workflowId, driveId: $driveId) {\n workflowId url absoluteUrl armed createdAt\n }\n }\n }`,\n { workflowId, driveId: driveId ?? null },\n );\n return data.workflowRuntime.webhookEndpoint;\n}\n\nexport async function testTrigger(\n t: Transport,\n workflowId: string,\n driveId?: string,\n): Promise<unknown> {\n const data = await t.gql<{ workflowRuntime: { testTrigger: unknown } }>(\n `mutation TestTrigger($workflowId: String!, $driveId: String) {\n workflowRuntime { testTrigger(workflowId: $workflowId, driveId: $driveId) }\n }`,\n { workflowId, driveId: driveId ?? null },\n );\n return data.workflowRuntime.testTrigger;\n}\n\nexport interface CoreTriggerTestOptions {\n // The manual trigger: the sample payload.\n payload?: unknown;\n // The webhook trigger: how long to wait for a delivery (default and cap 300).\n timeoutSeconds?: number;\n // Lets the runtime wait for a workflow that hasn't synced yet.\n driveId?: string;\n}\n\n// Tests the draft trigger, core ones included: manual saves `payload`, schedule\n// samples a fire now, webhook resolves with the next delivery to its endpoint.\nexport async function testCoreTrigger(\n t: Transport,\n workflowId: string,\n options: CoreTriggerTestOptions = {},\n): Promise<unknown> {\n const data = await t.gql<{ workflowRuntime: { testTrigger: unknown } }>(\n `mutation TestCoreTrigger($workflowId: String!, $payload: Unknown, $timeoutSeconds: Int, $driveId: String) {\n workflowRuntime {\n testTrigger(workflowId: $workflowId, payload: $payload, timeoutSeconds: $timeoutSeconds, driveId: $driveId)\n }\n }`,\n {\n workflowId,\n payload: options.payload ?? null,\n timeoutSeconds: options.timeoutSeconds ?? null,\n driveId: options.driveId ?? null,\n },\n );\n return data.workflowRuntime.testTrigger;\n}\n\n// Stops a waiting webhook test; false when none was waiting.\nexport async function cancelTriggerTest(\n t: Transport,\n workflowId: string,\n): Promise<boolean> {\n const data = await t.gql<{ workflowRuntime: { cancelTriggerTest: boolean } }>(\n `mutation CancelTriggerTest($workflowId: String!) {\n workflowRuntime { cancelTriggerTest(workflowId: $workflowId) }\n }`,\n { workflowId },\n );\n return data.workflowRuntime.cancelTriggerTest;\n}\n\nexport interface StepTestResult {\n // Null when the test never started, e.g. `Test \"fetch\" first`.\n runId: string | null;\n // INDETERMINATE: a write the step asked for may have landed.\n status: \"SUCCEEDED\" | \"FAILED\" | \"INDETERMINATE\";\n output: unknown;\n error: string | null;\n // The thrown error's name, e.g. ReactorAccessDeniedError.\n errorName: string | null;\n durationMs: number;\n}\n\n// Runs one draft step against the latest test outputs of the blocks it reads.\nexport async function testStep(\n t: Transport,\n workflowId: string,\n stepId: string,\n driveId?: string,\n): Promise<StepTestResult> {\n const data = await t.gql<{ workflowRuntime: { testStep: StepTestResult } }>(\n `mutation TestStep($workflowId: String!, $stepId: String!, $driveId: String) {\n workflowRuntime {\n testStep(workflowId: $workflowId, stepId: $stepId, driveId: $driveId) {\n runId status output error errorName durationMs\n }\n }\n }`,\n { workflowId, stepId, driveId: driveId ?? null },\n );\n return data.workflowRuntime.testStep;\n}\n\nexport type BlockMatch =\n | \"exact\"\n | \"compatible\"\n | \"fallback\"\n | \"installed\"\n | \"missing\";\n\nexport interface BlockResolution {\n // The trigger's or step's id.\n stepId: string;\n pieceName: string;\n // The version the block pins.\n pieceVersion: string;\n name: string;\n kind: \"action\" | \"trigger\";\n // Null when nothing resolves.\n resolvedVersion: string | null;\n source: \"local\" | \"registry\" | \"activepieces\" | \"npm\" | null;\n match: BlockMatch;\n // Why the version that runs differs from the pin, or why nothing resolves.\n note: string | null;\n // Newest version any source offers.\n latestVersion: string | null;\n}\n\n// Every block of the draft, trigger first, as the runtime would run it.\nexport async function blockResolutions(\n t: Transport,\n workflowId: string,\n): Promise<BlockResolution[]> {\n const data = await t.gql<{\n workflowRuntime: { blockResolutions: BlockResolution[] };\n }>(\n `query BlockResolutions($workflowId: String!) {\n workflowRuntime {\n blockResolutions(workflowId: $workflowId) {\n stepId pieceName pieceVersion name kind resolvedVersion source match note latestVersion\n }\n }\n }`,\n { workflowId },\n );\n return data.workflowRuntime.blockResolutions;\n}\n\nexport interface RunStepRecord {\n stepId: string;\n stepKey: string;\n pieceName: string;\n // The action the step ran, or the trigger a trigger test sampled.\n blockName: string;\n status: string;\n // Undefined on a listing row (fetchRunsPage); fetchRun reads them.\n input: unknown;\n output: unknown;\n port: string | null;\n error: string | null;\n errorName: string | null;\n // Null for skipped and replayed steps, and for runs journaled before timings.\n startedAt: string | null;\n endedAt: string | null;\n}\n\nexport interface RunRecord {\n id: string;\n workflowId: string;\n workflowName: string;\n workflowVersion: number;\n triggerKind: string;\n triggerPayload: unknown;\n status: string;\n error: string | null;\n errorName: string | null;\n startedAt: string;\n endedAt: string | null;\n rerunOf: string | null;\n // Why a finished run is not a plain success, e.g. an edge nothing takes.\n warningNotes: string[];\n steps: RunStepRecord[];\n}\n\nconst RUN_ROW_FIELDS = `id workflowId workflowName workflowVersion triggerKind\n triggerPayload status error errorName startedAt endedAt rerunOf warningNotes`;\nconst STEP_ROW_FIELDS =\n \"stepId stepKey pieceName blockName status port error errorName startedAt endedAt\";\nconst RUN_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} input output }`;\n// A listing row: the steps without their input and output.\nconst RUN_LIST_FIELDS = `${RUN_ROW_FIELDS} steps { ${STEP_ROW_FIELDS} }`;\n\nexport interface RunsScope {\n workflowId?: string;\n // Scopes runs to the workflows the drive holds; ignored alongside workflowId.\n driveId?: string;\n limit?: number;\n // Left out by the runtime, so they never cost a page its rows.\n excludeTriggerKinds?: string[];\n}\n\nfunction scopeVariables(scope: RunsScope, limit: number) {\n return {\n workflowId: scope.workflowId ?? null,\n driveId: scope.driveId ?? null,\n excludeTriggerKinds: scope.excludeTriggerKinds ?? null,\n limit: scope.limit ?? limit,\n };\n}\n\nexport async function fetchRuns(\n t: Transport,\n scope: RunsScope = {},\n): Promise<RunRecord[]> {\n const data = await t.gql<{ workflowRuntime: { runs: RunRecord[] } }>(\n `query Runs($workflowId: String, $driveId: String, $limit: Int, $excludeTriggerKinds: [String!]) {\n workflowRuntime { runs(workflowId: $workflowId, driveId: $driveId, limit: $limit, excludeTriggerKinds: $excludeTriggerKinds) { ${RUN_FIELDS} } }\n }`,\n scopeVariables(scope, 30),\n );\n return data.workflowRuntime.runs;\n}\n\n// Steps come without input and output; fetchRun has them.\nexport interface RunPage {\n items: RunRecord[];\n hasNextPage: boolean;\n cursor: string | null;\n}\n\nexport async function fetchRunsPage(\n t: Transport,\n scope: RunsScope = {},\n cursor: string | null = null,\n): Promise<RunPage> {\n const { limit, ...rest } = scopeVariables(scope, 30);\n const data = await t.gql<{ workflowRuntime: { runsPage: RunPage } }>(\n `query RunsPage($workflowId: String, $driveId: String, $excludeTriggerKinds: [String!], $paging: WorkflowRunsPagingInput) {\n workflowRuntime {\n runsPage(workflowId: $workflowId, driveId: $driveId, excludeTriggerKinds: $excludeTriggerKinds, paging: $paging) {\n items { ${RUN_LIST_FIELDS} } hasNextPage cursor\n }\n }\n }`,\n { ...rest, paging: { limit, cursor } },\n );\n return data.workflowRuntime.runsPage;\n}\n\nexport async function fetchRun(\n t: Transport,\n runId: string,\n): Promise<RunRecord | null> {\n const data = await t.gql<{ workflowRuntime: { run: RunRecord | null } }>(\n `query Run($id: String!) { workflowRuntime { run(id: $id) { ${RUN_FIELDS} } } }`,\n { id: runId },\n );\n return data.workflowRuntime.run;\n}\n\nexport interface FireResult {\n runId: string | null;\n status: string;\n error: string | null;\n}\n\nexport async function fireWorkflow(\n t: Transport,\n workflowId: string,\n payload?: unknown,\n): Promise<FireResult> {\n const data = await t.gql<{ workflowRuntime: { fire: FireResult } }>(\n `mutation Fire($workflowId: String!, $payload: Unknown) {\n workflowRuntime { fire(workflowId: $workflowId, payload: $payload) { runId status error } }\n }`,\n { workflowId, payload: payload ?? {} },\n );\n return data.workflowRuntime.fire;\n}\n\n// Resume a FAILED run: succeeded steps replay, execution restarts at the\n// failure. Returns the new run.\nexport async function rerunRun(\n t: Transport,\n runId: string,\n): Promise<FireResult> {\n const data = await t.gql<{ workflowRuntime: { rerun: FireResult } }>(\n `mutation Rerun($runId: String!) {\n workflowRuntime { rerun(runId: $runId) { runId status error } }\n }`,\n { runId },\n );\n return data.workflowRuntime.rerun;\n}\n\ninterface BlockOptionsResult {\n workflowRuntime: { blockOptions: unknown };\n}\n\nexport async function loadBlockOptions(\n t: Transport,\n block: BlockRef,\n propName: string,\n input: Record<string, unknown>,\n connectionId?: string,\n searchValue?: string,\n // Narrows a reactor-reading resolver to what the step's connection reaches.\n reactorConnectionId?: string,\n): Promise<unknown> {\n const data = await t.gql<BlockOptionsResult>(\n `query Options($block: BlockInput!, $propName: String!, $input: Unknown, $connectionId: String, $searchValue: String, $reactorConnectionId: String) {\n workflowRuntime { blockOptions(block: $block, propName: $propName, input: $input, connectionId: $connectionId, searchValue: $searchValue, reactorConnectionId: $reactorConnectionId) }\n }`,\n {\n block: blockInput(block),\n propName,\n input,\n connectionId: connectionId ?? null,\n searchValue: searchValue ?? null,\n reactorConnectionId: reactorConnectionId ?? null,\n },\n );\n return data.workflowRuntime.blockOptions;\n}\n\nconst operations = {\n getBlockForm,\n fetchPieceCatalog,\n fetchPieceActions,\n fetchPieceTriggers,\n searchPieces,\n fetchBlockOutputTree,\n fetchStepOutputTree,\n fetchConnections,\n checkConnection,\n fetchReactorAccess,\n fetchReactorAccessDenial,\n fetchOAuthRedirectUri,\n startOAuth,\n fetchOAuthAttempt,\n createSecret,\n rotateSecret,\n fetchSecretStat,\n fetchWebhookEndpoint,\n testTrigger,\n testCoreTrigger,\n cancelTriggerTest,\n testStep,\n blockResolutions,\n fetchRuns,\n fetchRunsPage,\n fetchRun,\n fireWorkflow,\n rerunRun,\n loadBlockOptions,\n};\n\ntype Operations = typeof operations;\ntype Bound<F> = F extends (t: Transport, ...args: infer A) => infer R\n ? (...args: A) => R\n : never;\ntype BoundOperations = { [K in keyof Operations]: Bound<Operations[K]> };\n\n// Every workflow-runtime call, bound to one subgraph URL. Holds no cache.\nexport type RuntimeClient = Transport & BoundOperations;\n\nexport function createRuntimeClient(\n url: string,\n options: RuntimeClientOptions = {},\n): RuntimeClient {\n const transport = createTransport(url, options);\n const bound = Object.fromEntries(\n Object.entries(operations).map(([name, operation]) => [\n name,\n (...args: unknown[]) =>\n (operation as (t: Transport, ...rest: unknown[]) => unknown)(\n transport,\n ...args,\n ),\n ]),\n ) as BoundOperations;\n return { ...transport, ...bound };\n}\n","// Design-time tests are journaled as runs of this kind.\nexport const TEST_TRIGGER_KIND = \"test\";\n\n// Runs as the author sees them: tests aren't executions of the workflow.\nexport function realRuns<T extends { triggerKind: string }>(runs: T[]): T[] {\n return runs.filter((run) => run.triggerKind !== TEST_TRIGGER_KIND);\n}\n","// Query keys for runtime data. Every key starts with the runtime URL (the\n// \"scope\"), so two runtimes never share an entry.\nimport type { BlockRef } from \"@powerhousedao/pieces-framework/block-type\";\n\n// A block as a key part: every field, the version included.\nexport function blockPart(block: BlockRef) {\n return [block.pieceName, block.pieceVersion, block.kind, block.name] as const;\n}\n\n// The same, as one string for a Map key.\nexport function blockRefKey(block: BlockRef): string {\n return blockPart(block).join(\" \");\n}\n\nexport type RuntimeQueryKind =\n | \"catalog\"\n | \"form\"\n | \"pieceActions\"\n | \"pieceTriggers\"\n | \"searchPieces\"\n | \"outputTree\"\n | \"options\"\n | \"dynamic\"\n | \"connections\"\n | \"webhook\"\n | \"latestRun\"\n | \"runs\"\n | \"run\"\n | \"secret\"\n | \"blockResolutions\"\n | \"reactorAccess\"\n | \"reactorDenial\";\n\nexport interface ResolverKeyInput {\n block: BlockRef;\n propName: string;\n // Values of the prop's refreshers, in declaration order.\n refreshers: unknown[];\n connectionId?: string | null;\n searchValue?: string | null;\n reactorConnectionId?: string | null;\n}\n\nfunction resolverKey(\n scope: string,\n kind: \"options\" | \"dynamic\",\n input: ResolverKeyInput,\n) {\n return [\n scope,\n kind,\n blockPart(input.block),\n input.propName,\n input.refreshers,\n input.connectionId ?? null,\n input.searchValue ?? null,\n input.reactorConnectionId ?? null,\n ] as const;\n}\n\nexport const runtimeKeys = {\n all: (scope: string) => [scope] as const,\n catalog: (scope: string) => [scope, \"catalog\"] as const,\n form: (scope: string, block: BlockRef) =>\n [scope, \"form\", blockPart(block)] as const,\n pieceActions: (scope: string, packageName: string) =>\n [scope, \"pieceActions\", packageName] as const,\n pieceTriggers: (scope: string, packageName: string) =>\n [scope, \"pieceTriggers\", packageName] as const,\n searchPieces: (scope: string, query: string, filter: unknown) =>\n [scope, \"searchPieces\", query, filter] as const,\n outputTrees: (scope: string) => [scope, \"outputTree\"] as const,\n outputTree: (scope: string, block: BlockRef, config: unknown) =>\n [scope, \"outputTree\", blockPart(block), config ?? {}] as const,\n // Keyed by the test it reads, so a new test is a new entry.\n stepOutputTree: (\n scope: string,\n workflowId: string,\n stepId: string,\n testedAt: string | null,\n ) => [scope, \"outputTree\", \"step\", workflowId, stepId, testedAt] as const,\n options: (scope: string, input: ResolverKeyInput) =>\n resolverKey(scope, \"options\", input),\n dynamic: (scope: string, input: ResolverKeyInput) =>\n resolverKey(scope, \"dynamic\", input),\n // `filter` tells apart listings a caller narrows, e.g. to one drive.\n connections: (scope: string, filter?: string | null) =>\n filter === undefined\n ? ([scope, \"connections\"] as const)\n : ([scope, \"connections\", filter] as const),\n webhook: (scope: string, workflowId: string) =>\n [scope, \"webhook\", workflowId] as const,\n latestRun: (scope: string, workflowId: string) =>\n [scope, \"latestRun\", workflowId] as const,\n allRuns: (scope: string) => [scope, \"runs\"] as const,\n runs: (\n scope: string,\n runsScope: { workflowId?: string; driveId?: string; limit?: number },\n ) =>\n [\n scope,\n \"runs\",\n {\n workflowId: runsScope.workflowId ?? null,\n driveId: runsScope.driveId ?? null,\n limit: runsScope.limit ?? null,\n },\n ] as const,\n // Under allRuns, so every invalidation of the listing reaches the pages.\n runPages: (\n scope: string,\n runsScope: { workflowId?: string; driveId?: string; limit?: number },\n ) =>\n [\n scope,\n \"runs\",\n \"pages\",\n {\n workflowId: runsScope.workflowId ?? null,\n driveId: runsScope.driveId ?? null,\n limit: runsScope.limit ?? null,\n },\n ] as const,\n run: (scope: string, runId: string) => [scope, \"run\", runId] as const,\n // Per viewer: the identity is only served to a signed-in caller.\n reactorAccess: (scope: string, viewer: string | null) =>\n [scope, \"reactorAccess\", viewer] as const,\n reactorDenial: (scope: string, workflowId: string) =>\n [scope, \"reactorDenial\", workflowId] as const,\n secret: (scope: string, ref: string) => [scope, \"secret\", ref] as const,\n allBlockResolutions: (scope: string, workflowId: string) =>\n [scope, \"blockResolutions\", workflowId] as const,\n // `blocks` is the draft's, trigger first, so an edit is a new entry.\n blockResolutions: (\n scope: string,\n workflowId: string,\n blocks: readonly BlockRef[],\n ) => [scope, \"blockResolutions\", workflowId, blocks.map(blockPart)] as const,\n};\n\nexport function queryKind(key: readonly unknown[]): string | undefined {\n return typeof key[1] === \"string\" ? key[1] : undefined;\n}\n\n// Piece metadata that is the same for every caller of one runtime.\nexport const SHARED_STALE_MS = 30 * 60_000;\n// Resolver answers depend on the caller's connection; kept briefly.\nexport const RESOLVER_STALE_MS = 5 * 60_000;\n","// Query options over a RuntimeClient. Keys come from ui/query-keys, so the\n// editor's hooks and these factories address the same cache entries.\nimport {\n infiniteQueryOptions,\n mutationOptions,\n QueryClient,\n queryOptions,\n useMutation,\n} from \"@tanstack/react-query\";\nimport type { BlockRef } from \"@powerhousedao/pieces-framework/block-type\";\nimport type {\n RunPage,\n RunRecord,\n RunsScope,\n RuntimeClient,\n StepTestResult,\n} from \"./runtime-client.js\";\nimport { realRuns, TEST_TRIGGER_KIND } from \"./run-kinds.js\";\nimport { runtimeKeys, SHARED_STALE_MS } from \"./ui/query-keys.js\";\n\nexport function createRuntimeQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n // Callers surface failures themselves, with their own retry buttons.\n queries: { retry: false, refetchOnWindowFocus: false },\n mutations: { retry: false },\n },\n });\n}\n\nexport const catalogQuery = (client: RuntimeClient) =>\n queryOptions({\n queryKey: runtimeKeys.catalog(client.url),\n queryFn: () => client.fetchPieceCatalog(),\n staleTime: SHARED_STALE_MS,\n });\n\nexport const blockFormQuery = (client: RuntimeClient, block: BlockRef) =>\n queryOptions({\n queryKey: runtimeKeys.form(client.url, block),\n queryFn: () => client.getBlockForm(block),\n staleTime: SHARED_STALE_MS,\n });\n\nexport const pieceActionsQuery = (client: RuntimeClient, packageName: string) =>\n queryOptions({\n queryKey: runtimeKeys.pieceActions(client.url, packageName),\n queryFn: () => client.fetchPieceActions(packageName),\n staleTime: SHARED_STALE_MS,\n });\n\nexport const pieceTriggersQuery = (\n client: RuntimeClient,\n packageName: string,\n) =>\n queryOptions({\n queryKey: runtimeKeys.pieceTriggers(client.url, packageName),\n queryFn: () => client.fetchPieceTriggers(packageName),\n staleTime: SHARED_STALE_MS,\n });\n\n// Kept until a test trigger could have changed the sample it derives from.\nexport const outputTreeQuery = (\n client: RuntimeClient,\n block: BlockRef,\n config: unknown,\n) =>\n queryOptions({\n queryKey: runtimeKeys.outputTree(client.url, block, config),\n queryFn: () => client.fetchBlockOutputTree(block, config),\n staleTime: Infinity,\n });\n\n// A given test's sample never changes; the key moves on with lastTest.\nexport const stepOutputTreeQuery = (\n client: RuntimeClient,\n workflowId: string,\n stepId: string,\n testedAt: string | null,\n) =>\n queryOptions({\n queryKey: runtimeKeys.stepOutputTree(\n client.url,\n workflowId,\n stepId,\n testedAt,\n ),\n queryFn: () => client.fetchStepOutputTree(workflowId, stepId),\n staleTime: Infinity,\n });\n\n// Test runs are left out: they belong to the trigger's test, not the history.\nconst REAL_RUNS = [TEST_TRIGGER_KIND];\n\nexport const runsQuery = (client: RuntimeClient, scope: RunsScope) =>\n queryOptions({\n queryKey: runtimeKeys.runs(client.url, scope),\n queryFn: () =>\n client\n .fetchRuns({ ...scope, excludeTriggerKinds: REAL_RUNS })\n .then(realRuns),\n staleTime: 0,\n });\n\n// Tests are left out by the runtime, so the newest row is the latest real run.\nexport const LATEST_RUN_WINDOW = 1;\n\n// The runs views' listing, a page at a time, without step input and output.\nexport const runPagesQuery = (client: RuntimeClient, scope: RunsScope) =>\n infiniteQueryOptions({\n queryKey: runtimeKeys.runPages(client.url, scope),\n queryFn: ({ pageParam }) =>\n client.fetchRunsPage(\n { ...scope, excludeTriggerKinds: REAL_RUNS },\n pageParam,\n ),\n initialPageParam: null as string | null,\n getNextPageParam: (page: RunPage) =>\n page.hasNextPage && page.cursor ? page.cursor : undefined,\n staleTime: 0,\n });\n\n// Pages flattened, once each: a run that starts moves up past a page break.\nexport function runsOfPages(pages: readonly RunPage[]): RunRecord[] {\n const seen = new Set<string>();\n return realRuns(pages.flatMap((page) => page.items)).filter((run) => {\n if (seen.has(run.id)) return false;\n seen.add(run.id);\n return true;\n });\n}\n\nconst FINISHED = new Set([\"SUCCEEDED\", \"FAILED\"]);\n\nexport const runQuery = (client: RuntimeClient, runId: string) =>\n queryOptions({\n queryKey: runtimeKeys.run(client.url, runId),\n queryFn: () => client.fetchRun(runId),\n // A finished run never changes.\n staleTime: (query) =>\n query.state.data && FINISHED.has(query.state.data.status) ? Infinity : 0,\n });\n\nexport const connectionsQuery = (client: RuntimeClient) =>\n queryOptions({\n queryKey: runtimeKeys.connections(client.url),\n queryFn: () => client.fetchConnections(),\n staleTime: 0,\n });\n\nexport const secretStatQuery = (client: RuntimeClient, ref: string) =>\n queryOptions({\n queryKey: runtimeKeys.secret(client.url, ref),\n queryFn: () => client.fetchSecretStat(ref),\n staleTime: 0,\n });\n\nexport interface TestStepVariables {\n workflowId: string;\n stepId: string;\n}\n\n// A step test is a new run and a new sample for the output trees.\nexport const testStepMutation = (\n client: RuntimeClient,\n queryClient: QueryClient,\n) =>\n mutationOptions<StepTestResult, Error, TestStepVariables>({\n mutationFn: ({ workflowId, stepId }) => client.testStep(workflowId, stepId),\n onSettled: () =>\n Promise.all(\n [\n runtimeKeys.allRuns(client.url),\n [client.url, \"latestRun\"],\n runtimeKeys.outputTrees(client.url),\n ].map((queryKey) => queryClient.invalidateQueries({ queryKey })),\n ),\n });\n\nexport function useTestStep(client: RuntimeClient, queryClient: QueryClient) {\n return useMutation(testStepMutation(client, queryClient), queryClient);\n}\n"],"mappings":";;;;;AAyNA,MAAa,qBAAoC;CAC/C,MAAM;CACN,aAAa;CACb,MAAM;CACN,UAAU;CACV,aACE;AACJ;;;ACpNA,MAAa,aAAa;AAG1B,MAAa,gBAAgB;AAE7B,MAAM,QAAQ,MAAiB,UAAiC;CAC9D,WAAW;CACX;CACA;AACF;AAEA,MAAa,iBAAiB,KAAK,WAAW,QAAQ;AACtD,MAAa,mBAAmB,KAAK,WAAW,UAAU;AAC1D,MAAa,kBAAkB,KAAK,WAAW,SAAS;AACxD,MAAa,eAAe,KAAK,UAAU,QAAQ;AACnD,MAAa,eAAe,KAAK,UAAU,QAAQ;AAKnD,SAAgB,UACd,GACA,GACS;CACT,OAAO,QAAQ,KAAK,KAAK,SAAS,CAAC,MAAM,SAAS,CAAC,CAAC;AACtD;AAEA,SAAgB,YAAY,OAAuC;CACjE,OAAO,MAAM,cAAc;AAC7B;AAIA,SAAgB,oBAAoB,OAAuC;CACzE,OAAO,MAAM,cAAc;AAC7B;AAEA,SAAgB,UAAU,MAIb;CACX,OAAO;EACL,WAAW,KAAK;EAChB,cAAc,KAAK;EACnB,MAAM;EACN,MAAM,KAAK;CACb;AACF;AAEA,SAAgB,aAAa,SAIhB;CACX,OAAO;EACL,WAAW,QAAQ;EACnB,cAAc,QAAQ;EACtB,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e,OAAO,gBAAgB,GAAG;CACzC,WAAW;AACb,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"trigger-text-BIeZ9W1H.js","names":[],"sources":["../../editors/workflow-editor/ui/model.ts","../../editors/workflow-editor/ui/PublishControls.tsx","../../editors/workflow-editor/ui/StepError.tsx","../../editors/shared/document-ref.tsx","../../editors/shared/data-viewer.tsx","../../editors/workflow-editor/ui/trigger-text.ts"],"sourcesContent":["// Plain view model + callbacks; no document-model imports so the UI layer\n// stays independent of Powerhouse document plumbing.\nimport type { AddedBlock } from \"./add-follow-up.js\";\nimport type { BlockForm } from \"./forms.js\";\n\nexport type WorkflowStatusValue = \"DRAFT\" | \"ENABLED\" | \"DISABLED\" | \"ARCHIVED\";\n\nexport interface PointModel {\n x: number;\n y: number;\n}\n\nexport type PropertyModeValue = \"MANUAL\" | \"EXPRESSION\";\n\nexport interface PropertySettingModel {\n prop: string;\n mode: PropertyModeValue;\n // A DYNAMIC prop's resolved children, options stripped.\n schema?: unknown;\n}\n\nexport interface TestRecordModel {\n runId: string;\n testedAt: string;\n}\n\n// Editor bookkeeping on a step or the trigger; absent on older documents.\nexport interface BlockStateModel {\n propertySettings?: PropertySettingModel[] | null;\n lastTest?: TestRecordModel | null;\n updatedAt?: string | null;\n}\n\nexport interface TriggerModel extends BlockStateModel {\n id: string;\n pieceName: string;\n pieceVersion: string;\n triggerName: string;\n config: unknown;\n connectionId: string | null;\n // A REACTOR connection, for a trigger that declares requireReactor.\n reactorConnectionId?: string | null;\n}\n\nexport type BackoffKindValue = \"FIXED\" | \"EXPONENTIAL\";\n\nexport interface RetryPolicyModel {\n maxAttempts: number;\n backoff: BackoffKindValue;\n initialDelaySeconds: number;\n maxDelaySeconds: number;\n retryOn: string[];\n}\n\nexport interface StepModel extends BlockStateModel {\n id: string;\n key: string;\n name: string;\n pieceName: string;\n pieceVersion: string;\n actionName: string;\n connectionId: string | null;\n // A REACTOR connection, for an action that declares requireReactor.\n reactorConnectionId?: string | null;\n config: unknown;\n retry: RetryPolicyModel | null;\n timeoutSeconds: number | null;\n idempotencyKeyExpression: string | null;\n position: PointModel | null;\n skip?: boolean;\n}\n\nexport interface EdgeModel {\n id: string;\n from: string;\n to: string;\n port: string;\n condition: string | null;\n}\n\nexport type VariableTypeValue =\n | \"TEXT\"\n | \"NUMBER\"\n | \"BOOLEAN\"\n | \"JSON\"\n | \"SECRET\";\n\nexport interface VariableModel {\n id: string;\n key: string;\n value: unknown;\n description: string | null;\n // Null means untyped: the type is inferred from the value.\n type?: VariableTypeValue | null;\n}\n\nexport interface PublishedBlockModel {\n id: string;\n // The step's name, or \"Trigger\".\n label: string;\n pieceName: string;\n pieceVersion: string;\n kind: \"action\" | \"trigger\";\n name: string;\n reactorConnectionId: string | null;\n}\n\nexport interface PublishedModel {\n version: number;\n publishedAt: string;\n // The snapshot's blocks, trigger first; what actually runs.\n blocks?: PublishedBlockModel[];\n}\n\nexport interface WorkflowModel {\n name: string;\n description?: string | null;\n status: WorkflowStatusValue;\n version: number;\n trigger: TriggerModel | null;\n steps: StepModel[];\n edges: EdgeModel[];\n variables: VariableModel[];\n published?: PublishedModel | null;\n // Writes nothing, bookkeeping included.\n readOnly?: boolean;\n // Kept by another document (an app's integration): shown read-only.\n managedBy?: {\n documentId: string;\n documentType: string;\n label: string;\n } | null;\n}\n\n// The side panel's id for the variables editor, beside step and trigger ids.\nexport const VARIABLES_VIEW = \"__variables\";\n\n/** Query params of the editor's view: the open panel and its tab. */\nexport const STEP_PARAM = \"step\";\nexport const TAB_PARAM = \"tab\";\n\n// Unpublished changes: never published, or edited since.\nexport function hasDraftChanges(\n model: Pick<WorkflowModel, \"version\" | \"published\">,\n): boolean {\n return !model.published || model.published.version !== model.version;\n}\n\nexport interface AddStepInputModel {\n key: string;\n name: string;\n pieceName: string;\n pieceVersion: string;\n actionName: string;\n config: unknown;\n position?: PointModel;\n}\n\nexport interface UpdateStepInputModel {\n id: string;\n key?: string;\n name?: string;\n // \"Update to vZ\" edits only pieceVersion.\n pieceName?: string;\n pieceVersion?: string;\n actionName?: string;\n // null clears the step's connection.\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n config?: unknown;\n // null clears each of these; undefined leaves them unchanged.\n retry?: RetryPolicyModel | null;\n timeoutSeconds?: number | null;\n idempotencyKeyExpression?: string | null;\n position?: PointModel;\n skip?: boolean;\n}\n\n// Field modes and DYNAMIC schemas ride along with the config edit they\n// belong to; undefined leaves them as they are.\nexport interface ConfigExtras {\n propertySettings?: PropertySettingModel[];\n}\n\nexport interface WorkflowEditorCallbacks {\n setName: (name: string) => void;\n setDescription: (description: string) => void;\n setStatus: (status: WorkflowStatusValue) => void;\n setTrigger: (\n input: {\n pieceName: string;\n pieceVersion: string;\n triggerName: string;\n config: unknown;\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n } & ConfigExtras,\n ) => AddedBlock;\n // Field-level trigger edits: each leaves the trigger's other fields alone.\n setTriggerConfig: (config: unknown, extras?: ConfigExtras) => void;\n // null clears a connection; undefined leaves it unchanged.\n setTriggerConnection: (input: {\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n }) => void;\n setTriggerPieceVersion: (pieceVersion: string) => void;\n clearTrigger: () => void;\n addStep: (input: AddStepInputModel) => AddedBlock;\n updateStep: (input: UpdateStepInputModel) => void;\n setStepConfig: (id: string, config: unknown, extras?: ConfigExtras) => void;\n // Snapshots the draft and turns the workflow on; resolves once applied.\n publish: () => Promise<void>;\n discardChanges: () => void;\n removeStep: (id: string) => void;\n addEdge: (input: {\n from: string;\n to: string;\n port: string;\n condition?: string;\n }) => void;\n removeEdge: (id: string) => void;\n // Upserts by id; no id adds a variable. Keys are unique.\n setVariable: (input: {\n id?: string;\n key: string;\n value: unknown;\n description?: string;\n // Undefined leaves the type as is; null clears it.\n type?: VariableTypeValue | null;\n }) => void;\n removeVariable: (id: string) => void;\n // Composite operations backing the canvas add buttons.\n // `port` is the inserted block's own port the old edge's target hangs off.\n insertStepOnEdge: (\n edgeId: string,\n input: AddStepInputModel,\n port: string,\n ) => AddedBlock | undefined;\n appendStep: (\n fromId: string,\n port: string,\n input: AddStepInputModel,\n ) => AddedBlock;\n // Completes a block added before its form loaded: the defaults still unset\n // and the port it continues on. Nothing when the block is gone.\n completeBlock: (added: AddedBlock, form: BlockForm) => void;\n // Copies a step with its config and advanced settings, detached from the\n // graph so no port ends up with two edges.\n duplicateStep: (id: string) => void;\n // Re-parents a step onto a port, keeping whatever follows it.\n moveStep: (move: {\n stepId: string;\n toParentId: string;\n port: string;\n }) => void;\n}\n\n// Slugified step key derived from a label, suffixed until it is free.\nexport function uniqueStepKey(taken: string[], label: string): string {\n const base =\n label\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/g, \"_\")\n .replaceAll(/^_+|_+$/g, \"\") || \"step\";\n const keys = new Set(taken);\n let key = base;\n let suffix = 2;\n while (keys.has(key)) key = `${base}_${suffix++}`;\n return key;\n}\n","// Publishing, the Activepieces way: a draft that is always editable, a\n// Publish that snapshots it, and an on/off switch for the published flow.\nimport { useState } from \"react\";\nimport { Button, Toggle, Tooltip } from \"../../shared/controls.js\";\nimport {\n hasDraftChanges,\n type WorkflowEditorCallbacks,\n type WorkflowModel,\n type WorkflowStatusValue,\n} from \"./model.js\";\nimport type { WorkflowReadiness } from \"./validation.js\";\n\n// Under enforcement a publish must be signed, or its runs reach no documents.\nexport interface PublishSignIn {\n required: boolean;\n pending: boolean;\n login: () => void;\n}\n\nfunction blockedReason(readiness: WorkflowReadiness): string {\n if (!readiness.hasTrigger) return \"Add a trigger first\";\n if (readiness.firstIncomplete) return \"You have incomplete steps\";\n return \"Checking the steps…\";\n}\n\nexport function usePublish(callbacks: WorkflowEditorCallbacks) {\n const [publishing, setPublishing] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const publish = () => {\n if (publishing) return;\n setPublishing(true);\n setError(null);\n callbacks\n .publish()\n .catch((cause: unknown) =>\n setError(cause instanceof Error ? cause.message : String(cause)),\n )\n .finally(() => setPublishing(false));\n };\n return { publishing, error, publish };\n}\n\nexport function PublishButton(props: {\n model: WorkflowModel;\n readiness: WorkflowReadiness;\n publishing: boolean;\n onPublish: () => void;\n onSelect: (id: string) => void;\n size?: \"sm\" | \"md\";\n signIn?: PublishSignIn;\n}) {\n const { model, readiness } = props;\n if (props.signIn?.required) {\n return (\n <Tooltip content=\"This Switchboard enforces document permissions, so a publish must be signed\">\n <Button\n size={props.size ?? \"sm\"}\n variant=\"primary\"\n disabled={props.signIn.pending}\n onClick={props.signIn.login}\n >\n Sign in to publish\n </Button>\n </Tooltip>\n );\n }\n const incomplete = !readiness.ready;\n const changes = hasDraftChanges(model);\n const target = readiness.firstIncomplete;\n const select = () => {\n if (target) props.onSelect(target);\n };\n return (\n <Tooltip\n enabled={incomplete}\n content={\n <button\n type=\"button\"\n className=\"font-medium text-wf-warn hover:underline\"\n onClick={select}\n >\n {blockedReason(readiness)}\n </button>\n }\n >\n {/* The disabled button passes clicks through to this wrapper. */}\n <span className=\"inline-flex\" onClick={incomplete ? select : undefined}>\n <Button\n size={props.size ?? \"sm\"}\n variant=\"primary\"\n disabled={incomplete || !changes || props.publishing}\n title={!changes && !incomplete ? \"No unpublished changes\" : undefined}\n onClick={props.onPublish}\n >\n {props.publishing ? \"Publishing…\" : \"Publish\"}\n </Button>\n </span>\n </Tooltip>\n );\n}\n\n// A dot and a word: Draft until first published, then Published, or\n// Unpublished changes once the draft moves on.\nexport function PublishState(props: {\n model: Pick<WorkflowModel, \"version\" | \"published\">;\n}) {\n const draft = hasDraftChanges(props.model);\n return (\n <span\n className=\"flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs text-muted-foreground\"\n title={\n props.model.published\n ? `Published ${new Date(props.model.published.publishedAt).toLocaleString()}`\n : \"Never published\"\n }\n >\n <span\n aria-hidden\n className={`h-2 w-2 rounded-full ${draft ? \"bg-wf-warn\" : \"bg-wf-ok\"}`}\n />\n <span>\n {!props.model.published\n ? \"Draft\"\n : draft\n ? \"Unpublished changes\"\n : \"Published\"}\n </span>\n {props.model.published && draft ? (\n <span className=\"text-muted-foreground/80\">\n · v{props.model.published.version} live\n </span>\n ) : null}\n </span>\n );\n}\n\nexport function StatusToggle(props: {\n published: boolean;\n status: WorkflowStatusValue;\n onChange: (status: WorkflowStatusValue) => void;\n tooltipSide?: \"below\" | \"left\";\n}) {\n // Nothing runs until the first publish.\n const allowed = props.published;\n const on = props.status === \"ENABLED\";\n return (\n <Tooltip\n enabled={!allowed}\n content=\"Publish the workflow first\"\n align=\"end\"\n side={props.tooltipSide}\n >\n <span className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n <Toggle\n checked={on}\n disabled={!allowed}\n label={on ? \"Turn the workflow off\" : \"Turn the workflow on\"}\n onChange={(checked) =>\n props.onChange(checked ? \"ENABLED\" : \"DISABLED\")\n }\n />\n <span className=\"w-6\">{on ? \"On\" : \"Off\"}</span>\n </span>\n </Tooltip>\n );\n}\n\n// The live snapshot's blocks that need a reactor connection and bind none.\nexport function PublishedMissingNote(props: { missing: readonly string[] }) {\n if (props.missing.length === 0) return null;\n return (\n <span\n role=\"alert\"\n aria-label=\"Published version incomplete\"\n className=\"shrink-0 whitespace-nowrap rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs text-wf-warn\"\n title={`The published version is missing a reactor connection on: ${props.missing.join(\", \")}`}\n >\n Live version incomplete\n </span>\n );\n}\n\n// Why the runtime won't give the published workflow reactor access.\nexport function ReactorDenialNote(props: { denial: string | null }) {\n if (!props.denial) return null;\n return (\n <span\n role=\"alert\"\n aria-label=\"Reactor access denied\"\n className=\"max-w-80 truncate rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs text-wf-warn\"\n title={props.denial}\n >\n No reactor access: {props.denial}\n </span>\n );\n}\n\n/** Instead of the draft banner on a managed workflow: who keeps it, and that edits here are not saved. */\nexport function ManagedBanner(props: { model: WorkflowModel }) {\n const manager = props.model.managedBy;\n if (!manager) return null;\n return (\n <div\n role=\"status\"\n className=\"pointer-events-auto flex max-w-xl items-center gap-3 rounded-lg border border-solid border-foreground/10 bg-card px-3 py-1.5 text-[13px] shadow-sm\"\n >\n <span\n className=\"h-2 w-2 shrink-0 rounded-full bg-muted-foreground\"\n aria-hidden\n />\n <span className=\"text-foreground\">\n Managed by <strong>{manager.label || manager.documentType}</strong>.\n Change it there: edits here are not saved.\n </span>\n </div>\n );\n}\n\nexport function DraftBanner(props: {\n model: WorkflowModel;\n readiness: WorkflowReadiness;\n publishing: boolean;\n error: string | null;\n onPublish: () => void;\n onDiscard: () => void;\n onSelect: (id: string) => void;\n signIn?: PublishSignIn;\n}) {\n if (!hasDraftChanges(props.model)) return null;\n const { readiness } = props;\n const target = readiness.firstIncomplete;\n return (\n <div\n role=\"status\"\n className=\"pointer-events-auto flex items-center gap-3 rounded-lg border border-solid border-foreground/10 bg-card py-1.5 pl-3 pr-1.5 text-[13px] shadow-sm\"\n >\n <span className=\"h-2 w-2 shrink-0 rounded-full bg-wf-warn\" aria-hidden />\n <span className=\"text-foreground\">You have unpublished changes</span>\n {props.error ? (\n <span className=\"text-xs text-wf-fail\">{props.error}</span>\n ) : null}\n {!readiness.hasTrigger || target ? (\n <span className=\"flex items-center gap-1.5 text-xs text-wf-warn\">\n <span>{target ? \"Incomplete steps\" : \"No trigger yet\"}</span>\n {target ? (\n <button\n type=\"button\"\n className=\"font-medium underline underline-offset-2 hover:no-underline\"\n onClick={() => props.onSelect(target)}\n >\n Show\n </button>\n ) : null}\n </span>\n ) : null}\n <span className=\"flex items-center gap-1\">\n {props.model.published ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={props.onDiscard}>\n Discard changes\n </Button>\n ) : null}\n <PublishButton\n model={props.model}\n readiness={readiness}\n publishing={props.publishing}\n onPublish={props.onPublish}\n onSelect={props.onSelect}\n signIn={props.signIn}\n />\n </span>\n </div>\n );\n}\n","// A step's error from a run.\nexport function StepError(props: { error: string }) {\n return (\n <pre className=\"overflow-auto whitespace-pre-wrap rounded-md bg-wf-fail/10 p-2.5 text-xs text-wf-fail\">\n {props.error}\n </pre>\n );\n}\n","// The documents a run's data references: the run journal keeps a reference\n// (id, type, branch, revision) in place of a document's state.\nimport type { DocumentReference } from \"@powerhousedao/pieces-framework/workflow\";\nimport { useSetSelectedNode } from \"@powerhousedao/reactor-browser\";\nimport { Button } from \"./controls.js\";\n\n// Beyond this many, the rest are counted.\nconst SHOWN = 3;\n\nfunction shortId(id: string): string {\n return id.length > 16 ? `${id.slice(0, 6)}…${id.slice(-6)}` : id;\n}\n\nfunction revisionText(reference: DocumentReference): string {\n const scopes = Object.entries(reference.revision)\n .map(([scope, count]) => `${scope} ${count}`)\n .join(\" · \");\n return reference.branch === \"main\"\n ? scopes\n : `${reference.branch}: ${scopes}`;\n}\n\nfunction DocumentRefRow(props: { reference: DocumentReference }) {\n const { reference } = props;\n const setSelectedNode = useSetSelectedNode();\n return (\n <li\n aria-label={`Document ${reference.documentId}`}\n className=\"flex items-center gap-2\"\n >\n <div className=\"min-w-0 flex-1 text-xs\">\n <div className=\"flex min-w-0 items-baseline gap-1.5\">\n <span className=\"truncate font-medium text-foreground\">\n {reference.documentType}\n </span>\n <span\n className=\"shrink-0 font-mono text-[11px] text-muted-foreground\"\n title={reference.documentId}\n >\n {shortId(reference.documentId)}\n </span>\n </div>\n <div className=\"truncate text-[11px] text-muted-foreground\">\n Revision {revisionText(reference)}\n </div>\n </div>\n <Button\n size=\"sm\"\n onClick={() => setSelectedNode(reference.documentId)}\n aria-label={`Open document ${reference.documentId}`}\n >\n Open document\n </Button>\n </li>\n );\n}\n\nexport function DocumentRefs(props: { references: DocumentReference[] }) {\n const { references } = props;\n const hidden = references.length - SHOWN;\n return (\n <div\n role=\"group\"\n aria-label=\"Document references\"\n className=\"flex flex-col gap-1.5\"\n >\n <ul className=\"m-0 flex list-none flex-col gap-1.5 p-0\">\n {references.slice(0, SHOWN).map((reference, index) => (\n <DocumentRefRow\n key={`${reference.documentId}-${index}`}\n reference={reference}\n />\n ))}\n </ul>\n {hidden > 0 ? (\n <p className=\"text-[11px] text-muted-foreground\">\n and {hidden} more in the data below\n </p>\n ) : null}\n <p className=\"text-[11px] text-muted-foreground\">\n The run kept a reference, not the state. Opening shows the document as\n it is now: past revisions can&apos;t be read yet (#3179).\n </p>\n </div>\n );\n}\n","// A run's data (a step's input or output, a trigger payload) as a foldable\n// tree, with a raw JSON view and, given a root, per-key {{references}}.\nimport {\n DOCUMENT_REF_KEY,\n documentRefsIn,\n isDocumentRefMarker,\n} from \"@powerhousedao/pieces-framework/workflow\";\nimport { lazy, Suspense, useState } from \"react\";\nimport { IconButton } from \"./controls.js\";\nimport { DocumentRefs } from \"./document-ref.js\";\n\nconst DataTree = lazy(() => import(\"./data-tree.js\"));\n\nfunction stringify(value: unknown): string {\n try {\n // undefined for functions and symbols, despite the typing.\n return (JSON.stringify(value, null, 2) as string | undefined) ?? \"\";\n } catch {\n return String(value as string);\n }\n}\n\nfunction isEmpty(value: unknown): boolean {\n if (value === undefined || value === null) return true;\n if (typeof value === \"object\") return Object.keys(value).length === 0;\n return false;\n}\n\nfunction RawJson(props: { text: string }) {\n return (\n <pre className=\"max-h-72 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground\">\n {props.text}\n </pre>\n );\n}\n\n// Stands in while the tree's chunk loads.\nfunction TreeSkeleton() {\n return (\n <div\n role=\"status\"\n aria-label=\"Loading data\"\n className=\"flex animate-pulse flex-col gap-2 py-1\"\n >\n {[\"w-2/5\", \"w-3/5\", \"w-1/2\", \"w-1/3\"].map((width, index) => (\n <span\n key={width}\n className={`h-2.5 rounded bg-muted ${width}`}\n style={{ marginLeft: index === 0 ? 0 : 16 }}\n />\n ))}\n </div>\n );\n}\n\nexport function DataViewer(props: {\n label: string;\n value: unknown;\n // Expression prefix for this value, e.g. \"steps.fetch.output\".\n root?: string;\n emptyText?: string;\n}) {\n const [raw, setRaw] = useState(false);\n const [copied, setCopied] = useState(false);\n const empty = isEmpty(props.value);\n const text = stringify(props.value);\n const tree = typeof props.value === \"object\" && props.value !== null;\n const references = tree ? documentRefsIn(props.value) : [];\n // A whole value that is a reference shows as one; its other keys stay a tree.\n const treeValue = isDocumentRefMarker(props.value)\n ? Object.fromEntries(\n Object.entries(props.value).filter(([key]) => key !== DOCUMENT_REF_KEY),\n )\n : props.value;\n\n return (\n <section\n aria-label={props.label}\n className=\"min-w-0 rounded-md border border-solid border-border bg-card\"\n >\n <header className=\"flex h-8 items-center gap-1 border-b border-solid border-border pl-3 pr-1\">\n <h4 className=\"mr-auto text-xs font-medium text-foreground\">\n {props.label}\n </h4>\n {!empty && tree ? (\n <button\n type=\"button\"\n aria-pressed={raw}\n className=\"rounded px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40\"\n onClick={() => setRaw((value) => !value)}\n >\n {raw ? \"Tree\" : \"JSON\"}\n </button>\n ) : null}\n {!empty ? (\n <IconButton\n icon={copied ? \"check\" : \"copy\"}\n label={`Copy ${props.label.toLowerCase()} as JSON`}\n onClick={() => {\n void navigator.clipboard.writeText(text).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n });\n }}\n />\n ) : null}\n </header>\n <div className=\"px-3 py-2\">\n {empty ? (\n <p className=\"text-xs text-muted-foreground\">\n {props.emptyText ?? \"Nothing\"}\n </p>\n ) : !tree ? (\n <p className=\"break-words font-mono text-xs text-foreground\">\n {text}\n </p>\n ) : raw ? (\n <RawJson text={text} />\n ) : (\n <div className=\"flex flex-col gap-2\">\n {references.length > 0 ? (\n <DocumentRefs references={references} />\n ) : null}\n {isEmpty(treeValue) ? null : (\n <div className=\"max-h-72 overflow-auto\">\n <Suspense fallback={<TreeSkeleton />}>\n <DataTree value={treeValue as object} root={props.root} />\n </Suspense>\n </div>\n )}\n </div>\n )}\n </div>\n </section>\n );\n}\n","// Plain-language descriptions of when a workflow starts: \"Every day at\n// 08:00 UTC\" rather than \"0 8 * * *\". Unknown shapes fall back to the raw text.\nimport { blockKey } from \"@powerhousedao/pieces-framework/block-type\";\nimport { blockMeta } from \"./block-meta.js\";\nimport {\n MANUAL_TRIGGER,\n REACTOR_PIECE,\n SCHEDULE_TRIGGER,\n WEBHOOK_TRIGGER,\n} from \"./blocks.js\";\nimport { parseScheduleConfig } from \"@powerhousedao/pieces-framework/workflow\";\n\nconst WEEKDAYS = [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n];\n\nconst UNIT_LABEL: Record<string, [string, string]> = {\n minutes: [\"minute\", \"minutes\"],\n hours: [\"hour\", \"hours\"],\n days: [\"day\", \"days\"],\n};\n\nfunction isInt(field: string): boolean {\n return /^\\d+$/.test(field);\n}\n\nfunction clock(hour: string, minute: string): string {\n return `${hour.padStart(2, \"0\")}:${minute.padStart(2, \"0\")}`;\n}\n\nfunction dayList(field: string): string | undefined {\n if (field === \"1-5\") return \"on weekdays\";\n if (field === \"0,6\" || field === \"6,0\") return \"at weekends\";\n const days = field.split(\",\");\n if (!days.every((day) => isInt(day) && Number(day) <= 7)) return undefined;\n const names = days.map((day) => WEEKDAYS[Number(day) % 7]);\n if (names.length === 1) return `every ${names[0]}`;\n return `on ${names.slice(0, -1).join(\", \")} and ${names[names.length - 1]}`;\n}\n\n/** Describes a five-field cron expression, or returns undefined. */\nexport function describeCron(cron: string): string | undefined {\n const fields = cron.trim().split(/\\s+/);\n if (fields.length !== 5) return undefined;\n const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;\n if (month !== \"*\") return undefined;\n\n const everyMinutes = /^\\*\\/(\\d+)$/.exec(minute);\n if (everyMinutes && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\") {\n const n = Number(everyMinutes[1]);\n return n === 1 ? \"Every minute\" : `Every ${n} minutes`;\n }\n if (minute === \"*\" && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\")\n return \"Every minute\";\n if (isInt(minute) && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\")\n return minute === \"0\"\n ? \"Every hour, on the hour\"\n : `Every hour at ${minute.padStart(2, \"0\")} past`;\n\n const everyHours = /^\\*\\/(\\d+)$/.exec(hour);\n if (isInt(minute) && everyHours && dayOfMonth === \"*\" && dayOfWeek === \"*\") {\n return `Every ${everyHours[1]} hours`;\n }\n if (!isInt(minute) || !isInt(hour)) return undefined;\n const at = clock(hour, minute);\n\n if (dayOfMonth === \"*\" && dayOfWeek === \"*\") return `Every day at ${at}`;\n if (dayOfMonth === \"*\") {\n const days = dayList(dayOfWeek);\n return days\n ? `${days.charAt(0).toUpperCase()}${days.slice(1)} at ${at}`\n : undefined;\n }\n if (isInt(dayOfMonth) && dayOfWeek === \"*\") {\n return `Every month on day ${dayOfMonth} at ${at}`;\n }\n return undefined;\n}\n\nexport function describeSchedule(config: unknown): string {\n let schedule;\n try {\n schedule = parseScheduleConfig(config);\n } catch {\n return \"On a schedule that does not parse\";\n }\n if (schedule.mode === \"interval\") {\n const unit = UNIT_LABEL[schedule.unit];\n return schedule.every === 1\n ? `Every ${unit[0]}`\n : `Every ${schedule.every} ${unit[1]}`;\n }\n const described = describeCron(schedule.cron);\n return described\n ? `${described} ${schedule.timezone}`\n : `On schedule ${schedule.cron}`;\n}\n\n// A literal config value; an expression or a blank says nothing to show.\nfunction literal(config: unknown, key: string): string | undefined {\n if (!config || typeof config !== \"object\") return undefined;\n const value = (config as Record<string, unknown>)[key];\n if (typeof value !== \"string\") return undefined;\n const text = value.trim();\n return text && !text.includes(\"{{\") ? text : undefined;\n}\n\n// \"umh/production-ledger\" reads as \"Production Ledger\".\nfunction documentTypeLabel(documentType: string): string {\n const name = documentType.split(\"/\").pop() ?? documentType;\n return name\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\n// \"APPROVE_ORDER\" reads as \"Approve order\".\nfunction actionTypeLabel(actionType: string): string {\n const words = actionType\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter(Boolean);\n const text = words.join(\" \");\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n\n/** Describes a reactor document trigger by what it filters on. */\nexport function describeDocumentTrigger(\n triggerName: string,\n config: unknown,\n): string | undefined {\n const documentType = literal(config, \"documentType\");\n const label = documentType ? documentTypeLabel(documentType) : \"\";\n const subject = label\n ? `${/^[AEIOU]/.test(label) ? \"an\" : \"a\"} ${label}`\n : literal(config, \"documentId\")\n ? \"its document\"\n : \"a document\";\n switch (triggerName) {\n case \"document-event\": {\n const actionType = literal(config, \"actionType\");\n return actionType\n ? `When ${actionTypeLabel(actionType)} runs on ${subject}`\n : `When ${subject} changes`;\n }\n case \"document-created\":\n return `When ${subject} is created`;\n case \"document-deleted\":\n return `When ${subject} is deleted`;\n default:\n return undefined;\n }\n}\n\n/** When a workflow starts, from its trigger. */\nexport function describeTrigger(\n trigger:\n | { pieceName: string; triggerName: string; config: unknown }\n | null\n | undefined,\n): string {\n if (!trigger) return \"Never starts: no trigger\";\n const block = {\n pieceName: trigger.pieceName,\n kind: \"trigger\" as const,\n name: trigger.triggerName,\n };\n switch (blockKey(block)) {\n case blockKey(MANUAL_TRIGGER):\n return \"Manual\";\n case blockKey(WEBHOOK_TRIGGER):\n return \"When its webhook is called\";\n case blockKey(SCHEDULE_TRIGGER):\n return describeSchedule(trigger.config);\n default: {\n if (trigger.pieceName === REACTOR_PIECE) {\n const described = describeDocumentTrigger(\n trigger.triggerName,\n trigger.config,\n );\n if (described) return described;\n }\n const meta = blockMeta(block);\n const piece = meta.subtitle.replace(/ · Trigger$/, \"\");\n return `${meta.displayName} in ${piece}`;\n }\n }\n}\n"],"mappings":";;;;;;;;AAuIA,MAAa,iBAAiB;;AAG9B,MAAa,aAAa;AAI1B,SAAgB,gBACd,OACS;CACT,OAAO,CAAC,MAAM,aAAa,MAAM,UAAU,YAAY,MAAM;AAC/D;AAgHA,SAAgB,cAAc,OAAiB,OAAuB;CACpE,MAAM,OACJ,M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Q,cAAc;CACnD,MAAM,QAAQ,eAAe,kBAAkB,YAAY,IAAI;CAC/D,MAAM,UAAU,QACZ,GAAG,WAAW,KAAK,KAAK,IAAI,OAAO,IAAI,GAAG,UAC1C,QAAQ,QAAQ,YAAY,IAC1B,iBACA;CACN,QAAQ,aAAR;EACE,KAAK,kBAAkB;GACrB,MAAM,aAAa,QAAQ,QAAQ,YAAY;GAC/C,OAAO,aACH,QAAQ,gBAAgB,UAAU,EAAE,WAAW,YAC/C,QAAQ,QAAQ;EACtB;EACA,KAAK,oBACH,OAAO,QAAQ,QAAQ;EACzB,KAAK,oBACH,OAAO,QAAQ,QAAQ;EACzB,SACE;CACJ;AACF;;AAGA,SAAgB,gBACd,SAIQ;CACR,IAAI,CAAC,SAAS,OAAO;CACrB,MAAM,QAAQ;EACZ,WAAW,QAAQ;EACnB,MAAM;EACN,MAAM,QAAQ;CAChB;CACA,QAAQ,SAAS,KAAK,GAAtB;EACE,KAAK,SAAS,cAAc,GAC1B,OAAO;EACT,KAAK,SAAS,eAAe,GAC3B,OAAO;EACT,KAAK,SAAS,gBAAgB,GAC5B,OAAO,iBAAiB,QAAQ,MAAM;EACxC,SAAS;GACP,IAAI,QAAQ,cAAA,gCAA6B;IACvC,MAAM,YAAY,wBAChB,QAAQ,aACR,QAAQ,MACV;IACA,IAAI,WAAW,OAAO;GACxB;GACA,MAAM,OAAO,UAAU,KAAK;GAC5B,MAAM,QAAQ,KAAK,SAAS,QAAQ,eAAe,EAAE;GACrD,OAAO,GAAG,KAAK,YAAY,MAAM;EACnC;CACF;AACF"}
@@ -1,8 +0,0 @@
1
- import { m as connectionUpgradeManifest } from "./module-FuSfFXPT.js";
2
- import { m as workflowUpgradeManifest } from "./module-DxRdnkW2.js";
3
- //#region document-models/upgrade-manifests.ts
4
- const upgradeManifests = [connectionUpgradeManifest, workflowUpgradeManifest];
5
- //#endregion
6
- export { upgradeManifests as t };
7
-
8
- //# sourceMappingURL=upgrade-manifests-bahiFXsr.js.map