@powerhousedao/switchboard 6.2.3-dev.6 → 6.2.3-dev.60

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 (177) hide show
  1. package/.tsbuild/test/attachments/byte-grants.test.d.ts +2 -0
  2. package/.tsbuild/test/attachments/byte-grants.test.d.ts.map +1 -0
  3. package/.tsbuild/test/attachments/byte-routes-read-gate.integration.test.d.ts +2 -0
  4. package/.tsbuild/test/attachments/byte-routes-read-gate.integration.test.d.ts.map +1 -0
  5. package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts +2 -0
  6. package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts.map +1 -0
  7. package/.tsbuild/test/attachments/url-signer.test.d.ts +2 -0
  8. package/.tsbuild/test/attachments/url-signer.test.d.ts.map +1 -0
  9. package/.tsbuild/test/boot-create-signature-policy.test.d.ts +2 -0
  10. package/.tsbuild/test/boot-create-signature-policy.test.d.ts.map +1 -0
  11. package/.tsbuild/test/boot-inspection-enabled.test.d.ts +2 -0
  12. package/.tsbuild/test/boot-inspection-enabled.test.d.ts.map +1 -0
  13. package/.tsbuild/test/boot-mcp-enabled.test.d.ts +2 -0
  14. package/.tsbuild/test/boot-mcp-enabled.test.d.ts.map +1 -0
  15. package/.tsbuild/test/boot-privacy.test.d.ts +2 -0
  16. package/.tsbuild/test/boot-privacy.test.d.ts.map +1 -0
  17. package/.tsbuild/test/boot-unsupported-stored-documents.test.d.ts +2 -0
  18. package/.tsbuild/test/boot-unsupported-stored-documents.test.d.ts.map +1 -0
  19. package/.tsbuild/test/boot-without-renown.test.d.ts +2 -0
  20. package/.tsbuild/test/boot-without-renown.test.d.ts.map +1 -0
  21. package/.tsbuild/test/boot-without-require-signatures.test.d.ts +2 -0
  22. package/.tsbuild/test/boot-without-require-signatures.test.d.ts.map +1 -0
  23. package/.tsbuild/test/boot-worker-trust-policy.test.d.ts +2 -0
  24. package/.tsbuild/test/boot-worker-trust-policy.test.d.ts.map +1 -0
  25. package/.tsbuild/test/boot-workflow-singleton-conflict.test.d.ts +2 -0
  26. package/.tsbuild/test/boot-workflow-singleton-conflict.test.d.ts.map +1 -0
  27. package/.tsbuild/test/boot-workflow-singleton-retry.test.d.ts +2 -0
  28. package/.tsbuild/test/boot-workflow-singleton-retry.test.d.ts.map +1 -0
  29. package/.tsbuild/test/builder-defaults.test.d.ts +2 -0
  30. package/.tsbuild/test/builder-defaults.test.d.ts.map +1 -0
  31. package/.tsbuild/test/create-signature-policy.test.d.ts +2 -0
  32. package/.tsbuild/test/create-signature-policy.test.d.ts.map +1 -0
  33. package/.tsbuild/test/durable-node-fs-pg16.test.d.ts +2 -0
  34. package/.tsbuild/test/durable-node-fs-pg16.test.d.ts.map +1 -0
  35. package/.tsbuild/test/fatal-shutdown.test.d.ts +2 -0
  36. package/.tsbuild/test/fatal-shutdown.test.d.ts.map +1 -0
  37. package/.tsbuild/test/inspection-flag.test.d.ts +2 -0
  38. package/.tsbuild/test/inspection-flag.test.d.ts.map +1 -0
  39. package/.tsbuild/test/inspection-throttle.test.d.ts +2 -0
  40. package/.tsbuild/test/inspection-throttle.test.d.ts.map +1 -0
  41. package/.tsbuild/test/mcp-flag.test.d.ts +2 -0
  42. package/.tsbuild/test/mcp-flag.test.d.ts.map +1 -0
  43. package/.tsbuild/test/observability-signals.test.d.ts +2 -0
  44. package/.tsbuild/test/observability-signals.test.d.ts.map +1 -0
  45. package/.tsbuild/test/pglite-preflight.test.d.ts +2 -0
  46. package/.tsbuild/test/pglite-preflight.test.d.ts.map +1 -0
  47. package/.tsbuild/test/plugin-presence.test.d.ts +2 -0
  48. package/.tsbuild/test/plugin-presence.test.d.ts.map +1 -0
  49. package/.tsbuild/test/renown-trust-policy.test.d.ts +2 -0
  50. package/.tsbuild/test/renown-trust-policy.test.d.ts.map +1 -0
  51. package/.tsbuild/test/snapshot-writer.d.ts +18 -0
  52. package/.tsbuild/test/snapshot-writer.d.ts.map +1 -0
  53. package/.tsbuild/test/unsupported-stored-documents.test.d.ts +2 -0
  54. package/.tsbuild/test/unsupported-stored-documents.test.d.ts.map +1 -0
  55. package/.tsbuild/test/workflow/harness.d.ts +56 -0
  56. package/.tsbuild/test/workflow/harness.d.ts.map +1 -0
  57. package/.tsbuild/test/workflow/oauth.test.d.ts +2 -0
  58. package/.tsbuild/test/workflow/oauth.test.d.ts.map +1 -0
  59. package/.tsbuild/test/workflow/resolvers.test.d.ts +2 -0
  60. package/.tsbuild/test/workflow/resolvers.test.d.ts.map +1 -0
  61. package/.tsbuild/test/workflow/webhook-dedupe.test.d.ts +2 -0
  62. package/.tsbuild/test/workflow/webhook-dedupe.test.d.ts.map +1 -0
  63. package/.tsbuild/test/workflow/webhook-signed.test.d.ts +2 -0
  64. package/.tsbuild/test/workflow/webhook-signed.test.d.ts.map +1 -0
  65. package/.tsbuild/test/workflow/webhook-trigger-test.test.d.ts +2 -0
  66. package/.tsbuild/test/workflow/webhook-trigger-test.test.d.ts.map +1 -0
  67. package/.tsbuild/test/workflow/webhook-unsigned.test.d.ts +2 -0
  68. package/.tsbuild/test/workflow/webhook-unsigned.test.d.ts.map +1 -0
  69. package/.tsbuild/test/workflow-reactor-access.test.d.ts +2 -0
  70. package/.tsbuild/test/workflow-reactor-access.test.d.ts.map +1 -0
  71. package/.tsbuild/test/workflow-reactor-enforcement.test.d.ts +2 -0
  72. package/.tsbuild/test/workflow-reactor-enforcement.test.d.ts.map +1 -0
  73. package/.tsbuild/test/workflow-read-gate.test.d.ts +2 -0
  74. package/.tsbuild/test/workflow-read-gate.test.d.ts.map +1 -0
  75. package/.tsbuild/test/workflow-runtime.test.d.ts +2 -0
  76. package/.tsbuild/test/workflow-runtime.test.d.ts.map +1 -0
  77. package/.tsbuild/tsconfig.tsbuildinfo +1 -1
  78. package/.tsbuild/tsdown.config.d.ts.map +1 -1
  79. package/.tsbuild/vitest.config.d.ts.map +1 -1
  80. package/Auth.md +144 -2
  81. package/CHANGELOG.md +736 -0
  82. package/README.md +47 -10
  83. package/dist/index.d.mts +2 -1
  84. package/dist/index.mjs +50 -50
  85. package/dist/index.mjs.map +1 -1
  86. package/dist/install-packages.d.mts +2 -1
  87. package/dist/install-packages.mjs +2 -2
  88. package/dist/install-packages.mjs.map +1 -1
  89. package/dist/mcp-cNWW82NH.mjs +27 -0
  90. package/dist/mcp-cNWW82NH.mjs.map +1 -0
  91. package/dist/migrate.d.mts +2 -1
  92. package/dist/migrate.mjs +4 -3
  93. package/dist/migrate.mjs.map +1 -1
  94. package/dist/plugin-host-CGO4XZzK.d.mts +38 -0
  95. package/dist/plugin-host-CGO4XZzK.d.mts.map +1 -0
  96. package/dist/plugins/attachments.d.mts +23 -0
  97. package/dist/plugins/attachments.d.mts.map +1 -0
  98. package/dist/plugins/attachments.mjs +4 -0
  99. package/dist/plugins/mcp.d.mts +21 -0
  100. package/dist/plugins/mcp.d.mts.map +1 -0
  101. package/dist/plugins/mcp.mjs +4 -0
  102. package/dist/plugins/privacy.d.mts +12 -0
  103. package/dist/plugins/privacy.d.mts.map +1 -0
  104. package/dist/plugins/privacy.mjs +4 -0
  105. package/dist/plugins/workflows.d.mts +36 -0
  106. package/dist/plugins/workflows.d.mts.map +1 -0
  107. package/dist/plugins/workflows.mjs +4 -0
  108. package/dist/privacy-C8KVimKF.mjs +113 -0
  109. package/dist/privacy-C8KVimKF.mjs.map +1 -0
  110. package/dist/{server-CiKkVE6g.mjs → server-C9RQTWTA.mjs} +1132 -222
  111. package/dist/server-C9RQTWTA.mjs.map +1 -0
  112. package/dist/server.d.mts +158 -30
  113. package/dist/server.d.mts.map +1 -1
  114. package/dist/server.mjs +4 -5
  115. package/dist/{utils-Baw7rThP.mjs → utils-uaBlzyjS.mjs} +15 -9
  116. package/dist/utils-uaBlzyjS.mjs.map +1 -0
  117. package/dist/utils.d.mts +4 -5
  118. package/dist/utils.d.mts.map +1 -1
  119. package/dist/utils.mjs +3 -3
  120. package/dist/workflow-runtime-7GaJ13c9.d.mts +30 -0
  121. package/dist/workflow-runtime-7GaJ13c9.d.mts.map +1 -0
  122. package/dist/workflows-qKtqZhn3.mjs +1338 -0
  123. package/dist/workflows-qKtqZhn3.mjs.map +1 -0
  124. package/package.json +49 -20
  125. package/scripts/install-packages.sh +0 -0
  126. package/test/attachment-reference-read-model.test.ts +6 -1
  127. package/test/attachments/auth.test.ts +85 -0
  128. package/test/attachments/byte-grants.test.ts +290 -0
  129. package/test/attachments/byte-routes-read-gate.integration.test.ts +314 -0
  130. package/test/attachments/download-target.test.ts +201 -32
  131. package/test/attachments/index.test.ts +47 -4
  132. package/test/attachments/reserve-metadata-parity.test.ts +96 -0
  133. package/test/attachments/routes-integration.test.ts +60 -4
  134. package/test/attachments/routes.test.ts +271 -24
  135. package/test/attachments/service-config.test.ts +13 -3
  136. package/test/attachments/url-signer.test.ts +105 -0
  137. package/test/boot-create-signature-policy.test.ts +108 -0
  138. package/test/boot-inspection-enabled.test.ts +150 -0
  139. package/test/boot-mcp-enabled.test.ts +130 -0
  140. package/test/boot-privacy.test.ts +243 -0
  141. package/test/boot-unsupported-stored-documents.test.ts +213 -0
  142. package/test/boot-without-renown.test.ts +81 -0
  143. package/test/boot-without-require-signatures.test.ts +74 -0
  144. package/test/boot-worker-trust-policy.test.ts +90 -0
  145. package/test/boot-workflow-singleton-conflict.test.ts +107 -0
  146. package/test/boot-workflow-singleton-retry.test.ts +133 -0
  147. package/test/builder-defaults.test.ts +80 -0
  148. package/test/create-signature-policy.test.ts +69 -0
  149. package/test/durable-node-fs-pg16.test.ts +80 -0
  150. package/test/fatal-shutdown.test.ts +165 -0
  151. package/test/inspection-flag.test.ts +62 -0
  152. package/test/inspection-throttle.test.ts +23 -0
  153. package/test/mcp-flag.test.ts +56 -0
  154. package/test/observability-signals.test.ts +131 -0
  155. package/test/pglite-dialect.test.ts +217 -2
  156. package/test/pglite-preflight.test.ts +313 -0
  157. package/test/pglite-version.test.ts +9 -1
  158. package/test/plugin-presence.test.ts +269 -0
  159. package/test/renown-trust-policy.test.ts +315 -0
  160. package/test/snapshot-writer.ts +94 -0
  161. package/test/unsupported-stored-documents.test.ts +72 -0
  162. package/test/worker-pool.test.ts +27 -1
  163. package/test/workflow/harness.ts +289 -0
  164. package/test/workflow/oauth.test.ts +214 -0
  165. package/test/workflow/resolvers.test.ts +357 -0
  166. package/test/workflow/webhook-dedupe.test.ts +295 -0
  167. package/test/workflow/webhook-signed.test.ts +509 -0
  168. package/test/workflow/webhook-trigger-test.test.ts +82 -0
  169. package/test/workflow/webhook-unsigned.test.ts +345 -0
  170. package/test/workflow-reactor-access.test.ts +384 -0
  171. package/test/workflow-reactor-enforcement.test.ts +808 -0
  172. package/test/workflow-read-gate.test.ts +213 -0
  173. package/test/workflow-runtime.test.ts +1122 -0
  174. package/tsconfig.json +11 -2
  175. package/tsdown.config.ts +9 -1
  176. package/dist/server-CiKkVE6g.mjs.map +0 -1
  177. package/dist/utils-Baw7rThP.mjs.map +0 -1
