@niscorp/moss 0.9.2 → 0.9.3

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/DOCS.md +21 -2
  3. package/dist/{chunk-WMIJU6ZZ.js → chunk-6MZPY4X6.js} +51 -10
  4. package/dist/chunk-6MZPY4X6.js.map +1 -0
  5. package/dist/{chunk-KVXP6OTW.cjs → chunk-EXMOO7ZR.cjs} +105 -64
  6. package/dist/chunk-EXMOO7ZR.cjs.map +1 -0
  7. package/dist/{chunk-5ZB7FZ2J.js → chunk-MVG333UF.js} +4 -3
  8. package/dist/chunk-MVG333UF.js.map +1 -0
  9. package/dist/{chunk-FUJRIO4N.js → chunk-TAAKHW3U.js} +3 -3
  10. package/dist/{chunk-FUJRIO4N.js.map → chunk-TAAKHW3U.js.map} +1 -1
  11. package/dist/{chunk-6ZWMC2OV.cjs → chunk-U43CBKKE.cjs} +3 -2
  12. package/dist/chunk-U43CBKKE.cjs.map +1 -0
  13. package/dist/{chunk-KMZT6NVL.cjs → chunk-YGZS5B2U.cjs} +5 -5
  14. package/dist/{chunk-KMZT6NVL.cjs.map → chunk-YGZS5B2U.cjs.map} +1 -1
  15. package/dist/{document-C3aS9uiW.d.ts → document-BzXQvEc1.d.ts} +2 -1
  16. package/dist/{document-deAs7Dre.d.cts → document-CuF4JqzJ.d.cts} +2 -1
  17. package/dist/index.cjs +14 -14
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +2 -2
  21. package/dist/node.cjs +7 -7
  22. package/dist/node.d.cts +1 -1
  23. package/dist/node.d.ts +1 -1
  24. package/dist/node.js +3 -3
  25. package/dist/unverified.cjs +2 -2
  26. package/dist/unverified.js +1 -1
  27. package/dist/vite.cjs +8 -8
  28. package/dist/vite.d.cts +1 -1
  29. package/dist/vite.d.ts +1 -1
  30. package/dist/vite.js +3 -3
  31. package/package.json +7 -7
  32. package/dist/chunk-5ZB7FZ2J.js.map +0 -1
  33. package/dist/chunk-6ZWMC2OV.cjs.map +0 -1
  34. package/dist/chunk-KVXP6OTW.cjs.map +0 -1
  35. package/dist/chunk-WMIJU6ZZ.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk6ZWMC2OV_cjs = require('./chunk-6ZWMC2OV.cjs');
3
+ var chunkU43CBKKE_cjs = require('./chunk-U43CBKKE.cjs');
4
4
  var chunkPVZMCEBX_cjs = require('./chunk-PVZMCEBX.cjs');
5
5
  var chunkNCQBGK3E_cjs = require('./chunk-NCQBGK3E.cjs');
6
6
  var zod = require('zod');
@@ -625,7 +625,7 @@ var removalsRefused = (found) => [
625
625
  ...found.retyped.map((what) => `this run changes the type of ${what}`)
626
626
  ].map((sentence) => `${sentence} \u2014 nothing removed or retyped is applied unless it is allowed (\`allowRemoval\`; \`nisc migrate --allow-removal\`)`);
627
627
  var migrateTables = async (runtime, app, options = {}) => {
628
- const entries = chunk6ZWMC2OV_cjs.entriesOf(app);
628
+ const entries = chunkU43CBKKE_cjs.entriesOf(app);
629
629
  const cache = runtime.cache ?? vex.createPostgresCache({ pool: runtime.pool });
630
630
  const before = await vex.createPostgresAdapter({ pool: runtime.pool }).introspect();
631
631
  const misfitsBefore = misfitsOf(entries, before);
@@ -733,7 +733,12 @@ var createDataLayer = async (deps) => {
733
733
  const table = deps.cache ?? vex.createPostgresCache({ pool: deps.pool });
734
734
  await table.init?.();
735
735
  const { cache, askFirst } = createEntryCache(table);
736
- const engine = vex.createQueryEngine({ adapter, cache, ...deps.vexConfig !== void 0 ? { config: deps.vexConfig } : {} });
736
+ const engine = vex.createQueryEngine({
737
+ adapter,
738
+ cache,
739
+ ...deps.vexConfig !== void 0 ? { config: deps.vexConfig } : {},
740
+ ...deps.upgradedColumns !== void 0 && deps.upgrader !== void 0 ? { upgradedColumns: deps.upgradedColumns, upgrader: deps.upgrader } : {}
741
+ });
737
742
  const schema = await engine.introspect();
738
743
  return { engine, adapter, schema, grants: vex.scopeGrants(schema.entities.map((e) => e.name)), askFirst };
739
744
  };
@@ -993,7 +998,8 @@ var createIntentAnswers = (deps) => {
993
998
  generateDsl: writers.generateDsl,
994
999
  mapToShape: writers.mapToShape,
995
1000
  ...deps.behaviors !== void 0 ? { behaviors: deps.behaviors } : {},
996
- ...deps.vexConfig !== void 0 ? { config: deps.vexConfig } : {}
1001
+ ...deps.vexConfig !== void 0 ? { config: deps.vexConfig } : {},
1002
+ ...deps.upgradedColumns !== void 0 && deps.upgrader !== void 0 ? { upgradedColumns: deps.upgradedColumns, upgrader: deps.upgrader } : {}
997
1003
  });
998
1004
  await engine.introspect();
999
1005
  return engine;
