@dbsp/core 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.
@@ -1,2 +1,330 @@
1
- export { A as AdmittedDestructiveOutcomeClaim, D as DurablyLoadedRun, m as admitDestructiveOutcomeClaim, n as admitOutcomeClaim, q as attachDestructiveAuthorityPermit, r as claimIdForToken, s as consumeClaimToken, t as decideDestructiveDecision, u as isDestructiveAuthorityPermit, v as isDurablyLoadedRun, w as markTransitionClientCompromised, x as mintClaimToken, y as mintDurablyLoadedRun, z as transitionPhysicalSessionIsCompromised } from './internal-CNjWzMNe.js';
2
- import '@dbsp/types';
1
+ import { BaseAdapter, ExecutingAdapter, StreamingAdapter, TransactionalAdapter, CheckConstraintIR, Comparator, ObservationContext, AdmittedOutcomeClaim, DestructiveAuthorityPermit, DestructiveDecision, OutcomeClaimAdmissionInput, OutcomeClaimAdmission, OutcomeProtocolRefusal, DestructiveAction, DestructiveAuthorityEvidence, EnumIR, EvidenceObservation, ObservationRequest, EvidenceView, ProofObligation, ExecutionContract, ExecutionRequirement, AdvisoryObservationId, AssumptionId, ClaimId, EvidenceId, SemanticArtifactId, IndexIR, LedgerHome, LedgerAddress, LedgerChainMember, LedgerChainProjection, ClaimToken, OutcomeRecoveryInput, OutcomeRecoveryClassification, ClaimBundleStatement, ClaimStatementBundle, OutcomeClaimPlan, ProvenPlanShape, Assumption, ApplyPolicy, ResourceAddress, ResourceSelector, TransitionRunMetadata, NormalizedManagedStep, TransitionFragment, ProofClaim, OperationEffectAssessment, WhereIntent, QueryIntent, PlanReport, ResolvedRange, RangeAllocator, ModelIR, ResolvedCondition, PlanDecision, SelectExecution } from '@dbsp/types';
2
+ export { AdapterCapabilities, AdapterStreamOptions, ApplicableEvaluation, ApplyPolicy, CapabilityDescriptor, ColumnJsReadType, CompareOutcome, DumpMeta, DurableIntentRecord, ExclusiveTransitionTarget, FingerprintManifest, ForeignKeyIR, LogicalIdentity, ObservationContext, ObservationIssuer, ObservationRequest, OnDeleteAction, OperationEffectAssessment, PhysicalOperation, ProvenPlanShape, RecognitionResult, RecursivePlanReport, RelationIR, RelationType, ResourceAddress, RuleEvaluation, StepJournal, TableReaddressDeclaration, TransactionOptions, TransactionalCompletionRecord, TransitionLessor, TransitionQueryClient, TransitionRule, TransitionRunMetadata, TransitionSessionClient } from '@dbsp/types';
3
+ import { P as PackRegistry, T as TransitionRunPersister, bu as Applier, bv as InProcessProvenPlan, bw as Prover } from './assertion-functions-DiuRuq1k.js';
4
+ export { bx as ASSERTION_TYPES, F as AssertionBlock, by as DUCKDB_CAPABILITIES, bz as DurablyLoadedRun, bA as ExecutionCoordinator, bB as MSSQL_CAPABILITIES, bC as MYSQL_CAPABILITIES, bD as ManagedOutcomeExecutionRequest, bE as ManagedOutcomePreflightRequest, bF as NonRollbackableExecutionTracker, e as OrderByRecord, bG as RefDefinition, bH as RegisteredOperationSemantics, bI as SQLITE_CAPABILITIES, bJ as TRANSITION_LESSOR_REJECTION, bK as TransitionExecutionClient, bL as TransitionLeaseFailure, bM as TransitionPack, bN as acquireExclusiveTransitionLease, bO as acquireTransitionLease, bP as acquireTransitionTargetLease, bQ as assertCanonicalizableJson, bR as assertContains, bS as assertDbColumnExists, bT as assertDbOutput, bU as assertDbRowsEquals, bV as assertDbRowsMax, bW as assertDbRowsMin, bX as assertDbValueEquals, bY as assertIntentHasGroupBy, bZ as assertIntentHasOrderBy, b_ as assertIntentHasWhere, b$ as assertIntentTable, c0 as assertIntentType, c1 as assertIntentWith, c2 as assertMatches, c3 as assertParamsLength, c4 as assertParamsValue, c5 as assertSQLColumn, c6 as assertSQLJoin, c7 as assertSQLTable, c8 as assertSuccess, c9 as bindDeclarationSet, ca as compileNqlRead, cb as createBindingFinalPlan, cc as createExclusiveTransitionTarget, cd as createPackRegistry, ce as createTransitionLessor, cf as declarationSetFromModel, cg as isDurablyLoadedRun, ch as isExclusiveTransitionTarget, ci as isExpressionSpec, cj as isOverallSuccess, ck as isTransitionLessor, cl as isWhereIntent, cm as loadVerifiedRecoveryJournal, cn as markTransitionClientCompromised, co as mintDurablyLoadedRun, cp as normalizeRecursiveIncludeOptions, cq as objectToWhereIntent, cr as planOperationSession, cs as rawNotExists, ct as requiresDatabase, cu as resolveQueryIndex, cv as serverVersionNum, cw as stringAgg, cx as transitionPhysicalSessionIsCompromised, cy as validateDeclarationModel, cz as validateIncludeInput, cA as validateIncludeOptions, cB as validateIncludeOrdering, cC as validateIncludeStrategy, cD as validateRecursiveIncludeStrategy, cE as validateRecursiveSetOperation, cF as validateResolvedIncludeStrategy, cG as validateSchemaIndexOptions, cH as validateTypeName } from './assertion-functions-DiuRuq1k.js';
5
+ export { CaseExpressionIntent, CompileOnlyAdapter, ConnectionAvailability, DeleteIntent, LiteralExpressionIntent, PartitionIR, RequiredEnumLabelIR, SelectAllIntent, UpdateIntent, UpsertIntent, WhereAnyIntent, WhereExistsIntent, WhereNotExistsIntent, WhereRelationFilterIntent, WhereSubqueryIntent, isSubqueryRef } from '@dbsp/types/internal';
6
+ import '@dbsp/nql';
7
+
8
+ /**
9
+ * Adapter interface for database adapters.
10
+ *
11
+ * Type definitions live in @dbsp/types. This module re-exports them
12
+ * and provides runtime functions and error classes.
13
+ *
14
+ * @module adapter
15
+ */
16
+
17
+ /**
18
+ * Check if adapter supports execution.
19
+ */
20
+ declare function supportsExecution(adapter: BaseAdapter): adapter is ExecutingAdapter;
21
+ /**
22
+ * Check if adapter supports streaming.
23
+ */
24
+ declare function supportsStreaming(adapter: BaseAdapter): adapter is StreamingAdapter;
25
+ /**
26
+ * Check if adapter supports transactions.
27
+ */
28
+ declare function supportsTransactions<DB>(adapter: BaseAdapter): adapter is TransactionalAdapter<DB>;
29
+
30
+ declare function createApplier(registry: PackRegistry, persister: TransitionRunPersister): Applier;
31
+
32
+ /**
33
+ * Encodes a JSON value with lexically sorted object keys and preserved array
34
+ * order. Unlike JSON.stringify, this refuses values it would omit or coerce.
35
+ */
36
+ declare function canonicalJson(value: unknown): string;
37
+ /** Hashes the canonical durable representation of a JSON payload. */
38
+ declare function canonicalJsonDigest(value: unknown): string;
39
+
40
+ type CheckSetEntry = Pick<CheckConstraintIR, 'name' | 'expression' | 'notValid'>;
41
+ type CheckDelta = {
42
+ readonly kind: 'none';
43
+ } | {
44
+ readonly kind: 'add-check';
45
+ readonly check: CheckSetEntry;
46
+ readonly expectedBefore: readonly CheckSetEntry[];
47
+ readonly expectedAfter: readonly CheckSetEntry[];
48
+ } | {
49
+ readonly kind: 'expression-mismatch';
50
+ readonly desired: CheckSetEntry;
51
+ readonly current: CheckSetEntry;
52
+ readonly expectedBefore: readonly CheckSetEntry[];
53
+ readonly expectedAfter: readonly CheckSetEntry[];
54
+ } | {
55
+ readonly kind: 'unsupported';
56
+ };
57
+ declare function checkDelta(desiredChecks: readonly CheckConstraintIR[] | undefined, currentChecks: readonly CheckConstraintIR[] | undefined): CheckDelta;
58
+
59
+ declare function createComparator(registry: PackRegistry): Comparator;
60
+
61
+ declare function observationContextDigest(context: ObservationContext): string;
62
+
63
+ /**
64
+ * The total destructive classifier produces a decision for every evidence
65
+ * tuple; only its permitting cells produce positive destructive authority.
66
+ */
67
+ declare function decideDestructiveDecision(action: DestructiveAction, evidence: DestructiveAuthorityEvidence): DestructiveDecision;
68
+ /** Runtime defense for the erased opaque type at adapter boundaries. */
69
+ declare function isDestructiveAuthorityPermit(permit: DestructiveAuthorityPermit): boolean;
70
+ /**
71
+ * Couples the positive authority result to the existing single token producer.
72
+ * The adapter's destructive emitter accepts this value, never raw evidence.
73
+ */
74
+ type AdmittedDestructiveOutcomeClaim = AdmittedOutcomeClaim & {
75
+ readonly destructivePermit: DestructiveAuthorityPermit;
76
+ };
77
+ declare function admitDestructiveOutcomeClaim(input: {
78
+ readonly decision: Extract<DestructiveDecision, {
79
+ readonly kind: 'destructive-decision-permitted';
80
+ }>;
81
+ readonly admission: OutcomeClaimAdmissionInput;
82
+ }): AdmittedDestructiveOutcomeClaim | Exclude<OutcomeClaimAdmission, AdmittedOutcomeClaim>;
83
+ /** Attach a real interpreter permit to an adapter-opened, already minted claim. */
84
+ declare function attachDestructiveAuthorityPermit(input: {
85
+ readonly decision: Extract<DestructiveDecision, {
86
+ readonly kind: 'destructive-decision-permitted';
87
+ }>;
88
+ readonly claim: AdmittedOutcomeClaim;
89
+ }): AdmittedDestructiveOutcomeClaim | OutcomeProtocolRefusal;
90
+
91
+ type EnumAddDelta = {
92
+ readonly kind: 'none';
93
+ } | {
94
+ readonly kind: 'add-label';
95
+ readonly label: string;
96
+ readonly after?: string;
97
+ } | {
98
+ readonly kind: 'unsupported';
99
+ };
100
+ interface EnumAddDeltaOptions {
101
+ readonly targetSchema?: string;
102
+ }
103
+ declare function resolveEnumSchemaForComparison(enumDef: EnumIR, targetSchema?: string): EnumIR;
104
+ declare function enumAddDelta(desired: EnumIR, current: EnumIR, options?: EnumAddDeltaOptions): EnumAddDelta;
105
+
106
+ declare function createEvidenceView(params: {
107
+ readonly evidence: readonly EvidenceObservation[];
108
+ readonly context: ObservationContext;
109
+ readonly requests?: readonly ObservationRequest[];
110
+ }): EvidenceView;
111
+
112
+ type EvidenceConclusion = 'established' | 'undischarged' | 'refuted' | 'conflicted';
113
+ type EvidenceEntailmentResult = {
114
+ readonly conclusion: EvidenceConclusion;
115
+ readonly supportedBy: readonly EvidenceObservation[];
116
+ };
117
+ declare function concludeEvidenceForObligation(params: {
118
+ readonly obligation: ProofObligation;
119
+ readonly evidence: readonly EvidenceObservation[];
120
+ readonly expectedContext?: ObservationContext;
121
+ }): EvidenceEntailmentResult;
122
+
123
+ /** Construct a fresh versioned contract whose requirements are canonical. */
124
+ declare function createExecutionContract(requirements: readonly ExecutionRequirement[]): ExecutionContract;
125
+ /** Attach a planning-time-only contract to a fresh immutable durable plan. */
126
+ declare function bindExecutionContract(plan: InProcessProvenPlan, contract: ExecutionContract): InProcessProvenPlan;
127
+
128
+ declare function semanticArtifactId(value: string): SemanticArtifactId;
129
+ declare function assumptionId(value: string): AssumptionId;
130
+ declare function claimId(value: string): ClaimId;
131
+ declare function evidenceId(value: string): EvidenceId;
132
+ declare function advisoryObservationId(value: string): AdvisoryObservationId;
133
+
134
+ type IndexSetEntry = {
135
+ readonly name: string;
136
+ readonly columns: readonly string[];
137
+ readonly unique?: boolean;
138
+ readonly valid?: boolean;
139
+ readonly ready?: boolean;
140
+ readonly method?: string;
141
+ readonly where?: string;
142
+ readonly expressions?: readonly string[];
143
+ readonly include?: readonly string[];
144
+ readonly opclass?: Readonly<Record<string, string>>;
145
+ readonly with?: Readonly<Record<string, string>>;
146
+ readonly nullsNotDistinct?: boolean;
147
+ };
148
+ type IndexDelta = {
149
+ readonly kind: 'none';
150
+ } | {
151
+ readonly kind: 'add-unique-index';
152
+ readonly index: IndexSetEntry;
153
+ readonly expectedBefore: readonly IndexSetEntry[];
154
+ readonly expectedAfter: readonly IndexSetEntry[];
155
+ } | {
156
+ readonly kind: 'unsupported';
157
+ };
158
+ declare function defaultIndexName(tableName: string, index: Pick<IndexIR, 'name' | 'columns'>): string;
159
+ type IndexPerspective = 'desired' | 'current';
160
+ declare function normalizedIndex(tableName: string, index: IndexIR, perspective?: IndexPerspective): IndexSetEntry;
161
+ declare function indexDelta(tableName: string, desiredIndexes: readonly IndexIR[], currentIndexes: readonly IndexIR[]): IndexDelta;
162
+
163
+ interface LedgerChainProjectionInput {
164
+ readonly ledger: LedgerHome;
165
+ readonly address: LedgerAddress;
166
+ readonly events: readonly LedgerChainMember[];
167
+ }
168
+ /**
169
+ * Projects a whole address chain without using insertion order. Malformed
170
+ * chains deliberately return a structured value so mutation callers fail
171
+ * closed while readers retain the evidence needed to diagnose it.
172
+ */
173
+ declare function projectLedgerChain(input: LedgerChainProjectionInput): LedgerChainProjection;
174
+
175
+ /**
176
+ * The sole durable identity builder for a managed outcome claim. An address
177
+ * is the stable chain key, while the claim id is execution-scoped:
178
+ * hash(executionId, plannedClaimKey, address[, closureMemberKey]). Hashing the
179
+ * canonical representation keeps the persisted identifier opaque, compact,
180
+ * and free of serializer type tags.
181
+ */
182
+ declare function outcomeClaimId(executionId: string, plannedClaimKey: string, address: LedgerAddress, closureMemberKey?: string): string;
183
+ /** Resolution and progress ids cannot collide across execution attempts either. */
184
+ declare function outcomeClaimEventId(claimId: string, role: string): string;
185
+ /**
186
+ * The sole token producer. The documented package API does not expose managed
187
+ * DDL or ledger-append primitives; capability checks prevent accidental
188
+ * bypass within supported integrations. This is not a security boundary
189
+ * against code already running in this Node process or a database role
190
+ * authorized to issue DDL or write ledger tables.
191
+ */
192
+ declare function mintClaimToken(plan: OutcomeClaimPlan): ClaimToken;
193
+ /**
194
+ * Reads the claim identity of a core-minted capability without exposing its
195
+ * bundle or giving callers a way to mint one.
196
+ */
197
+ declare function claimIdForToken(token: ClaimToken): string | undefined;
198
+ /**
199
+ * Consumes exactly one planned statement. The PostgreSQL execution sink calls
200
+ * this immediately before it sends SQL, after it has verified the claim is
201
+ * still open in the ledger.
202
+ */
203
+ declare function consumeClaimToken(token: ClaimToken, claimId: string, statements: readonly ClaimBundleStatement[]): ClaimStatementBundle | OutcomeProtocolRefusal;
204
+ /**
205
+ * Admits an open claim from the one lifecycle grammar, and mints the execution
206
+ * token only after the chain and plan-time bundle have both passed.
207
+ */
208
+ declare function admitOutcomeClaim(input: OutcomeClaimAdmissionInput): OutcomeClaimAdmission;
209
+ /**
210
+ * Classifies one open outcome-protocol claim from a fresh catalogue read.
211
+ * It never issues DDL; its only mutation instruction is an append for the
212
+ * adapter to perform after the read has completed. Calling this once per
213
+ * address deliberately keeps interrupted closures independently recoverable.
214
+ */
215
+ declare function classifyOutcomeRecovery(input: OutcomeRecoveryInput): Promise<OutcomeRecoveryClassification>;
216
+
217
+ /**
218
+ * Canonical digest used to bind a durable transition run to its proven plan.
219
+ */
220
+ declare function transitionPlanDigest(plan: ProvenPlanShape): string;
221
+
222
+ declare function createProver(registry: PackRegistry): Prover;
223
+
224
+ declare function selectorMatchesResource(selector: ResourceSelector, resource: ResourceAddress): boolean;
225
+ declare function resourceScopeCovers(scope: readonly ResourceAddress[], required: readonly ResourceAddress[]): boolean;
226
+ declare function assumptionAccepted(assumption: Assumption, policy: ApplyPolicy): boolean;
227
+
228
+ /**
229
+ * Mint metadata for a proven transition before making it durable.
230
+ *
231
+ * The target digest is deliberately derived from the plan's evidence, not a
232
+ * caller-supplied snapshot. That is the exact context resume verifies.
233
+ */
234
+ declare function createTransitionRunMetadata(plan: InProcessProvenPlan): TransitionRunMetadata;
235
+
236
+ type TransitionRelationalValidationInput = {
237
+ readonly kind: 'fragment';
238
+ readonly fragment: TransitionFragment;
239
+ readonly claims: readonly ProofClaim[];
240
+ readonly assumptions: readonly Assumption[];
241
+ } | {
242
+ readonly kind: 'plan';
243
+ readonly plan: ProvenPlanShape;
244
+ readonly operationEffectsByRef?: ReadonlyMap<string, OperationEffectAssessment>;
245
+ };
246
+ type TransitionRelationalValidationResult = {
247
+ readonly ok: true;
248
+ } | {
249
+ readonly ok: false;
250
+ readonly detail: string;
251
+ };
252
+ declare const validatedManagedStepManifestBrand: unique symbol;
253
+ /** A manifest normalized and accepted by the managed lifecycle boundary. */
254
+ interface ValidatedManagedStepManifest {
255
+ readonly steps: readonly NormalizedManagedStep[];
256
+ readonly [validatedManagedStepManifestBrand]: 'dbsp-validated-managed-step-manifest';
257
+ }
258
+ type ValidatedManagedStepManifestResult = {
259
+ readonly ok: true;
260
+ readonly manifest: ValidatedManagedStepManifest;
261
+ } | {
262
+ readonly ok: false;
263
+ readonly detail: string;
264
+ };
265
+ /**
266
+ * Generic lifecycle invariants for adapter-produced normalized managed steps.
267
+ * Mapping a concrete DDL kind remains adapter work; core only validates the
268
+ * durable protocol shape before it becomes digest-covered plan material.
269
+ */
270
+ declare function validateNormalizedManagedStepManifest(steps: readonly NormalizedManagedStep[]): ValidatedManagedStepManifestResult;
271
+ /**
272
+ * Diagnostic consistency check for transition fragments and already-trusted,
273
+ * in-process plans. For plan inputs this is not an untrusted serialized-plan
274
+ * validator; apply() first requires the module-private minting capability, and
275
+ * any later plan failure is a prover bug.
276
+ */
277
+ declare function validateTransitionRelationalInvariants(input: TransitionRelationalValidationInput): TransitionRelationalValidationResult;
278
+
279
+ type FilterMap = Readonly<Record<string, WhereIntent>>;
280
+ /** Copy only own entries, retaining a null prototype after range exclusions. */
281
+ declare function copyDefaultFilters(filters: FilterMap, keep?: (table: string) => boolean): Record<string, WhereIntent>;
282
+
283
+ /** Inspect enumerable own keys without consulting model metadata. */
284
+ declare function inspectMutationRows(rows: readonly Record<string, unknown>[], options: {
285
+ operation: 'insert' | 'upsert' | 'update';
286
+ homogeneous?: boolean;
287
+ requiredKeys?: readonly string[];
288
+ }): {
289
+ columns: string[];
290
+ heterogeneous: boolean;
291
+ rowKeys: ReadonlySet<string>[];
292
+ };
293
+
294
+ declare function getRelationalReadPlan(intent: QueryIntent, queryLocalSource?: boolean): PlanReport | undefined;
295
+
296
+ /** One traversal, with one shared allocator and no reconstruction of ancestor name sets. */
297
+ declare function resolveSelectWhere(where: WhereIntent | undefined, root: ResolvedRange, visible: readonly ResolvedRange[], allocator: RangeAllocator, model: ModelIR | undefined, initialAliasCount?: number, additionalOuterRanges?: readonly ResolvedRange[]): ResolvedCondition | undefined;
298
+
299
+ /** Called during planning or once after legacy boundary validation. Never by SQL emission. */
300
+ declare function resolveReportIncludes(intent: QueryIntent, decisions: readonly PlanDecision[], model: ModelIR | undefined, options?: {
301
+ defaultFilters?: Readonly<Record<string, WhereIntent>>;
302
+ skipRootDefaultFilter?: boolean;
303
+ whereReservedNames?: readonly string[];
304
+ defaultPk?: string;
305
+ deriveFk?: (table: string, pk: string) => string;
306
+ }): SelectExecution;
307
+ /** Include decisions retain observations only; resolved authority belongs to execution. */
308
+ declare function observeIncludeDecisions(decisions: readonly PlanDecision[]): readonly PlanDecision[];
309
+
310
+ /**
311
+ * Preserve hostile diagnostic text as one printable line without losing which
312
+ * control character was supplied. This is for diagnostics only, never SQL.
313
+ */
314
+ declare function escapeDiagnosticText(value: string): string;
315
+
316
+ declare class EnumNameMapKeyMismatchError extends Error {
317
+ readonly mapKey: string;
318
+ readonly enumName: string;
319
+ constructor(mapKey: string, enumName: string);
320
+ }
321
+ declare function assertDeclaredEnumMapIdentity(enums: ReadonlyMap<string, EnumIR> | undefined): void;
322
+
323
+ type RelationPathUsage = {
324
+ readonly relationName?: string | null | undefined;
325
+ readonly relationPath?: string | null | undefined;
326
+ };
327
+ declare function deriveRelationPathFromIntentPath(includes: readonly unknown[] | undefined, intentPath: string | undefined, fallbackRelation: string | undefined): string | undefined;
328
+ declare function countDistinctRelationPathsByName(usages: readonly RelationPathUsage[]): Map<string, number>;
329
+
330
+ export { type AdmittedDestructiveOutcomeClaim, EnumNameMapKeyMismatchError, InProcessProvenPlan, PackRegistry, TransitionRunPersister, type ValidatedManagedStepManifest, admitDestructiveOutcomeClaim, admitOutcomeClaim, advisoryObservationId, assertDeclaredEnumMapIdentity, assumptionAccepted, assumptionId, attachDestructiveAuthorityPermit, bindExecutionContract, canonicalJson, canonicalJsonDigest, checkDelta, claimId, claimIdForToken, classifyOutcomeRecovery, concludeEvidenceForObligation, consumeClaimToken, copyDefaultFilters, countDistinctRelationPathsByName, createApplier, createComparator, createEvidenceView, createExecutionContract, createProver, createTransitionRunMetadata, decideDestructiveDecision, defaultIndexName, deriveRelationPathFromIntentPath, enumAddDelta, escapeDiagnosticText, evidenceId, getRelationalReadPlan, indexDelta, inspectMutationRows, isDestructiveAuthorityPermit, mintClaimToken, normalizedIndex, observationContextDigest, observeIncludeDecisions, outcomeClaimEventId, outcomeClaimId, projectLedgerChain, resolveEnumSchemaForComparison, resolveReportIncludes, resolveSelectWhere, resourceScopeCovers, selectorMatchesResource, semanticArtifactId, supportsExecution, supportsStreaming, supportsTransactions, transitionPlanDigest, validateNormalizedManagedStepManifest, validateTransitionRelationalInvariants };
package/dist/internal.js CHANGED
@@ -1,13 +1,122 @@
1
1
  import {
2
+ ASSERTION_TYPES,
3
+ DUCKDB_CAPABILITIES,
4
+ EnumNameMapKeyMismatchError,
5
+ MSSQL_CAPABILITIES,
6
+ MYSQL_CAPABILITIES,
7
+ PackRegistry,
8
+ SQLITE_CAPABILITIES,
9
+ TRANSITION_LESSOR_REJECTION,
10
+ acquireExclusiveTransitionLease,
11
+ acquireTransitionLease,
12
+ acquireTransitionTargetLease,
2
13
  admitOutcomeClaim,
14
+ advisoryObservationId,
15
+ assertCanonicalizableJson,
16
+ assertContains,
17
+ assertDbColumnExists,
18
+ assertDbOutput,
19
+ assertDbRowsEquals,
20
+ assertDbRowsMax,
21
+ assertDbRowsMin,
22
+ assertDbValueEquals,
23
+ assertDeclaredEnumMapIdentity,
24
+ assertIntentHasGroupBy,
25
+ assertIntentHasOrderBy,
26
+ assertIntentHasWhere,
27
+ assertIntentTable,
28
+ assertIntentType,
29
+ assertIntentWith,
30
+ assertMatches,
31
+ assertParamsLength,
32
+ assertParamsValue,
33
+ assertSQLColumn,
34
+ assertSQLJoin,
35
+ assertSQLTable,
36
+ assertSuccess,
37
+ assumptionAccepted,
38
+ assumptionId,
39
+ bindDeclarationSet,
40
+ bindExecutionContract,
41
+ canonicalJson,
42
+ canonicalJsonDigest,
43
+ checkDelta,
44
+ claimId,
3
45
  claimIdForToken,
46
+ classifyOutcomeRecovery,
47
+ compileNqlRead,
48
+ concludeEvidenceForObligation,
4
49
  consumeClaimToken,
50
+ copyDefaultFilters,
51
+ countDistinctRelationPathsByName,
52
+ createApplier,
53
+ createBindingFinalPlan,
54
+ createComparator,
55
+ createEvidenceView,
56
+ createExclusiveTransitionTarget,
57
+ createExecutionContract,
58
+ createPackRegistry,
59
+ createProver,
60
+ createTransitionLessor,
61
+ createTransitionRunMetadata,
62
+ declarationSetFromModel,
63
+ defaultIndexName,
64
+ deriveRelationPathFromIntentPath,
65
+ enumAddDelta,
66
+ escapeDiagnosticText,
67
+ evidenceId,
68
+ getRelationalReadPlan,
69
+ indexDelta,
70
+ inspectMutationRows,
71
+ intent_ast_exports,
5
72
  isDurablyLoadedRun,
73
+ isExclusiveTransitionTarget,
74
+ isExpressionSpec,
75
+ isOverallSuccess,
76
+ isTransitionLessor,
77
+ isWhereIntent,
78
+ loadVerifiedRecoveryJournal,
6
79
  markTransitionClientCompromised,
7
80
  mintClaimToken,
8
81
  mintDurablyLoadedRun,
9
- transitionPhysicalSessionIsCompromised
10
- } from "./chunk-AQN7HBYD.js";
82
+ normalizeRecursiveIncludeOptions,
83
+ normalizedIndex,
84
+ objectToWhereIntent,
85
+ observationContextDigest,
86
+ observeIncludeDecisions,
87
+ outcomeClaimEventId,
88
+ outcomeClaimId,
89
+ planOperationSession,
90
+ projectLedgerChain,
91
+ rawNotExists,
92
+ requiresDatabase,
93
+ resolveEnumSchemaForComparison,
94
+ resolveQueryIndex,
95
+ resolveReportIncludes,
96
+ resolveSelectWhere,
97
+ resourceScopeCovers,
98
+ selectorMatchesResource,
99
+ semanticArtifactId,
100
+ serverVersionNum,
101
+ stringAgg,
102
+ supportsExecution,
103
+ supportsStreaming,
104
+ supportsTransactions,
105
+ transitionPhysicalSessionIsCompromised,
106
+ transitionPlanDigest,
107
+ validateDeclarationModel,
108
+ validateIncludeInput,
109
+ validateIncludeOptions,
110
+ validateIncludeOrdering,
111
+ validateIncludeStrategy,
112
+ validateNormalizedManagedStepManifest,
113
+ validateRecursiveIncludeStrategy,
114
+ validateRecursiveSetOperation,
115
+ validateResolvedIncludeStrategy,
116
+ validateSchemaIndexOptions,
117
+ validateTransitionRelationalInvariants,
118
+ validateTypeName
119
+ } from "./chunk-UATOOZ2G.js";
11
120
 