package/dist/server.d.mts CHANGED
@@ -1,12 +1,31 @@
1
+ import { n as WorkflowTriggersCapability } from "./workflow-runtime-7GaJ13c9.mjs";
1
2
  import { ILogger } from "document-model";
2
- import { ChannelScheme, IDocumentModelLoader, IReactorClient, InProcessReactorClientModule, JwtHandler, ReactorBuilder, ReactorClientBuilder, ReactorFeatureFlags, SignerConfig } from "@powerhousedao/reactor";
3
+ import "@powerhousedao/reactor-api/pglite-node";
4
+ import { ChannelScheme, Database, IDocumentModelLoader, IReactorClient, InProcessReactorClientModule, JwtHandler, ModelManifestEntry, PoolInstrumentation, ReactorBuilder, ReactorClientBuilder, ReactorFeatureFlags, ReactorStorageFacts, SignerConfig, UnsupportedStoredDocuments, UnsupportedStoredProtocolError } from "@powerhousedao/reactor";
3
5
  import { AttachmentReferenceProjectionCapability } from "@powerhousedao/reactor-api";
4
6
  import { IAttachmentService } from "@powerhousedao/reactor-attachments";
5
7
  import { IRenown } from "@renown/sdk/node";
8
+ import { Kysely } from "kysely";
9
+ import { IErasureService } from "@powerhousedao/reactor-privacy";
10
+ import { ResolvedPlugin } from "@powerhousedao/host-core";
6
11
  import { DriveInput } from "@powerhousedao/shared/document-drive";
