graphddb 0.7.0 → 0.7.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/cdc/index.d.ts +2 -2
- package/dist/{chunk-GFGVDF4W.js → chunk-H34BNRDZ.js} +631 -43
- package/dist/cli.js +186 -11
- package/dist/{from-change-pnURY-cV.d.ts → from-change-CWiXBcgi.d.ts} +1 -1
- package/dist/{index-Eg94ChE1.d.ts → index-CvS9ATKB.d.ts} +289 -104
- package/dist/index.d.ts +85 -7
- package/dist/index.js +253 -1
- package/dist/linter/index.d.ts +4 -4
- package/dist/{maintenance-view-adapter-BP2CJDdz.d.ts → maintenance-view-adapter-NBTZbE8-.d.ts} +57 -4
- package/dist/{registry-Cv9nl_3i.d.ts → registry-BndKbZbg.d.ts} +1 -1
- package/dist/{relation-depth-BR0y7Q1i.d.ts → relation-depth-CCGHLTOv.d.ts} +1 -1
- package/dist/spec/index.d.ts +3 -3
- package/dist/spec/index.js +13 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/transform/index.d.ts +51 -2
- package/dist/transform/index.js +264 -1
- package/docs/cqrs-contract.md +1 -1
- package/docs/design-patterns.md +9 -7
- package/docs/prepared-statements.md +70 -3
- package/docs/python-bridge.md +24 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,8 +5,10 @@ import {
|
|
|
5
5
|
BatchGetResult,
|
|
6
6
|
DDBModel,
|
|
7
7
|
EDGE_WRITES_MARKER,
|
|
8
|
+
LOGICAL_EFFECT_CATEGORIES,
|
|
8
9
|
MARKER_ROW_ENTITY,
|
|
9
10
|
OLD_VALUE_NAMESPACE,
|
|
11
|
+
PREPARED_FORMAT_VERSION,
|
|
10
12
|
PREPARE_CACHE_MAX,
|
|
11
13
|
PreparedReadStatement,
|
|
12
14
|
PreparedWriteStatement,
|
|
@@ -21,6 +23,7 @@ import {
|
|
|
21
23
|
buildContexts,
|
|
22
24
|
buildContracts,
|
|
23
25
|
buildManifest,
|
|
26
|
+
buildManifestEntity,
|
|
24
27
|
buildOperations,
|
|
25
28
|
buildProjection,
|
|
26
29
|
buildQuerySpec,
|
|
@@ -44,6 +47,7 @@ import {
|
|
|
44
47
|
deriveModelEdgeWriteItems,
|
|
45
48
|
edgeWrites,
|
|
46
49
|
encodeCursor,
|
|
50
|
+
entityFingerprint,
|
|
47
51
|
evaluateFilter,
|
|
48
52
|
execute,
|
|
49
53
|
executeBatchGet,
|
|
@@ -52,6 +56,8 @@ import {
|
|
|
52
56
|
executeExplain,
|
|
53
57
|
executeList,
|
|
54
58
|
executeListInternal,
|
|
59
|
+
executeLogicalParallelWrites,
|
|
60
|
+
executeLogicalWriteOps,
|
|
55
61
|
executeQuery,
|
|
56
62
|
from,
|
|
57
63
|
getEdgeWrites,
|
|
@@ -80,10 +86,11 @@ import {
|
|
|
80
86
|
query,
|
|
81
87
|
resolveLifecycle,
|
|
82
88
|
resolveRelations,
|
|
89
|
+
serializeEffectParams,
|
|
83
90
|
validateDepth,
|
|
84
91
|
when,
|
|
85
92
|
wholeKeysSentinel
|
|
86
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-H34BNRDZ.js";
|
|
87
94
|
import {
|
|
88
95
|
CdcEmulator,
|
|
89
96
|
MAINT_OUTBOX_PK_PREFIX,
|
|
@@ -1282,6 +1289,249 @@ async function executeRangeFanout(op, keys, params = {}) {
|
|
|
1282
1289
|
return out;
|
|
1283
1290
|
}
|
|
1284
1291
|
|
|
1292
|
+
// src/runtime/prepared-loader.ts
|
|
1293
|
+
var LOAD_LABEL = "graphddb.loadPreparedPlan";
|
|
1294
|
+
function slotOfBind(bind) {
|
|
1295
|
+
if ("param" in bind) return { kind: "param", name: bind.param };
|
|
1296
|
+
if ("literal" in bind) return { kind: "literal", value: bind.literal };
|
|
1297
|
+
if ("literalDate" in bind) return { kind: "literal", value: new Date(bind.literalDate) };
|
|
1298
|
+
return { kind: "literal", value: BigInt(bind.literalBigInt) };
|
|
1299
|
+
}
|
|
1300
|
+
function slotsOfBindMap(map2) {
|
|
1301
|
+
const out = {};
|
|
1302
|
+
for (const [field2, bind] of Object.entries(map2 ?? {})) out[field2] = slotOfBind(bind);
|
|
1303
|
+
return out;
|
|
1304
|
+
}
|
|
1305
|
+
function bindValues(slots, params) {
|
|
1306
|
+
const out = {};
|
|
1307
|
+
for (const [field2, slot] of Object.entries(slots)) {
|
|
1308
|
+
out[field2] = slot.kind === "param" ? params[slot.name] : slot.value;
|
|
1309
|
+
}
|
|
1310
|
+
return out;
|
|
1311
|
+
}
|
|
1312
|
+
function resolveModelByName(name, planId) {
|
|
1313
|
+
for (const modelClass of MetadataRegistry.getAll().keys()) {
|
|
1314
|
+
if (modelClass.name === name) return modelClass;
|
|
1315
|
+
}
|
|
1316
|
+
throw new Error(
|
|
1317
|
+
`${LOAD_LABEL}: static plan '${planId}' targets entity '${name}', which is not a registered model in this process. Ensure the model module is imported before the plan executes, or regenerate the artifact (graphddb transform prepared --aot).`
|
|
1318
|
+
);
|
|
1319
|
+
}
|
|
1320
|
+
function bindEntities(plan2, planId) {
|
|
1321
|
+
const classes = /* @__PURE__ */ new Map();
|
|
1322
|
+
const entities = {};
|
|
1323
|
+
const tables = {};
|
|
1324
|
+
for (const [name, expected] of Object.entries(plan2.entities)) {
|
|
1325
|
+
const modelClass = resolveModelByName(name, planId);
|
|
1326
|
+
const metadata = MetadataRegistry.get(modelClass);
|
|
1327
|
+
const actual = entityFingerprint(metadata);
|
|
1328
|
+
if (actual !== expected) {
|
|
1329
|
+
throw new Error(
|
|
1330
|
+
`${LOAD_LABEL}: static plan '${planId}' is STALE \u2014 entity '${name}' has changed since the plan artifact was generated (declaration fingerprint mismatch: expected ${expected.slice(0, 12)}\u2026, live ${actual.slice(0, 12)}\u2026). A stale static plan never executes. Regenerate the artifact: \`graphddb transform prepared --aot <artifact> --write\` (CI: run the check mode to catch this at build time).`
|
|
1331
|
+
);
|
|
1332
|
+
}
|
|
1333
|
+
classes.set(name, modelClass);
|
|
1334
|
+
const entity = buildManifestEntity(metadata);
|
|
1335
|
+
entities[name] = entity;
|
|
1336
|
+
tables[metadata.tableName] = { physicalName: TableMapping.resolve(metadata.tableName) };
|
|
1337
|
+
}
|
|
1338
|
+
return { classes, manifest: { version: SPEC_VERSION, tables, entities } };
|
|
1339
|
+
}
|
|
1340
|
+
function renderSpecItem(transaction, index, manifest, params) {
|
|
1341
|
+
const single = {
|
|
1342
|
+
params: transaction.params,
|
|
1343
|
+
items: [transaction.items[index]]
|
|
1344
|
+
};
|
|
1345
|
+
return expandTransactionItems(single, manifest, params);
|
|
1346
|
+
}
|
|
1347
|
+
function renderEffectsForOp(op, boundParams) {
|
|
1348
|
+
const rendered = serializeEffectParams([op.modelClass], boundParams);
|
|
1349
|
+
const effects = {};
|
|
1350
|
+
const checks = [];
|
|
1351
|
+
const modelBySignature = /* @__PURE__ */ new Map();
|
|
1352
|
+
const { transaction, categories } = op.spec;
|
|
1353
|
+
for (let i = 0; i < transaction.items.length; i++) {
|
|
1354
|
+
const category = categories[i];
|
|
1355
|
+
if (category === "base") continue;
|
|
1356
|
+
for (const out of renderSpecItem(transaction, i, op.manifest, rendered)) {
|
|
1357
|
+
const item = out.item;
|
|
1358
|
+
if (category === "check") {
|
|
1359
|
+
if (item.ConditionCheck !== void 0) checks.push(item.ConditionCheck);
|
|
1360
|
+
continue;
|
|
1361
|
+
}
|
|
1362
|
+
const family = category;
|
|
1363
|
+
if (!LOGICAL_EFFECT_CATEGORIES.includes(family)) {
|
|
1364
|
+
throw new Error(
|
|
1365
|
+
`${LOAD_LABEL}: unknown effect category '${String(category)}' in a static plan (artifact format skew \u2014 regenerate the artifact).`
|
|
1366
|
+
);
|
|
1367
|
+
}
|
|
1368
|
+
(effects[family] ??= []).push(item);
|
|
1369
|
+
if (out.model !== void 0) {
|
|
1370
|
+
modelBySignature.set(execItemKeySignature(item), out.model);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
return { effects, checks, modelBySignature };
|
|
1375
|
+
}
|
|
1376
|
+
var INTENT_TO_KIND = { create: "put", update: "update", remove: "delete" };
|
|
1377
|
+
var AotPreparedWriteStatement = class {
|
|
1378
|
+
/** @internal */
|
|
1379
|
+
constructor(ops) {
|
|
1380
|
+
this.ops = ops;
|
|
1381
|
+
}
|
|
1382
|
+
ops;
|
|
1383
|
+
async execute(params = {}, options = {}) {
|
|
1384
|
+
const logical = this.ops.map((op) => {
|
|
1385
|
+
const bound = {
|
|
1386
|
+
...bindValues(op.inputSlots, params),
|
|
1387
|
+
...bindValues(op.keySlots, params)
|
|
1388
|
+
};
|
|
1389
|
+
const condition = op.conditionSlots !== void 0 ? bindValues(op.conditionSlots, params) : void 0;
|
|
1390
|
+
return {
|
|
1391
|
+
kind: INTENT_TO_KIND[op.spec.intent],
|
|
1392
|
+
modelClass: op.modelClass,
|
|
1393
|
+
modelStatic: op.modelStatic,
|
|
1394
|
+
keyFields: op.spec.keyFields,
|
|
1395
|
+
params: bound,
|
|
1396
|
+
// A `create` guards with attribute_not_exists — the same condition the
|
|
1397
|
+
// compiled base op carries; an explicit gate on a create was rejected at
|
|
1398
|
+
// BUILD time (mirroring the compiled core's `withCondition` reject).
|
|
1399
|
+
...op.spec.intent === "create" ? { condition: { notExists: true } } : condition !== void 0 ? { condition } : {},
|
|
1400
|
+
...op.spec.result !== void 0 ? { result: op.spec.result } : {},
|
|
1401
|
+
renderEffects: (postW1) => renderEffectsForOp(op, postW1)
|
|
1402
|
+
};
|
|
1403
|
+
});
|
|
1404
|
+
const mode = options.mode ?? "transaction";
|
|
1405
|
+
const runOpts = {
|
|
1406
|
+
label: LOAD_LABEL,
|
|
1407
|
+
...options.retry !== void 0 ? { retry: options.retry } : {},
|
|
1408
|
+
...options.context !== void 0 ? { context: options.context } : {}
|
|
1409
|
+
};
|
|
1410
|
+
if (mode === "transaction") {
|
|
1411
|
+
const { readBacks } = await executeLogicalWriteOps(logical, runOpts);
|
|
1412
|
+
const out2 = {};
|
|
1413
|
+
this.ops.forEach((op, i) => {
|
|
1414
|
+
if (op.spec.result !== void 0) out2[op.alias] = readBacks[i];
|
|
1415
|
+
});
|
|
1416
|
+
return out2;
|
|
1417
|
+
}
|
|
1418
|
+
const settled = await executeLogicalParallelWrites(logical, runOpts);
|
|
1419
|
+
const out = {};
|
|
1420
|
+
this.ops.forEach((op, i) => {
|
|
1421
|
+
const res = settled[i];
|
|
1422
|
+
out[op.alias] = res.ok ? { ok: true, value: op.spec.result !== void 0 ? res.value : void 0 } : { ok: false, error: res.error };
|
|
1423
|
+
});
|
|
1424
|
+
return out;
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
function bindReadPlan(plan2, planId) {
|
|
1428
|
+
const { classes } = bindEntities(plan2, planId);
|
|
1429
|
+
const routes = (plan2.reads ?? []).map((r) => {
|
|
1430
|
+
const modelClass = classes.get(r.entity);
|
|
1431
|
+
if (modelClass === void 0) {
|
|
1432
|
+
throw new Error(
|
|
1433
|
+
`${LOAD_LABEL}: static plan '${planId}' route '${r.alias}' targets entity '${r.entity}', which the plan does not fingerprint (artifact skew \u2014 regenerate).`
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1436
|
+
const consistentReadSlot = r.consistentRead !== void 0 ? slotOfBind(r.consistentRead) : void 0;
|
|
1437
|
+
const limitSlot = r.limit !== void 0 ? slotOfBind(r.limit) : void 0;
|
|
1438
|
+
const afterSlot = r.after !== void 0 ? slotOfBind(r.after) : void 0;
|
|
1439
|
+
return {
|
|
1440
|
+
alias: r.alias,
|
|
1441
|
+
kind: r.op,
|
|
1442
|
+
modelClass,
|
|
1443
|
+
select: r.select,
|
|
1444
|
+
keySlots: slotsOfBindMap(r.key),
|
|
1445
|
+
...r.maxDepth !== void 0 ? { maxDepth: r.maxDepth } : {},
|
|
1446
|
+
...r.order !== void 0 ? { order: r.order } : {},
|
|
1447
|
+
...r.filter !== void 0 ? { filter: r.filter } : {},
|
|
1448
|
+
...consistentReadSlot !== void 0 ? { consistentReadSlot } : {},
|
|
1449
|
+
...limitSlot !== void 0 ? { limitSlot } : {},
|
|
1450
|
+
...afterSlot !== void 0 ? { afterSlot } : {}
|
|
1451
|
+
};
|
|
1452
|
+
});
|
|
1453
|
+
return new PreparedReadStatement(routes);
|
|
1454
|
+
}
|
|
1455
|
+
function bindWritePlan(plan2, planId) {
|
|
1456
|
+
const { classes, manifest } = bindEntities(plan2, planId);
|
|
1457
|
+
const ops = (plan2.writes ?? []).map((w) => {
|
|
1458
|
+
const modelClass = classes.get(w.entity);
|
|
1459
|
+
if (modelClass === void 0) {
|
|
1460
|
+
throw new Error(
|
|
1461
|
+
`${LOAD_LABEL}: static plan '${planId}' op '${w.alias}' targets entity '${w.entity}', which the plan does not fingerprint (artifact skew \u2014 regenerate).`
|
|
1462
|
+
);
|
|
1463
|
+
}
|
|
1464
|
+
const modelStatic = modelClass.asModel();
|
|
1465
|
+
return {
|
|
1466
|
+
alias: w.alias,
|
|
1467
|
+
spec: w,
|
|
1468
|
+
modelClass,
|
|
1469
|
+
modelStatic,
|
|
1470
|
+
keySlots: slotsOfBindMap(w.key),
|
|
1471
|
+
inputSlots: slotsOfBindMap(w.input),
|
|
1472
|
+
...w.condition !== void 0 ? { conditionSlots: slotsOfBindMap(w.condition) } : {},
|
|
1473
|
+
manifest
|
|
1474
|
+
};
|
|
1475
|
+
});
|
|
1476
|
+
return new AotPreparedWriteStatement(ops);
|
|
1477
|
+
}
|
|
1478
|
+
function bindPlan(doc, planId) {
|
|
1479
|
+
if (doc === null || typeof doc !== "object" || doc.plans === void 0) {
|
|
1480
|
+
throw new Error(`${LOAD_LABEL}: not a prepared-plan document.`);
|
|
1481
|
+
}
|
|
1482
|
+
if (doc.formatVersion !== PREPARED_FORMAT_VERSION) {
|
|
1483
|
+
throw new Error(
|
|
1484
|
+
`${LOAD_LABEL}: unsupported artifact format version '${String(doc.formatVersion)}' (this runtime supports '${PREPARED_FORMAT_VERSION}'). Regenerate the artifact with the installed graphddb version.`
|
|
1485
|
+
);
|
|
1486
|
+
}
|
|
1487
|
+
if (doc.specVersion !== SPEC_VERSION) {
|
|
1488
|
+
throw new Error(
|
|
1489
|
+
`${LOAD_LABEL}: the artifact was compiled against operation-IR version '${String(doc.specVersion)}' but this runtime speaks '${SPEC_VERSION}'. A version-skewed static plan never executes \u2014 regenerate the artifact.`
|
|
1490
|
+
);
|
|
1491
|
+
}
|
|
1492
|
+
const plan2 = doc.plans[planId];
|
|
1493
|
+
if (plan2 === void 0) {
|
|
1494
|
+
const available = Object.keys(doc.plans).sort().slice(0, 8).join(", ");
|
|
1495
|
+
throw new Error(
|
|
1496
|
+
`${LOAD_LABEL}: the artifact carries no plan '${planId}' (available: ${available}${Object.keys(doc.plans).length > 8 ? ", \u2026" : ""}). The source and the artifact have drifted \u2014 regenerate: \`graphddb transform prepared --aot <artifact> --write\`.`
|
|
1497
|
+
);
|
|
1498
|
+
}
|
|
1499
|
+
return plan2.kind === "read" ? bindReadPlan(plan2, planId) : bindWritePlan(plan2, planId);
|
|
1500
|
+
}
|
|
1501
|
+
var BOUND = /* @__PURE__ */ new WeakMap();
|
|
1502
|
+
var LazyAotHandle = class {
|
|
1503
|
+
constructor(doc, planId) {
|
|
1504
|
+
this.doc = doc;
|
|
1505
|
+
this.planId = planId;
|
|
1506
|
+
}
|
|
1507
|
+
doc;
|
|
1508
|
+
planId;
|
|
1509
|
+
bound;
|
|
1510
|
+
resolve() {
|
|
1511
|
+
if (this.bound !== void 0) return this.bound;
|
|
1512
|
+
let perDoc = BOUND.get(this.doc);
|
|
1513
|
+
if (perDoc === void 0) {
|
|
1514
|
+
perDoc = /* @__PURE__ */ new Map();
|
|
1515
|
+
BOUND.set(this.doc, perDoc);
|
|
1516
|
+
}
|
|
1517
|
+
let handle = perDoc.get(this.planId);
|
|
1518
|
+
if (handle === void 0) {
|
|
1519
|
+
handle = bindPlan(this.doc, this.planId);
|
|
1520
|
+
perDoc.set(this.planId, handle);
|
|
1521
|
+
}
|
|
1522
|
+
this.bound = handle;
|
|
1523
|
+
return handle;
|
|
1524
|
+
}
|
|
1525
|
+
async execute(params, options) {
|
|
1526
|
+
const target = this.resolve();
|
|
1527
|
+
return target.execute(params, options);
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
function loadPreparedPlan(doc, planId, body) {
|
|
1531
|
+
void body;
|
|
1532
|
+
return new LazyAotHandle(doc, planId);
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1285
1535
|
// src/relation/maintenance-rebuild.ts
|
|
1286
1536
|
function toClass(m) {
|
|
1287
1537
|
try {
|
|
@@ -1858,6 +2108,7 @@ function assertDefinition(name, def) {
|
|
|
1858
2108
|
}
|
|
1859
2109
|
}
|
|
1860
2110
|
export {
|
|
2111
|
+
AotPreparedWriteStatement,
|
|
1861
2112
|
BATCH_GET_MAX_KEYS,
|
|
1862
2113
|
BATCH_WRITE_MAX_ITEMS,
|
|
1863
2114
|
BatchGetResult,
|
|
@@ -2006,6 +2257,7 @@ export {
|
|
|
2006
2257
|
lifecyclePhaseForIntent,
|
|
2007
2258
|
list,
|
|
2008
2259
|
literal,
|
|
2260
|
+
loadPreparedPlan,
|
|
2009
2261
|
maintainTrigger,
|
|
2010
2262
|
maintainedFrom,
|
|
2011
2263
|
map,
|
package/dist/linter/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LintRule } from '../registry-
|
|
2
|
-
export { a as LintResult, b as Linter } from '../registry-
|
|
3
|
-
export { c as createDefaultLinter, g as gsiAmbiguityRule, m as missingGsiRule, n as noScanRule, q as queryBoundaryRule, r as relationDepthRule, a as requireLimitRule } from '../relation-depth-
|
|
4
|
-
import '../maintenance-view-adapter-
|
|
1
|
+
import { L as LintRule } from '../registry-BndKbZbg.js';
|
|
2
|
+
export { a as LintResult, b as Linter } from '../registry-BndKbZbg.js';
|
|
3
|
+
export { c as createDefaultLinter, g as gsiAmbiguityRule, m as missingGsiRule, n as noScanRule, q as queryBoundaryRule, r as relationDepthRule, a as requireLimitRule } from '../relation-depth-CCGHLTOv.js';
|
|
4
|
+
import '../maintenance-view-adapter-NBTZbE8-.js';
|
|
5
5
|
import '@aws-sdk/client-dynamodb';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/{maintenance-view-adapter-BP2CJDdz.d.ts → maintenance-view-adapter-NBTZbE8-.d.ts}
RENAMED
|
@@ -4135,8 +4135,17 @@ declare function buildMaintenanceGraph(registry?: ReadonlyMap<Function, EntityMe
|
|
|
4135
4135
|
* `PROFILE`).
|
|
4136
4136
|
*/
|
|
4137
4137
|
|
|
4138
|
-
/**
|
|
4139
|
-
|
|
4138
|
+
/**
|
|
4139
|
+
* The schema version emitted in every manifest / operations document.
|
|
4140
|
+
*
|
|
4141
|
+
* `1.1` (issue #208, B案): the operation IR gained the **list fan-out binding
|
|
4142
|
+
* form** ({@link SourceListSpec} on a `BatchGetItem` relation op), lifting the
|
|
4143
|
+
* #197 `refs` loud-reject. The op vocabulary (the physical DynamoDB API surface)
|
|
4144
|
+
* is unchanged — only the dataflow (source→key) binding grammar grew. Purely
|
|
4145
|
+
* additive: every `1.0` document is a valid `1.1` document, and a document that
|
|
4146
|
+
* uses no `refs` relation serializes byte-identically apart from this version.
|
|
4147
|
+
*/
|
|
4148
|
+
declare const SPEC_VERSION: "1.1";
|
|
4140
4149
|
/** Field type as carried in the manifest (derived from the DynamoDB type). */
|
|
4141
4150
|
type ManifestFieldType = 'string' | 'number' | 'boolean' | 'binary' | 'stringSet' | 'numberSet' | 'list' | 'map';
|
|
4142
4151
|
interface ManifestField {
|
|
@@ -4306,6 +4315,45 @@ interface OperationSpec {
|
|
|
4306
4315
|
* drive this operation's `{result.*}` placeholders. Absent on the root op.
|
|
4307
4316
|
*/
|
|
4308
4317
|
readonly sourceField?: string;
|
|
4318
|
+
/**
|
|
4319
|
+
* The **list fan-out binding form** (issue #208, B案 — the shared-IR
|
|
4320
|
+
* generalization that lifted the #197 `refs` loud-reject). Present only on a
|
|
4321
|
+
* `BatchGetItem` relation operation that resolves a `refs` relation: instead of
|
|
4322
|
+
* reading ONE scalar `parent[sourceField]`, the runtime reads the parent **list
|
|
4323
|
+
* attribute** {@link SourceListSpec.from} and binds `{result.<sourceField>}`
|
|
4324
|
+
* once per element — `element[key]` for an object element, the element itself
|
|
4325
|
+
* for a bare scalar — skipping null/undefined refs. All element keys across all
|
|
4326
|
+
* parents fan into ONE deduped `BatchGetItem` (the existing chunk/retry
|
|
4327
|
+
* machinery), and the operation's `resultPath` (`…<prop>.items`) receives a
|
|
4328
|
+
* connection `{ items, cursor: null }` whose items are the resolved child
|
|
4329
|
+
* bodies in **first-seen element order**, deduped, with missing bodies dropped
|
|
4330
|
+
* — byte-matching the TS in-process `fetchRefsList` semantics. Absent on every
|
|
4331
|
+
* scalar-bound relation op (a pre-#208 document is byte-identical).
|
|
4332
|
+
*/
|
|
4333
|
+
readonly sourceList?: SourceListSpec;
|
|
4334
|
+
}
|
|
4335
|
+
/**
|
|
4336
|
+
* The list-valued source descriptor of a fan-out `BatchGetItem` operation (issue
|
|
4337
|
+
* #208 B案; the operation-IR mirror of the manifest's `ManifestRelation.refs`).
|
|
4338
|
+
*/
|
|
4339
|
+
interface SourceListSpec {
|
|
4340
|
+
/** The parent LIST attribute holding the inline reference elements (e.g. `tagRefs`). */
|
|
4341
|
+
readonly from: string;
|
|
4342
|
+
/**
|
|
4343
|
+
* The field read off each element (e.g. `tagId`). Always equals the operation's
|
|
4344
|
+
* `sourceField` (the `{result.<sourceField>}` token name); carried explicitly so
|
|
4345
|
+
* the op is self-describing.
|
|
4346
|
+
*/
|
|
4347
|
+
readonly key: string;
|
|
4348
|
+
/**
|
|
4349
|
+
* `true` when the parent list attribute was NOT selected by the query and was
|
|
4350
|
+
* projected onto the parent operation **solely** to drive this fan-out. The
|
|
4351
|
+
* runtime must then delete `from` from every parent node after ALL relation
|
|
4352
|
+
* operations are applied — mirroring the TS hydrator, which projects implicit
|
|
4353
|
+
* relation-source fields but strips them from the assembled result. Absent when
|
|
4354
|
+
* the query's select projects the attribute itself (it stays in the result).
|
|
4355
|
+
*/
|
|
4356
|
+
readonly implicit?: boolean;
|
|
4309
4357
|
}
|
|
4310
4358
|
/**
|
|
4311
4359
|
* The **execution plan** for a multi-operation read (issue #70a). It is the
|
|
@@ -6368,7 +6416,9 @@ interface PreparedReadExecOptions {
|
|
|
6368
6416
|
/**
|
|
6369
6417
|
* A recorded binding: a value is either a param slot (bind from `params[name]`) or
|
|
6370
6418
|
* a static literal (used verbatim). Discovered ONCE at prepare from the recording
|
|
6371
|
-
* `$` proxy, replayed per `execute`.
|
|
6419
|
+
* `$` proxy, replayed per `execute`. Exported (@internal) for the #208 AOT
|
|
6420
|
+
* emitter (`src/spec/prepared.ts`) and loader (`src/runtime/prepared-loader.ts`),
|
|
6421
|
+
* which serialize / rebind exactly this structure.
|
|
6372
6422
|
*/
|
|
6373
6423
|
type Slot = {
|
|
6374
6424
|
readonly kind: 'param';
|
|
@@ -6386,6 +6436,9 @@ interface CompiledWriteOp {
|
|
|
6386
6436
|
readonly conditionSlots?: Readonly<Record<string, Slot>>;
|
|
6387
6437
|
readonly result?: PreparedWriteRoute['result'];
|
|
6388
6438
|
}
|
|
6439
|
+
/** @internal — exported for the #208 AOT loader, which reconstructs these
|
|
6440
|
+
* routes from the static plan artifact and executes them through the SAME
|
|
6441
|
+
* {@link PreparedReadStatement}. */
|
|
6389
6442
|
interface CompiledReadRoute {
|
|
6390
6443
|
readonly alias: string;
|
|
6391
6444
|
readonly kind: 'query' | 'list';
|
|
@@ -7316,4 +7369,4 @@ interface ViewDefinition {
|
|
|
7316
7369
|
*/
|
|
7317
7370
|
declare function collectViewDefinitions(registry?: ReadonlyMap<Function, EntityMetadata>): ViewDefinition[];
|
|
7318
7371
|
|
|
7319
|
-
export { type
|
|
7372
|
+
export { type OperationsDocument as $, type ContractSpec as A, type BatchResult as B, type CdcEmulatorOptions as C, type DynamoDBOperation as D, type EventLog as E, type FaultSpec as F, type QuerySpec as G, type CommandSpec as H, type TransactionSpec as I, type ContextSpec as J, SPEC_VERSION as K, type ParamSpec as L, type ModelStatic as M, type PreparedBody as N, type ParamDescriptor as O, type PutInput as P, type QueryModelContract as Q, type ReplayOptions as R, type ShardId as S, type TransactWriteExecItem as T, type Unsubscribe as U, type ViewDefinition as V, type WriteExecOptions as W, type EntityRef as X, type ConditionInput as Y, type Param as Z, type DefinitionMap as _, type CdcMode as a, type FieldOptions as a$, type AnyOperationDefinition as a0, type Manifest as a1, type BridgeBundle as a2, type ConditionSpec as a3, type CommandContractMethodSpec as a4, type CommandResolutionTarget as a5, type CompiledFragment as a6, type CompiledMutationPlan as a7, type ComposeSpec as a8, type CompositionPlanSpec as a9, type QueryContractMethodSpec as aA, type RangeConditionSpec as aB, type ReadOperationType as aC, type TransactionItemSpec as aD, type TransactionItemType as aE, type WhenSpec as aF, type WriteOperationType as aG, assertNoCrossFragmentMaintainCollision as aH, compileFragment as aI, compileMutationPlan as aJ, compileSingleFragmentPlan as aK, resetMaintenanceGraphCache as aL, resolveLifecycle as aM, resolveMaintainers as aN, type SelectableOf as aO, type PrimaryKeyOf as aP, type RequestContext as aQ, type Middleware as aR, type ReadRequestKind as aS, type CtxModel as aT, type ReadParams as aU, type ReadRequestCtx as aV, type Item as aW, type RetryPolicy as aX, type KeyDefinition as aY, type GsiDefinition as aZ, type ModelKind as a_, type ContractCardinality as aa, type ContractCommandResult as ab, type ContractInputArity as ac, type ContractKeySpec as ad, type ContractKind as ae, type ContractResolution as af, type DerivedConditionCheck as ag, type DerivedEdgeWrite as ah, type DerivedIdempotencyGuard as ai, type DerivedMaintainOutbox as aj, type DerivedMaintainWrite as ak, type DerivedOutboxEvent as al, type DerivedUniqueGuard as am, type DerivedUpdate as an, type EntityRefResolver as ao, type ExecutionPlanSpec as ap, type FilterSpec as aq, MAX_TRANSACT_COMPOSE_ITEMS as ar, type ManifestEntity as as, type ManifestField as at, type ManifestFieldType as au, type ManifestGsi as av, type ManifestKey as aw, type ManifestRelation as ax, type ManifestTable as ay, type OperationSpec as az, type ChangeBatch as b, type ContractQueryParams as b$, type DynamoType as b0, type ProjectionTransform as b1, type MaintainEvent as b2, type MembershipPredicate as b3, type MaintainConsistency as b4, type MaintainUpdateMode as b5, type MembershipPredicateOp as b6, type RelationOptions as b7, type AggregateOptions as b8, type AggregateValue as b9, type BatchWriteRequest as bA, CONTRACT_RANGE_FANOUT_CONCURRENCY as bB, type CdcModelRegistry as bC, type CdcSubscribeHandlers as bD, type Change as bE, type CollectionEffect as bF, type CollectionOptions as bG, type Column as bH, type ColumnMap as bI, type CommandInputShape as bJ, type CommandMethod as bK, type CommandPlan as bL, type CommandResultKind as bM, type CommandSelectShape as bN, type CondSlot as bO, type ConditionCheckInput as bP, type Connection as bQ, type ContractCallSignature as bR, type ContractCommandParams as bS, type ContractComposeNode as bT, type ContractFromRef as bU, type ContractItem as bV, type ContractKeyFieldRef as bW, type ContractKeyInput as bX, type ContractKeyRef as bY, type ContractMethodOp as bZ, type ContractParamRef as b_, type SelectBuilderSpec as ba, type RawCondition as bb, type RetryOverride as bc, type ExecutionPlan as bd, type FieldMetadata as be, type ResolvedKey as bf, type Slot as bg, type PreparedWriteExecOptions as bh, type CommandReturn as bi, type ParallelOpResult as bj, type PreparedStatement as bk, type RelationMetadata as bl, type MaintainEffect as bm, type OperationDefinition as bn, type WriteDefinitionOptions as bo, type PartialQueryKeyOf as bp, type StrictSelectSpec as bq, type ReadDefinitionOptions as br, type EntityInput as bs, type UniqueQueryKeyOf as bt, type AggregateMetadata as bu, type BatchDeleteRequest as bv, type BatchGetOptions as bw, type BatchGetRequest as bx, BatchGetResult as by, type BatchPutRequest as bz, type ChangeEvent as c, PreparedWriteStatement as c$, type CounterAggregate as c0, type CounterEffect as c1, type CtxBase as c2, DEFAULT_MAX_ATTEMPTS as c3, DEFAULT_RETRY_POLICY as c4, type DeleteOptions as c5, type DeriveEffect as c6, type DescriptorBinding as c7, ENTITY_WRITES_MARKER as c8, type EdgeEffect as c9, type MaintenanceGraph as cA, type MembershipEffect as cB, type ModelRef as cC, type MutateMode as cD, type MutateOptions as cE, type MutateParallelResult as cF, type MutateTransactionResult as cG, type MutationBody as cH, type MutationDescriptorMap as cI, type MutationFragment as cJ, type MutationInputProxy as cK, type MutationInputRef as cL, type MutationIntent as cM, type NumberParam as cN, type OperationKind as cO, PREPARE_CACHE_MAX as cP, type ParamKind as cQ, type ParamStructure as cR, type PersistCtx as cS, type PersistOrigin as cT, type PlannedCommandMethod as cU, type PreparedInputProxy as cV, type PreparedParamRef as cW, type PreparedReadExecOptions as cX, type PreparedReadRoute as cY, PreparedReadStatement as cZ, type PreparedWriteRoute as c_, type EffectPath as ca, type EmbeddedMetadata as cb, type EmitEffect as cc, type EntityWritesDefinition as cd, type EntityWritesShape as ce, type ExecutableCommandContract as cf, type ExecutableQueryContract as cg, type FilterInput as ch, type FragmentInput as ci, type GsiDefinitionMarker as cj, type GsiOptions as ck, type IdempotencyEffect as cl, type InProcessWriteDescriptor as cm, type InlineSnapshotSpec as cn, type InputArity as co, type KeyDefinitionMarker as cp, type KeySegment as cq, type KeySlot as cr, type KeyStructure as cs, type KeyedResult as ct, LIFECYCLE_CONTRACT_MARKER as cu, type LifecycleContract as cv, type LifecycleEffects as cw, type LiteralParam as cx, type MaintainItem as cy, type MaintainTrigger as cz, type ChangeEventName as d, executeKeyedBatchGet as d$, type ProjectionMap as d0, type ProjectionTransformOp as d1, type PutOptions as d2, type QueryEnvelopeResult as d3, type QueryKeyOf as d4, type QueryMethod as d5, type QueryResult as d6, type ReadEnvelope as d7, type ReadOpCtx as d8, type ReadOpKind as d9, type UniqueEffect as dA, type Updatable as dB, type UpdateOptions as dC, type ViewSourceSlice as dD, type WriteCtx as dE, type WriteDescriptor as dF, type WriteEnvelope as dG, type WriteInput as dH, type WriteKind as dI, type WriteLifecyclePhase as dJ, type WriteMiddleware as dK, type WriteRecorder as dL, type WriteResultProjection as dM, attachModelClass as dN, buildDeleteInput as dO, buildMaintenanceGraph as dP, buildPutInput as dQ, buildUpdateInput as dR, collectViewDefinitions as dS, cond as dT, contractOfMethodSpec as dU, definePlan as dV, entityWrites as dW, executeBatchGet as dX, executeBatchWrite as dY, executeCommandMethod as dZ, executeDelete as d_, type ReadRouteDescriptor as da, type ReadRouteOptions as db, type ReadRouteResult as dc, type RecordedCompose as dd, type RelationBuilder as de, type RelationConsistency as df, type RelationLimitOptions as dg, type RelationPattern as dh, type RelationProjection as di, type RelationReadOptions as dj, type RelationSelect as dk, type RelationSpec as dl, type RelationUpdateMode as dm, type RelationWriteOptions as dn, type RequiresEffect as dp, type Resolution as dq, type RetryInfo as dr, type RetryOperationKind as ds, type SegmentSpec as dt, type SegmentedKey as du, type SelectBuilder as dv, type SelectOf as dw, type SnapshotEffect as dx, type StringParam as dy, TransactionContext as dz, type ChangeHandler as e, executePut as e0, executeQueryMethod as e1, executeRangeFanout as e2, executeTransaction as e3, executeUpdate as e4, from as e5, getEntityWrites as e6, gsi as e7, identity as e8, isColumn as e9, param as eA, prepare as eB, preview as eC, publicCommandModel as eD, publicQueryModel as eE, query as eF, wholeKeysSentinel as eG, isCommandModelContract as ea, isCommandPlan as eb, isContractComposeNode as ec, isContractFromRef as ed, isContractKeyFieldRef as ee, isContractKeyRef as ef, isContractParamRef as eg, isEntityWritesDefinition as eh, isKeySegment as ei, isLifecycleContract as ej, isMaintainTrigger as ek, isMutationFragment as el, isMutationInputRef as em, isParam as en, isPlannedCommandMethod as eo, isPreparedParamRef as ep, isQueryModelContract as eq, isRetryableError as er, isRetryableTransactionCancellation as es, k as et, key as eu, lifecyclePhaseForIntent as ev, maintainTrigger as ew, mintContractKeyFieldRef as ex, mintContractParamRef as ey, mutation as ez, type ClockMode as f, type ConcurrentRecomputeRef as g, type StartingPosition as h, type StreamViewType as i, type SubscribeHandler as j, type SubscribeHandlers as k, buildSubscribeHandler as l, type EntityMetadata as m, type Executor as n, type ReadExecOptions as o, type ExecutorResult as p, type BatchGetExecInput as q, type WriteResult as r, type UpdateInput as s, type DeleteInput as t, type BatchWriteExecItem as u, type BatchExecOptions as v, DDBModel as w, type QueryMethodSpec as x, type CommandModelContract as y, type CommandMethodSpec as z };
|
package/dist/spec/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { A as AnyModelContract, B as BuiltContracts, C as ContextOwnership,
|
|
3
|
-
import '../registry-
|
|
1
|
+
export { a2 as BridgeBundle, a4 as CommandContractMethodSpec, a5 as CommandResolutionTarget, H as CommandSpec, a6 as CompiledFragment, a7 as CompiledMutationPlan, a8 as ComposeSpec, a9 as CompositionPlanSpec, a3 as ConditionSpec, J as ContextSpec, aa as ContractCardinality, ab as ContractCommandResult, ac as ContractInputArity, ad as ContractKeySpec, ae as ContractKind, af as ContractResolution, A as ContractSpec, ag as DerivedConditionCheck, ah as DerivedEdgeWrite, ai as DerivedIdempotencyGuard, aj as DerivedMaintainOutbox, ak as DerivedMaintainWrite, al as DerivedOutboxEvent, am as DerivedUniqueGuard, an as DerivedUpdate, ao as EntityRefResolver, ap as ExecutionPlanSpec, aq as FilterSpec, ar as MAX_TRANSACT_COMPOSE_ITEMS, a1 as Manifest, as as ManifestEntity, at as ManifestField, au as ManifestFieldType, av as ManifestGsi, aw as ManifestKey, ax as ManifestRelation, ay as ManifestTable, az as OperationSpec, $ as OperationsDocument, L as ParamSpec, aA as QueryContractMethodSpec, G as QuerySpec, aB as RangeConditionSpec, aC as ReadOperationType, K as SPEC_VERSION, aD as TransactionItemSpec, aE as TransactionItemType, I as TransactionSpec, aF as WhenSpec, aG as WriteOperationType, aH as assertNoCrossFragmentMaintainCollision, aI as compileFragment, aJ as compileMutationPlan, aK as compileSingleFragmentPlan, aL as resetMaintenanceGraphCache, aM as resolveLifecycle, aN as resolveMaintainers } from '../maintenance-view-adapter-NBTZbE8-.js';
|
|
2
|
+
export { A as AnyModelContract, B as BuiltContracts, C as ContextOwnership, b as ContextOwnershipMap, c as ContractBoundaryViolation, d as ContractInputs, e as ContractMap, f as ContractN1Violation, O as PREPARED_FORMAT_VERSION, Q as PreparedBindMap, g as PreparedBindSpec, a as PreparedPlanDocument, h as PreparedPlanSpec, i as PreparedReadRouteSpec, P as PreparedWriteOpSpec, s as assertBundleSerializable, t as assertContractBoundaries, u as assertContractN1Safe, v as assertJsonSerializable, w as assertSupportedCondition, x as buildBridgeBundle, y as buildContexts, z as buildContracts, D as buildManifest, E as buildOperations, R as buildPreparedPlanDocument, F as buildQuerySpec, G as buildTransactionSpec, H as buildTransactions, S as canonicalJson, I as collectContractBoundaryViolations, J as collectContractN1Violations, U as compilePreparedPlan, V as entityFingerprint, X as planFingerprint } from '../index-CvS9ATKB.js';
|
|
3
|
+
import '../registry-BndKbZbg.js';
|
|
4
4
|
import '@aws-sdk/client-dynamodb';
|
package/dist/spec/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MAX_TRANSACT_COMPOSE_ITEMS,
|
|
3
|
+
PREPARED_FORMAT_VERSION,
|
|
3
4
|
SPEC_VERSION,
|
|
4
5
|
assertBundleSerializable,
|
|
5
6
|
assertContractBoundaries,
|
|
@@ -12,22 +13,28 @@ import {
|
|
|
12
13
|
buildContracts,
|
|
13
14
|
buildManifest,
|
|
14
15
|
buildOperations,
|
|
16
|
+
buildPreparedPlanDocument,
|
|
15
17
|
buildQuerySpec,
|
|
16
18
|
buildTransactionSpec,
|
|
17
19
|
buildTransactions,
|
|
20
|
+
canonicalJson,
|
|
18
21
|
collectContractBoundaryViolations,
|
|
19
22
|
collectContractN1Violations,
|
|
20
23
|
compileFragment,
|
|
21
24
|
compileMutationPlan,
|
|
25
|
+
compilePreparedPlan,
|
|
22
26
|
compileSingleFragmentPlan,
|
|
27
|
+
entityFingerprint,
|
|
28
|
+
planFingerprint,
|
|
23
29
|
resetMaintenanceGraphCache,
|
|
24
30
|
resolveLifecycle,
|
|
25
31
|
resolveMaintainers
|
|
26
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-H34BNRDZ.js";
|
|
27
33
|
import "../chunk-F2DI3GTI.js";
|
|
28
34
|
import "../chunk-PDUVTYC5.js";
|
|
29
35
|
export {
|
|
30
36
|
MAX_TRANSACT_COMPOSE_ITEMS,
|
|
37
|
+
PREPARED_FORMAT_VERSION,
|
|
31
38
|
SPEC_VERSION,
|
|
32
39
|
assertBundleSerializable,
|
|
33
40
|
assertContractBoundaries,
|
|
@@ -40,14 +47,19 @@ export {
|
|
|
40
47
|
buildContracts,
|
|
41
48
|
buildManifest,
|
|
42
49
|
buildOperations,
|
|
50
|
+
buildPreparedPlanDocument,
|
|
43
51
|
buildQuerySpec,
|
|
44
52
|
buildTransactionSpec,
|
|
45
53
|
buildTransactions,
|
|
54
|
+
canonicalJson,
|
|
46
55
|
collectContractBoundaryViolations,
|
|
47
56
|
collectContractN1Violations,
|
|
48
57
|
compileFragment,
|
|
49
58
|
compileMutationPlan,
|
|
59
|
+
compilePreparedPlan,
|
|
50
60
|
compileSingleFragmentPlan,
|
|
61
|
+
entityFingerprint,
|
|
62
|
+
planFingerprint,
|
|
51
63
|
resetMaintenanceGraphCache,
|
|
52
64
|
resolveLifecycle,
|
|
53
65
|
resolveMaintainers
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as Executor, D as DynamoDBOperation, o as ReadExecOptions, p as ExecutorResult, q as BatchGetExecInput, P as PutInput, W as WriteExecOptions, r as WriteResult, s as UpdateInput, t as DeleteInput, u as BatchWriteExecItem, v as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, w as DDBModel, c as ChangeEvent } from '../maintenance-view-adapter-
|
|
1
|
+
import { n as Executor, D as DynamoDBOperation, o as ReadExecOptions, p as ExecutorResult, q as BatchGetExecInput, P as PutInput, W as WriteExecOptions, r as WriteResult, s as UpdateInput, t as DeleteInput, u as BatchWriteExecItem, v as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, w as DDBModel, c as ChangeEvent } from '../maintenance-view-adapter-NBTZbE8-.js';
|
|
2
2
|
import '@aws-sdk/client-dynamodb';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -115,7 +115,10 @@ type PreparedDiagnosticCode =
|
|
|
115
115
|
/** The `prepare` argument is not a statically visible function body. */
|
|
116
116
|
| 'unverifiable-body'
|
|
117
117
|
/** Informational: an inline call site the transform hoists (check mode). */
|
|
118
|
-
| 'hoistable'
|
|
118
|
+
| 'hoistable'
|
|
119
|
+
/** Informational (#208 --aot check mode): a `DDBModel.prepare` call site not
|
|
120
|
+
* yet rewritten to the static-plan loader (`--aot … --write` rewrites it). */
|
|
121
|
+
| 'aot-pending';
|
|
119
122
|
/** One lint / transform diagnostic, positioned in the original source. */
|
|
120
123
|
interface PreparedDiagnostic {
|
|
121
124
|
readonly code: PreparedDiagnosticCode;
|
|
@@ -163,5 +166,51 @@ declare function transformPreparedSource(fileName: string, sourceText: string, o
|
|
|
163
166
|
* reported as `hoistable` notes so a build can surface silent-slow fallbacks.
|
|
164
167
|
*/
|
|
165
168
|
declare function lintPreparedSource(fileName: string, sourceText: string): readonly PreparedDiagnostic[];
|
|
169
|
+
/** The local identifier the rewrite binds `loadPreparedPlan` to. */
|
|
170
|
+
declare const AOT_LOADER_LOCAL = "__gddbLoadPreparedPlan";
|
|
171
|
+
/** The local identifier the rewrite binds the artifact document to. */
|
|
172
|
+
declare const AOT_PLANS_LOCAL = "__gddbPreparedPlans";
|
|
173
|
+
/** The named export of an evaluation shim: `{ <siteIndex>: <bodyFn> }`. */
|
|
174
|
+
declare const AOT_SHIM_EXPORT = "__gddbAotBodies";
|
|
175
|
+
/** One discovered prepared call site (either form), verified and numbered. */
|
|
176
|
+
interface PreparedAotSite {
|
|
177
|
+
/** 1-based document-order index within the file. */
|
|
178
|
+
readonly index: number;
|
|
179
|
+
/** The stable plan id: `<planIdPrefix>#<index>`. */
|
|
180
|
+
readonly planId: string;
|
|
181
|
+
/** `prepare` (original form) or `aot` (already rewritten). */
|
|
182
|
+
readonly form: 'prepare' | 'aot';
|
|
183
|
+
}
|
|
184
|
+
/** The per-file result of the AOT pass. */
|
|
185
|
+
interface PreparedAotFileResult {
|
|
186
|
+
readonly fileName: string;
|
|
187
|
+
/** The rewritten source (identical to the input in check mode / no change). */
|
|
188
|
+
readonly text: string;
|
|
189
|
+
readonly changed: boolean;
|
|
190
|
+
readonly sites: readonly PreparedAotSite[];
|
|
191
|
+
/**
|
|
192
|
+
* The evaluation-shim module source (present when the file has ≥1 verified
|
|
193
|
+
* site and no violations). Importing it yields `{ [AOT_SHIM_EXPORT]:
|
|
194
|
+
* Record<siteIndex, PreparedBody> }`.
|
|
195
|
+
*/
|
|
196
|
+
readonly shimSource?: string;
|
|
197
|
+
readonly diagnostics: readonly PreparedDiagnostic[];
|
|
198
|
+
readonly errorCount: number;
|
|
199
|
+
}
|
|
200
|
+
interface PreparedAotOptions {
|
|
201
|
+
/** `transform` rewrites call sites; `check` only discovers + lints (drift mode). */
|
|
202
|
+
readonly mode: 'transform' | 'check';
|
|
203
|
+
/** The plan-id prefix — the project-relative source path (POSIX separators). */
|
|
204
|
+
readonly planIdPrefix: string;
|
|
205
|
+
/** The module specifier the rewrite imports the artifact document from. */
|
|
206
|
+
readonly artifactImport: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The #208 AOT pass over one source file: discover + verify every prepared call
|
|
210
|
+
* site (both forms), assign stable plan ids, build the evaluation shim, and (in
|
|
211
|
+
* `transform` mode) rewrite `DDBModel.prepare` sites to the static-plan loader.
|
|
212
|
+
* See the section header above for the full contract.
|
|
213
|
+
*/
|
|
214
|
+
declare function transformPreparedSourceAot(fileName: string, sourceText: string, options: PreparedAotOptions): PreparedAotFileResult;
|
|
166
215
|
|
|
167
|
-
export { HOIST_SLOT_PREFIX, type PreparedDiagnostic, type PreparedDiagnosticCode, type PreparedTransformOptions, type PreparedTransformResult, lintPreparedSource, transformPreparedSource };
|
|
216
|
+
export { AOT_LOADER_LOCAL, AOT_PLANS_LOCAL, AOT_SHIM_EXPORT, HOIST_SLOT_PREFIX, type PreparedAotFileResult, type PreparedAotOptions, type PreparedAotSite, type PreparedDiagnostic, type PreparedDiagnosticCode, type PreparedTransformOptions, type PreparedTransformResult, lintPreparedSource, transformPreparedSource, transformPreparedSourceAot };
|