@selvajs/selva 4.21.0-beta.23 → 4.21.0-beta.25

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 (56) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/chunks/A_2RYLH9.js +1 -0
  3. package/build/client/_app/immutable/chunks/A_2RYLH9.js.br +1 -0
  4. package/build/client/_app/immutable/chunks/A_2RYLH9.js.gz +0 -0
  5. package/build/client/_app/immutable/chunks/{DtmN00GS.js → BMp0Pt9F.js} +4 -4
  6. package/build/client/_app/immutable/chunks/BMp0Pt9F.js.br +0 -0
  7. package/build/client/_app/immutable/chunks/BMp0Pt9F.js.gz +0 -0
  8. package/build/client/_app/immutable/entry/{app.Dl3HM1mx.js → app.UvCzfP6E.js} +2 -2
  9. package/build/client/_app/immutable/entry/app.UvCzfP6E.js.br +0 -0
  10. package/build/client/_app/immutable/entry/app.UvCzfP6E.js.gz +0 -0
  11. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js +1 -0
  12. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js.br +1 -0
  13. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js.gz +0 -0
  14. package/build/client/_app/version.json +1 -1
  15. package/build/client/_app/version.json.br +0 -0
  16. package/build/client/_app/version.json.gz +0 -0
  17. package/build/runtime-meta.json +1 -1
  18. package/build/server/.vite/manifest.json +13 -11
  19. package/build/server/chunks/compute.js +1 -1
  20. package/build/server/chunks/engine.server.js +1 -1
  21. package/build/server/chunks/errors.js +7 -30
  22. package/build/server/chunks/errors.js.map +1 -1
  23. package/build/server/chunks/handlers.js +5 -4
  24. package/build/server/chunks/handlers.js.map +1 -1
  25. package/build/server/chunks/instance.js +3 -3
  26. package/build/server/chunks/internal.js +1 -1
  27. package/build/server/chunks/ops.js +1 -1
  28. package/build/server/chunks/package.js +1 -1
  29. package/build/server/chunks/package.js.map +1 -1
  30. package/build/server/chunks/providers.server.js +48 -15
  31. package/build/server/chunks/providers.server.js.map +1 -1
  32. package/build/server/chunks/{limits.js → saved-values.js} +35 -2
  33. package/build/server/chunks/saved-values.js.map +1 -0
  34. package/build/server/chunks/server.js +5 -0
  35. package/build/server/chunks/server.js.map +1 -1
  36. package/build/server/chunks/types2.js.map +1 -1
  37. package/build/server/entries/pages/library/_guid_/_page.server.ts.js +14 -3
  38. package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
  39. package/build/server/entries/pages/library/_guid_/_page.svelte.js +42 -8
  40. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  41. package/build/server/manifest-full.js +1 -1
  42. package/build/server/manifest.js +1 -1
  43. package/build/server/nodes/21.js +1 -1
  44. package/build/server/server.js +1 -1
  45. package/package.json +9 -9
  46. package/build/client/_app/immutable/chunks/B58dPMPq.js +0 -1
  47. package/build/client/_app/immutable/chunks/B58dPMPq.js.br +0 -1
  48. package/build/client/_app/immutable/chunks/B58dPMPq.js.gz +0 -0
  49. package/build/client/_app/immutable/chunks/DtmN00GS.js.br +0 -0
  50. package/build/client/_app/immutable/chunks/DtmN00GS.js.gz +0 -0
  51. package/build/client/_app/immutable/entry/app.Dl3HM1mx.js.br +0 -0
  52. package/build/client/_app/immutable/entry/app.Dl3HM1mx.js.gz +0 -0
  53. package/build/client/_app/immutable/nodes/21.BZJQikE5.js +0 -1
  54. package/build/client/_app/immutable/nodes/21.BZJQikE5.js.br +0 -0
  55. package/build/client/_app/immutable/nodes/21.BZJQikE5.js.gz +0 -0
  56. package/build/server/chunks/limits.js.map +0 -1