12
+ import { DocumentModelModule, ISigner, SignaturePolicy, UpgradeManifest } from "@powerhousedao/shared/document-model";
13
+ import "@electric-sql/pglite";
7
14
  import { IRenown as IRenown$1 } from "@renown/sdk";
8
- import { DocumentModelModule, UpgradeManifest } from "@powerhousedao/shared/document-model";
9
-
15
+ //#region src/pglite-version.d.ts
16
+ declare const SUPPORTED_PG_MAJORS: readonly [16, 17];
17
+ type SupportedPgMajor = (typeof SUPPORTED_PG_MAJORS)[number];
18
+ //#endregion
19
+ //#region src/privacy.d.mts
20
+ type PrivacyOptions = {
21
+ /** Wins over PH_PRIVACY_ENABLED. */
22
+ enabled?: boolean;
23
+ /** Wins over PH_PRIVACY_DEPLOYMENT_SECRET. */
24
+ deploymentSecret?: string;
25
+ /** The reactor's signer, for a caller-provided reactor. */
26
+ signer?: ISigner;
27
+ };
28
+ //#endregion
10
29
  //#region src/types.d.ts
11
30
  /**
12
31
  * Drive container document type chosen for the boot-time default drive. The
@@ -14,27 +33,28 @@ import { DocumentModelModule, UpgradeManifest } from "@powerhousedao/shared/docu
14
33
  * `powerhouse/reactor-drive` is wired through `addDefaultReactorDrive` and
15
34
  * uses the relationship-based child graph.
16
35
  */
17
- type SwitchboardDriveDocumentType = "powerhouse/document-drive" | "powerhouse/reactor-drive";
36
+ export type SwitchboardDriveDocumentType = "powerhouse/document-drive" | "powerhouse/reactor-drive";
18
37
  /** A {@link DriveInput} extended with the optional drive-container type. */