@@ -1020,7 +1026,7 @@ var prepareEngine = async (config) => {
1020
1026
  );
1021
1027
  });
1022
1028
  const grammars = await createGrammarUpgrader({ grammars: config.grammars });
1023
- const layer = await createDataLayer(config);
1029
+ const layer = await createDataLayer({ ...config, upgrader: grammars });
1024
1030
  return {
1025
1031
  grammars,
1026
1032
  engine: layer.engine,
@@ -1044,7 +1050,8 @@ var lazyIntentAnswers = (prepared, config) => {
1044
1050
  schema,
1045
1051
  cache: engine.cache,
1046
1052
  ...config.behaviors !== void 0 ? { behaviors: config.behaviors } : {},
1047
- ...config.vexConfig !== void 0 ? { vexConfig: config.vexConfig } : {}
1053
+ ...config.vexConfig !== void 0 ? { vexConfig: config.vexConfig } : {},
1054
+ ...config.upgradedColumns !== void 0 ? { upgradedColumns: config.upgradedColumns, upgrader: prepared.grammars } : {}
1048
1055
  });
1049
1056
  return answers;
1050
1057
  };
@@ -1055,6 +1062,20 @@ var tablesByFeature = (config) => (feature) => {
1055
1062
  if (kept === void 0) throw new Error(`moss: the data module was asked for the tables of a feature it was never told of ("${feature}").`);
1056
1063
  return kept.names;
1057
1064
  };