@@ -213,7 +213,7 @@ function server_data_serializer(event, state) {
213
213
  let promise_id = 1;
214
214
  let max_nodes = -1;
215
215
  const iterator = create_async_iterator();
216
- const global = "__sveltekit_qkzvuf";
216
+ const global = "__sveltekit_lyid0x";
217
217
  /** @param {number} index */
218
218
  function get_replacer(index) {
219
219
  /** @param {any} thing */
@@ -1443,7 +1443,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
1443
1443
  "crossorigin"
1444
1444
  ]);
1445
1445
  }
1446
- const global = "__sveltekit_qkzvuf";
1446
+ const global = "__sveltekit_lyid0x";
1447
1447
  const { data, chunks } = data_serializer.get_data(csp);
1448
1448
  if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!(state.prerendering || state.prerender_default === true))).join("\n ")}`;
1449
1449
  if (page_config.csr && client) {
@@ -1467,7 +1467,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
1467
1467
  }
1468
1468
  }
1469
1469
  const blocks = [];
1470
- const properties = [`base: ${base_expression}`, `version: ${s("1795173490044")}`];
1470
+ const properties = [`base: ${base_expression}`, `version: ${s("1795190200646")}`];
1471
1471
  if (assets) properties.push(`assets: ${s(assets)}`);
1472
1472
  if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : uneval$1(rendered_env)}`);