19
- type SwitchboardDriveInput = DriveInput & {
38
+ export type SwitchboardDriveInput = DriveInput & {
20
39
  documentType?: SwitchboardDriveDocumentType;
21
40
  };
22
- type StorageOptions = {
41
+ export type StorageOptions = {
23
42
  type: "filesystem" | "memory" | "postgres" | "browser";
24
43
  filesystemPath?: string;
25
44
  postgresUrl?: string;
26
45
  };
27
- type IdentityOptions = {
28
- /** Path to the keypair file. Defaults to ~/.ph/keypair.json */keypairPath?: string;
46
+ export type IdentityOptions = {
47
+ /** Path to the keypair file. Defaults to ~/.ph/keypair.json */
48
+ keypairPath?: string;
29
49
  /**
30
50
  * If true, won't start without an existing keypair.
31
51
  * Use this to ensure the switchboard only runs with an authenticated identity.
32
52
  */
33
- requireExisting?: boolean; /** Base url of the Renown instance to use */
34
- baseUrl?: string; /** If true, unsigned actions will be rejected */
35
- requireSignatures?: boolean;
53
+ requireExisting?: boolean;
54
+ /** Base url of the Renown instance to use */
55
+ baseUrl?: string;
36
56
  };
37
- type StartServerOptions = {
57
+ export type StartServerOptions = {
38
58
  /**
39
59
  * Pre-built ReactorClientModule (typically from
40
60
  * `@powerhousedao/reactor#ReactorClientBuilder.buildModule`). When set, the
@@ -56,6 +76,14 @@ type StartServerOptions = {
56
76
  * pieces as needed.
57
77
  */
58
78
  reactor?: InProcessReactorClientModule;
79
+ /**
80
+ * Route uncaught exceptions, and unhandled rejections nothing else listens
81
+ * for, through the reactor's SIGTERM shutdown, so PGlite stores are flushed
82
+ * before the process exits with code 1. Installed once the switchboard's own reactor is built;
83
+ * ignored when `reactor` is passed. For process entry points only, since
84
+ * it adds process-wide listeners.
85
+ */
86
+ fatalErrorShutdown?: boolean;
59
87
  /**
60
88
  * Registry URL for the HttpPackageLoader. Enables `PackagesSubgraph`
61
89
  * (install/uninstall mutations) plus dynamic package resolution.
@@ -85,9 +113,28 @@ type StartServerOptions = {
85
113
  * When configured, the switchboard will load the keypair from `ph login`
86
114
  * and can authenticate with remote services on behalf of the user.
87
115
  */
88
- identity?: IdentityOptions; /** Base URL for the attachment service; defaults to `PH_SWITCHBOARD_PUBLIC_URL` then `http(s)://localhost:${port}`. */
116
+ identity?: IdentityOptions;
117
+ /** Base URL for the attachment service; defaults to `PH_SWITCHBOARD_PUBLIC_URL` then `http(s)://localhost:${port}`. */
89
118
  attachmentServiceUrl?: string;
119
+ /** Mount the MCP server at `/mcp`. On by default; `false` wins over
120
+ * MCP_ENABLED, which can turn it off but never on. */
90
121
  mcp?: boolean;
122
+ /** The plugin composition to boot with (FEATURE_PLUGIN_HOST_ENABLED): the
123
+ * resolved host.js runner.plugins entries, supplied by the uniform-runners
124
+ * switchboard runner (R2 step 2) or a test. Omitted = the built-in default
125
+ * composition. Resolved plugins, not specifiers — resolution happens at the
126
+ * runner against the PROJECT dependency tree. */
127
+ pluginComposition?: ResolvedPlugin[];
128
+ /** Mount the read-only inspection subgraph at `/graphql/inspection`. On by
129
+ * default; `false` wins over INSPECTION_ENABLED, which can turn it off. */
130
+ inspection?: boolean;
131
+ /** Powerhouse workflows: the runtime, its subgraph, its webhooks and its
132
+ * document models. Wins over PH_WORKFLOWS_ENABLED and the config file. */
133
+ workflows?: {
134
+ enabled?: boolean;
135
+ };
136
+ /** The GDPR add-on; off unless this or PH_PRIVACY_ENABLED turns it on. */
137
+ privacy?: PrivacyOptions;
91
138
  processorConfig?: Map<string, unknown>;
92
139
  disableLocalPackages?: boolean;
93
140
  enableDocumentModelSubgraphs?: boolean;
@@ -144,12 +191,40 @@ type StartServerOptions = {
144
191
  enabled?: boolean;
145
192
  dbPoolSize?: number;
146
193
  };
194
+ /**
195
+ * Stored documents at protocol versions this build does not run: "refuse"
196
+ * (the default) fails the boot with a StoredDocumentsRefusedError;
197
+ * "read-only" starts with a warning and keeps those documents read-only.
198
+ * Unset falls back to the REACTOR_UNSUPPORTED_STORED_DOCUMENTS env var.
199
+ * Ignored when `reactor` is passed.
200
+ */
201
+ unsupportedStoredDocuments?: UnsupportedStoredDocuments;
147
202
  };
148
- type SwitchboardReactor = {
203
+ export type SwitchboardReactor = {
149
204
  defaultDriveUrl: string | undefined;
150
- reactor: IReactorClient; /** Switchboard-backed remote attachment service over its own `/attachments/*` API, for downstream consumers. */
151
- attachmentService: IAttachmentService; /** Whether the authoritative attachment-reference projection is active. */
152
- attachmentReferenceProjection: AttachmentReferenceProjectionCapability; /** The Renown instance if identity was initialized */
205
+ reactor: IReactorClient;
206
+ /** Switchboard-backed remote attachment service over its own `/attachments/*` API, for downstream consumers.
207
+ * Undefined when the attachments plugin is absent from the composition
208
+ * (FEATURE_PLUGIN_HOST_ENABLED — presence is activation, rewire R2.3). */
209
+ attachmentService: IAttachmentService | undefined;
210
+ /** Whether the authoritative attachment-reference projection is active. */
211
+ attachmentReferenceProjection: AttachmentReferenceProjectionCapability;
212
+ /** Whether the workflow runtime's operation intake is indexing. Undefined
213
+ * when workflows are off; unavailable means no document trigger fires. */
214
+ workflowTriggers?: WorkflowTriggersCapability;
215
+ /** Whether workflows are on, after the option, PH_WORKFLOWS_ENABLED and the config file. */
216
+ workflowsEnabled: boolean;
217
+ /** The boot list of importable models workers and workflow pieces load; empty when none are resolved. */
218
+ modelManifest(): ModelManifestEntry[];
219
+ /** Present when the privacy add-on runs: its erasure service. */
220
+ privacy?: {
221
+ erasure: IErasureService;
222
+ };
223
+ /** Whether `/mcp` is mounted, after the option and MCP_ENABLED. */
224
+ mcpEnabled: boolean;
225
+ /** Whether `/graphql/inspection` is mounted, after the option and INSPECTION_ENABLED. */
226
+ inspectionEnabled: boolean;
227
+ /** The Renown instance if identity was initialized */
153
228
  renown: IRenown$1 | null;
154
229
  /**
155
230
  * Port the HTTP server actually bound to. May differ from the requested
@@ -173,29 +248,57 @@ type SwitchboardReactor = {
173
248
  //#endregion
174
249
  //#region src/builder-defaults.d.mts
175
250
  type SwitchboardReactorDefaultsOptions = {
176
- documentModels?: DocumentModelModule[]; /** Upgrade manifests for versioned models, one per document type. */
177
- upgradeManifests?: UpgradeManifest<readonly number[]>[]; /** Default true. */
251
+ documentModels?: DocumentModelModule[];
252
+ /** Upgrade manifests for versioned models, one per document type. */
253
+ upgradeManifests?: UpgradeManifest<readonly number[]>[];
254
+ /** Default true. */
178
255
  includeBaseModels?: boolean;
179
256
  /**
180
257
  * Channel scheme. Defaults to `ChannelScheme.SWITCHBOARD`, which populates
181
258
  * `reactorModule.syncModule.syncManager` — required by reactor-api. Set
182
- * to `false` only if the caller will configure a scheme themselves.
259
+ * to `false` if the caller configures sync itself (`withChannelScheme` or
260
+ * `withSync`); the builder refuses both together.
183
261
  */
184
- channelScheme?: ChannelScheme | false; /** Defaults to true. Set false when the caller owns SIGINT handling. */
185
- signalHandlers?: boolean; /** Executor tuning. Omit to use the reactor's own defaults. */
262
+ channelScheme?: ChannelScheme | false;
263
+ /** Defaults to true. Set false when the caller owns SIGINT handling. */
264
+ signalHandlers?: boolean;
265
+ /** Executor tuning. Omit to use the reactor's own defaults. */
186
266
  executorConfig?: {
187
267
  maxSkipThreshold?: number;
188
268
  featureFlags?: Partial<ReactorFeatureFlags>;
189
- }; /** Wire dynamic document-model loading via HTTP. */
269
+ };
270
+ /** Wire dynamic document-model loading via HTTP. */
190
271
  documentModelLoader?: IDocumentModelLoader;
191
272
  logger?: ILogger;
192
273
  /**
193
- * Identity signer (typically from `getRenownSignerConfig`). Applied to the
194
- * `ReactorClientBuilder`; omit for unsigned operation.
274
+ * Identity signer (typically from `getRenownSignerConfig`). Signs client
275
+ * writes and the operations the executor synthesizes, in pooled workers
276
+ * through `workerSigner`; omit for unsigned operation.
195
277
  */
196
278
  signer?: SignerConfig;
279
+ /**
280
+ * Which keys may sign as which users (typically from
281
+ * `getRenownTrustPolicyConfig`); wins over one carried by `signer`.
282
+ */
283
+ trustPolicy?: Pick<SignerConfig, "trustPolicy" | "workerTrustPolicy">;
284
+ /** What the client creates new documents as; see `resolveCreateSignaturePolicy`. */
285
+ createSignaturePolicy?: SignaturePolicy;
197
286
  };
198
- declare function applySwitchboardReactorDefaults(reactorBuilder: ReactorBuilder, clientBuilder: ReactorClientBuilder, options?: SwitchboardReactorDefaultsOptions): void;
287
+ export declare function applySwitchboardReactorDefaults(reactorBuilder: ReactorBuilder, clientBuilder: ReactorClientBuilder, options?: SwitchboardReactorDefaultsOptions): void;
288
+ //#endregion
289
+ //#region src/unsupported-stored-documents.d.mts
290
+ /** From REACTOR_UNSUPPORTED_STORED_DOCUMENTS; `input` wins when defined. */
291
+ export declare function resolveUnsupportedStoredDocuments(input: UnsupportedStoredDocuments | undefined, env: NodeJS.ProcessEnv): UnsupportedStoredDocuments;
292
+ /** The reactor refused to start over documents this build does not run. */
293
+ export declare class StoredDocumentsRefusedError extends Error {
294
+ readonly versions: readonly {
295
+ protocol: string;
296
+ version: number;
297
+ }[];
298
+ readonly documents: number;
299
+ constructor(cause: UnsupportedStoredProtocolError);
300
+ static isError(error: unknown): error is StoredDocumentsRefusedError;
301
+ }
199
302
  //#endregion
200
303
  //#region src/server.d.mts
201
304
  /**
@@ -203,9 +306,33 @@ declare function applySwitchboardReactorDefaults(reactorBuilder: ReactorBuilder,
203
306
  * the port is free, false if the OS reports it in use. Any other error is
204
307
  * surfaced so we don't silently mask real issues (permissions, bad host, …).
205
308
  */
206
- declare function isPortAvailable(port: number): Promise<boolean>;
309
+ export declare function isPortAvailable(port: number): Promise<boolean>;
310
+ /**
311
+ * The reactor's storage handle, plus the pool instrumentation when that
312
+ * storage is Postgres. The PGlite branch has no `pg.Pool` at all, so the
313
+ * instrumentation is absent rather than optional-by-convention.
314
+ */
315
+ type ReactorStorage = {
316
+ kysely: Kysely<Database>;
317
+ poolInstrumentation: PoolInstrumentation | undefined;
318
+ storageFacts: ReactorStorageFacts;
319
+ };
320
+ export declare function createReactorKysely(opts: {
321
+ reactorDbUrl: string | undefined;
322
+ reactorPgliteDir: string | null;
323
+ reactorPgliteMajor: SupportedPgMajor | null;
324
+ inMemory: boolean;
325
+ /**
326
+ * Resolved lazily: only the Postgres branch has a host pool, and
327
+ * {@link resolveHostPoolSize} throws on a bad REACTOR_DB_POOL_SIZE_HOST.
328
+ * Called eagerly it would fail a PGlite-backed server over a value that
329
+ * path never reads.
330
+ */
331
+ hostPoolSize: () => number;
332
+ logger: ILogger;
333
+ }): Promise<ReactorStorage>;
207
334
  /** Derive the remote attachment service config for switchboard's own `/attachments/*` API. */
208
- declare function deriveAttachmentServiceConfig(options: Pick<StartServerOptions, "attachmentServiceUrl" | "https">, serverPort: number, renown: IRenown | null): {
335
+ export declare function deriveAttachmentServiceConfig(options: Pick<StartServerOptions, "attachmentServiceUrl" | "https">, serverPort: number, renown: IRenown | null): {
209
336
  remoteUrl: string;
210
337
  jwtHandler: JwtHandler | undefined;
211
338
  };
@@ -226,7 +353,8 @@ declare function deriveAttachmentServiceConfig(options: Pick<StartServerOptions,
226
353
  * trigger the `withShutdownHook` chain that disposes the api. Programmatic
227
354
  * full teardown isn't currently exposed — wire it via SIGINT/SIGTERM.
228
355
  */
229
- declare const startSwitchboard: (options?: StartServerOptions) => Promise<SwitchboardReactor>;
356
+ export declare const startSwitchboard: (options?: StartServerOptions) => Promise<SwitchboardReactor>;
230
357
  //#endregion
231
- export { IdentityOptions, StartServerOptions, StorageOptions, SwitchboardDriveDocumentType, SwitchboardDriveInput, SwitchboardReactor, type SwitchboardReactorDefaultsOptions, applySwitchboardReactorDefaults, deriveAttachmentServiceConfig, isPortAvailable, startSwitchboard };
358
+ export type { SwitchboardReactorDefaultsOptions, WorkflowTriggersCapability };
359
+ export {};
232
360
  //# sourceMappingURL=server.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.mts","names":[],"sources":["../src/types.ts","../src/builder-defaults.mts","../src/server.mts"],"mappings":";;;;;;;;;;;;;;;AAgBA;KAAY,4BAAA;;KAKA,qBAAA,GAAwB,UAAA;EAClC,YAAA,GAAe,4BAAA;AAAA;AAAA,KAGL,cAAA;EACV,IAAA;EACA,cAAA;EACA,WAAA;AAAA;AAAA,KAGU,eAAA;EATiC,+DAW3C,WAAA;EARU;;;;EAaV,eAAA,YAXA;EAcA,OAAA,WAbW;EAgBX,iBAAA;AAAA;AAAA,KAGU,kBAAA;;;;;;;;;AAAZ;;;;;;;;;;;;EAqBE,OAAA,GAAU,4BAAA;EAQV;;;;;;EADA,WAAA;EACA,UAAA;EACA,IAAA;EAYA;;;;;EANA,UAAA;EACA,GAAA;EACA,MAAA;EACA,KAAA,GAAQ,qBAAA;EACR,QAAA;EACA,YAAA;EACA,KAAA;IAEM,OAAA;IACA,QAAA;EAAA;EA0CN;;;;;EAjCA,QAAA,GAAW,eAAA,EAyDT;EAvDF,oBAAA;EACA,GAAA;EACA,eAAA,GAAkB,GAAA;EAClB,oBAAA;EACA,4BAAA;;;;;;EAMA,mBAAA;EACA,MAAA,GAAS,OAAA;EA2Ec;;;;;;;;;EAjEvB,aAAA;EAoDA;;;;;;;;AC5JF;EDkHE,cAAA;;;;;;;;;EASA,UAAA;IACE,UAAA;IACA,mBAAA;IACA,gBAAA;EAAA;ECxHF;;;;;;;;;EDmIA,gBAAA;IACE,OAAA;IACA,UAAA;EAAA;AAAA;AAAA,KAIQ,kBAAA;EACV,eAAA;EACA,OAAA,EAAS,cAAA,ECpHY;EDsHrB,iBAAA,EAAmB,kBAAA,EChGL;EDkGd,6BAAA,EAA+B,uCAAA;EAE/B,MAAA,EAAQ,SAAA;EClGO;;;;EDuGf,IAAA;ECxGA;;;;;;;;;;ACyDF;;EF4DE,QAAA,QAAgB,OAAA;AAAA;;;KCzKN,iCAAA;EAIV,cAAA,GAAiB,mBAAA;EAEjB,gBAAA,GAAmB,eAAA;EAEnB,iBAAA;;ADZF;;;;ECkBE,aAAA,GAAgB,aAAA,UDbN;ECeV,cAAA;EAEA,cAAA;IACE,gBAAA;IACA,YAAA,GAAe,OAAA,CAAQ,mBAAA;EAAA,GDlBkB;ECqB3C,mBAAA,GAAsB,oBAAA;EACtB,MAAA,GAAS,OAAA;EDnBe;;;;ECwBxB,MAAA,GAAS,YAAA;AAAA;AAAA,iBAsBK,+BAAA,CACd,cAAA,EAAgB,cAAA,EAChB,aAAA,EAAe,oBAAA,EACf,OAAA,GAAS,iCAAA;;;;;;;;iBCuDK,eAAA,CAAgB,IAAA,WAAe,OAAA;;iBA0H/B,6BAAA,CACd,OAAA,EAAS,IAAA,CAAK,kBAAA,qCACd,UAAA,UACA,MAAA,EAAQ,OAAA;EACL,SAAA;EAAmB,UAAA,EAAY,UAAA;AAAA;;AF1OpC;;;;;;;;;AAIA;;;;;;;cEogCa,gBAAA,GACX,OAAA,GAAS,kBAAA,KACR,OAAA,CAAQ,kBAAA"}
1
+ {"version":3,"file":"server.d.mts","names":[],"sources":["../src/pglite-version.ts","../src/privacy.mts","../src/types.ts","../src/builder-defaults.mts","../src/unsupported-stored-documents.mts","../src/server.mts"],"mappings":";;;;;;;;;;;;;;;cASa;KACD,2BAA2B;;;KCe3B;;EAEV;;EAEA;;EAEA,SAAS;;;;;;;;;;YCRC;;YAKA,wBAAwB;EAClC,eAAe;;YAGL;EACV;EACA;EACA;;YAGU;;EAEV;;;;;EAKA;;EAGA;;YAGU;;;;;;;;;;;;;;;;;;;;;EAqBV,UAAU;;;;;;;;EAQV;;;;;;;EAOA;EACA;EACA;;;;;;EAMA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;IAEM;IACA;;;;;;;EASN,WAAW;;EAEX;;;EAGA;;;;;;EAMA,oBAAoB;;;EAGpB;;;EAGA;IACE;;;EAGF,UAAU;EACV,kBAAkB;EAClB;EACA;;;;;;EAMA;EACA,SAAS;;;;;;;;;;EAUT;;;;;;;;;;EAUA;;;;;;;;;EASA;IACE;IACA;IACA;;;;;;;;;;;EAWF;IACE;IACA;;;;;;;;;EASF,6BAA6B;;YAGnB;EACV;EACA,SAAS;;;;EAIT,mBAAmB;;EAEnB,+BAA+B;;;EAG/B,mBAAmB;;EAEnB;;EAEA,iBAAiB;;EAEjB;IAAY,SAAS;;;EAErB;;EAEA;;EAEA,QAAQ;;;;;EAKR;;;;;;;;;;;;;EAaA,gBAAgB;;;;KC7NN;EAIV,iBAAiB;;EAEjB,mBAAmB;;EAEnB;;;;;;;EAOA,gBAAgB;;EAEhB;;EAEA;IACE;IACA,eAAe,QAAQ;;;EAGzB,sBAAsB;EACtB,SAAS;;;;;;EAMT,SAAS;;;;;EAKT,cAAc,KAAK;;EAEnB,wBAAwB;;wBAiBV,gCACd,gBAAgB,gBAChB,eAAe,sBACf,UAAS;;;;wBCvEK,kCACd,OAAO,wCACP,KAAK,OAAO,aACX;;qBAaU,oCAAoC;WACtC;IAAqB;IAAkB;;WACvC;EAET,YAAY,OAAO;SAcZ,QAAQ,iBAAiB,SAAS;;;;;;;;;wBC6L3B,gBAAgB,eAAe;;;;;;KA6D1C;EACH,QAAQ,OAAO;EACf,qBAAqB;EACrB,cAAc;;wBAGM,oBAAoB;EACxC;EACA;EACA,oBAAoB;EACpB;;;;;;;EAOA;EACA,QAAQ;IACN,QAAQ;;wBA4DI,8BACd,SAAS,KAAK,uDACd,oBACA,QAAQ;EACL;EAAmB,YAAY;;;;;;;;;;;;;;;;;;;qBAmnCvB,mBAAgB,UAClB,uBACR,QAAQ"}
package/dist/server.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as applySwitchboardReactorDefaults, n as isPortAvailable, r as startSwitchboard, t as deriveAttachmentServiceConfig } from "./server-CiKkVE6g.mjs";
3
- import "./utils-Baw7rThP.mjs";
4
- export { applySwitchboardReactorDefaults, deriveAttachmentServiceConfig, isPortAvailable, startSwitchboard };
5
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="43d97572-0a08-5683-83a3-d8477151600e")}catch(e){}}();
6
- //# debugId=43d97572-0a08-5683-83a3-d8477151600e
2
+ import { a as StoredDocumentsRefusedError, c as applySwitchboardReactorDefaults, i as startSwitchboard, n as deriveAttachmentServiceConfig, o as resolveUnsupportedStoredDocuments, r as isPortAvailable, t as createReactorKysely } from "./server-C9RQTWTA.mjs";
3
+ export { StoredDocumentsRefusedError, applySwitchboardReactorDefaults, createReactorKysely, deriveAttachmentServiceConfig, isPortAvailable, resolveUnsupportedStoredDocuments, startSwitchboard };
4
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="21bbbc15-c131-5f91-94c1-5b4d5dd195f4")}catch(e){}}();
5
+ //# debugId=21bbbc15-c131-5f91-94c1-5b4d5dd195f4
@@ -1,8 +1,16 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="686dcce6-c280-5558-89dd-a18a7e514cdf")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5ece528d-aafb-5305-a04d-e0c45c8c30a3")}catch(e){}}();
3
3
  import { reactorDriveCreateDocument, reactorDriveCreateState } from "@powerhousedao/reactor-drive";