12
121
  // src/transition/destructive-authority.ts
13
122
  import { sameLedgerAddress } from "@dbsp/types";
@@ -82,18 +191,128 @@ function attachDestructiveAuthorityPermit(input) {
82
191
  };
83
192
  return { ...input.claim, destructivePermit: input.decision.permit };
84
193
  }
194
+ var export_isSubqueryRef = intent_ast_exports.isSubqueryRef;
85
195
  export {
196
+ ASSERTION_TYPES,
197
+ DUCKDB_CAPABILITIES,
198
+ EnumNameMapKeyMismatchError,
199
+ MSSQL_CAPABILITIES,
200
+ MYSQL_CAPABILITIES,
201
+ PackRegistry,
202
+ SQLITE_CAPABILITIES,
203
+ TRANSITION_LESSOR_REJECTION,
204
+ acquireExclusiveTransitionLease,
205
+ acquireTransitionLease,
206
+ acquireTransitionTargetLease,
86
207
  admitDestructiveOutcomeClaim,
87
208
  admitOutcomeClaim,
209
+ advisoryObservationId,
210
+ assertCanonicalizableJson,
211
+ assertContains,
212
+ assertDbColumnExists,
213
+ assertDbOutput,
214
+ assertDbRowsEquals,
215
+ assertDbRowsMax,
216
+ assertDbRowsMin,
217
+ assertDbValueEquals,
218
+ assertDeclaredEnumMapIdentity,
219
+ assertIntentHasGroupBy,
220
+ assertIntentHasOrderBy,
221
+ assertIntentHasWhere,
222
+ assertIntentTable,
223
+ assertIntentType,
224
+ assertIntentWith,
225
+ assertMatches,
226
+ assertParamsLength,
227
+ assertParamsValue,
228
+ assertSQLColumn,
229
+ assertSQLJoin,
230
+ assertSQLTable,
231
+ assertSuccess,
232
+ assumptionAccepted,
233
+ assumptionId,
88
234
  attachDestructiveAuthorityPermit,
235
+ bindDeclarationSet,
236
+ bindExecutionContract,
237
+ canonicalJson,
238
+ canonicalJsonDigest,
239
+ checkDelta,
240
+ claimId,
89
241
  claimIdForToken,
242
+ classifyOutcomeRecovery,
243
+ compileNqlRead,
244
+ concludeEvidenceForObligation,
90
245
  consumeClaimToken,
246
+ copyDefaultFilters,
247
+ countDistinctRelationPathsByName,
248
+ createApplier,
249
+ createBindingFinalPlan,
250
+ createComparator,
251
+ createEvidenceView,
252
+ createExclusiveTransitionTarget,
253
+ createExecutionContract,
254
+ createPackRegistry,
255
+ createProver,
256
+ createTransitionLessor,
257
+ createTransitionRunMetadata,
91
258
  decideDestructiveDecision,
259
+ declarationSetFromModel,
260
+ defaultIndexName,
261
+ deriveRelationPathFromIntentPath,
262
+ enumAddDelta,
263
+ escapeDiagnosticText,
264
+ evidenceId,
265
+ getRelationalReadPlan,
266
+ indexDelta,
267
+ inspectMutationRows,
92
268
  isDestructiveAuthorityPermit,
93
269
  isDurablyLoadedRun,
270
+ isExclusiveTransitionTarget,
271
+ isExpressionSpec,
272
+ isOverallSuccess,
273
+ export_isSubqueryRef as isSubqueryRef,
274
+ isTransitionLessor,
275
+ isWhereIntent,
276
+ loadVerifiedRecoveryJournal,
94
277
  markTransitionClientCompromised,
95
278
  mintClaimToken,
96
279
  mintDurablyLoadedRun,
97
- transitionPhysicalSessionIsCompromised
280
+ normalizeRecursiveIncludeOptions,
281
+ normalizedIndex,
282
+ objectToWhereIntent,
283
+ observationContextDigest,
284
+ observeIncludeDecisions,
285
+ outcomeClaimEventId,
286
+ outcomeClaimId,
287
+ planOperationSession,
288
+ projectLedgerChain,
289
+ rawNotExists,
290
+ requiresDatabase,
291
+ resolveEnumSchemaForComparison,
292
+ resolveQueryIndex,
293
+ resolveReportIncludes,
294
+ resolveSelectWhere,
295
+ resourceScopeCovers,
296
+ selectorMatchesResource,
297
+ semanticArtifactId,
298
+ serverVersionNum,
299
+ stringAgg,
300
+ supportsExecution,
301
+ supportsStreaming,
302
+ supportsTransactions,
303
+ transitionPhysicalSessionIsCompromised,
304
+ transitionPlanDigest,
305
+ validateDeclarationModel,
306
+ validateIncludeInput,
307
+ validateIncludeOptions,
308
+ validateIncludeOrdering,
309
+ validateIncludeStrategy,
310
+ validateNormalizedManagedStepManifest,
311
+ validateRecursiveIncludeStrategy,
312
+ validateRecursiveSetOperation,
313
+ validateResolvedIncludeStrategy,
314
+ validateSchemaIndexOptions,
315
+ validateTransitionRelationalInvariants,
316
+ validateTypeName
98
317
  };
