@dbsp/core 3.2.0 → 3.4.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/dist/index.d.ts +149 -20
- package/dist/index.js +836 -270
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3022,9 +3022,6 @@ function generateJoinReasoning(relation, joinType, _hasFilter) {
|
|
|
3022
3022
|
return `Relation ${relation.source}.${relation.name} is optional without filter - using LEFT JOIN to preserve parent rows without matches`;
|
|
3023
3023
|
}
|
|
3024
3024
|
|
|
3025
|
-
// src/transition/applier.ts
|
|
3026
|
-
import { createHash as createHash3, randomUUID } from "crypto";
|
|
3027
|
-
|
|
3028
3025
|
// src/transition/context-match.ts
|
|
3029
3026
|
import { createHash } from "crypto";
|
|
3030
3027
|
|
|
@@ -3101,7 +3098,7 @@ function stableJsonInner(value, seen) {
|
|
|
3101
3098
|
return `array:[${entries2.join(",")}]`;
|
|
3102
3099
|
}
|
|
3103
3100
|
const tag = objectTag(value);
|
|
3104
|
-
const entries = Object.entries(value).sort(([left], [right]) => left
|
|
3101
|
+
const entries = Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(
|
|
3105
3102
|
([key, item]) => `${JSON.stringify(key)}:${stableJsonInner(item, seen)}`
|
|
3106
3103
|
);
|
|
3107
3104
|
return `${tag}:{${entries.join(",")}}`;
|
|
@@ -3308,6 +3305,10 @@ function plainDataError(kind, path) {
|
|
|
3308
3305
|
`a minted plan must be plain data; found ${kind} at ${path}`
|
|
3309
3306
|
);
|
|
3310
3307
|
}
|
|
3308
|
+
function isVisibleArrayIndex(value, key) {
|
|
3309
|
+
const index = Number(key);
|
|
3310
|
+
return String(index) === key && Number.isInteger(index) && index >= 0 && index < value.length;
|
|
3311
|
+
}
|
|
3311
3312
|
function assertPlainDataAndFreeze(value, path, seen) {
|
|
3312
3313
|
if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "undefined") {
|
|
3313
3314
|
return;
|
|
@@ -3363,6 +3364,12 @@ function assertPlainDataAndFreeze(value, path, seen) {
|
|
|
3363
3364
|
if ("get" in descriptor || "set" in descriptor) {
|
|
3364
3365
|
throw plainDataError("accessor", childPath(path, key));
|
|
3365
3366
|
}
|
|
3367
|
+
if (isPlainObject && !descriptor.enumerable) {
|
|
3368
|
+
throw plainDataError("non-enumerable property", childPath(path, key));
|
|
3369
|
+
}
|
|
3370
|
+
if (isPlainArray && key !== "length" && !isVisibleArrayIndex(value, key)) {
|
|
3371
|
+
throw plainDataError("named array property", childPath(path, key));
|
|
3372
|
+
}
|
|
3366
3373
|
assertPlainDataAndFreeze(descriptor.value, childPath(path, key), seen);
|
|
3367
3374
|
}
|
|
3368
3375
|
try {
|
|
@@ -3430,8 +3437,15 @@ function capabilityAvailable(descriptor, context) {
|
|
|
3430
3437
|
}
|
|
3431
3438
|
}
|
|
3432
3439
|
}
|
|
3440
|
+
var RETIRED_CONNECTION_OWNERSHIP_MEMBERS = ["checkout", "release"];
|
|
3441
|
+
function retiredConnectionOwnershipMember(value) {
|
|
3442
|
+
return RETIRED_CONNECTION_OWNERSHIP_MEMBERS.find((member) => member in value);
|
|
3443
|
+
}
|
|
3433
3444
|
function isOperationRuntime(semantics) {
|
|
3434
|
-
|
|
3445
|
+
if (retiredConnectionOwnershipMember(semantics) !== void 0) {
|
|
3446
|
+
return false;
|
|
3447
|
+
}
|
|
3448
|
+
return "writeIntentJournal" in semantics && "begin" in semantics && "setLockTimeout" in semantics && "acquireLocks" in semantics && "observeContext" in semantics && "observeOperation" in semantics && "checkGuard" in semantics && "executeOperation" in semantics && "writeCompletionJournal" in semantics && "commit" in semantics && "rollback" in semantics && "writeObservedJournal" in semantics && "isLockTimeout" in semantics;
|
|
3435
3449
|
}
|
|
3436
3450
|
function validateRulePrecedenceFacts(facts, rules) {
|
|
3437
3451
|
const rulesByKey = new Map(rules.map((rule) => [ruleKey(rule), rule]));
|
|
@@ -3574,6 +3588,12 @@ var PackRegistry = class {
|
|
|
3574
3588
|
compositionFactOwnerByKind.set(kind, owner);
|
|
3575
3589
|
};
|
|
3576
3590
|
for (const pack of packs) {
|
|
3591
|
+
const retiredMember = pack.executionCoordinator ? retiredConnectionOwnershipMember(pack.executionCoordinator) : void 0;
|
|
3592
|
+
if (retiredMember !== void 0) {
|
|
3593
|
+
throw new Error(
|
|
3594
|
+
`transition pack executionCoordinator declares retired connection ownership member ${retiredMember}`
|
|
3595
|
+
);
|
|
3596
|
+
}
|
|
3577
3597
|
const transactionDomain = pack.transactionDomain ?? pack.executionCoordinator?.transactionDomain;
|
|
3578
3598
|
if (pack.executionCoordinator && !transactionDomain) {
|
|
3579
3599
|
throw new Error(
|
|
@@ -3889,8 +3909,134 @@ function assumptionAccepted(assumption, policy) {
|
|
|
3889
3909
|
});
|
|
3890
3910
|
}
|
|
3891
3911
|
|
|
3892
|
-
// src/transition/
|
|
3912
|
+
// src/transition/plan-digest.ts
|
|
3893
3913
|
import { createHash as createHash2 } from "crypto";
|
|
3914
|
+
function transitionPlanDigest(plan2) {
|
|
3915
|
+
return createHash2("sha256").update(stableJson(plan2)).digest("hex");
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3918
|
+
// src/transition/transition-lessor.ts
|
|
3919
|
+
var TRANSITION_LESSOR_BRAND = /* @__PURE__ */ Symbol.for("dbsp.transition.lessor");
|
|
3920
|
+
var TRANSITION_LESSOR_PROTOCOL_VERSION = 1;
|
|
3921
|
+
var TRANSITION_LESSOR_REJECTION = "transition target must be a core-minted lessor";
|
|
3922
|
+
async function captureLease(value) {
|
|
3923
|
+
const { query, release } = leaseMembers(value);
|
|
3924
|
+
if (typeof query !== "function" || typeof release !== "function") {
|
|
3925
|
+
const rejection = new Error(
|
|
3926
|
+
"A transition lessor must acquire a lease exposing query() and release(). This acquisition returned an unusable member pair."
|
|
3927
|
+
);
|
|
3928
|
+
releaseMalformedAcquisition(value, release, rejection);
|
|
3929
|
+
throw rejection;
|
|
3930
|
+
}
|
|
3931
|
+
return {
|
|
3932
|
+
raw: value,
|
|
3933
|
+
query,
|
|
3934
|
+
release
|
|
3935
|
+
};
|
|
3936
|
+
}
|
|
3937
|
+
async function acquireTransitionLease(target) {
|
|
3938
|
+
const { raw: raw2, query, release } = await captureLease(await target.acquire());
|
|
3939
|
+
let closed = false;
|
|
3940
|
+
const session = Object.freeze({
|
|
3941
|
+
query: (sql2, params) => {
|
|
3942
|
+
if (closed) {
|
|
3943
|
+
return Promise.reject(
|
|
3944
|
+
new Error("transition lease was already given back")
|
|
3945
|
+
);
|
|
3946
|
+
}
|
|
3947
|
+
return query.call(raw2, sql2, params);
|
|
3948
|
+
}
|
|
3949
|
+
});
|
|
3950
|
+
const releaseLease = (failure) => {
|
|
3951
|
+
if (closed) {
|
|
3952
|
+
return Promise.resolve();
|
|
3953
|
+
}
|
|
3954
|
+
closed = true;
|
|
3955
|
+
try {
|
|
3956
|
+
const returned = failure ? release.call(raw2, releaseArgument(failure)) : release.call(raw2);
|
|
3957
|
+
void Promise.resolve(returned).catch(() => void 0);
|
|
3958
|
+
} catch {
|
|
3959
|
+
}
|
|
3960
|
+
return Promise.resolve();
|
|
3961
|
+
};
|
|
3962
|
+
return Object.freeze({
|
|
3963
|
+
session,
|
|
3964
|
+
release: releaseLease
|
|
3965
|
+
});
|
|
3966
|
+
}
|
|
3967
|
+
function leaseMembers(value) {
|
|
3968
|
+
if (value == null || typeof value !== "object" && typeof value !== "function") {
|
|
3969
|
+
return { query: void 0, release: void 0 };
|
|
3970
|
+
}
|
|
3971
|
+
const release = readMember(value, "release");
|
|
3972
|
+
return { query: readMember(value, "query"), release };
|
|
3973
|
+
}
|
|
3974
|
+
function readMember(value, member) {
|
|
3975
|
+
try {
|
|
3976
|
+
return value[member];
|
|
3977
|
+
} catch {
|
|
3978
|
+
return void 0;
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
function releaseMalformedAcquisition(value, release, rejection) {
|
|
3982
|
+
if (typeof release !== "function") {
|
|
3983
|
+
return;
|
|
3984
|
+
}
|
|
3985
|
+
try {
|
|
3986
|
+
void Promise.resolve(release.call(value, rejection)).catch(() => void 0);
|
|
3987
|
+
} catch {
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
function createTransitionLessor(acquire) {
|
|
3991
|
+
const lessor = { acquire };
|
|
3992
|
+
Object.defineProperty(lessor, TRANSITION_LESSOR_BRAND, {
|
|
3993
|
+
value: Object.freeze({
|
|
3994
|
+
protocolVersion: TRANSITION_LESSOR_PROTOCOL_VERSION
|
|
3995
|
+
}),
|
|
3996
|
+
writable: false,
|
|
3997
|
+
configurable: false
|
|
3998
|
+
});
|
|
3999
|
+
return Object.freeze(lessor);
|
|
4000
|
+
}
|
|
4001
|
+
function isTransitionLessor(value) {
|
|
4002
|
+
try {
|
|
4003
|
+
if (value == null || typeof value !== "object" && typeof value !== "function" || Array.isArray(value)) {
|
|
4004
|
+
return false;
|
|
4005
|
+
}
|
|
4006
|
+
const brand = value[TRANSITION_LESSOR_BRAND];
|
|
4007
|
+
return brand != null && typeof brand === "object" && brand.protocolVersion === TRANSITION_LESSOR_PROTOCOL_VERSION && typeof value.acquire === "function";
|
|
4008
|
+
} catch {
|
|
4009
|
+
return false;
|
|
4010
|
+
}
|
|
4011
|
+
}
|
|
4012
|
+
var TransitionLeaseFailureError = class extends Error {
|
|
4013
|
+
constructor(cause) {
|
|
4014
|
+
super("transition lease released after a failure", { cause });
|
|
4015
|
+
this.name = "TransitionLeaseFailureError";
|
|
4016
|
+
}
|
|
4017
|
+
};
|
|
4018
|
+
function releaseArgument(failure) {
|
|
4019
|
+
return failure.error ? failure.error : new TransitionLeaseFailureError(failure.error);
|
|
4020
|
+
}
|
|
4021
|
+
function transitionLessorRejectionAssessment(artifact, lifecycle = "planned") {
|
|
4022
|
+
return {
|
|
4023
|
+
decision: "blocked",
|
|
4024
|
+
assurance: "unproven",
|
|
4025
|
+
lifecycle,
|
|
4026
|
+
continuation: "human-intervention-required",
|
|
4027
|
+
reasons: [
|
|
4028
|
+
{
|
|
4029
|
+
code: "context-mismatch",
|
|
4030
|
+
artifact,
|
|
4031
|
+
fact: {
|
|
4032
|
+
key: "transition-lessor",
|
|
4033
|
+
value: TRANSITION_LESSOR_REJECTION
|
|
4034
|
+
},
|
|
4035
|
+
scope: []
|
|
4036
|
+
}
|
|
4037
|
+
]
|
|
4038
|
+
};
|
|
4039
|
+
}
|
|
3894
4040
|
|
|
3895
4041
|
// src/transition/validation.ts
|
|
3896
4042
|
function sameTrustRoot2(left, right) {
|
|
@@ -4560,8 +4706,24 @@ var RESUMER_ARTIFACT = {
|
|
|
4560
4706
|
id: semanticArtifactId("dbsp.core.transition.resume"),
|
|
4561
4707
|
version: "0.1.0"
|
|
4562
4708
|
};
|
|
4563
|
-
function
|
|
4564
|
-
|
|
4709
|
+
function deepFreeze(value) {
|
|
4710
|
+
if (value !== null && typeof value === "object") {
|
|
4711
|
+
for (const child of Object.values(value)) {
|
|
4712
|
+
deepFreeze(child);
|
|
4713
|
+
}
|
|
4714
|
+
Object.freeze(value);
|
|
4715
|
+
}
|
|
4716
|
+
return value;
|
|
4717
|
+
}
|
|
4718
|
+
function snapshotLoadedRun(value) {
|
|
4719
|
+
const serialized = JSON.stringify(value);
|
|
4720
|
+
if (serialized === void 0) {
|
|
4721
|
+
throw new Error("loaded transition journal is not JSON serializable");
|
|
4722
|
+
}
|
|
4723
|
+
return deepFreeze(JSON.parse(serialized));
|
|
4724
|
+
}
|
|
4725
|
+
function errorDetail(error) {
|
|
4726
|
+
return error instanceof Error ? error.message : "unknown error";
|
|
4565
4727
|
}
|
|
4566
4728
|
function planEvidenceContext(plan2) {
|
|
4567
4729
|
return plan2.observations.find(
|
|
@@ -4592,7 +4754,7 @@ function completedAssessment() {
|
|
|
4592
4754
|
]
|
|
4593
4755
|
};
|
|
4594
4756
|
}
|
|
4595
|
-
function contextMismatch(detail) {
|
|
4757
|
+
function contextMismatch(detail, journals = [], observations = []) {
|
|
4596
4758
|
return {
|
|
4597
4759
|
assessment: assessment(
|
|
4598
4760
|
{
|
|
@@ -4602,11 +4764,11 @@ function contextMismatch(detail) {
|
|
|
4602
4764
|
scope: [],
|
|
4603
4765
|
detail
|
|
4604
4766
|
},
|
|
4605
|
-
"
|
|
4767
|
+
"outcome-unknown",
|
|
4606
4768
|
"replan-required"
|
|
4607
4769
|
),
|
|
4608
|
-
journals
|
|
4609
|
-
observations
|
|
4770
|
+
journals,
|
|
4771
|
+
observations
|
|
4610
4772
|
};
|
|
4611
4773
|
}
|
|
4612
4774
|
function unacceptedStepAssumption(plan2, step, assumption) {
|
|
@@ -4787,6 +4949,11 @@ function latestIntent(step, events) {
|
|
|
4787
4949
|
recordedAt: recordedAt()
|
|
4788
4950
|
};
|
|
4789
4951
|
}
|
|
4952
|
+
function orderedPlanSteps(plan2, stepById) {
|
|
4953
|
+
return plan2.segments.flatMap(
|
|
4954
|
+
(segment) => segment.stepIds.map((stepId2) => stepById.get(stepId2)).filter((step) => step !== void 0)
|
|
4955
|
+
);
|
|
4956
|
+
}
|
|
4790
4957
|
function resumeRequiredResult(params) {
|
|
4791
4958
|
const hasCompleted = params.completed.length > 0;
|
|
4792
4959
|
return {
|
|
@@ -4925,80 +5092,71 @@ function completedJournal(intent, completion, observations) {
|
|
|
4925
5092
|
observedOutcome
|
|
4926
5093
|
};
|
|
4927
5094
|
}
|
|
4928
|
-
async function
|
|
5095
|
+
async function withObservedStep(registry, step, target, baseContext, phase, use) {
|
|
4929
5096
|
const resolution = registry.resolveOperation(step.operation);
|
|
4930
5097
|
if (!resolution.ok || !isOperationRuntime(resolution.semantics)) {
|
|
4931
|
-
return { ok: false, detail: "operation runtime missing" };
|
|
5098
|
+
return use({ ok: false, detail: "operation runtime missing" });
|
|
4932
5099
|
}
|
|
4933
5100
|
const runtime = resolution.semantics;
|
|
4934
5101
|
const issuer = registry.resolveIssuer(step.operation.operationKind.artifact);
|
|
4935
5102
|
if (!issuer) {
|
|
4936
|
-
return { ok: false, detail: "operation observation issuer missing" };
|
|
5103
|
+
return use({ ok: false, detail: "operation observation issuer missing" });
|
|
4937
5104
|
}
|
|
4938
|
-
let
|
|
5105
|
+
let lease;
|
|
5106
|
+
let failed = false;
|
|
5107
|
+
let failure;
|
|
4939
5108
|
try {
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
);
|
|
4946
|
-
context = registry.contextWithDerivedCapabilities(context);
|
|
4947
|
-
const liveContextMatch = matchLiveObservationContext({
|
|
4948
|
-
expected: baseContext,
|
|
4949
|
-
actual: context
|
|
4950
|
-
});
|
|
4951
|
-
if (!liveContextMatch.ok) {
|
|
4952
|
-
await runtimeSafeRelease(runtime, client);
|
|
4953
|
-
return { ok: false, detail: liveContextMatch.detail };
|
|
4954
|
-
}
|
|
4955
|
-
const observed = await runtime.observeOperation(
|
|
4956
|
-
client,
|
|
4957
|
-
step.operation,
|
|
4958
|
-
context,
|
|
4959
|
-
phase,
|
|
4960
|
-
issuer
|
|
4961
|
-
);
|
|
4962
|
-
return {
|
|
4963
|
-
ok: true,
|
|
4964
|
-
observations: observed.observations,
|
|
4965
|
-
fingerprint: observed.fingerprint,
|
|
4966
|
-
client,
|
|
4967
|
-
runtime
|
|
4968
|
-
};
|
|
4969
|
-
} catch (error) {
|
|
4970
|
-
if (client) {
|
|
4971
|
-
await runtimeSafeRelease(
|
|
4972
|
-
resolution.ok && isOperationRuntime(resolution.semantics) ? resolution.semantics : void 0,
|
|
5109
|
+
let observation;
|
|
5110
|
+
try {
|
|
5111
|
+
lease = await acquireTransitionLease(target);
|
|
5112
|
+
const client = { opaqueClient: lease.session };
|
|
5113
|
+
let context = await runtime.observeContext(
|
|
4973
5114
|
client,
|
|
4974
|
-
|
|
5115
|
+
step.operation,
|
|
5116
|
+
baseContext
|
|
4975
5117
|
);
|
|
5118
|
+
context = registry.contextWithDerivedCapabilities(context);
|
|
5119
|
+
const liveContextMatch = matchLiveObservationContext({
|
|
5120
|
+
expected: baseContext,
|
|
5121
|
+
actual: context
|
|
5122
|
+
});
|
|
5123
|
+
if (!liveContextMatch.ok) {
|
|
5124
|
+
observation = { ok: false, detail: liveContextMatch.detail };
|
|
5125
|
+
} else {
|
|
5126
|
+
const observed = await runtime.observeOperation(
|
|
5127
|
+
client,
|
|
5128
|
+
step.operation,
|
|
5129
|
+
context,
|
|
5130
|
+
phase,
|
|
5131
|
+
issuer
|
|
5132
|
+
);
|
|
5133
|
+
observation = {
|
|
5134
|
+
ok: true,
|
|
5135
|
+
observations: observed.observations,
|
|
5136
|
+
fingerprint: observed.fingerprint,
|
|
5137
|
+
writeJournal: async (journal) => runtime.writeObservedJournal(client, journal)
|
|
5138
|
+
};
|
|
5139
|
+
}
|
|
5140
|
+
} catch (error) {
|
|
5141
|
+
failed = true;
|
|
5142
|
+
failure = error;
|
|
5143
|
+
observation = {
|
|
5144
|
+
ok: false,
|
|
5145
|
+
detail: errorDetail(error)
|
|
5146
|
+
};
|
|
5147
|
+
}
|
|
5148
|
+
try {
|
|
5149
|
+
return await use(observation);
|
|
5150
|
+
} catch (error) {
|
|
5151
|
+
failed = true;
|
|
5152
|
+
failure = error;
|
|
5153
|
+
throw error;
|
|
5154
|
+
}
|
|
5155
|
+
} finally {
|
|
5156
|
+
if (lease) {
|
|
5157
|
+
await lease.release(failed ? { error: failure } : void 0);
|
|
4976
5158
|
}
|
|
4977
|
-
return {
|
|
4978
|
-
ok: false,
|
|
4979
|
-
detail: error instanceof Error ? error.message : "observation failed"
|
|
4980
|
-
};
|
|
4981
|
-
}
|
|
4982
|
-
}
|
|
4983
|
-
async function runtimeSafeRelease(runtime, client, error) {
|
|
4984
|
-
if (!runtime) {
|
|
4985
|
-
return;
|
|
4986
|
-
}
|
|
4987
|
-
try {
|
|
4988
|
-
await runtime.release(client, error);
|
|
4989
|
-
} catch {
|
|
4990
|
-
}
|
|
4991
|
-
}
|
|
4992
|
-
async function releaseObservedAttempt(attempt, error) {
|
|
4993
|
-
if (attempt.ok) {
|
|
4994
|
-
await runtimeSafeRelease(attempt.runtime, attempt.client, error);
|
|
4995
|
-
}
|
|
4996
|
-
}
|
|
4997
|
-
async function writeObserved(attempt, journal) {
|
|
4998
|
-
if (!attempt.ok) {
|
|
4999
|
-
return;
|
|
5000
5159
|
}
|
|
5001
|
-
await attempt.runtime.writeObservedJournal(attempt.client, journal);
|
|
5002
5160
|
}
|
|
5003
5161
|
function stepAssumption(plan2, assumptionId2) {
|
|
5004
5162
|
return plan2.assumptions.find((assumption) => assumption.id === assumptionId2);
|
|
@@ -5012,68 +5170,51 @@ function validatePolicyForStep(plan2, step, policy) {
|
|
|
5012
5170
|
}
|
|
5013
5171
|
return void 0;
|
|
5014
5172
|
}
|
|
5015
|
-
async function
|
|
5016
|
-
|
|
5017
|
-
|
|
5173
|
+
async function resumeTransitionRunInternal(registry, input, runId, completed, observations) {
|
|
5174
|
+
let supplied;
|
|
5175
|
+
try {
|
|
5176
|
+
supplied = await input.loadCurrent(runId);
|
|
5177
|
+
} catch (error) {
|
|
5018
5178
|
return contextMismatch(
|
|
5019
|
-
|
|
5179
|
+
`transition run ${runId} could not be loaded: ${errorDetail(error)}`
|
|
5020
5180
|
);
|
|
5021
5181
|
}
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
kind: "plan",
|
|
5027
|
-
plan: loaded.plan
|
|
5028
|
-
});
|
|
5029
|
-
if (!diagnostic.ok) {
|
|
5182
|
+
let loaded;
|
|
5183
|
+
try {
|
|
5184
|
+
loaded = snapshotLoadedRun(supplied);
|
|
5185
|
+
} catch (error) {
|
|
5030
5186
|
return contextMismatch(
|
|
5031
|
-
`loaded
|
|
5187
|
+
`loaded journal could not be snapshotted safely: ${errorDetail(error)}`
|
|
5032
5188
|
);
|
|
5033
5189
|
}
|
|
5034
|
-
|
|
5035
|
-
if (!evidenceContext) {
|
|
5036
|
-
return contextMismatch("loaded plan contains no durable evidence context");
|
|
5037
|
-
}
|
|
5038
|
-
const baseContext = await input.readContext(input.target, loaded.run);
|
|
5039
|
-
const runContextMatch = matchRunObservationContext({
|
|
5040
|
-
run: loaded.run,
|
|
5041
|
-
actual: baseContext
|
|
5042
|
-
});
|
|
5043
|
-
if (!runContextMatch.ok) {
|
|
5044
|
-
return contextMismatch(runContextMatch.detail);
|
|
5045
|
-
}
|
|
5046
|
-
const evidenceIdentityMatch = matchObservationContextIdentity({
|
|
5047
|
-
expected: baseContext,
|
|
5048
|
-
actual: evidenceContext,
|
|
5049
|
-
label: "loaded plan evidence context"
|
|
5050
|
-
});
|
|
5051
|
-
if (!evidenceIdentityMatch.ok) {
|
|
5190
|
+
if (loaded.run.runId !== runId) {
|
|
5052
5191
|
return contextMismatch(
|
|
5053
|
-
|
|
5192
|
+
"loaded journal run id does not match requested run id"
|
|
5054
5193
|
);
|
|
5055
5194
|
}
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
return contextMismatch(effectsResolution.detail);
|
|
5195
|
+
let diagnostic;
|
|
5196
|
+
try {
|
|
5197
|
+
if (loaded.run.planDigest !== transitionPlanDigest(loaded.plan)) {
|
|
5198
|
+
return contextMismatch("loaded plan digest does not match run metadata");
|
|
5061
5199
|
}
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5200
|
+
diagnostic = validateTransitionRelationalInvariants({
|
|
5201
|
+
kind: "plan",
|
|
5202
|
+
plan: loaded.plan
|
|
5203
|
+
});
|
|
5204
|
+
} catch (error) {
|
|
5205
|
+
return contextMismatch(
|
|
5206
|
+
`loaded plan could not be validated: ${errorDetail(error)}`
|
|
5065
5207
|
);
|
|
5066
5208
|
}
|
|
5067
|
-
|
|
5068
|
-
kind: "plan",
|
|
5069
|
-
plan: loaded.plan,
|
|
5070
|
-
operationEffectsByRef
|
|
5071
|
-
});
|
|
5072
|
-
if (!semanticDiagnostic.ok) {
|
|
5209
|
+
if (!diagnostic.ok) {
|
|
5073
5210
|
return contextMismatch(
|
|
5074
|
-
`loaded plan failed
|
|
5211
|
+
`loaded plan failed invariant validation: ${diagnostic.detail}`
|
|
5075
5212
|
);
|
|
5076
5213
|
}
|
|
5214
|
+
const evidenceContext2 = planEvidenceContext(loaded.plan);
|
|
5215
|
+
if (!evidenceContext2) {
|
|
5216
|
+
return contextMismatch("loaded plan contains no durable evidence context");
|
|
5217
|
+
}
|
|
5077
5218
|
const referencedAssumptions = /* @__PURE__ */ new Set();
|
|
5078
5219
|
for (const step of loaded.plan.steps) {
|
|
5079
5220
|
for (const assumptionId2 of step.restsOnAssumptions) {
|
|
@@ -5101,11 +5242,76 @@ async function resumeTransitionRun(registry, input) {
|
|
|
5101
5242
|
return contextMismatch(groupedResult.detail);
|
|
5102
5243
|
}
|
|
5103
5244
|
const grouped = groupedResult.grouped;
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5245
|
+
if (!isTransitionLessor(input.target)) {
|
|
5246
|
+
return {
|
|
5247
|
+
assessment: transitionLessorRejectionAssessment(
|
|
5248
|
+
RESUMER_ARTIFACT,
|
|
5249
|
+
loaded.events.length === 0 ? "planned" : "outcome-unknown"
|
|
5250
|
+
),
|
|
5251
|
+
journals: [],
|
|
5252
|
+
observations: []
|
|
5253
|
+
};
|
|
5254
|
+
}
|
|
5255
|
+
let baseContext;
|
|
5256
|
+
try {
|
|
5257
|
+
baseContext = await input.readContext(input.target, loaded.run);
|
|
5258
|
+
} catch (error) {
|
|
5259
|
+
return contextMismatch(
|
|
5260
|
+
`transition run ${runId} target context could not be read: ${errorDetail(error)}`
|
|
5261
|
+
);
|
|
5262
|
+
}
|
|
5263
|
+
const runContextMatch = matchRunObservationContext({
|
|
5264
|
+
run: loaded.run,
|
|
5265
|
+
actual: baseContext
|
|
5266
|
+
});
|
|
5267
|
+
if (!runContextMatch.ok) {
|
|
5268
|
+
return contextMismatch(runContextMatch.detail);
|
|
5269
|
+
}
|
|
5270
|
+
const evidenceIdentityMatch = matchObservationContextIdentity({
|
|
5271
|
+
expected: baseContext,
|
|
5272
|
+
actual: evidenceContext2,
|
|
5273
|
+
label: "loaded plan evidence context"
|
|
5274
|
+
});
|
|
5275
|
+
if (!evidenceIdentityMatch.ok) {
|
|
5276
|
+
return contextMismatch(
|
|
5277
|
+
`loaded plan evidence context does not match run proof context: ${evidenceIdentityMatch.detail}`
|
|
5278
|
+
);
|
|
5279
|
+
}
|
|
5280
|
+
const operationEffectsByRef = /* @__PURE__ */ new Map();
|
|
5281
|
+
for (const step of loaded.plan.steps) {
|
|
5282
|
+
const effectsResolution = registry.resolveOperation(step.operation);
|
|
5283
|
+
if (!effectsResolution.ok) {
|
|
5284
|
+
return contextMismatch(effectsResolution.detail);
|
|
5285
|
+
}
|
|
5286
|
+
try {
|
|
5287
|
+
operationEffectsByRef.set(
|
|
5288
|
+
step.operation.ref,
|
|
5289
|
+
effectsResolution.semantics.effectsOf(step.operation, baseContext)
|
|
5290
|
+
);
|
|
5291
|
+
} catch (error) {
|
|
5292
|
+
return contextMismatch(
|
|
5293
|
+
`operation ${step.operation.ref} effects could not be resolved: ${errorDetail(error)}`
|
|
5294
|
+
);
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
let semanticDiagnostic;
|
|
5298
|
+
try {
|
|
5299
|
+
semanticDiagnostic = validateTransitionRelationalInvariants({
|
|
5300
|
+
kind: "plan",
|
|
5301
|
+
plan: loaded.plan,
|
|
5302
|
+
operationEffectsByRef
|
|
5303
|
+
});
|
|
5304
|
+
} catch (error) {
|
|
5305
|
+
return contextMismatch(
|
|
5306
|
+
`loaded plan could not be semantically validated: ${errorDetail(error)}`
|
|
5307
|
+
);
|
|
5308
|
+
}
|
|
5309
|
+
if (!semanticDiagnostic.ok) {
|
|
5310
|
+
return contextMismatch(
|
|
5311
|
+
`loaded plan failed semantic invariant validation: ${semanticDiagnostic.detail}`
|
|
5312
|
+
);
|
|
5313
|
+
}
|
|
5314
|
+
const orderedSteps = orderedPlanSteps(loaded.plan, stepById);
|
|
5109
5315
|
for (const step of orderedSteps) {
|
|
5110
5316
|
const events = grouped.get(step.stepId);
|
|
5111
5317
|
if (!events?.intent && !events?.observed) {
|
|
@@ -5138,65 +5344,90 @@ async function resumeTransitionRun(registry, input) {
|
|
|
5138
5344
|
}
|
|
5139
5345
|
const transactional = effects.effects.execution.transaction !== "forbids-transaction";
|
|
5140
5346
|
if (observedJournal?.outcome === "completed" || completion) {
|
|
5141
|
-
const after2 = await
|
|
5347
|
+
const after2 = await withObservedStep(
|
|
5142
5348
|
registry,
|
|
5143
5349
|
step,
|
|
5144
5350
|
input.target,
|
|
5145
5351
|
baseContext,
|
|
5146
|
-
"after"
|
|
5352
|
+
"after",
|
|
5353
|
+
async (observation) => {
|
|
5354
|
+
if (!observation.ok || !fingerprintMatches(step.expectedAfter, observation.fingerprint)) {
|
|
5355
|
+
return {
|
|
5356
|
+
kind: "unmatched",
|
|
5357
|
+
detail: observation.ok ? "current fingerprint no longer matches expectedAfter" : observation.detail
|
|
5358
|
+
};
|
|
5359
|
+
}
|
|
5360
|
+
const journal = observedJournal?.outcome === "completed" ? observedJournal : completedJournal(intent, completion, observation.observations);
|
|
5361
|
+
if (!observedJournal) {
|
|
5362
|
+
await observation.writeJournal(journal);
|
|
5363
|
+
}
|
|
5364
|
+
return {
|
|
5365
|
+
kind: "completed",
|
|
5366
|
+
observations: observation.observations,
|
|
5367
|
+
journal
|
|
5368
|
+
};
|
|
5369
|
+
}
|
|
5147
5370
|
);
|
|
5148
|
-
if (after2.
|
|
5371
|
+
if (after2.kind === "completed") {
|
|
5149
5372
|
observations.push(...after2.observations);
|
|
5150
|
-
|
|
5151
|
-
if (!observedJournal) {
|
|
5152
|
-
await writeObserved(after2, journal);
|
|
5153
|
-
}
|
|
5154
|
-
await releaseObservedAttempt(after2);
|
|
5155
|
-
completed.push(journal);
|
|
5373
|
+
completed.push(after2.journal);
|
|
5156
5374
|
continue;
|
|
5157
5375
|
}
|
|
5158
|
-
await releaseObservedAttempt(after2);
|
|
5159
5376
|
return unknownResult({
|
|
5160
5377
|
step,
|
|
5161
5378
|
completed,
|
|
5162
5379
|
observations,
|
|
5163
|
-
detail: after2.
|
|
5380
|
+
detail: after2.detail
|
|
5164
5381
|
});
|
|
5165
5382
|
}
|
|
5166
5383
|
if (transactional) {
|
|
5167
|
-
const before2 = await
|
|
5384
|
+
const before2 = await withObservedStep(
|
|
5168
5385
|
registry,
|
|
5169
5386
|
step,
|
|
5170
5387
|
input.target,
|
|
5171
5388
|
baseContext,
|
|
5172
|
-
"before"
|
|
5389
|
+
"before",
|
|
5390
|
+
async (observation) => ({
|
|
5391
|
+
kind: observation.ok && fingerprintMatches(step.expectedBefore, observation.fingerprint) ? "resume-required" : "unmatched",
|
|
5392
|
+
observations: observation.ok ? observation.observations : []
|
|
5393
|
+
})
|
|
5173
5394
|
);
|
|
5174
|
-
if (before2.
|
|
5395
|
+
if (before2.kind === "resume-required") {
|
|
5175
5396
|
observations.push(...before2.observations);
|
|
5176
|
-
await releaseObservedAttempt(before2);
|
|
5177
5397
|
return resumeRequiredResult({
|
|
5178
5398
|
step,
|
|
5179
5399
|
completed,
|
|
5180
5400
|
observations
|
|
5181
5401
|
});
|
|
5182
5402
|
}
|
|
5183
|
-
await
|
|
5184
|
-
const after2 = await observeStep(
|
|
5403
|
+
const after2 = await withObservedStep(
|
|
5185
5404
|
registry,
|
|
5186
5405
|
step,
|
|
5187
5406
|
input.target,
|
|
5188
5407
|
baseContext,
|
|
5189
|
-
"after"
|
|
5408
|
+
"after",
|
|
5409
|
+
async (observation) => {
|
|
5410
|
+
if (!observation.ok || !fingerprintMatches(step.expectedAfter, observation.fingerprint)) {
|
|
5411
|
+
return { kind: "unmatched" };
|
|
5412
|
+
}
|
|
5413
|
+
const journal = completedJournal(
|
|
5414
|
+
intent,
|
|
5415
|
+
void 0,
|
|
5416
|
+
observation.observations
|
|
5417
|
+
);
|
|
5418
|
+
await observation.writeJournal(journal);
|
|
5419
|
+
return {
|
|
5420
|
+
kind: "completed",
|
|
5421
|
+
observations: observation.observations,
|
|
5422
|
+
journal
|
|
5423
|
+
};
|
|
5424
|
+
}
|
|
5190
5425
|
);
|
|
5191
|
-
if (after2.
|
|
5426
|
+
if (after2.kind === "completed") {
|
|
5192
5427
|
observations.push(...after2.observations);
|
|
5193
|
-
|
|
5194
|
-
await writeObserved(after2, journal);
|
|
5195
|
-
await releaseObservedAttempt(after2);
|
|
5196
|
-
completed.push(journal);
|
|
5428
|
+
completed.push(after2.journal);
|
|
5197
5429
|
continue;
|
|
5198
5430
|
}
|
|
5199
|
-
await releaseObservedAttempt(after2);
|
|
5200
5431
|
return unknownResult({
|
|
5201
5432
|
step,
|
|
5202
5433
|
completed,
|
|
@@ -5204,39 +5435,53 @@ async function resumeTransitionRun(registry, input) {
|
|
|
5204
5435
|
detail: "transactional intent had no completion and current state matches neither expectedBefore nor expectedAfter"
|
|
5205
5436
|
});
|
|
5206
5437
|
}
|
|
5207
|
-
const after = await
|
|
5438
|
+
const after = await withObservedStep(
|
|
5208
5439
|
registry,
|
|
5209
5440
|
step,
|
|
5210
5441
|
input.target,
|
|
5211
5442
|
baseContext,
|
|
5212
|
-
"after"
|
|
5443
|
+
"after",
|
|
5444
|
+
async (observation) => {
|
|
5445
|
+
if (!observation.ok || !fingerprintMatches(step.expectedAfter, observation.fingerprint)) {
|
|
5446
|
+
return { kind: "unmatched" };
|
|
5447
|
+
}
|
|
5448
|
+
const journal = completedJournal(
|
|
5449
|
+
intent,
|
|
5450
|
+
void 0,
|
|
5451
|
+
observation.observations
|
|
5452
|
+
);
|
|
5453
|
+
await observation.writeJournal(journal);
|
|
5454
|
+
return {
|
|
5455
|
+
kind: "completed",
|
|
5456
|
+
observations: observation.observations,
|
|
5457
|
+
journal
|
|
5458
|
+
};
|
|
5459
|
+
}
|
|
5213
5460
|
);
|
|
5214
|
-
if (after.
|
|
5461
|
+
if (after.kind === "completed") {
|
|
5215
5462
|
observations.push(...after.observations);
|
|
5216
|
-
|
|
5217
|
-
await writeObserved(after, journal);
|
|
5218
|
-
await releaseObservedAttempt(after);
|
|
5219
|
-
completed.push(journal);
|
|
5463
|
+
completed.push(after.journal);
|
|
5220
5464
|
continue;
|
|
5221
5465
|
}
|
|
5222
|
-
await
|
|
5223
|
-
const before = await observeStep(
|
|
5466
|
+
const before = await withObservedStep(
|
|
5224
5467
|
registry,
|
|
5225
5468
|
step,
|
|
5226
5469
|
input.target,
|
|
5227
5470
|
baseContext,
|
|
5228
|
-
"before"
|
|
5471
|
+
"before",
|
|
5472
|
+
async (observation) => ({
|
|
5473
|
+
kind: observation.ok && fingerprintMatches(step.expectedBefore, observation.fingerprint) ? "resume-required" : "unmatched",
|
|
5474
|
+
observations: observation.ok ? observation.observations : []
|
|
5475
|
+
})
|
|
5229
5476
|
);
|
|
5230
|
-
if (before.
|
|
5477
|
+
if (before.kind === "resume-required") {
|
|
5231
5478
|
observations.push(...before.observations);
|
|
5232
|
-
await releaseObservedAttempt(before);
|
|
5233
5479
|
return resumeRequiredResult({
|
|
5234
5480
|
step,
|
|
5235
5481
|
completed,
|
|
5236
5482
|
observations
|
|
5237
5483
|
});
|
|
5238
5484
|
}
|
|
5239
|
-
await releaseObservedAttempt(before);
|
|
5240
5485
|
return unknownResult({
|
|
5241
5486
|
step,
|
|
5242
5487
|
completed,
|
|
@@ -5250,6 +5495,64 @@ async function resumeTransitionRun(registry, input) {
|
|
|
5250
5495
|
observations
|
|
5251
5496
|
};
|
|
5252
5497
|
}
|
|
5498
|
+
async function resumeTransitionRun(registry, input) {
|
|
5499
|
+
const completed = [];
|
|
5500
|
+
const observations = [];
|
|
5501
|
+
const runId = input.runId;
|
|
5502
|
+
try {
|
|
5503
|
+
return await resumeTransitionRunInternal(
|
|
5504
|
+
registry,
|
|
5505
|
+
input,
|
|
5506
|
+
runId,
|
|
5507
|
+
completed,
|
|
5508
|
+
observations
|
|
5509
|
+
);
|
|
5510
|
+
} catch (error) {
|
|
5511
|
+
return contextMismatch(
|
|
5512
|
+
`transition run ${runId} could not be resumed: ${errorDetail(error)}`,
|
|
5513
|
+
completed,
|
|
5514
|
+
observations
|
|
5515
|
+
);
|
|
5516
|
+
}
|
|
5517
|
+
}
|
|
5518
|
+
|
|
5519
|
+
// src/transition/run-metadata.ts
|
|
5520
|
+
import { randomUUID } from "crypto";
|
|
5521
|
+
var TRANSITION_PLANNER_ARTIFACT = {
|
|
5522
|
+
id: semanticArtifactId("dbsp.core.transition.planner"),
|
|
5523
|
+
version: "0.1.0"
|
|
5524
|
+
};
|
|
5525
|
+
function evidenceContext(observations) {
|
|
5526
|
+
const evidence = observations.filter(
|
|
5527
|
+
(observation) => observation.role === "evidence"
|
|
5528
|
+
);
|
|
5529
|
+
const first = evidence[0]?.context;
|
|
5530
|
+
if (!first) {
|
|
5531
|
+
throw new Error(
|
|
5532
|
+
"internal error: minted proven plan has no evidence observation context"
|
|
5533
|
+
);
|
|
5534
|
+
}
|
|
5535
|
+
const expected = stableJson(first);
|
|
5536
|
+
for (const observation of evidence.slice(1)) {
|
|
5537
|
+
if (stableJson(observation.context) !== expected) {
|
|
5538
|
+
throw new Error(
|
|
5539
|
+
"internal error: minted proven plan evidence observations do not share one context"
|
|
5540
|
+
);
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
return first;
|
|
5544
|
+
}
|
|
5545
|
+
function createTransitionRunMetadata(plan2) {
|
|
5546
|
+
const context = evidenceContext(plan2.observations);
|
|
5547
|
+
return {
|
|
5548
|
+
runId: `dbsp-${randomUUID()}`,
|
|
5549
|
+
planDigest: transitionPlanDigest(plan2),
|
|
5550
|
+
targetContextDigest: observationContextDigest(context),
|
|
5551
|
+
databaseId: context.databaseId,
|
|
5552
|
+
coreVersion: TRANSITION_PLANNER_ARTIFACT.version,
|
|
5553
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5554
|
+
};
|
|
5555
|
+
}
|
|
5253
5556
|
|
|
5254
5557
|
// src/transition/applier.ts
|
|
5255
5558
|
var APPLIER_ARTIFACT = {
|
|
@@ -5273,6 +5576,13 @@ function completedAssessment2(proven) {
|
|
|
5273
5576
|
continuation: "none"
|
|
5274
5577
|
};
|
|
5275
5578
|
}
|
|
5579
|
+
function transitionLessorRejectionResult() {
|
|
5580
|
+
return {
|
|
5581
|
+
assessment: transitionLessorRejectionAssessment(APPLIER_ARTIFACT),
|
|
5582
|
+
journals: [],
|
|
5583
|
+
observations: []
|
|
5584
|
+
};
|
|
5585
|
+
}
|
|
5276
5586
|
function primaryClaimFromPlan(plan2) {
|
|
5277
5587
|
return plan2.claims[0]?.id ?? plan2.steps.flatMap((step) => [...step.requiredClaims])[0] ?? claimId("dbsp.transition.claim.plan");
|
|
5278
5588
|
}
|
|
@@ -5300,9 +5610,6 @@ function evidenceIds2(observations) {
|
|
|
5300
5610
|
function recordedAt2() {
|
|
5301
5611
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
5302
5612
|
}
|
|
5303
|
-
function digest2(value) {
|
|
5304
|
-
return createHash3("sha256").update(stableJson(value)).digest("hex");
|
|
5305
|
-
}
|
|
5306
5613
|
function lockTimeoutMs(runtime, step, context) {
|
|
5307
5614
|
const effects = runtime.effectsOf(step.operation, context);
|
|
5308
5615
|
const waits = effects.effects.locks.flatMap(
|
|
@@ -5310,35 +5617,9 @@ function lockTimeoutMs(runtime, step, context) {
|
|
|
5310
5617
|
);
|
|
5311
5618
|
return waits.length > 0 ? Math.max(...waits) : 5e3;
|
|
5312
5619
|
}
|
|
5313
|
-
function contextFromPlanObservations(observations) {
|
|
5314
|
-
const evidence = observations.filter(
|
|
5315
|
-
(observation) => observation.role === "evidence"
|
|
5316
|
-
);
|
|
5317
|
-
const first = evidence[0]?.context;
|
|
5318
|
-
if (!first) {
|
|
5319
|
-
return void 0;
|
|
5320
|
-
}
|
|
5321
|
-
const expected = stableJson(first);
|
|
5322
|
-
for (const observation of evidence.slice(1)) {
|
|
5323
|
-
if (stableJson(observation.context) !== expected) {
|
|
5324
|
-
return void 0;
|
|
5325
|
-
}
|
|
5326
|
-
}
|
|
5327
|
-
return first;
|
|
5328
|
-
}
|
|
5329
5620
|
function fingerprintMatches2(expected, actual) {
|
|
5330
5621
|
return expected.digest === actual.digest;
|
|
5331
5622
|
}
|
|
5332
|
-
function transitionRunMetadata(plan2, context) {
|
|
5333
|
-
return {
|
|
5334
|
-
runId: `dbsp-${randomUUID()}`,
|
|
5335
|
-
planDigest: digest2(plan2),
|
|
5336
|
-
targetContextDigest: digest2(context),
|
|
5337
|
-
databaseId: context.databaseId,
|
|
5338
|
-
coreVersion: APPLIER_ARTIFACT.version,
|
|
5339
|
-
startedAt: recordedAt2()
|
|
5340
|
-
};
|
|
5341
|
-
}
|
|
5342
5623
|
function intentRecord(step, run) {
|
|
5343
5624
|
return {
|
|
5344
5625
|
runId: run.runId,
|
|
@@ -5456,6 +5737,22 @@ function invalidPlanResult(detail) {
|
|
|
5456
5737
|
observations: []
|
|
5457
5738
|
};
|
|
5458
5739
|
}
|
|
5740
|
+
function persistenceFailureResult(run, error) {
|
|
5741
|
+
return {
|
|
5742
|
+
assessment: assessment2({
|
|
5743
|
+
code: "persistence-failed",
|
|
5744
|
+
artifact: APPLIER_ARTIFACT,
|
|
5745
|
+
fact: {
|
|
5746
|
+
key: "transition-run-id",
|
|
5747
|
+
value: run.runId
|
|
5748
|
+
},
|
|
5749
|
+
detail: `transition-run persistence is indeterminate; load run ${run.runId} before retrying: ${errorDetail2(error)}`,
|
|
5750
|
+
scope: []
|
|
5751
|
+
}),
|
|
5752
|
+
journals: [],
|
|
5753
|
+
observations: []
|
|
5754
|
+
};
|
|
5755
|
+
}
|
|
5459
5756
|
function unknownJournal(intent) {
|
|
5460
5757
|
return {
|
|
5461
5758
|
intent,
|
|
@@ -5510,11 +5807,11 @@ var CommitOutcomeUncertainError = class extends Error {
|
|
|
5510
5807
|
this.originalError = error;
|
|
5511
5808
|
}
|
|
5512
5809
|
};
|
|
5513
|
-
function
|
|
5810
|
+
function errorDetail2(error) {
|
|
5514
5811
|
return error instanceof Error ? error.message : "unknown error";
|
|
5515
5812
|
}
|
|
5516
5813
|
function withJournalWriteWarning(assessmentValue, error) {
|
|
5517
|
-
const detail = `observed journal write failed after outcome was decided: ${
|
|
5814
|
+
const detail = `observed journal write failed after outcome was decided: ${errorDetail2(error)}`;
|
|
5518
5815
|
return {
|
|
5519
5816
|
...assessmentValue,
|
|
5520
5817
|
reasons: assessmentValue.reasons.map(
|
|
@@ -5555,7 +5852,7 @@ function durableEvidence(observations) {
|
|
|
5555
5852
|
(observation) => observation.role === "evidence"
|
|
5556
5853
|
);
|
|
5557
5854
|
}
|
|
5558
|
-
function createApplier(registry) {
|
|
5855
|
+
function createApplier(registry, persister) {
|
|
5559
5856
|
return {
|
|
5560
5857
|
artifact: APPLIER_ARTIFACT,
|
|
5561
5858
|
async apply(proven, policy, target) {
|
|
@@ -5563,7 +5860,16 @@ function createApplier(registry) {
|
|
|
5563
5860
|
if (!isMintedInProcessPlan(plan2)) {
|
|
5564
5861
|
return invalidPlanResult(UNMINTED_PLAN_DETAIL);
|
|
5565
5862
|
}
|
|
5566
|
-
if (plan2.
|
|
5863
|
+
if (plan2.segments.length === 0) {
|
|
5864
|
+
if (!isTransitionLessor(target)) {
|
|
5865
|
+
return transitionLessorRejectionResult();
|
|
5866
|
+
}
|
|
5867
|
+
return uncomposablePlanResult(
|
|
5868
|
+
plan2,
|
|
5869
|
+
"plan contains no executable steps"
|
|
5870
|
+
);
|
|
5871
|
+
}
|
|
5872
|
+
if (plan2.steps.length === 0) {
|
|
5567
5873
|
return uncomposablePlanResult(
|
|
5568
5874
|
plan2,
|
|
5569
5875
|
"plan contains no executable steps"
|
|
@@ -5579,10 +5885,12 @@ function createApplier(registry) {
|
|
|
5579
5885
|
);
|
|
5580
5886
|
}
|
|
5581
5887
|
const reportedAssessment = derivedApplicableAssessment(plan2);
|
|
5582
|
-
const proofContext =
|
|
5888
|
+
const proofContext = plan2.observations.find(
|
|
5889
|
+
(observation) => observation.role === "evidence"
|
|
5890
|
+
)?.context;
|
|
5583
5891
|
if (!proofContext) {
|
|
5584
5892
|
throw new Error(
|
|
5585
|
-
"internal error: minted proven plan
|
|
5893
|
+
"internal error: minted proven plan has no evidence observation context"
|
|
5586
5894
|
);
|
|
5587
5895
|
}
|
|
5588
5896
|
const assumptionById = new Map(
|
|
@@ -5603,7 +5911,7 @@ function createApplier(registry) {
|
|
|
5603
5911
|
return unacceptedAssumptionResult(plan2, assumption);
|
|
5604
5912
|
}
|
|
5605
5913
|
}
|
|
5606
|
-
const run =
|
|
5914
|
+
const run = createTransitionRunMetadata(plan2);
|
|
5607
5915
|
const operationEffectsByRef = /* @__PURE__ */ new Map();
|
|
5608
5916
|
for (const step of plan2.steps) {
|
|
5609
5917
|
const operationResolution = registry.resolveOperation(step.operation);
|
|
@@ -5673,8 +5981,8 @@ function createApplier(registry) {
|
|
|
5673
5981
|
journalWriteFailure ?? params.result
|
|
5674
5982
|
);
|
|
5675
5983
|
};
|
|
5676
|
-
let runtimeContext = proofContext;
|
|
5677
5984
|
const stepById = new Map(plan2.steps.map((step) => [step.stepId, step]));
|
|
5985
|
+
const preflightSegments = [];
|
|
5678
5986
|
for (const segment of plan2.segments) {
|
|
5679
5987
|
const segmentSteps = segment.stepIds.map(
|
|
5680
5988
|
(stepId2) => stepById.get(stepId2)
|
|
@@ -5800,17 +6108,42 @@ function createApplier(registry) {
|
|
|
5800
6108
|
)
|
|
5801
6109
|
);
|
|
5802
6110
|
}
|
|
6111
|
+
preflightSegments.push({
|
|
6112
|
+
segment,
|
|
6113
|
+
resolvedSteps,
|
|
6114
|
+
first,
|
|
6115
|
+
transactional,
|
|
6116
|
+
segmentCoordinator
|
|
6117
|
+
});
|
|
6118
|
+
}
|
|
6119
|
+
if (!isTransitionLessor(target)) {
|
|
6120
|
+
return resultWithCommittedJournals(transitionLessorRejectionResult());
|
|
6121
|
+
}
|
|
6122
|
+
try {
|
|
6123
|
+
await persister.persist(run, plan2);
|
|
6124
|
+
} catch (error) {
|
|
6125
|
+
return persistenceFailureResult(run, error);
|
|
6126
|
+
}
|
|
6127
|
+
let runtimeContext = proofContext;
|
|
6128
|
+
for (const {
|
|
6129
|
+
resolvedSteps,
|
|
6130
|
+
first,
|
|
6131
|
+
transactional,
|
|
6132
|
+
segmentCoordinator
|
|
6133
|
+
} of preflightSegments) {
|
|
5803
6134
|
let client;
|
|
6135
|
+
let lease;
|
|
5804
6136
|
let committed = false;
|
|
5805
6137
|
let transactionStarted = false;
|
|
5806
|
-
let
|
|
6138
|
+
let releaseFailure;
|
|
5807
6139
|
let active = first;
|
|
5808
6140
|
let activeContext = runtimeContext;
|
|
5809
6141
|
let activeOperationAttempted = false;
|
|
5810
6142
|
let activeNonRollbackableOperationExecuted = false;
|
|
5811
6143
|
const completedInSegment = [];
|
|
5812
6144
|
try {
|
|
5813
|
-
|
|
6145
|
+
lease = await acquireTransitionLease(target);
|
|
6146
|
+
client = { opaqueClient: lease.session };
|
|
5814
6147
|
const executionClient = client;
|
|
5815
6148
|
if (transactional) {
|
|
5816
6149
|
await segmentCoordinator.begin(executionClient);
|
|
@@ -6290,7 +6623,7 @@ function createApplier(registry) {
|
|
|
6290
6623
|
operationKind: entry.step.operation.operationKind,
|
|
6291
6624
|
operationRef: entry.step.operation.ref,
|
|
6292
6625
|
scope: [],
|
|
6293
|
-
detail: `after-commit expectedAfter observation failed after commit: ${
|
|
6626
|
+
detail: `after-commit expectedAfter observation failed after commit: ${errorDetail2(error)}`
|
|
6294
6627
|
},
|
|
6295
6628
|
"outcome-unknown",
|
|
6296
6629
|
"human-intervention-required"
|
|
@@ -6361,7 +6694,7 @@ function createApplier(registry) {
|
|
|
6361
6694
|
journals.push(journal);
|
|
6362
6695
|
}
|
|
6363
6696
|
} catch (error) {
|
|
6364
|
-
|
|
6697
|
+
releaseFailure = { error };
|
|
6365
6698
|
if (error instanceof CommitOutcomeUncertainError) {
|
|
6366
6699
|
if (client && transactionStarted) {
|
|
6367
6700
|
await segmentCoordinator.rollback(client).catch(() => void 0);
|
|
@@ -6375,7 +6708,7 @@ function createApplier(registry) {
|
|
|
6375
6708
|
operationKind: active.step.operation.operationKind,
|
|
6376
6709
|
operationRef: active.step.operation.ref,
|
|
6377
6710
|
scope: [],
|
|
6378
|
-
detail: `commit outcome uncertain after commit failure: ${
|
|
6711
|
+
detail: `commit outcome uncertain after commit failure: ${errorDetail2(error.originalError)}`
|
|
6379
6712
|
},
|
|
6380
6713
|
"outcome-unknown",
|
|
6381
6714
|
"human-intervention-required"
|
|
@@ -6608,11 +6941,8 @@ function createApplier(registry) {
|
|
|
6608
6941
|
outcomeDurable: true
|
|
6609
6942
|
});
|
|
6610
6943
|
} finally {
|
|
6611
|
-
if (
|
|
6612
|
-
|
|
6613
|
-
await segmentCoordinator.release(client, releaseError);
|
|
6614
|
-
} catch {
|
|
6615
|
-
}
|
|
6944
|
+
if (lease) {
|
|
6945
|
+
await lease.release(releaseFailure);
|
|
6616
6946
|
}
|
|
6617
6947
|
}
|
|
6618
6948
|
}
|
|
@@ -8940,6 +9270,106 @@ function createEvidenceView(params) {
|
|
|
8940
9270
|
return new CoreEvidenceView(params.evidence, params.context, params.requests);
|
|
8941
9271
|
}
|
|
8942
9272
|
|
|
9273
|
+
// src/transition/execution-contract.ts
|
|
9274
|
+
import { EXECUTION_CONTRACT_VERSION } from "@dbsp/types";
|
|
9275
|
+
function canonicalRequirements(requirements) {
|
|
9276
|
+
const ordered = [...requirements].sort((left, right) => {
|
|
9277
|
+
const leftJson = stableJson(left);
|
|
9278
|
+
const rightJson = stableJson(right);
|
|
9279
|
+
return leftJson < rightJson ? -1 : leftJson > rightJson ? 1 : 0;
|
|
9280
|
+
});
|
|
9281
|
+
return ordered.filter(
|
|
9282
|
+
(requirement, index) => index === 0 || stableJson(requirement) !== stableJson(ordered[index - 1])
|
|
9283
|
+
);
|
|
9284
|
+
}
|
|
9285
|
+
function compareNamespaceIdentity(left, right) {
|
|
9286
|
+
return left.name < right.name ? -1 : left.name > right.name ? 1 : left.oid < right.oid ? -1 : left.oid > right.oid ? 1 : 0;
|
|
9287
|
+
}
|
|
9288
|
+
function canonicalNamespaces(namespaces) {
|
|
9289
|
+
const ordered = [...namespaces].sort(compareNamespaceIdentity);
|
|
9290
|
+
return ordered.filter(
|
|
9291
|
+
(namespace, index) => index === 0 || compareNamespaceIdentity(namespace, ordered[index - 1] ?? namespace) !== 0
|
|
9292
|
+
);
|
|
9293
|
+
}
|
|
9294
|
+
function createExecutionContract(requirements) {
|
|
9295
|
+
return {
|
|
9296
|
+
version: EXECUTION_CONTRACT_VERSION,
|
|
9297
|
+
requirements: canonicalRequirements(requirements)
|
|
9298
|
+
};
|
|
9299
|
+
}
|
|
9300
|
+
function nonEmpty(value) {
|
|
9301
|
+
return typeof value === "string" && value.length > 0;
|
|
9302
|
+
}
|
|
9303
|
+
function validRequirement(requirement) {
|
|
9304
|
+
if (requirement === null || typeof requirement !== "object" || Array.isArray(requirement))
|
|
9305
|
+
return false;
|
|
9306
|
+
const value = requirement;
|
|
9307
|
+
if (!nonEmpty(value.kind) || !["must-match", "set-and-verify", "must-satisfy", "provenance"].includes(
|
|
9308
|
+
value.mode
|
|
9309
|
+
))
|
|
9310
|
+
return false;
|
|
9311
|
+
switch (value.kind) {
|
|
9312
|
+
case "postgresql.physical-target": {
|
|
9313
|
+
if (!(value.mode === "must-match" && nonEmpty(value.systemIdentifier) && nonEmpty(value.databaseOid) && Array.isArray(value.namespaces) && value.namespaces.length > 0 && value.namespaces.every(
|
|
9314
|
+
(item) => item !== null && typeof item === "object" && nonEmpty(item.name) && nonEmpty(item.oid)
|
|
9315
|
+
)))
|
|
9316
|
+
return false;
|
|
9317
|
+
const namespaces = value.namespaces;
|
|
9318
|
+
return stableJson(namespaces) === stableJson(canonicalNamespaces(namespaces)) && new Set(namespaces.map((namespace) => namespace.name)).size === namespaces.length;
|
|
9319
|
+
}
|
|
9320
|
+
case "postgresql.engine-version":
|
|
9321
|
+
return value.mode === "must-satisfy" && nonEmpty(value.stepId) && (value.minServerVersionNum === void 0 || Number.isInteger(value.minServerVersionNum)) && (value.maxServerVersionNum === void 0 || Number.isInteger(value.maxServerVersionNum));
|
|
9322
|
+
case "postgresql.authority":
|
|
9323
|
+
return value.mode === "must-satisfy" && ["schema-usage", "table-alter", "type-alter"].includes(
|
|
9324
|
+
value.action
|
|
9325
|
+
) && nonEmpty(value.schema) && (value.action === "schema-usage" || nonEmpty(value.object));
|
|
9326
|
+
case "postgresql.session-setting":
|
|
9327
|
+
return (value.mode === "set-and-verify" || value.mode === "provenance") && [
|
|
9328
|
+
"standard_conforming_strings",
|
|
9329
|
+
"search_path",
|
|
9330
|
+
"client_encoding",
|
|
9331
|
+
"TimeZone"
|
|
9332
|
+
].includes(value.setting) && nonEmpty(value.value) && (value.mode !== "set-and-verify" || value.setting === "standard_conforming_strings" && value.value === "on" || value.setting === "client_encoding" && value.value === "UTF8");
|
|
9333
|
+
default:
|
|
9334
|
+
return false;
|
|
9335
|
+
}
|
|
9336
|
+
}
|
|
9337
|
+
function validateExecutionContract(value) {
|
|
9338
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
9339
|
+
return {
|
|
9340
|
+
ok: false,
|
|
9341
|
+
detail: "plan is missing an execution contract; re-plan before execution"
|
|
9342
|
+
};
|
|
9343
|
+
const contract = value;
|
|
9344
|
+
if (contract.version !== EXECUTION_CONTRACT_VERSION)
|
|
9345
|
+
return {
|
|
9346
|
+
ok: false,
|
|
9347
|
+
detail: `execution contract version ${String(contract.version)} is unsupported`
|
|
9348
|
+
};
|
|
9349
|
+
if (!Array.isArray(contract.requirements) || contract.requirements.length === 0)
|
|
9350
|
+
return { ok: false, detail: "execution contract has no requirements" };
|
|
9351
|
+
if (!contract.requirements.every(validRequirement))
|
|
9352
|
+
return {
|
|
9353
|
+
ok: false,
|
|
9354
|
+
detail: "execution contract contains an unknown requirement kind or mode"
|
|
9355
|
+
};
|
|
9356
|
+
const canonical = canonicalRequirements(contract.requirements);
|
|
9357
|
+
if (stableJson(canonical) !== stableJson(contract.requirements))
|
|
9358
|
+
return {
|
|
9359
|
+
ok: false,
|
|
9360
|
+
detail: "execution contract requirements are not canonically ordered"
|
|
9361
|
+
};
|
|
9362
|
+
return { ok: true, contract };
|
|
9363
|
+
}
|
|
9364
|
+
function bindExecutionContract(plan2, contract) {
|
|
9365
|
+
const validation = validateExecutionContract(contract);
|
|
9366
|
+
if (!validation.ok) throw new Error(validation.detail);
|
|
9367
|
+
return mintInProcessPlan({
|
|
9368
|
+
...plan2,
|
|
9369
|
+
executionContract: validation.contract
|
|
9370
|
+
});
|
|
9371
|
+
}
|
|
9372
|
+
|
|
8943
9373
|
// src/transition/composer.ts
|
|
8944
9374
|
function sameResource4(left, right) {
|
|
8945
9375
|
return stableJson(left) === stableJson(right);
|
|
@@ -9636,6 +10066,14 @@ var ObservationContextMismatchError = class extends Error {
|
|
|
9636
10066
|
this.name = "ObservationContextMismatchError";
|
|
9637
10067
|
}
|
|
9638
10068
|
};
|
|
10069
|
+
function verifyCapturedTargetIdentity(expected, actual) {
|
|
10070
|
+
if (expected.postgresqlTargetIdentity === void 0) return;
|
|
10071
|
+
if (stableJson(expected.postgresqlTargetIdentity) !== stableJson(actual.postgresqlTargetIdentity)) {
|
|
10072
|
+
throw new ObservationContextMismatchError(
|
|
10073
|
+
"proof observation target identity does not match the target captured before evidence collection"
|
|
10074
|
+
);
|
|
10075
|
+
}
|
|
10076
|
+
}
|
|
9639
10077
|
function validateIssuedObservation(observation, context) {
|
|
9640
10078
|
const contextMatch = matchLiveObservationContext({
|
|
9641
10079
|
expected: context,
|
|
@@ -9674,22 +10112,8 @@ function validateIssuedObservation(observation, context) {
|
|
|
9674
10112
|
detail: `observation ${observation.id ?? "unknown"} has an invalid role`
|
|
9675
10113
|
};
|
|
9676
10114
|
}
|
|
9677
|
-
function transitionPool(target) {
|
|
9678
|
-
if (isJsonObject3(target) && typeof target.connect === "function" && typeof target.release !== "function") {
|
|
9679
|
-
return target;
|
|
9680
|
-
}
|
|
9681
|
-
throw new Error(
|
|
9682
|
-
"transition proof target must be a Pool-like object with connect(); checked-out clients are not accepted"
|
|
9683
|
-
);
|
|
9684
|
-
}
|
|
9685
10115
|
async function checkoutProofClient(target) {
|
|
9686
|
-
|
|
9687
|
-
if (!isJsonObject3(client) || typeof client.query !== "function" || typeof client.release !== "function") {
|
|
9688
|
-
throw new Error(
|
|
9689
|
-
"transition proof pool returned a client without query() and release()"
|
|
9690
|
-
);
|
|
9691
|
-
}
|
|
9692
|
-
return client;
|
|
10116
|
+
return acquireTransitionLease(target);
|
|
9693
10117
|
}
|
|
9694
10118
|
function conclusionForObligation(obligation, evidence, expectedContext) {
|
|
9695
10119
|
const result = concludeEvidenceForObligation({
|
|
@@ -10326,13 +10750,15 @@ async function proveTransitions(registry, compare, target, context, initialState
|
|
|
10326
10750
|
let minServerVersionRequests = /* @__PURE__ */ new Map();
|
|
10327
10751
|
const obligationClaimByCanonicalKey = /* @__PURE__ */ new Map();
|
|
10328
10752
|
const multiCandidateSnapshot = !initialState && compare.candidates.length > 1;
|
|
10753
|
+
let sharedLease;
|
|
10329
10754
|
let sharedClient;
|
|
10330
|
-
let
|
|
10755
|
+
let sharedReleaseFailure;
|
|
10331
10756
|
const sharedIssuedRequestKeys = /* @__PURE__ */ new Set();
|
|
10332
10757
|
let sharedIssued = { evidence: [], advisory: [] };
|
|
10333
10758
|
try {
|
|
10334
10759
|
if (multiCandidateSnapshot) {
|
|
10335
|
-
|
|
10760
|
+
sharedLease = await checkoutProofClient(target);
|
|
10761
|
+
sharedClient = sharedLease.session;
|
|
10336
10762
|
const allRequiredObservations = [];
|
|
10337
10763
|
for (const candidate of compare.candidates) {
|
|
10338
10764
|
const rule = registry.resolveRule(candidate.rule);
|
|
@@ -10379,6 +10805,7 @@ async function proveTransitions(registry, compare, target, context, initialState
|
|
|
10379
10805
|
requiredObservations
|
|
10380
10806
|
) : context
|
|
10381
10807
|
);
|
|
10808
|
+
verifyCapturedTargetIdentity(context, candidateContext);
|
|
10382
10809
|
if (!sharedProofContext) {
|
|
10383
10810
|
sharedProofContext = candidateContext;
|
|
10384
10811
|
} else {
|
|
@@ -10506,11 +10933,14 @@ async function proveTransitions(registry, compare, target, context, initialState
|
|
|
10506
10933
|
issued = appendIssued(sharedIssued, additional);
|
|
10507
10934
|
sharedIssued = appendIssued(sharedIssued, additional);
|
|
10508
10935
|
} else {
|
|
10936
|
+
let lease;
|
|
10509
10937
|
let client;
|
|
10510
|
-
let
|
|
10938
|
+
let releaseFailure;
|
|
10511
10939
|
try {
|
|
10512
|
-
|
|
10940
|
+
lease = await checkoutProofClient(target);
|
|
10941
|
+
client = lease.session;
|
|
10513
10942
|
proofContext = issuer.readContext ? await issuer.readContext(client, context, requiredObservations) : context;
|
|
10943
|
+
verifyCapturedTargetIdentity(context, proofContext);
|
|
10514
10944
|
proofContext = registry.contextWithDerivedCapabilities(proofContext);
|
|
10515
10945
|
const supportMismatch = ruleSupportMismatch(rule, proofContext);
|
|
10516
10946
|
if (supportMismatch) {
|
|
@@ -10529,7 +10959,7 @@ async function proveTransitions(registry, compare, target, context, initialState
|
|
|
10529
10959
|
proofContext
|
|
10530
10960
|
);
|
|
10531
10961
|
} catch (error) {
|
|
10532
|
-
|
|
10962
|
+
releaseFailure = { error };
|
|
10533
10963
|
return {
|
|
10534
10964
|
kind: "blocked",
|
|
10535
10965
|
assessment: artifactMismatch(
|
|
@@ -10538,8 +10968,8 @@ async function proveTransitions(registry, compare, target, context, initialState
|
|
|
10538
10968
|
)
|
|
10539
10969
|
};
|
|
10540
10970
|
} finally {
|
|
10541
|
-
if (
|
|
10542
|
-
|
|
10971
|
+
if (lease) {
|
|
10972
|
+
await lease.release(releaseFailure);
|
|
10543
10973
|
}
|
|
10544
10974
|
}
|
|
10545
10975
|
}
|
|
@@ -10886,7 +11316,7 @@ async function proveTransitions(registry, compare, target, context, initialState
|
|
|
10886
11316
|
planAssumptions.push(...assumptions2);
|
|
10887
11317
|
}
|
|
10888
11318
|
} catch (error) {
|
|
10889
|
-
|
|
11319
|
+
sharedReleaseFailure = { error };
|
|
10890
11320
|
return {
|
|
10891
11321
|
kind: "blocked",
|
|
10892
11322
|
assessment: artifactMismatch(
|
|
@@ -10895,8 +11325,8 @@ async function proveTransitions(registry, compare, target, context, initialState
|
|
|
10895
11325
|
)
|
|
10896
11326
|
};
|
|
10897
11327
|
} finally {
|
|
10898
|
-
if (
|
|
10899
|
-
|
|
11328
|
+
if (sharedLease) {
|
|
11329
|
+
await sharedLease.release(sharedReleaseFailure);
|
|
10900
11330
|
}
|
|
10901
11331
|
}
|
|
10902
11332
|
let assumptions;
|
|
@@ -11041,12 +11471,15 @@ async function retryUnknownRecognition(registry, compare, target, context) {
|
|
|
11041
11471
|
]);
|
|
11042
11472
|
const issuer = registry.resolveIssuer(recognition.rule.pack);
|
|
11043
11473
|
if (issuer) {
|
|
11474
|
+
let lease;
|
|
11044
11475
|
let client;
|
|
11045
|
-
let
|
|
11476
|
+
let releaseFailure;
|
|
11046
11477
|
const issuedRequestKeys = /* @__PURE__ */ new Set();
|
|
11047
11478
|
try {
|
|
11048
|
-
|
|
11479
|
+
lease = await checkoutProofClient(target);
|
|
11480
|
+
client = lease.session;
|
|
11049
11481
|
let proofContext2 = issuer.readContext ? await issuer.readContext(client, context, recognitionRequests) : context;
|
|
11482
|
+
verifyCapturedTargetIdentity(context, proofContext2);
|
|
11050
11483
|
proofContext2 = registry.contextWithDerivedCapabilities(proofContext2);
|
|
11051
11484
|
const supportMismatch2 = ruleSupportMismatch(rule, proofContext2);
|
|
11052
11485
|
if (supportMismatch2) {
|
|
@@ -11152,7 +11585,7 @@ async function retryUnknownRecognition(registry, compare, target, context) {
|
|
|
11152
11585
|
}
|
|
11153
11586
|
);
|
|
11154
11587
|
} catch (error) {
|
|
11155
|
-
|
|
11588
|
+
releaseFailure = { error };
|
|
11156
11589
|
return {
|
|
11157
11590
|
kind: "blocked",
|
|
11158
11591
|
assessment: artifactMismatch(
|
|
@@ -11161,8 +11594,8 @@ async function retryUnknownRecognition(registry, compare, target, context) {
|
|
|
11161
11594
|
)
|
|
11162
11595
|
};
|
|
11163
11596
|
} finally {
|
|
11164
|
-
if (
|
|
11165
|
-
|
|
11597
|
+
if (lease) {
|
|
11598
|
+
await lease.release(releaseFailure);
|
|
11166
11599
|
}
|
|
11167
11600
|
}
|
|
11168
11601
|
}
|
|
@@ -11259,7 +11692,7 @@ function createProver(registry) {
|
|
|
11259
11692
|
case "unsupported":
|
|
11260
11693
|
return { kind: "blocked", assessment: unsupported(compare) };
|
|
11261
11694
|
case "unknown":
|
|
11262
|
-
|
|
11695
|
+
break;
|
|
11263
11696
|
case "ambiguous":
|
|
11264
11697
|
return { kind: "blocked", assessment: ambiguous(compare) };
|
|
11265
11698
|
case "uncomposable":
|
|
@@ -11267,7 +11700,13 @@ function createProver(registry) {
|
|
|
11267
11700
|
case "transitions":
|
|
11268
11701
|
break;
|
|
11269
11702
|
}
|
|
11270
|
-
|
|
11703
|
+
if (!isTransitionLessor(target)) {
|
|
11704
|
+
return {
|
|
11705
|
+
kind: "blocked",
|
|
11706
|
+
assessment: transitionLessorRejectionAssessment(PROVER_ARTIFACT)
|
|
11707
|
+
};
|
|
11708
|
+
}
|
|
11709
|
+
return compare.kind === "unknown" ? retryUnknownRecognition(registry, compare, target, context) : proveTransitions(registry, compare, target, context);
|
|
11271
11710
|
}
|
|
11272
11711
|
};
|
|
11273
11712
|
}
|
|
@@ -11521,6 +11960,10 @@ function projectCompareToSingleCandidate(compare, entry) {
|
|
|
11521
11960
|
}
|
|
11522
11961
|
|
|
11523
11962
|
// src/transition/staged-orchestrator.ts
|
|
11963
|
+
var STAGED_ORCHESTRATOR_ARTIFACT = {
|
|
11964
|
+
id: semanticArtifactId("dbsp.core.transition.staged-orchestrator"),
|
|
11965
|
+
version: "0.1.0"
|
|
11966
|
+
};
|
|
11524
11967
|
function uniqueResources2(resources) {
|
|
11525
11968
|
const byKey = /* @__PURE__ */ new Map();
|
|
11526
11969
|
for (const resource of resources) {
|
|
@@ -11669,16 +12112,30 @@ function candidateProgressKey(entry) {
|
|
|
11669
12112
|
function completedJournalRefs(journals) {
|
|
11670
12113
|
return journals.filter((journal) => journal.outcome === "completed").map((journal) => journal.intent.operation.ref);
|
|
11671
12114
|
}
|
|
11672
|
-
function createStagedTransitionOrchestrator(registry) {
|
|
12115
|
+
function createStagedTransitionOrchestrator(registry, persister) {
|
|
11673
12116
|
const comparator = createComparator(registry);
|
|
11674
12117
|
const prover = createProver(registry);
|
|
11675
|
-
const applier = createApplier(registry);
|
|
12118
|
+
const applier = createApplier(registry, persister);
|
|
11676
12119
|
return {
|
|
11677
12120
|
async applyStagedTransition(input) {
|
|
11678
12121
|
const journals = [];
|
|
11679
12122
|
const observations = [];
|
|
11680
12123
|
const completedProgress = /* @__PURE__ */ new Set();
|
|
11681
12124
|
const maxIterations = input.maxIterations ?? 32;
|
|
12125
|
+
const targetRejectionResult = () => resultWithAggregate(
|
|
12126
|
+
transitionLessorRejectionAssessment(STAGED_ORCHESTRATOR_ARTIFACT),
|
|
12127
|
+
journals,
|
|
12128
|
+
observations
|
|
12129
|
+
);
|
|
12130
|
+
const proveAtTargetBoundary = async (compare, context) => {
|
|
12131
|
+
if (!isTransitionLessor(input.target)) {
|
|
12132
|
+
return { kind: "target-rejected" };
|
|
12133
|
+
}
|
|
12134
|
+
return {
|
|
12135
|
+
kind: "proof",
|
|
12136
|
+
proof: await prover.prove(compare, input.target, context)
|
|
12137
|
+
};
|
|
12138
|
+
};
|
|
11682
12139
|
for (let iteration = 0; iteration < maxIterations; iteration += 1) {
|
|
11683
12140
|
const context = await input.readContext();
|
|
11684
12141
|
const current = await input.loadCurrent();
|
|
@@ -11696,7 +12153,14 @@ function createStagedTransitionOrchestrator(registry) {
|
|
|
11696
12153
|
}
|
|
11697
12154
|
if (compare.kind !== "transitions") {
|
|
11698
12155
|
if (compare.kind === "unknown" && hasAppliedWork(journals)) {
|
|
11699
|
-
const
|
|
12156
|
+
const proofAtBoundary2 = await proveAtTargetBoundary(
|
|
12157
|
+
compare,
|
|
12158
|
+
context
|
|
12159
|
+
);
|
|
12160
|
+
if (proofAtBoundary2.kind === "target-rejected") {
|
|
12161
|
+
return targetRejectionResult();
|
|
12162
|
+
}
|
|
12163
|
+
const { proof: proof2 } = proofAtBoundary2;
|
|
11700
12164
|
switch (proof2.kind) {
|
|
11701
12165
|
case "no-drift":
|
|
11702
12166
|
return {
|
|
@@ -11750,7 +12214,14 @@ function createStagedTransitionOrchestrator(registry) {
|
|
|
11750
12214
|
);
|
|
11751
12215
|
}
|
|
11752
12216
|
const segmentCompare = projectCompareToSingleCandidate(compare, ready);
|
|
11753
|
-
const
|
|
12217
|
+
const proofAtBoundary = await proveAtTargetBoundary(
|
|
12218
|
+
segmentCompare,
|
|
12219
|
+
context
|
|
12220
|
+
);
|
|
12221
|
+
if (proofAtBoundary.kind === "target-rejected") {
|
|
12222
|
+
return targetRejectionResult();
|
|
12223
|
+
}
|
|
12224
|
+
const { proof } = proofAtBoundary;
|
|
11754
12225
|
if (proof.kind !== "proven") {
|
|
11755
12226
|
return resultWithAggregate(proof.assessment, journals, observations);
|
|
11756
12227
|
}
|
|
@@ -11788,8 +12259,41 @@ function createStagedTransitionOrchestrator(registry) {
|
|
|
11788
12259
|
|
|
11789
12260
|
// src/adapter.ts
|
|
11790
12261
|
function supportsExecution(adapter) {
|
|
12262
|
+
const connectionProvider = adapter;
|
|
12263
|
+
if (typeof connectionProvider.getPoolInstance === "function") {
|
|
12264
|
+
try {
|
|
12265
|
+
connectionProvider.getPoolInstance();
|
|
12266
|
+
} catch {
|
|
12267
|
+
return false;
|
|
12268
|
+
}
|
|
12269
|
+
}
|
|
11791
12270
|
return typeof adapter.execute === "function" && typeof adapter.executeOne === "function" && typeof adapter.executeOneOrThrow === "function";
|
|
11792
12271
|
}
|
|
12272
|
+
function assertConnectionAvailable(adapter, operation) {
|
|
12273
|
+
const availability = adapter.connectionAvailability;
|
|
12274
|
+
if (availability?.status === "unavailable") {
|
|
12275
|
+
throw new ExecutionError({
|
|
12276
|
+
operation,
|
|
12277
|
+
reason: availability.reason,
|
|
12278
|
+
fix: availability.fix
|
|
12279
|
+
});
|
|
12280
|
+
}
|
|
12281
|
+
}
|
|
12282
|
+
function executeCompiledQuery(adapter, query, operation) {
|
|
12283
|
+
assertConnectionAvailable(adapter, operation);
|
|
12284
|
+
return adapter.execute(query);
|
|
12285
|
+
}
|
|
12286
|
+
function executeCompiledQueryWithMeta(adapter, query, operation) {
|
|
12287
|
+
assertConnectionAvailable(adapter, operation);
|
|
12288
|
+
if (typeof adapter.executeWithMeta !== "function") {
|
|
12289
|
+
throw new ExecutionError({
|
|
12290
|
+
operation,
|
|
12291
|
+
reason: "this adapter does not implement executeWithMeta",
|
|
12292
|
+
fix: "Use an adapter that implements executeWithMeta."
|
|
12293
|
+
});
|
|
12294
|
+
}
|
|
12295
|
+
return adapter.executeWithMeta(query);
|
|
12296
|
+
}
|
|
11793
12297
|
function supportsStreaming(adapter) {
|
|
11794
12298
|
return adapter.capabilities?.supportsStreaming === true && "stream" in adapter && typeof adapter.stream === "function";
|
|
11795
12299
|
}
|
|
@@ -12698,7 +13202,7 @@ var CteQueryBuilder = class {
|
|
|
12698
13202
|
const intent = this.buildIntent();
|
|
12699
13203
|
const compileOptions = this.compileOptions();
|
|
12700
13204
|
const compiled = adapter.compileCteQuery(intent, compileOptions);
|
|
12701
|
-
return adapter.
|
|
13205
|
+
return executeCompiledQuery(adapter, compiled, "withCte().all()");
|
|
12702
13206
|
}
|
|
12703
13207
|
/**
|
|
12704
13208
|
* Alias for all().
|
|
@@ -14514,9 +15018,10 @@ var MutationBuilderBase = class {
|
|
|
14514
15018
|
async affectedRows() {
|
|
14515
15019
|
const adapter = this.requireAdapter(this.operationName);
|
|
14516
15020
|
const intent = this.buildIntent();
|
|
15021
|
+
const operation = `${this.operationName}.affectedRows()`;
|
|
14517
15022
|
if (typeof adapter.executeWithMeta !== "function") {
|
|
14518
15023
|
throw new ExecutionError({
|
|
14519
|
-
operation
|
|
15024
|
+
operation,
|
|
14520
15025
|
reason: "this adapter does not support affectedRows(); it does not implement executeWithMeta",
|
|
14521
15026
|
fix: "Use an adapter that implements executeWithMeta, or call execute() when row count metadata is not required."
|
|
14522
15027
|
});
|
|
@@ -14528,18 +15033,18 @@ var MutationBuilderBase = class {
|
|
|
14528
15033
|
onHookError: this.onHookError,
|
|
14529
15034
|
schemaName: this.schemaName,
|
|
14530
15035
|
inTransaction: this.inTransaction,
|
|
14531
|
-
prepare: (preparedIntent) => this.prepareMutationExecution(adapter, preparedIntent)
|
|
15036
|
+
prepare: (preparedIntent) => this.prepareMutationExecution(adapter, preparedIntent, operation)
|
|
14532
15037
|
});
|
|
14533
15038
|
if (execution.affectedRows === void 0) {
|
|
14534
15039
|
throw new ExecutionError({
|
|
14535
|
-
operation
|
|
15040
|
+
operation,
|
|
14536
15041
|
reason: "this adapter does not support affectedRows(); it did not return executeWithMeta metadata",
|
|
14537
15042
|
fix: "Use an adapter that implements executeWithMeta and returns rowCount metadata."
|
|
14538
15043
|
});
|
|
14539
15044
|
}
|
|
14540
15045
|
return execution.affectedRows;
|
|
14541
15046
|
}
|
|
14542
|
-
prepareMutationExecution(adapter, intent) {
|
|
15047
|
+
prepareMutationExecution(adapter, intent, operation = `${this.operationName}()`) {
|
|
14543
15048
|
const compileOptions = {
|
|
14544
15049
|
model: this.model,
|
|
14545
15050
|
...this.schemaName ? { schemaName: this.schemaName } : {}
|
|
@@ -14551,13 +15056,21 @@ var MutationBuilderBase = class {
|
|
|
14551
15056
|
parameters: compiled.parameters,
|
|
14552
15057
|
execute: async () => {
|
|
14553
15058
|
if (typeof adapter.executeWithMeta === "function") {
|
|
14554
|
-
const result2 = await
|
|
15059
|
+
const result2 = await executeCompiledQueryWithMeta(
|
|
15060
|
+
adapter,
|
|
15061
|
+
compiled,
|
|
15062
|
+
operation
|
|
15063
|
+
);
|
|
14555
15064
|
return {
|
|
14556
15065
|
result: result2.rows,
|
|
14557
15066
|
affectedRows: result2.rowCount
|
|
14558
15067
|
};
|
|
14559
15068
|
}
|
|
14560
|
-
const result = await
|
|
15069
|
+
const result = await executeCompiledQuery(
|
|
15070
|
+
adapter,
|
|
15071
|
+
compiled,
|
|
15072
|
+
operation
|
|
15073
|
+
);
|
|
14561
15074
|
return {
|
|
14562
15075
|
result
|
|
14563
15076
|
};
|
|
@@ -14571,13 +15084,17 @@ var MutationBuilderBase = class {
|
|
|
14571
15084
|
parameters: compiled.parameters,
|
|
14572
15085
|
execute: async () => {
|
|
14573
15086
|
if (typeof adapter.executeWithMeta === "function") {
|
|
14574
|
-
const result = await
|
|
15087
|
+
const result = await executeCompiledQueryWithMeta(
|
|
15088
|
+
adapter,
|
|
15089
|
+
compiled,
|
|
15090
|
+
operation
|
|
15091
|
+
);
|
|
14575
15092
|
return {
|
|
14576
15093
|
result: void 0,
|
|
14577
15094
|
affectedRows: result.rowCount
|
|
14578
15095
|
};
|
|
14579
15096
|
}
|
|
14580
|
-
await adapter
|
|
15097
|
+
await executeCompiledQuery(adapter, compiled, operation);
|
|
14581
15098
|
return {
|
|
14582
15099
|
result: void 0
|
|
14583
15100
|
};
|
|
@@ -16414,7 +16931,11 @@ var NqlBuilderImpl = class {
|
|
|
16414
16931
|
parameters: compiled.parameters,
|
|
16415
16932
|
execute: async () => {
|
|
16416
16933
|
if (typeof adapter.executeWithMeta === "function") {
|
|
16417
|
-
const metadata = await
|
|
16934
|
+
const metadata = await executeCompiledQueryWithMeta(
|
|
16935
|
+
adapter,
|
|
16936
|
+
compiled,
|
|
16937
|
+
"nql().all()"
|
|
16938
|
+
);
|
|
16418
16939
|
const hookRows2 = metadata.rows;
|
|
16419
16940
|
const rawRows2 = snapshotMutationRows(hookRows2);
|
|
16420
16941
|
return {
|
|
@@ -16426,7 +16947,11 @@ var NqlBuilderImpl = class {
|
|
|
16426
16947
|
affectedRows: metadata.rowCount
|
|
16427
16948
|
};
|
|
16428
16949
|
}
|
|
16429
|
-
const hookRows = await
|
|
16950
|
+
const hookRows = await executeCompiledQuery(
|
|
16951
|
+
adapter,
|
|
16952
|
+
compiled,
|
|
16953
|
+
"nql().all()"
|
|
16954
|
+
);
|
|
16430
16955
|
const rawRows = snapshotMutationRows(hookRows);
|
|
16431
16956
|
return {
|
|
16432
16957
|
result: {
|
|
@@ -16448,6 +16973,7 @@ var NqlBuilderImpl = class {
|
|
|
16448
16973
|
});
|
|
16449
16974
|
}
|
|
16450
16975
|
async executeNqlProgramSequence(compiledIntent, adapter) {
|
|
16976
|
+
assertConnectionAvailable(adapter, "nql().all()");
|
|
16451
16977
|
if (!supportsTransactions(adapter)) {
|
|
16452
16978
|
throw new ExecutionError({
|
|
16453
16979
|
operation: "nql",
|
|
@@ -16711,6 +17237,7 @@ var NqlBuilderImpl = class {
|
|
|
16711
17237
|
if (hasExecutableNqlProgramSequence(compiledIntent.bundle)) {
|
|
16712
17238
|
return this.executeNqlProgramSequence(compiledIntent, adapter);
|
|
16713
17239
|
}
|
|
17240
|
+
assertConnectionAvailable(adapter, "nql().all()");
|
|
16714
17241
|
if (compiledIntent.kind === "mutation") {
|
|
16715
17242
|
return (await this.runMutationStatement(
|
|
16716
17243
|
adapter,
|
|
@@ -16733,7 +17260,7 @@ var NqlBuilderImpl = class {
|
|
|
16733
17260
|
),
|
|
16734
17261
|
this.nqlBundleCompileOptions()
|
|
16735
17262
|
);
|
|
16736
|
-
const rows = await adapter.
|
|
17263
|
+
const rows = await executeCompiledQuery(adapter, compiled2, "nql().all()");
|
|
16737
17264
|
if (bindingFinalPlanHasJsonAggIncludes(planReport2)) {
|
|
16738
17265
|
hydrateJsonAggIncludes(
|
|
16739
17266
|
rows,
|
|
@@ -16746,7 +17273,7 @@ var NqlBuilderImpl = class {
|
|
|
16746
17273
|
const planReport = this.planInternal();
|
|
16747
17274
|
const finalBundle = this.createFinalNqlStatementBundle(compiledIntent);
|
|
16748
17275
|
const compiled = hasNqlBindings(finalBundle) ? adapter.compile(finalBundle, this.nqlBundleCompileOptions()) : adapter.compile(planReport);
|
|
16749
|
-
return adapter.
|
|
17276
|
+
return executeCompiledQuery(adapter, compiled, "nql().all()");
|
|
16750
17277
|
}
|
|
16751
17278
|
async run() {
|
|
16752
17279
|
await this.all();
|
|
@@ -17246,7 +17773,11 @@ var ResultHydrator = class {
|
|
|
17246
17773
|
parentIds,
|
|
17247
17774
|
compileOptions
|
|
17248
17775
|
);
|
|
17249
|
-
const childResults = await
|
|
17776
|
+
const childResults = await executeCompiledQuery(
|
|
17777
|
+
adapter,
|
|
17778
|
+
includeQuery,
|
|
17779
|
+
"all()"
|
|
17780
|
+
);
|
|
17250
17781
|
const childrenByParentId = /* @__PURE__ */ new Map();
|
|
17251
17782
|
for (const child of childResults) {
|
|
17252
17783
|
const parentId = this.extractKeyValue(
|
|
@@ -17402,7 +17933,11 @@ var ResultHydrator = class {
|
|
|
17402
17933
|
this.model,
|
|
17403
17934
|
compileOptions
|
|
17404
17935
|
);
|
|
17405
|
-
const recursiveRows = await
|
|
17936
|
+
const recursiveRows = await executeCompiledQuery(
|
|
17937
|
+
adapter,
|
|
17938
|
+
compiledRecursive,
|
|
17939
|
+
"all()"
|
|
17940
|
+
);
|
|
17406
17941
|
this.mergeRecursiveResults(
|
|
17407
17942
|
results,
|
|
17408
17943
|
recursiveRows,
|
|
@@ -17642,8 +18177,11 @@ var SetOperationBuilderImpl = class _SetOperationBuilderImpl {
|
|
|
17642
18177
|
}
|
|
17643
18178
|
async all() {
|
|
17644
18179
|
const adapter = this.requireAdapter();
|
|
17645
|
-
const compiled = adapter.compileSetOperation(
|
|
17646
|
-
|
|
18180
|
+
const compiled = adapter.compileSetOperation(
|
|
18181
|
+
this.intent,
|
|
18182
|
+
this.model
|
|
18183
|
+
);
|
|
18184
|
+
return executeCompiledQuery(adapter, compiled, "set operation all()");
|
|
17647
18185
|
}
|
|
17648
18186
|
async first() {
|
|
17649
18187
|
const rows = await this.all();
|
|
@@ -17723,6 +18261,7 @@ function stream(builder, options) {
|
|
|
17723
18261
|
return this;
|
|
17724
18262
|
},
|
|
17725
18263
|
async next() {
|
|
18264
|
+
assertConnectionAvailable(adapter, "stream()");
|
|
17726
18265
|
if (!supportsStreaming(adapter)) {
|
|
17727
18266
|
throw createUnsupportedStreamingError();
|
|
17728
18267
|
}
|
|
@@ -18320,8 +18859,10 @@ var QueryBuilderImpl = class _QueryBuilderImpl {
|
|
|
18320
18859
|
planReport,
|
|
18321
18860
|
compileOptions
|
|
18322
18861
|
);
|
|
18323
|
-
const mainResults = await
|
|
18324
|
-
|
|
18862
|
+
const mainResults = await executeCompiledQuery(
|
|
18863
|
+
adapter,
|
|
18864
|
+
compiledWithIncludes.main,
|
|
18865
|
+
"all()"
|
|
18325
18866
|
);
|
|
18326
18867
|
const hydrator = new ResultHydrator(
|
|
18327
18868
|
this.ctx.model,
|
|
@@ -18494,7 +19035,7 @@ var QueryBuilderImpl = class _QueryBuilderImpl {
|
|
|
18494
19035
|
compileOptions.schemaName = this.ctx.schemaName;
|
|
18495
19036
|
}
|
|
18496
19037
|
const compiled = adapter.compile(planReport, compileOptions);
|
|
18497
|
-
const rows = await adapter
|
|
19038
|
+
const rows = await executeCompiledQuery(adapter, compiled, "exists()");
|
|
18498
19039
|
return rows.length > 0 && rows[0].exists === true;
|
|
18499
19040
|
}
|
|
18500
19041
|
async existsWithHooks(adapter, store) {
|
|
@@ -18550,7 +19091,7 @@ var QueryBuilderImpl = class _QueryBuilderImpl {
|
|
|
18550
19091
|
compileOptions.schemaName = this.ctx.schemaName;
|
|
18551
19092
|
}
|
|
18552
19093
|
const compiled = adapter.compile(planReport, compileOptions);
|
|
18553
|
-
const rows = await adapter
|
|
19094
|
+
const rows = await executeCompiledQuery(adapter, compiled, "exists()");
|
|
18554
19095
|
const result = rows.length > 0 && rows[0].exists === true;
|
|
18555
19096
|
const afterCtx = {
|
|
18556
19097
|
table: this.from,
|
|
@@ -18834,8 +19375,10 @@ var QueryBuilderImpl = class _QueryBuilderImpl {
|
|
|
18834
19375
|
);
|
|
18835
19376
|
let mainResults;
|
|
18836
19377
|
try {
|
|
18837
|
-
mainResults = await
|
|
18838
|
-
|
|
19378
|
+
mainResults = await executeCompiledQuery(
|
|
19379
|
+
adapter,
|
|
19380
|
+
compiledWithIncludes.main,
|
|
19381
|
+
"all()"
|
|
18839
19382
|
);
|
|
18840
19383
|
} catch (error) {
|
|
18841
19384
|
if (store.onError.length > 0) {
|
|
@@ -19253,7 +19796,7 @@ var RawCteQueryBuilder = class {
|
|
|
19253
19796
|
...this.model !== void 0 && { model: this.model }
|
|
19254
19797
|
} : void 0;
|
|
19255
19798
|
const compiled = adapter.compileCteQuery(intent, compileOptions);
|
|
19256
|
-
return adapter.
|
|
19799
|
+
return executeCompiledQuery(adapter, compiled, "recursive().all()");
|
|
19257
19800
|
}
|
|
19258
19801
|
/**
|
|
19259
19802
|
* Alias for `all()`.
|
|
@@ -19840,6 +20383,11 @@ function createOrmInstance(model, strictMode, relationHints, adapter, schemaName
|
|
|
19840
20383
|
)
|
|
19841
20384
|
);
|
|
19842
20385
|
}
|
|
20386
|
+
try {
|
|
20387
|
+
assertConnectionAvailable(adapter, "transaction()");
|
|
20388
|
+
} catch (error) {
|
|
20389
|
+
return Promise.reject(error);
|
|
20390
|
+
}
|
|
19843
20391
|
if (!supportsTransactions(adapter)) {
|
|
19844
20392
|
return Promise.reject(createUnsupportedTransactionError());
|
|
19845
20393
|
}
|
|
@@ -19882,6 +20430,11 @@ function createOrmInstance(model, strictMode, relationHints, adapter, schemaName
|
|
|
19882
20430
|
)
|
|
19883
20431
|
);
|
|
19884
20432
|
}
|
|
20433
|
+
try {
|
|
20434
|
+
assertConnectionAvailable(adapter, "withPinnedConnection()");
|
|
20435
|
+
} catch (error) {
|
|
20436
|
+
return Promise.reject(error);
|
|
20437
|
+
}
|
|
19885
20438
|
if (!supportsPinnedConnections(adapter)) {
|
|
19886
20439
|
return Promise.reject(createUnsupportedPinnedConnectionError());
|
|
19887
20440
|
}
|
|
@@ -21559,6 +22112,7 @@ export {
|
|
|
21559
22112
|
SubqueryBuilder,
|
|
21560
22113
|
SubqueryExpression,
|
|
21561
22114
|
TABLE_META,
|
|
22115
|
+
TRANSITION_LESSOR_REJECTION,
|
|
21562
22116
|
TableNotFoundError,
|
|
21563
22117
|
UnhandledTypeInDialect,
|
|
21564
22118
|
UnknownDialectError,
|
|
@@ -21569,6 +22123,7 @@ export {
|
|
|
21569
22123
|
UpdateBuilder,
|
|
21570
22124
|
UpsertBuilder,
|
|
21571
22125
|
WindowBuilder,
|
|
22126
|
+
acquireTransitionLease,
|
|
21572
22127
|
advisoryObservationId,
|
|
21573
22128
|
aggOrderBy,
|
|
21574
22129
|
and,
|
|
@@ -21576,6 +22131,7 @@ export {
|
|
|
21576
22131
|
array,
|
|
21577
22132
|
arrayAgg,
|
|
21578
22133
|
assertCapability,
|
|
22134
|
+
assertConnectionAvailable,
|
|
21579
22135
|
assertContains,
|
|
21580
22136
|
assertDbColumnExists,
|
|
21581
22137
|
assertDbOutput,
|
|
@@ -21601,8 +22157,10 @@ export {
|
|
|
21601
22157
|
assertSQLTable,
|
|
21602
22158
|
assertSuccess,
|
|
21603
22159
|
assertTypeSupported,
|
|
22160
|
+
assumptionAccepted,
|
|
21604
22161
|
assumptionId,
|
|
21605
22162
|
batchValues,
|
|
22163
|
+
bindExecutionContract,
|
|
21606
22164
|
capitalize,
|
|
21607
22165
|
caseWhen,
|
|
21608
22166
|
cast,
|
|
@@ -21616,11 +22174,13 @@ export {
|
|
|
21616
22174
|
composeBeforeMutationHooks,
|
|
21617
22175
|
composeBeforeQueryHooks,
|
|
21618
22176
|
composeOnErrorHooks,
|
|
22177
|
+
concludeEvidenceForObligation,
|
|
21619
22178
|
countDistinctRelationPathsByName,
|
|
21620
22179
|
createApplier,
|
|
21621
22180
|
createComparator,
|
|
21622
22181
|
createDialectCapabilities,
|
|
21623
22182
|
createEvidenceView,
|
|
22183
|
+
createExecutionContract,
|
|
21624
22184
|
createHookManager,
|
|
21625
22185
|
createNqlTag,
|
|
21626
22186
|
createOrm,
|
|
@@ -21630,6 +22190,8 @@ export {
|
|
|
21630
22190
|
createRawCteBuilder,
|
|
21631
22191
|
createRecursiveMetadata,
|
|
21632
22192
|
createStagedTransitionOrchestrator,
|
|
22193
|
+
createTransitionLessor,
|
|
22194
|
+
createTransitionRunMetadata,
|
|
21633
22195
|
decapitalize,
|
|
21634
22196
|
defaultIndexName,
|
|
21635
22197
|
defaultLogger,
|
|
@@ -21702,6 +22264,7 @@ export {
|
|
|
21702
22264
|
isSubqueryExpression,
|
|
21703
22265
|
export_isSubqueryRef as isSubqueryRef,
|
|
21704
22266
|
isTableRef,
|
|
22267
|
+
isTransitionLessor,
|
|
21705
22268
|
export_isUpdateIntent as isUpdateIntent,
|
|
21706
22269
|
export_isUpsertIntent as isUpsertIntent,
|
|
21707
22270
|
export_isWhereAnd as isWhereAnd,
|
|
@@ -21737,6 +22300,7 @@ export {
|
|
|
21737
22300
|
notExists,
|
|
21738
22301
|
nqlRaw,
|
|
21739
22302
|
objectToWhereIntent,
|
|
22303
|
+
observationContextDigest,
|
|
21740
22304
|
op,
|
|
21741
22305
|
or,
|
|
21742
22306
|
outerRef,
|
|
@@ -21793,8 +22357,10 @@ export {
|
|
|
21793
22357
|
supportsStreaming,
|
|
21794
22358
|
supportsTransactions,
|
|
21795
22359
|
textScore,
|
|
22360
|
+
transitionPlanDigest,
|
|
21796
22361
|
unary,
|
|
21797
22362
|
validateAssertionBlocks,
|
|
22363
|
+
validateExecutionContract,
|
|
21798
22364
|
validateRecursiveInclude,
|
|
21799
22365
|
validateRecursiveShape,
|
|
21800
22366
|
validateSchemaIndexOptions,
|