4
4
  import { driveCreateDocument, driveCreateState } from "@powerhousedao/shared/document-drive";
5
+ import { withSignaturePolicy } from "@powerhousedao/shared/document-model";
5
6
  //#region src/utils.mts
7
+ /**
8
+ * A configured id pins the drive, and only a legacy drive can take a chosen
9
+ * id; otherwise the client's creation default applies.
10
+ */
11
+ async function underCreatePolicy(client, document, id) {
12
+ return id ? withSignaturePolicy(document, "legacy", { id }) : withSignaturePolicy(document, await client.getCreateSignaturePolicy());
13
+ }
6
14
  async function addDefaultDrive(client, drive, serverPort) {
7
15
  let driveId = drive.id;
8
16
  if (!driveId || driveId.length === 0) driveId = drive.slug;
@@ -13,7 +21,7 @@ async function addDefaultDrive(client, drive, serverPort) {
13
21
  } catch {}
14
22
  if (existingDrive) return `http://localhost:${serverPort}/d/${driveId}`;
15
23
  const { global } = driveCreateState();
16
- const document = driveCreateDocument({
24
+ const document = await underCreatePolicy(client, driveCreateDocument({
17
25
  global: {
18
26
  ...global,
19
27
  name: drive.global.name,
@@ -25,8 +33,7 @@ async function addDefaultDrive(client, drive, serverPort) {
25
33
  listeners: drive.local?.listeners ?? [],
26
34
  triggers: drive.local?.triggers ?? []
27
35
  }
28
- });
29
- if (drive.id && drive.id.length > 0) document.header.id = drive.id;
36
+ }), drive.id);
30
37
  if (drive.slug && drive.slug.length > 0) document.header.slug = drive.slug;
31
38
  if (drive.global.name) document.header.name = drive.global.name;
32
39
  if (drive.preferredEditor) document.header.meta = { preferredEditor: drive.preferredEditor };
@@ -47,7 +54,7 @@ async function addDefaultReactorDrive(client, drive, serverPort) {
47
54
  } catch {}
48
55
  if (existingDrive) return `http://localhost:${serverPort}/d/${driveId}`;
49
56
  const { global, local } = reactorDriveCreateState();
50
- const document = reactorDriveCreateDocument({
57
+ const document = await underCreatePolicy(client, reactorDriveCreateDocument({
51
58
  global: {
52
59
  ...global,
53
60
  name: drive.global.name,
@@ -58,8 +65,7 @@ async function addDefaultReactorDrive(client, drive, serverPort) {
58
65
  availableOffline: drive.local?.availableOffline ?? local.availableOffline,
59
66
  sharingType: drive.local?.sharingType ?? local.sharingType
60
67
  }
61
- });
62
- if (drive.id && drive.id.length > 0) document.header.id = drive.id;
68
+ }), drive.id);
63
69
  if (drive.slug && drive.slug.length > 0) document.header.slug = drive.slug;
64
70
  if (drive.global.name) document.header.name = drive.global.name;
65
71
  if (drive.preferredEditor) document.header.meta = { preferredEditor: drive.preferredEditor };
@@ -76,5 +82,5 @@ function isPostgresUrl(url) {
76
82
  //#endregion
77
83
  export { addDefaultReactorDrive as n, isPostgresUrl as r, addDefaultDrive as t };
78
84
 
79
- //# sourceMappingURL=utils-Baw7rThP.mjs.map
80
- //# debugId=686dcce6-c280-5558-89dd-a18a7e514cdf
85
+ //# sourceMappingURL=utils-uaBlzyjS.mjs.map
86
+ //# debugId=5ece528d-aafb-5305-a04d-e0c45c8c30a3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-uaBlzyjS.mjs","sources":["../src/utils.mts"],"sourcesContent":["import type { IReactorClient } from \"@powerhousedao/reactor\";\nimport {\n reactorDriveCreateDocument,\n reactorDriveCreateState,\n} from \"@powerhousedao/reactor-drive\";\nimport {\n driveCreateDocument,\n driveCreateState,\n} from \"@powerhousedao/shared/document-drive\";\nimport type { DriveInput } from \"@powerhousedao/shared/document-drive\";\nimport {\n withSignaturePolicy,\n type PHDocument,\n} from \"@powerhousedao/shared/document-model\";\n\n/**\n * A configured id pins the drive, and only a legacy drive can take a chosen\n * id; otherwise the client's creation default applies.\n */\nasync function underCreatePolicy<TDocument extends PHDocument>(\n client: IReactorClient,\n document: TDocument,\n id: string | undefined,\n): Promise<TDocument> {\n return id\n ? withSignaturePolicy(document, \"legacy\", { id })\n : withSignaturePolicy(document, await client.getCreateSignaturePolicy());\n}\n\nexport async function addDefaultDrive(\n client: IReactorClient,\n drive: DriveInput,\n serverPort: number,\n) {\n let driveId = drive.id;\n if (!driveId || driveId.length === 0) {\n driveId = drive.slug;\n }\n\n if (!driveId || driveId.length === 0) {\n throw new Error(\"Invalid Drive Id\");\n }\n\n // check if the drive already exists\n let existingDrive;\n try {\n existingDrive = await client.get(driveId);\n } catch {\n //\n }\n\n // already exists, return the existing drive url\n if (existingDrive) {\n return `http://localhost:${serverPort}/d/${driveId}`;\n }\n\n const { global } = driveCreateState();\n const created = driveCreateDocument({\n global: {\n ...global,\n name: drive.global.name,\n icon: drive.global.icon ?? global.icon,\n },\n local: {\n availableOffline: drive.local?.availableOffline ?? false,\n sharingType: drive.local?.sharingType ?? \"public\",\n listeners: drive.local?.listeners ?? [],\n triggers: drive.local?.triggers ?? [],\n },\n });\n\n const document = await underCreatePolicy(client, created, drive.id);\n if (drive.slug && drive.slug.length > 0) {\n document.header.slug = drive.slug;\n }\n if (drive.global.name) {\n document.header.name = drive.global.name;\n }\n if (drive.preferredEditor) {\n document.header.meta = { preferredEditor: drive.preferredEditor };\n }\n\n try {\n await client.create(document);\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : String(e);\n if (!errorMessage.includes(\"already exists\")) {\n throw e;\n }\n }\n\n return `http://localhost:${serverPort}/d/${driveId}`;\n}\n\nexport async function addDefaultReactorDrive(\n client: IReactorClient,\n drive: DriveInput,\n serverPort: number,\n) {\n let driveId = drive.id;\n if (!driveId || driveId.length === 0) {\n driveId = drive.slug;\n }\n\n if (!driveId || driveId.length === 0) {\n throw new Error(\"Invalid Drive Id\");\n }\n\n let existingDrive;\n try {\n existingDrive = await client.get(driveId);\n } catch {\n //\n }\n\n if (existingDrive) {\n return `http://localhost:${serverPort}/d/${driveId}`;\n }\n\n const { global, local } = reactorDriveCreateState();\n const created = reactorDriveCreateDocument({\n global: {\n ...global,\n name: drive.global.name,\n icon: drive.global.icon ?? global.icon,\n },\n local: {\n ...local,\n availableOffline: drive.local?.availableOffline ?? local.availableOffline,\n sharingType: drive.local?.sharingType ?? local.sharingType,\n },\n });\n\n const document = await underCreatePolicy(client, created, drive.id);\n if (drive.slug && drive.slug.length > 0) {\n document.header.slug = drive.slug;\n }\n if (drive.global.name) {\n document.header.name = drive.global.name;\n }\n if (drive.preferredEditor) {\n document.header.meta = { preferredEditor: drive.preferredEditor };\n }\n\n try {\n await client.create(document);\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : String(e);\n if (!errorMessage.includes(\"already exists\")) {\n throw e;\n }\n }\n\n return `http://localhost:${serverPort}/d/${driveId}`;\n}\n\nexport function isPostgresUrl(url: string) {\n return url.startsWith(\"postgresql\") || url.startsWith(\"postgres\");\n}\n"],"names":[],"mappings":"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","debug_id":"5ece528d-aafb-5305-a04d-e0c45c8c30a3"}
package/dist/utils.d.mts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { IReactorClient } from "@powerhousedao/reactor";
2
2
  import { DriveInput } from "@powerhousedao/shared/document-drive";
3
-
4
3
  //#region src/utils.d.mts
5
- declare function addDefaultDrive(client: IReactorClient, drive: DriveInput, serverPort: number): Promise<string>;
6
- declare function addDefaultReactorDrive(client: IReactorClient, drive: DriveInput, serverPort: number): Promise<string>;
7
- declare function isPostgresUrl(url: string): boolean;
4
+ export declare function addDefaultDrive(client: IReactorClient, drive: DriveInput, serverPort: number): Promise<string>;
5
+ export declare function addDefaultReactorDrive(client: IReactorClient, drive: DriveInput, serverPort: number): Promise<string>;
6
+ export declare function isPostgresUrl(url: string): boolean;
8
7
  //#endregion
9
- export { addDefaultDrive, addDefaultReactorDrive, isPostgresUrl };
8
+ export {};
10
9
  //# sourceMappingURL=utils.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.mts"],"mappings":";;;;iBAWsB,eAAA,CACpB,MAAA,EAAQ,cAAA,EACR,KAAA,EAAO,UAAA,EACP,UAAA,WAAkB,OAAA;AAAA,iBAgEE,sBAAA,CACpB,MAAA,EAAQ,cAAA,EACR,KAAA,EAAO,UAAA,EACP,UAAA,WAAkB,OAAA;AAAA,iBA6DJ,aAAA,CAAc,GAAA"}
1
+ {"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.mts"],"mappings":";;;wBA6BsB,gBACpB,QAAQ,gBACR,OAAO,YACP,qBAAkB;wBA8DE,uBACpB,QAAQ,gBACR,OAAO,YACP,qBAAkB;wBA2DJ,cAAc"}
package/dist/utils.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as addDefaultReactorDrive, r as isPostgresUrl, t as addDefaultDrive } from "./utils-Baw7rThP.mjs";
1
+ import { n as addDefaultReactorDrive, r as isPostgresUrl, t as addDefaultDrive } from "./utils-uaBlzyjS.mjs";
2
2
  export { addDefaultDrive, addDefaultReactorDrive, isPostgresUrl };
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8227e60f-e412-513a-b0cb-502740b7f818")}catch(e){}}();
4
- //# debugId=8227e60f-e412-513a-b0cb-502740b7f818
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e030fa72-327e-52e2-9ac0-68feb4ef300a")}catch(e){}}();
4
+ //# debugId=e030fa72-327e-52e2-9ac0-68feb4ef300a
@@ -0,0 +1,30 @@
1
+ import { ILogger } from "document-model";
2
+ import { IReactorClient, InProcessReactorClientModule, ModelManifestEntry, ReactorBuilder } from "@powerhousedao/reactor";
3
+ import { SubgraphClass } from "@powerhousedao/reactor-api";
4
+ import "@powerhousedao/shared/document-model";
5
+ import "@powerhousedao/reactor-workflow";
6
+ import "@powerhousedao/shared/processors";
7
+ //#region src/workflow-runtime.d.mts
8
+ /** Whether the operation intake is indexing. Same shape as the attachment
9
+ * reference projection, because it is the same limitation. */
10
+ type WorkflowTriggersCapability = {
11
+ status: "available";
12
+ } | {
13
+ status: "unavailable";
14
+ reason: "in-process-reactor-module-unavailable" | "live-read-model-registration-unsupported" | "workflow-singleton-lost";
15
+ };
16
+ interface ComposedWorkflowRuntime {
17
+ subgraph: SubgraphClass;
18
+ /** Whether document operations reach the runtime at all; unavailable once
19
+ * the singleton is lost. */
20
+ readonly triggers: WorkflowTriggersCapability;
21
+ /** The owner name this host holds the workflow singleton under; undefined
22
+ * when the lease was not taken (a suite that opted out). */
23
+ singletonOwner?: string;
24
+ start(): Promise<void>;
25
+ stop(): Promise<void>;
26
+ }
27
+ //#endregion
28
+ export { WorkflowTriggersCapability as n, ComposedWorkflowRuntime as t };
29
+ export {};
30
+ //# sourceMappingURL=workflow-runtime-7GaJ13c9.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-runtime-7GaJ13c9.d.mts","names":[],"sources":["../src/workflow-runtime.mts"],"mappings":";;;;;;;;;KAiEY;EACN;;EAEA;EACA;;UAuRW;EACf,UAAU;;;WAGD,UAAU;;;EAGnB;EACA,SAAS;EACT,QAAQ"}