1473
1473
  if (chunks) {
@@ -2363,7 +2363,7 @@ function redirect_response(status, location) {
2363
2363
  * @param {Response} response
2364
2364
  */
2365
2365
  function with_version_header(response) {
2366
- response.headers.set("x-sveltekit-version", "1795173490044");
2366
+ response.headers.set("x-sveltekit-version", "1795190200646");
2367
2367
  return response;
2368
2368
  }
2369
2369
  /**
@@ -1,6 +1,6 @@
1
1
  import { L as RETENTION_SETTINGS, tt as readSetting } from "./access.js";
2
2
  import { t as SYSTEM_CONTEXT } from "./context.js";
3
- import { t as COMPUTE_REQUEST_MAX_BYTES } from "./limits.js";
3
+ import { a as COMPUTE_REQUEST_MAX_BYTES } from "./saved-values.js";
4
4
  // ../server/src/ops/deploymentConfig.ts
5
5
  /**
6
6
  * Reverse-proxy and body-limit configuration rules, evaluated against a plain
@@ -1,6 +1,6 @@
1
1
  var package_default = {
2
2
  name: "@selvajs/selva",
3
- version: "4.21.0-beta.23",
3
+ version: "4.21.0-beta.25",
4
4
  description: "Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.",
5
5
  license: "MIT",
6
6
  author: "VektorNode",
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.23\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"selva\": {\n\t\t\"dataFormat\": 3\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js && node ./scripts/check-build-assets.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"playwright-core\": \"catalog:\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
1
+ {"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.25\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"selva\": {\n\t\t\"dataFormat\": 3\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js && node ./scripts/check-build-assets.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"playwright-core\": \"catalog:\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
@@ -7,7 +7,7 @@ import { a as toSourceDocumentId, i as UUID_REGEX } from "./schemas.js";
7
7
  import { i as DEFAULT_ORG_PERMISSIONS, t as ALL_ORG_ASSET_KINDS } from "./schemas2.js";
8
8
  import { t as ALL_PLATFORM_PERMISSIONS } from "./types3.js";
9
9
  import { a as createLogger, g as encodeOffsetCursor, h as decodeOffsetCursor, i as ConsoleLogger, m as clampPageLimit, n as renderThrown } from "./logging.js";
10
- import { n as readBool } from "./limits.js";
10
+ import { i as savedValuesToRecord, o as readBool } from "./saved-values.js";
11
11
  import * as crypto from "node:crypto";
12
12
  import { createCipheriv, createDecipheriv, createHash, createHmac, createPrivateKey, randomBytes, randomUUID, sign, timingSafeEqual } from "node:crypto";
13
13
  import { pathToFileURL } from "node:url";
@@ -2545,12 +2545,12 @@ var LocalDefinitionStore = class LocalDefinitionStore {
2545
2545
  const config = await this.readConfig();
2546
2546
  const parent = config.definitions[definitionId];
2547
2547
  if (!this.live(parent)) return paginate([], opts);
2548
- return paginate(Object.values(config.definitionVersions).filter((v) => v.definitionId === definitionId).sort((a, b) => b.versionNumber - a.versionNumber).map(({ schema: _schema, inventory: _inventory, ...rest }) => rest), opts);
2548
+ return paginate(Object.values(config.definitionVersions).filter((v) => v.definitionId === definitionId).sort((a, b) => b.versionNumber - a.versionNumber).map(({ schema: _schema, inventory: _inventory, savedValues: _savedValues, ...rest }) => rest), opts);
2549
2549
  }
2550
2550
  async listVersionsFor(_ctx, definitionIds) {
2551
2551
  const config = await this.readConfig();
2552
2552
  const byDefinition = new Map(definitionIds.map((id) => [id, []]));
2553
- for (const { schema: _schema, inventory: _inventory, ...version } of Object.values(config.definitionVersions)) if (this.live(config.definitions[version.definitionId])) byDefinition.get(version.definitionId)?.push(version);
2553
+ for (const { schema: _schema, inventory: _inventory, savedValues: _savedValues, ...version } of Object.values(config.definitionVersions)) if (this.live(config.definitions[version.definitionId])) byDefinition.get(version.definitionId)?.push(version);
2554
2554
  for (const versions of byDefinition.values()) versions.sort((a, b) => b.versionNumber - a.versionNumber);
2555
2555
  return byDefinition;
2556
2556
  }
@@ -2573,6 +2573,13 @@ var LocalDefinitionStore = class LocalDefinitionStore {
2573
2573
  version.inventorySummary = summary;
2574
2574
  await this.writeConfig(config);
2575
2575
  }
2576
+ async setVersionSavedValues(_ctx, versionId, values) {
2577
+ const config = await this.readConfig();
2578
+ const version = config.definitionVersions[versionId];
2579
+ if (!version) return;
2580
+ version.savedValues = values;
2581
+ await this.writeConfig(config);
2582
+ }
2576
2583
  async deleteVersion(ctx, versionId) {
2577
2584
  const config = await this.readConfig();
2578
2585
  const version = config.definitionVersions[versionId];
@@ -4029,21 +4036,21 @@ function projectMemberToRow(m) {
4029
4036
  /** Explicit column list for `definitions` — every field `rowToRecord` consumes. */
4030
4037
  var DEFINITION_COLUMNS = "guid, project_id, owner_id, created_by, updated_by, compute_server_id, solve_cache_limit, display_name, description, category, tags, cover_image, status, run_count, next_version_number, live_version_id, draft_version_id, source_document_id, created_at, updated_at, deleted_at";
4031
4038
  /**
4032
- * Explicit column list for `definition_versions`, minus the `schema` and `inventory` JSONB.
4033
- * Each can be hundreds of KB per row, so the list projection leaves them out
4039
+ * Explicit column list for `definition_versions`, minus the `schema`, `inventory` and
4040
+ * `saved_values` JSONB. Each can be hundreds of KB per row, so the list projection leaves them out
4034
4041
  * and `listVersions` returns rows without them; only `getVersion`
4035
4042
  * (which reads one row, for a caller that needs them) pulls them in.
4036
4043
  */
4037
4044
  var DEFINITION_VERSION_COLUMNS = "id, definition_guid, version_number, file_ext, file_key, original_filename, uploaded_by, uploaded_at, change_note, schema_extracted_at, inventory_summary";
4038
4045
  /**
4039
- * `getVersion`'s projection — the list columns plus the `schema` and `inventory` JSONB. Spelled
4046
+ * `getVersion`'s projection — the list columns plus the `schema`, `inventory` and `saved_values` JSONB. Spelled
4040
4047
  * out rather than built with a template literal: supabase-js infers the row
4041
4048
  * type from the literal column string, and a template literal degrades it to
4042
4049
  * `string`.
4043
4050
  */
4044
4051
  /** PostgREST's default `max-rows`: a longer read comes back cut at it. */
4045
4052
  var VERSIONS_PAGE = 1e3;
4046
- var DEFINITION_VERSION_COLUMNS_WITH_SCHEMA = "id, definition_guid, version_number, file_ext, file_key, original_filename, uploaded_by, uploaded_at, change_note, schema_extracted_at, inventory_summary, schema, inventory";
4053
+ var DEFINITION_VERSION_COLUMNS_WITH_SCHEMA = "id, definition_guid, version_number, file_ext, file_key, original_filename, uploaded_by, uploaded_at, change_note, schema_extracted_at, inventory_summary, schema, inventory, saved_values";
4047
4054
  /**
4048
4055
  * Definition metadata + version store backed by Postgres. `definitions` carries
4049
4056
  * the parent record and the `live`/`draft` channel pointers; `definition_versions`
@@ -4209,6 +4216,10 @@ var SupabaseDefinitionStore = class {
4209
4216
  }).eq("id", versionId);
4210
4217
  if (error) throw mapPostgrestError(error);
4211
4218
  }
4219
+ async setVersionSavedValues(_ctx, versionId, values) {
4220
+ const { error } = await this.clients.serviceClient.from("definition_versions").update({ saved_values: values }).eq("id", versionId);
4221
+ if (error) throw mapPostgrestError(error);
4222
+ }
4212
4223
  async deleteVersion(ctx, versionId) {
4213
4224
  const { error } = await this.clients.serviceClient.from("definition_versions").delete().eq("id", versionId);
4214
4225
  if (error) throw mapPostgrestError(error);
@@ -4340,7 +4351,8 @@ function rowToVersion(row) {
4340
4351
  schema: row.schema ?? void 0,
4341
4352
  schemaExtractedAt: row.schema_extracted_at ?? void 0,
4342
4353
  inventory: row.inventory ?? void 0,
4343
- inventorySummary: row.inventory_summary ?? void 0
4354
+ inventorySummary: row.inventory_summary ?? void 0,
4355
+ savedValues: row.saved_values ?? void 0
4344
4356
  };
4345
4357
  }
4346
4358
  function versionToRow(v) {
@@ -4359,6 +4371,7 @@ function versionToRow(v) {
4359
4371
  if (v.schemaExtractedAt !== void 0) row.schema_extracted_at = v.schemaExtractedAt;
4360
4372
  if (v.inventory !== void 0) row.inventory = v.inventory;
4361
4373
  if (v.inventorySummary !== void 0) row.inventory_summary = v.inventorySummary;
4374
+ if (v.savedValues !== void 0) row.saved_values = v.savedValues;
4362
4375
  return row;
4363
4376
  }
4364
4377
  function definitionOrderColumn(orderBy) {
@@ -5114,7 +5127,7 @@ function tokenToRow(t) {
5114
5127
  * whenever a migration is added — `migration-head.test.ts` asserts it
5115
5128
  * matches the migrations directory, so CI catches drift.
5116
5129
  */
5117
- var EXPECTED_MIGRATION_HEAD = "20261117200000";
5130
+ var EXPECTED_MIGRATION_HEAD = "20261120150000";
5118
5131
  /**
5119
5132
  * The oldest head this build runs on; the handshake fails below it. Behind
5120
5133
  * {@link EXPECTED_MIGRATION_HEAD} only while a migration has to land after the
@@ -6938,6 +6951,7 @@ var inventoryFields = (inventory) => inventory ? {
6938
6951
  inventory,
6939
6952
  inventorySummary: summarizeInventory(inventory)
6940
6953
  } : {};
6954
+ var savedValuesField = (values) => values instanceof Map && values.size > 0 ? { savedValues: savedValuesToRecord(values) } : {};
6941
6955
  /**
6942
6956
  * Orchestrates writes spanning IDataProvider + IStorageProvider. Application
6943
6957
  * orchestration, not platform contract — hence not in @selvajs/platform.
@@ -6950,11 +6964,13 @@ var inventoryFields = (inventory) => inventory ? {
6950
6964
  var DefinitionService = class {
6951
6965
  data;
6952
6966
  storage;
6953
- constructor(data, storage) {
6967
+ logger;
6968
+ constructor(data, storage, logger = new NoopLogger()) {
6954
6969
  this.data = data;
6955
6970
  this.storage = storage;
6971
+ this.logger = logger;
6956
6972
  }
6957
- async create(ctx, input, file, schema, inventory) {
6973
+ async create(ctx, input, file, schema, inventory, savedValues) {
6958
6974
  const now = (/* @__PURE__ */ new Date()).toISOString();
6959
6975
  const actor = ctx.userId || input.ownerId;
6960
6976
  const record = {
@@ -6994,9 +7010,11 @@ var DefinitionService = class {
6994
7010
  uploadedAt: now,
6995
7011
  schema,
6996
7012
  schemaExtractedAt: now,
6997
- ...inventoryFields(inventory)
7013
+ ...inventoryFields(inventory),
7014
+ ...savedValuesField(savedValues)
6998
7015
  };
6999
7016
  await this.data.definitions.createVersion(ctx, version);
7017
+ this.storeSavedValuesLater(ctx, versionId, savedValues);
7000
7018
  await this.data.definitions.attachInitialVersion(ctx, input.guid, versionId);
7001
7019
  return {
7002
7020
  record: {
@@ -7012,7 +7030,7 @@ var DefinitionService = class {
7012
7030
  * Advances the draft pointer only — `live` is unchanged. Use `publish` to
7013
7031
  * promote.
7014
7032
  */
7015
- async uploadVersion(ctx, guid, file, ext, originalName, schema, changeNote, inventory) {
7033
+ async uploadVersion(ctx, guid, file, ext, originalName, schema, changeNote, inventory, savedValues) {
7016
7034
  const existing = await this.data.definitions.get(ctx, guid);
7017
7035
  if (!existing) throw new ProviderError(`Definition not found: ${guid}`, 404);
7018
7036
  const next = await this.data.definitions.reserveNextVersionNumber(ctx, guid);
@@ -7032,14 +7050,29 @@ var DefinitionService = class {
7032
7050
  changeNote: changeNote?.trim() || void 0,
7033
7051
  schema,
7034
7052
  schemaExtractedAt: now,
7035
- ...inventoryFields(inventory)
7053
+ ...inventoryFields(inventory),
7054
+ ...savedValuesField(savedValues)
7036
7055
  };
7037
7056
  await this.data.definitions.createVersion(ctx, version);
7057
+ this.storeSavedValuesLater(ctx, versionId, savedValues);
7038
7058
  await this.data.definitions.setDraftVersion(ctx, guid, versionId);
7039
7059
  const sourceDocumentId = toSourceDocumentId(schema.documentId);
7040
7060
  if (sourceDocumentId && sourceDocumentId !== existing.sourceDocumentId) await this.data.definitions.update(ctx, guid, { sourceDocumentId });
7041
7061
  return version;
7042
7062
  }
7063
+ storeSavedValuesLater(ctx, versionId, values) {
7064
+ if (!(values instanceof Promise)) return;
7065
+ values.then((read) => {
7066
+ if (read.size === 0) return;
7067
+ return this.data.definitions.setVersionSavedValues(ctx, versionId, savedValuesToRecord(read));
7068
+ }).catch((err) => {
7069
+ this.logger.warn("Saved values write failed", {
7070
+ component: "definitionService",
7071
+ versionId,
7072
+ err: err instanceof Error ? err.stack ?? err.message : String(err)
7073
+ });
7074
+ });
7075
+ }
7043
7076
  /**
7044
7077
  * Moves the live channel to `versionId`, or to the current draft if omitted.
7045
7078
  * Any version id is accepted, so this rolls backward as well as forward.
@@ -7743,7 +7776,7 @@ var _definitionService;
7743
7776
  function getDefinitionService() {
7744
7777
  if (!_definitionService) {
7745
7778
  const p = resolveProviders();
7746
- _definitionService = new DefinitionService(p.data, p.storage);
7779
+ _definitionService = new DefinitionService(p.data, p.storage, lazyLogger);
7747
7780
  }
7748
7781
  return _definitionService;
7749
7782
  }