@supacloud/compiler 0.50.1 → 0.51.1

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/cli.js CHANGED
@@ -270,6 +270,16 @@ function validateFeatureSpec(spec, module) {
270
270
  if (spec.tenantField !== undefined && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(spec.tenantField)) {
271
271
  error("feature-tenant-boundary-invalid", `Feature ${spec.name} declares an unsafe tenant field.`);
272
272
  }
273
+ if (spec.requiredAdapters !== undefined) {
274
+ if (spec.requiredAdapters.length === 0 || spec.requiredAdapters.some((token) => !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(token)) || new Set(spec.requiredAdapters).size !== spec.requiredAdapters.length) {
275
+ error("feature-adapter-requirements-invalid", `Feature ${spec.name} must declare unique, non-empty adapter token identifiers.`);
276
+ }
277
+ }
278
+ if (spec.requiredAdapterScopes !== undefined) {
279
+ if (spec.requiredAdapters === undefined || Object.keys(spec.requiredAdapterScopes).some((token) => !spec.requiredAdapters?.includes(token))) {
280
+ error("feature-adapter-requirements-invalid", `Feature ${spec.name} must scope only declared required adapters.`);
281
+ }
282
+ }
273
283
  const databaseTransition = spec.transitions.some((transition) => transition.persistence?.boundary === "database");
274
284
  if (databaseTransition && spec.database === undefined && spec.file !== undefined) {
275
285
  error("feature-database-source-required", `Database Feature ${spec.name} must declare its database source, table and rowType.`);
@@ -286,6 +296,19 @@ function validateFeatureSpec(spec, module) {
286
296
  }
287
297
  }
288
298
  const names = new Set;
299
+ if (module && spec.requiredAdapters !== undefined) {
300
+ for (const token of spec.requiredAdapters) {
301
+ const provider = module.providers.find((candidate) => candidate.token === token || candidate.useClass === token);
302
+ if (!provider) {
303
+ error("feature-adapter-unresolved", `Feature ${spec.name} requires adapter ${token}, but module ${module.name} does not register a provider for it.`);
304
+ } else {
305
+ const expectedScope = spec.requiredAdapterScopes?.[token];
306
+ if (expectedScope !== undefined && provider.scope !== expectedScope) {
307
+ error("feature-adapter-provider-scope", `Feature ${spec.name} requires adapter ${token} to use ${expectedScope} scope, but module ${module.name} registers it with ${provider.scope} scope.`);
308
+ }
309
+ }
310
+ }
311
+ }
289
312
  for (const transition of spec.transitions) {
290
313
  if (!transition.name.trim() || names.has(transition.name)) {
291
314
  error("duplicate-feature-transition", `Feature ${spec.name} has duplicate/empty transition '${transition.name}'.`);
@@ -325,11 +348,20 @@ function validateFeatureSpec(spec, module) {
325
348
  }
326
349
  if (!module)
327
350
  continue;
328
- if (transition.persistence?.boundary === "database") {
351
+ if (transition.persistence !== undefined) {
329
352
  for (const query of module.queries) {
353
+ const queryProvider = module.providers.find((provider) => provider.token === query.className || provider.useClass === query.className);
354
+ if (!queryProvider) {
355
+ error("feature-query-provider-unresolved", `Feature query ${query.className} is not registered as a runtime provider in module ${module.name}.`);
356
+ } else if (queryProvider.scope !== "request") {
357
+ error("feature-query-provider-scope", `Feature query ${query.className} must use request scope, but module ${module.name} registers it with ${queryProvider.scope} scope.`);
358
+ }
330
359
  if (query.tenantScope !== "required") {
331
360
  error("feature-query-tenant-boundary", `Query ${query.className} in Feature ${spec.name} must declare tenantScope: "required".`);
332
361
  }
362
+ if (spec.readPermission !== undefined && query.permission !== spec.readPermission) {
363
+ error("feature-query-permission", `Query ${query.className} in Feature ${spec.name} must declare read permission '${spec.readPermission}'.`);
364
+ }
333
365
  }
334
366
  for (const job of module.jobs ?? []) {
335
367
  if (job.tenantScope !== "required") {
@@ -346,6 +378,12 @@ function validateFeatureSpec(spec, module) {
346
378
  error("feature-command-unresolved", `Transition ${transition.name} declares governance without a command binding.`);
347
379
  }
348
380
  if (command) {
381
+ const commandProvider = module.providers.find((provider) => provider.token === command.className || provider.useClass === command.className);
382
+ if (!commandProvider) {
383
+ error("feature-command-provider-unresolved", `Feature transition ${transition.name} references command ${command.className}, but the command is not registered as a provider in module ${module.name}.`);
384
+ } else if (commandProvider.scope !== "request") {
385
+ error("feature-command-provider-scope", `Feature command ${command.className} must use request scope, but module ${module.name} registers it with ${commandProvider.scope} scope.`);
386
+ }
349
387
  for (const key of ["permission", "transaction", "idempotency", "audit"]) {
350
388
  if (transition[key] !== undefined && transition[key] !== command[key]) {
351
389
  error("feature-governance-drift", `Transition ${transition.name} ${key} differs from command ${command.className}.`);
@@ -372,6 +410,12 @@ function validateFeatureSpec(spec, module) {
372
410
  error("feature-job-unresolved", `Transition ${transition.name} must reference exactly one Job in module ${module.name}.`);
373
411
  } else {
374
412
  const job = jobs[0];
413
+ const jobProvider = module.providers.find((provider) => provider.token === job.className || provider.useClass === job.className);
414
+ if (!jobProvider) {
415
+ error("feature-job-provider-unresolved", `Feature transition ${transition.name} references Job ${job.className}, but the Job is not registered as a runtime provider in module ${module.name}.`);
416
+ } else if (jobProvider.scope !== "job") {
417
+ error("feature-job-provider-scope", `Feature Job ${job.className} must use job scope, but module ${module.name} registers it with ${jobProvider.scope} scope.`);
418
+ }
375
419
  if (job.tenantScope !== "required") {
376
420
  error("feature-job-tenant-boundary", `Job ${job.className} in Feature ${spec.name} must declare tenantScope: "required".`);
377
421
  }
@@ -1448,6 +1492,11 @@ var init_validate = __esm(() => {
1448
1492
  "duplicate-feature-transition": { code: "SC6102", docsUrl: "https://supacloud.dev/errors/SC6102" },
1449
1493
  "invalid-feature-transition": { code: "SC6103", docsUrl: "https://supacloud.dev/errors/SC6103" },
1450
1494
  "feature-command-unresolved": { code: "SC6104", docsUrl: "https://supacloud.dev/errors/SC6104" },
1495
+ "feature-command-provider-unresolved": { code: "SC6128", docsUrl: "https://supacloud.dev/errors/SC6128" },
1496
+ "feature-command-provider-scope": { code: "SC6134", docsUrl: "https://supacloud.dev/errors/SC6134" },
1497
+ "feature-adapter-unresolved": { code: "SC6135", docsUrl: "https://supacloud.dev/errors/SC6135" },
1498
+ "feature-adapter-requirements-invalid": { code: "SC6136", docsUrl: "https://supacloud.dev/errors/SC6136" },
1499
+ "feature-adapter-provider-scope": { code: "SC6137", docsUrl: "https://supacloud.dev/errors/SC6137" },
1451
1500
  "feature-governance-drift": { code: "SC6105", docsUrl: "https://supacloud.dev/errors/SC6105" },
1452
1501
  "feature-persistence-invalid": { code: "SC6110", docsUrl: "https://supacloud.dev/errors/SC6110" },
1453
1502
  "feature-persistence-drift": { code: "SC6111", docsUrl: "https://supacloud.dev/errors/SC6111" },
@@ -1455,9 +1504,14 @@ var init_validate = __esm(() => {
1455
1504
  "feature-tenant-boundary-invalid": { code: "SC6112", docsUrl: "https://supacloud.dev/errors/SC6112" },
1456
1505
  "feature-tenant-boundary-drift": { code: "SC6127", docsUrl: "https://supacloud.dev/errors/SC6127" },
1457
1506
  "feature-query-tenant-boundary": { code: "SC6114", docsUrl: "https://supacloud.dev/errors/SC6114" },
1507
+ "feature-query-provider-unresolved": { code: "SC6130", docsUrl: "https://supacloud.dev/errors/SC6130" },
1508
+ "feature-query-provider-scope": { code: "SC6131", docsUrl: "https://supacloud.dev/errors/SC6131" },
1509
+ "feature-query-permission": { code: "SC6138", docsUrl: "https://supacloud.dev/errors/SC6138" },
1458
1510
  "feature-job-tenant-boundary": { code: "SC6115", docsUrl: "https://supacloud.dev/errors/SC6115" },
1459
1511
  "feature-command-tenant-boundary": { code: "SC6116", docsUrl: "https://supacloud.dev/errors/SC6116" },
1460
1512
  "feature-job-unresolved": { code: "SC6117", docsUrl: "https://supacloud.dev/errors/SC6117" },
1513
+ "feature-job-provider-unresolved": { code: "SC6129", docsUrl: "https://supacloud.dev/errors/SC6129" },
1514
+ "feature-job-provider-scope": { code: "SC6132", docsUrl: "https://supacloud.dev/errors/SC6132" },
1461
1515
  "feature-job-idempotency": { code: "SC6118", docsUrl: "https://supacloud.dev/errors/SC6118" },
1462
1516
  "feature-job-mode": { code: "SC6119", docsUrl: "https://supacloud.dev/errors/SC6119" },
1463
1517
  "feature-job-contract": { code: "SC6120", docsUrl: "https://supacloud.dev/errors/SC6120" },
@@ -1522,10 +1576,13 @@ function buildContractManifest(graph, artifacts) {
1522
1576
  });
1523
1577
  }
1524
1578
  for (const query of module.queries) {
1579
+ if (query.permission)
1580
+ permissions.add(query.permission);
1525
1581
  queries.push({
1526
1582
  name: query.name,
1527
1583
  className: query.className,
1528
1584
  module: module.name,
1585
+ ...query.permission === undefined ? {} : { permission: query.permission },
1529
1586
  ...query.tenantScope === undefined ? {} : { tenantScope: query.tenantScope }
1530
1587
  });
1531
1588
  }
@@ -1549,6 +1606,7 @@ function buildContractManifest(graph, artifacts) {
1549
1606
  states: [...module.featureSpec.states],
1550
1607
  ...module.featureSpec.database === undefined ? {} : { database: module.featureSpec.database },
1551
1608
  ...module.featureSpec.tenantField === undefined ? {} : { tenantField: module.featureSpec.tenantField },
1609
+ ...module.featureSpec.readPermission === undefined ? {} : { readPermission: module.featureSpec.readPermission },
1552
1610
  transitions: module.featureSpec.transitions.map((transition) => {
1553
1611
  const job = transition.job === undefined ? undefined : (module.jobs ?? []).find((candidate) => candidate.className === transition.job || candidate.name === transition.job);
1554
1612
  return {
@@ -1590,8 +1648,9 @@ function buildContractManifest(graph, artifacts) {
1590
1648
  const governedCommand = command ?? featureCommand;
1591
1649
  const effectiveCommand = route.command ?? featureTransition?.command;
1592
1650
  const idempotency = route.idempotency ?? command?.idempotency ?? featureTransition?.idempotency;
1593
- if (governedCommand?.permission)
1594
- permissions.add(governedCommand.permission);
1651
+ const permission = route.permission ?? governedCommand?.permission ?? featureTransition?.permission;
1652
+ if (permission)
1653
+ permissions.add(permission);
1595
1654
  if (route.contract?.evidence)
1596
1655
  fixtures.add(route.contract.evidence);
1597
1656
  routes.push({
@@ -1601,7 +1660,7 @@ function buildContractManifest(graph, artifacts) {
1601
1660
  controller: controller.className,
1602
1661
  handler: route.handler,
1603
1662
  ...effectiveCommand === undefined ? {} : { command: effectiveCommand },
1604
- ...governedCommand?.permission === undefined ? {} : { permission: governedCommand.permission },
1663
+ ...permission === undefined ? {} : { permission },
1605
1664
  ...idempotency === undefined ? {} : { idempotency },
1606
1665
  ...route.tags === undefined ? {} : { tags: [...route.tags] },
1607
1666
  requestSchemas: Object.fromEntries(["body", "params", "query", "headers", "cookie"].flatMap((key) => route[key] === undefined ? [] : [[key, route[key]]])),
@@ -2663,6 +2722,7 @@ function renderClient(graph, options) {
2663
2722
  const featureTransition = featureTransitionForRoute(module, controller, route);
2664
2723
  const featureCommand = featureTransition?.command === undefined ? undefined : commandByClassName.get(featureTransition.command);
2665
2724
  const governedCommand = command ?? featureCommand;
2725
+ const routePermission = route.permission ?? governedCommand?.permission ?? featureTransition?.permission;
2666
2726
  const idempotencyMode = route.idempotency ?? command?.idempotency ?? featureTransition?.idempotency ?? "none";
2667
2727
  const transitionRoute = `${route.method} ${fullPath}`;
2668
2728
  const invalidationTags = featureInvalidationTags.get(`${module.name}:${transitionRoute}`);
@@ -2689,6 +2749,7 @@ function renderClient(graph, options) {
2689
2749
  ["parse", route.parse],
2690
2750
  ["allowDeleteBody", route.allowDeleteBody],
2691
2751
  ["idempotency", idempotencyMode === "none" ? undefined : idempotencyMode],
2752
+ ["permission", routePermission],
2692
2753
  ["tags", route.tags],
2693
2754
  ["invalidateTags", invalidationTags]
2694
2755
  ]) {
@@ -2730,6 +2791,7 @@ function renderClient(graph, options) {
2730
2791
  path: fullPath,
2731
2792
  controller: controller.className,
2732
2793
  handler: route.handler,
2794
+ ...routePermission === undefined ? {} : { permission: routePermission },
2733
2795
  kind: procedureKind,
2734
2796
  idempotency: idempotencyMode,
2735
2797
  ...route.tags === undefined ? {} : { tags: route.tags },
@@ -2742,7 +2804,7 @@ function renderClient(graph, options) {
2742
2804
  handler: route.handler,
2743
2805
  kind: procedureKind,
2744
2806
  ...governedCommand?.name === undefined ? {} : { command: governedCommand.name },
2745
- ...governedCommand?.permission === undefined ? {} : { permission: governedCommand.permission },
2807
+ ...routePermission === undefined ? {} : { permission: routePermission },
2746
2808
  idempotency: idempotencyMode,
2747
2809
  ...route.tags === undefined ? {} : { tags: [...route.tags] },
2748
2810
  ...invalidationTags === undefined ? {} : { invalidateTags: [...invalidationTags] }
@@ -2798,6 +2860,7 @@ ${procedureMethods.join(`
2798
2860
  " controller: string;",
2799
2861
  " handler: string;",
2800
2862
  " kind: Kind;",
2863
+ " permission?: string;",
2801
2864
  " idempotency: Idempotency;",
2802
2865
  " tags?: readonly string[];",
2803
2866
  " invalidateTags?: readonly string[];",
@@ -3436,7 +3499,7 @@ function renderOpenApi(graph, options) {
3436
3499
  const featureCommand = featureTransition?.command === undefined ? undefined : commandByClass.get(featureTransition.command);
3437
3500
  const governedCommand = command ?? featureCommand;
3438
3501
  const idempotencyMode = route.idempotency ?? command?.idempotency ?? featureTransition?.idempotency ?? "none";
3439
- const permission = governedCommand?.permission ?? featureTransition?.permission;
3502
+ const permission = route.permission ?? governedCommand?.permission ?? featureTransition?.permission;
3440
3503
  const requiresAuth = (route.guards?.length ?? 0) > 0 || permission !== undefined || governedCommand !== undefined;
3441
3504
  const responseKind = route.contract?.response;
3442
3505
  const responseContentType = responseKind === "binary" || responseKind === "stream" ? "application/octet-stream" : "application/json";
@@ -3889,6 +3952,10 @@ function renderPermissions(graph) {
3889
3952
  if (command.permission)
3890
3953
  permissions.add(command.permission);
3891
3954
  }
3955
+ for (const query of module.queries) {
3956
+ if (query.permission)
3957
+ permissions.add(query.permission);
3958
+ }
3892
3959
  for (const controller of module.controllers) {
3893
3960
  for (const route of controller.routes) {
3894
3961
  const featureTransition = featureTransitionForRoute(module, controller, route);
@@ -3896,7 +3963,7 @@ function renderPermissions(graph) {
3896
3963
  const featureCommand = featureTransition?.command === undefined ? undefined : module.commands.find((candidate) => candidate.className === featureTransition.command || candidate.name === featureTransition.command);
3897
3964
  const governedCommand = command ?? featureCommand;
3898
3965
  const effectiveCommand = route.command ?? featureTransition?.command;
3899
- const perm = governedCommand?.permission ?? featureTransition?.permission;
3966
+ const perm = route.permission ?? governedCommand?.permission ?? featureTransition?.permission;
3900
3967
  const idempotency = route.idempotency ?? command?.idempotency ?? featureTransition?.idempotency;
3901
3968
  if (perm)
3902
3969
  permissions.add(perm);
@@ -5476,90 +5543,72 @@ var init_settings2 = __esm(() => {
5476
5543
  init_settings();
5477
5544
  });
5478
5545
 
5479
- // node_modules/typebox/build/system/memory/freeze.mjs
5480
- function Freeze(value) {
5481
- return Get().immutableTypes ? Object.freeze(value) : value;
5546
+ // node_modules/typebox/build/system/memory/keys.mjs
5547
+ function Keys2(value) {
5548
+ return [...Keys(value), ...Symbols(value)];
5482
5549
  }
5483
- var init_freeze = __esm(() => {
5550
+ var init_keys = __esm(() => {
5551
+ init_guard2();
5552
+ });
5553
+
5554
+ // node_modules/typebox/build/system/memory/finalize.mjs
5555
+ function Freeze(value, seen) {
5556
+ if (seen.has(value))
5557
+ return;
5558
+ seen.add(value);
5559
+ for (const key of Keys2(value)) {
5560
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
5561
+ if (!descriptor || !("value" in descriptor))
5562
+ continue;
5563
+ if (IsObject(descriptor.value))
5564
+ Freeze(descriptor.value, seen);
5565
+ }
5566
+ Object.freeze(value);
5567
+ }
5568
+ function Finalize(value) {
5569
+ if (!Get().immutableTypes)
5570
+ return value;
5571
+ Freeze(value, new WeakSet);
5572
+ return value;
5573
+ }
5574
+ var init_finalize = __esm(() => {
5575
+ init_guard2();
5484
5576
  init_settings2();
5577
+ init_keys();
5485
5578
  });
5486
5579
 
5487
5580
  // node_modules/typebox/build/system/memory/assign.mjs
5488
5581
  function Assign(left, right) {
5489
5582
  Metrics.assign += 1;
5490
- return Freeze({ ...left, ...right });
5583
+ const result = {}, rightKeys = Keys2(right), leftKeys = Keys2(left);
5584
+ for (const key of leftKeys) {
5585
+ if (rightKeys.includes(key))
5586
+ continue;
5587
+ Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(left, key));
5588
+ }
5589
+ for (const key of rightKeys) {
5590
+ Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(right, key));
5591
+ }
5592
+ return Finalize(result);
5491
5593
  }
5492
5594
  var init_assign = __esm(() => {
5493
5595
  init_metrics();
5494
- init_freeze();
5596
+ init_finalize();
5597
+ init_keys();
5495
5598
  });
5496
5599
 
5497
5600
  // node_modules/typebox/build/system/memory/clone.mjs
5498
- function FromClassInstance(value) {
5499
- return value;
5500
- }
5501
- function IsSchemaObject(value) {
5502
- return HasPropertyKey(value, "~kind") || HasPropertyKey(value, "~unsafe");
5503
- }
5504
- function FromSchemaObject(value) {
5505
- const result = {};
5506
- for (const key of Keys(value)) {
5507
- if (IsUnsafePropertyKey(key))
5508
- continue;
5509
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
5510
- descriptor.value = FromValue(descriptor.value);
5511
- if (IsEqual(descriptor.enumerable, true)) {
5512
- result[key] = descriptor.value;
5513
- } else {
5514
- Object.defineProperty(result, key, descriptor);
5515
- }
5516
- }
5517
- return result;
5518
- }
5519
- function FromPlainObject(value) {
5520
- const result = {};
5521
- for (const key of Keys(value)) {
5522
- if (IsUnsafePropertyKey(key))
5523
- continue;
5524
- result[key] = FromValue(value[key]);
5525
- }
5526
- for (const key of Symbols(value)) {
5527
- result[key] = FromValue(value[key]);
5528
- }
5529
- return result;
5530
- }
5531
- function FromObject(value) {
5532
- return IsClassInstance(value) ? FromClassInstance(value) : IsSchemaObject(value) ? FromSchemaObject(value) : FromPlainObject(value);
5533
- }
5534
- function FromArray(value) {
5535
- return value.map((element) => FromValue(element));
5536
- }
5537
- function FromTypedArray(value) {
5538
- return value.slice();
5539
- }
5540
- function FromRegExp(value) {
5541
- return new RegExp(value.source, value.flags);
5542
- }
5543
- function FromMap(value) {
5544
- return new Map(FromValue([...value.entries()]));
5545
- }
5546
- function FromSet(value) {
5547
- return new Set(FromValue([...value.values()]));
5548
- }
5549
- function FromValue(value) {
5550
- return IsTypeArray(value) ? FromTypedArray(value) : IsRegExp(value) ? FromRegExp(value) : IsMap(value) ? FromMap(value) : IsSet(value) ? FromSet(value) : IsArray(value) ? FromArray(value) : IsObject(value) ? FromObject(value) : value;
5551
- }
5552
- function Clone(value) {
5553
- Metrics.clone += 1;
5554
- return FromValue(value);
5555
- }
5556
5601
  var init_clone = __esm(() => {
5557
5602
  init_guard2();
5558
5603
  init_metrics();
5604
+ init_keys();
5559
5605
  });
5560
5606
 
5561
5607
  // node_modules/typebox/build/system/memory/create.mjs
5562
- function MergeHidden(left, right) {
5608
+ function WithEnumerable(left, right) {
5609
+ return { ...left, ...right };
5610
+ }
5611
+ function WithHidden(left, right) {
5563
5612
  for (const key of Object.keys(right)) {
5564
5613
  Object.defineProperty(left, key, {
5565
5614
  configurable: true,
@@ -5570,55 +5619,62 @@ function MergeHidden(left, right) {
5570
5619
  }
5571
5620
  return left;
5572
5621
  }
5573
- function Merge(left, right) {
5574
- return { ...left, ...right };
5575
- }
5576
5622
  function Create(hidden, enumerable, options = {}) {
5577
5623
  Metrics.create += 1;
5578
- const withOptions = Merge(enumerable, options);
5579
- const withHidden = Get().enumerableKind ? Merge(withOptions, hidden) : MergeHidden(withOptions, hidden);
5580
- return Freeze(withHidden);
5624
+ const withEnumerable = WithEnumerable(enumerable, options);
5625
+ const withHidden = Get().enumerableKind ? WithEnumerable(withEnumerable, hidden) : WithHidden(withEnumerable, hidden);
5626
+ return Finalize(withHidden);
5581
5627
  }
5582
5628
  var init_create = __esm(() => {
5583
5629
  init_settings2();
5584
5630
  init_metrics();
5585
- init_freeze();
5631
+ init_finalize();
5586
5632
  });
5587
5633
 
5588
5634
  // node_modules/typebox/build/system/memory/discard.mjs
5589
5635
  function Discard(value, propertyKeys) {
5590
5636
  Metrics.discard += 1;
5591
5637
  const result = {};
5592
- for (const key of Keys(value)) {
5638
+ for (const key of Keys2(value)) {
5593
5639
  if (propertyKeys.includes(key))
5594
5640
  continue;
5595
5641
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
5596
- descriptor.value = Clone(descriptor.value);
5597
5642
  Object.defineProperty(result, key, descriptor);
5598
5643
  }
5599
- return Freeze(result);
5644
+ return Finalize(result);
5600
5645
  }
5601
5646
  var init_discard = __esm(() => {
5602
- init_guard2();
5603
5647
  init_metrics();
5604
- init_freeze();
5605
- init_clone();
5648
+ init_finalize();
5649
+ init_keys();
5606
5650
  });
5607
5651
 
5608
5652
  // node_modules/typebox/build/system/memory/update.mjs
5609
- function Update(current, hidden, enumerable) {
5610
- Metrics.update += 1;
5611
- const settings = Get();
5612
- const result = Clone(current);
5613
- for (const key of Object.keys(hidden)) {
5653
+ function WithCurrent(current, hiddenKeys, enumerableKeys, result) {
5654
+ for (const key of Keys2(current)) {
5655
+ if (IsUnsafePropertyKey(key) || hiddenKeys.includes(key) || enumerableKeys.includes(key))
5656
+ continue;
5657
+ const descriptor = Object.getOwnPropertyDescriptor(current, key);
5658
+ Object.defineProperty(result, key, descriptor);
5659
+ }
5660
+ }
5661
+ function WithHidden2(hidden, keys, result) {
5662
+ const enumerableKind = Get().enumerableKind;
5663
+ for (const key of keys) {
5664
+ if (IsUnsafePropertyKey(key))
5665
+ continue;
5614
5666
  Object.defineProperty(result, key, {
5615
5667
  configurable: true,
5616
5668
  writable: true,
5617
- enumerable: settings.enumerableKind,
5669
+ enumerable: enumerableKind,
5618
5670
  value: hidden[key]
5619
5671
  });
5620
5672
  }
5621
- for (const key of Object.keys(enumerable)) {
5673
+ }
5674
+ function WithEnumerable2(enumerable, keys, result) {
5675
+ for (const key of keys) {
5676
+ if (IsUnsafePropertyKey(key))
5677
+ continue;
5622
5678
  Object.defineProperty(result, key, {
5623
5679
  configurable: true,
5624
5680
  enumerable: true,
@@ -5626,13 +5682,21 @@ function Update(current, hidden, enumerable) {
5626
5682
  value: enumerable[key]
5627
5683
  });
5628
5684
  }
5629
- return Freeze(result);
5685
+ }
5686
+ function Update(current, hidden, enumerable) {
5687
+ Metrics.update += 1;
5688
+ const result = {}, hiddenKeys = Keys2(hidden), enumerableKeys = Keys2(enumerable);
5689
+ WithCurrent(current, hiddenKeys, enumerableKeys, result);
5690
+ WithHidden2(hidden, hiddenKeys, result);
5691
+ WithEnumerable2(enumerable, enumerableKeys, result);
5692
+ return Finalize(result);
5630
5693
  }
5631
5694
  var init_update = __esm(() => {
5695
+ init_guard2();
5632
5696
  init_settings2();
5633
5697
  init_metrics();
5634
- init_freeze();
5635
- init_clone();
5698
+ init_finalize();
5699
+ init_keys();
5636
5700
  });
5637
5701
 
5638
5702
  // node_modules/typebox/build/system/memory/memory.mjs
@@ -5674,11 +5738,8 @@ var init_deferred = __esm(() => {
5674
5738
  });
5675
5739
 
5676
5740
  // node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs
5677
- function AddReadonlyOperation(type) {
5678
- return Update(type, { "~readonly": true }, {});
5679
- }
5680
5741
  function AddReadonlyAction(type, options) {
5681
- const result = Update(AddReadonlyOperation(type), {}, options);
5742
+ const result = Update(type, { "~readonly": true }, options);
5682
5743
  return result;
5683
5744
  }
5684
5745
  function AddReadonlyInstantiate(context, state, type, options) {
@@ -5691,11 +5752,8 @@ var init_instantiate_add = __esm(() => {
5691
5752
  });
5692
5753
 
5693
5754
  // node_modules/typebox/build/type/engine/optional/instantiate_add.mjs
5694
- function AddOptionalOperation(type) {
5695
- return Update(type, { "~optional": true }, {});
5696
- }
5697
5755
  function AddOptionalAction(type, options) {
5698
- const result = Update(AddOptionalOperation(type), {}, options);
5756
+ const result = Update(type, { "~optional": true }, options);
5699
5757
  return result;
5700
5758
  }
5701
5759
  function AddOptionalInstantiate(context, state, type, options) {
@@ -6013,13 +6071,20 @@ function IsIEEE754(value) {
6013
6071
  return typeof value === "number";
6014
6072
  }
6015
6073
  function FNV1A64_OP(byte) {
6016
- Accumulator = Accumulator ^ Bytes[byte];
6017
- Accumulator = Accumulator * Prime % Size;
6074
+ const L0 = A0 ^ byte;
6075
+ const T0 = L0 * 435;
6076
+ const T1 = A1 * 435 + (T0 >>> 16);
6077
+ const T2 = A2 * 435 + (T1 >>> 16) + (L0 << 8);
6078
+ const T3 = A3 * 435 + (T2 >>> 16) + (A1 << 8);
6079
+ A0 = T0 & 65535;
6080
+ A1 = T1 & 65535;
6081
+ A2 = T2 & 65535;
6082
+ A3 = T3 & 65535;
6018
6083
  }
6019
- function FromArray2(value) {
6084
+ function FromArray(value) {
6020
6085
  FNV1A64_OP(ByteMarker.Array);
6021
6086
  for (const item of value) {
6022
- FromValue2(item);
6087
+ FromValue(item);
6023
6088
  }
6024
6089
  }
6025
6090
  function FromBigInt(value) {
@@ -6035,15 +6100,15 @@ function FromBoolean(value) {
6035
6100
  }
6036
6101
  function FromConstructor(value) {
6037
6102
  FNV1A64_OP(ByteMarker.Constructor);
6038
- FromValue2(value.toString());
6103
+ FromValue(value.toString());
6039
6104
  }
6040
6105
  function FromDate(value) {
6041
6106
  FNV1A64_OP(ByteMarker.Date);
6042
- FromValue2(value.getTime());
6107
+ FromValue(value.getTime());
6043
6108
  }
6044
6109
  function FromFunction(value) {
6045
6110
  FNV1A64_OP(ByteMarker.Function);
6046
- FromValue2(value.toString());
6111
+ FromValue(value.toString());
6047
6112
  }
6048
6113
  function FromNull(_value) {
6049
6114
  FNV1A64_OP(ByteMarker.Null);
@@ -6055,26 +6120,33 @@ function FromNumber(value) {
6055
6120
  FNV1A64_OP(byte);
6056
6121
  }
6057
6122
  }
6058
- function FromObject2(value) {
6123
+ function FromObject(value) {
6059
6124
  FNV1A64_OP(ByteMarker.Object);
6060
6125
  for (const key of InstanceKeys(value).sort()) {
6061
- FromValue2(key);
6062
- FromValue2(value[key]);
6126
+ FromValue(key);
6127
+ FromValue(value[key]);
6063
6128
  }
6064
6129
  }
6065
- function FromRegExp2(value) {
6130
+ function FromRegExp(value) {
6066
6131
  FNV1A64_OP(ByteMarker.RegExp);
6067
6132
  FromString(value.toString());
6068
6133
  }
6069
6134
  function FromString(value) {
6070
6135
  FNV1A64_OP(ByteMarker.String);
6071
- for (const byte of encoder.encode(value)) {
6072
- FNV1A64_OP(byte);
6136
+ for (let i = 0;i < value.length; i++) {
6137
+ const code = value.charCodeAt(i);
6138
+ if (code > 127) {
6139
+ for (const byte of encoder.encode(value.slice(i))) {
6140
+ FNV1A64_OP(byte);
6141
+ }
6142
+ return;
6143
+ }
6144
+ FNV1A64_OP(code);
6073
6145
  }
6074
6146
  }
6075
6147
  function FromSymbol(value) {
6076
6148
  FNV1A64_OP(ByteMarker.Symbol);
6077
- FromValue2(value.toString());
6149
+ FromValue(value.toString());
6078
6150
  }
6079
6151
  function FromTypeArray(value) {
6080
6152
  FNV1A64_OP(ByteMarker.TypeArray);
@@ -6086,18 +6158,18 @@ function FromTypeArray(value) {
6086
6158
  function FromUndefined(_value) {
6087
6159
  return FNV1A64_OP(ByteMarker.Undefined);
6088
6160
  }
6089
- function FromValue2(value) {
6090
- return IsTypeArray(value) ? FromTypeArray(value) : IsDate(value) ? FromDate(value) : IsRegExp(value) ? FromRegExp2(value) : IsBoolean2(value) ? FromBoolean(value.valueOf()) : IsString2(value) ? FromString(value.valueOf()) : IsNumber2(value) ? FromNumber(value.valueOf()) : IsIEEE754(value) ? FromNumber(value) : IsArray(value) ? FromArray2(value) : IsBoolean(value) ? FromBoolean(value) : IsBigInt(value) ? FromBigInt(value) : IsConstructor(value) ? FromConstructor(value) : IsNull(value) ? FromNull(value) : IsObject(value) ? FromObject2(value) : IsString(value) ? FromString(value) : IsSymbol(value) ? FromSymbol(value) : IsUndefined(value) ? FromUndefined(value) : IsFunction(value) ? FromFunction(value) : Unreachable();
6161
+ function FromValue(value) {
6162
+ return IsTypeArray(value) ? FromTypeArray(value) : IsDate(value) ? FromDate(value) : IsRegExp(value) ? FromRegExp(value) : IsBoolean2(value) ? FromBoolean(value.valueOf()) : IsString2(value) ? FromString(value.valueOf()) : IsNumber2(value) ? FromNumber(value.valueOf()) : IsIEEE754(value) ? FromNumber(value) : IsArray(value) ? FromArray(value) : IsBoolean(value) ? FromBoolean(value) : IsBigInt(value) ? FromBigInt(value) : IsConstructor(value) ? FromConstructor(value) : IsNull(value) ? FromNull(value) : IsObject(value) ? FromObject(value) : IsString(value) ? FromString(value) : IsSymbol(value) ? FromSymbol(value) : IsUndefined(value) ? FromUndefined(value) : IsFunction(value) ? FromFunction(value) : Unreachable();
6091
6163
  }
6092
- function HashCode(value) {
6093
- Accumulator = BigInt("14695981039346656037");
6094
- FromValue2(value);
6095
- return Accumulator;
6164
+ function Hex(limb) {
6165
+ return limb.toString(16).padStart(4, "0");
6096
6166
  }
6097
6167
  function Hash(value) {
6098
- return HashCode(value).toString(16).padStart(16, "0");
6168
+ A0 = 8997, A1 = 33826, A2 = 40164, A3 = 52210;
6169
+ FromValue(value);
6170
+ return `${Hex(A3)}${Hex(A2)}${Hex(A1)}${Hex(A0)}`;
6099
6171
  }
6100
- var ByteMarker, Accumulator, Prime, Size, Bytes, F64, F64In, F64Out, encoder;
6172
+ var ByteMarker, A0 = 8997, A1 = 33826, A2 = 40164, A3 = 52210, F64, F64In, F64Out, encoder;
6101
6173
  var init_hash = __esm(() => {
6102
6174
  init_unreachable();
6103
6175
  init_guard2();
@@ -6117,9 +6189,6 @@ var init_hash = __esm(() => {
6117
6189
  TypeArray: 12,
6118
6190
  Undefined: 13
6119
6191
  };
6120
- Accumulator = BigInt("14695981039346656037");
6121
- [Prime, Size] = [BigInt("1099511628211"), BigInt("18446744073709551616")];
6122
- Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
6123
6192
  F64 = new Float64Array(1);
6124
6193
  F64In = new DataView(F64.buffer);
6125
6194
  F64Out = new Uint8Array(F64.buffer);
@@ -6582,30 +6651,20 @@ var init_tuple = __esm(() => {
6582
6651
  init_schema();
6583
6652
  });
6584
6653
 
6585
- // node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs
6586
- function RemoveReadonlyOperation(type) {
6587
- return Discard(type, ["~readonly"]);
6588
- }
6589
- function RemoveReadonlyAction(type, options) {
6590
- const result = Update(RemoveReadonlyOperation(type), {}, options);
6654
+ // node_modules/typebox/build/type/engine/tuple/to_object.mjs
6655
+ function TupleElementsToProperties(types) {
6656
+ const result = types.reduceRight((result, right, index) => {
6657
+ return { [index]: right, ...result };
6658
+ }, {});
6591
6659
  return result;
6592
6660
  }
6593
- function RemoveReadonlyInstantiate(context, state, type, options) {
6594
- const instantiatedType = InstantiateType(context, state, type);
6595
- return RemoveReadonlyAction(instantiatedType, options);
6596
- }
6597
- var init_instantiate_remove = __esm(() => {
6598
- init_memory2();
6599
- init_instantiate27();
6600
- });
6601
-
6602
- // node_modules/typebox/build/type/action/_remove_readonly.mjs
6603
- function RemoveReadonly(type, options = {}) {
6604
- return RemoveReadonlyAction(type, options);
6661
+ function TupleToObject(type) {
6662
+ const properties = TupleElementsToProperties(type.items);
6663
+ const result = _Object_(properties);
6664
+ return result;
6605
6665
  }
6606
- var init__remove_readonly = __esm(() => {
6607
- init_deferred();
6608
- init_instantiate_remove();
6666
+ var init_to_object = __esm(() => {
6667
+ init_object();
6609
6668
  });
6610
6669
 
6611
6670
  // node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs
@@ -6620,55 +6679,57 @@ function RemoveOptionalInstantiate(context, state, type, options) {
6620
6679
  const instantiatedType = InstantiateType(context, state, type);
6621
6680
  return RemoveOptionalAction(instantiatedType, options);
6622
6681
  }
6623
- var init_instantiate_remove2 = __esm(() => {
6682
+ var init_instantiate_remove = __esm(() => {
6624
6683
  init_memory2();
6625
6684
  init_instantiate27();
6626
6685
  });
6627
6686
 
6628
- // node_modules/typebox/build/type/action/_remove_optional.mjs
6629
- function RemoveOptional(type, options = {}) {
6630
- return RemoveOptionalAction(type, options);
6687
+ // node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs
6688
+ function RemoveReadonlyOperation(type) {
6689
+ return Discard(type, ["~readonly"]);
6631
6690
  }
6632
- var init__remove_optional = __esm(() => {
6633
- init_deferred();
6634
- init_instantiate_remove2();
6635
- });
6636
-
6637
- // node_modules/typebox/build/type/engine/tuple/to_object.mjs
6638
- function TupleElementsToProperties(types) {
6639
- const result = types.reduceRight((result, right, index) => {
6640
- return { [index]: right, ...result };
6641
- }, {});
6691
+ function RemoveReadonlyAction(type, options) {
6692
+ const result = Update(RemoveReadonlyOperation(type), {}, options);
6642
6693
  return result;
6643
6694
  }
6644
- function TupleToObject(type) {
6645
- const properties = TupleElementsToProperties(type.items);
6646
- const result = _Object_(properties);
6647
- return result;
6695
+ function RemoveReadonlyInstantiate(context, state, type, options) {
6696
+ const instantiatedType = InstantiateType(context, state, type);
6697
+ return RemoveReadonlyAction(instantiatedType, options);
6648
6698
  }
6649
- var init_to_object = __esm(() => {
6650
- init_object();
6699
+ var init_instantiate_remove2 = __esm(() => {
6700
+ init_memory2();
6701
+ init_instantiate27();
6651
6702
  });
6652
6703
 
6653
- // node_modules/typebox/build/type/engine/evaluate/composite.mjs
6654
- function CanComposite(type) {
6655
- return IsObject2(type) || IsTuple(type);
6656
- }
6657
- function IsReadonlyProperty(left, right) {
6658
- return IsReadonly(left) ? IsReadonly(right) ? true : false : false;
6659
- }
6660
- function IsOptionalProperty(left, right) {
6661
- return IsOptional(left) ? IsOptional(right) ? true : false : false;
6662
- }
6663
- function CompositeProperty(left, right) {
6664
- const isReadonly = IsReadonlyProperty(left, right);
6665
- const isOptional = IsOptionalProperty(left, right);
6704
+ // node_modules/typebox/build/type/engine/evaluate/property.mjs
6705
+ function EvaluatePropertyIntersect(left, right) {
6706
+ const isReadonly = IsReadonly(left) && IsReadonly(right);
6707
+ const isOptional = IsOptional(left) && IsOptional(right);
6666
6708
  const evaluated = EvaluateIntersect([left, right]);
6667
- const property = RemoveReadonly(RemoveOptional(evaluated));
6668
- return isReadonly && isOptional ? AddReadonly(AddOptional(property)) : isReadonly && !isOptional ? AddReadonly(property) : !isReadonly && isOptional ? AddOptional(property) : property;
6669
- }
6709
+ const property = RemoveReadonlyAction(RemoveOptionalAction(evaluated, {}), {});
6710
+ return isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) : isReadonly ? AddReadonlyAction(property, {}) : isOptional ? AddOptionalAction(property, {}) : property;
6711
+ }
6712
+ function EvaluatePropertyUnion(left, right) {
6713
+ const isReadonly = IsReadonly(left) || IsReadonly(right);
6714
+ const isOptional = IsOptional(left) || IsOptional(right);
6715
+ const leftProperty = RemoveReadonlyAction(RemoveOptionalAction(left, {}), {});
6716
+ const rightProperty = RemoveReadonlyAction(RemoveOptionalAction(right, {}), {});
6717
+ const property = EvaluateUnion([leftProperty, rightProperty]);
6718
+ return isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) : isReadonly ? AddReadonlyAction(property, {}) : isOptional ? AddOptionalAction(property, {}) : property;
6719
+ }
6720
+ var init_property = __esm(() => {
6721
+ init__optional();
6722
+ init__readonly();
6723
+ init_instantiate_add2();
6724
+ init_instantiate_add();
6725
+ init_instantiate_remove();
6726
+ init_instantiate_remove2();
6727
+ init_evaluate2();
6728
+ });
6729
+
6730
+ // node_modules/typebox/build/type/engine/evaluate/composite.mjs
6670
6731
  function CompositePropertyKey(left, right, key) {
6671
- return key in left ? key in right ? CompositeProperty(left[key], right[key]) : left[key] : (key in right) ? right[key] : Never();
6732
+ return key in left ? key in right ? EvaluatePropertyIntersect(left[key], right[key]) : left[key] : (key in right) ? right[key] : Never();
6672
6733
  }
6673
6734
  function CompositeProperties(left, right) {
6674
6735
  const keys = new Set([...Keys(left), ...Keys(right)]);
@@ -6690,17 +6751,11 @@ function Composite(left, right) {
6690
6751
  }
6691
6752
  var init_composite = __esm(() => {
6692
6753
  init_guard2();
6693
- init__readonly();
6694
- init__optional();
6695
6754
  init_object();
6696
6755
  init_never();
6697
6756
  init_tuple();
6698
- init__add_readonly();
6699
- init__add_optional();
6700
- init__remove_readonly();
6701
- init__remove_optional();
6702
6757
  init_to_object();
6703
- init_evaluate2();
6758
+ init_property();
6704
6759
  });
6705
6760
 
6706
6761
  // node_modules/typebox/build/type/engine/evaluate/narrow.mjs
@@ -6708,6 +6763,9 @@ function NarrowCompareRule(left, right) {
6708
6763
  const result = Compare(left, right);
6709
6764
  return IsEqual(result, CompareResultLeftInside) ? left : IsEqual(result, CompareResultRightInside) ? right : IsEqual(result, CompareResultEqual) ? right : Never();
6710
6765
  }
6766
+ function CanComposite(type) {
6767
+ return IsObject2(type) || IsTuple(type);
6768
+ }
6711
6769
  function NarrowCompositeRule(left, right) {
6712
6770
  const canCompositeLeft = CanComposite(left);
6713
6771
  const canCompositeRight = CanComposite(right);
@@ -6718,8 +6776,10 @@ function Narrow(left, right) {
6718
6776
  }
6719
6777
  var init_narrow = __esm(() => {
6720
6778
  init_guard2();
6779
+ init_object();
6721
6780
  init_any();
6722
6781
  init_never();
6782
+ init_tuple();
6723
6783
  init_unknown();
6724
6784
  init_compare();
6725
6785
  init_composite();
@@ -7884,14 +7944,14 @@ var init_object2 = __esm(() => {
7884
7944
  });
7885
7945
 
7886
7946
  // node_modules/typebox/build/type/extends/record.mjs
7887
- function FromObject3(inferred, properties) {
7947
+ function FromObject2(inferred, properties) {
7888
7948
  return IsEqual(Keys(properties).length, 0) ? ExtendsTrue(inferred) : ExtendsFalse();
7889
7949
  }
7890
7950
  function FromRecord(inferred, _leftKey, leftValue, _rightKey, rightValue) {
7891
7951
  return ExtendsLeft(inferred, leftValue, rightValue);
7892
7952
  }
7893
7953
  function ExtendsRecord(inferred, leftPattern, leftValue, right) {
7894
- return IsRecord(right) ? FromRecord(inferred, RecordPatternToType(leftPattern), leftValue, RecordPatternToType(RecordPattern(right)), RecordValue(right)) : IsObject2(right) ? FromObject3(inferred, right.properties) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
7954
+ return IsRecord(right) ? FromRecord(inferred, RecordPatternToType(leftPattern), leftValue, RecordPatternToType(RecordPattern(right)), RecordValue(right)) : IsObject2(right) ? FromObject2(inferred, right.properties) : IsAny(right) ? ExtendsTrue(inferred) : IsUnknown(right) ? ExtendsTrue(inferred) : ExtendsFalse();
7895
7955
  }
7896
7956
  var init_record2 = __esm(() => {
7897
7957
  init_guard2();
@@ -8449,6 +8509,7 @@ var init_evaluate3 = __esm(() => {
8449
8509
  init_flatten();
8450
8510
  init_instantiate5();
8451
8511
  init_narrow();
8512
+ init_property();
8452
8513
  });
8453
8514
 
8454
8515
  // node_modules/typebox/build/type/engine/call/distribute_arguments.mjs
@@ -8977,7 +9038,7 @@ function CollapseIntersectProperties(left, right) {
8977
9038
  const sharedKeys = Keys(left).filter((key) => HasPropertyKey(right, key));
8978
9039
  const leftProperties = leftKeys.reduce((result, key) => ({ ...result, [key]: left[key] }), {});
8979
9040
  const rightProperties = rightKeys.reduce((result, key) => ({ ...result, [key]: right[key] }), {});
8980
- const sharedProperties = sharedKeys.reduce((result, key) => ({ ...result, [key]: EvaluateIntersect([left[key], right[key]]) }), {});
9041
+ const sharedProperties = sharedKeys.reduce((result, key) => ({ ...result, [key]: EvaluatePropertyIntersect(left[key], right[key]) }), {});
8981
9042
  const unique = Assign(leftProperties, rightProperties);
8982
9043
  const shared = Assign(unique, sharedProperties);
8983
9044
  return shared;
@@ -8991,11 +9052,11 @@ var init_from_intersect = __esm(() => {
8991
9052
  init_memory2();
8992
9053
  init_guard2();
8993
9054
  init_from_type2();
8994
- init_evaluate2();
9055
+ init_property();
8995
9056
  });
8996
9057
 
8997
9058
  // node_modules/typebox/build/type/engine/object/from_object.mjs
8998
- function FromObject4(properties) {
9059
+ function FromObject3(properties) {
8999
9060
  return properties;
9000
9061
  }
9001
9062
 
@@ -9015,7 +9076,7 @@ var init_from_tuple = __esm(() => {
9015
9076
  function CollapseUnionProperties(left, right) {
9016
9077
  const sharedKeys = Keys(left).filter((key) => (key in right));
9017
9078
  const result = sharedKeys.reduce((result, key) => {
9018
- return { ...result, [key]: EvaluateUnion([left[key], right[key]]) };
9079
+ return { ...result, [key]: EvaluatePropertyUnion(left[key], right[key]) };
9019
9080
  }, {});
9020
9081
  return result;
9021
9082
  }
@@ -9028,13 +9089,13 @@ function FromUnion3(types) {
9028
9089
  var init_from_union2 = __esm(() => {
9029
9090
  init_guard2();
9030
9091
  init_unreachable();
9031
- init_evaluate2();
9092
+ init_property();
9032
9093
  init_from_type2();
9033
9094
  });
9034
9095
 
9035
9096
  // node_modules/typebox/build/type/engine/object/from_type.mjs
9036
9097
  function FromType8(type) {
9037
- return IsCyclic(type) ? FromCyclic(type.$defs, type.$ref) : IsDependent(type) ? FromDependent(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect(type.allOf) : IsUnion(type) ? FromUnion3(type.anyOf) : IsTuple(type) ? FromTuple(type.items) : IsObject2(type) ? FromObject4(type.properties) : {};
9098
+ return IsCyclic(type) ? FromCyclic(type.$defs, type.$ref) : IsDependent(type) ? FromDependent(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect(type.allOf) : IsUnion(type) ? FromUnion3(type.anyOf) : IsTuple(type) ? FromTuple(type.items) : IsObject2(type) ? FromObject3(type.properties) : {};
9038
9099
  }
9039
9100
  var init_from_type2 = __esm(() => {
9040
9101
  init_cyclic();
@@ -9072,7 +9133,7 @@ function ConvertToIntegerKey(value) {
9072
9133
  return integerKeyPattern.test(normal) ? parseInt(normal) : value;
9073
9134
  }
9074
9135
  var integerKeyPattern;
9075
- var init_keys = __esm(() => {
9136
+ var init_keys2 = __esm(() => {
9076
9137
  integerKeyPattern = new RegExp("^(?:0|[1-9][0-9]*)$");
9077
9138
  });
9078
9139
 
@@ -9086,7 +9147,7 @@ function NormalizeIndexerTypes(types) {
9086
9147
  function NormalizeIndexer(type) {
9087
9148
  return IsIntersect(type) ? Intersect(NormalizeIndexerTypes(type.allOf)) : IsUnion(type) ? Union(NormalizeIndexerTypes(type.anyOf)) : IsLiteral(type) ? NormalizeLiteral(type.const) : type;
9088
9149
  }
9089
- function FromArray3(type, indexer) {
9150
+ function FromArray2(type, indexer) {
9090
9151
  const normalizedIndexer = NormalizeIndexer(indexer);
9091
9152
  const check = Extends({}, normalizedIndexer, Number2());
9092
9153
  const result = IsExtendsTrueLike(check) ? type : IsLiteral(indexer) && IsEqual(indexer.const, "length") ? Number2() : Never();
@@ -9100,7 +9161,7 @@ var init_from_array = __esm(() => {
9100
9161
  init_number();
9101
9162
  init_never();
9102
9163
  init_extends3();
9103
- init_keys();
9164
+ init_keys2();
9104
9165
  });
9105
9166
 
9106
9167
  // node_modules/typebox/build/type/engine/indexable/from_cyclic.mjs
@@ -9253,7 +9314,7 @@ function FromIndexerNumber(properties) {
9253
9314
  const result = EvaluateUnion(variants);
9254
9315
  return result;
9255
9316
  }
9256
- function FromObject5(properties, indexer) {
9317
+ function FromObject4(properties, indexer) {
9257
9318
  const result = IsNumber3(indexer) ? FromIndexerNumber(properties) : FromIndexer(properties, indexer);
9258
9319
  return result;
9259
9320
  }
@@ -9283,7 +9344,7 @@ var init_array_indexer = __esm(() => {
9283
9344
  init_union();
9284
9345
  init_intersect();
9285
9346
  init_literal();
9286
- init_keys();
9347
+ init_keys2();
9287
9348
  });
9288
9349
 
9289
9350
  // node_modules/typebox/build/type/engine/indexed/from_tuple.mjs
@@ -9316,7 +9377,7 @@ var init_from_tuple2 = __esm(() => {
9316
9377
 
9317
9378
  // node_modules/typebox/build/type/engine/indexed/from_type.mjs
9318
9379
  function FromType11(type, indexer) {
9319
- return IsArray2(type) ? FromArray3(type.items, indexer) : IsObject2(type) ? FromObject5(type.properties, indexer) : IsTuple(type) ? FromTuple2(type.items, indexer) : Never();
9380
+ return IsArray2(type) ? FromArray2(type.items, indexer) : IsObject2(type) ? FromObject4(type.properties, indexer) : IsTuple(type) ? FromTuple2(type.items, indexer) : Never();
9320
9381
  }
9321
9382
  var init_from_type4 = __esm(() => {
9322
9383
  init_array();
@@ -9404,7 +9465,7 @@ var init_from_any = __esm(() => {
9404
9465
  });
9405
9466
 
9406
9467
  // node_modules/typebox/build/type/engine/keyof/from_array.mjs
9407
- function FromArray4(_type) {
9468
+ function FromArray3(_type) {
9408
9469
  return Number2();
9409
9470
  }
9410
9471
  var init_from_array2 = __esm(() => {
@@ -9418,7 +9479,7 @@ function FromPropertyKeys(keys) {
9418
9479
  }, []);
9419
9480
  return result;
9420
9481
  }
9421
- function FromObject6(properties) {
9482
+ function FromObject5(properties) {
9422
9483
  const propertyKeys = Keys(properties);
9423
9484
  const variants = FromPropertyKeys(propertyKeys);
9424
9485
  const result = EvaluateUnionFast(variants);
@@ -9428,7 +9489,7 @@ var init_from_object2 = __esm(() => {
9428
9489
  init_unreachable();
9429
9490
  init_guard2();
9430
9491
  init_literal();
9431
- init_keys();
9492
+ init_keys2();
9432
9493
  init_evaluate2();
9433
9494
  });
9434
9495
 
@@ -9452,7 +9513,7 @@ var init_from_tuple3 = __esm(() => {
9452
9513
 
9453
9514
  // node_modules/typebox/build/type/engine/keyof/from_type.mjs
9454
9515
  function FromType12(type) {
9455
- return IsAny(type) ? FromAny() : IsArray2(type) ? FromArray4(type.items) : IsObject2(type) ? FromObject6(type.properties) : IsRecord(type) ? FromRecord2(type) : IsTuple(type) ? FromTuple3(type.items) : Never();
9516
+ return IsAny(type) ? FromAny() : IsArray2(type) ? FromArray3(type.items) : IsObject2(type) ? FromObject5(type.properties) : IsRecord(type) ? FromRecord2(type) : IsTuple(type) ? FromTuple3(type.items) : Never();
9456
9517
  }
9457
9518
  var init_from_type5 = __esm(() => {
9458
9519
  init_any();
@@ -9814,7 +9875,7 @@ var init_from_union4 = __esm(() => {
9814
9875
  });
9815
9876
 
9816
9877
  // node_modules/typebox/build/type/engine/partial/from_object.mjs
9817
- function FromObject7(properties) {
9878
+ function FromObject6(properties) {
9818
9879
  const mapped = Keys(properties).reduce((result, left) => {
9819
9880
  return { ...result, [left]: AddOptional(properties[left]) };
9820
9881
  }, {});
@@ -9829,7 +9890,7 @@ var init_from_object3 = __esm(() => {
9829
9890
 
9830
9891
  // node_modules/typebox/build/type/engine/partial/from_type.mjs
9831
9892
  function FromType15(type) {
9832
- return IsCyclic(type) ? FromCyclic3(type.$defs, type.$ref) : IsDependent(type) ? FromDependent3(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion6(type.anyOf) : IsObject2(type) ? FromObject7(type.properties) : _Object_({});
9893
+ return IsCyclic(type) ? FromCyclic3(type.$defs, type.$ref) : IsDependent(type) ? FromDependent3(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion6(type.anyOf) : IsObject2(type) ? FromObject6(type.properties) : _Object_({});
9833
9894
  }
9834
9895
  var init_from_type7 = __esm(() => {
9835
9896
  init_cyclic();
@@ -9920,7 +9981,7 @@ var init_readonly_object = __esm(() => {
9920
9981
  });
9921
9982
 
9922
9983
  // node_modules/typebox/build/type/engine/readonly_object/from_array.mjs
9923
- function FromArray5(type) {
9984
+ function FromArray4(type) {
9924
9985
  const result = AddImmutable(_Array_(type));
9925
9986
  return result;
9926
9987
  }
@@ -9966,7 +10027,7 @@ var init_from_intersect4 = __esm(() => {
9966
10027
  });
9967
10028
 
9968
10029
  // node_modules/typebox/build/type/engine/readonly_object/from_object.mjs
9969
- function FromObject8(properties) {
10030
+ function FromObject7(properties) {
9970
10031
  const mapped = Keys(properties).reduce((result, left) => {
9971
10032
  return { ...result, [left]: AddReadonly(properties[left]) };
9972
10033
  }, {});
@@ -10001,7 +10062,7 @@ var init_from_union5 = __esm(() => {
10001
10062
 
10002
10063
  // node_modules/typebox/build/type/engine/readonly_object/from_type.mjs
10003
10064
  function FromType17(type) {
10004
- return IsArray2(type) ? FromArray5(type.items) : IsCyclic(type) ? FromCyclic4(type.$defs, type.$ref) : IsDependent(type) ? FromDependent4(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect4(type.allOf) : IsObject2(type) ? FromObject8(type.properties) : IsTuple(type) ? FromTuple4(type.items) : IsUnion(type) ? FromUnion7(type.anyOf) : type;
10065
+ return IsArray2(type) ? FromArray4(type.items) : IsCyclic(type) ? FromCyclic4(type.$defs, type.$ref) : IsDependent(type) ? FromDependent4(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect4(type.allOf) : IsObject2(type) ? FromObject7(type.properties) : IsTuple(type) ? FromTuple4(type.items) : IsUnion(type) ? FromUnion7(type.anyOf) : type;
10005
10066
  }
10006
10067
  var init_from_type9 = __esm(() => {
10007
10068
  init_array();
@@ -10091,8 +10152,17 @@ var init_from_union6 = __esm(() => {
10091
10152
  init_from_type10();
10092
10153
  });
10093
10154
 
10155
+ // node_modules/typebox/build/type/action/_remove_optional.mjs
10156
+ function RemoveOptional(type, options = {}) {
10157
+ return RemoveOptionalAction(type, options);
10158
+ }
10159
+ var init__remove_optional = __esm(() => {
10160
+ init_deferred();
10161
+ init_instantiate_remove();
10162
+ });
10163
+
10094
10164
  // node_modules/typebox/build/type/engine/required/from_object.mjs
10095
- function FromObject9(properties) {
10165
+ function FromObject8(properties) {
10096
10166
  const mapped = Keys(properties).reduce((result, left) => {
10097
10167
  return { ...result, [left]: RemoveOptional(properties[left]) };
10098
10168
  }, {});
@@ -10107,7 +10177,7 @@ var init_from_object5 = __esm(() => {
10107
10177
 
10108
10178
  // node_modules/typebox/build/type/engine/required/from_type.mjs
10109
10179
  function FromType18(type) {
10110
- return IsCyclic(type) ? FromCyclic5(type.$defs, type.$ref) : IsDependent(type) ? FromDependent5(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect5(type.allOf) : IsUnion(type) ? FromUnion8(type.anyOf) : IsObject2(type) ? FromObject9(type.properties) : _Object_({});
10180
+ return IsCyclic(type) ? FromCyclic5(type.$defs, type.$ref) : IsDependent(type) ? FromDependent5(type.if, type.then, type.else) : IsIntersect(type) ? FromIntersect5(type.allOf) : IsUnion(type) ? FromUnion8(type.anyOf) : IsObject2(type) ? FromObject8(type.properties) : _Object_({});
10111
10181
  }
10112
10182
  var init_from_type10 = __esm(() => {
10113
10183
  init_cyclic();
@@ -10289,9 +10359,9 @@ var init_instantiate27 = __esm(() => {
10289
10359
  init_instantiate_add3();
10290
10360
  init_instantiate_remove3();
10291
10361
  init_instantiate_add();
10292
- init_instantiate_remove();
10293
- init_instantiate_add2();
10294
10362
  init_instantiate_remove2();
10363
+ init_instantiate_add2();
10364
+ init_instantiate_remove();
10295
10365
  init__optional();
10296
10366
  init__immutable();
10297
10367
  init__readonly();
@@ -10327,11 +10397,8 @@ var init_instantiate27 = __esm(() => {
10327
10397
  });
10328
10398
 
10329
10399
  // node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs
10330
- function AddImmutableOperation(type) {
10331
- return Update(type, { "~immutable": true }, {});
10332
- }
10333
10400
  function AddImmutableAction(type, options) {
10334
- const result = Update(AddImmutableOperation(type), {}, options);
10401
+ const result = Update(type, { "~immutable": true }, options);
10335
10402
  return result;
10336
10403
  }
10337
10404
  function AddImmutableInstantiate(context, state, type, options) {
@@ -10358,6 +10425,12 @@ var init__remove_immutable = __esm(() => {
10358
10425
  init_instantiate_remove3();
10359
10426
  });
10360
10427
 
10428
+ // node_modules/typebox/build/type/action/_remove_readonly.mjs
10429
+ var init__remove_readonly = __esm(() => {
10430
+ init_deferred();
10431
+ init_instantiate_remove2();
10432
+ });
10433
+
10361
10434
  // node_modules/typebox/build/type/action/evaluate.mjs
10362
10435
  function Evaluate(type, options = {}) {
10363
10436
  return EvaluateAction(type, options);
@@ -10434,7 +10507,7 @@ var init_union3 = () => {};
10434
10507
  // node_modules/typebox/build/type/engine/helpers/index.mjs
10435
10508
  var init_helpers = __esm(() => {
10436
10509
  init_keys_to_indexer();
10437
- init_keys();
10510
+ init_keys2();
10438
10511
  init_union3();
10439
10512
  });
10440
10513
 
@@ -10720,14 +10793,14 @@ var init__refine2 = __esm(() => {
10720
10793
  });
10721
10794
 
10722
10795
  // node_modules/typebox/build/schema/types/schema.mjs
10723
- function IsSchemaObject2(value) {
10796
+ function IsSchemaObject(value) {
10724
10797
  return IsObject(value) && !IsArray(value);
10725
10798
  }
10726
10799
  function IsSchemaBoolean(value) {
10727
10800
  return IsBoolean(value);
10728
10801
  }
10729
10802
  function IsSchema2(value) {
10730
- return IsSchemaObject2(value) || IsSchemaBoolean(value);
10803
+ return IsSchemaObject(value) || IsSchemaBoolean(value);
10731
10804
  }
10732
10805
  var init_schema2 = __esm(() => {
10733
10806
  init_guard2();
@@ -11299,7 +11372,7 @@ function NextUri(ref, base) {
11299
11372
  return URL.canParse(ref, base) ? new URL(ref, base) : IsEqual(base, DefaultUri) ? new URL(`${base}:${ref}`) : new URL(`${base.slice(0, base.lastIndexOf(":"))}:${ref}`);
11300
11373
  }
11301
11374
  function Stack(context, schema) {
11302
- const base = IsSchemaObject2(schema) && IsId(schema) ? NextUri(schema.$id, DefaultUri).href : DefaultUri;
11375
+ const base = IsSchemaObject(schema) && IsId(schema) ? NextUri(schema.$id, DefaultUri).href : DefaultUri;
11303
11376
  return {
11304
11377
  context,
11305
11378
  schema,
@@ -11321,7 +11394,7 @@ function RegisterResourceAnchors(anchors, schema, isRoot = true) {
11321
11394
  return anchors;
11322
11395
  if (Array.isArray(schema))
11323
11396
  return schema.reduce((result, item) => RegisterResourceAnchors(result, item, false), anchors);
11324
- if (!IsSchemaObject2(schema))
11397
+ if (!IsSchemaObject(schema))
11325
11398
  return anchors;
11326
11399
  if (!isRoot && IsId(schema))
11327
11400
  return anchors;
@@ -11377,7 +11450,7 @@ function NextLexicalSchema(stack, schema) {
11377
11450
  return IsId(schema) ? schema : stack.lexicalSchema;
11378
11451
  }
11379
11452
  function HasStackKeywords(stack, schema) {
11380
- return IsSchemaObject2(schema) && (IsId(schema) || IsDynamicAnchor(schema) || IsUndefined(stack.recursiveAnchor) && IsRecursiveAnchorTrue(schema) || !IsUndefined(ResourceEntry(stack, schema)));
11453
+ return IsSchemaObject(schema) && (IsId(schema) || IsDynamicAnchor(schema) || IsUndefined(stack.recursiveAnchor) && IsRecursiveAnchorTrue(schema) || !IsUndefined(ResourceEntry(stack, schema)));
11381
11454
  }
11382
11455
  function NextStack(stack, schema) {
11383
11456
  return HasStackKeywords(stack, schema) ? {
@@ -11676,7 +11749,7 @@ var init_pointer2 = __esm(() => {
11676
11749
 
11677
11750
  // node_modules/typebox/build/schema/resolve/resolve.mjs
11678
11751
  function RelativeBase(schema, base) {
11679
- return IsSchemaObject2(schema) && IsId(schema) ? NextUri(schema.$id, base.href) : base;
11752
+ return IsSchemaObject(schema) && IsId(schema) ? NextUri(schema.$id, base.href) : base;
11680
11753
  }
11681
11754
  function AbsoluteBase(base) {
11682
11755
  return NextUri(base, DefaultUri);
@@ -11761,7 +11834,7 @@ function MatchWithDynamicAnchor(schema, base, ref) {
11761
11834
  return isMatch ? schema : undefined;
11762
11835
  }
11763
11836
  function MatchSchemaObject(schema, base, ref) {
11764
- if (!IsSchemaObject2(schema))
11837
+ if (!IsSchemaObject(schema))
11765
11838
  return;
11766
11839
  return MatchWithId(schema, base, ref) ?? MatchWithAnchor(schema, base, ref) ?? MatchWithDynamicAnchor(schema, base, ref) ?? MatchWithHash(schema, ref);
11767
11840
  }
@@ -11789,12 +11862,12 @@ function Match4(schema, base, ref) {
11789
11862
  }
11790
11863
  function Resource(context, schema, base, ref) {
11791
11864
  const result = RefInternal(context, schema, base, ref);
11792
- return IsSchemaObject2(result) && IsId(result) ? result : undefined;
11865
+ return IsSchemaObject(result) && IsId(result) ? result : undefined;
11793
11866
  }
11794
11867
  function FindDeferredResourceLegacy(stack, ref, schema) {
11795
11868
  if (!ref.$ref.startsWith("#"))
11796
11869
  return;
11797
- if (!IsSchemaObject2(stack.schema) || HasPropertyKey(stack.schema, "$schema"))
11870
+ if (!IsSchemaObject(stack.schema) || HasPropertyKey(stack.schema, "$schema"))
11798
11871
  return;
11799
11872
  const targetBase = Base(stack.lexicalSchema, stack.referenceBase, schema);
11800
11873
  if (IsUndefined(targetBase) || IsEqual(targetBase, stack.referenceBase))
@@ -11803,7 +11876,7 @@ function FindDeferredResourceLegacy(stack, ref, schema) {
11803
11876
  }
11804
11877
  function FindDeferredResourceModern(stack, canonical, schema) {
11805
11878
  const remoteRoot = stack.context[canonical];
11806
- if (!IsSchemaObject2(remoteRoot))
11879
+ if (!IsSchemaObject(remoteRoot))
11807
11880
  return;
11808
11881
  return { target: schema, base: canonical, root: remoteRoot };
11809
11882
  }
@@ -11865,10 +11938,10 @@ function RefResultNotFound(stack, schema) {
11865
11938
  }
11866
11939
  function Ref2(stack, ref) {
11867
11940
  const schema = RefInternal(stack.context, RefRoot(stack, ref), stack.referenceBase, ref.$ref);
11868
- return IsSchemaObject2(schema) ? RefResultFound(stack, ref, schema) : RefResultNotFound(stack, schema);
11941
+ return IsSchemaObject(schema) ? RefResultFound(stack, ref, schema) : RefResultNotFound(stack, schema);
11869
11942
  }
11870
11943
  function IsRecursiveAnchorInScope(stack) {
11871
- return IsSchemaObject2(stack.lexicalSchema) && IsRecursiveAnchorTrue(stack.lexicalSchema);
11944
+ return IsSchemaObject(stack.lexicalSchema) && IsRecursiveAnchorTrue(stack.lexicalSchema);
11872
11945
  }
11873
11946
  function RecursiveRef(stack, recursiveRef) {
11874
11947
  const schema = IsRecursiveAnchorInScope(stack) ? stack.recursiveAnchor : stack.lexicalSchema;
@@ -11881,7 +11954,7 @@ function FindScopedDynamicAnchor(stack, name) {
11881
11954
  return stack.dynamicAnchors.find((anchor) => IsEqual(anchor.$dynamicAnchor, name)) ?? SearchDynamicAnchor(stack.schema, name);
11882
11955
  }
11883
11956
  function DynamicRefWhenFound(stack, dynamicRef, fragmentTarget) {
11884
- if (!IsSchemaObject2(fragmentTarget) || !IsDynamicAnchor(fragmentTarget))
11957
+ if (!IsSchemaObject(fragmentTarget) || !IsDynamicAnchor(fragmentTarget))
11885
11958
  return fragmentTarget;
11886
11959
  const fragment = DynamicRefFragment(stack, dynamicRef);
11887
11960
  return IsPointerFragment(fragment) ? fragmentTarget : FindScopedDynamicAnchor(stack, fragmentTarget.$dynamicAnchor);
@@ -13525,7 +13598,7 @@ var init_type3 = __esm(() => {
13525
13598
  });
13526
13599
 
13527
13600
  // node_modules/typebox/build/value/clean/from_array.mjs
13528
- function FromArray6(context, type, value) {
13601
+ function FromArray5(context, type, value) {
13529
13602
  if (!IsArray(value))
13530
13603
  return value;
13531
13604
  return value.map((value) => FromType19(context, type.items, value));
@@ -13571,7 +13644,7 @@ var init_additional = __esm(() => {
13571
13644
  });
13572
13645
 
13573
13646
  // node_modules/typebox/build/value/clean/from_object.mjs
13574
- function FromObject10(context, type, value) {
13647
+ function FromObject9(context, type, value) {
13575
13648
  if (!IsObject(value) || IsArray(value))
13576
13649
  return value;
13577
13650
  const additionalProperties = GetAdditionalProperties(type);
@@ -13649,12 +13722,74 @@ var init_from_tuple5 = __esm(() => {
13649
13722
  init_from_type11();
13650
13723
  });
13651
13724
 
13725
+ // node_modules/typebox/build/system/memory/deep.mjs
13726
+ function FromClassInstance(value) {
13727
+ return value;
13728
+ }
13729
+ function IsSchemaObject2(value) {
13730
+ return HasPropertyKey(value, "~kind") || HasPropertyKey(value, "~unsafe");
13731
+ }
13732
+ function FromSchemaObject(value) {
13733
+ const result = {};
13734
+ for (const key of Keys(value)) {
13735
+ if (IsUnsafePropertyKey(key))
13736
+ continue;
13737
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
13738
+ descriptor.value = FromValue2(descriptor.value);
13739
+ if (IsEqual(descriptor.enumerable, true)) {
13740
+ result[key] = descriptor.value;
13741
+ } else {
13742
+ Object.defineProperty(result, key, descriptor);
13743
+ }
13744
+ }
13745
+ return result;
13746
+ }
13747
+ function FromPlainObject(value) {
13748
+ const result = {};
13749
+ for (const key of Keys(value)) {
13750
+ if (IsUnsafePropertyKey(key))
13751
+ continue;
13752
+ result[key] = FromValue2(value[key]);
13753
+ }
13754
+ for (const key of Symbols(value)) {
13755
+ result[key] = FromValue2(value[key]);
13756
+ }
13757
+ return result;
13758
+ }
13759
+ function FromObject10(value) {
13760
+ return IsClassInstance(value) ? FromClassInstance(value) : IsSchemaObject2(value) ? FromSchemaObject(value) : FromPlainObject(value);
13761
+ }
13762
+ function FromArray6(value) {
13763
+ return value.map((element) => FromValue2(element));
13764
+ }
13765
+ function FromTypedArray(value) {
13766
+ return value.slice();
13767
+ }
13768
+ function FromRegExp2(value) {
13769
+ return new RegExp(value.source, value.flags);
13770
+ }
13771
+ function FromMap(value) {
13772
+ return new Map(FromValue2([...value.entries()]));
13773
+ }
13774
+ function FromSet(value) {
13775
+ return new Set(FromValue2([...value.values()]));
13776
+ }
13777
+ function FromValue2(value) {
13778
+ return IsTypeArray(value) ? FromTypedArray(value) : IsRegExp(value) ? FromRegExp2(value) : IsMap(value) ? FromMap(value) : IsSet(value) ? FromSet(value) : IsArray(value) ? FromArray6(value) : IsObject(value) ? FromObject10(value) : value;
13779
+ }
13780
+ function Deep(value) {
13781
+ return FromValue2(value);
13782
+ }
13783
+ var init_deep = __esm(() => {
13784
+ init_guard2();
13785
+ });
13786
+
13652
13787
  // node_modules/typebox/build/value/clone/clone.mjs
13653
- function Clone2(value) {
13654
- return Clone(value);
13788
+ function Clone(value) {
13789
+ return Deep(value);
13655
13790
  }
13656
13791
  var init_clone2 = __esm(() => {
13657
- init_clone();
13792
+ init_deep();
13658
13793
  });
13659
13794
 
13660
13795
  // node_modules/typebox/build/value/clone/index.mjs
@@ -13665,7 +13800,7 @@ var init_clone3 = __esm(() => {
13665
13800
  // node_modules/typebox/build/value/clean/from_union.mjs
13666
13801
  function FromUnion9(context, type, value) {
13667
13802
  for (const schema of type.anyOf) {
13668
- const clean = FromType19(context, schema, Clone2(value));
13803
+ const clean = FromType19(context, schema, Clone(value));
13669
13804
  if (Check2(context, schema, clean))
13670
13805
  return clean;
13671
13806
  }
@@ -13679,7 +13814,7 @@ var init_from_union7 = __esm(() => {
13679
13814
 
13680
13815
  // node_modules/typebox/build/value/clean/from_type.mjs
13681
13816
  function FromType19(context, type, value) {
13682
- return IsArray2(type) ? FromArray6(context, type, value) : IsCyclic(type) ? FromCyclic6(context, type, value) : IsIntersect(type) ? FromIntersect6(context, type, value) : IsObject2(type) ? FromObject10(context, type, value) : IsRecord(type) ? FromRecord3(context, type, value) : IsRef(type) ? FromRef5(context, type, value) : IsTuple(type) ? FromTuple5(context, type, value) : IsUnion(type) ? FromUnion9(context, type, value) : value;
13817
+ return IsArray2(type) ? FromArray5(context, type, value) : IsCyclic(type) ? FromCyclic6(context, type, value) : IsIntersect(type) ? FromIntersect6(context, type, value) : IsObject2(type) ? FromObject9(context, type, value) : IsRecord(type) ? FromRecord3(context, type, value) : IsRef(type) ? FromRef5(context, type, value) : IsTuple(type) ? FromTuple5(context, type, value) : IsUnion(type) ? FromUnion9(context, type, value) : value;
13683
13818
  }
13684
13819
  var init_from_type11 = __esm(() => {
13685
13820
  init_type3();
@@ -13695,12 +13830,7 @@ var init_from_type11 = __esm(() => {
13695
13830
 
13696
13831
  // node_modules/typebox/build/value/shared/union_priority_sort.mjs
13697
13832
  function Modifiers(type, next) {
13698
- for (const key of Keys(type)) {
13699
- if (HasPropertyKey(next, key))
13700
- continue;
13701
- next[key] = type[key];
13702
- }
13703
- return next;
13833
+ return Assign(type, next);
13704
13834
  }
13705
13835
  function FromProperties4(properties) {
13706
13836
  const result = {};
@@ -13727,6 +13857,7 @@ function UnionPrioritySort(type) {
13727
13857
  }
13728
13858
  var init_union_priority_sort = __esm(() => {
13729
13859
  init_guard2();
13860
+ init_memory2();
13730
13861
  init_type3();
13731
13862
  init_type3();
13732
13863
  init_type3();
@@ -14171,7 +14302,7 @@ function FromUnion10(context, type, value) {
14171
14302
  const matched = type.anyOf.some((type) => Check2(context, type, value));
14172
14303
  if (matched)
14173
14304
  return value;
14174
- const candidates = type.anyOf.map((type) => FromType21(context, type, Clone2(value)));
14305
+ const candidates = type.anyOf.map((type) => FromType21(context, type, Clone(value)));
14175
14306
  const selected = candidates.find((value) => Check2(context, type, value));
14176
14307
  return IsUndefined(selected) ? value : selected;
14177
14308
  }
@@ -14263,7 +14394,7 @@ var init_from_cyclic8 = __esm(() => {
14263
14394
  function FromDefault(type, value) {
14264
14395
  if (!IsUndefined(value))
14265
14396
  return value;
14266
- return IsFunction(type.default) ? type.default() : Clone2(type.default);
14397
+ return IsFunction(type.default) ? type.default() : Clone(type.default);
14267
14398
  }
14268
14399
  var init_from_default = __esm(() => {
14269
14400
  init_guard2();
@@ -14363,7 +14494,7 @@ var init_from_tuple7 = __esm(() => {
14363
14494
  // node_modules/typebox/build/value/default/from_union.mjs
14364
14495
  function FromUnion11(context, schema, value) {
14365
14496
  for (const inner of schema.anyOf) {
14366
- const result = FromType22(context, inner, Clone2(value));
14497
+ const result = FromType22(context, inner, Clone(value));
14367
14498
  if (Check2(context, inner, result)) {
14368
14499
  return result;
14369
14500
  }
@@ -14500,7 +14631,7 @@ function NonMatchingInterior(value, interiors) {
14500
14631
  function Decode5(direction, context, type, value) {
14501
14632
  if (IsEqual(type.allOf.length, 0))
14502
14633
  return Callback(direction, context, type, value);
14503
- const interiors = type.allOf.map((schema) => FromType23(direction, context, schema, Clean(schema, Clone2(value))));
14634
+ const interiors = type.allOf.map((schema) => FromType23(direction, context, schema, Clean(schema, Clone(value))));
14504
14635
  const structural = interiors.every((result) => IsObject(result));
14505
14636
  const exterior = structural ? MergeInteriors(interiors) : NonMatchingInterior(value, interiors);
14506
14637
  return Callback(direction, context, type, exterior);
@@ -14509,7 +14640,7 @@ function Encode5(direction, context, type, value) {
14509
14640
  if (IsEqual(type.allOf.length, 0))
14510
14641
  return Callback(direction, context, type, value);
14511
14642
  const exterior = Callback(direction, context, type, value);
14512
- const interiors = type.allOf.map((schema) => FromType23(direction, context, schema, Clean(schema, Clone2(exterior))));
14643
+ const interiors = type.allOf.map((schema) => FromType23(direction, context, schema, Clean(schema, Clone(exterior))));
14513
14644
  const structural = interiors.every((result) => IsObject(result));
14514
14645
  if (structural)
14515
14646
  return MergeInteriors(interiors);
@@ -14645,7 +14776,7 @@ function Decode9(direction, context, type, value) {
14645
14776
  function Encode9(direction, context, type, value) {
14646
14777
  const exterior = Callback(direction, context, type, value);
14647
14778
  for (const schema of type.anyOf) {
14648
- const variant = FromType23(direction, context, schema, Clone2(exterior));
14779
+ const variant = FromType23(direction, context, schema, Clone(exterior));
14649
14780
  if (!Check2(context, schema, variant))
14650
14781
  continue;
14651
14782
  return variant;
@@ -14709,7 +14840,7 @@ var init_decode2 = __esm(() => {
14709
14840
  }
14710
14841
  };
14711
14842
  Decoder = Pipeline([
14712
- (_context, _type, value) => Clone2(value),
14843
+ (_context, _type, value) => Clone(value),
14713
14844
  (context, type, value) => Default(context, type, value),
14714
14845
  (context, type, value) => Convert(context, type, value),
14715
14846
  (context, type, value) => Clean(context, type, value),
@@ -14747,7 +14878,7 @@ var init_encode2 = __esm(() => {
14747
14878
  }
14748
14879
  };
14749
14880
  Encoder = Pipeline([
14750
- (_context, _type, value) => Clone2(value),
14881
+ (_context, _type, value) => Clone(value),
14751
14882
  (context, type, value) => EncodeUnsafe(context, type, value),
14752
14883
  (context, type, value) => Default(context, type, value),
14753
14884
  (context, type, value) => Convert(context, type, value),
@@ -14966,7 +15097,7 @@ var init_parse2 = __esm(() => {
14966
15097
  }
14967
15098
  };
14968
15099
  Parser = Pipeline([
14969
- (_context, _type, value) => Clone2(value),
15100
+ (_context, _type, value) => Clone(value),
14970
15101
  (context, type, value) => Default(context, type, value),
14971
15102
  (context, type, value) => Convert(context, type, value),
14972
15103
  (context, type, value) => Clean(context, type, value),
@@ -16760,7 +16891,7 @@ async function applyDiagnosticFix(fix, options = {}) {
16760
16891
  throw new Error("Command mode fix requires an explicit property and policy value");
16761
16892
  }
16762
16893
  const object = decoratorObject(findClass(source, fix.command), "Command");
16763
- const current = property(object, fix.property);
16894
+ const current = property2(object, fix.property);
16764
16895
  if (!current || current.initializer.getText(source) !== fix.expectedExpression) {
16765
16896
  throw new Error("Command mode changed since diagnosis; analyze the project again");
16766
16897
  }
@@ -16774,7 +16905,7 @@ async function applyDiagnosticFix(fix, options = {}) {
16774
16905
  const withImport = importSymbol(source, fix.importPath, fix.symbol);
16775
16906
  source = parse5(file, withImport);
16776
16907
  const object = unique(moduleObjects(source).filter((candidate) => !fix.targetModule || stringProperty(candidate, "name") === fix.targetModule), "target module");
16777
- const imports = property(object, "imports");
16908
+ const imports = property2(object, "imports");
16778
16909
  if (imports && !ts13.isArrayLiteralExpression(imports.initializer)) {
16779
16910
  throw new Error("Module imports must be a static array");
16780
16911
  }
@@ -16794,7 +16925,7 @@ async function applyDiagnosticFix(fix, options = {}) {
16794
16925
  }
16795
16926
  const command = findClass(source, fix.command);
16796
16927
  const object = decoratorObject(command, "Command");
16797
- const current = property(object, "permission");
16928
+ const current = property2(object, "permission");
16798
16929
  if (current && (!ts13.isStringLiteral(current.initializer) || current.initializer.text !== permission)) {
16799
16930
  throw new Error("Command permission already exists with a different value");
16800
16931
  }
@@ -16864,7 +16995,7 @@ function nameOf(name) {
16864
16995
  return "";
16865
16996
  return ts13.isIdentifier(name) || ts13.isStringLiteral(name) || ts13.isNumericLiteral(name) ? name.text : "";
16866
16997
  }
16867
- function property(object, key) {
16998
+ function property2(object, key) {
16868
16999
  if (object.properties.some((item) => !ts13.isPropertyAssignment(item) || ts13.isComputedPropertyName(item.name))) {
16869
17000
  throw new Error("Fix requires explicit static object properties");
16870
17001
  }
@@ -16874,11 +17005,11 @@ function property(object, key) {
16874
17005
  return values[0];
16875
17006
  }
16876
17007
  function stringProperty(object, key) {
16877
- const value = property(object, key)?.initializer;
17008
+ const value = property2(object, key)?.initializer;
16878
17009
  return value && ts13.isStringLiteral(value) ? value.text : undefined;
16879
17010
  }
16880
17011
  function replaceProperty(source, object, key, value) {
16881
- const previous = property(object, key);
17012
+ const previous = property2(object, key);
16882
17013
  const replacement = ts13.factory.createPropertyAssignment(key, value);
16883
17014
  const properties = object.properties.map((item) => item === previous ? replacement : item);
16884
17015
  if (!previous)
@@ -19588,10 +19719,12 @@ function parseModule(candidate, nameByNode, ctx) {
19588
19719
  if (queryDec) {
19589
19720
  const meta = decoratorObjectArg(queryDec);
19590
19721
  if (meta) {
19722
+ const permission = stringLiteralProp(meta, "permission");
19591
19723
  const tenantScope = commandModeProp(meta, "tenantScope");
19592
19724
  queries.push({
19593
19725
  className: cls.name?.text ?? "<anonymous>",
19594
19726
  name: stringLiteralProp(meta, "name") ?? cls.name?.text ?? "<anonymous>",
19727
+ ...permission === undefined ? {} : { permission },
19595
19728
  ...tenantScope === undefined ? {} : { tenantScope }
19596
19729
  });
19597
19730
  }
@@ -19652,11 +19785,23 @@ function parseFeatureSpec(input, ctx, seen = new Set) {
19652
19785
  if (databaseExpr !== undefined && database === undefined)
19653
19786
  return invalid();
19654
19787
  const tenantField = stringLiteralProp(input, "tenantField");
19788
+ const readPermission = stringLiteralProp(input, "readPermission");
19789
+ const requiredAdaptersExpr = getProp(input, "requiredAdapters");
19790
+ const requiredAdapterScopesExpr = getProp(input, "requiredAdapterScopes");
19655
19791
  const statesExpr = getProp(input, "states");
19656
19792
  const transitionObject = getProp(input, "transitions");
19657
19793
  if (!name || !statesExpr || !ts7.isArrayLiteralExpression(statesExpr) || statesExpr.elements.some((state) => !ts7.isStringLiteral(state)) || !transitionObject || !ts7.isObjectLiteralExpression(transitionObject) || input.properties.some((property) => !ts7.isPropertyAssignment(property))) {
19658
19794
  return invalid();
19659
19795
  }
19796
+ const requiredAdapters = requiredAdaptersExpr === undefined ? undefined : ts7.isArrayLiteralExpression(requiredAdaptersExpr) && requiredAdaptersExpr.elements.every((element) => ts7.isStringLiteral(element) && element.text.trim().length > 0) ? requiredAdaptersExpr.elements.map((element) => element.text) : undefined;
19797
+ if (requiredAdaptersExpr !== undefined && requiredAdapters === undefined)
19798
+ return invalid();
19799
+ const requiredAdapterScopes = requiredAdapterScopesExpr === undefined ? undefined : ts7.isObjectLiteralExpression(requiredAdapterScopesExpr) && requiredAdapterScopesExpr.properties.every((property) => ts7.isPropertyAssignment(property) && !ts7.isComputedPropertyName(property.name) && ts7.isStringLiteral(property.initializer) && isScope(property.initializer.text)) ? Object.fromEntries(requiredAdapterScopesExpr.properties.map((property) => [
19800
+ propertyName(property.name),
19801
+ property.initializer.getText().slice(1, -1)
19802
+ ])) : undefined;
19803
+ if (requiredAdapterScopesExpr !== undefined && requiredAdapterScopes === undefined)
19804
+ return invalid();
19660
19805
  const states = [];
19661
19806
  for (const state of statesExpr.elements) {
19662
19807
  if (!ts7.isStringLiteral(state))
@@ -19712,6 +19857,9 @@ function parseFeatureSpec(input, ctx, seen = new Set) {
19712
19857
  states,
19713
19858
  ...database === undefined ? {} : { database },
19714
19859
  ...tenantField === undefined ? {} : { tenantField },
19860
+ ...readPermission === undefined ? {} : { readPermission },
19861
+ ...requiredAdapters === undefined ? {} : { requiredAdapters },
19862
+ ...requiredAdapterScopes === undefined ? {} : { requiredAdapterScopes },
19715
19863
  transitions,
19716
19864
  file: sourcePath(ctx.rootDir, input.getSourceFile().fileName),
19717
19865
  line: lineOf(input)
@@ -20648,6 +20796,9 @@ function parseController(input, ctx) {
20648
20796
  const optionsArg = args[1];
20649
20797
  const optionsObject = resolveStaticObjectLiteral(optionsArg, ctx);
20650
20798
  if (optionsObject) {
20799
+ const permission = stringLiteralProp(optionsObject, "permission");
20800
+ if (permission !== undefined)
20801
+ route.permission = permission;
20651
20802
  const parsePolicy = routePolicyProperty(optionsObject, "parse", ctx);
20652
20803
  const deletePolicy = routePolicyProperty(optionsObject, "allowDeleteBody", ctx);
20653
20804
  const idempotency = checkedRouteIdempotency(optionsObject, ctx, route.handler);
@@ -25006,10 +25157,10 @@ import { readFileSync as readFileSync4 } from "node:fs";
25006
25157
  import { resolve as resolve18 } from "node:path";
25007
25158
 
25008
25159
  // src/migration-app-version.ts
25009
- var MIGRATION_APP_VERSION = "0.31.1";
25160
+ var MIGRATION_APP_VERSION = "0.33.0";
25010
25161
 
25011
25162
  // src/migration-elysia-version.ts
25012
- var MIGRATION_ELYSIA_VERSION = "0.35.2";
25163
+ var MIGRATION_ELYSIA_VERSION = "0.36.1";
25013
25164
 
25014
25165
  // src/migration-policy.ts
25015
25166
  var cachedCompilerVersion;
@@ -25028,7 +25179,7 @@ function migrationDependencies() {
25028
25179
  "@supacloud/app": MIGRATION_APP_VERSION,
25029
25180
  "@supacloud/compiler": compilerVersion(),
25030
25181
  "@supacloud/elysia": MIGRATION_ELYSIA_VERSION,
25031
- elysia: "2.0.0-beta.32",
25182
+ elysia: "2.0.0-rc.0",
25032
25183
  typescript: "7.0.2"
25033
25184
  };
25034
25185
  }