99
318
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/transition/destructive-authority.ts"],"sourcesContent":["import type {\n\tAdmittedOutcomeClaim,\n\tDestructiveAction,\n\tDestructiveAuthorityEvidence,\n\tDestructiveAuthorityPermit,\n\tDestructiveDecision,\n\tOutcomeClaimAdmission,\n\tOutcomeClaimAdmissionInput,\n\tOutcomeProtocolRefusal,\n} from '@dbsp/types';\nimport { sameLedgerAddress } from '@dbsp/types';\nimport { admitOutcomeClaim } from './outcome-protocol.js';\n\nconst permits = new WeakMap<object, { readonly closureDigest?: string }>();\n\nfunction declarationPermits(\n\taction: DestructiveAction,\n\tevidence: DestructiveAuthorityEvidence,\n): boolean {\n\tif (action.kind === 'removal')\n\t\treturn (\n\t\t\tevidence.declaration === 'requires-removal' ||\n\t\t\t(evidence.declaration === 'replacement-requested-by-plan' &&\n\t\t\t\tevidence.replacementAddress !== undefined &&\n\t\t\t\tsameLedgerAddress(evidence.replacementAddress, action.address))\n\t\t);\n\treturn evidence.declaration === 'requires-lossy-change';\n}\n\nfunction refusalReasons(\n\taction: DestructiveAction,\n\tevidence: DestructiveAuthorityEvidence,\n): readonly string[] {\n\tconst reasons: string[] = [];\n\tif (!declarationPermits(action, evidence))\n\t\treasons.push('declaration does not permit this destructive action');\n\tif (evidence.ownership !== 'managed-by-me')\n\t\treasons.push(`ownership is ${evidence.ownership}`);\n\tif (evidence.catalogueIdentity !== 'matches-recorded')\n\t\treasons.push(`catalogue identity is ${evidence.catalogueIdentity}`);\n\tif (evidence.operatorAcceptance !== 'destructive-plan-accepted')\n\t\treasons.push('operator acceptance is absent');\n\tif (\n\t\taction.kind === 'removal' &&\n\t\tevidence.containment !== 'all-contained-or-managed'\n\t)\n\t\treasons.push(\n\t\t\tevidence.containment === 'reaches-unmanaged' &&\n\t\t\t\tevidence.containmentUnmanaged !== undefined\n\t\t\t\t? `containment closure is reaches-unmanaged: ${evidence.containmentUnmanaged.kind} ${evidence.containmentUnmanaged.schema ?? '<database>'}.${evidence.containmentUnmanaged.name}`\n\t\t\t\t: evidence.containment === 'undecidable' &&\n\t\t\t\t\t\tevidence.containmentReason !== undefined\n\t\t\t\t\t? `containment closure is undecidable: ${evidence.containmentReason}`\n\t\t\t\t\t: `containment closure is ${evidence.containment ?? 'undecidable'}`,\n\t\t);\n\tif (evidence.ledgerLineage !== 'matches-database')\n\t\treasons.push(`ledger lineage is ${evidence.ledgerLineage}`);\n\treturn reasons;\n}\n\n/**\n * The total destructive classifier produces a decision for every evidence\n * tuple; only its permitting cells produce positive destructive authority.\n */\nexport function decideDestructiveDecision(\n\taction: DestructiveAction,\n\tevidence: DestructiveAuthorityEvidence,\n): DestructiveDecision {\n\tconst reasons = refusalReasons(action, evidence);\n\tif (reasons.length > 0)\n\t\treturn { kind: 'destructive-decision-refused', action, reasons };\n\tconst permit = Object.freeze({}) as DestructiveAuthorityPermit;\n\tpermits.set(\n\t\tpermit,\n\t\taction.kind === 'removal' && action.closureDigest !== undefined\n\t\t\t? { closureDigest: action.closureDigest }\n\t\t\t: {},\n\t);\n\treturn { kind: 'destructive-decision-permitted', action, permit };\n}\n\n/** Runtime defense for the erased opaque type at adapter boundaries. */\nexport function isDestructiveAuthorityPermit(\n\tpermit: DestructiveAuthorityPermit,\n): boolean {\n\treturn permits.has(permit);\n}\n\n/** The adapter compares this immutable admission set after taking its locks. */\nexport function closureDigestForDestructiveAuthorityPermit(\n\tpermit: DestructiveAuthorityPermit,\n): string | undefined {\n\treturn permits.get(permit)?.closureDigest;\n}\n\n/**\n * Couples the positive authority result to the existing single token producer.\n * The adapter's destructive emitter accepts this value, never raw evidence.\n */\nexport type AdmittedDestructiveOutcomeClaim = AdmittedOutcomeClaim & {\n\treadonly destructivePermit: DestructiveAuthorityPermit;\n};\n\nexport function admitDestructiveOutcomeClaim(input: {\n\treadonly decision: Extract<\n\t\tDestructiveDecision,\n\t\t{ readonly kind: 'destructive-decision-permitted' }\n\t>;\n\treadonly admission: OutcomeClaimAdmissionInput;\n}):\n\t| AdmittedDestructiveOutcomeClaim\n\t| Exclude<OutcomeClaimAdmission, AdmittedOutcomeClaim> {\n\tif (!isDestructiveAuthorityPermit(input.decision.permit)) {\n\t\treturn {\n\t\t\tkind: 'outcome-protocol-refused',\n\t\t\treason: 'destructive authority permit was not minted by the interpreter',\n\t\t};\n\t}\n\tif (\n\t\t!sameLedgerAddress(\n\t\t\tinput.decision.action.address,\n\t\t\tinput.admission.plan.address,\n\t\t)\n\t) {\n\t\treturn {\n\t\t\tkind: 'outcome-protocol-refused',\n\t\t\treason: 'destructive authority address does not match the claim address',\n\t\t};\n\t}\n\tconst admitted = admitOutcomeClaim(input.admission);\n\tif (admitted.kind !== 'admitted-outcome-claim') return admitted;\n\treturn { ...admitted, destructivePermit: input.decision.permit };\n}\n\n/** Attach a real interpreter permit to an adapter-opened, already minted claim. */\nexport function attachDestructiveAuthorityPermit(input: {\n\treadonly decision: Extract<\n\t\tDestructiveDecision,\n\t\t{ readonly kind: 'destructive-decision-permitted' }\n\t>;\n\treadonly claim: AdmittedOutcomeClaim;\n}): AdmittedDestructiveOutcomeClaim | OutcomeProtocolRefusal {\n\tif (!isDestructiveAuthorityPermit(input.decision.permit))\n\t\treturn {\n\t\t\tkind: 'outcome-protocol-refused',\n\t\t\treason: 'destructive authority permit was not minted by the interpreter',\n\t\t};\n\tif (\n\t\t!sameLedgerAddress(input.decision.action.address, input.claim.plan.address)\n\t)\n\t\treturn {\n\t\t\tkind: 'outcome-protocol-refused',\n\t\t\treason: 'destructive authority address does not match the claim address',\n\t\t};\n\treturn { ...input.claim, destructivePermit: input.decision.permit };\n}\n"],"mappings":";;;;;;;;;;;;AAUA,SAAS,yBAAyB;AAGlC,IAAM,UAAU,oBAAI,QAAqD;AAEzE,SAAS,mBACR,QACA,UACU;AACV,MAAI,OAAO,SAAS;AACnB,WACC,SAAS,gBAAgB,sBACxB,SAAS,gBAAgB,mCACzB,SAAS,uBAAuB,UAChC,kBAAkB,SAAS,oBAAoB,OAAO,OAAO;AAEhE,SAAO,SAAS,gBAAgB;AACjC;AAEA,SAAS,eACR,QACA,UACoB;AACpB,QAAM,UAAoB,CAAC;AAC3B,MAAI,CAAC,mBAAmB,QAAQ,QAAQ;AACvC,YAAQ,KAAK,qDAAqD;AACnE,MAAI,SAAS,cAAc;AAC1B,YAAQ,KAAK,gBAAgB,SAAS,SAAS,EAAE;AAClD,MAAI,SAAS,sBAAsB;AAClC,YAAQ,KAAK,yBAAyB,SAAS,iBAAiB,EAAE;AACnE,MAAI,SAAS,uBAAuB;AACnC,YAAQ,KAAK,+BAA+B;AAC7C,MACC,OAAO,SAAS,aAChB,SAAS,gBAAgB;AAEzB,YAAQ;AAAA,MACP,SAAS,gBAAgB,uBACxB,SAAS,yBAAyB,SAChC,6CAA6C,SAAS,qBAAqB,IAAI,IAAI,SAAS,qBAAqB,UAAU,YAAY,IAAI,SAAS,qBAAqB,IAAI,KAC7K,SAAS,gBAAgB,iBACzB,SAAS,sBAAsB,SAC9B,uCAAuC,SAAS,iBAAiB,KACjE,0BAA0B,SAAS,eAAe,aAAa;AAAA,IACpE;AACD,MAAI,SAAS,kBAAkB;AAC9B,YAAQ,KAAK,qBAAqB,SAAS,aAAa,EAAE;AAC3D,SAAO;AACR;AAMO,SAAS,0BACf,QACA,UACsB;AACtB,QAAM,UAAU,eAAe,QAAQ,QAAQ;AAC/C,MAAI,QAAQ,SAAS;AACpB,WAAO,EAAE,MAAM,gCAAgC,QAAQ,QAAQ;AAChE,QAAM,SAAS,OAAO,OAAO,CAAC,CAAC;AAC/B,UAAQ;AAAA,IACP;AAAA,IACA,OAAO,SAAS,aAAa,OAAO,kBAAkB,SACnD,EAAE,eAAe,OAAO,cAAc,IACtC,CAAC;AAAA,EACL;AACA,SAAO,EAAE,MAAM,kCAAkC,QAAQ,OAAO;AACjE;AAGO,SAAS,6BACf,QACU;AACV,SAAO,QAAQ,IAAI,MAAM;AAC1B;AAiBO,SAAS,6BAA6B,OAQW;AACvD,MAAI,CAAC,6BAA6B,MAAM,SAAS,MAAM,GAAG;AACzD,WAAO;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,IACT;AAAA,EACD;AACA,MACC,CAAC;AAAA,IACA,MAAM,SAAS,OAAO;AAAA,IACtB,MAAM,UAAU,KAAK;AAAA,EACtB,GACC;AACD,WAAO;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,IACT;AAAA,EACD;AACA,QAAM,WAAW,kBAAkB,MAAM,SAAS;AAClD,MAAI,SAAS,SAAS,yBAA0B,QAAO;AACvD,SAAO,EAAE,GAAG,UAAU,mBAAmB,MAAM,SAAS,OAAO;AAChE;AAGO,SAAS,iCAAiC,OAMY;AAC5D,MAAI,CAAC,6BAA6B,MAAM,SAAS,MAAM;AACtD,WAAO;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,IACT;AACD,MACC,CAAC,kBAAkB,MAAM,SAAS,OAAO,SAAS,MAAM,MAAM,KAAK,OAAO;AAE1E,WAAO;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,IACT;AACD,SAAO,EAAE,GAAG,MAAM,OAAO,mBAAmB,MAAM,SAAS,OAAO;AACnE;","names":[]}
1
+ {"version":3,"sources":["../src/transition/destructive-authority.ts"],"sourcesContent":["import type {\n\tAdmittedOutcomeClaim,\n\tDestructiveAction,\n\tDestructiveAuthorityEvidence,\n\tDestructiveAuthorityPermit,\n\tDestructiveDecision,\n\tOutcomeClaimAdmission,\n\tOutcomeClaimAdmissionInput,\n\tOutcomeProtocolRefusal,\n} from '@dbsp/types';\nimport { sameLedgerAddress } from '@dbsp/types';\nimport { admitOutcomeClaim } from './outcome-protocol.js';\n\nconst permits = new WeakMap<object, { readonly closureDigest?: string }>();\n\nfunction declarationPermits(\n\taction: DestructiveAction,\n\tevidence: DestructiveAuthorityEvidence,\n): boolean {\n\tif (action.kind === 'removal')\n\t\treturn (\n\t\t\tevidence.declaration === 'requires-removal' ||\n\t\t\t(evidence.declaration === 'replacement-requested-by-plan' &&\n\t\t\t\tevidence.replacementAddress !== undefined &&\n\t\t\t\tsameLedgerAddress(evidence.replacementAddress, action.address))\n\t\t);\n\treturn evidence.declaration === 'requires-lossy-change';\n}\n\nfunction refusalReasons(\n\taction: DestructiveAction,\n\tevidence: DestructiveAuthorityEvidence,\n): readonly string[] {\n\tconst reasons: string[] = [];\n\tif (!declarationPermits(action, evidence))\n\t\treasons.push('declaration does not permit this destructive action');\n\tif (evidence.ownership !== 'managed-by-me')\n\t\treasons.push(`ownership is ${evidence.ownership}`);\n\tif (evidence.catalogueIdentity !== 'matches-recorded')\n\t\treasons.push(`catalogue identity is ${evidence.catalogueIdentity}`);\n\tif (evidence.operatorAcceptance !== 'destructive-plan-accepted')\n\t\treasons.push('operator acceptance is absent');\n\tif (\n\t\taction.kind === 'removal' &&\n\t\tevidence.containment !== 'all-contained-or-managed'\n\t)\n\t\treasons.push(\n\t\t\tevidence.containment === 'reaches-unmanaged' &&\n\t\t\t\tevidence.containmentUnmanaged !== undefined\n\t\t\t\t? `containment closure is reaches-unmanaged: ${evidence.containmentUnmanaged.kind} ${evidence.containmentUnmanaged.schema ?? '<database>'}.${evidence.containmentUnmanaged.name}`\n\t\t\t\t: evidence.containment === 'undecidable' &&\n\t\t\t\t\t\tevidence.containmentReason !== undefined\n\t\t\t\t\t? `containment closure is undecidable: ${evidence.containmentReason}`\n\t\t\t\t\t: `containment closure is ${evidence.containment ?? 'undecidable'}`,\n\t\t);\n\tif (evidence.ledgerLineage !== 'matches-database')\n\t\treasons.push(`ledger lineage is ${evidence.ledgerLineage}`);\n\treturn reasons;\n}\n\n/**\n * The total destructive classifier produces a decision for every evidence\n * tuple; only its permitting cells produce positive destructive authority.\n */\nexport function decideDestructiveDecision(\n\taction: DestructiveAction,\n\tevidence: DestructiveAuthorityEvidence,\n): DestructiveDecision {\n\tconst reasons = refusalReasons(action, evidence);\n\tif (reasons.length > 0)\n\t\treturn { kind: 'destructive-decision-refused', action, reasons };\n\tconst permit = Object.freeze({}) as DestructiveAuthorityPermit;\n\tpermits.set(\n\t\tpermit,\n\t\taction.kind === 'removal' && action.closureDigest !== undefined\n\t\t\t? { closureDigest: action.closureDigest }\n\t\t\t: {},\n\t);\n\treturn { kind: 'destructive-decision-permitted', action, permit };\n}\n\n/** Runtime defense for the erased opaque type at adapter boundaries. */\nexport function isDestructiveAuthorityPermit(\n\tpermit: DestructiveAuthorityPermit,\n): boolean {\n\treturn permits.has(permit);\n}\n\n/** The adapter compares this immutable admission set after taking its locks. */\nexport function closureDigestForDestructiveAuthorityPermit(\n\tpermit: DestructiveAuthorityPermit,\n): string | undefined {\n\treturn permits.get(permit)?.closureDigest;\n}\n\n/**\n * Couples the positive authority result to the existing single token producer.\n * The adapter's destructive emitter accepts this value, never raw evidence.\n */\nexport type AdmittedDestructiveOutcomeClaim = AdmittedOutcomeClaim & {\n\treadonly destructivePermit: DestructiveAuthorityPermit;\n};\n\nexport function admitDestructiveOutcomeClaim(input: {\n\treadonly decision: Extract<\n\t\tDestructiveDecision,\n\t\t{ readonly kind: 'destructive-decision-permitted' }\n\t>;\n\treadonly admission: OutcomeClaimAdmissionInput;\n}):\n\t| AdmittedDestructiveOutcomeClaim\n\t| Exclude<OutcomeClaimAdmission, AdmittedOutcomeClaim> {\n\tif (!isDestructiveAuthorityPermit(input.decision.permit)) {\n\t\treturn {\n\t\t\tkind: 'outcome-protocol-refused',\n\t\t\treason: 'destructive authority permit was not minted by the interpreter',\n\t\t};\n\t}\n\tif (\n\t\t!sameLedgerAddress(\n\t\t\tinput.decision.action.address,\n\t\t\tinput.admission.plan.address,\n\t\t)\n\t) {\n\t\treturn {\n\t\t\tkind: 'outcome-protocol-refused',\n\t\t\treason: 'destructive authority address does not match the claim address',\n\t\t};\n\t}\n\tconst admitted = admitOutcomeClaim(input.admission);\n\tif (admitted.kind !== 'admitted-outcome-claim') return admitted;\n\treturn { ...admitted, destructivePermit: input.decision.permit };\n}\n\n/** Attach a real interpreter permit to an adapter-opened, already minted claim. */\nexport function attachDestructiveAuthorityPermit(input: {\n\treadonly decision: Extract<\n\t\tDestructiveDecision,\n\t\t{ readonly kind: 'destructive-decision-permitted' }\n\t>;\n\treadonly claim: AdmittedOutcomeClaim;\n}): AdmittedDestructiveOutcomeClaim | OutcomeProtocolRefusal {\n\tif (!isDestructiveAuthorityPermit(input.decision.permit))\n\t\treturn {\n\t\t\tkind: 'outcome-protocol-refused',\n\t\t\treason: 'destructive authority permit was not minted by the interpreter',\n\t\t};\n\tif (\n\t\t!sameLedgerAddress(input.decision.action.address, input.claim.plan.address)\n\t)\n\t\treturn {\n\t\t\tkind: 'outcome-protocol-refused',\n\t\t\treason: 'destructive authority address does not match the claim address',\n\t\t};\n\treturn { ...input.claim, destructivePermit: input.decision.permit };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,yBAAyB;AAGlC,IAAM,UAAU,oBAAI,QAAqD;AAEzE,SAAS,mBACR,QACA,UACU;AACV,MAAI,OAAO,SAAS;AACnB,WACC,SAAS,gBAAgB,sBACxB,SAAS,gBAAgB,mCACzB,SAAS,uBAAuB,UAChC,kBAAkB,SAAS,oBAAoB,OAAO,OAAO;AAEhE,SAAO,SAAS,gBAAgB;AACjC;AAEA,SAAS,eACR,QACA,UACoB;AACpB,QAAM,UAAoB,CAAC;AAC3B,MAAI,CAAC,mBAAmB,QAAQ,QAAQ;AACvC,YAAQ,KAAK,qDAAqD;AACnE,MAAI,SAAS,cAAc;AAC1B,YAAQ,KAAK,gBAAgB,SAAS,SAAS,EAAE;AAClD,MAAI,SAAS,sBAAsB;AAClC,YAAQ,KAAK,yBAAyB,SAAS,iBAAiB,EAAE;AACnE,MAAI,SAAS,uBAAuB;AACnC,YAAQ,KAAK,+BAA+B;AAC7C,MACC,OAAO,SAAS,aAChB,SAAS,gBAAgB;AAEzB,YAAQ;AAAA,MACP,SAAS,gBAAgB,uBACxB,SAAS,yBAAyB,SAChC,6CAA6C,SAAS,qBAAqB,IAAI,IAAI,SAAS,qBAAqB,UAAU,YAAY,IAAI,SAAS,qBAAqB,IAAI,KAC7K,SAAS,gBAAgB,iBACzB,SAAS,sBAAsB,SAC9B,uCAAuC,SAAS,iBAAiB,KACjE,0BAA0B,SAAS,eAAe,aAAa;AAAA,IACpE;AACD,MAAI,SAAS,kBAAkB;AAC9B,YAAQ,KAAK,qBAAqB,SAAS,aAAa,EAAE;AAC3D,SAAO;AACR;AAMO,SAAS,0BACf,QACA,UACsB;AACtB,QAAM,UAAU,eAAe,QAAQ,QAAQ;AAC/C,MAAI,QAAQ,SAAS;AACpB,WAAO,EAAE,MAAM,gCAAgC,QAAQ,QAAQ;AAChE,QAAM,SAAS,OAAO,OAAO,CAAC,CAAC;AAC/B,UAAQ;AAAA,IACP;AAAA,IACA,OAAO,SAAS,aAAa,OAAO,kBAAkB,SACnD,EAAE,eAAe,OAAO,cAAc,IACtC,CAAC;AAAA,EACL;AACA,SAAO,EAAE,MAAM,kCAAkC,QAAQ,OAAO;AACjE;AAGO,SAAS,6BACf,QACU;AACV,SAAO,QAAQ,IAAI,MAAM;AAC1B;AAiBO,SAAS,6BAA6B,OAQW;AACvD,MAAI,CAAC,6BAA6B,MAAM,SAAS,MAAM,GAAG;AACzD,WAAO;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,IACT;AAAA,EACD;AACA,MACC,CAAC;AAAA,IACA,MAAM,SAAS,OAAO;AAAA,IACtB,MAAM,UAAU,KAAK;AAAA,EACtB,GACC;AACD,WAAO;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,IACT;AAAA,EACD;AACA,QAAM,WAAW,kBAAkB,MAAM,SAAS;AAClD,MAAI,SAAS,SAAS,yBAA0B,QAAO;AACvD,SAAO,EAAE,GAAG,UAAU,mBAAmB,MAAM,SAAS,OAAO;AAChE;AAGO,SAAS,iCAAiC,OAMY;AAC5D,MAAI,CAAC,6BAA6B,MAAM,SAAS,MAAM;AACtD,WAAO;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,IACT;AACD,MACC,CAAC,kBAAkB,MAAM,SAAS,OAAO,SAAS,MAAM,MAAM,KAAK,OAAO;AAE1E,WAAO;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,IACT;AACD,SAAO,EAAE,GAAG,MAAM,OAAO,mBAAmB,MAAM,SAAS,OAAO;AACnE;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbsp/core",
3
- "version": "4.0.0",
3
+ "version": "6.0.0",
4
4
  "description": "Intent-first semantic query planner for databases — declare WHAT to fetch, the planner decides HOW",
5
5
  "author": "Olivier Orabona <oorabona@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -45,15 +45,15 @@
45
45
  "dist"
46
46
  ],
47
47
  "dependencies": {
48
- "valibot": "^1.4.2",
49
- "@dbsp/nql": "^1.10.4",
50
- "@dbsp/types": "^4.0.0"
48
+ "@dbsp/nql": "^2.0.0",
49
+ "@dbsp/types": "^6.0.0",
50
+ "valibot": "^1.4.2"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/node": "^26.1.0",
54
54
  "tsup": "^8.5.1",
55
55
  "typescript": "~6.0.3",
56
- "vitest": "^4.1.9"
56
+ "vitest": "^5.0.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup",