@powerhousedao/reactor-api 6.2.3-dev.76 → 6.2.3-dev.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ import { C as hasOperationSchemas, E as typeDefinitionNames, S as getGeneratedDo
4
4
  import { IAnalyticsStore } from "@powerhousedao/analytics-engine-core";
5
5
  import { AnalyticsModel } from "@powerhousedao/analytics-engine-graphql";
6
6
  import { DocumentNode, GraphQLError, GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig, GraphQLSchema } from "graphql";
7
- import { AttachmentRef, CatchUpLoadSample, DocumentModelSource as DocumentModelSource$1, ICatchUpLoadSource, IDocumentModelLoader, IDocumentModelRegistry, IDriveClient, IInspectableAttachmentStore, IInspector, IInspectorAdmin, IInspectorStorageHealthProvider, INSPECTOR_OPS, IReactorClient, IReactorFactsSink, IReactorProcessorHostModuleBase, IRelationalDb, ISyncInspector, ISyncManager, InProcessReactorClientModule, InProcessReactorModule, InspectorDocumentReader, InspectorReadOpKey, PagedResults, ParsedDriveUrl, ProcessorFactoryBuilder as ProcessorFactoryBuilder$1, Remote, SYNC_INSPECTION_OPS, SearchFilter, SyncInspectionReadOpKey, SyncScopeGate, ViewFilter, driveIdFromUrl, parseDriveUrl } from "@powerhousedao/reactor";
7
+ import { AttachmentRef, CatchUpLoadSample, DocumentModelSource as DocumentModelSource$1, ICatchUpLoadSource, IDocumentModelLoader, IDocumentModelRegistry, IDriveClient, IInspectableAttachmentStore, IInspector, IInspectorAdmin, IInspectorStorageHealthProvider, INSPECTOR_OPS, IReactorClient, IReactorFactsSink, IReactorProcessorHostModuleBase, IReactorReadClient, IReactorWriteClient, IRelationalDb, ISyncInspector, ISyncManager, InProcessReactorClientModule, InProcessReactorModule, InspectorDocumentReader, InspectorReadOpKey, PagedResults, ParsedDriveUrl, ProcessorFactoryBuilder as ProcessorFactoryBuilder$1, Remote, SYNC_INSPECTION_OPS, SearchFilter, SyncInspectionReadOpKey, SyncScopeGate, ViewFilter, driveIdFromUrl, parseDriveUrl } from "@powerhousedao/reactor";
8
8
  import { AuthSubject, DocumentModelModule, Operation, PHDocument, UpgradeManifest } from "@powerhousedao/shared/document-model";
9
9
  import { ILogger } from "document-model";
10
10
  import { GraphQLResolverMap } from "@apollo/subgraph";
@@ -81,6 +81,58 @@ export interface DbClient {
81
81
  export declare function getDbClient(connectionString?: string | undefined, pgliteFactory?: PgliteFactory): DbClient;
82
82
  export declare const initAnalyticsStoreSql: string[];
83
83
  //#endregion
84
+ //#region src/services/permission-cache.d.ts
85
+ /**
86
+ * Everything an authorization decision reads about one document: its
87
+ * protection flag (the configured default when it has no protection row), its
88
+ * owner, the users' grant levels and the users granted each operation.
89
+ * Addresses are stored lowercase, as the permission service writes them.
90
+ */
91
+ export declare class DocumentPermissionSnapshot {
92
+ readonly documentId: string;
93
+ readonly isProtected: boolean;
94
+ readonly ownerAddress: string | null;
95
+ readonly grants: ReadonlyMap<string, DocumentPermissionLevel>;
96
+ readonly operationGrants: ReadonlyMap<string, ReadonlySet<string>>;
97
+ constructor(documentId: string, isProtected: boolean, ownerAddress: string | null, grants: ReadonlyMap<string, DocumentPermissionLevel>, operationGrants: ReadonlyMap<string, ReadonlySet<string>>);
98
+ grantLevel(userAddress: string): DocumentPermissionLevel | null;
99
+ isOperationRestricted(operationType: string): boolean;
100
+ hasOperationGrant(operationType: string, userAddress: string): boolean;
101
+ }
102
+ /** Loads the snapshots of the given documents; every id gets one. */
103
+ export type PermissionSnapshotLoader = (documentIds: string[]) => Promise<Map<string, DocumentPermissionSnapshot>>;
104
+ export interface PermissionCacheOptions {
105
+ /** How long an entry is served without reloading; 0 disables caching. */
106
+ ttlMs: number;
107
+ /** Entries kept before the least recently used one is dropped. */
108
+ maxEntries: number;
109
+ now: () => number;
110
+ }
111
+ export declare const DEFAULT_PERMISSION_CACHE_TTL_MS = 30000;
112
+ export declare const DEFAULT_PERMISSION_CACHE_OPTIONS: PermissionCacheOptions;
113
+ /**
114
+ * Per-process cache of document permission snapshots, keyed by document id.
115
+ *
116
+ * Filled on miss from the store, invalidated by the permission service after
117
+ * each of its own writes, and expired after `ttlMs` as the safety net for
118
+ * writes made by another process (another switchboard instance on the same
119
+ * database) until cross-instance invalidation exists.
120
+ *
121
+ * A load that overlaps an invalidation still answers its caller but is not
122
+ * stored, so a read that started before a write commits cannot repopulate
123
+ * the cache with the pre-write rows.
124
+ */
125
+ export declare class PermissionCache {
126
+ #private;
127
+ constructor(load: PermissionSnapshotLoader, options?: PermissionCacheOptions);
128
+ get size(): number;
129
+ get(documentId: string): Promise<DocumentPermissionSnapshot>;
130
+ /** Snapshots for every id, loading the missing and expired ones in one batch. */
131
+ getMany(documentIds: string[]): Promise<Map<string, DocumentPermissionSnapshot>>;
132
+ invalidate(documentId: string): void;
133
+ clear(): void;
134
+ }
135
+ //#endregion
84
136
  //#region src/services/document-permission.service.d.ts
85
137
  export interface DocumentPermissionEntry {
86
138
  documentId: string;
@@ -122,7 +174,13 @@ export interface DocumentPermissionConfig {
122
174
  export declare class DocumentPermissionService {
123
175
  private readonly db;
124
176
  readonly config: DocumentPermissionConfig;
125
- constructor(db: Kysely<DocumentPermissionDatabase>, config?: DocumentPermissionConfig);
177
+ /**
178
+ * Serves the reads authorization decisions make (protection, owner, grant
179
+ * level, operation grants). Every write through this service invalidates
180
+ * the document it touched.
181
+ */
182
+ readonly permissionCache: PermissionCache;
183
+ constructor(db: Kysely<DocumentPermissionDatabase>, config?: DocumentPermissionConfig, cacheOptions?: PermissionCacheOptions);
126
184
  /**
127
185
  * Get the permission level for a user on a specific document.
128
186
  * Returns null if no permission is set.
@@ -189,6 +247,11 @@ export declare class DocumentPermissionService {
189
247
  * Collects all ancestor IDs first (with cycle detection), then batch-checks protection.
190
248
  */
191
249
  isProtectedWithAncestors(documentId: string, getParentIds: GetParentIdsFn): Promise<boolean>;
250
+ /**
251
+ * Reads the permission rows of the given documents from the store, three
252
+ * queries for the whole batch. The permission cache's loader.
253
+ */
254
+ loadPermissionSnapshots(documentIds: string[]): Promise<Map<string, DocumentPermissionSnapshot>>;
192
255
  /**
193
256
  * Collect all ancestor IDs (including the document itself) with cycle detection.
194
257
  */
@@ -432,6 +495,21 @@ export declare class AuthService implements ICredentialInvalidator {
432
495
  private fetchCredentialExists;
433
496
  }
434
497
  //#endregion
498
+ //#region src/graphql/request-clients.d.ts
499
+ /**
500
+ * The reactor client halves a resolver may use, carried on the GraphQL
501
+ * context as `ctx.clients`.
502
+ */
503
+ interface RequestClients {
504
+ /** Answers from read models; always present. */
505
+ readonly read: IReactorReadClient;
506
+ /**
507
+ * Enqueues writes. Present while a mutation executes; reading it in a query
508
+ * or a subscription throws {@link WriteClientUnavailableError}.
509
+ */
510
+ readonly write: IReactorWriteClient;
511
+ }
512
+ //#endregion
435
513
  //#region src/graphql/gateway/types.d.ts
436
514
  export type TlsOptions = {
437
515
  keyPath: string;
@@ -843,12 +921,28 @@ export declare class CanonicalDocumentIdResolutionError extends Error {
843
921
  constructor();
844
922
  }
845
923
  export type CanonicalDocumentIdResolver = (identifier: string) => Promise<CanonicalDocumentId>;
924
+ /** Resolves an identifier the way the read side's data paths do. */
925
+ export type ReadSideIdentity = Pick<IReactorReadClient, "resolveIdOrSlug">;
926
+ /** Resolves an identifier the way a mutation resolves its target. */
927
+ export type WriteSideIdentity = Pick<IReactorWriteClient, "describe">;
928
+ /** The halves an identifier can be resolved on; mutations need `write`. */
929
+ export type CanonicalIdClients = {
930
+ read: ReadSideIdentity;
931
+ write?: WriteSideIdentity;
932
+ };
933
+ /** Which side resolves: a mutation resolves on the write side. */
934
+ export type CanonicalIdOperation = "query" | "mutation" | "subscription";
846
935
  /**
847
936
  * The sanctioned string-to-CanonicalDocumentId cast: both the GraphQL layer
848
937
  * and server routes must resolve caller identifiers through this helper so
849
938
  * decision and data layers always agree on the subject document.
939
+ *
940
+ * Queries and subscriptions resolve on the read half (`resolveIdOrSlug`, the
941
+ * lookup their data fetch makes); mutations on the write half (`describe`, the
942
+ * lookup their write makes). A bare read client (or the facade, whose
943
+ * `write` is then used) is accepted as the read half.
850
944
  */
851
- export declare function createCanonicalDocumentIdResolver(client: Pick<IReactorClient, "resolveIdOrSlug">): CanonicalDocumentIdResolver;
945
+ export declare function createCanonicalDocumentIdResolver(clients: CanonicalIdClients | ReadSideIdentity, operationType?: CanonicalIdOperation): CanonicalDocumentIdResolver;
852
946
  //#endregion
853
947
  //#region src/services/attachment-access.service.d.ts
854
948
  /**
@@ -1060,6 +1154,12 @@ export type Context = {
1060
1154
  /** The did:key of the app instance that issued this request's token. */
1061
1155
  appKey: string;
1062
1156
  };
1157
+ /**
1158
+ * The reactor client halves this operation may use. `read` is always there;
1159
+ * `write` only while a mutation executes, and reading it anywhere else
1160
+ * throws an error naming the field.
1161
+ */
1162
+ clients: RequestClients;
1063
1163
  };
1064
1164
  export type ISubgraph = {
1065
1165
  name: string;
@@ -1073,14 +1173,33 @@ export type ISubgraph = {
1073
1173
  path?: string;
1074
1174
  resolvers: Record<string, any>;
1075
1175
  typeDefs: DocumentNode;
1076
- reactorClient: IReactorClient;
1176
+ /** The read half, for setup-time lookups; resolvers read through `ctx.clients.read`. */
1177
+ readClient?: IReactorReadClient;
1178
+ /** @deprecated Resolvers use `ctx.clients`; setup-time code uses `readClient`. */
1179
+ reactorClient?: IReactorClient;
1077
1180
  relationalDb: IRelationalDb;
1181
+ /**
1182
+ * Query fields of this subgraph that read write-side state and so are handed
1183
+ * `ctx.clients.write` although they run in a query. Honoured for the host's
1184
+ * core subgraphs only.
1185
+ */
1186
+ writeSideQueries?: readonly string[];
1078
1187
  hasSubscriptions?: boolean;
1079
1188
  onSetup?: () => Promise<void>;
1080
1189
  onDisconnect?: () => Promise<void>;
1081
1190
  };
1082
1191
  export type SubgraphArgs = {
1083
- reactorClient: IReactorClient;
1192
+ /**
1193
+ * The read half, for setup-time lookups (schema building, model lookup).
1194
+ * Resolvers read through `ctx.clients.read` and write through
1195
+ * `ctx.clients.write`. Derived from `reactorClient` when absent.
1196
+ */
1197
+ readClient?: IReactorReadClient;
1198
+ /**
1199
+ * @deprecated The facade over both halves, kept for one release for
1200
+ * subgraphs that still call it. Use `readClient` and `ctx.clients`.
1201
+ */
1202
+ reactorClient?: IReactorClient;
1084
1203
  /**
1085
1204
  * The subgraph's package's slice of the HTTP surface, for serving REST
1086
1205
  * routes and webhooks alongside the GraphQL API. Already bound to the
@@ -1189,6 +1308,16 @@ export declare class BaseSubgraph implements ISubgraph$1 {
1189
1308
  path: string;
1190
1309
  resolvers: Record<string, any>;
1191
1310
  typeDefs: DocumentNode;
1311
+ /**
1312
+ * The read half, for setup-time use (schema building, model lookup).
1313
+ * Resolvers read through `ctx.clients.read` instead.
1314
+ */
1315
+ readonly readClient: IReactorReadClient;
1316
+ /**
1317
+ * @deprecated The facade over both halves, for subgraphs that have not
1318
+ * moved. Resolvers use `ctx.clients.read` and, in a mutation,
1319
+ * `ctx.clients.write`; setup-time code uses {@link readClient}.
1320
+ */
1192
1321
  reactorClient: IReactorClient;
1193
1322
  /** This package's namespaced slice of the HTTP surface. */
1194
1323
  readonly http: SubgraphArgs$1["http"];
@@ -1213,13 +1342,20 @@ export declare class BaseSubgraph implements ISubgraph$1 {
1213
1342
  * @throws Error when the host provides no attachment client to subgraphs.
1214
1343
  */
1215
1344
  attachmentsFor(ctx: Context): IAttachmentClient;
1345
+ /**
1346
+ * The clients this request's operation may use: those the GraphQL layer put
1347
+ * on the context. A context it never saw (a resolver called directly) reads
1348
+ * through {@link readClient} and may not write.
1349
+ */
1350
+ clientsOf(ctx: Context | undefined): RequestClients;
1216
1351
  onSetup(): Promise<void>;
1217
1352
  onDisconnect(): Promise<void>;
1218
1353
  /**
1219
1354
  * Resolves a caller-supplied identifier (id or slug) to its canonical
1220
1355
  * document id, memoized per request. Both the decision layer and the data
1221
- * layer must agree on the subject, so this runs the same resolveIdOrSlug
1222
- * lookup the data path uses. A resolution failure (not found, ambiguous, or
1356
+ * layer must agree on the subject, so this runs the lookup the data path
1357
+ * uses: `resolveIdOrSlug` on the read half for a query, `describe` on the
1358
+ * write half for a mutation. A resolution failure (not found, ambiguous, or
1223
1359
  * transient) surfaces as a generic Forbidden, fail-closed, so a bad
1224
1360
  * identifier cannot be used as a document-existence oracle.
1225
1361
  */
@@ -1602,7 +1738,19 @@ export type GraphQLManagerOptions = {
1602
1738
  path: string;
1603
1739
  httpServer: http.Server;
1604
1740
  wsServer: WebSocketServer;
1605
- reactorClient: IReactorClient;
1741
+ /**
1742
+ * The read half: every query reads through it (as `ctx.clients.read`), and
1743
+ * so do setup-time lookups, drive discovery and the drive ownership cache.
1744
+ */
1745
+ readClient?: IReactorReadClient;
1746
+ /** The write half, handed to mutation resolvers as `ctx.clients.write`. */
1747
+ writeClient?: IReactorWriteClient;
1748
+ /**
1749
+ * @deprecated Pass `readClient` and `writeClient`. Accepted for one release:
1750
+ * the halves are taken from its `read` and `write`, and it is still handed
1751
+ * to subgraphs as their deprecated `reactorClient`.
1752
+ */
1753
+ reactorClient?: IReactorClient;
1606
1754
  relationalDb: IRelationalDb;
1607
1755
  analyticsStore: IAnalyticsStore;
1608
1756
  syncManager: ISyncManager;
@@ -1624,7 +1772,7 @@ export type GraphQLManagerOptions = {
1624
1772
  inspection?: IReactorInspectionSource;
1625
1773
  /**
1626
1774
  * Where drive ownership is looked up, past the read gate. Defaults to the
1627
- * reactor client, which withholds a drive the host's own key may not read.
1775
+ * read client, which withholds a drive the host's own key may not read.
1628
1776
  */
1629
1777
  driveStore?: DriveStore;
1630
1778
  reportError?: ReportError;
@@ -1676,7 +1824,6 @@ export declare class GraphQLManager {
1676
1824
  private readonly path;
1677
1825
  private readonly httpServer;
1678
1826
  private readonly wsServer;
1679
- private readonly reactorClient;
1680
1827
  private readonly relationalDb;
1681
1828
  private readonly analyticsStore;
1682
1829
  private readonly syncManager;
@@ -2333,6 +2480,13 @@ export type ConsistencyCoordinate = {
2333
2480
  readonly operationIndex: Scalars["Int"]["output"];
2334
2481
  readonly scope: Scalars["String"]["output"];
2335
2482
  };
2483
+ /** A consistency token's coordinate, as ConsistencyCoordinate reports it. */
2484
+ export type ConsistencyCoordinateInput = {
2485
+ readonly branch: Scalars["String"]["input"];
2486
+ readonly documentId: Scalars["String"]["input"];
2487
+ readonly operationIndex: Scalars["Int"]["input"];
2488
+ readonly scope: Scalars["String"]["input"];
2489
+ };
2336
2490
  /**
2337
2491
  * The write positions a job reached, for read-after-write. Only meaningful once
2338
2492
  * the job has completed.
@@ -2342,6 +2496,15 @@ export type ConsistencyToken = {
2342
2496
  readonly createdAtUtcIso: Scalars["String"]["output"];
2343
2497
  readonly version: Scalars["Int"]["output"];
2344
2498
  };
2499
+ /**
2500
+ * A consistency token, as JobInfo.consistencyToken reports it. A read given one
2501
+ * waits until the read models it reads from hold every coordinate it names.
2502
+ */
2503
+ export type ConsistencyTokenInput = {
2504
+ readonly coordinates: ReadonlyArray<ConsistencyCoordinateInput>;
2505
+ readonly createdAtUtcIso: Scalars["String"]["input"];
2506
+ readonly version: Scalars["Int"]["input"];
2507
+ };
2345
2508
  export type CreateDefaults = {
2346
2509
  readonly protocolVersions: Scalars["JSONObject"]["output"];
2347
2510
  readonly signaturePolicy: Scalars["String"]["output"];
@@ -2799,11 +2962,13 @@ export type QueryCreateDefaultsArgs = {
2799
2962
  parentIdOrSlug?: InputMaybe<Scalars["String"]["input"]>;
2800
2963
  };
2801
2964
  export type QueryDocumentArgs = {
2965
+ consistency?: InputMaybe<ConsistencyTokenInput>;
2802
2966
  idOrSlug?: InputMaybe<Scalars["String"]["input"]>;
2803
2967
  identifier?: InputMaybe<Scalars["String"]["input"]>;
2804
2968
  view?: InputMaybe<ViewFilterInput>;
2805
2969
  };
2806
2970
  export type QueryDocumentIncomingRelationshipEdgesArgs = {
2971
+ consistency?: InputMaybe<ConsistencyTokenInput>;
2807
2972
  paging?: InputMaybe<PagingInput>;
2808
2973
  relationshipType?: InputMaybe<Scalars["String"]["input"]>;
2809
2974
  targetIdOrSlug?: InputMaybe<Scalars["String"]["input"]>;
@@ -2811,6 +2976,7 @@ export type QueryDocumentIncomingRelationshipEdgesArgs = {
2811
2976
  view?: InputMaybe<ViewFilterInput>;
2812
2977
  };
2813
2978
  export type QueryDocumentIncomingRelationshipsArgs = {
2979
+ consistency?: InputMaybe<ConsistencyTokenInput>;
2814
2980
  paging?: InputMaybe<PagingInput>;
2815
2981
  relationshipType: Scalars["String"]["input"];
2816
2982
  targetIdOrSlug?: InputMaybe<Scalars["String"]["input"]>;
@@ -2826,6 +2992,7 @@ export type QueryDocumentOperationsArgs = {
2826
2992
  paging?: InputMaybe<PagingInput>;
2827
2993
  };
2828
2994
  export type QueryDocumentOutgoingRelationshipEdgesArgs = {
2995
+ consistency?: InputMaybe<ConsistencyTokenInput>;
2829
2996
  paging?: InputMaybe<PagingInput>;
2830
2997
  relationshipType?: InputMaybe<Scalars["String"]["input"]>;
2831
2998
  sourceIdOrSlug?: InputMaybe<Scalars["String"]["input"]>;
@@ -2833,6 +3000,7 @@ export type QueryDocumentOutgoingRelationshipEdgesArgs = {
2833
3000
  view?: InputMaybe<ViewFilterInput>;
2834
3001
  };
2835
3002
  export type QueryDocumentOutgoingRelationshipsArgs = {
3003
+ consistency?: InputMaybe<ConsistencyTokenInput>;
2836
3004
  paging?: InputMaybe<PagingInput>;
2837
3005
  relationshipType: Scalars["String"]["input"];
2838
3006
  sourceIdOrSlug?: InputMaybe<Scalars["String"]["input"]>;
@@ -2850,6 +3018,7 @@ export type QueryEvaluateActionsArgs = {
2850
3018
  documentIdentifier?: InputMaybe<Scalars["String"]["input"]>;
2851
3019
  };
2852
3020
  export type QueryFindDocumentsArgs = {
3021
+ consistency?: InputMaybe<ConsistencyTokenInput>;
2853
3022
  paging?: InputMaybe<PagingInput>;
2854
3023
  search?: InputMaybe<SearchFilterInput>;
2855
3024
  view?: InputMaybe<ViewFilterInput>;
@@ -3849,7 +4018,9 @@ export type ResolversTypes = ResolversObject<{
3849
4018
  ChannelMeta: ResolverTypeWrapper<ChannelMeta>;
3850
4019
  ChannelMetaInput: ChannelMetaInput;
3851
4020
  ConsistencyCoordinate: ResolverTypeWrapper<ConsistencyCoordinate>;
4021
+ ConsistencyCoordinateInput: ConsistencyCoordinateInput;
3852
4022
  ConsistencyToken: ResolverTypeWrapper<ConsistencyToken>;
4023
+ ConsistencyTokenInput: ConsistencyTokenInput;
3853
4024
  CreateDefaults: ResolverTypeWrapper<CreateDefaults>;
3854
4025
  DateTime: ResolverTypeWrapper<Scalars["DateTime"]["output"]>;
3855
4026
  DeadLetterInfo: ResolverTypeWrapper<DeadLetterInfo>;
@@ -3925,7 +4096,9 @@ export type ResolversParentTypes = ResolversObject<{
3925
4096
  ChannelMeta: ChannelMeta;
3926
4097
  ChannelMetaInput: ChannelMetaInput;
3927
4098
  ConsistencyCoordinate: ConsistencyCoordinate;
4099
+ ConsistencyCoordinateInput: ConsistencyCoordinateInput;
3928
4100
  ConsistencyToken: ConsistencyToken;
4101
+ ConsistencyTokenInput: ConsistencyTokenInput;
3929
4102
  CreateDefaults: CreateDefaults;
3930
4103
  DateTime: Scalars["DateTime"]["output"];
3931
4104
  DeadLetterInfo: DeadLetterInfo;
@@ -4330,6 +4503,8 @@ export declare function ActionCandidateInputSchema(): z$1.ZodObject<Properties<A
4330
4503
  export declare function ActionContextInputSchema(): z$1.ZodObject<Properties<ActionContextInput>>;
4331
4504
  export declare function ActionInputSchema(): z$1.ZodObject<Properties<ActionInput>>;
4332
4505
  export declare function ChannelMetaInputSchema(): z$1.ZodObject<Properties<ChannelMetaInput>>;
4506
+ export declare function ConsistencyCoordinateInputSchema(): z$1.ZodObject<Properties<ConsistencyCoordinateInput>>;
4507
+ export declare function ConsistencyTokenInputSchema(): z$1.ZodObject<Properties<ConsistencyTokenInput>>;
4333
4508
  export declare function DocumentOperationsFilterInputSchema(): z$1.ZodObject<Properties<DocumentOperationsFilterInput>>;
4334
4509
  export declare function ExecutionJobInputSchema(): z$1.ZodObject<Properties<ExecutionJobInput>>;
4335
4510
  export declare function OperationContextInputSchema(): z$1.ZodObject<Properties<OperationContextInput>>;
@@ -4580,6 +4755,8 @@ export declare class ReactorSubgraph extends BaseSubgraph {
4580
4755
  constructor(args: SubgraphArgs);
4581
4756
  name: string;
4582
4757
  hasSubscriptions: boolean;
4758
+ /** See {@link resolvers.WRITE_SIDE_QUERIES}. */
4759
+ readonly writeSideQueries: readonly string[];
4583
4760
  private get documentChanges();
4584
4761
  /**
4585
4762
  * Check operation-level permissions for an array of actions.
@@ -4975,14 +5152,31 @@ export interface ClientInitializerResult {
4975
5152
  module: InProcessReactorClientModule;
4976
5153
  reactorDriveClient?: IDriveClient;
4977
5154
  attachmentReferenceProjection?: AttachmentReferenceProjectionCapability;
5155
+ /**
5156
+ * The reactor store, bound to the schema its migrations ran in, where the
5157
+ * document permission tables live (reactor migration 029). When absent the
5158
+ * permission service keeps the legacy tables on the read-model store.
5159
+ */
5160
+ permissionsDb?: Kysely<DocumentPermissionDatabase>;
4978
5161
  }
4979
5162
  export interface ClientInitializerDependencies {
4980
5163
  attachmentReferenceWriter: IAttachmentReferenceWriter;
4981
5164
  /** Upgrade manifests exported by the loaded packages, one per type. */
4982
5165
  upgradeManifests: UpgradeManifest<readonly number[]>[];
5166
+ /** The read-model store, for moving data that used to live there. */
5167
+ readModelDb: Kysely<unknown>;
4983
5168
  }
5169
+ /**
5170
+ * The permission cache TTL from `DOCUMENT_PERMISSION_CACHE_TTL_MS`: a
5171
+ * non-negative integer of milliseconds, 0 disabling the cache. Anything else
5172
+ * falls back to the default with a warning.
5173
+ */
5174
+ export declare function resolvePermissionCacheTtlMs(raw: string | undefined, logger: ILogger): number;
4984
5175
  export declare function initializeAndStartAPI(clientInitializer: (documentModels: DocumentModelModule[], dependencies: ClientInitializerDependencies) => Promise<ClientInitializerResult>, options: Options, processorApp: ProcessorApp): Promise<API & {
5176
+ /** @deprecated Use `read` and `write`. */
4985
5177
  client: IReactorClient;
5178
+ read: IReactorReadClient;
5179
+ write: IReactorWriteClient;
4986
5180
  syncManager: ISyncManager;
4987
5181
  documentModelRegistry: IDocumentModelRegistry;
4988
5182
  readiness: ReadinessGate;
@@ -5018,6 +5212,6 @@ export declare class PrivacyPermissionAdapter {
5018
5212
  erasePermissions(documentId: string): Promise<Record<string, number>>;
5019
5213
  }
5020
5214
  //#endregion
5021
- export { type AttachmentReadGate, type AuthorizationConfig, type AuthorizerResult, type CanonicalDocumentId, DocumentModelSchema, DocumentModelSchemaCache, DocumentModelSchemaOptions, DocumentModelSource, GeneratedDocumentModelTypes, type HttpRouteServiceOptions, type IAuthorizationService, type IDocumentScopeGate, type IEventLoopDelaySource, type IHttpScope, type IPackageLoader, type IPackageLoaderOptions, type IPackagePieceSource, type IReactorInspectionSource, type IWebhookEndpoints, type IWebhookScope, type IWebhookStore, type InspectionCallerGate, type InspectionReadField, type InspectionThrottleConfig, type NodeRouteSpec, PGLITE_UTC_PARSERS, type PackagePiece, type PackagePieceEntry, type PackagesSubgraphArgs, type ParsedDriveUrl, type ReactorInspectionOptions, ReportError, type RequestLoadRecorderOptions, ReservedTypeNames, ResolvedDocumentModelSchema, type RouteActor, type RouteAuth, type RouteAuthorizer, type RouteBody, type RouteContext, type RouteHandler, type RouteMethod, type RouteOptions, type RouteSpec, type RouteTransport, type RouteUser, RunDetachedOptions, type ScopedRouteHandle, SubgraphSchemaOptions, SubgraphTypeCollisionError, type WebhookEndpointInfo, type WebhookEndpointRow, type WebhookField, type WebhookHashAlgorithm, type WebhookPolicy, type WebhookReply, type WebhookRequest, type WebhookScheme, type WebhookSignatureEncoding, type WebhookSpec, type WebhookVerification, assembleSubgraphTypeDefs, buildDocumentModelSchema, buildSubgraphSchemaModule, createMergedSchema, createSchema, documentModelSubgraphTypes, driveIdFromUrl, findSubgraphTypeCollisions, generateDocumentModelSchema, generatedTypesOf, getDocumentModelSchemaName, getDocumentModelSubgraphName, getDocumentModelTypeDefs, getGeneratedDocumentModelTypes, hasOperationSchemas, parseDriveUrl, reportFailure, reservedTypeNames, reservedTypeNamesTaken, runDetached, typeDefinitionNames };
5215
+ export { type AttachmentReadGate, type AuthorizationConfig, type AuthorizerResult, type CanonicalDocumentId, DocumentModelSchema, DocumentModelSchemaCache, DocumentModelSchemaOptions, DocumentModelSource, GeneratedDocumentModelTypes, type HttpRouteServiceOptions, type IAuthorizationService, type IDocumentScopeGate, type IEventLoopDelaySource, type IHttpScope, type IPackageLoader, type IPackageLoaderOptions, type IPackagePieceSource, type IReactorInspectionSource, type IWebhookEndpoints, type IWebhookScope, type IWebhookStore, type InspectionCallerGate, type InspectionReadField, type InspectionThrottleConfig, type NodeRouteSpec, PGLITE_UTC_PARSERS, type PackagePiece, type PackagePieceEntry, type PackagesSubgraphArgs, type ParsedDriveUrl, type ReactorInspectionOptions, ReportError, type RequestClients, type RequestLoadRecorderOptions, ReservedTypeNames, ResolvedDocumentModelSchema, type RouteActor, type RouteAuth, type RouteAuthorizer, type RouteBody, type RouteContext, type RouteHandler, type RouteMethod, type RouteOptions, type RouteSpec, type RouteTransport, type RouteUser, RunDetachedOptions, type ScopedRouteHandle, SubgraphSchemaOptions, SubgraphTypeCollisionError, type WebhookEndpointInfo, type WebhookEndpointRow, type WebhookField, type WebhookHashAlgorithm, type WebhookPolicy, type WebhookReply, type WebhookRequest, type WebhookScheme, type WebhookSignatureEncoding, type WebhookSpec, type WebhookVerification, assembleSubgraphTypeDefs, buildDocumentModelSchema, buildSubgraphSchemaModule, createMergedSchema, createSchema, documentModelSubgraphTypes, driveIdFromUrl, findSubgraphTypeCollisions, generateDocumentModelSchema, generatedTypesOf, getDocumentModelSchemaName, getDocumentModelSubgraphName, getDocumentModelTypeDefs, getGeneratedDocumentModelTypes, hasOperationSchemas, parseDriveUrl, reportFailure, reservedTypeNames, reservedTypeNamesTaken, runDetached, typeDefinitionNames };
5022
5216
  export {};
5023
5217
  //# sourceMappingURL=index.d.mts.map