@powerhousedao/shared 6.2.3-dev.33 → 6.2.3-dev.35
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/clis/args/index.d.mts +1 -1
- package/dist/clis/args/{service-BBx5GDTc.d.mts → service-CHjY5epu.d.mts} +3 -3
- package/dist/clis/args/{service-BBx5GDTc.d.mts.map → service-CHjY5epu.d.mts.map} +1 -1
- package/dist/clis/args/service.d.mts +1 -1
- package/dist/clis/build-pieces.d.mts +1 -1
- package/dist/clis/constants.d.mts +1 -1
- package/dist/clis/index.d.mts +3 -2
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +5 -2
- package/dist/clis/index.mjs.map +1 -1
- package/dist/clis/{types-nzer4WIr.d.mts → types-DM26OWlT.d.mts} +2 -2
- package/dist/clis/{types-nzer4WIr.d.mts.map → types-DM26OWlT.d.mts.map} +1 -1
- package/dist/{config-loader-C6dZB_iX.js → config-loader-CXhzL512.js} +7 -2
- package/dist/{config-loader-C6dZB_iX.js.map → config-loader-CXhzL512.js.map} +1 -1
- package/dist/connect/config-loader.d.ts +2 -1
- package/dist/connect/config-loader.d.ts.map +1 -1
- package/dist/connect/config-loader.js +2 -2
- package/dist/connect/index.d.ts +3 -3
- package/dist/connect/index.js +2 -2
- package/dist/document-drive/index.d.ts +3 -4
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-model/index.d.ts +2 -3
- package/dist/document-model/index.js +7 -322
- package/dist/document-model/index.js.map +1 -1
- package/dist/{index-5gwOhPG5.d.ts → index-DdXp-CVw.d.ts} +2 -2
- package/dist/{index-5gwOhPG5.d.ts.map → index-DdXp-CVw.d.ts.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/processors/index.d.ts +2 -2
- package/dist/processors/index.js +58 -3
- package/dist/processors/index.js.map +1 -1
- package/dist/purge-v06m_oGz.js +381 -0
- package/dist/purge-v06m_oGz.js.map +1 -0
- package/dist/registry/index.d.ts +3 -3
- package/dist/registry/index.js +10 -1
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +2 -2
- package/dist/{types-CI3ren9F.d.ts → types-B11NGQOQ.d.ts} +20 -12
- package/dist/types-B11NGQOQ.d.ts.map +1 -0
- package/dist/{types-CmeoQg_J.d.ts → types-CFbd2nan.d.ts} +1489 -468
- package/dist/types-CFbd2nan.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/index-D6833Siv.d.ts +0 -939
- package/dist/index-D6833Siv.d.ts.map +0 -1
- package/dist/types-CI3ren9F.d.ts.map +0 -1
- package/dist/types-CmeoQg_J.d.ts.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { f as IAnalyticsStore } from "./types-Bsp8VL2y.js";
|
|
2
|
-
import
|
|
2
|
+
import "./utils-BrKxCmKx.js";
|
|
3
|
+
import { ZodIssue, ZodRawShape, z } from "zod";
|
|
3
4
|
import { Draft } from "mutative";
|
|
5
|
+
import { Kysely, QueryCreator } from "kysely";
|
|
4
6
|
import { ArgParser } from "cmd-ts/dist/cjs/argparser.js";
|
|
5
7
|
import { Agent } from "package-manager-detector";
|
|
6
8
|
import { OperationWithContext } from "@powerhousedao/shared/document-model";
|
|
7
|
-
import { Kysely, QueryCreator } from "kysely";
|
|
8
9
|
import { IncomingMessage, ServerResponse } from "node:http";
|
|
9
10
|
import { FC, ReactNode } from "react";
|
|
10
11
|
//#region clis/args/common.d.ts
|
|
@@ -985,477 +986,987 @@ type Action = {
|
|
|
985
986
|
context?: ActionContext;
|
|
986
987
|
};
|
|
987
988
|
//#endregion
|
|
988
|
-
//#region
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
989
|
+
//#region document-model/action-signature.d.ts
|
|
990
|
+
declare const ACTION_SIGNATURE_V2_PREFIX = "v2:";
|
|
991
|
+
/** The log an operation is stored in, which a v2 tuple is bound to. */
|
|
992
|
+
type ActionSigningTarget = {
|
|
993
|
+
documentId: string;
|
|
994
|
+
branch: string;
|
|
995
|
+
};
|
|
996
|
+
/** Who a v2 tuple attributes the action to; both halves are in the preimage. */
|
|
997
|
+
type ActionSignerIdentity = {
|
|
998
|
+
user: UserActionSigner;
|
|
999
|
+
app: AppActionSigner;
|
|
1000
|
+
};
|
|
1001
|
+
/** A value that would not survive a JSON store round trip unchanged. */
|
|
1002
|
+
declare class CanonicalJsonError extends Error {
|
|
1003
|
+
constructor(path: string, detail: string);
|
|
996
1004
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1005
|
+
/** Sorted-key JSON, as the state hash encodes; drops `undefined` properties. */
|
|
1006
|
+
declare function canonicalJson(value: unknown, label?: string): string;
|
|
1007
|
+
/** Actions the reactor reduces itself, onto the document scope. */
|
|
1008
|
+
declare const DOCUMENT_SCOPE_ACTION_TYPES: ReadonlySet<string>;
|
|
1009
|
+
/** Where a document-scope action writes: `sourceId` or `documentId`. */
|
|
1010
|
+
declare function targetDocumentId(action: {
|
|
1011
|
+
type: string;
|
|
1012
|
+
input: unknown;
|
|
1013
|
+
}, fallback: string): string;
|
|
1014
|
+
/** The log an action submitted to a job on `documentId` is stored in. */
|
|
1015
|
+
declare function actionSigningTarget(action: {
|
|
1016
|
+
type: string;
|
|
1017
|
+
input: unknown;
|
|
1018
|
+
}, documentId: string, branch: string): ActionSigningTarget;
|
|
1019
|
+
/** The identity a signer writes into `context.signer`, and signs over. */
|
|
1020
|
+
declare function actionSignerIdentity(signer: {
|
|
1021
|
+
user?: UserActionSigner;
|
|
1022
|
+
app?: AppActionSigner;
|
|
1023
|
+
}): ActionSignerIdentity;
|
|
1024
|
+
/** The v2 preimage; throws `CanonicalJsonError` on an unsignable action. */
|
|
1025
|
+
declare function actionPreimageV2(action: Action, target: ActionSigningTarget, signer: ActionSignerIdentity): string;
|
|
1026
|
+
/** `"v2:" + base64url(sha256(preimage))`, unpadded. */
|
|
1027
|
+
declare function hashActionV2(action: Action, target: ActionSigningTarget, signer: ActionSignerIdentity): Promise<string>;
|
|
1028
|
+
/** Signs `action` as a v2 tuple; the message layout is the legacy one. */
|
|
1029
|
+
declare function signActionV2(params: {
|
|
1030
|
+
action: Action;
|
|
1031
|
+
target: ActionSigningTarget;
|
|
1032
|
+
signer: ActionSignerIdentity;
|
|
1033
|
+
sign: ActionSigningHandler;
|
|
1034
|
+
previousStateHash?: string;
|
|
1035
|
+
}): Promise<Signature>;
|
|
1036
|
+
/** Element [2] carries the v2 prefix, whether or not it is well formed. */
|
|
1037
|
+
declare function isV2ActionHash(hash: string): boolean;
|
|
1038
|
+
/** The strict shape of a v2 tuple, apart from what its hash covers. */
|
|
1039
|
+
declare function v2TupleProblem(tuple: Signature): string | undefined;
|
|
1040
|
+
//#endregion
|
|
1041
|
+
//#region document-model/action-transport.d.ts
|
|
1042
|
+
/**
|
|
1043
|
+
* An action's signer, as the wire declares it: signatures joined into strings,
|
|
1044
|
+
* because GraphQL declares them as a list of strings rather than of lists.
|
|
1045
|
+
*/
|
|
1046
|
+
type TransportSigner = {
|
|
1047
|
+
user?: {
|
|
1048
|
+
address: string;
|
|
1049
|
+
networkId: string;
|
|
1050
|
+
chainId: number;
|
|
1051
|
+
};
|
|
1052
|
+
app?: {
|
|
1053
|
+
name: string;
|
|
1054
|
+
key: string;
|
|
1055
|
+
};
|
|
1056
|
+
signatures: string[];
|
|
1000
1057
|
};
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1058
|
+
/** An action's context, as the wire declares it. */
|
|
1059
|
+
type TransportActionContext = {
|
|
1060
|
+
prevOpIndex?: number;
|
|
1061
|
+
prevOpHash?: string;
|
|
1062
|
+
nonce?: string;
|
|
1063
|
+
signer?: TransportSigner;
|
|
1064
|
+
};
|
|
1065
|
+
/** An action projected onto exactly the fields the wire declares. */
|
|
1066
|
+
type TransportAction = {
|
|
1067
|
+
id: string;
|
|
1068
|
+
type: string;
|
|
1069
|
+
timestampUtcMs: string;
|
|
1070
|
+
/**
|
|
1071
|
+
* Non-nullable, because the wire declares it so. An action's own type says
|
|
1072
|
+
* `unknown`, which admits the absent input an action creator called without
|
|
1073
|
+
* one produces - {@link toTransportAction} refuses that rather than passing
|
|
1074
|
+
* it on.
|
|
1075
|
+
*/
|
|
1076
|
+
input: NonNullable<unknown>;
|
|
1077
|
+
scope: string;
|
|
1078
|
+
context?: TransportActionContext;
|
|
1079
|
+
};
|
|
1080
|
+
/**
|
|
1081
|
+
* Projects an action onto the fields the GraphQL `ActionInput` declares.
|
|
1082
|
+
*
|
|
1083
|
+
* A projection rather than a spread, because an input object rejects a field it
|
|
1084
|
+
* does not declare, and that refusal takes the whole request with it. An action
|
|
1085
|
+
* read back out of storage can carry fields the type no longer has - a legacy
|
|
1086
|
+
* `attachments` array, or the operation fields left behind by a signing helper
|
|
1087
|
+
* that returns an operation - and any one of them would sink an otherwise valid
|
|
1088
|
+
* submission.
|
|
1089
|
+
*
|
|
1090
|
+
* Only fields the action actually carries are emitted, so an unsigned action
|
|
1091
|
+
* sends no context at all rather than a context full of nulls.
|
|
1092
|
+
*/
|
|
1093
|
+
declare function toTransportAction(action: Action): TransportAction;
|
|
1094
|
+
//#endregion
|
|
1095
|
+
//#region document-model/auth.d.ts
|
|
1096
|
+
type InitializeAuthActionInput = {
|
|
1097
|
+
version: number;
|
|
1098
|
+
grants: Grant[];
|
|
1099
|
+
};
|
|
1100
|
+
type SetGrantActionInput = {
|
|
1101
|
+
grant: Grant;
|
|
1102
|
+
};
|
|
1103
|
+
type RemoveGrantActionInput = {
|
|
1104
|
+
id: string;
|
|
1105
|
+
};
|
|
1106
|
+
type MoveGrantActionInput = {
|
|
1107
|
+
id: string;
|
|
1108
|
+
/** Target index in the grant list; clamped to the valid range. */
|
|
1109
|
+
index: number;
|
|
1110
|
+
};
|
|
1111
|
+
type InitializeAuthAction = Action & {
|
|
1112
|
+
type: "INITIALIZE_AUTH";
|
|
1113
|
+
input: InitializeAuthActionInput;
|
|
1114
|
+
};
|
|
1115
|
+
type SetGrantAction = Action & {
|
|
1116
|
+
type: "SET_GRANT";
|
|
1117
|
+
input: SetGrantActionInput;
|
|
1118
|
+
};
|
|
1119
|
+
type RemoveGrantAction = Action & {
|
|
1120
|
+
type: "REMOVE_GRANT";
|
|
1121
|
+
input: RemoveGrantActionInput;
|
|
1122
|
+
};
|
|
1123
|
+
type MoveGrantAction = Action & {
|
|
1124
|
+
type: "MOVE_GRANT";
|
|
1125
|
+
input: MoveGrantActionInput;
|
|
1126
|
+
};
|
|
1127
|
+
type AuthAction = InitializeAuthAction | SetGrantAction | RemoveGrantAction | MoveGrantAction;
|
|
1128
|
+
declare const AUTH_ACTION_TYPES: readonly ["INITIALIZE_AUTH", "SET_GRANT", "REMOVE_GRANT", "MOVE_GRANT"];
|
|
1129
|
+
declare function isAuthAction(action: Action): action is AuthAction;
|
|
1130
|
+
/** Highest known policy version; decide() fails closed above it. */
|
|
1131
|
+
declare const MAX_SUPPORTED_AUTH_VERSION = 1;
|
|
1132
|
+
declare const InitializeAuthActionInputSchema: () => z.ZodObject<{
|
|
1133
|
+
version: z.ZodNumber;
|
|
1134
|
+
grants: z.ZodArray<z.ZodCustom<Grant, Grant>>;
|
|
1135
|
+
}, z.core.$strip>;
|
|
1136
|
+
declare const SetGrantActionInputSchema: () => z.ZodObject<{
|
|
1137
|
+
grant: z.ZodCustom<Grant, Grant>;
|
|
1138
|
+
}, z.core.$strip>;
|
|
1139
|
+
declare const RemoveGrantActionInputSchema: () => z.ZodObject<{
|
|
1140
|
+
id: z.ZodString;
|
|
1141
|
+
}, z.core.$strip>;
|
|
1142
|
+
declare const MoveGrantActionInputSchema: () => z.ZodObject<{
|
|
1143
|
+
id: z.ZodString;
|
|
1144
|
+
index: z.ZodNumber;
|
|
1145
|
+
}, z.core.$strip>;
|
|
1146
|
+
declare const initializeAuth: (input: InitializeAuthActionInput) => InitializeAuthAction;
|
|
1147
|
+
declare const setGrant: (input: SetGrantActionInput) => SetGrantAction;
|
|
1148
|
+
declare const removeGrant: (input: RemoveGrantActionInput) => RemoveGrantAction;
|
|
1149
|
+
declare const moveGrant: (input: MoveGrantActionInput) => MoveGrantAction;
|
|
1150
|
+
/**
|
|
1151
|
+
* True when `signerKey` (an ActionSigner app key, a did:key) identifies the same
|
|
1152
|
+
* key recorded as the document creator. Returns false
|
|
1153
|
+
* when there is no creator (empty JWK) or no signer key.
|
|
1154
|
+
*/
|
|
1155
|
+
declare function isDocumentCreator(creatorKey: JsonWebKey | undefined, signerKey: string | undefined): boolean;
|
|
1156
|
+
/**
|
|
1157
|
+
* Sets the initial policy. Valid only while the auth scope is uninitialized
|
|
1158
|
+
* (version 0). The input version is the policy language version and must be an
|
|
1159
|
+
* integer >= 1; 0 is reserved for the uninitialized state. On a signed-header
|
|
1160
|
+
* document it must be signed by the document creator (`header.sig.publicKey`).
|
|
1161
|
+
* A creator-less policy must include a grant permitting execute on the auth
|
|
1162
|
+
* scope, or it would be born locked out.
|
|
1163
|
+
*/
|
|
1164
|
+
declare function applyInitializeAuthAction<TState extends PHBaseState>(document: PHDocument<TState>, action: InitializeAuthAction): PHDocument<TState>;
|
|
1165
|
+
/** Upserts a grant by id: replaces in place if present, otherwise appends. */
|
|
1166
|
+
declare function applySetGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: SetGrantAction): PHDocument<TState>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Removes a grant by id; throws if the id is not present or if the removal
|
|
1169
|
+
* would leave a creator-less policy with no auth-administration grant.
|
|
1170
|
+
*/
|
|
1171
|
+
declare function applyRemoveGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: RemoveGrantAction): PHDocument<TState>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Moves a grant by id to a new index. Order is load-bearing (the last
|
|
1174
|
+
* applicable grant wins), so the relative order of the other grants is kept.
|
|
1175
|
+
* The target index is clamped to the valid range; an unknown id throws.
|
|
1176
|
+
*
|
|
1177
|
+
* Order alone decides which grant wins, so a move can take administration away
|
|
1178
|
+
* without changing the list's contents. It carries the same retention rule as
|
|
1179
|
+
* the two mutation paths.
|
|
1180
|
+
*/
|
|
1181
|
+
declare function applyMoveGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: MoveGrantAction): PHDocument<TState>;
|
|
1182
|
+
/**
|
|
1183
|
+
* Dispatches an auth-scope action to its handler. This is the auth scope's
|
|
1184
|
+
* dedicated reducer: it is applied by the base reducer instead of the model
|
|
1185
|
+
* reducer, mirroring the document-scope platform handlers. Unknown types are a
|
|
1186
|
+
* no-op, matching the model-reducer default.
|
|
1187
|
+
*/
|
|
1188
|
+
declare function applyAuthAction<TState extends PHBaseState>(document: PHDocument<TState>, action: Action): PHDocument<TState>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Because only creators can initialize auth scopes, we must verify that either
|
|
1191
|
+
* the document has no auth or the version and creator match.
|
|
1192
|
+
*/
|
|
1193
|
+
declare function assertAuthPreservedOnDuplicate(documentId: string, source: PHAuthState | undefined, duplicated: PHAuthState | undefined): void;
|
|
1194
|
+
/**
|
|
1195
|
+
* The auth scope a state snapshot may install, given the policy already there.
|
|
1196
|
+
*
|
|
1197
|
+
* `applyAuthAction` is the validated door onto `state.auth`, but a whole-state
|
|
1198
|
+
* snapshot (UPGRADE_DOCUMENT's `initialState`) replaces the scope wholesale and
|
|
1199
|
+
* is authorized as a `document`-scope write. Without this, a subject holding
|
|
1200
|
+
* `execute` on `document` and no auth grant at all can install a policy of its
|
|
1201
|
+
* choosing, name itself `creator` (which exempts the policy from the retention
|
|
1202
|
+
* rule for good), or wipe an existing policy by carrying the default
|
|
1203
|
+
* uninitialized one.
|
|
1204
|
+
*
|
|
1205
|
+
* Three cases:
|
|
1206
|
+
*
|
|
1207
|
+
* - the snapshot carries no policy, or an uninitialized one: the document
|
|
1208
|
+
* keeps the policy it has, so a default-state upgrade cannot reset it;
|
|
1209
|
+
* - the document is uninitialized and the snapshot carries a policy: the
|
|
1210
|
+
* policy is installed after the same validation genesis applies, so it
|
|
1211
|
+
* cannot be born locked out;
|
|
1212
|
+
* - both carry a policy: they must agree. A duplicate preserves its source's
|
|
1213
|
+
* policy (see {@link assertAuthPreservedOnDuplicate}), and anything else is
|
|
1214
|
+
* an attempt to replace one policy with another.
|
|
1215
|
+
*/
|
|
1216
|
+
declare function resolveSnapshotAuth(documentId: string, documentType: string, current: PHAuthState | undefined, incoming: PHAuthState | undefined): PHAuthState;
|
|
1217
|
+
/** UNDO and REDO are rejected on the auth scope. */
|
|
1218
|
+
declare function assertAuthScopeActionAllowed(action: Action): void;
|
|
1219
|
+
type AuthVerb = "read" | "execute";
|
|
1220
|
+
type AuthRequest = {
|
|
1221
|
+
verb: AuthVerb;
|
|
1222
|
+
scope: string;
|
|
1223
|
+
/** For execute: the operation (action type) being attempted. Omitted for reads. */
|
|
1224
|
+
operation?: string;
|
|
1225
|
+
};
|
|
1226
|
+
type AuthSubject = {
|
|
1227
|
+
/** Verified signer address; undefined for an anonymous subject. */
|
|
1228
|
+
address?: string;
|
|
1229
|
+
/** The signer's app key (a did:key), used to match the document creator. */
|
|
1230
|
+
key?: string;
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* What condition attr paths resolve against, beyond the subject. Supplied
|
|
1234
|
+
* only while authConditions enforcement is on: with no context a grant
|
|
1235
|
+
* carrying `where` or a { match } principal never applies.
|
|
1236
|
+
*/
|
|
1237
|
+
type ConditionContext = {
|
|
1238
|
+
/** The executing scope's own state, for `doc.<scope>.*` paths. */
|
|
1239
|
+
scopeState: unknown;
|
|
1240
|
+
/** The action's input, for `action.input.*` paths. Absent for reads. */
|
|
1241
|
+
actionInput?: unknown;
|
|
1242
|
+
};
|
|
1243
|
+
type AuthDecision = "allow" | "deny";
|
|
1244
|
+
/** Why the policy refused a request. */
|
|
1245
|
+
type AuthRefusal = "version-unsupported" | "no-applicable-grant" | "denied-by-grant";
|
|
1246
|
+
/**
|
|
1247
|
+
* A decision together with why it refused. A refusal names which of the
|
|
1248
|
+
* policy's rules produced it, so an operation records the reason it was refused
|
|
1249
|
+
* rather than one reason standing for every refusal.
|
|
1250
|
+
*/
|
|
1251
|
+
type AuthEvaluation = {
|
|
1252
|
+
decision: "allow";
|
|
1009
1253
|
} | {
|
|
1010
|
-
|
|
1011
|
-
|
|
1254
|
+
decision: "deny";
|
|
1255
|
+
refusal: AuthRefusal;
|
|
1256
|
+
grantId?: string;
|
|
1012
1257
|
};
|
|
1013
|
-
/**
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
/**
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1258
|
+
/**
|
|
1259
|
+
* Evaluates the auth policy for a single request and reports why it refused.
|
|
1260
|
+
* Pure and deterministic.
|
|
1261
|
+
*
|
|
1262
|
+
* An uninitialized policy (version 0, absent auth state, or a legacy `{}`
|
|
1263
|
+
* auth scope serialized before PHAuthState had a version) leaves the document
|
|
1264
|
+
* open. Once a policy exists the default is deny, and grants stack in order.
|
|
1265
|
+
*
|
|
1266
|
+
* Group principals match only against a supplied groups map (the groups
|
|
1267
|
+
* projection, present when authGroups is on); with no map they never apply.
|
|
1268
|
+
* `where` clauses and { match } principals likewise evaluate only against a
|
|
1269
|
+
* supplied condition context (present when authConditions is on).
|
|
1270
|
+
*/
|
|
1271
|
+
declare function evaluate(auth: PHAuthState | undefined, subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthEvaluation;
|
|
1272
|
+
/**
|
|
1273
|
+
* Evaluates the auth policy for a single request. Pure and deterministic. This
|
|
1274
|
+
* is {@link evaluate} with the reason dropped.
|
|
1275
|
+
*/
|
|
1276
|
+
declare function decide(auth: PHAuthState | undefined, subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthDecision;
|
|
1277
|
+
/**
|
|
1278
|
+
* The group document ids a single auth action's input names with `{ group }`
|
|
1279
|
+
* principals. INITIALIZE_AUTH contributes the groups named across its grants,
|
|
1280
|
+
* SET_GRANT the groups named by its one grant; REMOVE_GRANT and MOVE_GRANT
|
|
1281
|
+
* contribute nothing. Total over any input shape, because references are read
|
|
1282
|
+
* from the input as it arrived, including inputs later stored as errors.
|
|
1283
|
+
*/
|
|
1284
|
+
declare function mentionedGroupIds(action: Action): string[];
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region document-model/auth-v1.d.ts
|
|
1287
|
+
/** Maximum number of grants in a policy. */
|
|
1288
|
+
declare const MAX_AUTH_GRANTS = 100;
|
|
1289
|
+
/** Maximum nesting depth of a condition tree. */
|
|
1290
|
+
declare const MAX_CONDITION_DEPTH = 10;
|
|
1291
|
+
/** Maximum node count (conditions plus operands) of a condition tree. */
|
|
1292
|
+
declare const MAX_CONDITION_NODES = 100;
|
|
1293
|
+
/** Maximum entries in an execute capability's operation list. */
|
|
1294
|
+
declare const MAX_CAPABILITY_OPERATIONS = 100;
|
|
1295
|
+
/**
|
|
1296
|
+
* Thrown when a grant violates the v1 validation rules. The message is stored
|
|
1297
|
+
* on error operations, so it must be a pure function of the input.
|
|
1298
|
+
*/
|
|
1299
|
+
declare class InvalidGrantError extends Error {
|
|
1300
|
+
readonly grantId: string;
|
|
1301
|
+
constructor(grantId: string, problem: string);
|
|
1036
1302
|
}
|
|
1037
|
-
/**
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
prefix: string;
|
|
1042
|
-
baseUrl: string;
|
|
1303
|
+
/** Thrown for a `{ group }` principal on a group document: references never chain. */
|
|
1304
|
+
declare class GroupPrincipalNotAllowedError extends Error {
|
|
1305
|
+
readonly grantId: string;
|
|
1306
|
+
constructor(grantId: string);
|
|
1043
1307
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
signal: AbortSignal;
|
|
1053
|
-
transport: RouteTransport;
|
|
1308
|
+
/**
|
|
1309
|
+
* Thrown when a change would leave a creator-less policy with no grant
|
|
1310
|
+
* permitting execute on the auth scope. Without the creator carve-out no
|
|
1311
|
+
* subject could ever administer such a policy again.
|
|
1312
|
+
*/
|
|
1313
|
+
declare class AuthAdministrationLockoutError extends Error {
|
|
1314
|
+
readonly grantId: string;
|
|
1315
|
+
constructor(grantId: string);
|
|
1054
1316
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1317
|
+
/**
|
|
1318
|
+
* Thrown when INITIALIZE_AUTH would create a creator-less policy with no grant
|
|
1319
|
+
* permitting execute on the auth scope. Such a policy would be born with no
|
|
1320
|
+
* subject able to administer it.
|
|
1321
|
+
*/
|
|
1322
|
+
declare class AuthAdministrationMissingError extends Error {
|
|
1323
|
+
constructor();
|
|
1061
1324
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1325
|
+
declare function isPlainValue(value: unknown): value is Record<string, unknown>;
|
|
1326
|
+
/** Returns the first v1-rule violation, or null. Pure, total, deterministic. */
|
|
1327
|
+
declare function grantProblem(value: unknown): string | null;
|
|
1328
|
+
declare const GrantSchema: () => z.ZodCustom<Grant, Grant>;
|
|
1329
|
+
/** V1 shape rules plus the group-document group-principal ban. */
|
|
1330
|
+
declare function assertValidGrant(grant: unknown, documentType: string): void;
|
|
1331
|
+
/**
|
|
1332
|
+
* Validates an initial grant list: the count cap, every grant, and — on a
|
|
1333
|
+
* creator-less policy — that some grant keeps the auth scope administrable.
|
|
1334
|
+
*/
|
|
1335
|
+
declare function assertValidInitialGrants(grants: Grant[], documentType: string, creator: string | undefined): void;
|
|
1336
|
+
/**
|
|
1337
|
+
* Validates a grant upsert: the grant itself, the count cap on append, and
|
|
1338
|
+
* administration retention. Retention is checked on an append as well as an
|
|
1339
|
+
* in-place replace, because a grant appended after the administration grant can
|
|
1340
|
+
* shadow it (evaluation is last-applicable-grant-wins) and so take
|
|
1341
|
+
* administration away without removing anything.
|
|
1342
|
+
*/
|
|
1343
|
+
declare function assertValidGrantUpsert(grant: Grant, existing: Grant[], documentType: string, creator: string | undefined): void;
|
|
1344
|
+
/**
|
|
1345
|
+
* A creator-less policy must always retain a grant permitting execute on the
|
|
1346
|
+
* auth scope; on a signed document the creator carve-out keeps administration
|
|
1347
|
+
* reachable instead. Rejects a change that takes the last such grant away. A
|
|
1348
|
+
* policy already without one is left alone: the change is not what locks it.
|
|
1349
|
+
*/
|
|
1350
|
+
declare function assertAuthAdministrationRetained(creator: string | undefined, previous: Grant[], next: Grant[], grantId: string): void;
|
|
1351
|
+
/**
|
|
1352
|
+
* Evaluates a version-1 condition. Deterministic, total, and pure: any input
|
|
1353
|
+
* shape yields a boolean and never throws, and a malformed condition is
|
|
1354
|
+
* false. These are consensus semantics, versioned by `PHAuthState.version`;
|
|
1355
|
+
* changing them requires a new version.
|
|
1356
|
+
*/
|
|
1357
|
+
declare function evaluateCondition(condition: Condition, subject: AuthSubject, request: AuthRequest, conditions: ConditionContext): boolean;
|
|
1358
|
+
/**
|
|
1359
|
+
* The group document ids named by `{ group }` principals in a grant list, in
|
|
1360
|
+
* order of first appearance. These are the streams the groups projection reads.
|
|
1361
|
+
*/
|
|
1362
|
+
declare function referencedGroupIds(grants: Grant[]): string[];
|
|
1363
|
+
/**
|
|
1364
|
+
* Evaluates a v1 grant stack: default deny, last applicable grant wins, and
|
|
1365
|
+
* reports which grant decided it. Group principals match only against a
|
|
1366
|
+
* supplied groups map, and `where` clauses and { match } principals evaluate
|
|
1367
|
+
* only against a supplied condition context; a grant that uses an unsupplied
|
|
1368
|
+
* feature never applies.
|
|
1369
|
+
*/
|
|
1370
|
+
declare function evaluateGrantStack(grants: Grant[], subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthEvaluation;
|
|
1371
|
+
/**
|
|
1372
|
+
* Evaluates a v1 grant stack: default deny, last applicable grant wins. This is
|
|
1373
|
+
* {@link evaluateGrantStack} with the reason dropped.
|
|
1374
|
+
*/
|
|
1375
|
+
declare function evaluateGrants(grants: Grant[], subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthDecision;
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region document-model/constants.d.ts
|
|
1378
|
+
declare const documentModelFileExtension: "phdm";
|
|
1379
|
+
declare const documentModelInitialLocalState: DocumentModelLocalState;
|
|
1380
|
+
declare const documentModelInitialGlobalState: DocumentModelGlobalState;
|
|
1381
|
+
declare const documentModelGlobalState: DocumentModelGlobalState;
|
|
1382
|
+
declare const HASH_ALGORITHM_SHA1 = "sha1";
|
|
1383
|
+
declare const HASH_ALGORITHM_SHA256 = "sha256";
|
|
1384
|
+
declare const HASH_ALGORITHM_SHA512 = "sha512";
|
|
1385
|
+
declare const HASH_ENCODING_BASE64 = "base64";
|
|
1386
|
+
declare const HASH_ENCODING_HEX = "hex";
|
|
1387
|
+
//#endregion
|
|
1388
|
+
//#region document-model/crypto.d.ts
|
|
1389
|
+
declare const hashBrowser: (data: string | Uint8Array | ArrayBufferView | DataView, algorithm?: string, encoding?: string, _params?: Record<string, unknown>) => string;
|
|
1390
|
+
declare function getUnixTimestamp(date: Date | string): string;
|
|
1391
|
+
declare function buildOperationSignatureParams({ documentId, signer, action, previousStateHash }: ActionSignatureContext): [string, string, string, string];
|
|
1392
|
+
declare function buildOperationSignatureMessage(params: [string, string, string, string]): Uint8Array;
|
|
1393
|
+
declare function ab2hex(ab: ArrayBuffer | ArrayBufferView): string;
|
|
1394
|
+
declare function hex2ab(hex: string): Uint8Array<ArrayBuffer>;
|
|
1395
|
+
/**
|
|
1396
|
+
* Decodes a base58btc (Bitcoin/IPFS alphabet) string to bytes. Returns null on
|
|
1397
|
+
* any character outside the alphabet.
|
|
1398
|
+
*/
|
|
1399
|
+
declare function base58Decode(input: string): Uint8Array | null;
|
|
1400
|
+
/** Encodes bytes as unpadded base64url. */
|
|
1401
|
+
declare function bytesToBase64Url(bytes: Uint8Array): string;
|
|
1402
|
+
/** Decodes a base64url string to bytes (portable across node, browsers, workers). */
|
|
1403
|
+
declare function base64UrlToBytes(input: string): Uint8Array;
|
|
1404
|
+
//#endregion
|
|
1405
|
+
//#region document-model/denied.d.ts
|
|
1406
|
+
/**
|
|
1407
|
+
* True iff authorization rejected the action.
|
|
1408
|
+
*/
|
|
1409
|
+
declare function isDenied(operation: Operation): boolean;
|
|
1410
|
+
/**
|
|
1411
|
+
* The closed set of strings persisted as `deniedReason`. Re-evaluation compares
|
|
1412
|
+
* them, so they are consensus data: exact strings that embed no grant id,
|
|
1413
|
+
* subject or timestamp. Changing one is history-visible.
|
|
1414
|
+
*/
|
|
1415
|
+
declare const DOCUMENT_DELETED_REASON = "document deleted";
|
|
1416
|
+
declare const AUTH_VERSION_UNSUPPORTED_REASON = "auth policy version unsupported";
|
|
1417
|
+
declare const AUTH_NO_GRANT_REASON = "no grant permits this operation";
|
|
1418
|
+
declare const AUTH_DENIED_BY_GRANT_REASON = "denied by grant";
|
|
1419
|
+
//#endregion
|
|
1420
|
+
//#region document-model/document-schema.d.ts
|
|
1421
|
+
declare const BaseDocumentHeaderSchema: z.ZodObject<{
|
|
1422
|
+
id: z.ZodString;
|
|
1423
|
+
name: z.ZodString;
|
|
1424
|
+
createdAtUtcIso: z.ZodString;
|
|
1425
|
+
lastModifiedAtUtcIso: z.ZodString;
|
|
1426
|
+
documentType: z.ZodString;
|
|
1427
|
+
}, z.core.$strip>;
|
|
1428
|
+
declare const BaseDocumentStateSchema: z.ZodObject<{
|
|
1429
|
+
global: z.ZodUnknown;
|
|
1430
|
+
}, z.core.$strip>;
|
|
1431
|
+
/** Schema for validating the header object of a DocumentModel document */
|
|
1432
|
+
declare const DocumentModelHeaderSchema: z.ZodObject<{
|
|
1433
|
+
id: z.ZodString;
|
|
1434
|
+
name: z.ZodString;
|
|
1435
|
+
createdAtUtcIso: z.ZodString;
|
|
1436
|
+
lastModifiedAtUtcIso: z.ZodString;
|
|
1437
|
+
documentType: z.ZodLiteral<"powerhouse/document-model">;
|
|
1438
|
+
}, z.core.$strip>;
|
|
1439
|
+
/** Schema for validating the state object of a DocumentModel document */
|
|
1440
|
+
declare const DocumentModelPHStateSchema: z.ZodObject<{
|
|
1441
|
+
global: z.ZodObject<Required<{
|
|
1442
|
+
author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
|
|
1443
|
+
description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1444
|
+
extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1445
|
+
id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1446
|
+
name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1447
|
+
specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
|
|
1448
|
+
}>, z.core.$strip>;
|
|
1449
|
+
}, z.core.$strip>;
|
|
1450
|
+
declare const DocumentModelSchema: z.ZodObject<{
|
|
1451
|
+
header: z.ZodObject<{
|
|
1452
|
+
id: z.ZodString;
|
|
1453
|
+
name: z.ZodString;
|
|
1454
|
+
createdAtUtcIso: z.ZodString;
|
|
1455
|
+
lastModifiedAtUtcIso: z.ZodString;
|
|
1456
|
+
documentType: z.ZodLiteral<"powerhouse/document-model">;
|
|
1457
|
+
}, z.core.$strip>;
|
|
1458
|
+
state: z.ZodObject<{
|
|
1459
|
+
global: z.ZodObject<Required<{
|
|
1460
|
+
author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
|
|
1461
|
+
description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1462
|
+
extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1463
|
+
id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1464
|
+
name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1465
|
+
specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
|
|
1466
|
+
}>, z.core.$strip>;
|
|
1467
|
+
}, z.core.$strip>;
|
|
1468
|
+
initialState: z.ZodObject<{
|
|
1469
|
+
global: z.ZodObject<Required<{
|
|
1470
|
+
author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
|
|
1471
|
+
description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1472
|
+
extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1473
|
+
id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1474
|
+
name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
1475
|
+
specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
|
|
1476
|
+
}>, z.core.$strip>;
|
|
1477
|
+
}, z.core.$strip>;
|
|
1478
|
+
}, z.core.$strip>;
|
|
1479
|
+
/** Simple helper function to check if a state object is a DocumentModel document state object */
|
|
1480
|
+
declare function isDocumentModelState(state: unknown): state is DocumentModelPHState;
|
|
1481
|
+
/** Simple helper function to assert that a document state object is a DocumentModel document state object */
|
|
1482
|
+
declare function assertIsDocumentModelState(state: unknown): asserts state is DocumentModelPHState;
|
|
1483
|
+
/** Simple helper function to check if a document is a DocumentModel document */
|
|
1484
|
+
declare function isDocumentModelDocument(document: unknown): document is DocumentModelDocument;
|
|
1485
|
+
/** Simple helper function to assert that a document is a DocumentModel document */
|
|
1486
|
+
declare function assertIsDocumentModelDocument(document: unknown): asserts document is DocumentModelDocument;
|
|
1487
|
+
//#endregion
|
|
1488
|
+
//#region document-model/document-type.d.ts
|
|
1489
|
+
declare const documentModelDocumentType = "powerhouse/document-model";
|
|
1490
|
+
declare const groupDocumentType = "powerhouse/reactor-group";
|
|
1491
|
+
/**
|
|
1492
|
+
* The group-model action types that change membership. The groups projection
|
|
1493
|
+
* filters its reads to these, so any other group operation is invisible to a
|
|
1494
|
+
* decision. Kept here so the reactor never depends on the group package; a
|
|
1495
|
+
* reactor-group test guards against drift.
|
|
1496
|
+
*/
|
|
1497
|
+
declare const groupMembershipActionTypes: readonly ["ADD_MEMBER", "REMOVE_MEMBER"];
|
|
1498
|
+
//#endregion
|
|
1499
|
+
//#region document-model/errors.d.ts
|
|
1500
|
+
declare const FileSystemError: Error;
|
|
1501
|
+
declare class InvalidActionInputError extends Error {
|
|
1502
|
+
data: unknown;
|
|
1503
|
+
constructor(data: unknown);
|
|
1066
1504
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
dispose(): void;
|
|
1505
|
+
declare class InvalidActionInputZodError extends InvalidActionInputError {
|
|
1506
|
+
issues: ZodIssue[];
|
|
1507
|
+
constructor(issues: ZodIssue[]);
|
|
1071
1508
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
type WebhookHashAlgorithm = "sha1" | "sha256" | "sha512";
|
|
1081
|
-
/** How the digest is written into the header. */
|
|
1082
|
-
type WebhookSignatureEncoding = "hex" | "base64";
|
|
1083
|
-
interface WebhookVerification {
|
|
1084
|
-
scheme: WebhookScheme;
|
|
1085
|
-
/** Resolved value, never a reference — the caller resolves refs. */
|
|
1086
|
-
secret?: string;
|
|
1087
|
-
/** Overrides the scheme's conventional header. */
|
|
1088
|
-
header?: string;
|
|
1089
|
-
/** Replay window for timestamped schemes. */
|
|
1090
|
-
toleranceSeconds?: number;
|
|
1091
|
-
algorithm?: WebhookHashAlgorithm;
|
|
1092
|
-
/** Defaults to `hex`. Base64 comparison is case-sensitive; hex is not. */
|
|
1093
|
-
encoding?: WebhookSignatureEncoding;
|
|
1094
|
-
prefix?: string;
|
|
1509
|
+
/**
|
|
1510
|
+
* Error thrown when attempting to downgrade a document version.
|
|
1511
|
+
*/
|
|
1512
|
+
declare class DowngradeNotSupportedError extends Error {
|
|
1513
|
+
readonly documentType: string;
|
|
1514
|
+
readonly fromVersion: number;
|
|
1515
|
+
readonly toVersion: number;
|
|
1516
|
+
constructor(documentType: string, fromVersion: number, toVersion: number);
|
|
1095
1517
|
}
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
{
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
interface WebhookRequest {
|
|
1104
|
-
/** The caller's own key for this endpoint, e.g. a document id. */
|
|
1105
|
-
key: string;
|
|
1106
|
-
method: string;
|
|
1107
|
-
path: string;
|
|
1108
|
-
queryParams: Record<string, string>;
|
|
1109
|
-
/** Lowercased, with credentials redacted. */
|
|
1110
|
-
headers: Record<string, string>;
|
|
1111
|
-
/** The exact bytes received. */
|
|
1112
|
-
raw: Buffer;
|
|
1113
|
-
/** JSON and form bodies decoded; anything else as text. */
|
|
1114
|
-
body: unknown;
|
|
1518
|
+
/**
|
|
1519
|
+
* Thrown when INITIALIZE_AUTH is applied to an already-initialized auth scope.
|
|
1520
|
+
* The genesis action is valid only at auth revision zero.
|
|
1521
|
+
*/
|
|
1522
|
+
declare class AuthAlreadyInitializedError extends Error {
|
|
1523
|
+
readonly documentId: string;
|
|
1524
|
+
constructor(documentId: string);
|
|
1115
1525
|
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1526
|
+
/**
|
|
1527
|
+
* Thrown when INITIALIZE_AUTH is not signed by the document creator (its signer
|
|
1528
|
+
* does not match `header.sig.publicKey`), so it cannot set the auth policy.
|
|
1529
|
+
*/
|
|
1530
|
+
declare class AuthInitializerNotCreatorError extends Error {
|
|
1531
|
+
readonly documentId: string;
|
|
1532
|
+
constructor(documentId: string);
|
|
1120
1533
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
challengeField?: WebhookField;
|
|
1130
|
-
maxBodyBytes?: number;
|
|
1534
|
+
/**
|
|
1535
|
+
* Thrown when INITIALIZE_AUTH carries a version below 1. Version 0 is reserved
|
|
1536
|
+
* for the uninitialized auth scope.
|
|
1537
|
+
*/
|
|
1538
|
+
declare class InvalidAuthVersionError extends Error {
|
|
1539
|
+
readonly documentId: string;
|
|
1540
|
+
readonly version: number;
|
|
1541
|
+
constructor(documentId: string, version: number);
|
|
1131
1542
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
onRequest: (request: WebhookRequest) => Promise<WebhookReply> | WebhookReply;
|
|
1137
|
-
policyFor?: (key: string) => Promise<WebhookPolicy | undefined> | WebhookPolicy | undefined;
|
|
1543
|
+
/** Thrown when a duplicate would lose the source policy's version or creator binding. */
|
|
1544
|
+
declare class AuthPolicyNotPreservedError extends Error {
|
|
1545
|
+
readonly documentId: string;
|
|
1546
|
+
constructor(documentId: string);
|
|
1138
1547
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1548
|
+
/**
|
|
1549
|
+
* Thrown when a grant referenced by REMOVE_GRANT or MOVE_GRANT does not exist.
|
|
1550
|
+
*/
|
|
1551
|
+
declare class GrantNotFoundError extends Error {
|
|
1552
|
+
readonly grantId: string;
|
|
1553
|
+
constructor(grantId: string);
|
|
1144
1554
|
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1555
|
+
/**
|
|
1556
|
+
* Thrown when a disallowed action (UNDO, REDO) targets the auth scope.
|
|
1557
|
+
*/
|
|
1558
|
+
declare class AuthActionNotAllowedError extends Error {
|
|
1559
|
+
readonly actionType: string;
|
|
1560
|
+
constructor(actionType: string);
|
|
1149
1561
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1562
|
+
declare class HashMismatchError extends Error {
|
|
1563
|
+
protected _scope: string;
|
|
1564
|
+
protected _document: PHDocument;
|
|
1565
|
+
protected _operation: Operation;
|
|
1566
|
+
constructor(scope: string, document: PHDocument, operation: Operation);
|
|
1567
|
+
get document(): PHDocument;
|
|
1568
|
+
get scope(): string;
|
|
1569
|
+
get operation(): Operation;
|
|
1153
1570
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
patch(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
1165
|
-
delete(path: string, handler: RouteHandler): ScopedRouteHandle;
|
|
1166
|
-
delete(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
1167
|
-
/** Registered independently of GET: a HEAD response is not a bodyless GET. */
|
|
1168
|
-
head(path: string, handler: RouteHandler): ScopedRouteHandle;
|
|
1169
|
-
head(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
1170
|
-
route(spec: RouteSpec): ScopedRouteHandle;
|
|
1171
|
-
nodeRoute(spec: NodeRouteSpec): ScopedRouteHandle;
|
|
1172
|
-
readonly webhooks: IWebhookScope;
|
|
1173
|
-
/** Release every route this scope registered. Called on package teardown. */
|
|
1174
|
-
dispose(): void;
|
|
1571
|
+
/**
|
|
1572
|
+
* Thrown when replay or import requires a document model version that is not
|
|
1573
|
+
* registered. Carries the data the UI needs to explain the mismatch.
|
|
1574
|
+
*/
|
|
1575
|
+
declare class UnsupportedDocumentModelVersionError extends Error {
|
|
1576
|
+
readonly documentType: string;
|
|
1577
|
+
readonly requiredVersion: number;
|
|
1578
|
+
readonly availableVersions: number[];
|
|
1579
|
+
constructor(documentType: string, requiredVersion: number, availableVersions: number[]);
|
|
1580
|
+
static isError(error: unknown): error is UnsupportedDocumentModelVersionError;
|
|
1175
1581
|
}
|
|
1176
1582
|
//#endregion
|
|
1177
|
-
//#region
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1583
|
+
//#region document-model/upgrades.d.ts
|
|
1584
|
+
/** Upgrade reducer transforms a document from one version to another */
|
|
1585
|
+
type UpgradeReducer<TFrom extends PHBaseState, TTo extends PHBaseState> = (document: PHDocument<TFrom>, action: Action) => PHDocument<TTo>;
|
|
1586
|
+
type ModelVersion = number;
|
|
1587
|
+
/** Metadata about a version transition */
|
|
1588
|
+
type UpgradeTransition = {
|
|
1589
|
+
toVersion: ModelVersion;
|
|
1590
|
+
upgradeReducer: UpgradeReducer<any, any>;
|
|
1591
|
+
description?: string;
|
|
1592
|
+
};
|
|
1593
|
+
type TupleMember<T extends readonly unknown[]> = T[number];
|
|
1594
|
+
/** Manifest declaring all supported versions and upgrade paths */
|
|
1595
|
+
type UpgradeManifest<TVersions extends readonly number[]> = {
|
|
1596
|
+
documentType: string;
|
|
1597
|
+
latestVersion: TupleMember<TVersions>;
|
|
1598
|
+
supportedVersions: TVersions;
|
|
1599
|
+
upgrades: { [V in Exclude<TupleMember<TVersions>, 1> as `v${V}`]: UpgradeTransition; };
|
|
1181
1600
|
};
|
|
1182
|
-
interface IProcessorDispatch {
|
|
1183
|
-
execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
|
|
1184
|
-
}
|
|
1185
|
-
interface IProcessorHostModuleBase {
|
|
1186
|
-
analyticsStore: IAnalyticsStore;
|
|
1187
|
-
relationalDb: IRelationalDb;
|
|
1188
|
-
processorApp: ProcessorApp;
|
|
1189
|
-
dispatch: IProcessorDispatch;
|
|
1190
|
-
getReadModel<T>(name: string): T;
|
|
1191
|
-
config?: Map<string, unknown>;
|
|
1192
|
-
/**
|
|
1193
|
-
* The package's slice of the HTTP surface, bound to its own namespace.
|
|
1194
|
-
*
|
|
1195
|
-
* Declared on the host-agnostic base rather than on each host's module so
|
|
1196
|
-
* the two cannot drift: codegen types generated processors against
|
|
1197
|
-
* reactor-browser's `IProcessorHostModule`, and the same source has to
|
|
1198
|
-
* compile against reactor-api's.
|
|
1199
|
-
*
|
|
1200
|
-
* Absent whenever the host has no HTTP server — processors also run in the
|
|
1201
|
-
* browser — and on the reactor when the package's name cannot be resolved to
|
|
1202
|
-
* a routable namespace, so a caller must always check before using it.
|
|
1203
|
-
*/
|
|
1204
|
-
http?: IHttpScope;
|
|
1205
|
-
}
|
|
1206
1601
|
/**
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1602
|
+
* Canonical document-model version normalization: documents stamped with 0
|
|
1603
|
+
* or nothing at all predate versioning and are treated as version 1, the
|
|
1604
|
+
* same version the registry assigns unversioned modules. Every consumer
|
|
1605
|
+
* that resolves a module or compares versions must use this rule; resolving
|
|
1606
|
+
* 0 to "latest" instead re-pins a legacy document's history to whichever
|
|
1607
|
+
* module happens to be newest.
|
|
1210
1608
|
*/
|
|
1211
|
-
|
|
1212
|
-
documentType?: string[];
|
|
1213
|
-
scope?: string[];
|
|
1214
|
-
branch?: string[];
|
|
1215
|
-
documentId?: string[];
|
|
1216
|
-
};
|
|
1609
|
+
declare function normalizeDocumentModelVersion(version: number | undefined | null): number;
|
|
1217
1610
|
/**
|
|
1218
|
-
*
|
|
1611
|
+
* Applies an UPGRADE_DOCUMENT action to a document.
|
|
1612
|
+
* Handles all upgrade scenarios including initial upgrades, no-ops, and multi-step upgrades.
|
|
1613
|
+
*
|
|
1614
|
+
* Behavior based on fromVersion/toVersion:
|
|
1615
|
+
* - fromVersion === toVersion (and fromVersion > 0): No-op - return unchanged document
|
|
1616
|
+
* - fromVersion > toVersion: Throw DowngradeNotSupportedError
|
|
1617
|
+
* - All other cases: Apply upgradePath transitions (if provided), then apply initialState, set version
|
|
1219
1618
|
*/
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
* Called when operations match this processor's filter.
|
|
1224
|
-
*
|
|
1225
|
-
* Delivery is at-least-once. Within a document's scope and branch, each
|
|
1226
|
-
* call is in ordinal order, and an operation delivered late comes with
|
|
1227
|
-
* every later operation of its stream this processor was already given.
|
|
1228
|
-
* Across documents there is no ordering guarantee. A processor receives one
|
|
1229
|
-
* `onOperations` call at a time; the next call begins after the previous
|
|
1230
|
-
* resolves.
|
|
1231
|
-
*/
|
|
1232
|
-
onOperations(operations: OperationWithContext[]): Promise<void>;
|
|
1233
|
-
/**
|
|
1234
|
-
* Called when the processor is disconnected.
|
|
1235
|
-
* Used to clean up any resources allocated during processor creation.
|
|
1236
|
-
*/
|
|
1237
|
-
onDisconnect(): Promise<void>;
|
|
1238
|
-
}
|
|
1619
|
+
declare function applyUpgradeDocumentAction(document: PHDocument, action: UpgradeDocumentAction, upgradePath?: UpgradeTransition[]): PHDocument;
|
|
1620
|
+
/** CREATE_DOCUMENT fixes `protocolVersions`; this puts them back after a reducer. */
|
|
1621
|
+
declare function withProtocolVersions<TDocument extends PHDocument>(document: TDocument, protocolVersions: PHDocument["header"]["protocolVersions"]): TDocument;
|
|
1239
1622
|
/**
|
|
1240
|
-
*
|
|
1623
|
+
* Applies a DELETE_DOCUMENT action, or a PURGE_DOCUMENT marker, to a document.
|
|
1624
|
+
* Marks the document as deleted in the document scope state.
|
|
1241
1625
|
*/
|
|
1242
|
-
|
|
1243
|
-
processor: IProcessor;
|
|
1244
|
-
filter: ProcessorFilter;
|
|
1245
|
-
startFrom?: "beginning" | "current";
|
|
1246
|
-
id?: string;
|
|
1247
|
-
};
|
|
1626
|
+
declare function applyDeleteDocumentAction(document: PHDocument, action: DeleteDocumentAction | PurgeDocumentAction): PHDocument;
|
|
1248
1627
|
/**
|
|
1249
|
-
*
|
|
1250
|
-
*
|
|
1628
|
+
* Computes the ordered list of upgrade transitions needed to move from
|
|
1629
|
+
* fromVersion to toVersion using the provided manifest.
|
|
1630
|
+
* Walks keys v(fromVersion+1)..v(toVersion) and throws a descriptive Error
|
|
1631
|
+
* if the manifest is absent or any step is missing.
|
|
1251
1632
|
*/
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
processorId: string;
|
|
1260
|
-
factoryId: string;
|
|
1261
|
-
driveId: string;
|
|
1262
|
-
processorIndex: number;
|
|
1263
|
-
record: ProcessorRecord;
|
|
1264
|
-
lastOrdinal: number;
|
|
1265
|
-
status: ProcessorStatus;
|
|
1266
|
-
lastError: string | undefined;
|
|
1267
|
-
lastErrorTimestamp: Date | undefined;
|
|
1268
|
-
/**
|
|
1269
|
-
* Clears the error and resolves once the replay from the cursor completes.
|
|
1270
|
-
* Safe from anywhere, but awaiting it from this processor's own
|
|
1271
|
-
* `onOperations` waits on itself: the replay runs after that call returns.
|
|
1272
|
-
* A no-op once the processor has been removed.
|
|
1273
|
-
*/
|
|
1274
|
-
retry: () => Promise<void>;
|
|
1633
|
+
declare function computeUpgradeTransitions(manifest: UpgradeManifest<readonly number[]> | undefined, fromVersion: number, toVersion: number): UpgradeTransition[];
|
|
1634
|
+
//#endregion
|
|
1635
|
+
//#region document-model/versioned-replay.d.ts
|
|
1636
|
+
type VersionedReducers = Record<number, Reducer<PHBaseState>>;
|
|
1637
|
+
type VersionedReplayConfig = {
|
|
1638
|
+
reducers: VersionedReducers;
|
|
1639
|
+
upgradeManifest?: UpgradeManifest<readonly number[]>;
|
|
1275
1640
|
};
|
|
1276
1641
|
/**
|
|
1277
|
-
*
|
|
1642
|
+
* Version-aware document replay. Replays a versioned document through per-version
|
|
1643
|
+
* reducers, applying upgrade transitions at segment boundaries.
|
|
1644
|
+
*
|
|
1645
|
+
* Algorithm (D5):
|
|
1646
|
+
* a. Build spine from operations["document"]. Empty spine or no upgrades → legacy fallback.
|
|
1647
|
+
* b. Collect UPGRADE_DOCUMENT ops from the spine.
|
|
1648
|
+
* c. Seed state from the creation upgrade (fromVersion===0). Missing seed with validated
|
|
1649
|
+
* upgrades throws; otherwise falls back to legacy.
|
|
1650
|
+
* d. Identify validated upgrades (fromVersion > 0, version increases). Compute per-scope
|
|
1651
|
+
* boundaries using revision snapshot (preferred) or timestamp fallback.
|
|
1652
|
+
* e. Loop over version segments, replaying each scope's ops through the matching reducer,
|
|
1653
|
+
* then applying the upgrade transition before the next segment.
|
|
1654
|
+
* f. Set header.revision["document"], verify per-scope hashes against state at op-time
|
|
1655
|
+
* (not post-upgrade state) when checkHashes is false, and map timestamps from input.
|
|
1656
|
+
*
|
|
1657
|
+
* operations must include ALL scopes (document scope is NOT stripped).
|
|
1658
|
+
* reuseOperationResultingState is ignored by this function — zip operations never carry
|
|
1659
|
+
* resultingState.
|
|
1278
1660
|
*/
|
|
1279
|
-
|
|
1280
|
-
/**
|
|
1281
|
-
* Registers a processor factory.
|
|
1282
|
-
* Immediately creates processors for all existing drives and resolves once
|
|
1283
|
-
* every factory run has completed and its processors are bound. Their
|
|
1284
|
-
* backfills run afterwards, on each processor's own queue. If processors
|
|
1285
|
-
* from an earlier registration under the same identifier are still
|
|
1286
|
-
* draining, or a call of the previous factory is still in flight, the
|
|
1287
|
-
* factory runs after they have settled, so awaiting a re-registration of
|
|
1288
|
-
* a factory from inside that factory or one of its processors'
|
|
1289
|
-
* `onOperations` waits on itself.
|
|
1290
|
-
*/
|
|
1291
|
-
registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
|
|
1292
|
-
/**
|
|
1293
|
-
* Unregisters a processor factory. Resolves once its processors receive no
|
|
1294
|
-
* new deliveries and their cursors are deleted; each one's in-flight
|
|
1295
|
-
* delivery finishes first, then `onDisconnect` runs. Safe to call from
|
|
1296
|
-
* inside a processor's own `onOperations`.
|
|
1297
|
-
*/
|
|
1298
|
-
unregisterFactory(identifier: string): Promise<void>;
|
|
1299
|
-
/**
|
|
1300
|
-
* Gets a tracked processor by its ID.
|
|
1301
|
-
*/
|
|
1302
|
-
get(processorId: string): TrackedProcessor | undefined;
|
|
1303
|
-
/**
|
|
1304
|
-
* Gets all tracked processors.
|
|
1305
|
-
*/
|
|
1306
|
-
getAll(): TrackedProcessor[];
|
|
1307
|
-
}
|
|
1308
|
-
type ProcessorApp = (typeof PROCESSOR_APPS)[number];
|
|
1309
|
-
type ProcessorApps = readonly ProcessorApp[];
|
|
1661
|
+
declare function replayDocumentVersioned<TState extends PHBaseState>(initialState: TState, operations: DocumentOperations, config: VersionedReplayConfig, header: PHDocumentHeader, dispatch?: SignalDispatch, options?: ReplayDocumentOptions): PHDocument<TState>;
|
|
1310
1662
|
//#endregion
|
|
1311
|
-
//#region
|
|
1312
|
-
|
|
1313
|
-
type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
|
|
1314
|
-
withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
|
|
1315
|
-
};
|
|
1316
|
-
type HashAlgorithms = "fnv1a";
|
|
1317
|
-
type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
|
|
1663
|
+
//#region document-model/files.d.ts
|
|
1664
|
+
declare function createZip(document: PHDocument): Promise<Uint8Array>;
|
|
1318
1665
|
/**
|
|
1319
|
-
*
|
|
1320
|
-
*
|
|
1321
|
-
*
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1666
|
+
* Creates a minimal ZIP backup from strand data.
|
|
1667
|
+
* Used when the full document is not available (e.g., in onOperations handler).
|
|
1668
|
+
* Creates a ZIP with minimal header and empty operations.
|
|
1669
|
+
*/
|
|
1670
|
+
declare function createMinimalZip(data: MinimalBackupData): Promise<Uint8Array>;
|
|
1671
|
+
declare function baseSaveToFileHandle(document: PHDocument, input: FileSystemFileHandle): Promise<void>;
|
|
1672
|
+
declare function baseLoadFromInput<TState extends PHBaseState>(input: FileInput, reducer: Reducer<TState>, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
|
|
1673
|
+
declare function baseLoadFromInputVersioned<TState extends PHBaseState>(input: FileInput, config: VersionedReplayConfig, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
|
|
1674
|
+
type BulkArchiveEntry = {
|
|
1675
|
+
/** "/"-separated zip path of a file entry (no trailing slash). */
|
|
1676
|
+
path: string;
|
|
1677
|
+
data: Uint8Array;
|
|
1326
1678
|
};
|
|
1327
|
-
type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessor<infer TSchema> ? TSchema : TProcessor;
|
|
1328
|
-
type RelationalDbProcessorClass<TSchema> = typeof RelationalDbProcessor<TSchema>;
|
|
1329
|
-
interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
|
|
1330
|
-
namespace: string;
|
|
1331
|
-
query: IRelationalQueryBuilder<TDatabaseSchema>;
|
|
1332
|
-
filter: ProcessorFilter;
|
|
1333
|
-
initAndUpgrade(): Promise<void>;
|
|
1334
|
-
}
|
|
1335
|
-
declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
|
|
1336
1679
|
/**
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1680
|
+
* Whether this zip is a single Powerhouse document: the document's four JSON
|
|
1681
|
+
* entries (header/state/current-state/operations) at the archive root. A
|
|
1682
|
+
* bulk archive has a folder tree instead. Returns false for any input that
|
|
1683
|
+
* is not a readable zip.
|
|
1340
1684
|
*/
|
|
1341
|
-
declare
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
get filter(): ProcessorFilter;
|
|
1363
|
-
/**
|
|
1364
|
-
* Returns the namespace used by the processor.
|
|
1365
|
-
*/
|
|
1366
|
-
get namespace(): string;
|
|
1367
|
-
get query(): IRelationalQueryBuilder<TDatabaseSchema>;
|
|
1368
|
-
/**
|
|
1369
|
-
* Abstract method that derived classes must implement.
|
|
1370
|
-
* This method is meant to be called on subclasses to initialize and upgrade the database.
|
|
1371
|
-
*/
|
|
1372
|
-
abstract initAndUpgrade(): Promise<void>;
|
|
1373
|
-
/**
|
|
1374
|
-
* Called when the processor is disconnected.
|
|
1375
|
-
* This method is meant to be overridden by subclasses to clean up resources.
|
|
1376
|
-
*/
|
|
1377
|
-
abstract onDisconnect(): Promise<void>;
|
|
1378
|
-
}
|
|
1685
|
+
declare function isDocumentZip(data: Uint8Array): Promise<boolean>;
|
|
1686
|
+
/**
|
|
1687
|
+
* The file entries of a zip (directory entries excluded). Used for bulk
|
|
1688
|
+
* archives; throws when the archive holds no files. Note this does NOT
|
|
1689
|
+
* validate that the entries are document zips — pair with isDocumentZip.
|
|
1690
|
+
*/
|
|
1691
|
+
declare function parseBulkArchive(data: Uint8Array): Promise<BulkArchiveEntry[]>;
|
|
1692
|
+
/**
|
|
1693
|
+
* Assemble a zip from raw entries. A key ending in "/" with empty data is a
|
|
1694
|
+
* directory entry, so an archive's folder structure survives a round-trip.
|
|
1695
|
+
*/
|
|
1696
|
+
declare function zipEntries(entries: Record<string, Uint8Array>): Promise<Uint8Array>;
|
|
1697
|
+
declare const documentModelLoadFromInput: LoadFromInput<DocumentModelPHState>;
|
|
1698
|
+
declare const documentModelSaveToFileHandle: SaveToFileHandle;
|
|
1699
|
+
declare function writeFileBrowser(path: string, name: string, stream: Uint8Array): Promise<string>;
|
|
1700
|
+
declare function readFileBrowser(path: string): void;
|
|
1701
|
+
declare function fetchFileBrowser(url: string): Promise<{
|
|
1702
|
+
data: Buffer;
|
|
1703
|
+
mimeType?: string;
|
|
1704
|
+
}>;
|
|
1705
|
+
declare const getFileBrowser: (file: string) => Promise<void>;
|
|
1379
1706
|
//#endregion
|
|
1380
|
-
//#region
|
|
1707
|
+
//#region document-model/header.d.ts
|
|
1381
1708
|
/**
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1384
|
-
*
|
|
1385
|
-
* @param
|
|
1386
|
-
* @returns
|
|
1709
|
+
* Creates a verification-only signer from a public key.
|
|
1710
|
+
* This signer can only verify signatures, not sign data.
|
|
1711
|
+
*
|
|
1712
|
+
* @param pubKey - The public key to use for verification.
|
|
1713
|
+
* @returns An ISigner that can only verify signatures.
|
|
1387
1714
|
*/
|
|
1388
|
-
declare function
|
|
1715
|
+
declare function createVerificationSigner(pubKey: JsonWebKey): Promise<ISigner>;
|
|
1389
1716
|
/**
|
|
1390
|
-
*
|
|
1391
|
-
* @
|
|
1392
|
-
*
|
|
1393
|
-
* @
|
|
1717
|
+
* Signs a header. Generally, this is not called directly, but rather through
|
|
1718
|
+
* {@link createSignedHeader}.
|
|
1719
|
+
*
|
|
1720
|
+
* @param parameters - The parameters used to sign the header.
|
|
1721
|
+
* @param signer - The signer of the document.
|
|
1722
|
+
*
|
|
1723
|
+
* @returns The signature of the header.
|
|
1394
1724
|
*/
|
|
1395
|
-
declare
|
|
1396
|
-
type NamespaceOptions = {
|
|
1397
|
-
hashNamespace?: boolean;
|
|
1398
|
-
};
|
|
1399
|
-
declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
|
|
1400
|
-
declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
|
|
1725
|
+
declare const sign: (parameters: SigningParameters, signer: ISigner) => Promise<string>;
|
|
1401
1726
|
/**
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1727
|
+
* Verifies a header signature. Generally, this is not called directly, but
|
|
1728
|
+
* rather through {@link validateHeader}.
|
|
1729
|
+
*
|
|
1730
|
+
* @param parameters - The parameters used to sign the header.
|
|
1731
|
+
* @param signature - The signature to verify.
|
|
1732
|
+
* @param signer - The signer of the document.
|
|
1405
1733
|
*/
|
|
1406
|
-
declare
|
|
1734
|
+
declare const verify: (parameters: SigningParameters, signature: string, signer: ISigner) => Promise<void>;
|
|
1735
|
+
/**
|
|
1736
|
+
* Validates a header signature.
|
|
1737
|
+
*/
|
|
1738
|
+
declare const validateHeader: (header: PHDocumentHeader) => Promise<void>;
|
|
1739
|
+
/**
|
|
1740
|
+
* Creates a header that has yet to be signed. This header is not valid, but
|
|
1741
|
+
* can be input into {@link createSignedHeader} to create a signed header.
|
|
1742
|
+
*
|
|
1743
|
+
* With `protocolVersions` requiring v2 signatures the header takes a random
|
|
1744
|
+
* nonce and the id {@link deriveDocumentId} gives, so `id` must be omitted.
|
|
1745
|
+
*
|
|
1746
|
+
* @returns An unsigned header for a document.
|
|
1747
|
+
*/
|
|
1748
|
+
declare const createPresignedHeader: (id?: string, documentType?: string, protocolVersions?: ProtocolVersions) => PHDocumentHeader;
|
|
1749
|
+
/**
|
|
1750
|
+
* A header for a copy of a document headed `source`. A copy is v2-required
|
|
1751
|
+
* when its source is or when `policy` asks for it, and then takes a derived id;
|
|
1752
|
+
* otherwise it takes `id`. It keeps the source's other protocol versions.
|
|
1753
|
+
*/
|
|
1754
|
+
declare function createCopyHeader(source: Pick<PHDocumentHeader, "documentType" | "protocolVersions">, id?: string, policy?: SignaturePolicy$1): PHDocumentHeader;
|
|
1755
|
+
/** Whether a v2-required `header` carries the id its params derive. */
|
|
1756
|
+
declare function hasDerivedDocumentId(header: PHDocumentHeader): boolean;
|
|
1757
|
+
/**
|
|
1758
|
+
* Creates a new, signed header for a document. This will replace the id of the
|
|
1759
|
+
* document.
|
|
1760
|
+
*
|
|
1761
|
+
* @param unsignedHeader - The unsigned header to created the signed header from.
|
|
1762
|
+
* @param signer - The signer of the document.
|
|
1763
|
+
*
|
|
1764
|
+
* @returns A new signed header for a document. Some fields are mutable and
|
|
1765
|
+
* some are not. See the PHDocumentHeader type for more information.
|
|
1766
|
+
*/
|
|
1767
|
+
declare const createSignedHeader: (unsignedHeader: PHDocumentHeader, documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
|
|
1768
|
+
/**
|
|
1769
|
+
* Creates a signed header for a document. The document header requires a signer
|
|
1770
|
+
* as the document id is a cryptographic signature.
|
|
1771
|
+
*
|
|
1772
|
+
* @param documentType - The type of the document.
|
|
1773
|
+
* @param signer - The signer of the document.
|
|
1774
|
+
*
|
|
1775
|
+
* @returns The signed header for a document. Some fields are mutable and
|
|
1776
|
+
* some are not. See the PHDocumentHeader type for more information.
|
|
1777
|
+
*/
|
|
1778
|
+
declare const createSignedHeaderForSigner: (documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
|
|
1407
1779
|
//#endregion
|
|
1408
|
-
//#region document-model/
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1780
|
+
//#region document-model/peer-agreement.d.ts
|
|
1781
|
+
/** The reactor feature flags a capability's support is a function of. */
|
|
1782
|
+
type PeerCapabilityFlags = {
|
|
1783
|
+
readonly [flag: string]: boolean | undefined;
|
|
1784
|
+
};
|
|
1785
|
+
/** A document protocol, named by its `protocolVersions` key. */
|
|
1786
|
+
type ProtocolCapability = {
|
|
1787
|
+
kind: "protocol";
|
|
1788
|
+
name: string;
|
|
1789
|
+
/** What a peer that announces nothing is assumed to support. */
|
|
1790
|
+
baseline: readonly number[];
|
|
1791
|
+
supported(flags: PeerCapabilityFlags): readonly number[];
|
|
1792
|
+
/** The version new documents take when peers agree. Absent: not negotiated. */
|
|
1793
|
+
preferred?(flags: PeerCapabilityFlags): number;
|
|
1794
|
+
/** A header may omit the key. */
|
|
1795
|
+
optional: boolean;
|
|
1796
|
+
};
|
|
1797
|
+
/** A feature that changes what a peer sends or expects on the wire. */
|
|
1798
|
+
type FeatureCapability = {
|
|
1799
|
+
kind: "feature";
|
|
1800
|
+
name: string;
|
|
1801
|
+
baseline: readonly number[];
|
|
1802
|
+
supported(flags: PeerCapabilityFlags): readonly number[];
|
|
1803
|
+
};
|
|
1804
|
+
type PeerCapability = ProtocolCapability | FeatureCapability;
|
|
1805
|
+
/** A purged document's protocol; never preferred, so creation never selects it. */
|
|
1806
|
+
declare const DOCUMENT_PURGE_PROTOCOL = "document-purge";
|
|
1807
|
+
/** A peer that takes refusals of polled purge markers on the poll. */
|
|
1808
|
+
declare const MARKER_REFUSAL_FEATURE = "marker-refusal";
|
|
1809
|
+
declare const PEER_CAPABILITIES: readonly PeerCapability[];
|
|
1810
|
+
/** `base` plus `extra`; an extra replaces a base entry of the same name. */
|
|
1811
|
+
declare function mergePeerCapabilities(base: readonly PeerCapability[], extra: readonly PeerCapability[]): PeerCapability[];
|
|
1812
|
+
declare const PEER_MANIFEST_FORMAT = 1;
|
|
1813
|
+
type Supports = {
|
|
1814
|
+
protocols: {
|
|
1815
|
+
[protocol: string]: readonly number[];
|
|
1816
|
+
};
|
|
1817
|
+
features: {
|
|
1818
|
+
[feature: string]: readonly number[];
|
|
1819
|
+
};
|
|
1414
1820
|
};
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1821
|
+
type PeerManifest = Supports & {
|
|
1822
|
+
format: 1;
|
|
1823
|
+
/** The signer's did:key, when configured; informational. */
|
|
1824
|
+
appKey?: string;
|
|
1825
|
+
/** Grows with every start of the reactor; a peer ignores an older one. */
|
|
1826
|
+
sequence: number;
|
|
1827
|
+
/** base64url(sha256(canonicalJson(Supports & { sequence }))) */
|
|
1828
|
+
revision: string;
|
|
1829
|
+
};
|
|
1830
|
+
/** What this reactor supports, for every capability it registers. */
|
|
1831
|
+
declare function localSupports(capabilities: readonly PeerCapability[], flags: PeerCapabilityFlags): Supports;
|
|
1832
|
+
/** What a peer that announces nothing supports. */
|
|
1833
|
+
declare function legacySupports(capabilities: readonly PeerCapability[]): Supports;
|
|
1834
|
+
declare function manifestRevision(supports: Supports, sequence?: number): string;
|
|
1835
|
+
declare function localPeerManifest(capabilities: readonly PeerCapability[], flags: PeerCapabilityFlags, appKey?: string, sequence?: number): PeerManifest;
|
|
1836
|
+
/** A manifest sent before the one already held; silence carries no sequence. */
|
|
1837
|
+
declare function isOlderManifest(next: PeerManifest | null, held: PeerManifest | null | undefined): boolean;
|
|
1838
|
+
/** A peer's manifest, or the baselines for a peer that announced none. */
|
|
1839
|
+
declare function peerSupports(manifest: PeerManifest | null, capabilities: readonly PeerCapability[]): Supports;
|
|
1840
|
+
/**
|
|
1841
|
+
* A manifest as received from a peer, or null when it is not one. Formats only
|
|
1842
|
+
* add fields, so one of an unknown format is read as its two maps.
|
|
1843
|
+
*/
|
|
1844
|
+
declare function readPeerManifest(value: unknown): PeerManifest | null;
|
|
1845
|
+
/** Why a document may not go to a peer. */
|
|
1846
|
+
type HoldReason = {
|
|
1847
|
+
protocol: string;
|
|
1848
|
+
version: number;
|
|
1849
|
+
peerSupports: readonly number[];
|
|
1850
|
+
};
|
|
1851
|
+
/** Only keys this reactor registers are judged; an absent key agrees. */
|
|
1852
|
+
declare function holdReason(peer: Supports, versions: {
|
|
1853
|
+
readonly [protocol: string]: number;
|
|
1854
|
+
}, capabilities: readonly PeerCapability[]): HoldReason | undefined;
|
|
1855
|
+
/** Whether a peer runs every version this reactor does, so nothing is held. */
|
|
1856
|
+
declare function coversLocal(peer: Supports, local: Supports, capabilities: readonly PeerCapability[]): boolean;
|
|
1857
|
+
/**
|
|
1858
|
+
* protocolVersions for a new document: per negotiated protocol, the highest
|
|
1859
|
+
* version up to the local preference that every member supports, else the
|
|
1860
|
+
* lowest local one. `requested` wins over what is selected.
|
|
1861
|
+
*/
|
|
1862
|
+
declare function selectProtocolVersions(input: {
|
|
1863
|
+
capabilities: readonly PeerCapability[];
|
|
1864
|
+
flags: PeerCapabilityFlags;
|
|
1865
|
+
members: Iterable<Supports>;
|
|
1866
|
+
requested?: {
|
|
1867
|
+
readonly [protocol: string]: number;
|
|
1868
|
+
};
|
|
1869
|
+
}): {
|
|
1870
|
+
[protocol: string]: number;
|
|
1419
1871
|
};
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
declare
|
|
1428
|
-
|
|
1429
|
-
declare function
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1872
|
+
//#endregion
|
|
1873
|
+
//#region document-model/purge.d.ts
|
|
1874
|
+
declare const PURGE_DOCUMENT = "PURGE_DOCUMENT";
|
|
1875
|
+
type PurgeMarkerOperation = Operation & {
|
|
1876
|
+
action: PurgeDocumentAction;
|
|
1877
|
+
};
|
|
1878
|
+
type ActionLike = Pick<Action, "type">;
|
|
1879
|
+
declare function isPurgeMarker(value: Action): value is PurgeDocumentAction;
|
|
1880
|
+
declare function isPurgeMarker(value: Operation): value is PurgeMarkerOperation;
|
|
1881
|
+
declare function isPurgeMarker(value: OperationWithContext$1): value is OperationWithContext$1 & {
|
|
1882
|
+
operation: PurgeMarkerOperation;
|
|
1883
|
+
};
|
|
1884
|
+
declare function isPurgeMarker(value: ActionLike | {
|
|
1885
|
+
action?: ActionLike;
|
|
1886
|
+
} | {
|
|
1887
|
+
operation: Operation;
|
|
1888
|
+
}): boolean;
|
|
1889
|
+
/** An unsigned marker; `purgedAtUtcIso` is the action's own timestamp. */
|
|
1890
|
+
declare function purgeDocumentAction(input: Omit<PurgeDocumentActionInput, "purgedAtUtcIso">, options?: {
|
|
1891
|
+
id?: string;
|
|
1892
|
+
timestampUtcMs?: string;
|
|
1893
|
+
}): PurgeDocumentAction;
|
|
1894
|
+
/** The sole row of a purged stream: document/main, index 0, skip 0, hash "". */
|
|
1895
|
+
declare function purgeMarkerOperation(action: PurgeDocumentAction): PurgeMarkerOperation;
|
|
1896
|
+
/** Protocol versions of a purged id; derived, never stored. */
|
|
1897
|
+
declare function purgedProtocolVersions(): {
|
|
1898
|
+
[protocol: string]: number;
|
|
1899
|
+
};
|
|
1900
|
+
//#endregion
|
|
1901
|
+
//#region document-model/reducer.d.ts
|
|
1902
|
+
declare function replayOperations<TState extends PHBaseState = PHBaseState>(initialState: TState, clearedOperations: DocumentOperations, stateReducer: StateReducer<TState>, header: PHDocumentHeader, dispatch?: SignalDispatch, documentReducer?: typeof baseReducer, skipHeaderOperations?: SkipHeaderOperations, options?: ReplayDocumentOptions): PHDocument<TState>;
|
|
1903
|
+
/**
|
|
1904
|
+
* Updates the document state based on the provided action.
|
|
1905
|
+
*
|
|
1906
|
+
* @param state The current state of the document.
|
|
1907
|
+
* @param action The action being applied to the document.
|
|
1908
|
+
* @param skip The number of operations to skip before applying the action.
|
|
1909
|
+
* @param reuseLastOperationIndex Whether to reuse the last operation index (used when a an UNDO operation is performed after an existing one).
|
|
1910
|
+
* @param context The operation context for deterministic ID generation.
|
|
1911
|
+
* @returns The updated document state.
|
|
1912
|
+
*/
|
|
1913
|
+
declare function updateDocument<TDocument extends PHDocument>(document: TDocument, action: Action, reuseLastOperationIndex: boolean, skip: number, context: OperationContext, operation?: Operation, skipIndexValidation?: boolean): TDocument;
|
|
1914
|
+
/**
|
|
1915
|
+
* Processes an UNDO or REDO action.
|
|
1916
|
+
*
|
|
1917
|
+
* @param document The current state of the document.
|
|
1918
|
+
* @param action The action being applied to the document.
|
|
1919
|
+
* @param skip The number of operations to skip before applying the action.
|
|
1920
|
+
* @returns The updated document, calculated skip value and transformed action (if applied).
|
|
1921
|
+
*/
|
|
1922
|
+
declare function processUndoRedo<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, skip: number, protocolVersion?: number): {
|
|
1923
|
+
document: PHDocument<TState>;
|
|
1449
1924
|
action: Action;
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1925
|
+
skip: number;
|
|
1926
|
+
reuseLastOperationIndex: boolean;
|
|
1927
|
+
};
|
|
1928
|
+
/**
|
|
1929
|
+
* Base document reducer that wraps a custom document reducer and handles
|
|
1930
|
+
* document-level actions such as undo, redo, and set name.
|
|
1931
|
+
*
|
|
1932
|
+
* @template TGlobalState - The type of the state of the custom reducer.
|
|
1933
|
+
* @template TAction - The type of the actions of the custom reducer.
|
|
1934
|
+
* @param state - The current state of the document.
|
|
1935
|
+
* @param action - The action object to apply to the state.
|
|
1936
|
+
* @param customReducer - The custom reducer that implements the application logic
|
|
1937
|
+
* specific to the document's state.
|
|
1938
|
+
* @returns The new state of the document.
|
|
1939
|
+
*/
|
|
1940
|
+
declare function baseReducer<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, customReducer: StateReducer<TState>, dispatch?: SignalDispatch, options?: ReducerOptions): PHDocument<TState>;
|
|
1941
|
+
/**
|
|
1942
|
+
* Helper function to create a document model reducer.
|
|
1943
|
+
*
|
|
1944
|
+
* @remarks
|
|
1945
|
+
* This function creates a new reducer that wraps the provided `reducer` with
|
|
1946
|
+
* `documentReducer`, adding support for document actions:
|
|
1947
|
+
* - `SET_NAME`
|
|
1948
|
+
* - `UNDO`
|
|
1949
|
+
* - `REDO`
|
|
1950
|
+
*
|
|
1951
|
+
* It also updates the document-related attributes on every operation.
|
|
1952
|
+
*
|
|
1953
|
+
* @param reducer - The custom reducer to wrap.
|
|
1954
|
+
* @param documentReducer - The document reducer to use.
|
|
1955
|
+
*
|
|
1956
|
+
* @returns The new reducer.
|
|
1957
|
+
*/
|
|
1958
|
+
declare function createReducer<TState extends PHBaseState = PHBaseState>(stateReducer: StateReducer<TState>, documentReducer?: typeof baseReducer): Reducer<TState>;
|
|
1959
|
+
//#endregion
|
|
1960
|
+
//#region document-model/reducers.d.ts
|
|
1961
|
+
declare const documentModelHeaderReducer: DocumentModelHeaderOperations;
|
|
1962
|
+
declare const documentModelModuleReducer: DocumentModelModuleOperations;
|
|
1963
|
+
declare const documentModelOperationErrorReducer: DocumentModelOperationErrorOperations;
|
|
1964
|
+
declare const documentModelOperationExampleReducer: DocumentModelOperationExampleOperations;
|
|
1965
|
+
declare const documentModelOperationReducer: DocumentModelOperationOperations;
|
|
1966
|
+
declare const documentModelStateSchemaReducer: DocumentModelStateOperations;
|
|
1967
|
+
declare const documentModelVersioningReducer: DocumentModelVersioningOperations;
|
|
1968
|
+
declare const documentModelStateReducer: StateReducer<DocumentModelPHState>;
|
|
1969
|
+
declare const documentModelReducer: Reducer<DocumentModelPHState>;
|
|
1459
1970
|
//#endregion
|
|
1460
1971
|
//#region document-model/schemas.d.ts
|
|
1461
1972
|
type definedNonNullAny = {};
|
|
@@ -1792,57 +2303,554 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
1792
2303
|
pwa: z.ZodOptional<z.ZodType<PHConnectPwa, unknown, z.core.$ZodTypeInternals<PHConnectPwa, unknown>>>;
|
|
1793
2304
|
}, z.core.$strip>;
|
|
1794
2305
|
//#endregion
|
|
1795
|
-
//#region document-model/
|
|
1796
|
-
/**
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
2306
|
+
//#region document-model/validation.d.ts
|
|
2307
|
+
/**
|
|
2308
|
+
* Reserved operation names from base reducer (core/actions.ts).
|
|
2309
|
+
* These names cannot be used for custom operations.
|
|
2310
|
+
*/
|
|
2311
|
+
declare const RESERVED_OPERATION_NAMES: readonly ["UNDO", "REDO", "SET_NAME", "SET_PREFERRED_EDITOR", "NOOP", "PURGE_DOCUMENT"];
|
|
2312
|
+
type ReservedOperationName = (typeof RESERVED_OPERATION_NAMES)[number];
|
|
2313
|
+
/**
|
|
2314
|
+
* Operation names become the literal action `type` string at runtime and the
|
|
2315
|
+
* key for codegen's action union. They must be SCREAMING_SNAKE_CASE so the
|
|
2316
|
+
* generated TypeScript is valid.
|
|
2317
|
+
*/
|
|
2318
|
+
declare const OPERATION_NAME_PATTERN: RegExp;
|
|
2319
|
+
declare function isValidOperationNameFormat(name: string): boolean;
|
|
2320
|
+
/**
|
|
2321
|
+
* Check if name conflicts with base reducer actions (case-insensitive).
|
|
2322
|
+
*/
|
|
2323
|
+
declare function isReservedOperationName(name: string): boolean;
|
|
2324
|
+
/**
|
|
2325
|
+
* Get all operation names from all modules in the latest specification.
|
|
2326
|
+
* Returns names in uppercase for case-insensitive comparison.
|
|
2327
|
+
*/
|
|
2328
|
+
declare function getAllOperationNames(state: DocumentModelGlobalState, excludeOperationId?: string): string[];
|
|
2329
|
+
/**
|
|
2330
|
+
* Validate operation name is not reserved or duplicate. Throws on failure.
|
|
2331
|
+
*
|
|
2332
|
+
* @param name - The operation name to validate
|
|
2333
|
+
* @param state - The document model global state
|
|
2334
|
+
* @param excludeOperationId - Optional operation ID to exclude (for rename validation)
|
|
2335
|
+
* @throws Error if the name is reserved or a duplicate
|
|
2336
|
+
*/
|
|
2337
|
+
declare function validateOperationName(name: string, state: DocumentModelGlobalState, excludeOperationId?: string): void;
|
|
2338
|
+
declare function validateInitialState(initialState: string, allowEmptyState?: boolean): ValidationError[];
|
|
2339
|
+
declare function validateStateSchemaName(schema: string, documentName: string, scope?: string, allowEmptySchema?: boolean): ValidationError[];
|
|
2340
|
+
declare function validateModules(modules: ModuleSpecification[]): ValidationError[];
|
|
2341
|
+
declare function validateModule(mod: ModuleSpecification): ValidationError[];
|
|
2342
|
+
declare function validateModuleOperation(operation: OperationSpecification): ValidationError[];
|
|
2343
|
+
/**
|
|
2344
|
+
* Find a module in the latest specification by id, or throw. Reducers that
|
|
2345
|
+
* mutate-by-id should call this up front so an unknown id fails loudly
|
|
2346
|
+
* instead of silently no-opping.
|
|
2347
|
+
*/
|
|
2348
|
+
declare function findModuleOrThrow(state: DocumentModelGlobalState, moduleId: string): ModuleSpecification;
|
|
2349
|
+
/**
|
|
2350
|
+
* Find an operation in the latest specification by id, or throw. Same
|
|
2351
|
+
* rationale as findModuleOrThrow — reducers that target an operation must
|
|
2352
|
+
* fail loudly when the operation doesn't exist.
|
|
2353
|
+
*/
|
|
2354
|
+
declare function findOperationOrThrow(state: DocumentModelGlobalState, operationId: string): OperationSpecification;
|
|
2355
|
+
/**
|
|
2356
|
+
* Find an operation error by id across all operations in the latest
|
|
2357
|
+
* specification, or throw. Throws on a duplicate id too: setters act on a
|
|
2358
|
+
* single error, so an ambiguous id must fail loudly rather than mutate an
|
|
2359
|
+
* arbitrary match.
|
|
2360
|
+
*/
|
|
2361
|
+
declare function findOperationErrorOrThrow(state: DocumentModelGlobalState, errorId: string): OperationErrorSpecification;
|
|
2362
|
+
/**
|
|
2363
|
+
* Find an operation example (code example) by id across all operations in the
|
|
2364
|
+
* latest specification, or throw. Throws on a duplicate id for the same reason
|
|
2365
|
+
* as findOperationErrorOrThrow.
|
|
2366
|
+
*/
|
|
2367
|
+
declare function findOperationExampleOrThrow(state: DocumentModelGlobalState, exampleId: string): CodeExample;
|
|
2368
|
+
/**
|
|
2369
|
+
* Assert no module in the latest specification already uses `id`. Modules are
|
|
2370
|
+
* targeted by id by the setter/delete/reorder reducers, so a duplicate id makes
|
|
2371
|
+
* those operations ambiguous.
|
|
2372
|
+
*/
|
|
2373
|
+
declare function assertModuleIdUnique(state: DocumentModelGlobalState, id: string): void;
|
|
2374
|
+
/**
|
|
2375
|
+
* Assert no operation in the latest specification already uses `id`. Operations
|
|
2376
|
+
* are targeted by id across all modules, so the id must be unique document-wide.
|
|
2377
|
+
*/
|
|
2378
|
+
declare function assertOperationIdUnique(state: DocumentModelGlobalState, id: string): void;
|
|
2379
|
+
/**
|
|
2380
|
+
* Assert no operation error in the latest specification already uses `id`.
|
|
2381
|
+
* Error ids are targeted document-wide by the setter/delete reducers, so the id
|
|
2382
|
+
* must be unique to keep those operations unambiguous.
|
|
2383
|
+
*/
|
|
2384
|
+
declare function assertOperationErrorIdUnique(state: DocumentModelGlobalState, id: string): void;
|
|
2385
|
+
/**
|
|
2386
|
+
* Assert no operation example in the latest specification already uses `id`.
|
|
2387
|
+
* Example ids are targeted document-wide by the update/delete reducers, so the
|
|
2388
|
+
* id must be unique to keep those operations unambiguous.
|
|
2389
|
+
*/
|
|
2390
|
+
declare function assertOperationExampleIdUnique(state: DocumentModelGlobalState, id: string): void;
|
|
2391
|
+
declare function validateOperations(operations: DocumentOperations): ValidationError[];
|
|
2392
|
+
//#endregion
|
|
2393
|
+
//#region processors/deletion.d.ts
|
|
2394
|
+
/** The id a DELETE_DOCUMENT or PURGE_DOCUMENT removes; undefined otherwise. */
|
|
2395
|
+
declare function deletedDocumentId(op: OperationWithContext$1): string | undefined;
|
|
2396
|
+
//#endregion
|
|
2397
|
+
//#region processors/http.d.ts
|
|
2398
|
+
/** Methods a package route may bind. OPTIONS belongs to the CORS layer. */
|
|
2399
|
+
type RouteMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
|
|
2400
|
+
interface RouteUser {
|
|
2401
|
+
address: string;
|
|
2402
|
+
chainId: number;
|
|
2403
|
+
networkId: string;
|
|
2404
|
+
appKey: string;
|
|
2405
|
+
}
|
|
2406
|
+
type RouteActor = {
|
|
2407
|
+
user: RouteUser | undefined;
|
|
2408
|
+
authEnabled: boolean;
|
|
2409
|
+
};
|
|
2410
|
+
type AuthorizerResult = {
|
|
2411
|
+
authorized: true;
|
|
2412
|
+
} |
|
|
2413
|
+
/** Refused; the scope answers with its own JSON error envelope. */
|
|
2414
|
+
{
|
|
2415
|
+
authorized: false;
|
|
2416
|
+
status: number;
|
|
2417
|
+
message: string;
|
|
2418
|
+
} | {
|
|
2419
|
+
authorized: false;
|
|
2420
|
+
response: Response;
|
|
2421
|
+
};
|
|
2422
|
+
/** A route-specific gate, for policies the standard modes cannot express. */
|
|
2423
|
+
type RouteAuthorizer = (req: IncomingMessage) => Promise<AuthorizerResult> | AuthorizerResult;
|
|
2424
|
+
/** How a route authenticates. */
|
|
2425
|
+
type RouteAuth =
|
|
2426
|
+
/** Default. A verifiable bearer is required; a caller without one gets 401. */
|
|
2427
|
+
"renown" | "renown-optional" | "public" | RouteAuthorizer;
|
|
2428
|
+
/** How the request body reaches the handler. */
|
|
2429
|
+
type RouteBody =
|
|
2430
|
+
/** Default. Buffered, and readable through the Fetch Request. */
|
|
2431
|
+
"parsed" |
|
|
2432
|
+
/** Buffered and also handed over as `ctx.rawBody`, byte for byte. */
|
|
2433
|
+
"raw" |
|
|
2434
|
+
/** Not buffered; the Fetch Request body is the live request stream. */
|
|
2435
|
+
"stream" |
|
|
2436
|
+
/** The body is not read at all. */
|
|
2437
|
+
"none";
|
|
2438
|
+
interface RouteOptions {
|
|
2439
|
+
auth?: RouteAuth;
|
|
2440
|
+
body?: RouteBody;
|
|
2441
|
+
/** Refuse a body larger than this with 413. Ignored when body is `stream`. */
|
|
2442
|
+
maxBodyBytes?: number;
|
|
2443
|
+
/** Serve sub-paths too, not just an exact match. */
|
|
2444
|
+
prefix?: boolean;
|
|
2445
|
+
}
|
|
2446
|
+
/** Where the request reached the host, resolved through any reverse proxy. */
|
|
2447
|
+
interface RouteTransport {
|
|
2448
|
+
proto: string;
|
|
2449
|
+
host: string;
|
|
2450
|
+
prefix: string;
|
|
2451
|
+
baseUrl: string;
|
|
2452
|
+
}
|
|
2453
|
+
interface RouteContext {
|
|
2454
|
+
/** Decoded path params. */
|
|
2455
|
+
params: Record<string, string>;
|
|
2456
|
+
user: RouteUser | undefined;
|
|
2457
|
+
authEnabled: boolean;
|
|
2458
|
+
/** The exact octets received. Present only when body is `raw`. */
|
|
2459
|
+
rawBody: Buffer | undefined;
|
|
2460
|
+
/** Aborts when the client disconnects. */
|
|
2461
|
+
signal: AbortSignal;
|
|
2462
|
+
transport: RouteTransport;
|
|
2463
|
+
}
|
|
2464
|
+
type RouteHandler = (request: Request, ctx: RouteContext) => Response | Promise<Response>;
|
|
2465
|
+
interface RouteSpec extends RouteOptions {
|
|
2466
|
+
method: RouteMethod | RouteMethod[];
|
|
2467
|
+
/** Relative to the scope: "runs/:id", never "/api/@scope/pkg/runs/:id". */
|
|
2468
|
+
path: string;
|
|
2469
|
+
handler: RouteHandler;
|
|
2470
|
+
}
|
|
2471
|
+
interface NodeRouteSpec extends Omit<RouteOptions, "body" | "maxBodyBytes"> {
|
|
2472
|
+
method: RouteMethod | RouteMethod[];
|
|
2473
|
+
path: string;
|
|
2474
|
+
handler: (req: IncomingMessage, res: ServerResponse, ctx: Omit<RouteContext, "rawBody" | "signal">) => void | Promise<void>;
|
|
2475
|
+
}
|
|
2476
|
+
interface ScopedRouteHandle {
|
|
2477
|
+
/** The absolute public URL this route answers on. */
|
|
2478
|
+
readonly url: string;
|
|
2479
|
+
dispose(): void;
|
|
2480
|
+
}
|
|
2481
|
+
type WebhookScheme = "none" |
|
|
2482
|
+
/** A shared secret presented verbatim. No digest, so no digest options. */
|
|
2483
|
+
"token" |
|
|
2484
|
+
/** The digest of the body, alone. */
|
|
2485
|
+
"hmac" |
|
|
2486
|
+
/** That digest behind a label, `sha256=<digest>`. */
|
|
2487
|
+
"hmac-prefixed" | "hmac-timestamped";
|
|
2488
|
+
/** Hashes a sender may compute the digest with. */
|
|
2489
|
+
type WebhookHashAlgorithm = "sha1" | "sha256" | "sha512";
|
|
2490
|
+
/** How the digest is written into the header. */
|
|
2491
|
+
type WebhookSignatureEncoding = "hex" | "base64";
|
|
2492
|
+
interface WebhookVerification {
|
|
2493
|
+
scheme: WebhookScheme;
|
|
2494
|
+
/** Resolved value, never a reference — the caller resolves refs. */
|
|
2495
|
+
secret?: string;
|
|
2496
|
+
/** Overrides the scheme's conventional header. */
|
|
2497
|
+
header?: string;
|
|
2498
|
+
/** Replay window for timestamped schemes. */
|
|
2499
|
+
toleranceSeconds?: number;
|
|
2500
|
+
algorithm?: WebhookHashAlgorithm;
|
|
2501
|
+
/** Defaults to `hex`. Base64 comparison is case-sensitive; hex is not. */
|
|
2502
|
+
encoding?: WebhookSignatureEncoding;
|
|
2503
|
+
prefix?: string;
|
|
2504
|
+
}
|
|
2505
|
+
type WebhookField = string | {
|
|
2506
|
+
header: string;
|
|
2507
|
+
} |
|
|
2508
|
+
/** Dot-separated path into the parsed body, e.g. `data.object.id`. */
|
|
2509
|
+
{
|
|
2510
|
+
body: string;
|
|
2511
|
+
};
|
|
2512
|
+
interface WebhookRequest {
|
|
2513
|
+
/** The caller's own key for this endpoint, e.g. a document id. */
|
|
2514
|
+
key: string;
|
|
2515
|
+
method: string;
|
|
2516
|
+
path: string;
|
|
2517
|
+
queryParams: Record<string, string>;
|
|
2518
|
+
/** Lowercased, with credentials redacted. */
|
|
2519
|
+
headers: Record<string, string>;
|
|
2520
|
+
/** The exact bytes received. */
|
|
2521
|
+
raw: Buffer;
|
|
2522
|
+
/** JSON and form bodies decoded; anything else as text. */
|
|
2523
|
+
body: unknown;
|
|
2524
|
+
}
|
|
2525
|
+
interface WebhookReply {
|
|
2526
|
+
status: number;
|
|
2527
|
+
body?: string;
|
|
2528
|
+
contentType?: string;
|
|
2529
|
+
}
|
|
2530
|
+
interface WebhookPolicy {
|
|
2531
|
+
verify?: WebhookVerification;
|
|
2532
|
+
/** Uppercase. Undefined accepts every method. */
|
|
2533
|
+
methods?: string[];
|
|
2534
|
+
dedupe?: {
|
|
2535
|
+
field: WebhookField;
|
|
2536
|
+
ttlSeconds?: number;
|
|
2537
|
+
};
|
|
2538
|
+
challengeField?: WebhookField;
|
|
2539
|
+
maxBodyBytes?: number;
|
|
2540
|
+
}
|
|
2541
|
+
interface WebhookSpec {
|
|
2542
|
+
/** Distinguishes several endpoint families within one package. */
|
|
2543
|
+
name: string;
|
|
2544
|
+
defaults?: WebhookPolicy;
|
|
2545
|
+
onRequest: (request: WebhookRequest) => Promise<WebhookReply> | WebhookReply;
|
|
2546
|
+
policyFor?: (key: string) => Promise<WebhookPolicy | undefined> | WebhookPolicy | undefined;
|
|
2547
|
+
}
|
|
2548
|
+
interface WebhookEndpointInfo {
|
|
2549
|
+
key: string;
|
|
2550
|
+
token: string;
|
|
2551
|
+
url: string;
|
|
2552
|
+
createdAt: string;
|
|
2553
|
+
}
|
|
2554
|
+
interface IWebhookEndpoints {
|
|
2555
|
+
endpointFor(key: string): Promise<Omit<WebhookEndpointInfo, "key">>;
|
|
2556
|
+
revoke(key: string): Promise<void>;
|
|
2557
|
+
list(): Promise<WebhookEndpointInfo[]>;
|
|
2558
|
+
}
|
|
2559
|
+
interface IWebhookScope {
|
|
2560
|
+
register(spec: WebhookSpec): Promise<IWebhookEndpoints>;
|
|
2561
|
+
readonly hasPublicOrigin: boolean;
|
|
2562
|
+
}
|
|
2563
|
+
interface IHttpScope {
|
|
2564
|
+
readonly owner: string;
|
|
2565
|
+
readonly baseUrl: string;
|
|
2566
|
+
get(path: string, handler: RouteHandler): ScopedRouteHandle;
|
|
2567
|
+
get(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
2568
|
+
post(path: string, handler: RouteHandler): ScopedRouteHandle;
|
|
2569
|
+
post(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
2570
|
+
put(path: string, handler: RouteHandler): ScopedRouteHandle;
|
|
2571
|
+
put(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
2572
|
+
patch(path: string, handler: RouteHandler): ScopedRouteHandle;
|
|
2573
|
+
patch(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
2574
|
+
delete(path: string, handler: RouteHandler): ScopedRouteHandle;
|
|
2575
|
+
delete(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
2576
|
+
/** Registered independently of GET: a HEAD response is not a bodyless GET. */
|
|
2577
|
+
head(path: string, handler: RouteHandler): ScopedRouteHandle;
|
|
2578
|
+
head(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
|
|
2579
|
+
route(spec: RouteSpec): ScopedRouteHandle;
|
|
2580
|
+
nodeRoute(spec: NodeRouteSpec): ScopedRouteHandle;
|
|
2581
|
+
readonly webhooks: IWebhookScope;
|
|
2582
|
+
/** Release every route this scope registered. Called on package teardown. */
|
|
2583
|
+
dispose(): void;
|
|
2584
|
+
}
|
|
2585
|
+
//#endregion
|
|
2586
|
+
//#region processors/types.d.ts
|
|
2587
|
+
type ProcessorDispatchResult = {
|
|
2588
|
+
id: string;
|
|
2589
|
+
status: string;
|
|
2590
|
+
};
|
|
2591
|
+
interface IProcessorDispatch {
|
|
2592
|
+
execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
|
|
2593
|
+
}
|
|
2594
|
+
interface IProcessorHostModuleBase {
|
|
2595
|
+
analyticsStore: IAnalyticsStore;
|
|
2596
|
+
relationalDb: IRelationalDb;
|
|
2597
|
+
processorApp: ProcessorApp;
|
|
2598
|
+
dispatch: IProcessorDispatch;
|
|
2599
|
+
getReadModel<T>(name: string): T;
|
|
2600
|
+
config?: Map<string, unknown>;
|
|
2601
|
+
/**
|
|
2602
|
+
* The package's slice of the HTTP surface, bound to its own namespace.
|
|
2603
|
+
*
|
|
2604
|
+
* Declared on the host-agnostic base rather than on each host's module so
|
|
2605
|
+
* the two cannot drift: codegen types generated processors against
|
|
2606
|
+
* reactor-browser's `IProcessorHostModule`, and the same source has to
|
|
2607
|
+
* compile against reactor-api's.
|
|
2608
|
+
*
|
|
2609
|
+
* Absent whenever the host has no HTTP server — processors also run in the
|
|
2610
|
+
* browser — and on the reactor when the package's name cannot be resolved to
|
|
2611
|
+
* a routable namespace, so a caller must always check before using it.
|
|
2612
|
+
*/
|
|
2613
|
+
http?: IHttpScope;
|
|
2614
|
+
}
|
|
2615
|
+
/**
|
|
2616
|
+
* Filter for matching operations to processors.
|
|
2617
|
+
* All fields are optional arrays - when provided, operations must match at least one value in each specified field.
|
|
2618
|
+
* When a field is undefined or empty, it matches all values for that field.
|
|
2619
|
+
*/
|
|
2620
|
+
type ProcessorFilter = {
|
|
2621
|
+
documentType?: string[];
|
|
2622
|
+
scope?: string[];
|
|
2623
|
+
branch?: string[];
|
|
2624
|
+
documentId?: string[];
|
|
2625
|
+
};
|
|
2626
|
+
/**
|
|
2627
|
+
* Describes an object that can process operations.
|
|
2628
|
+
*/
|
|
2629
|
+
interface IProcessor {
|
|
2630
|
+
/**
|
|
2631
|
+
* Processes a list of operations with context.
|
|
2632
|
+
* Called when operations match this processor's filter.
|
|
2633
|
+
*
|
|
2634
|
+
* Delivery is at-least-once. Within a document's scope and branch, each
|
|
2635
|
+
* call is in ordinal order, and an operation delivered late comes with
|
|
2636
|
+
* every later operation of its stream this processor was already given.
|
|
2637
|
+
* Across documents there is no ordering guarantee. A processor receives one
|
|
2638
|
+
* `onOperations` call at a time; the next call begins after the previous
|
|
2639
|
+
* resolves.
|
|
2640
|
+
*
|
|
2641
|
+
* A drive's processors also receive the drive's own DELETE_DOCUMENT or
|
|
2642
|
+
* PURGE_DOCUMENT, whatever the filter, as the last delivery before
|
|
2643
|
+
* `onDisconnect`. A purged document's operations other than its marker are
|
|
2644
|
+
* not delivered. Erase a document's data on either deletion action.
|
|
2645
|
+
*/
|
|
2646
|
+
onOperations(operations: OperationWithContext[]): Promise<void>;
|
|
2647
|
+
/**
|
|
2648
|
+
* Called when the processor is disconnected.
|
|
2649
|
+
* Used to clean up any resources allocated during processor creation.
|
|
2650
|
+
* Also runs when the factory is unregistered, so it is not a deletion signal.
|
|
2651
|
+
*/
|
|
2652
|
+
onDisconnect(): Promise<void>;
|
|
2653
|
+
}
|
|
2654
|
+
/**
|
|
2655
|
+
* Relates a processor to its filter configuration.
|
|
2656
|
+
*/
|
|
2657
|
+
type ProcessorRecord = {
|
|
2658
|
+
processor: IProcessor;
|
|
2659
|
+
filter: ProcessorFilter;
|
|
2660
|
+
startFrom?: "beginning" | "current";
|
|
2661
|
+
id?: string;
|
|
2662
|
+
};
|
|
2663
|
+
/**
|
|
2664
|
+
* A factory function that creates processor records for a given drive.
|
|
2665
|
+
* Called once per drive when the drive is first detected or when the factory is registered.
|
|
2666
|
+
* The header is the drive's header at creation. For a purged drive it is
|
|
2667
|
+
* minimal: only `id` and `documentType` are set, and `slug` and `name` are
|
|
2668
|
+
* empty, so a factory that selects drives by slug or name makes no processor
|
|
2669
|
+
* for it and the deletion stays owed.
|
|
2670
|
+
*/
|
|
2671
|
+
type ProcessorFactory = (driveHeader: PHDocumentHeader, processorApp?: ProcessorApp) => Promise<ProcessorRecord[]> | ProcessorRecord[];
|
|
2672
|
+
/** Takes a processor host module and builds processor factories using its context. */
|
|
2673
|
+
type ProcessorFactoryBuilder<TModule extends IProcessorHostModuleBase = IProcessorHostModuleBase> = {
|
|
2674
|
+
bivarianceHack(module: TModule): Promise<ProcessorFactory> | ProcessorFactory;
|
|
2675
|
+
}["bivarianceHack"];
|
|
2676
|
+
type ProcessorStatus = "active" | "errored";
|
|
2677
|
+
type TrackedProcessor = {
|
|
2678
|
+
processorId: string;
|
|
2679
|
+
factoryId: string;
|
|
2680
|
+
driveId: string;
|
|
2681
|
+
processorIndex: number;
|
|
2682
|
+
record: ProcessorRecord;
|
|
2683
|
+
lastOrdinal: number;
|
|
2684
|
+
status: ProcessorStatus;
|
|
2685
|
+
lastError: string | undefined;
|
|
2686
|
+
lastErrorTimestamp: Date | undefined;
|
|
2687
|
+
/**
|
|
2688
|
+
* Clears the error and resolves once the replay from the cursor completes.
|
|
2689
|
+
* Safe from anywhere, but awaiting it from this processor's own
|
|
2690
|
+
* `onOperations` waits on itself: the replay runs after that call returns.
|
|
2691
|
+
* A no-op once the processor has been removed.
|
|
2692
|
+
*/
|
|
2693
|
+
retry: () => Promise<void>;
|
|
2694
|
+
};
|
|
2695
|
+
/**
|
|
2696
|
+
* Manages processor creation and destruction based on drive operations.
|
|
2697
|
+
*/
|
|
2698
|
+
interface IProcessorManager {
|
|
2699
|
+
/**
|
|
2700
|
+
* Registers a processor factory.
|
|
2701
|
+
* Immediately creates processors for all existing drives and resolves once
|
|
2702
|
+
* every factory run has completed and its processors are bound. Their
|
|
2703
|
+
* backfills run afterwards, on each processor's own queue. A deleted drive
|
|
2704
|
+
* whose deletion one of the factory's processors never received (it was not
|
|
2705
|
+
* running, or its delivery threw) gets a processor too: it receives only the
|
|
2706
|
+
* drive's `DELETE_DOCUMENT`, or its `PURGE_DOCUMENT` once purged, and is
|
|
2707
|
+
* disconnected. That delivery is not awaited: it runs after this resolves,
|
|
2708
|
+
* so a processor that hangs on it does not hold the registration, nor a
|
|
2709
|
+
* later one: a drive whose deletion is still being delivered gets it from
|
|
2710
|
+
* the new registration only if that delivery leaves it owed. If processors
|
|
2711
|
+
* from an earlier registration under the same identifier are still
|
|
2712
|
+
* draining, or a call of the previous factory is still in flight, the
|
|
2713
|
+
* factory runs after they have settled, so awaiting a re-registration of
|
|
2714
|
+
* a factory from inside that factory or one of its processors'
|
|
2715
|
+
* `onOperations` waits on itself.
|
|
2716
|
+
*/
|
|
2717
|
+
registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
|
|
2718
|
+
/**
|
|
2719
|
+
* Unregisters a processor factory. Resolves once its processors receive no
|
|
2720
|
+
* new deliveries and their cursors are released; each one's in-flight
|
|
2721
|
+
* delivery finishes first, then `onDisconnect` runs. A released cursor no
|
|
2722
|
+
* longer positions a processor: a re-registration starts each one afresh,
|
|
2723
|
+
* per `startFrom`. It only records that the factory held a drive's data, so
|
|
2724
|
+
* that a drive deleted before the factory registers again still gets its
|
|
2725
|
+
* deletion delivered then. Safe to call from
|
|
2726
|
+
* inside a processor's own `onOperations`.
|
|
2727
|
+
*/
|
|
2728
|
+
unregisterFactory(identifier: string): Promise<void>;
|
|
2729
|
+
/**
|
|
2730
|
+
* Gets a tracked processor by its ID.
|
|
2731
|
+
*/
|
|
2732
|
+
get(processorId: string): TrackedProcessor | undefined;
|
|
2733
|
+
/**
|
|
2734
|
+
* Gets all tracked processors, including an errored entry for each
|
|
2735
|
+
* processor whose drive's deletion threw; its `retry()` delivers the
|
|
2736
|
+
* deletion again.
|
|
2737
|
+
*/
|
|
2738
|
+
getAll(): TrackedProcessor[];
|
|
2739
|
+
}
|
|
2740
|
+
type ProcessorApp = (typeof PROCESSOR_APPS)[number];
|
|
2741
|
+
type ProcessorApps = readonly ProcessorApp[];
|
|
2742
|
+
//#endregion
|
|
2743
|
+
//#region processors/relational/types.d.ts
|
|
2744
|
+
/** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */
|
|
2745
|
+
declare const DOCUMENT_ID_COLUMNS: readonly ["document_id", "documentId"];
|
|
2746
|
+
type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
|
|
2747
|
+
type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
|
|
2748
|
+
withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
|
|
1804
2749
|
};
|
|
1805
|
-
type
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
2750
|
+
type HashAlgorithms = "fnv1a";
|
|
2751
|
+
type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
|
|
2752
|
+
/**
|
|
2753
|
+
* The standardized relational database interface for relational db processors.
|
|
2754
|
+
* This abstraction provides type-safe database operations while hiding the underlying
|
|
2755
|
+
* database framework implementation details.
|
|
2756
|
+
**/
|
|
2757
|
+
type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {
|
|
2758
|
+
createNamespace<NamespaceSchema>(namespace: string): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;
|
|
2759
|
+
queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilder<NamespaceSchema>;
|
|
1812
2760
|
};
|
|
2761
|
+
type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessor<infer TSchema> ? TSchema : TProcessor;
|
|
2762
|
+
type RelationalDbProcessorClass<TSchema> = typeof RelationalDbProcessor<TSchema>;
|
|
2763
|
+
interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
|
|
2764
|
+
namespace: string;
|
|
2765
|
+
query: IRelationalQueryBuilder<TDatabaseSchema>;
|
|
2766
|
+
filter: ProcessorFilter;
|
|
2767
|
+
initAndUpgrade(): Promise<void>;
|
|
2768
|
+
}
|
|
2769
|
+
declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
|
|
1813
2770
|
/**
|
|
1814
|
-
*
|
|
1815
|
-
*
|
|
1816
|
-
*
|
|
1817
|
-
* that resolves a module or compares versions must use this rule; resolving
|
|
1818
|
-
* 0 to "latest" instead re-pins a legacy document's history to whichever
|
|
1819
|
-
* module happens to be newest.
|
|
2771
|
+
* Base class for relational db processors that require a relational database storage.
|
|
2772
|
+
* This class abstracts database initialization, migration management, and resource cleanup,
|
|
2773
|
+
* allowing derived classes to focus on business logic.
|
|
1820
2774
|
*/
|
|
1821
|
-
declare
|
|
2775
|
+
declare abstract class RelationalDbProcessor<TDatabaseSchema = unknown> implements IRelationalDbProcessor<TDatabaseSchema> {
|
|
2776
|
+
protected _namespace: string;
|
|
2777
|
+
protected _filter: ProcessorFilter;
|
|
2778
|
+
protected relationalDb: IRelationalDb<TDatabaseSchema>;
|
|
2779
|
+
/** The drive the factory created this processor for. */
|
|
2780
|
+
protected _driveId?: string | undefined;
|
|
2781
|
+
constructor(_namespace: string, _filter: ProcessorFilter, relationalDb: IRelationalDb<TDatabaseSchema>,
|
|
2782
|
+
/** The drive the factory created this processor for. */
|
|
2783
|
+
_driveId?: string | undefined);
|
|
2784
|
+
static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
|
|
2785
|
+
/**
|
|
2786
|
+
* Returns the namespace for a given drive id.
|
|
2787
|
+
* This method can be overridden by derived classes to provide a custom namespace.
|
|
2788
|
+
*/
|
|
2789
|
+
static getNamespace(driveId: string): string;
|
|
2790
|
+
static query<Schema>(this: RelationalDbProcessorClass<Schema>, driveId: string, db: IRelationalDb<any>): IRelationalQueryBuilder<Schema>;
|
|
2791
|
+
/**
|
|
2792
|
+
* Processes a list of operations with context.
|
|
2793
|
+
* Called when operations match this processor's filter.
|
|
2794
|
+
*/
|
|
2795
|
+
abstract onOperations(operations: OperationWithContext[]): Promise<void>;
|
|
2796
|
+
/**
|
|
2797
|
+
* Returns the filter for the processor.
|
|
2798
|
+
* This method can be overridden by derived classes to provide a custom filter.
|
|
2799
|
+
*/
|
|
2800
|
+
get filter(): ProcessorFilter;
|
|
2801
|
+
/**
|
|
2802
|
+
* Returns the namespace used by the processor.
|
|
2803
|
+
*/
|
|
2804
|
+
get namespace(): string;
|
|
2805
|
+
get query(): IRelationalQueryBuilder<TDatabaseSchema>;
|
|
2806
|
+
/** True for this processor's drive when its namespace is that drive's alone. */
|
|
2807
|
+
protected isNamespaceDrive(documentId: string): boolean;
|
|
2808
|
+
/** Deletes a document's rows from every table with a document-id column. */
|
|
2809
|
+
protected deleteDocumentRows(documentId: string): Promise<void>;
|
|
2810
|
+
/** Drops this processor's namespace and every table in it. */
|
|
2811
|
+
protected dropNamespace(): Promise<void>;
|
|
2812
|
+
private namespaceSchema;
|
|
2813
|
+
/**
|
|
2814
|
+
* Abstract method that derived classes must implement.
|
|
2815
|
+
* This method is meant to be called on subclasses to initialize and upgrade the database.
|
|
2816
|
+
*/
|
|
2817
|
+
abstract initAndUpgrade(): Promise<void>;
|
|
2818
|
+
/**
|
|
2819
|
+
* Called when the processor is disconnected.
|
|
2820
|
+
* This method is meant to be overridden by subclasses to clean up resources.
|
|
2821
|
+
*/
|
|
2822
|
+
abstract onDisconnect(): Promise<void>;
|
|
2823
|
+
}
|
|
2824
|
+
//#endregion
|
|
2825
|
+
//#region processors/relational/utils.d.ts
|
|
1822
2826
|
/**
|
|
1823
|
-
*
|
|
1824
|
-
*
|
|
1825
|
-
*
|
|
1826
|
-
*
|
|
1827
|
-
*
|
|
1828
|
-
* - fromVersion > toVersion: Throw DowngradeNotSupportedError
|
|
1829
|
-
* - All other cases: Apply upgradePath transitions (if provided), then apply initialState, set version
|
|
2827
|
+
* Hashes a string to a lowercase base-26 string.
|
|
2828
|
+
* @param str The string to hash.
|
|
2829
|
+
* @param length The length of the hash. Defaults to 10.
|
|
2830
|
+
* @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
|
|
2831
|
+
* @returns The hashed string.
|
|
1830
2832
|
*/
|
|
1831
|
-
declare function
|
|
1832
|
-
/** CREATE_DOCUMENT fixes `protocolVersions`; this puts them back after a reducer. */
|
|
1833
|
-
declare function withProtocolVersions<TDocument extends PHDocument>(document: TDocument, protocolVersions: PHDocument["header"]["protocolVersions"]): TDocument;
|
|
2833
|
+
declare function hashNamespace(str: string, length?: number): string;
|
|
1834
2834
|
/**
|
|
1835
|
-
*
|
|
1836
|
-
*
|
|
2835
|
+
* Creates a RelationalDb instance with namespace support.
|
|
2836
|
+
* @param baseDb The base RelationalDb instance to enhance.
|
|
2837
|
+
* @param baseOptions The default options for namespace creation. Hashes namespace by default.
|
|
2838
|
+
* @returns The enhanced RelationalDb instance.
|
|
1837
2839
|
*/
|
|
1838
|
-
declare function
|
|
2840
|
+
declare function createRelationalDb<Schema>(baseDb: IBaseRelationalDb<Schema>, baseOptions?: NamespaceOptions): IRelationalDb<Schema>;
|
|
2841
|
+
type NamespaceOptions = {
|
|
2842
|
+
hashNamespace?: boolean;
|
|
2843
|
+
};
|
|
2844
|
+
declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
|
|
2845
|
+
/** The schema behind a handle from `createNamespace`; undefined otherwise. */
|
|
2846
|
+
declare function namespaceSchemaOf(db: object): string | undefined;
|
|
2847
|
+
declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
|
|
1839
2848
|
/**
|
|
1840
|
-
*
|
|
1841
|
-
*
|
|
1842
|
-
*
|
|
1843
|
-
* if the manifest is absent or any step is missing.
|
|
2849
|
+
* Returns a query builder for a RelationalDb instance.
|
|
2850
|
+
* @param query The RelationalDb instance to convert.
|
|
2851
|
+
* @returns The IRelationalQueryBuilder instance.
|
|
1844
2852
|
*/
|
|
1845
|
-
declare function
|
|
2853
|
+
declare function relationalDbToQueryBuilder<TSchema>(query: IBaseRelationalDb<TSchema>): IRelationalQueryBuilder<TSchema>;
|
|
1846
2854
|
//#endregion
|
|
1847
2855
|
//#region document-model/types.d.ts
|
|
1848
2856
|
type State = {
|
|
@@ -2690,6 +3698,13 @@ type DeleteDocumentActionInput = {
|
|
|
2690
3698
|
documentId: string;
|
|
2691
3699
|
propagate?: "none" | "cascade";
|
|
2692
3700
|
};
|
|
3701
|
+
type PurgeDocumentActionInput = {
|
|
3702
|
+
documentId: string;
|
|
3703
|
+
documentType: string;
|
|
3704
|
+
/** The same instant as the action's timestampUtcMs. */
|
|
3705
|
+
purgedAtUtcIso: string;
|
|
3706
|
+
requestId: string;
|
|
3707
|
+
};
|
|
2693
3708
|
type AddRelationshipActionInput = {
|
|
2694
3709
|
sourceId: string;
|
|
2695
3710
|
targetId: string;
|
|
@@ -2719,6 +3734,12 @@ type DeleteDocumentAction = Action & {
|
|
|
2719
3734
|
type: "DELETE_DOCUMENT";
|
|
2720
3735
|
input: DeleteDocumentActionInput;
|
|
2721
3736
|
};
|
|
3737
|
+
/** Reserved document-scope marker; a purged document's only operation. */
|
|
3738
|
+
type PurgeDocumentAction = Action & {
|
|
3739
|
+
type: "PURGE_DOCUMENT";
|
|
3740
|
+
scope: "document";
|
|
3741
|
+
input: PurgeDocumentActionInput;
|
|
3742
|
+
};
|
|
2722
3743
|
type AddRelationshipAction = Action & {
|
|
2723
3744
|
type: "ADD_RELATIONSHIP";
|
|
2724
3745
|
input: AddRelationshipActionInput;
|
|
@@ -3332,6 +4353,6 @@ type PowerhouseConfig = {
|
|
|
3332
4353
|
connect?: PHConnectRuntimeConfig;
|
|
3333
4354
|
};
|
|
3334
4355
|
//#endregion
|
|
3335
|
-
export { AddOperationErrorInput as $, AddOperationErrorInputSchema as $a, deleteOperationError as $c, SetOperationNameInput as $i, baseReducerVersion as $l, MutationMoveOperationArgs as $n, SetOperationErrorNameInputSchema as $o, ReorderChangeLogItemsInput as $r, ProcessorApps as $s, DocumentModelOperationExampleAction as $t, defaultDocumentState as $u, PHPackageProvider as A, UndoRedoAction as Aa, WebhookScheme as Ac, PHDocumentSignatureInfo as Ad, SetModelExtensionInput as Ai, setOperationErrorName as Al, MakeEmpty as An, RedoActionSchema as Ao, MutationUpdateStateExampleArgs as Ar, isV2ActionHash as As, DeleteOperationErrorAction as At, sortOperations as Au, ServiceActions as B, UpgradeDocumentActionInput as Ba, addChangeLogItem as Bc, SetNameActionInput as Bi, updateChangeLogItem as Bl, Mutation as Bn, SetAuthorWebsiteInputSchema as Bo, PieceModule as Br, HashAlgorithms as Bs, DocumentModelDocumentModelModule as Bt, PHBaseState as Bu, PHConnectPwaUrlPattern as C, SkipHeaderOperations as Ca, ScopedRouteHandle as Cc, setNameOperation as Cd, SetAuthorWebsiteAction as Ci, setModelName as Cl, ISigner as Cn, PieceModuleSchema as Co, MutationSetOperationReducerArgs as Cr, CanonicalJsonError as Cs, DeleteChildDocumentInput as Ct, readOnly as Cu, PHConnectRenownAdapters as D, Undo as Da, WebhookPolicy as Dc, ActionSigner as Dd, SetModelDescriptionAction as Di, setOperationDescription as Dl, IsStateOfType as Dn, PublisherSchema as Do, MutationUndoArgs as Dr, actionSigningTarget as Ds, DeleteModuleAction as Dt, reshuffleByTimestampAndIndex as Du, PHConnectRenown as E, SubgraphModule as Ea, WebhookHashAlgorithm as Ec, undoOperationV2 as Ed, SetInitialStateInput as Ei, setName as El, IsDocumentOfType as En, PowerhouseModulesSchema as Eo, MutationSetStateSchemaArgs as Er, actionSignerIdentity as Es, DeleteDocumentActionInput as Et, reshuffleByTimestamp as Eu, ParsedCmdResult as F, UpdateRelationshipAction as Fa, ActionContext as Fc, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Fd, SetModuleDescriptionAction as Fi, setOperationScope as Fl, Maybe as Fn, ReorderOperationErrorsInputSchema as Fo, OperationsByScope as Fr, createNamespacedQueryBuilder as Fs, DeleteStateExampleAction as Ft, Capability as Fu, ActionVerificationHandler as G, UpgradeTransition as Ga, addStateExample as Gc, SetOperationErrorCodeInput as Gi, IntegrityIssueType as Gl, MutationAddOperationExampleArgs as Gn, SetModelNameInputSchema as Go, RedoAction as Gr, IRelationalQueryMethods as Gs, DocumentModelLib as Gt, createAuthState as Gu, ActionErrorCallback as H, ValidationError as Ha, addOperation as Hc, SetOperationDescriptionAction as Hi, updateStateExample as Hl, MutationAddModuleArgs as Hn, SetModelDescriptionInputSchema as Ho, Publisher as Hr, IRelationalDb as Hs, DocumentModelHeaderAction as Ht, PHGroupState as Hu, PathValidation as I, UpdateRelationshipActionInput as Ia, actionContext as Ic, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as Id, SetModuleDescriptionInput as Ii, setOperationTemplate as Il, MinimalBackupData as In, ReorderOperationExamplesInputSchema as Io, PartialRecord as Ir, createRelationalDb as Is, DeleteStateExampleInput as It, Condition as Iu, AddChangeLogItemInput as J, computeUpgradeTransitions as Ja, buildSignedAction as Jc, SetOperationErrorNameAction as Ji, PHDocumentMeta as Jl, MutationDeleteModuleArgs as Jn, SetNameActionInputSchema as Jo, ReducerOptions as Jr, IProcessor as Js, DocumentModelModuleAction as Jt, createGlobalState as Ju, Actions as K, applyDeleteDocumentAction as Ka, baseActions as Kc, SetOperationErrorDescriptionAction as Ki, PHDocument as Kl, MutationAddStateExampleArgs as Kn, SetModuleDescriptionInputSchema as Ko, RedoActionInput as Kr, RelationalDbProcessor as Ks, DocumentModelLocalState as Kt, createBaseState as Ku, PowerhouseConfig as L, UpdateStateExampleAction as La, actionFromAction as Lc, PROCESSOR_APPS as Ld, SetModuleNameAction as Li, setPreferredEditor as Ll, ModuleSpecification as Ln, ReorderStateExamplesInputSchema as Lo, PartialState as Lr, hashNamespace as Ls, DocumentAction as Lt, Grant as Lu, PHRenownPrivyAdapterConfig as M, UpdateChangeLogItemInput as Ma, WebhookSpec as Mc, UserActionSigner as Md, SetModelIdInput as Mi, setOperationName as Ml, MakeOptional as Mn, ReorderChangeLogItemsInputSchema as Mo, OperationErrorSpecification as Mr, targetDocumentId as Ms, DeleteOperationExampleAction as Mt, updateHeaderRevision as Mu, PHRenownRainbowAdapterConfig as N, UpdateOperationExampleAction as Na, WebhookVerification as Nc, deserializeSignature as Nd, SetModelNameAction as Ni, setOperationReducer as Nl, Manifest as Nn, ReorderModuleOperationsInputSchema as No, OperationIndex as Nr, v2TupleProblem as Ns, DeleteOperationExampleInput as Nt, withSignaturePolicy as Nu, PHConnectRuntimeConfig as O, UndoAction as Oa, WebhookReply as Oc, AppActionSigner as Od, SetModelDescriptionInput as Oi, setOperationErrorCode as Ol, LoadFromFile as On, PwaConfigSchema as Oo, MutationUpdateChangeLogItemInputArgs as Or, canonicalJson as Os, DeleteModuleInput as Ot, skipHeaderOperations as Ou, PackageManagerArgs as P, UpdateOperationExampleInput as Pa, Action as Pc, serializeSignature as Pd, SetModelNameInput as Pi, setOperationSchema as Pl, MappedOperation as Pn, ReorderModulesInputSchema as Po, OperationSpecification as Pr, createNamespacedDb as Ps, DeleteOperationInput as Pt, AuthGroups as Pu, AddOperationErrorAction as Q, AddModuleInputSchema as Qa, deleteOperation as Qc, SetOperationNameAction as Qi, baseCreateDocument as Ql, MutationDeleteStateExampleArgs as Qn, SetOperationErrorDescriptionInputSchema as Qo, ReorderChangeLogItemsAction as Qr, ProcessorApp as Qs, DocumentModelOperationErrorOperations as Qt, defaultBaseState as Qu, PowerhousePackage as R, UpdateStateExampleInput as Ra, actionSigner as Rc, SetModuleNameInput as Ri, setStateSchema as Rl, MoveOperationAction as Rn, ScopeStateSchema as Ro, PhAiToolAnnotations as Rr, relationalDbToQueryBuilder as Rs, DocumentModelAction as Rt, Operand as Ru, PHConnectPwaRuntimeCaching as S, SkipHeaderOperationIndex as Sa, RouteUser as Sc, redoOperation as Sd, SetAuthorNameInput as Si, setModelId as Sl, ISignalResult as Sn, OperationSpecificationSchema as So, MutationSetOperationNameArgs as Sr, ActionSigningTarget as Ss, DeleteChangeLogItemInput as St, prepareOperations as Su, PHConnectReactorFeatureFlags as T, StateReducer as Ta, WebhookField as Tc, undoOperation as Td, SetInitialStateAction as Ti, setModuleName as Tl, InputMaybe as Tn, PowerhouseModuleSchema as To, MutationSetOperationTemplateArgs as Tr, actionPreimageV2 as Ts, DeleteDocumentAction as Tt, replayDocument as Tu, ActionSignatureContext as U, UpgradeManifest as Ua, addOperationError as Uc, SetOperationDescriptionInput as Ui, verifyOperationSignature as Ul, MutationAddOperationArgs as Un, SetModelExtensionInputSchema as Uo, Query as Ur, IRelationalDbProcessor as Us, DocumentModelHeaderOperations as Ut, Principal as Uu, DEFAULT_REGISTRY_URL as V, User as Va, addModule as Vc, SetNameOperation as Vi, updateOperationExample as Vl, MutationAddChangeLogItemInputArgs as Vn, SetInitialStateInputSchema as Vo, PowerhouseModule as Vr, IBaseRelationalDb as Vs, DocumentModelGlobalState as Vt, PHDocumentState as Vu, ActionSigningHandler as W, UpgradeReducer as Wa, addOperationExample as Wc, SetOperationErrorCodeAction as Wi, IntegrityIssueSubType as Wl, MutationAddOperationErrorArgs as Wn, SetModelIdInputSchema as Wo, Redo as Wr, IRelationalQueryBuilder as Ws, DocumentModelInput as Wt, backfillAuthState as Wu, AddModuleInput as X, withProtocolVersions as Xa, deleteChangeLogItem as Xc, SetOperationErrorTemplateAction as Xi, appendWithoutApplying as Xl, MutationDeleteOperationErrorArgs as Xn, SetOperationDescriptionInputSchema as Xo, RemoveRelationshipAction as Xr, IProcessorHostModuleBase as Xs, DocumentModelOperationAction as Xt, createState as Xu, AddModuleAction as Y, normalizeDocumentModelVersion as Ya, createAction as Yc, SetOperationErrorNameInput as Yi, addUndo as Yl, MutationDeleteOperationArgs as Yn, SetNameActionSchema as Yo, ReleaseNewVersionAction as Yr, IProcessorDispatch as Ys, DocumentModelModuleOperations as Yt, createLocalState as Yu, AddOperationAction as Z, AddChangeLogItemInputSchema as Za, deleteModule as Zc, SetOperationErrorTemplateInput as Zi, attachBranch as Zl, MutationDeleteOperationExampleArgs as Zn, SetOperationErrorCodeInputSchema as Zo, RemoveRelationshipActionInput as Zr, IProcessorManager as Zs, DocumentModelOperationErrorAction as Zt, defaultAuthState as Zu, PHConnectPwa as _, SignalResult as _a, RouteHandler as _c, Operation as _d, SchemaSetNameAction as _i, setAuthorName as _l, IAction as _n, ManifestSchema as _o, MutationSetOperationDescriptionArgs as _r, UpdateStateExampleInputSchema as _s, CreateDocument as _t, merge as _u, PHConnectAi as a, SetOperationScopeInput as aa, ProcessorStatus as ac, ProtocolVersions as ad, ReorderOperationErrorsInput as ai, operationExampleCreators as al, DocumentModelUtils as an, ConfigEntrySchema as ao, MutationReorderOperationExamplesArgs as ar, SetOperationTemplateInputSchema as as, AddStateExampleAction as at, garbageCollect as au, PHConnectPwaIcon as b, SignatureVerificationHandler as ba, RouteSpec as bc, OperationWithContext$1 as bd, ScopeState as bi, setModelDescription as bl, IOperation as bn, OperationErrorSchema as bo, MutationSetOperationErrorNameArgs as br, ACTION_SIGNATURE_V2_PREFIX as bs, CreateState as bt, parseResultingState as bu, PHConnectDefaultDrive as c, SetPreferredEditorAction as ca, IHttpScope as cc, SignaturePolicy$1 as cd, ReorderStateExamplesAction as ci, operationWithContext as cl, DocumentOperationsIgnoreMap as cn, DeleteModuleInputSchema as co, MutationSetAuthorWebsiteArgs as cr, SetStateSchemaInputSchema as cs, AssertIsStateOfType as ct, getDocumentLastModified as cu, PHConnectDriveSection as d, SetStateSchemaAction as da, NodeRouteSpec as dc, isSignaturePolicy as dd, RevisionsFilter as di, reorderChangeLogItems as dl, EditorDispatch as dn, DeleteOperationInputSchema as do, MutationSetModelExtensionArgs as dr, StateSchema as ds, ConfigEntry as dt, isDocumentAction as du, SetOperationReducerAction as ea, ProcessorDispatchResult as ec, defaultGlobalState as ed, ReorderModuleOperationsAction as ei, deleteOperationExample as el, DocumentModelOperationExampleOperations as en, AddOperationExampleInputSchema as eo, MutationRedoArgs as er, SetOperationErrorTemplateInputSchema as es, AddOperationExampleAction as et, checkCleanedOperationsIntegrity as eu, PHConnectDriveSections as f, SetStateSchemaInput as fa, RouteActor as fc, protocolVersionsFor as fd, SaveToFile as fi, reorderModuleOperations as fl, EditorModule as fn, DeleteStateExampleInputSchema as fo, MutationSetModelIdArgs as fr, UndoActionInputSchema as fs, ConfigEntryType as ft, isNoopOperation as fu, PHConnectPackages as g, SignalDispatch as ga, RouteContext as gc, DocumentOperations as gd, SchemaRedoAction as gi, reorderStateExamples as gl, GetDocumentOptions as gn, DocumentSpecificationSchema as go, MutationSetNameArgs as gr, UpdateOperationExampleInputSchema as gs, CreateChildDocumentSignal as gt, mapSkippedOperationsV2 as gu, PHConnectOpenPanel as h, Signal as ha, RouteBody as hc, v2RequiredProtocolVersions as hd, SchemaNOOPAction as hi, reorderOperationExamples as hl, FileInput as hn, DocumentModelInputSchema as ho, MutationSetModuleNameArgs as hr, UpdateChangeLogItemInputSchema as hs, CreateChildDocumentInput as ht, mapSkippedOperations as hu, LogLevels as i, SetOperationScopeAction as ia, ProcessorRecord as ic, DocumentIdParams as id, ReorderOperationErrorsAction as ii, noop as il, DocumentModelStateOperations as in, CodeExampleSchema as io, MutationReorderOperationErrorsArgs as ir, SetOperationScopeInputSchema as is, AddRelationshipActionInput as it, filterDuplicatedOperations as iu, PHReactorRenown as j, UpdateChangeLogItemAction as ja, WebhookSignatureEncoding as jc, Signature as jd, SetModelIdAction as ji, setOperationErrorTemplate as jl, MakeMaybe as jn, RedoSchema as jo, NOOPAction as jr, signActionV2 as js, DeleteOperationErrorInput as jt, split as ju, PHConnectSentry as k, UndoActionInput as ka, WebhookRequest as kc, HashConfig as kd, SetModelExtensionAction as ki, setOperationErrorDescription as kl, LoadFromInput as kn, RedoActionInputSchema as ko, MutationUpdateOperationExampleArgs as kr, hashActionV2 as ks, DeleteOperationAction as kt, sortMappedOperations as ku, PHConnectDefaultDriveLocal as l, SetPreferredEditorActionInput as la, IWebhookEndpoints as lc, deriveDocumentId as ld, ReorderStateExamplesInput as li, redo as ll, DocumentSpecification as ln, DeleteOperationErrorInputSchema as lo, MutationSetInitialStateArgs as lr, Set_NameSchema as ls, Author as lt, groupOperationsByScope as lu, PHConnectInstance as m, Set_PreferredEditor as ma, RouteAuthorizer as mc, signaturePolicyOf as md, Scalars as mi, reorderOperationErrors as ml, Exact as mn, DocumentModelGlobalStateSchema as mo, MutationSetModuleDescriptionArgs as mr, UndoSchema as ms, CopyChildDocumentSignal as mt, isUndoRedo as mu, DrivePreserveStrategy as n, SetOperationSchemaAction as na, ProcessorFactoryBuilder as nc, defaultPHState as nd, ReorderModulesAction as ni, documentModelActions as nl, DocumentModelPHState as nn, AddStateExampleInputSchema as no, MutationReorderModuleOperationsArgs as nr, SetOperationReducerInputSchema as ns, AddOperationInput as nt, diffOperations as nu, PHConnectApp as o, SetOperationTemplateAction as oa, TrackedProcessor as oc, SIGNATURE_PROTOCOL as od, ReorderOperationExamplesAction as oi, operationFromAction as ol, DocumentModelVersioningAction as on, ConfigEntryTypeSchema as oo, MutationReorderStateExamplesArgs as or, SetPreferredEditorActionInputSchema as os, AddStateExampleInput as ot, garbageCollectDocumentOperations as ou, PHConnectDrives as p, Set_Name as pa, RouteAuth as pc, requestedSignaturePolicy as pd, SaveToFileHandle as pi, reorderModules as pl, EditorProps as pn, DocumentActionSchema as po, MutationSetModelNameArgs as pr, UndoActionSchema as ps, CopyChildDocumentInput as pt, isUndo as pu, AddChangeLogItemAction as q, applyUpgradeDocumentAction as qa, buildOperationSignature as qc, SetOperationErrorDescriptionInput as qi, PHDocumentHeader as ql, MutationDeleteChangeLogItemInputArgs as qn, SetModuleNameInputSchema as qo, Reducer as qr, RelationalDbProcessorClass as qs, DocumentModelModule as qt, createDocumentState as qu, LogLevel as r, SetOperationSchemaInput as ra, ProcessorFilter as rc, DEFAULT_SIGNATURE_POLICY as rd, ReorderModulesInput as ri, moveOperation as rl, DocumentModelStateAction as rn, AuthorSchema as ro, MutationReorderModulesArgs as rr, SetOperationSchemaInputSchema as rs, AddRelationshipAction as rt, filterDocumentOperationsResultingState as ru, PHConnectBranding as s, SetOperationTemplateInput as sa, AuthorizerResult as sc, SIGNATURE_PROTOCOL_V2 as sd, ReorderOperationExamplesInput as si, operationFromOperation as sl, DocumentModelVersioningOperations as sn, DeleteChangeLogItemInputSchema as so, MutationSetAuthorNameArgs as sr, SetPreferredEditorActionSchema as ss, AssertIsDocumentOfType as st, garbageCollectV2 as su, DrivePreserveStrategies as t, SetOperationReducerInput as ta, ProcessorFactory as tc, defaultLocalState as td, ReorderModuleOperationsInput as ti, deleteStateExample as tl, DocumentModelOperationOperations as tn, AddOperationInputSchema as to, MutationReorderChangeLogItemsInputArgs as tr, SetOperationNameInputSchema as ts, AddOperationExampleInput as tt, checkOperationsIntegrity as tu, PHConnectDefaultDriveRemote as u, SetPreferredEditorOperation as ua, IWebhookScope as uc, isDerivedDocumentId as ud, ReplayDocumentOptions as ui, releaseNewVersion as ul, ENSInfo as un, DeleteOperationExampleInputSchema as uo, MutationSetModelDescriptionArgs as ur, Set_PreferredEditorSchema as us, CodeExample as ut, hashDocumentStateForScope as uu, PHConnectPwaCacheStrategy as v, SignalResults as va, RouteMethod as vc, OperationContext as vd, SchemaSetPreferredEditorAction as vi, setAuthorWebsite as vl, ID as vn, ModuleSchema as vo, MutationSetOperationErrorCodeArgs as vr, definedNonNullAnySchema as vs, CreateDocumentAction as vt, nextSkipNumber as vu, PHConnectReactor as w, State as wa, WebhookEndpointInfo as wc, setPreferredEditorOperation as wd, SetAuthorWebsiteInput as wi, setModuleDescription as wl, Incremental as wn, PieceModulesSchema as wo, MutationSetOperationSchemaArgs as wr, DOCUMENT_SCOPE_ACTION_TYPES as ws, DeleteChildDocumentSignal as wt, removeExistingOperations as wu, PHConnectPwaManifest as x, SigningParameters as xa, RouteTransport as xc, operationOutcome as xd, SetAuthorNameAction as xi, setModelExtension as xl, ISignal as xn, OperationScopeSchema as xo, MutationSetOperationErrorTemplateArgs as xr, ActionSignerIdentity as xs, DeleteChangeLogItemAction as xt, precedes as xu, PHConnectPwaFileHandler as y, SignalType as ya, RouteOptions as yc, OperationOutcome as yd, SchemaUndoAction as yi, setInitialState as yl, IDocument as yn, MoveOperationInputSchema as yo, MutationSetOperationErrorDescriptionArgs as yr, isDefinedNonNullAny as ys, CreateDocumentActionInput as yt, operationsAreEqual as yu, ServiceAction as z, UpgradeDocumentAction as za, actions as zc, SetNameAction as zi, undo as zl, MoveOperationInput as zn, SetAuthorNameInputSchema as zo, PhAiToolDescriptor as zr, ExtractProcessorSchemaOrSelf as zs, DocumentModelDocument as zt, PHAuthState as zu };
|
|
4356
|
+
export { AddOperationErrorInput as $, HashAlgorithms as $a, PurgeMarkerOperation as $c, mentionedGroupIds as $d, reorderChangeLogItems as $f, SetOperationErrorTemplateInput as $i, UpgradeManifest as $l, isSignaturePolicy as $m, MutationMoveOperationArgs as $n, assertOperationExampleIdUnique as $o, isDocumentAction as $p, RemoveRelationshipActionInput as $r, ReorderOperationErrorsInputSchema as $s, DocumentModelOperationExampleAction as $t, documentModelInitialLocalState as $u, PHPackageProvider as A, UndoAction as Aa, UndoActionInputSchema as Ac, InitializeAuthActionInputSchema as Ad, addOperation as Af, SetModelDescriptionInput as Ai, createVerificationSigner as Al, PHGroupState as Am, MakeEmpty as An, RouteHandler as Ao, updateStateExample as Ap, MutationUpdateStateExampleArgs as Ar, DeleteStateExampleInputSchema as As, DeleteOperationErrorAction as At, isDocumentModelState as Au, ServiceActions as B, UpdateStateExampleInput as Ba, documentModelOperationErrorReducer as Bc, SetGrantActionInputSchema as Bd, deleteOperation as Bf, SetModuleNameInput as Bi, createZip as Bl, defaultBaseState as Bm, Mutation as Bn, WebhookPolicy as Bo, baseCreateDocument as Bp, PieceModule as Br, OperationSpecificationSchema as Bs, DocumentModelDocumentModelModule as Bt, buildOperationSignatureParams as Bu, PHConnectPwaUrlPattern as C, SigningParameters as Ca, SetOperationTemplateInputSchema as Cc, AuthRefusal as Cd, ActionContext as Cf, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Ch, SetAuthorNameAction as Ci, peerSupports as Cl, Capability as Cm, ISigner as Cn, IWebhookScope as Co, setOperationScope as Cp, MutationSetOperationReducerArgs as Cr, ConfigEntrySchema as Cs, DeleteChildDocumentInput as Ct, BaseDocumentStateSchema as Cu, PHConnectRenownAdapters as D, StateReducer as Da, Set_NameSchema as Dc, ConditionContext as Dd, actions as Df, SetInitialStateAction as Di, createPresignedHeader as Dl, PHAuthState as Dm, IsStateOfType as Dn, RouteAuthorizer as Do, undo as Dp, MutationUndoArgs as Dr, DeleteOperationErrorInputSchema as Ds, DeleteModuleAction as Dt, assertIsDocumentModelDocument as Du, PHConnectRenown as E, State as Ea, SetStateSchemaInputSchema as Ec, AuthVerb as Ed, actionSigner as Ef, SetAuthorWebsiteInput as Ei, createCopyHeader as El, Operand as Em, IsDocumentOfType as En, RouteAuth as Eo, setStateSchema as Ep, MutationSetStateSchemaArgs as Er, DeleteModuleInputSchema as Es, DeleteDocumentActionInput as Et, DocumentModelSchema as Eu, ParsedCmdResult as F, UpdateOperationExampleAction as Fa, UpdateStateExampleInputSchema as Fc, RemoveGrantAction as Fd, buildOperationSignature as Ff, SetModelNameAction as Fi, BulkArchiveEntry as Fl, createDocumentState as Fm, Maybe as Fn, RouteUser as Fo, PHDocumentHeader as Fp, OperationsByScope as Fr, ManifestSchema as Fs, DeleteStateExampleAction as Ft, isDenied as Fu, ActionVerificationHandler as G, createNamespacedDb as Ga, documentModelStateSchemaReducer as Gc, applySetGrantAction as Gd, moveOperation as Gf, SetOperationDescriptionInput as Gi, isDocumentZip as Gl, DEFAULT_SIGNATURE_POLICY as Gm, MutationAddOperationExampleArgs as Gn, WebhookSpec as Go, filterDocumentOperationsResultingState as Gp, Query as Gr, PublisherSchema as Gs, DocumentModelLib as Gt, HASH_ALGORITHM_SHA1 as Gu, ActionErrorCallback as H, UpgradeDocumentActionInput as Ha, documentModelOperationReducer as Hc, applyInitializeAuthAction as Hd, deleteOperationExample as Hf, SetNameActionInput as Hi, documentModelSaveToFileHandle as Hl, defaultGlobalState as Hm, MutationAddModuleArgs as Hn, WebhookRequest as Ho, checkCleanedOperationsIntegrity as Hp, Publisher as Hr, PieceModulesSchema as Hs, DocumentModelHeaderAction as Ht, getUnixTimestamp as Hu, PathValidation as I, UpdateOperationExampleInput as Ia, definedNonNullAnySchema as Ic, RemoveGrantActionInput as Id, buildSignedAction as If, SetModelNameInput as Ii, baseLoadFromInput as Il, createGlobalState as Im, MinimalBackupData as In, ScopedRouteHandle as Io, PHDocumentMeta as Ip, PartialRecord as Ir, ModuleSchema as Is, DeleteStateExampleInput as It, ab2hex as Iu, AddChangeLogItemInput as J, hashNamespace as Ja, createReducer as Jc, decide as Jd, operationFromAction as Jf, SetOperationErrorDescriptionAction as Ji, writeFileBrowser as Jl, SIGNATURE_PROTOCOL as Jm, MutationDeleteModuleArgs as Jn, OPERATION_NAME_PATTERN as Jo, garbageCollectDocumentOperations as Jp, RedoActionInput as Jr, RedoActionSchema as Js, DocumentModelModuleAction as Jt, HASH_ENCODING_BASE64 as Ju, Actions as K, createNamespacedQueryBuilder as Ka, documentModelVersioningReducer as Kc, assertAuthPreservedOnDuplicate as Kd, noop as Kf, SetOperationErrorCodeAction as Ki, parseBulkArchive as Kl, DocumentIdParams as Km, MutationAddStateExampleArgs as Kn, WebhookVerification as Ko, filterDuplicatedOperations as Kp, Redo as Kr, PwaConfigSchema as Ks, DocumentModelLocalState as Kt, HASH_ALGORITHM_SHA256 as Ku, PowerhouseConfig as L, UpdateRelationshipAction as La, isDefinedNonNullAny as Lc, RemoveGrantActionInputSchema as Ld, createAction as Lf, SetModuleDescriptionAction as Li, baseLoadFromInputVersioned as Ll, createLocalState as Lm, ModuleSpecification as Ln, WebhookEndpointInfo as Lo, addUndo as Lp, PartialState as Lr, MoveOperationInputSchema as Ls, DocumentAction as Lt, base58Decode as Lu, PHRenownPrivyAdapterConfig as M, UndoRedoAction as Ma, UndoSchema as Mc, MoveGrantAction as Md, addOperationExample as Mf, SetModelExtensionInput as Mi, sign as Ml, backfillAuthState as Mm, MakeOptional as Mn, RouteOptions as Mo, IntegrityIssueSubType as Mp, OperationErrorSpecification as Mr, DocumentModelGlobalStateSchema as Ms, DeleteOperationExampleAction as Mt, AUTH_NO_GRANT_REASON as Mu, PHRenownRainbowAdapterConfig as N, UpdateChangeLogItemAction as Na, UpdateChangeLogItemInputSchema as Nc, MoveGrantActionInput as Nd, addStateExample as Nf, SetModelIdAction as Ni, validateHeader as Nl, createAuthState as Nm, Manifest as Nn, RouteSpec as No, IntegrityIssueType as Np, OperationIndex as Nr, DocumentModelInputSchema as Ns, DeleteOperationExampleInput as Nt, AUTH_VERSION_UNSUPPORTED_REASON as Nu, PHConnectRuntimeConfig as O, SubgraphModule as Oa, Set_PreferredEditorSchema as Oc, InitializeAuthAction as Od, addChangeLogItem as Of, SetInitialStateInput as Oi, createSignedHeader as Ol, PHBaseState as Om, LoadFromFile as On, RouteBody as Oo, updateChangeLogItem as Op, MutationUpdateChangeLogItemInputArgs as Or, DeleteOperationExampleInputSchema as Os, DeleteModuleInput as Ot, assertIsDocumentModelState as Ou, PackageManagerArgs as P, UpdateChangeLogItemInput as Pa, UpdateOperationExampleInputSchema as Pc, MoveGrantActionInputSchema as Pd, baseActions as Pf, SetModelIdInput as Pi, verify as Pl, createBaseState as Pm, MappedOperation as Pn, RouteTransport as Po, PHDocument as Pp, OperationSpecification as Pr, DocumentSpecificationSchema as Ps, DeleteOperationInput as Pt, DOCUMENT_DELETED_REASON as Pu, AddOperationErrorAction as Q, ExtractProcessorSchemaOrSelf as Qa, PURGE_DOCUMENT as Qc, isDocumentCreator as Qd, releaseNewVersion as Qf, SetOperationErrorTemplateAction as Qi, replayDocumentVersioned as Ql, isDerivedDocumentId as Qm, MutationDeleteStateExampleArgs as Qn, assertOperationErrorIdUnique as Qo, hashDocumentStateForScope as Qp, RemoveRelationshipAction as Qr, ReorderModulesInputSchema as Qs, DocumentModelOperationErrorOperations as Qt, documentModelInitialGlobalState as Qu, PowerhousePackage as R, UpdateRelationshipActionInput as Ra, documentModelHeaderReducer as Rc, SetGrantAction as Rd, deleteChangeLogItem as Rf, SetModuleDescriptionInput as Ri, baseSaveToFileHandle as Rl, createState as Rm, MoveOperationAction as Rn, WebhookField as Ro, appendWithoutApplying as Rp, PhAiToolAnnotations as Rr, OperationErrorSchema as Rs, DocumentModelAction as Rt, base64UrlToBytes as Ru, PHConnectPwaRuntimeCaching as S, SignatureVerificationHandler as Sa, SetOperationScopeInputSchema as Sc, AuthEvaluation as Sd, Action as Sf, serializeSignature as Sh, ScopeState as Si, mergePeerCapabilities as Sl, AuthGroups as Sm, ISignalResult as Sn, IWebhookEndpoints as So, setOperationSchema as Sp, MutationSetOperationNameArgs as Sr, CodeExampleSchema as Ss, DeleteChangeLogItemInput as St, BaseDocumentHeaderSchema as Su, PHConnectReactorFeatureFlags as T, SkipHeaderOperations as Ta, SetPreferredEditorActionSchema as Tc, AuthSubject as Td, actionFromAction as Tf, PROCESSOR_APPS as Th, SetAuthorWebsiteAction as Ti, selectProtocolVersions as Tl, Grant as Tm, InputMaybe as Tn, RouteActor as To, setPreferredEditor as Tp, MutationSetOperationTemplateArgs as Tr, DeleteChangeLogItemInputSchema as Ts, DeleteDocumentAction as Tt, DocumentModelPHStateSchema as Tu, ActionSignatureContext as U, User as Ua, documentModelReducer as Uc, applyMoveGrantAction as Ud, deleteStateExample as Uf, SetNameOperation as Ui, fetchFileBrowser as Ul, defaultLocalState as Um, MutationAddOperationArgs as Un, WebhookScheme as Uo, checkOperationsIntegrity as Up, PurgeDocumentAction as Ur, PowerhouseModuleSchema as Us, DocumentModelHeaderOperations as Ut, hashBrowser as Uu, DEFAULT_REGISTRY_URL as V, UpgradeDocumentAction as Va, documentModelOperationExampleReducer as Vc, applyAuthAction as Vd, deleteOperationError as Vf, SetNameAction as Vi, documentModelLoadFromInput as Vl, defaultDocumentState as Vm, MutationAddChangeLogItemInputArgs as Vn, WebhookReply as Vo, baseReducerVersion as Vp, PowerhouseModule as Vr, PieceModuleSchema as Vs, DocumentModelGlobalState as Vt, bytesToBase64Url as Vu, ActionSigningHandler as W, ValidationError as Wa, documentModelStateReducer as Wc, applyRemoveGrantAction as Wd, documentModelActions as Wf, SetOperationDescriptionAction as Wi, getFileBrowser as Wl, defaultPHState as Wm, MutationAddOperationErrorArgs as Wn, WebhookSignatureEncoding as Wo, diffOperations as Wp, PurgeDocumentActionInput as Wr, PowerhouseModulesSchema as Ws, DocumentModelInput as Wt, hex2ab as Wu, AddModuleInput as X, relationalDbToQueryBuilder as Xa, replayOperations as Xc, initializeAuth as Xd, operationWithContext as Xf, SetOperationErrorNameAction as Xi, VersionedReducers as Xl, SignaturePolicy$1 as Xm, MutationDeleteOperationErrorArgs as Xn, ReservedOperationName as Xo, getDocumentLastModified as Xp, ReducerOptions as Xr, ReorderChangeLogItemsInputSchema as Xs, DocumentModelOperationAction as Xt, documentModelFileExtension as Xu, AddModuleAction as Y, namespaceSchemaOf as Ya, processUndoRedo as Yc, evaluate as Yd, operationFromOperation as Yf, SetOperationErrorDescriptionInput as Yi, zipEntries as Yl, SIGNATURE_PROTOCOL_V2 as Ym, MutationDeleteOperationArgs as Yn, RESERVED_OPERATION_NAMES as Yo, garbageCollectV2 as Yp, Reducer as Yr, RedoSchema as Ys, DocumentModelModuleOperations as Yt, HASH_ENCODING_HEX as Yu, AddOperationAction as Z, DOCUMENT_ID_COLUMNS as Za, updateDocument as Zc, isAuthAction as Zd, redo as Zf, SetOperationErrorNameInput as Zi, VersionedReplayConfig as Zl, deriveDocumentId as Zm, MutationDeleteOperationExampleArgs as Zn, assertModuleIdUnique as Zo, groupOperationsByScope as Zp, ReleaseNewVersionAction as Zr, ReorderModuleOperationsInputSchema as Zs, DocumentModelOperationErrorAction as Zt, documentModelGlobalState as Zu, PHConnectPwa as _, Signal as _a, SetOperationErrorNameInputSchema as _c, isPlainValue as _d, hashActionV2 as _f, HashConfig as _h, SchemaNOOPAction as _i, isOlderManifest as _l, sortMappedOperations as _m, IAction as _n, ProcessorRecord as _o, setOperationErrorDescription as _p, MutationSetOperationDescriptionArgs as _r, AddOperationErrorInputSchema as _s, CreateDocument as _t, InvalidAuthVersionError as _u, PHConnectAi as a, SetOperationSchemaInput as aa, SetInitialStateInputSchema as ac, MAX_AUTH_GRANTS as ad, TransportActionContext as af, Operation as ah, ReorderModulesInput as ai, FeatureCapability as al, merge as am, DocumentModelUtils as an, RelationalDbProcessor as ao, setAuthorName as ap, MutationReorderOperationExamplesArgs as ar, getAllOperationNames as as, AddStateExampleAction as at, normalizeDocumentModelVersion as au, PHConnectPwaIcon as b, SignalResults as ba, SetOperationReducerInputSchema as bc, AuthAction as bd, targetDocumentId as bf, UserActionSigner as bh, SchemaSetPreferredEditorAction as bi, localSupports as bl, updateHeaderRevision as bm, IOperation as bn, AuthorizerResult as bo, setOperationName as bp, MutationSetOperationErrorNameArgs as br, AddStateExampleInputSchema as bs, CreateState as bt, groupDocumentType as bu, PHConnectDefaultDrive as c, SetOperationTemplateAction as ca, SetModelIdInputSchema as cc, MAX_CONDITION_NODES as cd, ACTION_SIGNATURE_V2_PREFIX as cf, OperationWithContext$1 as ch, ReorderOperationExamplesAction as ci, PEER_CAPABILITIES as cl, parseResultingState as cm, DocumentOperationsIgnoreMap as cn, IProcessorDispatch as co, setModelDescription as cp, MutationSetAuthorWebsiteArgs as cr, validateInitialState as cs, AssertIsStateOfType as ct, AuthAlreadyInitializedError as cu, PHConnectDriveSection as d, SetPreferredEditorActionInput as da, SetModuleNameInputSchema as dc, assertValidGrantUpsert as dd, CanonicalJsonError as df, setNameOperation as dh, ReorderStateExamplesInput as di, PeerCapabilityFlags as dl, readOnly as dm, EditorDispatch as dn, ProcessorApp as do, setModelName as dp, MutationSetModelExtensionArgs as dr, validateModules as ds, ConfigEntry as dt, DowngradeNotSupportedError as du, SetOperationNameAction as ea, ReorderOperationExamplesInputSchema as ec, AuthAdministrationLockoutError as ed, moveGrant as ef, protocolVersionsFor as eh, ReorderChangeLogItemsAction as ei, isPurgeMarker as el, isNoopOperation as em, DocumentModelOperationExampleOperations as en, IBaseRelationalDb as eo, reorderModuleOperations as ep, MutationRedoArgs as er, assertOperationIdUnique as es, AddOperationExampleAction as et, UpgradeReducer as eu, PHConnectDriveSections as f, SetPreferredEditorOperation as fa, SetNameActionInputSchema as fc, assertValidInitialGrants as fd, DOCUMENT_SCOPE_ACTION_TYPES as ff, setPreferredEditorOperation as fh, ReplayDocumentOptions as fi, PeerManifest as fl, removeExistingOperations as fm, EditorModule as fn, ProcessorApps as fo, setModuleDescription as fp, MutationSetModelIdArgs as fr, validateOperationName as fs, ConfigEntryType as ft, FileSystemError as fu, PHConnectPackages as g, Set_PreferredEditor as ga, SetOperationErrorDescriptionInputSchema as gc, grantProblem as gd, canonicalJson as gf, AppActionSigner as gh, Scalars as gi, holdReason as gl, skipHeaderOperations as gm, GetDocumentOptions as gn, ProcessorFilter as go, setOperationErrorCode as gp, MutationSetNameArgs as gr, AddModuleInputSchema as gs, CreateChildDocumentSignal as gt, InvalidActionInputZodError as gu, PHConnectOpenPanel as h, Set_Name as ha, SetOperationErrorCodeInputSchema as hc, evaluateGrants as hd, actionSigningTarget as hf, ActionSigner as hh, SaveToFileHandle as hi, coversLocal as hl, reshuffleByTimestampAndIndex as hm, FileInput as hn, ProcessorFactoryBuilder as ho, setOperationDescription as hp, MutationSetModuleNameArgs as hr, AddChangeLogItemInputSchema as hs, CreateChildDocumentInput as ht, InvalidActionInputError as hu, LogLevels as i, SetOperationSchemaAction as ia, SetAuthorWebsiteInputSchema as ic, InvalidGrantError as id, TransportAction as if, DocumentOperations as ih, ReorderModulesAction as ii, DOCUMENT_PURGE_PROTOCOL as il, mapSkippedOperationsV2 as im, DocumentModelStateOperations as in, IRelationalQueryMethods as io, reorderStateExamples as ip, MutationReorderOperationErrorsArgs as ir, findOperationOrThrow as is, AddRelationshipActionInput as it, computeUpgradeTransitions as iu, PHReactorRenown as j, UndoActionInput as ja, UndoActionSchema as jc, MAX_SUPPORTED_AUTH_VERSION as jd, addOperationError as jf, SetModelExtensionAction as ji, hasDerivedDocumentId as jl, Principal as jm, MakeMaybe as jn, RouteMethod as jo, verifyOperationSignature as jp, NOOPAction as jr, DocumentActionSchema as js, DeleteOperationErrorInput as jt, AUTH_DENIED_BY_GRANT_REASON as ju, PHConnectSentry as k, Undo as ka, StateSchema as kc, InitializeAuthActionInput as kd, addModule as kf, SetModelDescriptionAction as ki, createSignedHeaderForSigner as kl, PHDocumentState as km, LoadFromInput as kn, RouteContext as ko, updateOperationExample as kp, MutationUpdateOperationExampleArgs as kr, DeleteOperationInputSchema as ks, DeleteOperationAction as kt, isDocumentModelDocument as ku, PHConnectDefaultDriveLocal as l, SetOperationTemplateInput as la, SetModelNameInputSchema as lc, assertAuthAdministrationRetained as ld, ActionSignerIdentity as lf, operationOutcome as lh, ReorderOperationExamplesInput as li, PEER_MANIFEST_FORMAT as ll, precedes as lm, DocumentSpecification as ln, IProcessorHostModuleBase as lo, setModelExtension as lp, MutationSetInitialStateArgs as lr, validateModule as ls, Author as lt, AuthInitializerNotCreatorError as lu, PHConnectInstance as m, SetStateSchemaInput as ma, SetOperationDescriptionInputSchema as mc, evaluateGrantStack as md, actionSignerIdentity as mf, undoOperationV2 as mh, SaveToFile as mi, Supports as ml, reshuffleByTimestamp as mm, Exact as mn, ProcessorFactory as mo, setName as mp, MutationSetModuleDescriptionArgs as mr, validateStateSchemaName as ms, CopyChildDocumentSignal as mt, HashMismatchError as mu, DrivePreserveStrategy as n, SetOperationReducerAction as na, ScopeStateSchema as nc, GrantSchema as nd, resolveSnapshotAuth as nf, signaturePolicyOf as nh, ReorderModuleOperationsAction as ni, purgeMarkerOperation as nl, isUndoRedo as nm, DocumentModelPHState as nn, IRelationalDbProcessor as no, reorderOperationErrors as np, MutationReorderModuleOperationsArgs as nr, findOperationErrorOrThrow as ns, AddOperationInput as nt, applyDeleteDocumentAction as nu, PHConnectApp as o, SetOperationScopeAction as oa, SetModelDescriptionInputSchema as oc, MAX_CAPABILITY_OPERATIONS as od, TransportSigner as of, OperationContext as oh, ReorderOperationErrorsAction as oi, HoldReason as ol, nextSkipNumber as om, DocumentModelVersioningAction as on, RelationalDbProcessorClass as oo, setAuthorWebsite as op, MutationReorderStateExamplesArgs as or, isReservedOperationName as os, AddStateExampleInput as ot, withProtocolVersions as ou, PHConnectDrives as p, SetStateSchemaAction as pa, SetNameActionSchema as pc, evaluateCondition as pd, actionPreimageV2 as pf, undoOperation as ph, RevisionsFilter as pi, ProtocolCapability as pl, replayDocument as pm, EditorProps as pn, ProcessorDispatchResult as po, setModuleName as pp, MutationSetModelNameArgs as pr, validateOperations as ps, CopyChildDocumentInput as pt, GrantNotFoundError as pu, AddChangeLogItemAction as q, createRelationalDb as qa, baseReducer as qc, assertAuthScopeActionAllowed as qd, operationExampleCreators as qf, SetOperationErrorCodeInput as qi, readFileBrowser as ql, ProtocolVersions as qm, MutationDeleteChangeLogItemInputArgs as qn, deletedDocumentId as qo, garbageCollect as qp, RedoAction as qr, RedoActionInputSchema as qs, DocumentModelModule as qt, HASH_ALGORITHM_SHA512 as qu, LogLevel as r, SetOperationReducerInput as ra, SetAuthorNameInputSchema as rc, GroupPrincipalNotAllowedError as rd, setGrant as rf, v2RequiredProtocolVersions as rh, ReorderModuleOperationsInput as ri, purgedProtocolVersions as rl, mapSkippedOperations as rm, DocumentModelStateAction as rn, IRelationalQueryBuilder as ro, reorderOperationExamples as rp, MutationReorderModulesArgs as rr, findOperationExampleOrThrow as rs, AddRelationshipAction as rt, applyUpgradeDocumentAction as ru, PHConnectBranding as s, SetOperationScopeInput as sa, SetModelExtensionInputSchema as sc, MAX_CONDITION_DEPTH as sd, toTransportAction as sf, OperationOutcome as sh, ReorderOperationErrorsInput as si, MARKER_REFUSAL_FEATURE as sl, operationsAreEqual as sm, DocumentModelVersioningOperations as sn, IProcessor as so, setInitialState as sp, MutationSetAuthorNameArgs as sr, isValidOperationNameFormat as ss, AssertIsDocumentOfType as st, AuthActionNotAllowedError as su, DrivePreserveStrategies as t, SetOperationNameInput as ta, ReorderStateExamplesInputSchema as tc, AuthAdministrationMissingError as td, removeGrant as tf, requestedSignaturePolicy as th, ReorderChangeLogItemsInput as ti, purgeDocumentAction as tl, isUndo as tm, DocumentModelOperationOperations as tn, IRelationalDb as to, reorderModules as tp, MutationReorderChangeLogItemsInputArgs as tr, findModuleOrThrow as ts, AddOperationExampleInput as tt, UpgradeTransition as tu, PHConnectDefaultDriveRemote as u, SetPreferredEditorAction as ua, SetModuleDescriptionInputSchema as uc, assertValidGrant as ud, ActionSigningTarget as uf, redoOperation as uh, ReorderStateExamplesAction as ui, PeerCapability as ul, prepareOperations as um, ENSInfo as un, IProcessorManager as uo, setModelId as up, MutationSetModelDescriptionArgs as ur, validateModuleOperation as us, CodeExample as ut, AuthPolicyNotPreservedError as uu, PHConnectPwaCacheStrategy as v, SignalDispatch as va, SetOperationErrorTemplateInputSchema as vc, referencedGroupIds as vd, isV2ActionHash as vf, PHDocumentSignatureInfo as vh, SchemaRedoAction as vi, legacySupports as vl, sortOperations as vm, ID as vn, ProcessorStatus as vo, setOperationErrorName as vp, MutationSetOperationErrorCodeArgs as vr, AddOperationExampleInputSchema as vs, CreateDocumentAction as vt, UnsupportedDocumentModelVersionError as vu, PHConnectReactor as w, SkipHeaderOperationIndex as wa, SetPreferredEditorActionInputSchema as wc, AuthRequest as wd, actionContext as wf, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as wh, SetAuthorNameInput as wi, readPeerManifest as wl, Condition as wm, Incremental as wn, NodeRouteSpec as wo, setOperationTemplate as wp, MutationSetOperationSchemaArgs as wr, ConfigEntryTypeSchema as ws, DeleteChildDocumentSignal as wt, DocumentModelHeaderSchema as wu, PHConnectPwaManifest as x, SignalType as xa, SetOperationSchemaInputSchema as xc, AuthDecision as xd, v2TupleProblem as xf, deserializeSignature as xh, SchemaUndoAction as xi, manifestRevision as xl, withSignaturePolicy as xm, ISignal as xn, IHttpScope as xo, setOperationReducer as xp, MutationSetOperationErrorTemplateArgs as xr, AuthorSchema as xs, DeleteChangeLogItemAction as xt, groupMembershipActionTypes as xu, PHConnectPwaFileHandler as y, SignalResult as ya, SetOperationNameInputSchema as yc, AUTH_ACTION_TYPES as yd, signActionV2 as yf, Signature as yh, SchemaSetNameAction as yi, localPeerManifest as yl, split as ym, IDocument as yn, TrackedProcessor as yo, setOperationErrorTemplate as yp, MutationSetOperationErrorDescriptionArgs as yr, AddOperationInputSchema as ys, CreateDocumentActionInput as yt, documentModelDocumentType as yu, ServiceAction as z, UpdateStateExampleAction as za, documentModelModuleReducer as zc, SetGrantActionInput as zd, deleteModule as zf, SetModuleNameAction as zi, createMinimalZip as zl, defaultAuthState as zm, MoveOperationInput as zn, WebhookHashAlgorithm as zo, attachBranch as zp, PhAiToolDescriptor as zr, OperationScopeSchema as zs, DocumentModelDocument as zt, buildOperationSignatureMessage as zu };
|
|
3336
4357
|
export {};
|
|
3337
|
-
//# sourceMappingURL=types-
|
|
4358
|
+
//# sourceMappingURL=types-CFbd2nan.d.ts.map
|