@dbsp/core 6.1.1 → 6.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{assertion-functions-D6t_OvBt.d.ts → assertion-functions-BcRg_kzj.d.ts} +7 -7
- package/dist/{chunk-DUIL3IMF.js → chunk-RIQOPLZ5.js} +484 -144
- package/dist/chunk-RIQOPLZ5.js.map +1 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +18 -3
- package/dist/internal.js +5 -1
- package/dist/internal.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-DUIL3IMF.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { ModelIR, ObservationContext, TransitionLessor, ApplyPolicy, ApplyResult
|
|
|
3
3
|
export { Adapter, AdapterLogger, AlterColumnOptions, AmbiguousIncludeError, Assumption, BaseAdapter, Cardinality, ColumnIR, ColumnType, CompileOptions, CompiledQuery, CompilingAdapter, CreateIndexOptions, DbCasing, DialectCapabilities, DropIndexOptions, Dump, ExecutingAdapter, IncludeStrategy, IndexColumnDef, IndexIR, IndexInfo, IndexMethod, IntrospectingAdapter, ModelIR, Optionality, PlanDecision, PlanOptions, PlanReport, PlanWarning, ProvenPlanStep, RangeValue, RawSqlAdapter, StreamingAdapter, TableIR, TransactionalAdapter, TruncateOptions, VacuumOptions } from '@dbsp/types';
|
|
4
4
|
import { IncludeIntent, SelectIntent, WhereIntent, AggregateIntent, OrderByIntent, JoinIntent, QueryIntent, WhereRangeIntent } from '@dbsp/types/internal';
|
|
5
5
|
export { AggregateExpressionIntent, AggregateIntent, ExpressionIntent, IncludeIntent, InsertFromIntent, InsertIntent, JoinIntent, MutationIntent, OrderByIntent, QueryIntent, RecursiveIntent, SelectAggregateIntent, SelectFieldsIntent, SelectIntent, SelectWithExpressionsIntent, SubqueryRefIntent, UpsertFromIntent, WhereAndIntent, WhereComparisonIntent, WhereInIntent, WhereIntent, WhereLikeIntent, WhereNotIntent, WhereNullIntent, WhereOrIntent, WhereRangeIntent, WindowIntent, isDeleteIntent, isInsertIntent, isUpdateIntent, isUpsertIntent } from '@dbsp/types/internal';
|
|
6
|
-
import { P as PackRegistry, T as TransitionRunPersister, R as RecursiveIncludeOptions, D as DefaultFilters, H as HookStore, a as HookErrorHandler, O as ObserverErrorHandler, Q as QueryBuilder, b as RelationHints, I as IncludeOptionsWithRecursive, A as AliasedExprColumn, C as ColumnSpec, c as AggregateOptions, d as DistinctField, e as OrderByRecord, f as OrderBySpec, E as ExpressionRef, g as ExpressionSpec, N as NullsPosition, h as PredicateRef, W as WhereFilter, B as BatchValuesRef, i as DumpMetaInput, S as StreamOptions, j as PaginateOptions, k as PaginatedResult, l as CursorPaginateOptions, m as CursorPaginatedResult, n as SetOperationBuilder, o as TableRef, p as ColumnRef, q as InsertBuilder, U as UpdateBuilder, r as DeleteBuilder, s as UpsertBuilder, t as InferTableRow, L as ListHierarchyOptions, u as NqlTag, v as BatchValuesOptions, w as Schema, x as SchemaDefinition, y as InferDB, z as PredicateExpressionRef, F as AssertionBlock, G as AssertionQueryResult, J as AssertionSummary, K as HookManager } from './assertion-functions-
|
|
7
|
-
export { M as AfterMutationHook, V as AfterMutationObserver, X as AfterQueryHook, Y as AfterQueryObserver, Z as AmbiguousPlanError, _ as Assertion, $ as AssertionOutcome, a0 as BeforeMutationHook, a1 as BeforeQueryHook, a2 as ColumnDef, a3 as IncludeOptions, a4 as IntentSummary, a5 as JsonValue, a6 as ManyToManyDefinition, a7 as ManyToManyOptions, a8 as MutationDump, a9 as MutationHookContext, aa as NqlBuilder, ab as OnErrorHook, ac as POSTGRESQL_CAPABILITIES, ad as ParseError, ae as ParseResult, af as QueryAssertionResult, ag as QueryHookContext, ah as RefOptions, ai as RelationRef, aj as SchemaColumnType, ak as SchemaIndexOptions, al as SchemaOptions, am as SchemaTableOptions, an as SelfRefRoles, ao as SqlRawExpression, ap as SubqueryBuilder, aq as SubqueryExpression, ar as TABLE_META, as as TableDef, at as admitRecordedIdentity, au as aggOrderBy, av as and, aw as any, ax as array, ay as arrayAgg, az as assertEquals, aA as assertParamsEquals, aB as assertParamsType, aC as assertSQLEquals, aD as batchValues, aE as boolFn, aF as cast, aG as coalesce, aH as col, aI as createHookManager, aJ as distinct, aK as eq, aL as every, aM as exists, aN as exprRef, aO as extractPseudoColumnKeywords, aP as fn, aQ as getSchemaFromDb, aR as gt, aS as gte, aT as inArray, aU as inSubquery, aV as isBatchValuesRef, aW as isDistinctFrom, aX as isNotNull, aY as isNull, aZ as isOperationRuntime, a_ as isRef, a$ as isSqlRaw, b0 as like, b1 as literal, b2 as lt, b3 as lte, b4 as manyToMany, b5 as namedArg, b6 as neq, b7 as none, b8 as not, b9 as notExists, ba as nqlRaw, bb as op, bc as or, bd as outerRef, be as param, bf as parseAssertionFile, bg as plan, bh as planRecursive, bi as raw, bj as rawExists, bk as ref, bl as relationColumn, bm as schema, bn as some, bo as sql, bp as star, bq as subquery, br as unary, bs as unsafeAsPredicate, bt as validateAssertionBlocks } from './assertion-functions-
|
|
6
|
+
import { P as PackRegistry, T as TransitionRunPersister, R as RecursiveIncludeOptions, D as DefaultFilters, H as HookStore, a as HookErrorHandler, O as ObserverErrorHandler, Q as QueryBuilder, b as RelationHints, I as IncludeOptionsWithRecursive, A as AliasedExprColumn, C as ColumnSpec, c as AggregateOptions, d as DistinctField, e as OrderByRecord, f as OrderBySpec, E as ExpressionRef, g as ExpressionSpec, N as NullsPosition, h as PredicateRef, W as WhereFilter, B as BatchValuesRef, i as DumpMetaInput, S as StreamOptions, j as PaginateOptions, k as PaginatedResult, l as CursorPaginateOptions, m as CursorPaginatedResult, n as SetOperationBuilder, o as TableRef, p as ColumnRef, q as InsertBuilder, U as UpdateBuilder, r as DeleteBuilder, s as UpsertBuilder, t as InferTableRow, L as ListHierarchyOptions, u as NqlTag, v as BatchValuesOptions, w as Schema, x as SchemaDefinition, y as InferDB, z as PredicateExpressionRef, F as AssertionBlock, G as AssertionQueryResult, J as AssertionSummary, K as HookManager } from './assertion-functions-BcRg_kzj.js';
|
|
7
|
+
export { M as AfterMutationHook, V as AfterMutationObserver, X as AfterQueryHook, Y as AfterQueryObserver, Z as AmbiguousPlanError, _ as Assertion, $ as AssertionOutcome, a0 as BeforeMutationHook, a1 as BeforeQueryHook, a2 as ColumnDef, a3 as IncludeOptions, a4 as IntentSummary, a5 as JsonValue, a6 as ManyToManyDefinition, a7 as ManyToManyOptions, a8 as MutationDump, a9 as MutationHookContext, aa as NqlBuilder, ab as OnErrorHook, ac as POSTGRESQL_CAPABILITIES, ad as ParseError, ae as ParseResult, af as QueryAssertionResult, ag as QueryHookContext, ah as RefOptions, ai as RelationRef, aj as SchemaColumnType, ak as SchemaIndexOptions, al as SchemaOptions, am as SchemaTableOptions, an as SelfRefRoles, ao as SqlRawExpression, ap as SubqueryBuilder, aq as SubqueryExpression, ar as TABLE_META, as as TableDef, at as admitRecordedIdentity, au as aggOrderBy, av as and, aw as any, ax as array, ay as arrayAgg, az as assertEquals, aA as assertParamsEquals, aB as assertParamsType, aC as assertSQLEquals, aD as batchValues, aE as boolFn, aF as cast, aG as coalesce, aH as col, aI as createHookManager, aJ as distinct, aK as eq, aL as every, aM as exists, aN as exprRef, aO as extractPseudoColumnKeywords, aP as fn, aQ as getSchemaFromDb, aR as gt, aS as gte, aT as inArray, aU as inSubquery, aV as isBatchValuesRef, aW as isDistinctFrom, aX as isNotNull, aY as isNull, aZ as isOperationRuntime, a_ as isRef, a$ as isSqlRaw, b0 as like, b1 as literal, b2 as lt, b3 as lte, b4 as manyToMany, b5 as namedArg, b6 as neq, b7 as none, b8 as not, b9 as notExists, ba as nqlRaw, bb as op, bc as or, bd as outerRef, be as param, bf as parseAssertionFile, bg as plan, bh as planRecursive, bi as raw, bj as rawExists, bk as ref, bl as relationColumn, bm as schema, bn as some, bo as sql, bp as star, bq as subquery, br as unary, bs as unsafeAsPredicate, bt as validateAssertionBlocks } from './assertion-functions-BcRg_kzj.js';
|
|
8
8
|
import '@dbsp/nql';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -90,12 +90,10 @@ declare class ModelIRImpl implements ModelIR {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* Include-intent helpers: convert include options to IncludeIntent, parse
|
|
94
|
+
* dot-notation include paths, and validate recursive includes.
|
|
94
95
|
*
|
|
95
|
-
*
|
|
96
|
-
* from execution, hydration, and other concerns.
|
|
97
|
-
*
|
|
98
|
-
* @module intent-builder
|
|
96
|
+
* @module include-intent
|
|
99
97
|
*/
|
|
100
98
|
|
|
101
99
|
/**
|
package/dist/index.js
CHANGED
package/dist/internal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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
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-
|
|
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-
|
|
3
|
+
import { P as PackRegistry, T as TransitionRunPersister, bu as Applier, bv as InProcessProvenPlan, bw as Prover } from './assertion-functions-BcRg_kzj.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-BcRg_kzj.js';
|
|
5
5
|
export { CaseExpressionIntent, CompileOnlyAdapter, ConnectionAvailability, DeleteIntent, LiteralExpressionIntent, PartitionIR, RequiredEnumLabelIR, SelectAllIntent, UpdateIntent, UpsertIntent, WhereAnyIntent, WhereExistsIntent, WhereNotExistsIntent, WhereRelationFilterIntent, WhereSubqueryIntent, isSubqueryRef } from '@dbsp/types/internal';
|
|
6
6
|
import '@dbsp/nql';
|
|
7
7
|
|
|
@@ -291,6 +291,21 @@ declare function inspectMutationRows(rows: readonly Record<string, unknown>[], o
|
|
|
291
291
|
rowKeys: ReadonlySet<string>[];
|
|
292
292
|
};
|
|
293
293
|
|
|
294
|
+
/**
|
|
295
|
+
* The refusal of a table-rooted quantifier read from a body that is not the
|
|
296
|
+
* single visible range of its table (#991).
|
|
297
|
+
*
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
declare function refuseTableRootedQuantifier(relation: unknown): never;
|
|
301
|
+
/**
|
|
302
|
+
* Refuse a `pathRef` leaf below a body boundary in one top-level
|
|
303
|
+
* condition (a mutation WHERE or guard, a recursive `start.where`).
|
|
304
|
+
*
|
|
305
|
+
* @internal
|
|
306
|
+
*/
|
|
307
|
+
declare function assertNoPathRefInConditionBodies(condition: unknown): void;
|
|
308
|
+
|
|
294
309
|
declare function getRelationalReadPlan(intent: QueryIntent, queryLocalSource?: boolean): PlanReport | undefined;
|
|
295
310
|
|
|
296
311
|
/** One traversal, with one shared allocator and no reconstruction of ancestor name sets. */
|
|
@@ -327,4 +342,4 @@ type RelationPathUsage = {
|
|
|
327
342
|
declare function deriveRelationPathFromIntentPath(includes: readonly unknown[] | undefined, intentPath: string | undefined, fallbackRelation: string | undefined): string | undefined;
|
|
328
343
|
declare function countDistinctRelationPathsByName(usages: readonly RelationPathUsage[]): Map<string, number>;
|
|
329
344
|
|
|
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 };
|
|
345
|
+
export { type AdmittedDestructiveOutcomeClaim, EnumNameMapKeyMismatchError, InProcessProvenPlan, PackRegistry, TransitionRunPersister, type ValidatedManagedStepManifest, admitDestructiveOutcomeClaim, admitOutcomeClaim, advisoryObservationId, assertDeclaredEnumMapIdentity, assertNoPathRefInConditionBodies, 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, refuseTableRootedQuantifier, resolveEnumSchemaForComparison, resolveReportIncludes, resolveSelectWhere, resourceScopeCovers, selectorMatchesResource, semanticArtifactId, supportsExecution, supportsStreaming, supportsTransactions, transitionPlanDigest, validateNormalizedManagedStepManifest, validateTransitionRelationalInvariants };
|
package/dist/internal.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
assertIntentType,
|
|
29
29
|
assertIntentWith,
|
|
30
30
|
assertMatches,
|
|
31
|
+
assertNoPathRefInConditionBodies,
|
|
31
32
|
assertParamsLength,
|
|
32
33
|
assertParamsValue,
|
|
33
34
|
assertSQLColumn,
|
|
@@ -89,6 +90,7 @@ import {
|
|
|
89
90
|
planOperationSession,
|
|
90
91
|
projectLedgerChain,
|
|
91
92
|
rawNotExists,
|
|
93
|
+
refuseTableRootedQuantifier,
|
|
92
94
|
requiresDatabase,
|
|
93
95
|
resolveEnumSchemaForComparison,
|
|
94
96
|
resolveQueryIndex,
|
|
@@ -116,7 +118,7 @@ import {
|
|
|
116
118
|
validateSchemaIndexOptions,
|
|
117
119
|
validateTransitionRelationalInvariants,
|
|
118
120
|
validateTypeName
|
|
119
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-RIQOPLZ5.js";
|
|
120
122
|
|
|
121
123
|
// src/transition/destructive-authority.ts
|
|
122
124
|
import { sameLedgerAddress } from "@dbsp/types";
|
|
@@ -223,6 +225,7 @@ export {
|
|
|
223
225
|
assertIntentType,
|
|
224
226
|
assertIntentWith,
|
|
225
227
|
assertMatches,
|
|
228
|
+
assertNoPathRefInConditionBodies,
|
|
226
229
|
assertParamsLength,
|
|
227
230
|
assertParamsValue,
|
|
228
231
|
assertSQLColumn,
|
|
@@ -287,6 +290,7 @@ export {
|
|
|
287
290
|
planOperationSession,
|
|
288
291
|
projectLedgerChain,
|
|
289
292
|
rawNotExists,
|
|
293
|
+
refuseTableRootedQuantifier,
|
|
290
294
|
requiresDatabase,
|
|
291
295
|
resolveEnumSchemaForComparison,
|
|
292
296
|
resolveQueryIndex,
|
package/dist/internal.js.map
CHANGED
|
@@ -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":"
|
|
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": "6.1.
|
|
3
|
+
"version": "6.1.2",
|
|
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,8 +45,8 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@dbsp/nql": "^2.0.
|
|
49
|
-
"@dbsp/types": "^6.1.
|
|
48
|
+
"@dbsp/nql": "^2.0.2",
|
|
49
|
+
"@dbsp/types": "^6.1.1",
|
|
50
50
|
"valibot": "^1.4.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|