1065
+ var refuseUpgradedOwnedTables = (config) => {
1066
+ const owners = new Map([
1067
+ ...(config.featureTables ?? []).flatMap((tables) => tables.names.map((name) => [name, `the feature "${tables.feature}"`])),
1068
+ ...ARTIFACT_TABLES.map((name) => [name, "the artifactory"]),
1069
+ ...POINTER.tables.map((name) => [name, POINTER.owner])
1070
+ ]);
1071
+ const owned = Object.keys(config.upgradedColumns ?? {}).flatMap((table) => {
1072
+ const owner = owners.get(table);
1073
+ return owner === void 0 ? [] : [`"${table}" is ${owner}'s`];
1074
+ });
1075
+ if (owned.length > 0) {
1076
+ throw new Error(`moss: the app's \`upgradedColumns\` name tables it does not own (${owned.join("; ")}). Their owner reads them as stored: name only the app's own tables.`);
1077
+ }
1078
+ };
1058
1079
  var createUpgradeStore = (prepared, tablesOf) => async (feature, store) => {
1059
1080
  const own = tablesOf(feature);
1060
1081
  if (store.schema !== void 0) {
@@ -1068,6 +1089,7 @@ var createUpgradeStore = (prepared, tablesOf) => async (feature, store) => {
1068
1089
  await prepared.upgradeStore(store);
1069
1090
  };
1070
1091
  var createDataWith = (prepared, config) => {
1092
+ refuseUpgradedOwnedTables(config);
1071
1093
  const { grammars, engine, grants } = prepared;
1072
1094
  const governed = { charter: config.charter, behaviors: { ...config.behaviors, ...config.rowRules } };
1073
1095
  const policies = createPolicies({ ...governed, grants });
@@ -1272,15 +1294,15 @@ var isKept = (layout) => layout !== void 0 && layout !== null && typeof layout !
1272
1294
  var shellWithStoredLayouts = (shell) => {
1273
1295
  const layouts = {};
1274
1296
  const frame = shell.layout;
1275
- if (isKept(frame)) layouts[chunk6ZWMC2OV_cjs.FRAME_LAYOUT_REF] = frame;
1297
+ if (isKept(frame)) layouts[chunkU43CBKKE_cjs.FRAME_LAYOUT_REF] = frame;
1276
1298
  const canvases = shell.canvases.map((canvas) => {
1277
1299
  const layout = canvas.actionLayout;
1278
1300
  if (!isKept(layout)) return canvas;
1279
- const ref = chunk6ZWMC2OV_cjs.canvasLayoutRef(canvas.id);
1301
+ const ref = chunkU43CBKKE_cjs.canvasLayoutRef(canvas.id);
1280
1302
  layouts[ref] = layout;
1281
1303
  return { ...canvas, actionLayout: ref };
1282
1304
  });
1283
- return { canvases, ...isKept(frame) ? { frame: chunk6ZWMC2OV_cjs.FRAME_LAYOUT_REF } : typeof frame === "string" ? { frame } : {}, layouts };
1305
+ return { canvases, ...isKept(frame) ? { frame: chunkU43CBKKE_cjs.FRAME_LAYOUT_REF } : typeof frame === "string" ? { frame } : {}, layouts };
1284
1306
  };
1285
1307
  var slottedIn = /* @__PURE__ */ new WeakMap();
1286
1308
  var canvasesSlottedIn = (layout) => {
@@ -1331,7 +1353,7 @@ var createComponentNames = (read2) => {
1331
1353
  var SavedLayoutSchema = zod.z.strictObject({ ref: zod.z.string(), layout: nova.LayoutNodeSchema, use: zod.z.boolean().optional() });
1332
1354
  var upgradedLayoutBody = (upgrader, body, stamp) => reflect.isRecord(body) && body["layout"] !== void 0 ? { ...body, layout: upgrader.upgrade(body["layout"], { kind: "nisc.nova/layout", stamp }).document } : body;
1333
1355
  var actionAtRef = (actions, layouts) => (ref) => {
1334
- const id = chunk6ZWMC2OV_cjs.actionOfLayoutRef(ref);
1356
+ const id = chunkU43CBKKE_cjs.actionOfLayoutRef(ref);
1335
1357
  const action = id !== void 0 && Object.hasOwn(actions, id) ? actions[id] : void 0;
1336
1358
  const layout = Object.hasOwn(layouts, ref) ? layouts[ref] : void 0;
1337
1359
  return action === void 0 || layout === void 0 ? void 0 : { ...action, layout };
@@ -1356,9 +1378,9 @@ var readLayout = (body, heldTo) => {
1356
1378
  const { ref, layout } = parsed.data;
1357
1379
  const target = targetAt(ref, heldTo);
1358
1380
  if (target === void 0) return { refusal: nothingKeptUnder(ref) };
1359
- const misfits = chunk6ZWMC2OV_cjs.layoutMisfits(layout, target.kit);
1381
+ const misfits = chunkU43CBKKE_cjs.layoutMisfits(layout, target.kit);
1360
1382
  if (misfits.length > 0) return { refusal: misfits.join("; ") };
1361
- const named = chunk6ZWMC2OV_cjs.layoutNameRefusal(layout);
1383
+ const named = chunkU43CBKKE_cjs.layoutNameRefusal(layout);
1362
1384
  if (named !== void 0) return { refusal: `it ${named}` };
1363
1385
  const { action } = target;
1364
1386
  if (action === void 0) return { layout: parsed.data };
@@ -1392,7 +1414,7 @@ var layoutsInUse = (inForce2, drawnFor) => {
1392
1414
  }
1393
1415
  return layouts;
1394
1416
  };
1395
- var generatedId = () => `${chunk6ZWMC2OV_cjs.GENERATED_ID_PREFIX}${crypto$1.randomUUID()}`;
1417
+ var generatedId = () => `${chunkU43CBKKE_cjs.GENERATED_ID_PREFIX}${crypto$1.randomUUID()}`;
1396
1418
  var VEX_ROUTE = /^\/api\/(?:[A-Za-z0-9_-]+\/)?vex$/;
1397
1419
  var endpointRefusals = async (endpoints, heldTo) => {
1398
1420
  const refusals = [];
@@ -1429,8 +1451,8 @@ var parsedUnder = (schema, body, id, more = {}) => {
1429
1451
  return { refusal: first === void 0 ? "no reason given" : `${first.path.join(".") || "(the body)"}: ${first.message}` };
1430
1452
  };
1431
1453
  var layoutRefusals = (layout, kit) => {
1432
- const named = chunk6ZWMC2OV_cjs.layoutNameRefusal(layout);
1433
- return [...layout === void 0 || typeof layout === "string" ? [] : chunk6ZWMC2OV_cjs.layoutMisfits(layout, kit), ...named === void 0 ? [] : [`it ${named}`]];
1454
+ const named = chunkU43CBKKE_cjs.layoutNameRefusal(layout);
1455
+ return [...layout === void 0 || typeof layout === "string" ? [] : chunkU43CBKKE_cjs.layoutMisfits(layout, kit), ...named === void 0 ? [] : [`it ${named}`]];
1434
1456
  };
1435
1457
  var passedOrRefused = (body, refusals) => refusals.length > 0 ? { refusal: refusals.join("; ") } : { body };
1436
1458
  var readAction = async (body, id, heldTo) => {
@@ -1463,6 +1485,19 @@ var generatedInForce = async (inForce2, heldTo, whose) => {
1463
1485
  };
1464
1486
  return { actions: await passed("action", readAction), fragments: await passed("fragment", readFragment) };
1465
1487
  };
1488
+ var refuseUnrunnable = (entries, compile2, heading) => {
1489
+ if (compile2 === void 0) return;
1490
+ const unrunnable = entries.flatMap((entry) => {
1491
+ if (!("dsl" in entry)) return [];
1492
+ try {
1493
+ compile2(entry.dsl);
1494
+ return [];
1495
+ } catch (error) {
1496
+ return [` "${entry.fingerprint}": ${error instanceof Error ? error.message : String(error)}`];
1497
+ }
1498
+ });
1499
+ if (unrunnable.length > 0) throw new Error([heading, ...unrunnable].join("\n"));
1500
+ };
1466
1501
  var compileEntries = async (entries) => {
1467
1502
  const compiled = vex.createMemoryCache();
1468
1503
  await vex.seedCache(compiled, entries);
@@ -1473,7 +1508,8 @@ var mergedEntries = (own, sets) => {
1473
1508
  for (const entry of [...own, ...[...sets.values()].flat()]) byFingerprint.set(entry.fingerprint, entry);
1474
1509
  return Object.freeze([...byFingerprint.values()]);
1475
1510
  };
1476
- var createEntriesInForce = (own) => {
1511
+ var createEntriesInForce = (own, compileRead) => {
1512
+ refuseUnrunnable(own, compileRead, "Seeded reads that do not run \u2014 refusing to serve:");
1477
1513
  let sets = /* @__PURE__ */ new Map();
1478
1514
  let list = mergedEntries(own, sets);
1479
1515
  let byFingerprint = new Map(list.map((entry) => [entry.fingerprint, entry]));
@@ -1486,6 +1522,7 @@ var createEntriesInForce = (own) => {
1486
1522
  holdsSet: (source) => sets.has(source),
1487
1523
  withSet: (source, handed) => mergedEntries(own, new Map([...sets, [source, handed]])),
1488
1524
  takeSet: (source, handed, taken) => {
1525
+ refuseUnrunnable(handed, compileRead, "Refresh refused \u2014 seeded reads that do not run:");
1489
1526
  sets = new Map([...sets, [source, handed]]);
1490
1527
  list = mergedEntries(own, sets);
1491
1528
  byFingerprint = new Map(list.map((entry) => [entry.fingerprint, entry]));
@@ -1832,7 +1869,7 @@ var createGeneration = (pointer, ctx) => {
1832
1869
  var NO_DEFAULTS = { actions: {}, fragments: {}, reads: /* @__PURE__ */ new Map() };
1833
1870
  var drawableIn = (fragments, kit, say) => Object.fromEntries(
1834
1871
  Object.entries(fragments).filter(([id, fragment]) => {
1835
- const misfits = chunk6ZWMC2OV_cjs.layoutMisfits(fragment.layout, kit);
1872
+ const misfits = chunkU43CBKKE_cjs.layoutMisfits(fragment.layout, kit);
1836
1873
  if (misfits.length > 0) say(`[moss] the fragment "${id}" published for everybody is left out of a shell that cannot draw it: ${misfits.join("; ")}`);
1837
1874
  return misfits.length === 0;
1838
1875
  })
@@ -1870,7 +1907,7 @@ var checkedDefaults = async (versions, heldTo, whose) => {
1870
1907
  catalog: () => [...Object.values(heldTo.built).map((action) => ({ id: action.id, input: action.input ?? {} })), ...catalogOfGenerated(versions)]
1871
1908
  };
1872
1909
  const passed = await generatedInForce(versions, checks, whose);
1873
- return { passed, reads, verified: chunk6ZWMC2OV_cjs.verifyManifest(heldTo.candidate({ ...heldTo.built, ...passed.actions }, passed.fragments)) };
1910
+ return { passed, reads, verified: chunkU43CBKKE_cjs.verifyManifest(heldTo.candidate({ ...heldTo.built, ...passed.actions }, passed.fragments)) };
1874
1911
  };
1875
1912
  var narrowedBy = (filter, ids, installed) => {
1876
1913
  const answered = new Set(filter(ids, installed));
@@ -1883,9 +1920,9 @@ var catalogFor = (app, roles, installed, installedOnly) => {
1883
1920
  };
1884
1921
  var resolveVariantsForRoles = (app, roles) => {
1885
1922
  const variants = app.layouts ?? {};
1886
- return chunk6ZWMC2OV_cjs.variantLayouts(variants, charter.resolvePrincipal(app.charter, Object.keys(variants), roles, "layouts"));
1923
+ return chunkU43CBKKE_cjs.variantLayouts(variants, charter.resolvePrincipal(app.charter, Object.keys(variants), roles, "layouts"));
1887
1924
  };
1888
- var definitionsFor = (actions, ids, variants) => Object.freeze(Object.fromEntries(chunk6ZWMC2OV_cjs.withVariants(actions, ids, variants)));
1925
+ var definitionsFor = (actions, ids, variants) => Object.freeze(Object.fromEntries(chunkU43CBKKE_cjs.withVariants(actions, ids, variants)));
1889
1926
  var actionsWithStoredLayouts = (definitions) => {
1890
1927
  const actions = {};
1891
1928
  const layouts = {};
@@ -1895,7 +1932,7 @@ var actionsWithStoredLayouts = (definitions) => {
1895
1932
  actions[id] = definition;
1896
1933
  continue;
1897
1934
  }
1898
- const ref = chunk6ZWMC2OV_cjs.actionLayoutRef(id);
1935
+ const ref = chunkU43CBKKE_cjs.actionLayoutRef(id);
1899
1936
  layouts[ref] = layout;
1900
1937
  actions[id] = { ...definition, layout: { ref } };
1901
1938
  }
@@ -1991,17 +2028,17 @@ var tell = (listener, ...told) => {
1991
2028
  };
1992
2029
  var createRunningManifest = (config) => {
1993
2030
  const { shipped } = config;
1994
- const entries = createEntriesInForce(chunk6ZWMC2OV_cjs.entriesOf(shipped));
2031
+ const entries = createEntriesInForce(chunkU43CBKKE_cjs.entriesOf(shipped), config.compileSeeded);
1995
2032
  let defaults = NO_DEFAULTS;
1996
2033
  const usage = createUsage(config.touchEveryMs ?? TOUCH_EVERY_MS);
1997
2034
  let functionIds;
1998
- const candidate = (actions, held = entries.list(), fragments = defaults.fragments) => chunk6ZWMC2OV_cjs.withFragments({ ...chunk6ZWMC2OV_cjs.candidateOf(shipped, { actions, entries: held }, config.grants), ...functionIds === void 0 ? {} : { functionIds } }, fragments);
2035
+ const candidate = (actions, held = entries.list(), fragments = defaults.fragments) => chunkU43CBKKE_cjs.withFragments({ ...chunkU43CBKKE_cjs.candidateOf(shipped, { actions, entries: held }, config.grants), ...functionIds === void 0 ? {} : { functionIds } }, fragments);
1999
2036
  const own = shipped.actions;
2000
2037
  const loaders = /* @__PURE__ */ new Map();
2001
2038
  const owners = createSetOwners();
2002
2039
  let sets = /* @__PURE__ */ new Map();
2003
2040
  let inForce2 = mergedActions(own, sets);
2004
- let report = chunk6ZWMC2OV_cjs.verifiedAtBoot(candidate(inForce2));
2041
+ let report = chunkU43CBKKE_cjs.verifiedAtBoot(candidate(inForce2));
2005
2042
  const components = createComponentNames((shell) => shellComponents({ actions: inForce2, layouts: shipped.layouts }, shell));
2006
2043
  const componentsOf2 = (shells) => {
2007
2044
  const kit = /* @__PURE__ */ new Map();
@@ -2036,14 +2073,14 @@ var createRunningManifest = (config) => {
2036
2073
  const { reads: readSources } = config;
2037
2074
  const functionsWritten = (written) => {
2038
2075
  if (functionIds !== void 0) return;
2039
- const ids = chunk6ZWMC2OV_cjs.functionsIn(written).map((definition) => definition.id);
2040
- const charter = chunk6ZWMC2OV_cjs.charterOverFunctions(shipped.charter, { actions: Object.keys(inForce2), data: config.grants, layouts: Object.keys(shipped.layouts ?? {}) }, ids);
2076
+ const ids = chunkU43CBKKE_cjs.functionsIn(written).map((definition) => definition.id);
2077
+ const charter = chunkU43CBKKE_cjs.charterOverFunctions(shipped.charter, { actions: Object.keys(inForce2), data: config.grants, layouts: Object.keys(shipped.layouts ?? {}) }, ids);
2041
2078
  if (charter.errors.length > 0) throw new Error(`Charter is incoherent over the app\u2019s functions \u2014 refusing to serve:
2042
2079
  ${charter.errors.join("\n ")}`);
2043
2080
  functionIds = new Set(ids);
2044
2081
  const built = mergedActions(own, sets);
2045
- const verified = chunk6ZWMC2OV_cjs.verifyManifest(candidate(built, entries.list(), {}));
2046
- const refusal = chunk6ZWMC2OV_cjs.refusalOf(verified, "boot");
2082
+ const verified = chunkU43CBKKE_cjs.verifyManifest(candidate(built, entries.list(), {}));
2083
+ const refusal = chunkU43CBKKE_cjs.refusalOf(verified, "boot");
2047
2084
  if (refusal !== void 0) {
2048
2085
  functionIds = void 0;
2049
2086
  throw new Error(refusal);
@@ -2054,7 +2091,7 @@ var createRunningManifest = (config) => {
2054
2091
  dropMemos();
2055
2092
  memo.drop();
2056
2093
  for (const warning2 of charter.warnings) console.warn(`[moss] charter: ${warning2}`);
2057
- const warning = chunk6ZWMC2OV_cjs.functionsWarning(written);
2094
+ const warning = chunkU43CBKKE_cjs.functionsWarning(written);
2058
2095
  if (warning !== void 0) console.warn(warning);
2059
2096
  };
2060
2097
  const grantedFunctionsOf = (roles) => (names) => charter.resolvePrincipal(shipped.charter, names, roles, "functions");
@@ -2108,7 +2145,7 @@ var createRunningManifest = (config) => {
2108
2145
  const over = sets;
2109
2146
  const { passed, reads, verified } = await checkedDefaults(versions, defaultsHeldTo(), "published for everybody");
2110
2147
  if (sets !== over) return applyPublished(versions);
2111
- const refusal = chunk6ZWMC2OV_cjs.refusalOf(verified, "boot");
2148
+ const refusal = chunkU43CBKKE_cjs.refusalOf(verified, "boot");
2112
2149
  if (refusal !== void 0) memo.sayOnce(`[moss] what is published for everybody is left out, and the build\u2019s copies stand: ${refusal}`);
2113
2150
  const next = refusal === void 0 ? { actions: passed.actions, fragments: passed.fragments, reads } : { ...NO_DEFAULTS, reads };
2114
2151
  if (!hasDefaults(next) && !hasDefaults(defaults)) return;
@@ -2132,10 +2169,10 @@ var createRunningManifest = (config) => {
2132
2169
  const applySets = (arrived, announce) => {
2133
2170
  const next = new Map([...sets, ...arrived]);
2134
2171
  const actions = mergedActions(own, next, defaults.actions);
2135
- const verified = chunk6ZWMC2OV_cjs.verifyManifest(candidate(actions));
2136
- const refusal = chunk6ZWMC2OV_cjs.refusalOf(verified, "refresh");
2172
+ const verified = chunkU43CBKKE_cjs.verifyManifest(candidate(actions));
2173
+ const refusal = chunkU43CBKKE_cjs.refusalOf(verified, "refresh");
2137
2174
  if (refusal !== void 0) throw new Error(refusal);
2138
- for (const set of arrived.values()) chunk6ZWMC2OV_cjs.freezeDeep(set);
2175
+ for (const set of arrived.values()) chunkU43CBKKE_cjs.freezeDeep(set);
2139
2176
  sets = next;
2140
2177
  inForce2 = actions;
2141
2178
  report = verified;
@@ -2151,13 +2188,13 @@ var createRunningManifest = (config) => {
2151
2188
  };
2152
2189
  const takeEntries = async (source, handed) => {
2153
2190
  owners.assertAppOwned(source);
2154
- const misfits = chunk6ZWMC2OV_cjs.entryMisfits(handed);
2191
+ const misfits = chunkU43CBKKE_cjs.entryMisfits(handed);
2155
2192
  if (misfits.length > 0) throw new Error(["Refresh refused \u2014 entries that do not parse:", ...misfits.map((misfit) => ` ${misfit}`)].join("\n"));
2156
2193
  const compiled = await compileEntries(handed);
2157
- const verified = chunk6ZWMC2OV_cjs.verifyManifest(candidate(inForce2, entries.withSet(source, handed)));
2158
- const refusal = chunk6ZWMC2OV_cjs.refusalOf(verified, "refresh");
2194
+ const verified = chunkU43CBKKE_cjs.verifyManifest(candidate(inForce2, entries.withSet(source, handed)));
2195
+ const refusal = chunkU43CBKKE_cjs.refusalOf(verified, "refresh");
2159
2196
  if (refusal !== void 0) throw new Error(refusal);
2160
- chunk6ZWMC2OV_cjs.freezeDeep(handed);
2197
+ chunkU43CBKKE_cjs.freezeDeep(handed);
2161
2198
  entries.takeSet(source, handed, compiled);
2162
2199
  report = verified;
2163
2200
  for (const listener of [...listeners]) tell(listener);
@@ -2167,7 +2204,7 @@ var createRunningManifest = (config) => {
2167
2204
  return {
2168
2205
  actions: () => inForce2,
2169
2206
  entries: entries.list,
2170
- verify: (actions) => chunk6ZWMC2OV_cjs.verifyManifest(candidate(actions)),
2207
+ verify: (actions) => chunkU43CBKKE_cjs.verifyManifest(candidate(actions)),
2171
2208
  report: () => report,
2172
2209
  replace: (source, actions) => applySets(/* @__PURE__ */ new Map([[owners.assertAppOwned(source), actions]]), true),
2173
2210
  // In turn: a set is compiled before it is taken, and of two handed over
@@ -2228,7 +2265,7 @@ var createRunningManifest = (config) => {
2228
2265
  const drawable = theirOwn.heldTo.layouts;
2229
2266
  const theirs2 = layoutsInUse(versions, { whose, heldTo: drawable });
2230
2267
  const variants = roleMemo.variantsFor(roles);
2231
- const underVariants = { ...drawable, actionAt: (ref) => variants.has(chunk6ZWMC2OV_cjs.actionOfLayoutRef(ref) ?? "") ? void 0 : drawable.actionAt(ref) };
2268
+ const underVariants = { ...drawable, actionAt: (ref) => variants.has(chunkU43CBKKE_cjs.actionOfLayoutRef(ref) ?? "") ? void 0 : drawable.actionAt(ref) };
2232
2269
  const everybodys = layoutsInUse(everybodysVersions, { whose: "published for everybody", heldTo: underVariants, say: memo.sayOnce });
2233
2270
  const laidOverShell = { ...drawableIn(defaults.fragments, kitOf2(shell), memo.sayOnce), ...theirOwn.fragments };
2234
2271
  const fragments = Object.keys(laidOverShell).length === 0 ? shell.fragments : { ...shell.fragments, ...laidOverShell };
@@ -2260,7 +2297,7 @@ var createRunningManifest = (config) => {
2260
2297
  verify: async (versions, inForce3) => {
2261
2298
  const kept = inForce3.filter((held) => !versions.some((version) => version.kind === held.kind && version.id === held.id));
2262
2299
  const asked = versions.map((version) => ({ ...version, save: "", createdAt: "" }));
2263
- const refusal = chunk6ZWMC2OV_cjs.refusalOf((await checkedDefaults([...kept, ...asked], defaultsHeldTo(), void 0)).verified, "publish");
2300
+ const refusal = chunkU43CBKKE_cjs.refusalOf((await checkedDefaults([...kept, ...asked], defaultsHeldTo(), void 0)).verified, "publish");
2264
2301
  if (refusal !== void 0) throw new Error(refusal);
2265
2302
  }
2266
2303
  },
@@ -2765,13 +2802,13 @@ var seamsFor = (feature, owned, { app, runtime, server, operator, registered, id
2765
2802
  grantedActionIds: (roles, installed) => running.catalogFor(roles, installed).ids,
2766
2803
  actions: running.actions,
2767
2804
  replaceActions: owned.replace,
2768
- refusalOf: (actions) => chunk6ZWMC2OV_cjs.refusalOf(running.verify(actions), "refresh"),
2805
+ refusalOf: (actions) => chunkU43CBKKE_cjs.refusalOf(running.verify(actions), "refresh"),
2769
2806
  setActionsLoader: owned.setLoader,
2770
2807
  addCatalogFilter: running.addCatalogFilter,
2771
2808
  charter: app.charter,
2772
2809
  components: app.shell?.components ?? {},
2773
- layoutMisfits: (layout) => chunk6ZWMC2OV_cjs.layoutMisfits(layout, kitOf(app)),
2774
- endlessChains: chunk6ZWMC2OV_cjs.endlessChains,
2810
+ layoutMisfits: (layout) => chunkU43CBKKE_cjs.layoutMisfits(layout, kitOf(app)),
2811
+ endlessChains: chunkU43CBKKE_cjs.endlessChains,
2775
2812
  ownEntries: (entries) => data.ownEntries(feature.name, entries),
2776
2813
  grammars: data.grammars,
2777
2814
  upgradeStore: (store) => data.upgradeStore(feature.name, store),
@@ -2838,9 +2875,9 @@ var read = (live) => {
2838
2875
  console.error("[moss/shells] the shell frame failed to render for a snapshot \u2014 serving an empty arrangement:", error);
2839
2876
  }
2840
2877
  const trees = {};
2841
- for (const canvasId of chunk6ZWMC2OV_cjs.canvasesOf(live)) {
2878
+ for (const canvasId of chunkU43CBKKE_cjs.canvasesOf(live)) {
2842
2879
  try {
2843
- trees[canvasId] = chunk6ZWMC2OV_cjs.treeOf(live, canvasId);
2880
+ trees[canvasId] = chunkU43CBKKE_cjs.treeOf(live, canvasId);
2844
2881
  } catch (error) {
2845
2882
  console.error(`[moss/shells] canvas "${canvasId}" failed to render for a snapshot \u2014 leaving it out:`, error);
2846
2883
  }
@@ -2857,7 +2894,7 @@ var needOf = (live, principal, kept) => {
2857
2894
  for (const instance of canvas.stack) {
2858
2895
  const definition = live.shell.getRuntime(instance.id)?.definition;
2859
2896
  if (definition === void 0) continue;
2860
- const need = shellNeedOf(chunk6ZWMC2OV_cjs.withLayoutInPlace(definition, live.shell.layoutStore), entries);
2897
+ const need = shellNeedOf(chunkU43CBKKE_cjs.withLayoutInPlace(definition, live.shell.layoutStore), entries);
2861
2898
  for (const reason of need.why) why.push(`${definition.id}: ${reason}`);
2862
2899
  for (const read2 of need.drawnWith) drawnWith.push(read2);
2863
2900
  }
@@ -2880,7 +2917,7 @@ var sweep = (host, idleMs) => {
2880
2917
  }
2881
2918
  if (live.connections.size > 0 || live.idleSince === null) continue;
2882
2919
  if (now - live.idleSince < idleMs) continue;
2883
- chunk6ZWMC2OV_cjs.endShell(host, live);
2920
+ chunkU43CBKKE_cjs.endShell(host, live);
2884
2921
  live.shell.dispose();
2885
2922
  durable.delete(principal);
2886
2923
  }
@@ -2902,7 +2939,7 @@ var rosterOf = (durable) => {
2902
2939
  var sameDocument = (one, other) => one === other || JSON.stringify(one) === JSON.stringify(other);
2903
2940
  var takeLayouts = (live, made) => {
2904
2941
  const taken = live.layouts;
2905
- const answered = chunk6ZWMC2OV_cjs.layoutsOf(made);
2942
+ const answered = chunkU43CBKKE_cjs.layoutsOf(made);
2906
2943
  for (const [ref, layout] of Object.entries(answered.layoutStore)) {
2907
2944
  if (!sameDocument(taken.layoutStore[ref], layout)) live.shell.setLayout(ref, layout);
2908
2945
  }
@@ -2932,15 +2969,15 @@ var takeComposition = (live, made) => {
2932
2969
  live.entries = made.entries;
2933
2970
  takeLayouts(live, made);
2934
2971
  takeCanvases(live, made);
2935
- chunk6ZWMC2OV_cjs.holdGranted(live.functions, made.grantedFunctions);
2972
+ chunkU43CBKKE_cjs.holdGranted(live.functions, made.grantedFunctions);
2936
2973
  };
2937
2974
  var adoptDraft = async (host, live, next) => {
2938
2975
  for (; ; ) {
2939
2976
  const cell = host.living.get(live);
2940
- if (cell === void 0 || cell.live !== live) throw new Error(chunk6ZWMC2OV_cjs.SHELL_GONE);
2977
+ if (cell === void 0 || cell.live !== live) throw new Error(chunkU43CBKKE_cjs.SHELL_GONE);
2941
2978
  const changes = host.changes;
2942
- const made = await host.config.composition(cell.principal, chunk6ZWMC2OV_cjs.draftedIn(next));
2943
- if (live.ended || cell.live !== live) throw new Error(chunk6ZWMC2OV_cjs.SHELL_GONE);
2979
+ const made = await host.config.composition(cell.principal, chunkU43CBKKE_cjs.draftedIn(next));
2980
+ if (live.ended || cell.live !== live) throw new Error(chunkU43CBKKE_cjs.SHELL_GONE);
2944
2981
  if (changes < cell.changes) continue;
2945
2982
  cell.changes = changes;
2946
2983
  live.draft = next;
@@ -2954,7 +2991,7 @@ var adopt = (host, cell) => {
2954
2991
  if (asked.ended) return;
2955
2992
  const drafted = asked.draft;
2956
2993
  const changes = host.changes;
2957
- const made = await host.config.composition(cell.principal, chunk6ZWMC2OV_cjs.draftedIn(drafted));
2994
+ const made = await host.config.composition(cell.principal, chunkU43CBKKE_cjs.draftedIn(drafted));
2958
2995
  if (asked.ended || changes <= cell.changes) return;
2959
2996
  if (asked.draft !== drafted) {
2960
2997
  adopt(host, cell);
@@ -2985,7 +3022,7 @@ var build = (host, asked, wanted = () => true) => {
2985
3022
  reject(new Error(`moss: the shell of ${asked.principal ?? "nobody"} was not built within ${limit}ms.`));
2986
3023
  }, limit);
2987
3024
  timer.unref?.();
2988
- chunk6ZWMC2OV_cjs.buildShell(host, { ...asked, wanted: () => inTime && wanted() }).then((live) => resolve2(live === void 0 ? void 0 : { live, changes }), reject).finally(() => clearTimeout(timer));
3025
+ chunkU43CBKKE_cjs.buildShell(host, { ...asked, wanted: () => inTime && wanted() }).then((live) => resolve2(live === void 0 ? void 0 : { live, changes }), reject).finally(() => clearTimeout(timer));
2989
3026
  });
2990
3027
  };
2991
3028
  var builtOrThrow = (built) => {
@@ -3025,18 +3062,18 @@ var replaceShell = async (host, cell) => {
3025
3062
  if (built === void 0) return;
3026
3063
  const old = cell.live;
3027
3064
  if (!stands()) {
3028
- chunk6ZWMC2OV_cjs.endShell(host, built.live);
3065
+ chunkU43CBKKE_cjs.endShell(host, built.live);
3029
3066
  built.live.shell.dispose();
3030
3067
  return;
3031
3068
  }
3032
3069
  const carried = [...old.connections].map((connection) => ({ connection, wants: old.deltaReady.has(connection) }));
3033
- chunk6ZWMC2OV_cjs.endShell(host, old);
3070
+ chunkU43CBKKE_cjs.endShell(host, old);
3034
3071
  old.connections.clear();
3035
3072
  old.shell.dispose();
3036
3073
  cell.live = built.live;
3037
3074
  cell.changes = built.changes;
3038
3075
  registerLiving(host, cell);
3039
- for (const { connection, wants } of carried) chunk6ZWMC2OV_cjs.attach(built.live, connection, host.delta && wants);
3076
+ for (const { connection, wants } of carried) chunkU43CBKKE_cjs.attach(built.live, connection, host.delta && wants);
3040
3077
  };
3041
3078
  var resetCell = (host, cell) => {
3042
3079
  if (cell.hasWaitingReset === true) return;
@@ -3079,7 +3116,7 @@ var snapshotOf = (host) => async (token, principal, options) => {
3079
3116
  const settled = await settle(live, waitMs);
3080
3117
  return { ...read(live), seed, settled, ...needOf(live, principal, kept) };
3081
3118
  } finally {
3082
- chunk6ZWMC2OV_cjs.endShell(host, live);
3119
+ chunkU43CBKKE_cjs.endShell(host, live);
3083
3120
  live.shell.dispose();
3084
3121
  }
3085
3122
  };
@@ -3111,9 +3148,9 @@ var createShellHost = (config) => {
3111
3148
  const handedOut = {
3112
3149
  session: async (token, principal, options) => {
3113
3150
  if (principal === null || !host.kept) {
3114
- return chunk6ZWMC2OV_cjs.sessionOn(host, await open2(host, { token, principal, ...options !== void 0 ? { opening: options } : {} }, false), true, reset);
3151
+ return chunkU43CBKKE_cjs.sessionOn(host, await open2(host, { token, principal, ...options !== void 0 ? { opening: options } : {} }, false), true, reset);
3115
3152
  }
3116
- return chunk6ZWMC2OV_cjs.sessionOn(host, await keptCell(host, token, principal), false, reset);
3153
+ return chunkU43CBKKE_cjs.sessionOn(host, await keptCell(host, token, principal), false, reset);
3117
3154
  },
3118
3155
  snapshot: snapshotOf(host),
3119
3156
  deliver: deliverTo(host),
@@ -3414,7 +3451,7 @@ var wireFabric = (fabric, origin, apply) => {
3414
3451
 
3415
3452
  // src/server/server.ts
3416
3453
  var createServerWith = async (app, runtime, dataOf) => {
3417
- chunk6ZWMC2OV_cjs.receiveManifest(app);
3454
+ chunkU43CBKKE_cjs.receiveManifest(app);
3418
3455
  const session = sessionVerifierOf(runtime);
3419
3456
  const revokeSessions = sessionRevokerOf(runtime);
3420
3457
  const data = await dataOf(app, runtime);
@@ -3440,6 +3477,7 @@ var buildData = (app, runtime) => createData({
3440
3477
  featureTables: featureTablesOf(app),
3441
3478
  tables: runtime.tables,
3442
3479
  grammars: app.grammars,
3480
+ upgradedColumns: app.upgradedColumns,
3443
3481
  charter: app.charter,
3444
3482
  behaviors: app.behaviors,
3445
3483
  rowRules: rowRulesBeside(app.behaviors),
@@ -3534,7 +3572,10 @@ var buildRunningManifest = async (app, runtime, data, saved) => {
3534
3572
  // Polled on the clock a socket's credential is re-verified on.
3535
3573
  pointer: { read: data.pointer.read, move: data.pointer.move, ...runtime.sessionRevalidateMs !== void 0 ? { everyMs: runtime.sessionRevalidateMs } : {} },
3536
3574
  shells: [...app.shell !== void 0 ? [app.shell] : [], ...Object.values(app.pages ?? {})],
3537
- ...saved !== void 0 ? { published: saved.published().inForce, reads: { written: data.vexEntry, compile: data.compileQuery, savedOf: saved.of } } : {}
3575
+ ...saved !== void 0 ? { published: saved.published().inForce, reads: { written: data.vexEntry, compile: data.compileQuery, savedOf: saved.of } } : {},
3576
+ // Only where the app names upgradedColumns: vex refuses some reads of those when it compiles a read, and a seeded
3577
+ // read is otherwise first compiled at its first replay. An app that names none boots as before.
3578
+ ...app.upgradedColumns !== void 0 ? { compileSeeded: data.compileQuery } : {}
3538
3579
  });
3539
3580
  data.dropOnChange(running.onChange);
3540
3581
  data.entriesHeldBy({ get: running.cacheEntry, entries: running.cacheEntries });
@@ -3601,5 +3642,5 @@ exports.renderDocument = renderDocument;
3601
3642
  exports.revokeAllFor = revokeAllFor;
3602
3643
  exports.sessionCookies = sessionCookies;
3603
3644
  exports.tableStatus = tableStatus;
3604
- //# sourceMappingURL=chunk-KVXP6OTW.cjs.map
3605
- //# sourceMappingURL=chunk-KVXP6OTW.cjs.map
3645
+ //# sourceMappingURL=chunk-EXMOO7ZR.cjs.map
3646
+ //# sourceMappingURL=chunk-EXMOO7ZR.cjs.map