@dbsp/adapter-pgsql 4.0.0 → 6.0.0
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/README.md +2 -2
- package/dist/chunk-NXGMFZ4E.js +57170 -0
- package/dist/chunk-NXGMFZ4E.js.map +1 -0
- package/dist/index.d.ts +183 -1245
- package/dist/index.js +791 -36999
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +144 -5
- package/dist/internal.js +37 -1
- package/dist/outcome-protocol-Dw5DYhnA.d.ts +2727 -0
- package/package.json +8 -8
- package/dist/chunk-KZ3NLIZ5.js +0 -13043
- package/dist/chunk-KZ3NLIZ5.js.map +0 -1
- package/dist/outcome-protocol-CACJDzli.d.ts +0 -1088
|
@@ -1,1088 +0,0 @@
|
|
|
1
|
-
import { TransitionRunPersister, ValidatedManagedStepManifest } from '@dbsp/core';
|
|
2
|
-
import { AdmittedDestructiveOutcomeClaim, DurablyLoadedRun } from '@dbsp/core/internal';
|
|
3
|
-
import * as _dbsp_types from '@dbsp/types';
|
|
4
|
-
import { DbCasing, DialectCapabilities, ModelIR, NormalizedManagedStep, ResourceAddress, LedgerAddress, DurableIntentRecord, TransitionRunAuthorization, TransitionRunJournal, ProvenPlanShape, LedgerHome, LedgerReservationRow, LedgerIdentity, LedgerChainMember, LedgerMarkerState, DeclarationSet, ReinitializePreflightReport, OutcomeClaimPlan, DestructiveDecision, LedgerEventKind, LedgerPayload, OutcomeVacancy, OutcomeProtocolRefusal, ClaimBundleStatement, ControllerIdentity, AdmittedOutcomeClaim, ClaimToken, OutcomeIndeterminateRecoveryEvidence, OutcomeRecoveryEffect, OutcomeRecoveryClassification, ScopedApprovalSet, OutcomeRecoveryReadBack, OutcomeClaimAdmission } from '@dbsp/types';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Schema Comparison Engine (DDL-PROV Block 1)
|
|
8
|
-
*
|
|
9
|
-
* Compares two ModelIRs (schema definition vs database state)
|
|
10
|
-
* and produces a structured diff of changes needed.
|
|
11
|
-
*
|
|
12
|
-
* @module schema-diff
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
type ChangeKind = 'create_table' | 'drop_table' | 'readdress_table' | 'add_column' | 'drop_column' | 'alter_column_type' | 'alter_column_nullable' | 'alter_column_default' | 'alter_column_unique' | 'add_primary_key' | 'drop_primary_key' | 'add_foreign_key' | 'drop_foreign_key' | 'alter_foreign_key' | 'validate_constraint' | 'create_index' | 'drop_index' | 'add_check_constraint' | 'drop_check_constraint' | 'create_enum' | 'alter_enum_add_value' | 'drop_enum' | 'alter_column_collation' | 'alter_column_identity' | 'add_comment' | 'drop_comment' | 'create_extension' | 'drop_extension' | 'create_sequence' | 'alter_sequence' | 'drop_sequence' | 'enable_rls' | 'disable_rls' | 'create_policy' | 'drop_policy';
|
|
16
|
-
interface SchemaChange {
|
|
17
|
-
readonly kind: ChangeKind;
|
|
18
|
-
readonly table: string;
|
|
19
|
-
readonly column?: string;
|
|
20
|
-
readonly destructive: boolean;
|
|
21
|
-
readonly details: string;
|
|
22
|
-
/** Additional metadata for SQL generation */
|
|
23
|
-
readonly meta?: Readonly<Record<string, unknown>>;
|
|
24
|
-
}
|
|
25
|
-
interface DiffSummary {
|
|
26
|
-
readonly tables: {
|
|
27
|
-
readonly added: number;
|
|
28
|
-
readonly dropped: number;
|
|
29
|
-
};
|
|
30
|
-
readonly columns: {
|
|
31
|
-
readonly added: number;
|
|
32
|
-
readonly dropped: number;
|
|
33
|
-
readonly altered: number;
|
|
34
|
-
};
|
|
35
|
-
readonly indexes: {
|
|
36
|
-
readonly added: number;
|
|
37
|
-
readonly dropped: number;
|
|
38
|
-
};
|
|
39
|
-
readonly constraints: {
|
|
40
|
-
readonly added: number;
|
|
41
|
-
readonly dropped: number;
|
|
42
|
-
readonly altered: number;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
interface SchemaDiff {
|
|
46
|
-
readonly changes: readonly SchemaChange[];
|
|
47
|
-
readonly hasDestructive: boolean;
|
|
48
|
-
readonly summary: DiffSummary;
|
|
49
|
-
}
|
|
50
|
-
interface CompareSchemataOptions {
|
|
51
|
-
/**
|
|
52
|
-
* Database naming convention.
|
|
53
|
-
* When set, schema model names (camelCase) are converted to DB format
|
|
54
|
-
* (e.g. snake_case) before comparison with the introspected model.
|
|
55
|
-
*/
|
|
56
|
-
dbCasing?: DbCasing;
|
|
57
|
-
/** Dialect capabilities — comparisons for unsupported features will be skipped */
|
|
58
|
-
readonly dialectCapabilities?: DialectCapabilities;
|
|
59
|
-
/**
|
|
60
|
-
* When `true`, extensions present in the live DB but absent from the model
|
|
61
|
-
* schema are silently ignored — no `drop_extension` change is emitted for them.
|
|
62
|
-
* Only extensions explicitly declared in the model are managed (created if missing).
|
|
63
|
-
*
|
|
64
|
-
* Use this when the database image pre-installs extensions that the application
|
|
65
|
-
* schema does not own (e.g. pgvector, pg_search bundled in a custom Postgres image).
|
|
66
|
-
* Default: `false` (full-sync behaviour — unmanaged DB extensions produce a
|
|
67
|
-
* `drop_extension` entry).
|
|
68
|
-
*/
|
|
69
|
-
readonly ignoreUnmanagedExtensions?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Strict compile-only mode for callers that require convergence guarantees.
|
|
72
|
-
*
|
|
73
|
-
* `compareSchemata()` is intentionally pure and cannot ask PostgreSQL to
|
|
74
|
-
* canonicalise raw-SQL expression surfaces. By default it keeps the historic
|
|
75
|
-
* best-effort verbatim comparison for column defaults, CHECK expressions,
|
|
76
|
-
* partial-index predicates, and index expressions. Set this flag to throw when either model
|
|
77
|
-
* contains one of those surfaces so a caller cannot accidentally rely on a
|
|
78
|
-
* compile-only diff for a convergence-sensitive check.
|
|
79
|
-
*
|
|
80
|
-
* Live PostgreSQL callers should use `comparePgsqlDatabaseSchema()`, which
|
|
81
|
-
* canonicalises CHECK constraint expressions, column defaults, and partial-index predicates before calling this function.
|
|
82
|
-
* Under that live mode, each side is canonicalised independently; rejected
|
|
83
|
-
* predicates refuse the migration and infrastructure fallback uses both raw
|
|
84
|
-
* models. This does not prove
|
|
85
|
-
* that the resulting migration is executable.
|
|
86
|
-
* Index expressions are not canonicalised by the live helper and are rejected
|
|
87
|
-
* there when this strict flag is set.
|
|
88
|
-
*/
|
|
89
|
-
readonly requireExpressionCanonicalization?: boolean;
|
|
90
|
-
}
|
|
91
|
-
declare class ExpressionCanonicalizationUnavailableError extends Error {
|
|
92
|
-
readonly surfaces: readonly string[];
|
|
93
|
-
constructor(surfaces: readonly string[]);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Compare two ModelIRs and produce a structured diff.
|
|
97
|
-
*
|
|
98
|
-
* @param schema - The desired schema (from definition)
|
|
99
|
-
* @param db - The current database state (from introspection)
|
|
100
|
-
* @param options - Optional comparison settings (e.g. dbCasing)
|
|
101
|
-
* @returns SchemaDiff with all changes needed to bring DB in sync with schema
|
|
102
|
-
*/
|
|
103
|
-
declare function compareSchemata(schema: ModelIR, db: ModelIR, options?: CompareSchemataOptions): SchemaDiff;
|
|
104
|
-
|
|
105
|
-
type GeneratedConstraintPostcondition = {
|
|
106
|
-
readonly type: 'p' | 'u';
|
|
107
|
-
readonly columns: readonly string[];
|
|
108
|
-
readonly deferrable: boolean;
|
|
109
|
-
readonly initiallyDeferred: boolean;
|
|
110
|
-
readonly enforced: boolean;
|
|
111
|
-
} | {
|
|
112
|
-
readonly type: 'f';
|
|
113
|
-
readonly columns: readonly string[];
|
|
114
|
-
readonly references: {
|
|
115
|
-
readonly schema: string;
|
|
116
|
-
readonly table: string;
|
|
117
|
-
readonly columns: readonly string[];
|
|
118
|
-
};
|
|
119
|
-
readonly onDelete: GeneratedForeignKeyAction;
|
|
120
|
-
readonly onUpdate: GeneratedForeignKeyAction;
|
|
121
|
-
readonly deferrable: boolean;
|
|
122
|
-
readonly initiallyDeferred: boolean;
|
|
123
|
-
readonly enforced: boolean;
|
|
124
|
-
readonly notValid: boolean;
|
|
125
|
-
} | {
|
|
126
|
-
readonly type: 'c';
|
|
127
|
-
/** The ModelIR CHECK expression, never a rendered constraint definition. */
|
|
128
|
-
readonly expression: string;
|
|
129
|
-
readonly notValid: boolean;
|
|
130
|
-
};
|
|
131
|
-
/** The semantic FK actions PostgreSQL can represent in pg_constraint. */
|
|
132
|
-
type GeneratedForeignKeyAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
133
|
-
type GeneratedIndexPostcondition = {
|
|
134
|
-
/** The identity is persisted separately from the rendered CREATE INDEX SQL. */
|
|
135
|
-
readonly schema: string;
|
|
136
|
-
readonly table: string;
|
|
137
|
-
readonly name: string;
|
|
138
|
-
/** PostgreSQL exposes an omitted method as btree; make that expectation explicit. */
|
|
139
|
-
readonly method: string;
|
|
140
|
-
readonly unique: boolean;
|
|
141
|
-
readonly valid: true;
|
|
142
|
-
readonly ready: true;
|
|
143
|
-
readonly live: true;
|
|
144
|
-
readonly columns: readonly string[];
|
|
145
|
-
readonly expressions?: readonly string[];
|
|
146
|
-
readonly include?: readonly string[];
|
|
147
|
-
readonly nullsNotDistinct: boolean;
|
|
148
|
-
readonly opclass?: Readonly<Record<string, string>>;
|
|
149
|
-
readonly with?: Readonly<Record<string, string>>;
|
|
150
|
-
readonly where?: string;
|
|
151
|
-
};
|
|
152
|
-
/** A canonical SQL fact, never an unversioned deparse string. */
|
|
153
|
-
type CanonicalSqlFact = {
|
|
154
|
-
readonly canonicalFormVersion: 1;
|
|
155
|
-
readonly sql: string;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* The default, identity, and expression facts are one discriminated state.
|
|
159
|
-
* In particular, an identity cannot also claim an authored/default sequence
|
|
160
|
-
* expression, and a missing default cannot carry an expression.
|
|
161
|
-
*/
|
|
162
|
-
type GeneratedColumnDefaultState = {
|
|
163
|
-
readonly defaultKind: 'none';
|
|
164
|
-
readonly hasDefault: false;
|
|
165
|
-
readonly identity: null;
|
|
166
|
-
readonly defaultExpression?: never;
|
|
167
|
-
} | {
|
|
168
|
-
readonly defaultKind: 'authored';
|
|
169
|
-
readonly hasDefault: true;
|
|
170
|
-
readonly identity: null;
|
|
171
|
-
readonly defaultExpression: CanonicalSqlFact;
|
|
172
|
-
} | {
|
|
173
|
-
readonly defaultKind: 'generated-sequence';
|
|
174
|
-
readonly hasDefault: true;
|
|
175
|
-
readonly identity: null;
|
|
176
|
-
readonly defaultExpression?: never;
|
|
177
|
-
} | {
|
|
178
|
-
readonly defaultKind: 'identity';
|
|
179
|
-
readonly hasDefault: false;
|
|
180
|
-
readonly identity: 'always' | 'byDefault';
|
|
181
|
-
readonly defaultExpression?: never;
|
|
182
|
-
};
|
|
183
|
-
type GeneratedColumnDeclaration = {
|
|
184
|
-
readonly type?: string;
|
|
185
|
-
readonly nullable?: boolean;
|
|
186
|
-
/** null means no COLLATE clause was authored; it is not an effective default. */
|
|
187
|
-
readonly authoredCollation?: string | null;
|
|
188
|
-
readonly default?: GeneratedColumnDefaultState;
|
|
189
|
-
};
|
|
190
|
-
type GeneratedTableColumnDeclaration = GeneratedColumnDeclaration & {
|
|
191
|
-
/** A table-shape member name, not the table target binding. */
|
|
192
|
-
readonly name: string;
|
|
193
|
-
};
|
|
194
|
-
type GeneratedIndexDeclaration = Omit<GeneratedIndexPostcondition, 'schema' | 'table' | 'name' | 'expressions' | 'where'> & {
|
|
195
|
-
readonly expressions?: readonly CanonicalSqlFact[];
|
|
196
|
-
readonly where?: CanonicalSqlFact;
|
|
197
|
-
};
|
|
198
|
-
type GeneratedConstraintDeclaration = Extract<GeneratedConstraintPostcondition, {
|
|
199
|
-
readonly type: 'p' | 'u';
|
|
200
|
-
}> | Extract<GeneratedConstraintPostcondition, {
|
|
201
|
-
readonly type: 'f';
|
|
202
|
-
}>;
|
|
203
|
-
/** Table names live only in TargetBinding; columns describe table structure. */
|
|
204
|
-
type V3TableDeclaration = {
|
|
205
|
-
readonly kind: 'table';
|
|
206
|
-
readonly columns: readonly GeneratedTableColumnDeclaration[];
|
|
207
|
-
};
|
|
208
|
-
/** Column names live only in TargetBinding; this is the column's shape. */
|
|
209
|
-
type V3ColumnDeclaration = {
|
|
210
|
-
readonly kind: 'column';
|
|
211
|
-
readonly column: GeneratedColumnDeclaration;
|
|
212
|
-
};
|
|
213
|
-
/** Constraint names live only in TargetBinding; this is a non-CHECK constraint fact. */
|
|
214
|
-
type V3ConstraintDeclaration = {
|
|
215
|
-
readonly kind: 'constraint';
|
|
216
|
-
readonly constraint: GeneratedConstraintDeclaration;
|
|
217
|
-
};
|
|
218
|
-
/** CHECK names live only in TargetBinding; expression is canonical and versioned. */
|
|
219
|
-
type V3CheckDeclaration = {
|
|
220
|
-
readonly kind: 'check';
|
|
221
|
-
readonly check: {
|
|
222
|
-
readonly expression: CanonicalSqlFact;
|
|
223
|
-
readonly notValid: boolean;
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
/** Index schema, table, and name live only in TargetBinding; options are structured facts. */
|
|
227
|
-
type V3IndexDeclaration = {
|
|
228
|
-
readonly kind: 'index';
|
|
229
|
-
readonly index: GeneratedIndexDeclaration;
|
|
230
|
-
};
|
|
231
|
-
/** Enum names live only in TargetBinding; labels are the declaration. */
|
|
232
|
-
type V3EnumDeclaration = {
|
|
233
|
-
readonly kind: 'enum';
|
|
234
|
-
readonly labels: readonly string[];
|
|
235
|
-
};
|
|
236
|
-
/** Sequence names live only in TargetBinding; options are the declaration. */
|
|
237
|
-
type V3SequenceDeclaration = {
|
|
238
|
-
readonly kind: 'sequence';
|
|
239
|
-
readonly startValue?: string;
|
|
240
|
-
readonly incrementBy?: string;
|
|
241
|
-
readonly minValue?: string;
|
|
242
|
-
readonly maxValue?: string;
|
|
243
|
-
readonly cycle?: boolean;
|
|
244
|
-
};
|
|
245
|
-
/** Extension names live only in TargetBinding; requested version is the declaration. */
|
|
246
|
-
type V3ExtensionDeclaration = {
|
|
247
|
-
readonly kind: 'extension';
|
|
248
|
-
readonly version?: string;
|
|
249
|
-
};
|
|
250
|
-
/** Address-free v3 declaration variants. */
|
|
251
|
-
type GeneratedPostconditionDeclarationV3 = {
|
|
252
|
-
readonly canonicalFormVersion: 1;
|
|
253
|
-
} & (V3TableDeclaration | V3ColumnDeclaration | V3ConstraintDeclaration | V3CheckDeclaration | V3IndexDeclaration | V3EnumDeclaration | V3SequenceDeclaration | V3ExtensionDeclaration | {
|
|
254
|
-
readonly kind: 'absent';
|
|
255
|
-
});
|
|
256
|
-
/**
|
|
257
|
-
* The separate binding selects the surrounding managed step's canonical
|
|
258
|
-
* address. It is versioned independently so later verifiers can resolve it
|
|
259
|
-
* without teaching any declaration variant about physical addresses.
|
|
260
|
-
*/
|
|
261
|
-
type TargetBinding = {
|
|
262
|
-
readonly bindingVersion: 1;
|
|
263
|
-
readonly bindingKind: 'managed-step-address';
|
|
264
|
-
};
|
|
265
|
-
/** Version 3 carries an address-free declaration and a separately decoded binding. */
|
|
266
|
-
type GeneratedPostconditionV3 = {
|
|
267
|
-
readonly postconditionVersion: 3;
|
|
268
|
-
/** v3 kind lives only in the address-free declaration, never beside the binding. */
|
|
269
|
-
readonly kind?: never;
|
|
270
|
-
readonly declaration: GeneratedPostconditionDeclarationV3;
|
|
271
|
-
readonly targetBinding: TargetBinding;
|
|
272
|
-
};
|
|
273
|
-
/** Only v3 is a decodable generated postcondition. Older values replan. */
|
|
274
|
-
type GeneratedPostcondition = GeneratedPostconditionV3;
|
|
275
|
-
/** The version tag is part of the digest domain, never an implicit convention. */
|
|
276
|
-
declare function generatedPostconditionDigest(value: {
|
|
277
|
-
readonly postconditionVersion: number;
|
|
278
|
-
}): string;
|
|
279
|
-
declare function generatedPostconditionForChange(input: {
|
|
280
|
-
readonly change: SchemaChange;
|
|
281
|
-
readonly schema: string;
|
|
282
|
-
}): _dbsp_types.LedgerPayload | undefined;
|
|
283
|
-
/**
|
|
284
|
-
* The only change-kind boundary between diagnostic schema diffing and managed
|
|
285
|
-
* execution. Keep it at manifest construction: diagnostic-only controls must
|
|
286
|
-
* never acquire an address, claim, reservation, or DDL bundle.
|
|
287
|
-
*/
|
|
288
|
-
declare function assertDeclarableChangeKind(kind: ChangeKind): asserts kind is Exclude<ChangeKind, 'enable_rls' | 'disable_rls' | 'create_policy' | 'drop_policy' | 'add_comment' | 'drop_comment'>;
|
|
289
|
-
/**
|
|
290
|
-
* PostgreSQL's total ChangeKind-to-address producer. The mapping is run at
|
|
291
|
-
* plan time, so no executable generator step can later fall through to a
|
|
292
|
-
* permissive "no managed address" branch.
|
|
293
|
-
*/
|
|
294
|
-
declare function createPgsqlGeneratedManagedStep(input: {
|
|
295
|
-
readonly change: SchemaChange;
|
|
296
|
-
readonly database: string;
|
|
297
|
-
readonly schema: string;
|
|
298
|
-
readonly stepKey: string;
|
|
299
|
-
readonly order: number;
|
|
300
|
-
readonly dependencyOrder?: readonly string[];
|
|
301
|
-
readonly statements: readonly string[];
|
|
302
|
-
}): NormalizedManagedStep;
|
|
303
|
-
|
|
304
|
-
type GeneratedPostconditionQuery = {
|
|
305
|
-
query(sql: string, params?: readonly unknown[]): Promise<{
|
|
306
|
-
readonly rows: readonly Record<string, unknown>[];
|
|
307
|
-
}>;
|
|
308
|
-
};
|
|
309
|
-
declare const generatedPostconditionSessionBrand: unique symbol;
|
|
310
|
-
/** An adapter-minted, exclusive PostgreSQL session for rollback-only proof. */
|
|
311
|
-
type GeneratedPostconditionSession = GeneratedPostconditionQuery & {
|
|
312
|
-
readonly [generatedPostconditionSessionBrand]: true;
|
|
313
|
-
};
|
|
314
|
-
/** A retained session capability was used after its owning bracket ended. */
|
|
315
|
-
declare class GeneratedPostconditionSessionDeactivatedError extends Error {
|
|
316
|
-
constructor();
|
|
317
|
-
}
|
|
318
|
-
/** A caller attempted to overlap rollback-only proofs on one capability. */
|
|
319
|
-
declare class GeneratedPostconditionProofInFlightError extends Error {
|
|
320
|
-
constructor();
|
|
321
|
-
}
|
|
322
|
-
/** A session bracket completed while rollback-only proof work was still running. */
|
|
323
|
-
declare class GeneratedPostconditionWorkInFlightError extends Error {
|
|
324
|
-
constructor();
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Public verifier checkout bracket. Scratch-backed proofs require the active
|
|
328
|
-
* role to hold database TEMP privilege; callers must preflight that capability
|
|
329
|
-
* before applying managed DDL whose postcondition needs scratch staging.
|
|
330
|
-
*/
|
|
331
|
-
declare function withGeneratedPostconditionSession<T>(executor: {
|
|
332
|
-
connect(): Promise<GeneratedPostconditionQuery & {
|
|
333
|
-
release(error?: unknown): void | Promise<void>;
|
|
334
|
-
}>;
|
|
335
|
-
}, work: (session: GeneratedPostconditionSession) => Promise<T>, lockTimeoutMs?: number): Promise<T>;
|
|
336
|
-
type ResolvableGeneratedPostconditionKind = 'table' | 'column' | 'constraint';
|
|
337
|
-
type GeneratedPostconditionBindingKind = ResolvableGeneratedPostconditionKind | 'index' | 'enum' | 'sequence' | 'extension';
|
|
338
|
-
type GeneratedPostconditionSchemaBindingKind = Exclude<GeneratedPostconditionBindingKind, 'extension'>;
|
|
339
|
-
type GeneratedPostconditionTableChildKind = 'column' | 'index' | 'constraint';
|
|
340
|
-
/** The canonical schema-scoped table parent of a managed table child. */
|
|
341
|
-
type GeneratedPostconditionTableParent = {
|
|
342
|
-
readonly scope: 'schema';
|
|
343
|
-
readonly engine: string;
|
|
344
|
-
readonly database: string;
|
|
345
|
-
readonly schema: string;
|
|
346
|
-
readonly kind: 'table';
|
|
347
|
-
readonly name: string;
|
|
348
|
-
readonly parent?: never;
|
|
349
|
-
readonly catalogueIdentity?: never;
|
|
350
|
-
readonly qualifiedBy?: never;
|
|
351
|
-
};
|
|
352
|
-
type GeneratedPostconditionSchemaRootAddress<K extends Exclude<GeneratedPostconditionSchemaBindingKind, GeneratedPostconditionTableChildKind>> = Omit<ResourceAddress, 'engine' | 'schema' | 'parent' | 'kind'> & {
|
|
353
|
-
readonly engine: string;
|
|
354
|
-
readonly scope: 'schema';
|
|
355
|
-
readonly schema: string;
|
|
356
|
-
readonly parent?: never;
|
|
357
|
-
readonly kind: K;
|
|
358
|
-
};
|
|
359
|
-
type GeneratedPostconditionTableChildAddress<K extends GeneratedPostconditionTableChildKind> = Omit<ResourceAddress, 'engine' | 'schema' | 'parent' | 'kind'> & {
|
|
360
|
-
readonly engine: string;
|
|
361
|
-
readonly scope: 'schema';
|
|
362
|
-
readonly schema: string;
|
|
363
|
-
readonly parent: GeneratedPostconditionTableParent;
|
|
364
|
-
readonly kind: K;
|
|
365
|
-
};
|
|
366
|
-
type GeneratedPostconditionExtensionAddress = Omit<ResourceAddress, 'engine' | 'schema' | 'parent' | 'kind'> & {
|
|
367
|
-
readonly engine: string;
|
|
368
|
-
readonly scope: 'database';
|
|
369
|
-
readonly schema?: never;
|
|
370
|
-
readonly parent?: never;
|
|
371
|
-
readonly kind: 'extension';
|
|
372
|
-
};
|
|
373
|
-
/** The complete topology selected by a v3 managed-step binding. */
|
|
374
|
-
type GeneratedPostconditionBindingAddress = GeneratedPostconditionSchemaRootAddress<'table' | 'enum' | 'sequence'> | GeneratedPostconditionTableChildAddress<GeneratedPostconditionTableChildKind> | GeneratedPostconditionExtensionAddress;
|
|
375
|
-
declare class GeneratedPostconditionBindingResolutionError extends Error {
|
|
376
|
-
readonly sought: string;
|
|
377
|
-
readonly found: string;
|
|
378
|
-
constructor(input: {
|
|
379
|
-
readonly sought: string;
|
|
380
|
-
readonly found: string;
|
|
381
|
-
}, options?: ErrorOptions);
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Narrows a ledger address into the complete topology that a v3 verifier can
|
|
385
|
-
* bind. Ledger addresses are intentionally broader, so this boundary must
|
|
386
|
-
* reject malformed persisted input before it reaches any verifier dispatch.
|
|
387
|
-
*/
|
|
388
|
-
declare function toGeneratedPostconditionBindingAddress(address: LedgerAddress): GeneratedPostconditionBindingAddress;
|
|
389
|
-
type IndexProjection = {
|
|
390
|
-
readonly schema: string;
|
|
391
|
-
readonly table: string;
|
|
392
|
-
readonly name: string;
|
|
393
|
-
readonly method: string;
|
|
394
|
-
readonly unique: boolean;
|
|
395
|
-
readonly valid: boolean;
|
|
396
|
-
readonly ready: boolean;
|
|
397
|
-
readonly live: boolean;
|
|
398
|
-
readonly nullsNotDistinct: boolean;
|
|
399
|
-
readonly primary: boolean;
|
|
400
|
-
readonly exclusion: boolean;
|
|
401
|
-
readonly immediate: boolean;
|
|
402
|
-
readonly constraintOwned: boolean;
|
|
403
|
-
readonly keyColumns: readonly (string | null)[];
|
|
404
|
-
readonly keyDefinitions: readonly string[];
|
|
405
|
-
readonly includeColumns: readonly string[];
|
|
406
|
-
readonly opclasses: readonly string[];
|
|
407
|
-
readonly keyOptions: readonly string[];
|
|
408
|
-
readonly reloptions: readonly string[];
|
|
409
|
-
readonly predicate: string | null;
|
|
410
|
-
};
|
|
411
|
-
type CheckProjection = {
|
|
412
|
-
readonly expression: string;
|
|
413
|
-
readonly validated: boolean;
|
|
414
|
-
readonly noInherit: boolean;
|
|
415
|
-
readonly enforced: boolean;
|
|
416
|
-
readonly isLocal: boolean;
|
|
417
|
-
readonly inheritanceCount: number;
|
|
418
|
-
readonly parentId: number;
|
|
419
|
-
};
|
|
420
|
-
type TableColumnProjection = {
|
|
421
|
-
readonly name: string;
|
|
422
|
-
readonly type: string;
|
|
423
|
-
readonly nullable: boolean;
|
|
424
|
-
readonly default: string | undefined;
|
|
425
|
-
/** Ownership and canonical nextval shape read in the same catalogue snapshot. */
|
|
426
|
-
readonly generatedSequenceDefault: boolean;
|
|
427
|
-
readonly collation: string | null;
|
|
428
|
-
readonly identity: 'always' | 'byDefault' | null;
|
|
429
|
-
};
|
|
430
|
-
type TableProjection = {
|
|
431
|
-
readonly columns: readonly TableColumnProjection[];
|
|
432
|
-
};
|
|
433
|
-
type GeneratedColumnProjection = Omit<TableColumnProjection, 'name'>;
|
|
434
|
-
declare class GeneratedPostconditionReplanRequiredError extends Error {
|
|
435
|
-
readonly code = "REPLAN_REQUIRED";
|
|
436
|
-
readonly diagnostic: Readonly<{
|
|
437
|
-
versionSeen: unknown;
|
|
438
|
-
stepIdentity: string | undefined;
|
|
439
|
-
structuralPath: string | undefined;
|
|
440
|
-
}>;
|
|
441
|
-
readonly structuralPath: string | undefined;
|
|
442
|
-
constructor(message: string, versionSeen?: unknown, stepIdentity?: string | undefined, options?: ErrorOptions, structuralPath?: string | undefined);
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Decode exactly one postcondition interpretation per version: only v3 is
|
|
446
|
-
* accepted. v1/v2 and every other value are named REPLAN_REQUIRED outcomes.
|
|
447
|
-
*/
|
|
448
|
-
declare function decodeGeneratedPostcondition(value: unknown, stepIdentity?: string): GeneratedPostcondition;
|
|
449
|
-
/**
|
|
450
|
-
* The persisted digest is bound to the versioned wire value before decoding.
|
|
451
|
-
* A digest minted for one version cannot authenticate another version body.
|
|
452
|
-
*/
|
|
453
|
-
declare function decodeGeneratedPostconditionPayload(payload: {
|
|
454
|
-
readonly value: unknown;
|
|
455
|
-
readonly digest: string;
|
|
456
|
-
}, stepIdentity?: string): GeneratedPostcondition;
|
|
457
|
-
/** Refuse structural lookalikes before any proof or catalogue read. */
|
|
458
|
-
declare function assertGeneratedPostconditionSession(value: unknown): GeneratedPostconditionSession;
|
|
459
|
-
type GeneratedPostconditionCatalogueIdentity = NonNullable<ResourceAddress['catalogueIdentity']>;
|
|
460
|
-
/** Resolves the v3 table binding, then delegates its shared structural proof. */
|
|
461
|
-
declare function verifyGeneratedTablePostcondition(input: {
|
|
462
|
-
readonly session: GeneratedPostconditionSession;
|
|
463
|
-
readonly postcondition: unknown;
|
|
464
|
-
readonly address: GeneratedPostconditionBindingAddress;
|
|
465
|
-
}): Promise<{
|
|
466
|
-
readonly kind: 'table';
|
|
467
|
-
readonly projection: TableProjection;
|
|
468
|
-
readonly catalogueIdentity: GeneratedPostconditionCatalogueIdentity;
|
|
469
|
-
}>;
|
|
470
|
-
/** Resolves the v3 column binding, then delegates its shared structural proof. */
|
|
471
|
-
declare function verifyGeneratedColumnPostcondition(input: {
|
|
472
|
-
readonly session: GeneratedPostconditionSession;
|
|
473
|
-
readonly postcondition: unknown;
|
|
474
|
-
readonly address: GeneratedPostconditionBindingAddress;
|
|
475
|
-
}): Promise<{
|
|
476
|
-
readonly kind: 'column';
|
|
477
|
-
readonly projection: GeneratedColumnProjection;
|
|
478
|
-
readonly catalogueIdentity: GeneratedPostconditionCatalogueIdentity;
|
|
479
|
-
}>;
|
|
480
|
-
/** Resolves the v3 index binding, then delegates its shared structural proof. */
|
|
481
|
-
declare function verifyGeneratedIndexPostcondition(input: {
|
|
482
|
-
readonly session: GeneratedPostconditionSession;
|
|
483
|
-
readonly postcondition: unknown;
|
|
484
|
-
readonly address: GeneratedPostconditionBindingAddress;
|
|
485
|
-
}): Promise<{
|
|
486
|
-
readonly kind: 'index';
|
|
487
|
-
readonly projection: IndexProjection;
|
|
488
|
-
readonly catalogueIdentity: GeneratedPostconditionCatalogueIdentity;
|
|
489
|
-
}>;
|
|
490
|
-
/** Resolves the v3 CHECK binding, then delegates its shared structural proof. */
|
|
491
|
-
declare function verifyGeneratedCheckPostcondition(input: {
|
|
492
|
-
readonly session: GeneratedPostconditionSession;
|
|
493
|
-
readonly postcondition: unknown;
|
|
494
|
-
readonly address: GeneratedPostconditionBindingAddress;
|
|
495
|
-
}): Promise<{
|
|
496
|
-
readonly kind: 'constraint';
|
|
497
|
-
readonly projection: CheckProjection;
|
|
498
|
-
readonly catalogueIdentity: GeneratedPostconditionCatalogueIdentity;
|
|
499
|
-
}>;
|
|
500
|
-
/**
|
|
501
|
-
* Binds the deliberately non-structural v3 kinds under the same rollback-only
|
|
502
|
-
* proof bracket as structural verifiers. The declaration kind is the binding
|
|
503
|
-
* expectation, so a sequence slot can never observe an enum declaration (or
|
|
504
|
-
* vice versa) merely because the address happens to resolve.
|
|
505
|
-
*/
|
|
506
|
-
declare function verifyGeneratedIdentityPostcondition(input: {
|
|
507
|
-
readonly session: GeneratedPostconditionSession;
|
|
508
|
-
readonly postcondition: unknown;
|
|
509
|
-
readonly address: GeneratedPostconditionBindingAddress;
|
|
510
|
-
readonly kind: 'constraint' | 'enum' | 'sequence' | 'extension';
|
|
511
|
-
}): Promise<{
|
|
512
|
-
readonly kind: 'constraint' | 'enum' | 'sequence' | 'extension';
|
|
513
|
-
readonly identity: Readonly<{
|
|
514
|
-
readonly relationOid: string;
|
|
515
|
-
readonly objectOid?: string;
|
|
516
|
-
}>;
|
|
517
|
-
readonly catalogueIdentity: GeneratedPostconditionCatalogueIdentity;
|
|
518
|
-
}>;
|
|
519
|
-
|
|
520
|
-
type QueryResultLike = {
|
|
521
|
-
readonly rows: readonly Record<string, unknown>[];
|
|
522
|
-
};
|
|
523
|
-
type TransitionJournalQueryable = {
|
|
524
|
-
query(sql: string, params?: readonly unknown[]): Promise<QueryResultLike>;
|
|
525
|
-
};
|
|
526
|
-
/** A copied plan row is not authority for a differently named run. */
|
|
527
|
-
declare class TransitionRunIdentityMismatchError extends Error {
|
|
528
|
-
constructor();
|
|
529
|
-
}
|
|
530
|
-
declare function renderCreateDbspMetaSchemaSql(): string;
|
|
531
|
-
declare function renderCreateTransitionRunTableSql(): string;
|
|
532
|
-
declare function renderCreateTransitionJournalTableSql(): string;
|
|
533
|
-
declare function renderCreateTransitionRunPlanTableSql(): string;
|
|
534
|
-
declare function renderCreateTransitionAuthorizationTableSql(): string;
|
|
535
|
-
declare function ensureTransitionJournal(executor: TransitionJournalQueryable): Promise<void>;
|
|
536
|
-
declare function createPgTransitionRunPersister(executor: TransitionJournalQueryable): TransitionRunPersister;
|
|
537
|
-
declare function appendIntentJournal(executor: TransitionJournalQueryable, record: DurableIntentRecord): Promise<void>;
|
|
538
|
-
/** Append-only run approval, intentionally separate from step attempts. */
|
|
539
|
-
declare function appendTransitionAuthorization(executor: TransitionJournalQueryable, record: TransitionRunAuthorization): Promise<void>;
|
|
540
|
-
declare function readTransitionJournal(executor: TransitionJournalQueryable, runId: string, options?: {
|
|
541
|
-
readonly ensure?: boolean;
|
|
542
|
-
}): Promise<TransitionRunJournal & {
|
|
543
|
-
readonly plan: ProvenPlanShape;
|
|
544
|
-
}>;
|
|
545
|
-
|
|
546
|
-
interface PgCatalogueIdentityQueryable {
|
|
547
|
-
query(sql: string, params?: readonly unknown[]): Promise<{
|
|
548
|
-
readonly rows: readonly Record<string, unknown>[];
|
|
549
|
-
}>;
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* Re-read the PostgreSQL catalogue identity for one managed address. The
|
|
553
|
-
* adapter deliberately returns absence as undefined; callers decide whether an
|
|
554
|
-
* absent object is legal for the lifecycle state they are admitting.
|
|
555
|
-
*/
|
|
556
|
-
declare function readPgCatalogueIdentity(executor: PgCatalogueIdentityQueryable, address: ResourceAddress): Promise<ResourceAddress | undefined>;
|
|
557
|
-
|
|
558
|
-
declare const PG_LEDGER_SHAPE_VERSION = 1;
|
|
559
|
-
declare const ledgerShapeAllowanceBrand: unique symbol;
|
|
560
|
-
/**
|
|
561
|
-
* An in-process allowance for one non-ledger trigger observed immediately
|
|
562
|
-
* after trusted harness setup. Its contents are deliberately not structural:
|
|
563
|
-
* only the internal factory can register a value in the WeakSet below.
|
|
564
|
-
*/
|
|
565
|
-
interface PgLedgerShapeAllowance {
|
|
566
|
-
readonly [ledgerShapeAllowanceBrand]: 'dbsp-ledger-shape-allowance';
|
|
567
|
-
}
|
|
568
|
-
type PgLedgerPhysicalShapeOutcome = {
|
|
569
|
-
readonly kind: 'verified';
|
|
570
|
-
} | {
|
|
571
|
-
readonly kind: 'shape-wrong';
|
|
572
|
-
readonly artefact: string;
|
|
573
|
-
} | {
|
|
574
|
-
readonly kind: 'unverifiable';
|
|
575
|
-
readonly cause: string;
|
|
576
|
-
} | {
|
|
577
|
-
readonly kind: 'unsupported-major';
|
|
578
|
-
readonly major: number | undefined;
|
|
579
|
-
} | {
|
|
580
|
-
readonly kind: 'validator-abi-failure';
|
|
581
|
-
readonly sqlstate: string;
|
|
582
|
-
};
|
|
583
|
-
/**
|
|
584
|
-
* Read-only admission of an existing ledger. A fixture is deliberately a
|
|
585
|
-
* prerequisite: deparse text is not portable across PostgreSQL majors.
|
|
586
|
-
*/
|
|
587
|
-
declare function classifyPgLedgerPhysicalShape(executor: TransitionJournalQueryable, target: PgLedgerTarget, allowance?: PgLedgerShapeAllowance): Promise<PgLedgerPhysicalShapeOutcome>;
|
|
588
|
-
/**
|
|
589
|
-
* Throwing compatibility façade. Existing mutating callers intentionally keep
|
|
590
|
-
* their historical contract; outcome-aware consumers use `classify…`.
|
|
591
|
-
*/
|
|
592
|
-
declare function validatePgLedgerPhysicalShape(executor: TransitionJournalQueryable, target: PgLedgerTarget, allowance?: PgLedgerShapeAllowance): Promise<void>;
|
|
593
|
-
/**
|
|
594
|
-
* Mint a one-request allowance for one exact live trigger. This is exported
|
|
595
|
-
* only from the adapter's `/internal` surface: consumers cannot forge the
|
|
596
|
-
* WeakMap registration or serialize it into an ordinary recovery request.
|
|
597
|
-
*/
|
|
598
|
-
declare function createPgLedgerShapeAllowance(executor: TransitionJournalQueryable, target: PgLedgerTarget, triggerName: string): Promise<PgLedgerShapeAllowance>;
|
|
599
|
-
declare class PgLedgerStorageUnsupportedError extends Error {
|
|
600
|
-
constructor(observed: unknown);
|
|
601
|
-
}
|
|
602
|
-
declare const pgOrderedLedgerLocksBrand: unique symbol;
|
|
603
|
-
/** Proof returned only after this transaction acquired every home in order. */
|
|
604
|
-
interface PgOrderedLedgerLocks {
|
|
605
|
-
readonly homes: readonly PgLedgerTarget[];
|
|
606
|
-
readonly [pgOrderedLedgerLocksBrand]: 'dbsp-pg-ordered-ledger-locks';
|
|
607
|
-
}
|
|
608
|
-
type PgLedgerLockResult = {
|
|
609
|
-
readonly kind: 'acquired';
|
|
610
|
-
readonly proof: PgOrderedLedgerLocks;
|
|
611
|
-
} | {
|
|
612
|
-
readonly kind: 'busy';
|
|
613
|
-
readonly ledger: LedgerHome;
|
|
614
|
-
} | {
|
|
615
|
-
readonly kind: 'refused';
|
|
616
|
-
readonly ledger: LedgerHome;
|
|
617
|
-
readonly error: unknown;
|
|
618
|
-
};
|
|
619
|
-
type PgLedgerTarget = LedgerHome;
|
|
620
|
-
/** Read only reservations explicitly linked to one durable execution/run. */
|
|
621
|
-
declare function readPgLedgerReservationsForExecution(executor: TransitionJournalQueryable, target: PgLedgerTarget, executionId: string): Promise<readonly LedgerReservationRow[]>;
|
|
622
|
-
/**
|
|
623
|
-
* A re-address pair can cross ledger homes. Discover every existing reservation
|
|
624
|
-
* table before reading the pair so recovery cannot accidentally treat one side
|
|
625
|
-
* of a cross-schema closure as the entire operation.
|
|
626
|
-
*/
|
|
627
|
-
type PgLedgerReservationCandidateOutcome = {
|
|
628
|
-
readonly target: PgLedgerTarget;
|
|
629
|
-
readonly kind: 'verified';
|
|
630
|
-
} | {
|
|
631
|
-
readonly target: PgLedgerTarget;
|
|
632
|
-
readonly kind: 'not-ledger-shape';
|
|
633
|
-
} | {
|
|
634
|
-
readonly target: PgLedgerTarget;
|
|
635
|
-
readonly kind: 'unverifiable';
|
|
636
|
-
readonly cause: string;
|
|
637
|
-
};
|
|
638
|
-
type PgLedgerReservationsForPair = readonly LedgerReservationRow[] & {
|
|
639
|
-
readonly candidates: readonly PgLedgerReservationCandidateOutcome[];
|
|
640
|
-
};
|
|
641
|
-
declare function readPgLedgerReservationsForPair(executor: TransitionJournalQueryable, pairId: string): Promise<PgLedgerReservationsForPair>;
|
|
642
|
-
type LedgerWriteMember = Omit<LedgerChainMember, 'controller' | 'recordedAt'>;
|
|
643
|
-
declare function renderCreateLedgerEventTableSql(target: PgLedgerTarget): string;
|
|
644
|
-
declare function renderCreateLedgerTerminalMemberIndexSql(target: PgLedgerTarget): string;
|
|
645
|
-
declare function renderCreateLedgerReservationTableSql(target: PgLedgerTarget): string;
|
|
646
|
-
declare function renderCreateLedgerIdentityTableSql(target: PgLedgerTarget): string;
|
|
647
|
-
declare function renderCreateLedgerMarkerTableSql(target: PgLedgerTarget): string;
|
|
648
|
-
declare function renderCreateLedgerImmutabilityFunctionSql(target: PgLedgerTarget): string;
|
|
649
|
-
declare function renderCreateLedgerImmutabilityTriggerSql(target: PgLedgerTarget): string;
|
|
650
|
-
/** Proves the PG 15 requirement before emitting a NULLS NOT DISTINCT table. */
|
|
651
|
-
declare function ensurePgLedgerStorageVersion(executor: TransitionJournalQueryable): Promise<void>;
|
|
652
|
-
declare function ensurePgLedger(executor: TransitionJournalQueryable, target: PgLedgerTarget, options?: {
|
|
653
|
-
readonly writeMarker?: boolean;
|
|
654
|
-
}): Promise<void>;
|
|
655
|
-
declare function ensureDbspMetaLedger(executor: TransitionJournalQueryable, options?: {
|
|
656
|
-
readonly writeMarker?: boolean;
|
|
657
|
-
}): Promise<void>;
|
|
658
|
-
/** Records lineage once; a mismatching identity is an admission concern of unit 5. */
|
|
659
|
-
declare function recordPgLedgerIdentity(executor: TransitionJournalQueryable, target: PgLedgerTarget, identity: LedgerIdentity): Promise<void>;
|
|
660
|
-
declare function appendPgLedgerProgress(executor: TransitionJournalQueryable, target: PgLedgerTarget, member: LedgerWriteMember): Promise<void>;
|
|
661
|
-
/**
|
|
662
|
-
* Appends the root claim and every reservation in one PostgreSQL statement.
|
|
663
|
-
* Callers can include this statement in a larger DDL transaction, but cannot
|
|
664
|
-
* accidentally split this claim's append from its durable reservation rows.
|
|
665
|
-
*/
|
|
666
|
-
declare function appendPgLedgerClaim(executor: TransitionJournalQueryable, target: PgLedgerTarget, member: LedgerWriteMember, reservations: readonly LedgerReservationRow[], reservationRootClaimId?: string): Promise<void>;
|
|
667
|
-
/**
|
|
668
|
-
* Appends an entire destructive closure as one ledger group. The caller owns
|
|
669
|
-
* the surrounding locked transaction; consequently a failed member insert
|
|
670
|
-
* rolls back the root, every member and every reservation together.
|
|
671
|
-
*/
|
|
672
|
-
declare function appendPgLedgerClaimGroup(executor: TransitionJournalQueryable, root: LedgerWriteMember, members: readonly LedgerWriteMember[], reservations: readonly LedgerReservationRow[]): Promise<void>;
|
|
673
|
-
/** Resolves every closure terminal in the caller's one locked transaction. */
|
|
674
|
-
declare function appendPgLedgerResolutionGroup(executor: TransitionJournalQueryable, rootClaimId: string, members: readonly LedgerWriteMember[], reservations: readonly Pick<LedgerReservationRow, 'address'>[]): Promise<void>;
|
|
675
|
-
/**
|
|
676
|
-
* Appends a terminal member and releases the reservations owned by this
|
|
677
|
-
* append atomically. A group-owned contained member has an intentionally
|
|
678
|
-
* empty closure because its group's root append already released it.
|
|
679
|
-
*/
|
|
680
|
-
declare function appendPgLedgerResolution(executor: TransitionJournalQueryable, target: PgLedgerTarget, member: LedgerWriteMember, rootClaimId: string, reservations: readonly Pick<LedgerReservationRow, 'address'>[]): Promise<void>;
|
|
681
|
-
/**
|
|
682
|
-
* `released` has no claim spelling in the closed event grammar. It is the
|
|
683
|
-
* deliberate atomic managed-to-unknown transition, so it must not invent an
|
|
684
|
-
* empty reservation closure merely to reuse ordinary claim resolution.
|
|
685
|
-
*/
|
|
686
|
-
declare function appendPgLedgerRelease(executor: TransitionJournalQueryable, target: PgLedgerTarget, member: LedgerWriteMember): Promise<void>;
|
|
687
|
-
/**
|
|
688
|
-
* Transaction-scoped, non-waiting locks for one effects closure. The ordering
|
|
689
|
-
* is dbsp_meta first and then schema name, so opposing closures cannot deadlock.
|
|
690
|
-
*/
|
|
691
|
-
declare function acquirePgLedgerLocks(executor: TransitionJournalQueryable, homes: readonly LedgerHome[]): Promise<PgLedgerLockResult>;
|
|
692
|
-
|
|
693
|
-
type ReinitializePreflightCheckpoint = 'archive' | 'create' | 'grants' | 'marker' | 'output';
|
|
694
|
-
/** Test-only callers can observe real engine progress without changing production flow. */
|
|
695
|
-
type ReinitializePreflightObserver = (checkpoint: ReinitializePreflightCheckpoint, ledger?: LedgerHome) => Promise<void>;
|
|
696
|
-
interface PgReinitializePreflightClient extends TransitionJournalQueryable {
|
|
697
|
-
release?(error?: unknown): void;
|
|
698
|
-
}
|
|
699
|
-
interface PgReinitializePreflightPool {
|
|
700
|
-
connect(): Promise<PgReinitializePreflightClient>;
|
|
701
|
-
}
|
|
702
|
-
interface PgReinitializePreflightOptions {
|
|
703
|
-
readonly pool: PgReinitializePreflightPool;
|
|
704
|
-
/** Schema names only. `dbsp_meta` is always added as the database ledger. */
|
|
705
|
-
readonly schemas: readonly string[];
|
|
706
|
-
readonly declarations: DeclarationSet;
|
|
707
|
-
readonly writeAdoptionFile: (report: ReinitializePreflightReport) => Promise<void>;
|
|
708
|
-
readonly observer?: ReinitializePreflightObserver;
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Read exactly one ledger shape marker without creating or repairing anything.
|
|
712
|
-
* Ordinary command surfaces use this to refuse a non-current mutating scope;
|
|
713
|
-
* inspect deliberately reports the returned value instead.
|
|
714
|
-
*/
|
|
715
|
-
declare function readPgLedgerMarker(executor: TransitionJournalQueryable, home: LedgerHome): Promise<LedgerMarkerState>;
|
|
716
|
-
/**
|
|
717
|
-
* Ordinary mutating commands consume this read-only admission result. It
|
|
718
|
-
* intentionally delegates equality to the preflight's recorded-vs-live
|
|
719
|
-
* comparison, keeping that pair as the only ledger lineage comparison.
|
|
720
|
-
*/
|
|
721
|
-
type PgLedgerScopeCurrency = {
|
|
722
|
-
readonly kind: 'absent';
|
|
723
|
-
readonly marker: LedgerMarkerState;
|
|
724
|
-
} | {
|
|
725
|
-
readonly kind: 'current';
|
|
726
|
-
readonly marker: LedgerMarkerState;
|
|
727
|
-
} | {
|
|
728
|
-
readonly kind: 'not-current';
|
|
729
|
-
readonly marker: LedgerMarkerState;
|
|
730
|
-
readonly reason: 'marker' | 'lineage';
|
|
731
|
-
};
|
|
732
|
-
declare function readPgLedgerScopeCurrency(executor: TransitionJournalQueryable, home: LedgerHome): Promise<PgLedgerScopeCurrency>;
|
|
733
|
-
/**
|
|
734
|
-
* Pair recovery reads only homes already selected by the durable run. A
|
|
735
|
-
* same-named user table in another schema is never discovery evidence for a
|
|
736
|
-
* pair; callers must first establish the finite candidate homes from reviewed
|
|
737
|
-
* material and then each home is admitted here.
|
|
738
|
-
*/
|
|
739
|
-
declare function readVerifiedPgLedgerReservationsForPair(executor: TransitionJournalQueryable, pairId: string, homes: readonly LedgerHome[]): Promise<readonly _dbsp_types.LedgerReservationRow[]>;
|
|
740
|
-
/**
|
|
741
|
-
* Runs the separately privileged reinitialize-preflight. It never invokes a
|
|
742
|
-
* ledger append primitive: the only durable writes are additive structure,
|
|
743
|
-
* archived structure, identity, grants, marker, and the caller-owned output.
|
|
744
|
-
*/
|
|
745
|
-
declare function runPgReinitializePreflight(options: PgReinitializePreflightOptions): Promise<ReinitializePreflightReport>;
|
|
746
|
-
|
|
747
|
-
declare const pgLockedRunBrand: unique symbol;
|
|
748
|
-
/**
|
|
749
|
-
* A run identity that was loaded while the caller owns its run lock. This is
|
|
750
|
-
* deliberately not a structural `{ runId, planDigest }`: callers cannot bind
|
|
751
|
-
* the digest check to two independently supplied strings.
|
|
752
|
-
*/
|
|
753
|
-
interface PgLockedRun {
|
|
754
|
-
readonly runId: string;
|
|
755
|
-
readonly planDigest: string;
|
|
756
|
-
readonly [pgLockedRunBrand]: 'dbsp-pg-locked-journal-run';
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Adapter-only bridge from the journal-load/run-lock boundary. Keep this
|
|
760
|
-
* beside the admitted facade; ordinary callers receive a `PgLockedRun`, never
|
|
761
|
-
* manufacture one from string fields.
|
|
762
|
-
*/
|
|
763
|
-
declare function lockPgJournalRun(run: DurablyLoadedRun): PgLockedRun;
|
|
764
|
-
/** A COMMIT write may have reached PostgreSQL even when its acknowledgement did not. */
|
|
765
|
-
declare class PgCommitAcknowledgementAmbiguousError extends Error {
|
|
766
|
-
constructor(cause: unknown);
|
|
767
|
-
}
|
|
768
|
-
/**
|
|
769
|
-
* Test-only observation points on the admitted path. Production callers do
|
|
770
|
-
* not supply an observer, so the helper is inert: it performs no IPC, I/O, or
|
|
771
|
-
* scheduling work in an ordinary run.
|
|
772
|
-
*/
|
|
773
|
-
type PgOutcomeCheckpoint = 'post-lock-integrity-before-append' | 'commit-acknowledged' | 'ddl-completed-before-read-back';
|
|
774
|
-
type PgOutcomeCheckpointObserver = (checkpoint: PgOutcomeCheckpoint) => Promise<void> | void;
|
|
775
|
-
interface PgOutcomeClaimRequest {
|
|
776
|
-
readonly plan: OutcomeClaimPlan;
|
|
777
|
-
readonly reservations: readonly LedgerReservationRow[];
|
|
778
|
-
readonly lockTimeoutMs?: number;
|
|
779
|
-
/** Destructive authority is evaluated under these same ledger locks. */
|
|
780
|
-
readonly destructiveDecision?: (executor: TransitionJournalQueryable, plan: OutcomeClaimPlan) => Promise<DestructiveDecision>;
|
|
781
|
-
/** Optional E2E observer; absent in all production command paths. */
|
|
782
|
-
readonly observer?: PgOutcomeCheckpointObserver;
|
|
783
|
-
}
|
|
784
|
-
/** One root claim plus its token-free destructive-closure members. */
|
|
785
|
-
interface PgOutcomeClaimGroupRequest extends PgOutcomeClaimRequest {
|
|
786
|
-
readonly members: readonly Omit<PgOutcomeClaimRequest, 'destructiveDecision'>[];
|
|
787
|
-
}
|
|
788
|
-
interface PgOutcomeClaimGroupAdmission {
|
|
789
|
-
readonly root: OutcomeClaimAdmission;
|
|
790
|
-
readonly members: readonly OutcomeClaimAdmission[];
|
|
791
|
-
}
|
|
792
|
-
interface PgOutcomeClaimGroupResolution {
|
|
793
|
-
readonly rootClaimId: string;
|
|
794
|
-
readonly members: readonly {
|
|
795
|
-
readonly target: PgLedgerTarget;
|
|
796
|
-
readonly member: Omit<LedgerChainMember, 'controller' | 'recordedAt'>;
|
|
797
|
-
}[];
|
|
798
|
-
readonly reservations: readonly Pick<LedgerReservationRow, 'address'>[];
|
|
799
|
-
readonly lockTimeoutMs?: number;
|
|
800
|
-
/** Durable run witness carried from destructive admission to its terminal. */
|
|
801
|
-
readonly runtimeIntegrityRun?: PgLockedRun;
|
|
802
|
-
/** Optional E2E observer for this terminal-appending transaction. */
|
|
803
|
-
readonly observer?: PgOutcomeCheckpointObserver;
|
|
804
|
-
}
|
|
805
|
-
interface PgOutcomeResolution {
|
|
806
|
-
readonly eventId: string;
|
|
807
|
-
readonly eventKind: Exclude<LedgerEventKind, 'intent' | 'retire-intent' | 'readdress-intent' | 'adopt-intent' | 'executing'>;
|
|
808
|
-
readonly observed?: LedgerChainMember['observed'];
|
|
809
|
-
/** Required by the ledger writer when this resolution is `refused`. */
|
|
810
|
-
readonly refusal?: LedgerChainMember['refusal'];
|
|
811
|
-
}
|
|
812
|
-
interface PgOutcomeExecutionRequest {
|
|
813
|
-
readonly token: ClaimToken;
|
|
814
|
-
readonly claim: AdmittedOutcomeClaim;
|
|
815
|
-
readonly statements: readonly ClaimBundleStatement[];
|
|
816
|
-
}
|
|
817
|
-
/**
|
|
818
|
-
* The first admitted-operation shape. Later waves add single and paired
|
|
819
|
-
* operation variants without reopening the facade's authority boundary.
|
|
820
|
-
*/
|
|
821
|
-
interface PgSingleAdmittedOperation {
|
|
822
|
-
readonly kind: 'single-outcome';
|
|
823
|
-
readonly request: PgOutcomeTransactionalRequest | PgOutcomeNonTransactionalRequest;
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* The three generated payload roles are intentionally disjoint at the type
|
|
827
|
-
* boundary. Their runtime serialization remains the ledger's `{ value,
|
|
828
|
-
* digest }` pair; the discriminant prevents a generic identity observation
|
|
829
|
-
* from being wired into a declaration or a structural-proof slot.
|
|
830
|
-
*/
|
|
831
|
-
type GeneratedDeclarationPayload = LedgerPayload & {
|
|
832
|
-
readonly payloadKind: 'generated-declaration';
|
|
833
|
-
};
|
|
834
|
-
type GeneratedIdentityObservation = LedgerPayload & {
|
|
835
|
-
readonly payloadKind: 'generated-identity-observation';
|
|
836
|
-
};
|
|
837
|
-
type GeneratedStructuralObservation = LedgerPayload & {
|
|
838
|
-
readonly payloadKind: 'generated-structural-observation';
|
|
839
|
-
};
|
|
840
|
-
/**
|
|
841
|
-
* Readdress keeps its catalogue closure discovery in readdress.ts, while this
|
|
842
|
-
* facade owns the only claim/permit/DDL/terminal path for the resulting pair.
|
|
843
|
-
*/
|
|
844
|
-
interface PgPairedReaddressOperation {
|
|
845
|
-
readonly kind: 'paired-readdress';
|
|
846
|
-
readonly request: {
|
|
847
|
-
readonly pairId: string;
|
|
848
|
-
readonly executionId: string;
|
|
849
|
-
readonly members: readonly {
|
|
850
|
-
readonly source: LedgerAddress;
|
|
851
|
-
readonly target: LedgerAddress;
|
|
852
|
-
readonly sourceClaimId: string;
|
|
853
|
-
readonly targetClaimId: string;
|
|
854
|
-
readonly sourceDeclared?: LedgerPayload;
|
|
855
|
-
readonly targetDeclared: GeneratedDeclarationPayload;
|
|
856
|
-
readonly targetObserved: GeneratedIdentityObservation;
|
|
857
|
-
/**
|
|
858
|
-
* Optional structural proof for a typed table declaration. The paired
|
|
859
|
-
* protocol invokes it after DDL on its pinned transaction session, so
|
|
860
|
-
* the observed ledger fact is the catalogue projection it just read.
|
|
861
|
-
*/
|
|
862
|
-
readonly postDdlReadBack?: (executor: GeneratedPostconditionSession) => Promise<GeneratedStructuralObservation>;
|
|
863
|
-
/** Verifies a physical relationship that identity alone cannot prove. */
|
|
864
|
-
readonly postDdlVerify?: (executor: TransitionJournalQueryable) => Promise<void>;
|
|
865
|
-
}[];
|
|
866
|
-
readonly reservations: readonly LedgerReservationRow[];
|
|
867
|
-
readonly statements: readonly ClaimBundleStatement[];
|
|
868
|
-
/** Digest-covered root material for this paired request; it is never empty. */
|
|
869
|
-
readonly manifestPlan: OutcomeClaimPlan;
|
|
870
|
-
/** Re-read closure, source controller/identity and target vacancy under lock. */
|
|
871
|
-
readonly verifyLiveAdmission: (executor: TransitionJournalQueryable, currentController: ControllerIdentity) => Promise<OutcomeProtocolRefusal | readonly {
|
|
872
|
-
readonly source: LedgerAddress;
|
|
873
|
-
readonly target: LedgerAddress;
|
|
874
|
-
readonly catalogueIdentity: NonNullable<NonNullable<Awaited<ReturnType<typeof readPgCatalogueIdentity>>>['catalogueIdentity']>;
|
|
875
|
-
}[]>;
|
|
876
|
-
readonly lockTimeoutMs?: number;
|
|
877
|
-
/** Optional E2E observer; absent in normal execution. */
|
|
878
|
-
readonly observer?: PgOutcomeCheckpointObserver;
|
|
879
|
-
};
|
|
880
|
-
}
|
|
881
|
-
interface PgDestructiveAdmittedOperation {
|
|
882
|
-
readonly kind: 'destructive-outcome';
|
|
883
|
-
readonly request: PgOutcomeClaimGroupRequest;
|
|
884
|
-
readonly readBackAndResolve: (executor: TransitionJournalQueryable, claim: AdmittedDestructiveOutcomeClaim) => Promise<PgOutcomeClaimGroupResolution>;
|
|
885
|
-
}
|
|
886
|
-
type PgAdmittedOperation = PgSingleAdmittedOperation | PgPairedReaddressOperation | PgDestructiveAdmittedOperation;
|
|
887
|
-
type PgAdmittedOperationResult = PgOutcomeResult | PgDestructiveOutcomeResult | {
|
|
888
|
-
readonly kind: 'executed-paired-readdress';
|
|
889
|
-
readonly pairId: string;
|
|
890
|
-
} | {
|
|
891
|
-
readonly kind: 'outcome-transport-ambiguous';
|
|
892
|
-
readonly reason: string;
|
|
893
|
-
} | {
|
|
894
|
-
readonly kind: 'outcome-recovery-required';
|
|
895
|
-
readonly claimId: string;
|
|
896
|
-
readonly reason: string;
|
|
897
|
-
};
|
|
898
|
-
type PgDestructiveOutcomeResult = {
|
|
899
|
-
readonly kind: 'executed-destructive-outcome';
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* SQL was admitted and may have run, but its operation-owned read-back could
|
|
903
|
-
* not establish a terminal fact. Keep the durable claim open for reconcile;
|
|
904
|
-
* in particular, never turn this post-executing state into `refused`.
|
|
905
|
-
*/
|
|
906
|
-
| {
|
|
907
|
-
readonly kind: 'outcome-protocol-pending';
|
|
908
|
-
readonly reason: string;
|
|
909
|
-
} | OutcomeProtocolRefusal | {
|
|
910
|
-
readonly kind: 'outcome-transport-ambiguous';
|
|
911
|
-
readonly reason: string;
|
|
912
|
-
} | {
|
|
913
|
-
readonly kind: 'outcome-recovery-required';
|
|
914
|
-
readonly claimId: string;
|
|
915
|
-
readonly reason: string;
|
|
916
|
-
};
|
|
917
|
-
/**
|
|
918
|
-
* Internal compatibility bridge. Callers must bring the durable run and scoped
|
|
919
|
-
* approvals that the façade consumes; this bridge never invents either.
|
|
920
|
-
*/
|
|
921
|
-
declare function executePgDestructiveOutcome(executor: TransitionJournalQueryable, input: {
|
|
922
|
-
readonly run: PgLockedRun;
|
|
923
|
-
readonly approval: ScopedApprovalSet;
|
|
924
|
-
readonly request: PgOutcomeClaimGroupRequest;
|
|
925
|
-
readonly readBackAndResolve: (executor: TransitionJournalQueryable, claim: AdmittedDestructiveOutcomeClaim) => Promise<PgOutcomeClaimGroupResolution>;
|
|
926
|
-
}): Promise<PgDestructiveOutcomeResult>;
|
|
927
|
-
/** Keeps terminal appends and reservation release behind the managed facade. */
|
|
928
|
-
declare function resolvePgDestructiveOutcome(executor: TransitionJournalQueryable, request: PgOutcomeClaimGroupResolution): Promise<undefined | OutcomeProtocolRefusal>;
|
|
929
|
-
interface PgOutcomeTransactionalRequest extends PgOutcomeClaimRequest {
|
|
930
|
-
readonly resolution: PgOutcomeResolution;
|
|
931
|
-
/** Core has already opened the segment transaction; never nest BEGIN. */
|
|
932
|
-
readonly transactionOpen?: boolean;
|
|
933
|
-
/**
|
|
934
|
-
* Operation-owned terminal read-back; generic catalogue identity is not
|
|
935
|
-
* evidence. It receives the admitted session so transactional DDL is read
|
|
936
|
-
* before its terminal ledger fact commits.
|
|
937
|
-
*/
|
|
938
|
-
readonly readBack?: (executor: GeneratedPostconditionSession) => Promise<LedgerPayload>;
|
|
939
|
-
/** Required for creations; the reader runs after the claim and before SQL. */
|
|
940
|
-
readonly vacancy?: (executor: TransitionJournalQueryable, plan: OutcomeClaimPlan) => Promise<OutcomeVacancy>;
|
|
941
|
-
/** Re-check operation-specific live facts after the claim/reservation opens. */
|
|
942
|
-
readonly verifyLiveAdmission?: (executor: TransitionJournalQueryable, plan: OutcomeClaimPlan) => Promise<OutcomeProtocolRefusal | undefined>;
|
|
943
|
-
/** Record the post-DDL catalogue identity on a present terminal member. */
|
|
944
|
-
readonly recordCatalogueIdentity?: boolean;
|
|
945
|
-
}
|
|
946
|
-
interface PgOutcomeNonTransactionalRequest extends PgOutcomeTransactionalRequest {
|
|
947
|
-
readonly executingEventId: string;
|
|
948
|
-
/** Observable acknowledgement point after executing has committed, before SQL. */
|
|
949
|
-
readonly onExecutingCommitted?: () => Promise<void> | void;
|
|
950
|
-
}
|
|
951
|
-
/** Builds the canonical read-back payload once catalogue presence is proven. */
|
|
952
|
-
type PgOutcomeReadBackFactory = (executor: GeneratedPostconditionSession, address: LedgerAddress, catalogueIdentity: NonNullable<Awaited<ReturnType<typeof readPgCatalogueIdentity>>>['catalogueIdentity']) => Promise<LedgerPayload>;
|
|
953
|
-
/**
|
|
954
|
-
* A postcondition read owned by the operation itself. Catalogue identity is
|
|
955
|
-
* still retained when present for the ledger, but effect classification comes
|
|
956
|
-
* from the operation's value-level observation rather than object presence.
|
|
957
|
-
*/
|
|
958
|
-
type PgOutcomeOperationReadBackFactory = (executor: TransitionJournalQueryable, address: LedgerAddress, catalogueIdentity: NonNullable<Awaited<ReturnType<typeof readPgCatalogueIdentity>>>['catalogueIdentity'] | undefined) => Promise<{
|
|
959
|
-
readonly observed: LedgerPayload;
|
|
960
|
-
readonly effect: OutcomeRecoveryEffect;
|
|
961
|
-
}>;
|
|
962
|
-
interface PgOutcomeRecoveryRequest {
|
|
963
|
-
readonly address: LedgerAddress;
|
|
964
|
-
readonly reservations: readonly Pick<LedgerReservationRow, 'address'>[];
|
|
965
|
-
readonly resolutionEventId: string;
|
|
966
|
-
readonly acceptedExternalDdlExclusion: boolean;
|
|
967
|
-
/** Durable claim-bound evidence re-matched by reconcile under the run lock. */
|
|
968
|
-
readonly indeterminateEvidence?: OutcomeIndeterminateRecoveryEvidence;
|
|
969
|
-
readonly resolveIndeterminate?: boolean;
|
|
970
|
-
readonly readBack: PgOutcomeReadBackFactory;
|
|
971
|
-
readonly operationReadBack?: PgOutcomeOperationReadBackFactory;
|
|
972
|
-
readonly lockTimeoutMs?: number;
|
|
973
|
-
/** Internal-only, in-memory allowance for one harness-installed trigger. */
|
|
974
|
-
readonly ledgerShapeAllowance?: PgLedgerShapeAllowance;
|
|
975
|
-
/** Optional E2E observer for recovery's committing transaction. */
|
|
976
|
-
readonly observer?: PgOutcomeCheckpointObserver;
|
|
977
|
-
}
|
|
978
|
-
type PgOutcomeResolutionAppendResult = {
|
|
979
|
-
readonly kind: 'appended-outcome-resolution';
|
|
980
|
-
} | {
|
|
981
|
-
readonly kind: 'already-appended-outcome-resolution';
|
|
982
|
-
} | {
|
|
983
|
-
readonly kind: 'malformed-outcome-resolution';
|
|
984
|
-
readonly reason: string;
|
|
985
|
-
};
|
|
986
|
-
type PgOutcomeRecoveryResult = Exclude<OutcomeRecoveryClassification, {
|
|
987
|
-
readonly kind: 'outcome-recovery-append';
|
|
988
|
-
}> | {
|
|
989
|
-
readonly kind: 'outcome-recovery-appended';
|
|
990
|
-
readonly classification: Extract<OutcomeRecoveryClassification, {
|
|
991
|
-
readonly kind: 'outcome-recovery-append';
|
|
992
|
-
}>;
|
|
993
|
-
readonly append: Exclude<PgOutcomeResolutionAppendResult, {
|
|
994
|
-
readonly kind: 'malformed-outcome-resolution';
|
|
995
|
-
}>;
|
|
996
|
-
} | {
|
|
997
|
-
readonly kind: 'outcome-transport-ambiguous';
|
|
998
|
-
readonly reason: string;
|
|
999
|
-
} | OutcomeProtocolRefusal;
|
|
1000
|
-
type PgOutcomeResult = {
|
|
1001
|
-
readonly kind: 'executed-outcome-claim';
|
|
1002
|
-
readonly claim: AdmittedOutcomeClaim;
|
|
1003
|
-
} | OutcomeProtocolRefusal | {
|
|
1004
|
-
readonly kind: 'outcome-transport-ambiguous';
|
|
1005
|
-
readonly reason: string;
|
|
1006
|
-
} | {
|
|
1007
|
-
readonly kind: 'outcome-recovery-required';
|
|
1008
|
-
readonly claimId: string;
|
|
1009
|
-
readonly reason: string;
|
|
1010
|
-
};
|
|
1011
|
-
type PgPairedReaddressRecoveryDecision = {
|
|
1012
|
-
readonly kind: 'refused';
|
|
1013
|
-
readonly reason: string;
|
|
1014
|
-
} | {
|
|
1015
|
-
readonly kind: 'pending';
|
|
1016
|
-
readonly reason: string;
|
|
1017
|
-
} | {
|
|
1018
|
-
readonly kind: 'indeterminate';
|
|
1019
|
-
readonly reason: string;
|
|
1020
|
-
} | {
|
|
1021
|
-
readonly kind: 'outcome-transport-ambiguous';
|
|
1022
|
-
readonly reason: string;
|
|
1023
|
-
};
|
|
1024
|
-
/**
|
|
1025
|
-
* Recovery owns its reservation set: it re-reads every durable pair row,
|
|
1026
|
-
* checks currency under the same locks, and appends only under a minted paired
|
|
1027
|
-
* permit. A caller's selected rows are evidence to compare, never authority.
|
|
1028
|
-
*/
|
|
1029
|
-
declare function recoverPgAdmittedReaddressPair(executor: TransitionJournalQueryable, request: {
|
|
1030
|
-
readonly pairId: string;
|
|
1031
|
-
readonly executionId: string;
|
|
1032
|
-
readonly reservations: readonly LedgerReservationRow[];
|
|
1033
|
-
readonly assess: (executor: TransitionJournalQueryable, reservations: readonly LedgerReservationRow[]) => Promise<PgPairedReaddressRecoveryDecision>;
|
|
1034
|
-
readonly observer?: PgOutcomeCheckpointObserver;
|
|
1035
|
-
}): Promise<PgPairedReaddressRecoveryDecision>;
|
|
1036
|
-
type RuntimeIntegritySeams = {
|
|
1037
|
-
readonly validateShape: typeof validatePgLedgerPhysicalShape;
|
|
1038
|
-
readonly readCurrency: typeof readPgLedgerScopeCurrency;
|
|
1039
|
-
};
|
|
1040
|
-
/**
|
|
1041
|
-
* The façade's runtime gate: validate the physical ledger and its marker /
|
|
1042
|
-
* lineage currency on the same pinned execution session before it admits DDL.
|
|
1043
|
-
* Callers must still take the ledger locks before claiming; this check avoids a
|
|
1044
|
-
* preflight-only trust decision without widening the ledger DDL grammar.
|
|
1045
|
-
*/
|
|
1046
|
-
declare function validatePgLedgerRuntimeIntegrity(executor: TransitionJournalQueryable, homes: readonly PgLedgerTarget[], run?: PgLockedRun, seams?: RuntimeIntegritySeams): Promise<OutcomeProtocolRefusal | undefined>;
|
|
1047
|
-
/**
|
|
1048
|
-
* Appends a resolution once, or treats an already-written equal payload as a
|
|
1049
|
-
* successful retry. A different child cannot be written by PostgreSQL's
|
|
1050
|
-
* one-child constraint and is reported as a fail-closed malformed outcome.
|
|
1051
|
-
*/
|
|
1052
|
-
declare function appendPgOutcomeResolution(executor: TransitionJournalQueryable, target: PgLedgerTarget, member: Omit<LedgerChainMember, 'controller' | 'recordedAt'>, rootClaimId: string, reservations: readonly Pick<LedgerReservationRow, 'address'>[]): Promise<PgOutcomeResolutionAppendResult>;
|
|
1053
|
-
/**
|
|
1054
|
-
* Standalone PostgreSQL catalogue read-back. This intentionally does not
|
|
1055
|
-
* issue LOCK TABLE: callers may supply a Pool, and protocol atomicity belongs
|
|
1056
|
-
* to the transaction-bound recovery and observed-resolution paths.
|
|
1057
|
-
*/
|
|
1058
|
-
declare function readPgOutcomeRecoveryReadBack(executor: TransitionJournalQueryable, address: LedgerAddress, readBack: PgOutcomeReadBackFactory, operationReadBack?: PgOutcomeOperationReadBackFactory, lockTimeoutMs?: number): Promise<OutcomeRecoveryReadBack>;
|
|
1059
|
-
/** Opens a claim on one connection when supplied a PostgreSQL pool. */
|
|
1060
|
-
declare function openPgOutcomeClaim(executor: TransitionJournalQueryable, request: PgOutcomeClaimRequest, run?: PgLockedRun): Promise<OutcomeClaimAdmission>;
|
|
1061
|
-
/**
|
|
1062
|
-
* Opens a root and all closure claims under globally ordered ledger locks in
|
|
1063
|
-
* one transaction. No child is ever durable before its root group commits.
|
|
1064
|
-
*/
|
|
1065
|
-
declare function openPgOutcomeClaimGroup(executor: TransitionJournalQueryable, request: PgOutcomeClaimGroupRequest, run?: PgLockedRun): Promise<PgOutcomeClaimGroupAdmission>;
|
|
1066
|
-
/** Resolves every member terminal atomically under the same ordered locks. */
|
|
1067
|
-
declare function resolvePgOutcomeClaimGroup(executor: TransitionJournalQueryable, request: PgOutcomeClaimGroupResolution): Promise<undefined | OutcomeProtocolRefusal>;
|
|
1068
|
-
/**
|
|
1069
|
-
* The public PostgreSQL admitted-execution boundary. It is intentionally not
|
|
1070
|
-
* used by legacy paths yet: later dispatches bind their persisted runs and
|
|
1071
|
-
* operation shapes here without changing this authority surface.
|
|
1072
|
-
*/
|
|
1073
|
-
declare function executePgAdmittedOperation(session: TransitionJournalQueryable, input: {
|
|
1074
|
-
readonly run: PgLockedRun;
|
|
1075
|
-
readonly operation: PgAdmittedOperation;
|
|
1076
|
-
readonly approval: ScopedApprovalSet;
|
|
1077
|
-
/** Branded proof that the operation came from the normalized manifest. */
|
|
1078
|
-
readonly manifest?: ValidatedManagedStepManifest;
|
|
1079
|
-
/** Recomputed from the durable plan while the caller owns its run lock. */
|
|
1080
|
-
readonly recomputedPlanDigest?: string;
|
|
1081
|
-
}): Promise<PgAdmittedOperationResult>;
|
|
1082
|
-
/**
|
|
1083
|
-
* Reads an address's chain and live catalogue in one locked transaction before
|
|
1084
|
-
* appending the core classifier's instruction. It never calls the DDL sink.
|
|
1085
|
-
*/
|
|
1086
|
-
declare function recoverPgOutcomeClaim(executor: TransitionJournalQueryable, request: PgOutcomeRecoveryRequest): Promise<PgOutcomeRecoveryResult>;
|
|
1087
|
-
|
|
1088
|
-
export { executePgAdmittedOperation as $, type PgOutcomeResult as A, type PgOutcomeTransactionalRequest as B, type ChangeKind as C, type DiffSummary as D, ExpressionCanonicalizationUnavailableError as E, type PgReinitializePreflightOptions as F, type GeneratedPostcondition as G, type PgReinitializePreflightPool as H, type SchemaChange as I, TransitionRunIdentityMismatchError as J, acquirePgLedgerLocks as K, appendIntentJournal as L, appendTransitionAuthorization as M, assertDeclarableChangeKind as N, assertGeneratedPostconditionSession as O, type PgLockedRun as P, compareSchemata as Q, createPgTransitionRunPersister as R, type SchemaDiff as S, type TransitionJournalQueryable as T, createPgsqlGeneratedManagedStep as U, decodeGeneratedPostcondition as V, decodeGeneratedPostconditionPayload as W, ensureDbspMetaLedger as X, ensurePgLedger as Y, ensurePgLedgerStorageVersion as Z, ensureTransitionJournal as _, type CompareSchemataOptions as a, generatedPostconditionDigest as a0, generatedPostconditionForChange as a1, readPgCatalogueIdentity as a2, readPgLedgerMarker as a3, readPgLedgerReservationsForExecution as a4, readPgLedgerScopeCurrency as a5, readPgOutcomeRecoveryReadBack as a6, readTransitionJournal as a7, readVerifiedPgLedgerReservationsForPair as a8, recordPgLedgerIdentity as a9, appendPgLedgerClaimGroup as aA, appendPgLedgerProgress as aB, appendPgLedgerRelease as aC, appendPgLedgerResolution as aD, appendPgLedgerResolutionGroup as aE, appendPgOutcomeResolution as aF, classifyPgLedgerPhysicalShape as aG, createPgLedgerShapeAllowance as aH, executePgDestructiveOutcome as aI, lockPgJournalRun as aJ, openPgOutcomeClaim as aK, openPgOutcomeClaimGroup as aL, readPgLedgerReservationsForPair as aM, recoverPgAdmittedReaddressPair as aN, recoverPgOutcomeClaim as aO, resolvePgDestructiveOutcome as aP, resolvePgOutcomeClaimGroup as aQ, renderCreateDbspMetaSchemaSql as aa, renderCreateLedgerEventTableSql as ab, renderCreateLedgerIdentityTableSql as ac, renderCreateLedgerImmutabilityFunctionSql as ad, renderCreateLedgerImmutabilityTriggerSql as ae, renderCreateLedgerMarkerTableSql as af, renderCreateLedgerReservationTableSql as ag, renderCreateLedgerTerminalMemberIndexSql as ah, renderCreateTransitionAuthorizationTableSql as ai, renderCreateTransitionJournalTableSql as aj, renderCreateTransitionRunPlanTableSql as ak, renderCreateTransitionRunTableSql as al, runPgReinitializePreflight as am, toGeneratedPostconditionBindingAddress as an, validatePgLedgerRuntimeIntegrity as ao, verifyGeneratedCheckPostcondition as ap, verifyGeneratedColumnPostcondition as aq, verifyGeneratedIdentityPostcondition as ar, verifyGeneratedIndexPostcondition as as, verifyGeneratedTablePostcondition as at, withGeneratedPostconditionSession as au, type PgOrderedLedgerLocks as av, type PgLedgerShapeAllowance as aw, type PgLedgerPhysicalShapeOutcome as ax, PgCommitAcknowledgementAmbiguousError as ay, appendPgLedgerClaim as az, type PgOutcomeCheckpointObserver as b, type GeneratedPostconditionBindingAddress as c, GeneratedPostconditionBindingResolutionError as d, GeneratedPostconditionProofInFlightError as e, GeneratedPostconditionReplanRequiredError as f, type GeneratedPostconditionSession as g, GeneratedPostconditionSessionDeactivatedError as h, GeneratedPostconditionWorkInFlightError as i, PG_LEDGER_SHAPE_VERSION as j, type PgAdmittedOperation as k, type PgAdmittedOperationResult as l, type PgCatalogueIdentityQueryable as m, type PgLedgerLockResult as n, type PgLedgerScopeCurrency as o, PgLedgerStorageUnsupportedError as p, type PgLedgerTarget as q, type PgOutcomeCheckpoint as r, type PgOutcomeClaimRequest as s, type PgOutcomeExecutionRequest as t, type PgOutcomeNonTransactionalRequest as u, type PgOutcomeReadBackFactory as v, type PgOutcomeRecoveryRequest as w, type PgOutcomeRecoveryResult as x, type PgOutcomeResolution as y, type PgOutcomeResolutionAppendResult as z };
|