@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/index.js CHANGED
@@ -269,6 +269,16 @@ function validateFeatureSpec(spec, module) {
269
269
  if (spec.tenantField !== undefined && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(spec.tenantField)) {
270
270
  error("feature-tenant-boundary-invalid", `Feature ${spec.name} declares an unsafe tenant field.`);
271
271
  }
272
+ if (spec.requiredAdapters !== undefined) {
273
+ 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) {
274
+ error("feature-adapter-requirements-invalid", `Feature ${spec.name} must declare unique, non-empty adapter token identifiers.`);
275
+ }
276
+ }
277
+ if (spec.requiredAdapterScopes !== undefined) {
278
+ if (spec.requiredAdapters === undefined || Object.keys(spec.requiredAdapterScopes).some((token) => !spec.requiredAdapters?.includes(token))) {
279
+ error("feature-adapter-requirements-invalid", `Feature ${spec.name} must scope only declared required adapters.`);
280
+ }
281
+ }
272
282
  const databaseTransition = spec.transitions.some((transition) => transition.persistence?.boundary === "database");
273
283
  if (databaseTransition && spec.database === undefined && spec.file !== undefined) {
274
284
  error("feature-database-source-required", `Database Feature ${spec.name} must declare its database source, table and rowType.`);
@@ -285,6 +295,19 @@ function validateFeatureSpec(spec, module) {
285
295
  }
286
296
  }
287
297
  const names = new Set;
298
+ if (module && spec.requiredAdapters !== undefined) {
299
+ for (const token of spec.requiredAdapters) {
300
+ const provider = module.providers.find((candidate) => candidate.token === token || candidate.useClass === token);
301
+ if (!provider) {
302
+ error("feature-adapter-unresolved", `Feature ${spec.name} requires adapter ${token}, but module ${module.name} does not register a provider for it.`);
303
+ } else {
304
+ const expectedScope = spec.requiredAdapterScopes?.[token];
305
+ if (expectedScope !== undefined && provider.scope !== expectedScope) {
306
+ 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.`);
307
+ }
308
+ }
309
+ }
310
+ }
288
311
  for (const transition of spec.transitions) {
289
312
  if (!transition.name.trim() || names.has(transition.name)) {
290
313
  error("duplicate-feature-transition", `Feature ${spec.name} has duplicate/empty transition '${transition.name}'.`);
@@ -324,11 +347,20 @@ function validateFeatureSpec(spec, module) {
324
347
  }
325
348
  if (!module)
326
349
  continue;
327
- if (transition.persistence?.boundary === "database") {
350
+ if (transition.persistence !== undefined) {
328
351
  for (const query of module.queries) {
352
+ const queryProvider = module.providers.find((provider) => provider.token === query.className || provider.useClass === query.className);
353
+ if (!queryProvider) {
354
+ error("feature-query-provider-unresolved", `Feature query ${query.className} is not registered as a runtime provider in module ${module.name}.`);
355
+ } else if (queryProvider.scope !== "request") {
356
+ error("feature-query-provider-scope", `Feature query ${query.className} must use request scope, but module ${module.name} registers it with ${queryProvider.scope} scope.`);
357
+ }
329
358
  if (query.tenantScope !== "required") {
330
359
  error("feature-query-tenant-boundary", `Query ${query.className} in Feature ${spec.name} must declare tenantScope: "required".`);
331
360
  }
361
+ if (spec.readPermission !== undefined && query.permission !== spec.readPermission) {
362
+ error("feature-query-permission", `Query ${query.className} in Feature ${spec.name} must declare read permission '${spec.readPermission}'.`);
363
+ }
332
364
  }
333
365
  for (const job of module.jobs ?? []) {
334
366
  if (job.tenantScope !== "required") {
@@ -345,6 +377,12 @@ function validateFeatureSpec(spec, module) {
345
377
  error("feature-command-unresolved", `Transition ${transition.name} declares governance without a command binding.`);
346
378
  }
347
379
  if (command) {
380
+ const commandProvider = module.providers.find((provider) => provider.token === command.className || provider.useClass === command.className);
381
+ if (!commandProvider) {
382
+ 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}.`);
383
+ } else if (commandProvider.scope !== "request") {
384
+ error("feature-command-provider-scope", `Feature command ${command.className} must use request scope, but module ${module.name} registers it with ${commandProvider.scope} scope.`);
385
+ }
348
386
  for (const key of ["permission", "transaction", "idempotency", "audit"]) {
349
387
  if (transition[key] !== undefined && transition[key] !== command[key]) {
350
388
  error("feature-governance-drift", `Transition ${transition.name} ${key} differs from command ${command.className}.`);
@@ -371,6 +409,12 @@ function validateFeatureSpec(spec, module) {
371
409
  error("feature-job-unresolved", `Transition ${transition.name} must reference exactly one Job in module ${module.name}.`);
372
410
  } else {
373
411
  const job = jobs[0];
412
+ const jobProvider = module.providers.find((provider) => provider.token === job.className || provider.useClass === job.className);
413
+ if (!jobProvider) {
414
+ 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}.`);
415
+ } else if (jobProvider.scope !== "job") {
416
+ error("feature-job-provider-scope", `Feature Job ${job.className} must use job scope, but module ${module.name} registers it with ${jobProvider.scope} scope.`);
417
+ }
374
418
  if (job.tenantScope !== "required") {
375
419
  error("feature-job-tenant-boundary", `Job ${job.className} in Feature ${spec.name} must declare tenantScope: "required".`);
376
420
  }
@@ -1447,6 +1491,11 @@ var init_validate = __esm(() => {
1447
1491
  "duplicate-feature-transition": { code: "SC6102", docsUrl: "https://supacloud.dev/errors/SC6102" },
1448
1492
  "invalid-feature-transition": { code: "SC6103", docsUrl: "https://supacloud.dev/errors/SC6103" },
1449
1493
  "feature-command-unresolved": { code: "SC6104", docsUrl: "https://supacloud.dev/errors/SC6104" },
1494
+ "feature-command-provider-unresolved": { code: "SC6128", docsUrl: "https://supacloud.dev/errors/SC6128" },
1495
+ "feature-command-provider-scope": { code: "SC6134", docsUrl: "https://supacloud.dev/errors/SC6134" },
1496
+ "feature-adapter-unresolved": { code: "SC6135", docsUrl: "https://supacloud.dev/errors/SC6135" },
1497
+ "feature-adapter-requirements-invalid": { code: "SC6136", docsUrl: "https://supacloud.dev/errors/SC6136" },
1498
+ "feature-adapter-provider-scope": { code: "SC6137", docsUrl: "https://supacloud.dev/errors/SC6137" },
1450
1499
  "feature-governance-drift": { code: "SC6105", docsUrl: "https://supacloud.dev/errors/SC6105" },
1451
1500
  "feature-persistence-invalid": { code: "SC6110", docsUrl: "https://supacloud.dev/errors/SC6110" },
1452
1501
  "feature-persistence-drift": { code: "SC6111", docsUrl: "https://supacloud.dev/errors/SC6111" },
@@ -1454,9 +1503,14 @@ var init_validate = __esm(() => {
1454
1503
  "feature-tenant-boundary-invalid": { code: "SC6112", docsUrl: "https://supacloud.dev/errors/SC6112" },
1455
1504
  "feature-tenant-boundary-drift": { code: "SC6127", docsUrl: "https://supacloud.dev/errors/SC6127" },
1456
1505
  "feature-query-tenant-boundary": { code: "SC6114", docsUrl: "https://supacloud.dev/errors/SC6114" },
1506
+ "feature-query-provider-unresolved": { code: "SC6130", docsUrl: "https://supacloud.dev/errors/SC6130" },
1507
+ "feature-query-provider-scope": { code: "SC6131", docsUrl: "https://supacloud.dev/errors/SC6131" },
1508
+ "feature-query-permission": { code: "SC6138", docsUrl: "https://supacloud.dev/errors/SC6138" },
1457
1509
  "feature-job-tenant-boundary": { code: "SC6115", docsUrl: "https://supacloud.dev/errors/SC6115" },
1458
1510
  "feature-command-tenant-boundary": { code: "SC6116", docsUrl: "https://supacloud.dev/errors/SC6116" },
1459
1511
  "feature-job-unresolved": { code: "SC6117", docsUrl: "https://supacloud.dev/errors/SC6117" },
1512
+ "feature-job-provider-unresolved": { code: "SC6129", docsUrl: "https://supacloud.dev/errors/SC6129" },
1513
+ "feature-job-provider-scope": { code: "SC6132", docsUrl: "https://supacloud.dev/errors/SC6132" },
1460
1514
  "feature-job-idempotency": { code: "SC6118", docsUrl: "https://supacloud.dev/errors/SC6118" },
1461
1515
  "feature-job-mode": { code: "SC6119", docsUrl: "https://supacloud.dev/errors/SC6119" },
1462
1516
  "feature-job-contract": { code: "SC6120", docsUrl: "https://supacloud.dev/errors/SC6120" },
@@ -1521,10 +1575,13 @@ function buildContractManifest(graph, artifacts) {
1521
1575
  });
1522
1576
  }
1523
1577
  for (const query of module.queries) {
1578
+ if (query.permission)
1579
+ permissions.add(query.permission);
1524
1580
  queries.push({
1525
1581
  name: query.name,
1526
1582
  className: query.className,
1527
1583
  module: module.name,
1584
+ ...query.permission === undefined ? {} : { permission: query.permission },
1528
1585
  ...query.tenantScope === undefined ? {} : { tenantScope: query.tenantScope }
1529
1586
  });
1530
1587
  }
@@ -1548,6 +1605,7 @@ function buildContractManifest(graph, artifacts) {
1548
1605
  states: [...module.featureSpec.states],
1549
1606
  ...module.featureSpec.database === undefined ? {} : { database: module.featureSpec.database },
1550
1607
  ...module.featureSpec.tenantField === undefined ? {} : { tenantField: module.featureSpec.tenantField },
1608
+ ...module.featureSpec.readPermission === undefined ? {} : { readPermission: module.featureSpec.readPermission },
1551
1609
  transitions: module.featureSpec.transitions.map((transition) => {
1552
1610
  const job = transition.job === undefined ? undefined : (module.jobs ?? []).find((candidate) => candidate.className === transition.job || candidate.name === transition.job);
1553
1611
  return {
@@ -1589,8 +1647,9 @@ function buildContractManifest(graph, artifacts) {
1589
1647
  const governedCommand = command ?? featureCommand;
1590
1648
  const effectiveCommand = route.command ?? featureTransition?.command;
1591
1649
  const idempotency = route.idempotency ?? command?.idempotency ?? featureTransition?.idempotency;
1592
- if (governedCommand?.permission)
1593
- permissions.add(governedCommand.permission);
1650
+ const permission = route.permission ?? governedCommand?.permission ?? featureTransition?.permission;
1651
+ if (permission)
1652
+ permissions.add(permission);
1594
1653
  if (route.contract?.evidence)
1595
1654
  fixtures.add(route.contract.evidence);
1596
1655
  routes.push({
@@ -1600,7 +1659,7 @@ function buildContractManifest(graph, artifacts) {
1600
1659
  controller: controller.className,
1601
1660
  handler: route.handler,
1602
1661
  ...effectiveCommand === undefined ? {} : { command: effectiveCommand },
1603
- ...governedCommand?.permission === undefined ? {} : { permission: governedCommand.permission },
1662
+ ...permission === undefined ? {} : { permission },
1604
1663
  ...idempotency === undefined ? {} : { idempotency },
1605
1664
  ...route.tags === undefined ? {} : { tags: [...route.tags] },
1606
1665
  requestSchemas: Object.fromEntries(["body", "params", "query", "headers", "cookie"].flatMap((key) => route[key] === undefined ? [] : [[key, route[key]]])),
@@ -2662,6 +2721,7 @@ function renderClient(graph, options) {
2662
2721
  const featureTransition = featureTransitionForRoute(module, controller, route);
2663
2722
  const featureCommand = featureTransition?.command === undefined ? undefined : commandByClassName.get(featureTransition.command);
2664
2723
  const governedCommand = command ?? featureCommand;
2724
+ const routePermission = route.permission ?? governedCommand?.permission ?? featureTransition?.permission;
2665
2725
  const idempotencyMode = route.idempotency ?? command?.idempotency ?? featureTransition?.idempotency ?? "none";
2666
2726
  const transitionRoute = `${route.method} ${fullPath}`;
2667
2727
  const invalidationTags = featureInvalidationTags.get(`${module.name}:${transitionRoute}`);
@@ -2688,6 +2748,7 @@ function renderClient(graph, options) {
2688
2748
  ["parse", route.parse],
2689
2749
  ["allowDeleteBody", route.allowDeleteBody],
2690
2750
  ["idempotency", idempotencyMode === "none" ? undefined : idempotencyMode],
2751
+ ["permission", routePermission],
2691
2752
  ["tags", route.tags],
2692
2753
  ["invalidateTags", invalidationTags]
2693
2754
  ]) {
@@ -2729,6 +2790,7 @@ function renderClient(graph, options) {
2729
2790
  path: fullPath,
2730
2791
  controller: controller.className,
2731
2792
  handler: route.handler,
2793
+ ...routePermission === undefined ? {} : { permission: routePermission },
2732
2794
  kind: procedureKind,
2733
2795
  idempotency: idempotencyMode,
2734
2796
  ...route.tags === undefined ? {} : { tags: route.tags },
@@ -2741,7 +2803,7 @@ function renderClient(graph, options) {
2741
2803
  handler: route.handler,
2742
2804
  kind: procedureKind,
2743
2805
  ...governedCommand?.name === undefined ? {} : { command: governedCommand.name },
2744
- ...governedCommand?.permission === undefined ? {} : { permission: governedCommand.permission },
2806
+ ...routePermission === undefined ? {} : { permission: routePermission },
2745
2807
  idempotency: idempotencyMode,
2746
2808
  ...route.tags === undefined ? {} : { tags: [...route.tags] },
2747
2809
  ...invalidationTags === undefined ? {} : { invalidateTags: [...invalidationTags] }
@@ -2797,6 +2859,7 @@ ${procedureMethods.join(`
2797
2859
  " controller: string;",
2798
2860
  " handler: string;",
2799
2861
  " kind: Kind;",
2862
+ " permission?: string;",
2800
2863
  " idempotency: Idempotency;",
2801
2864
  " tags?: readonly string[];",
2802
2865
  " invalidateTags?: readonly string[];",
@@ -3435,7 +3498,7 @@ function renderOpenApi(graph, options) {
3435
3498
  const featureCommand = featureTransition?.command === undefined ? undefined : commandByClass.get(featureTransition.command);
3436
3499
  const governedCommand = command ?? featureCommand;
3437
3500
  const idempotencyMode = route.idempotency ?? command?.idempotency ?? featureTransition?.idempotency ?? "none";
3438
- const permission = governedCommand?.permission ?? featureTransition?.permission;
3501
+ const permission = route.permission ?? governedCommand?.permission ?? featureTransition?.permission;
3439
3502
  const requiresAuth = (route.guards?.length ?? 0) > 0 || permission !== undefined || governedCommand !== undefined;
3440
3503
  const responseKind = route.contract?.response;
3441
3504
  const responseContentType = responseKind === "binary" || responseKind === "stream" ? "application/octet-stream" : "application/json";
@@ -3888,6 +3951,10 @@ function renderPermissions(graph) {
3888
3951
  if (command.permission)
3889
3952
  permissions.add(command.permission);
3890
3953
  }
3954
+ for (const query of module.queries) {
3955
+ if (query.permission)
3956
+ permissions.add(query.permission);
3957
+ }
3891
3958
  for (const controller of module.controllers) {
3892
3959
  for (const route of controller.routes) {
3893
3960
  const featureTransition = featureTransitionForRoute(module, controller, route);
@@ -3895,7 +3962,7 @@ function renderPermissions(graph) {
3895
3962
  const featureCommand = featureTransition?.command === undefined ? undefined : module.commands.find((candidate) => candidate.className === featureTransition.command || candidate.name === featureTransition.command);
3896
3963
  const governedCommand = command ?? featureCommand;
3897
3964
  const effectiveCommand = route.command ?? featureTransition?.command;
3898
- const perm = governedCommand?.permission ?? featureTransition?.permission;
3965
+ const perm = route.permission ?? governedCommand?.permission ?? featureTransition?.permission;
3899
3966
  const idempotency = route.idempotency ?? command?.idempotency ?? featureTransition?.idempotency;
3900
3967
  if (perm)
3901
3968
  permissions.add(perm);
@@ -5128,90 +5195,72 @@ var init_settings2 = __esm(() => {
5128
5195
  init_settings();
5129
5196
  });
5130
5197
 
5131
- // node_modules/typebox/build/system/memory/freeze.mjs
5132
- function Freeze(value) {
5133
- return Get().immutableTypes ? Object.freeze(value) : value;
5198
+ // node_modules/typebox/build/system/memory/keys.mjs
5199
+ function Keys2(value) {
5200
+ return [...Keys(value), ...Symbols(value)];
5134
5201
  }
5135
- var init_freeze = __esm(() => {
5202
+ var init_keys = __esm(() => {
5203
+ init_guard2();
5204
+ });
5205
+
5206
+ // node_modules/typebox/build/system/memory/finalize.mjs
5207
+ function Freeze(value, seen) {
5208
+ if (seen.has(value))
5209
+ return;
5210
+ seen.add(value);
5211
+ for (const key of Keys2(value)) {
5212
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
5213
+ if (!descriptor || !("value" in descriptor))
5214
+ continue;
5215
+ if (IsObject(descriptor.value))
5216
+ Freeze(descriptor.value, seen);
5217
+ }
5218
+ Object.freeze(value);
5219
+ }
5220
+ function Finalize(value) {
5221
+ if (!Get().immutableTypes)
5222
+ return value;
5223
+ Freeze(value, new WeakSet);
5224
+ return value;
5225
+ }
5226
+ var init_finalize = __esm(() => {
5227
+ init_guard2();
5136
5228
  init_settings2();
5229
+ init_keys();
5137
5230
  });
5138
5231
 
5139
5232
  // node_modules/typebox/build/system/memory/assign.mjs
5140
5233
  function Assign(left, right) {
5141
5234
  Metrics.assign += 1;
5142
- return Freeze({ ...left, ...right });
5235
+ const result = {}, rightKeys = Keys2(right), leftKeys = Keys2(left);
5236
+ for (const key of leftKeys) {
5237
+ if (rightKeys.includes(key))
5238
+ continue;
5239
+ Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(left, key));
5240
+ }
5241
+ for (const key of rightKeys) {
5242
+ Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(right, key));
5243
+ }
5244
+ return Finalize(result);
5143
5245
  }
5144
5246
  var init_assign = __esm(() => {
5145
5247
  init_metrics();
5146
- init_freeze();
5248
+ init_finalize();
5249
+ init_keys();
5147
5250
  });
5148
5251
 
5149
5252
  // node_modules/typebox/build/system/memory/clone.mjs
5150
- function FromClassInstance(value) {
5151
- return value;
5152
- }
5153
- function IsSchemaObject(value) {
5154
- return HasPropertyKey(value, "~kind") || HasPropertyKey(value, "~unsafe");
5155
- }
5156
- function FromSchemaObject(value) {
5157
- const result = {};
5158
- for (const key of Keys(value)) {
5159
- if (IsUnsafePropertyKey(key))
5160
- continue;
5161
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
5162
- descriptor.value = FromValue(descriptor.value);
5163
- if (IsEqual(descriptor.enumerable, true)) {
5164
- result[key] = descriptor.value;
5165
- } else {
5166
- Object.defineProperty(result, key, descriptor);
5167
- }
5168
- }
5169
- return result;
5170
- }
5171
- function FromPlainObject(value) {
5172
- const result = {};
5173
- for (const key of Keys(value)) {
5174
- if (IsUnsafePropertyKey(key))
5175
- continue;
5176
- result[key] = FromValue(value[key]);
5177
- }
5178
- for (const key of Symbols(value)) {
5179
- result[key] = FromValue(value[key]);
5180
- }
5181
- return result;
5182
- }
5183
- function FromObject(value) {
5184
- return IsClassInstance(value) ? FromClassInstance(value) : IsSchemaObject(value) ? FromSchemaObject(value) : FromPlainObject(value);
5185
- }
5186
- function FromArray(value) {
5187
- return value.map((element) => FromValue(element));
5188
- }
5189
- function FromTypedArray(value) {
5190
- return value.slice();
5191
- }
5192
- function FromRegExp(value) {
5193
- return new RegExp(value.source, value.flags);
5194
- }
5195
- function FromMap(value) {
5196
- return new Map(FromValue([...value.entries()]));
5197
- }
5198
- function FromSet(value) {
5199
- return new Set(FromValue([...value.values()]));
5200
- }
5201
- function FromValue(value) {
5202
- 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;
5203
- }
5204
- function Clone(value) {
5205
- Metrics.clone += 1;
5206
- return FromValue(value);
5207
- }
5208
5253
  var init_clone = __esm(() => {
5209
5254
  init_guard2();
5210
5255
  init_metrics();
5256
+ init_keys();
5211
5257
  });
5212
5258
 
5213
5259
  // node_modules/typebox/build/system/memory/create.mjs
5214
- function MergeHidden(left, right) {
5260
+ function WithEnumerable(left, right) {
5261
+ return { ...left, ...right };
5262
+ }
5263
+ function WithHidden(left, right) {
5215
5264
  for (const key of Object.keys(right)) {
5216
5265
  Object.defineProperty(left, key, {
5217
5266
  configurable: true,
@@ -5222,55 +5271,62 @@ function MergeHidden(left, right) {
5222
5271
  }
5223
5272
  return left;
5224
5273
  }
5225
- function Merge(left, right) {
5226
- return { ...left, ...right };
5227
- }
5228
5274
  function Create(hidden, enumerable, options = {}) {
5229
5275
  Metrics.create += 1;
5230
- const withOptions = Merge(enumerable, options);
5231
- const withHidden = Get().enumerableKind ? Merge(withOptions, hidden) : MergeHidden(withOptions, hidden);
5232
- return Freeze(withHidden);
5276
+ const withEnumerable = WithEnumerable(enumerable, options);
5277
+ const withHidden = Get().enumerableKind ? WithEnumerable(withEnumerable, hidden) : WithHidden(withEnumerable, hidden);
5278
+ return Finalize(withHidden);
5233
5279
  }
5234
5280
  var init_create = __esm(() => {
5235
5281
  init_settings2();
5236
5282
  init_metrics();
5237
- init_freeze();
5283
+ init_finalize();
5238
5284
  });
5239
5285
 
5240
5286
  // node_modules/typebox/build/system/memory/discard.mjs
5241
5287
  function Discard(value, propertyKeys) {
5242
5288
  Metrics.discard += 1;
5243
5289
  const result = {};
5244
- for (const key of Keys(value)) {
5290
+ for (const key of Keys2(value)) {
5245
5291
  if (propertyKeys.includes(key))
5246
5292
  continue;
5247
5293
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
5248
- descriptor.value = Clone(descriptor.value);
5249
5294
  Object.defineProperty(result, key, descriptor);
5250
5295
  }
5251
- return Freeze(result);
5296
+ return Finalize(result);
5252
5297
  }
5253
5298
  var init_discard = __esm(() => {
5254
- init_guard2();
5255
5299
  init_metrics();
5256
- init_freeze();
5257
- init_clone();
5300
+ init_finalize();
5301
+ init_keys();
5258
5302
  });
5259
5303
 
5260
5304
  // node_modules/typebox/build/system/memory/update.mjs
5261
- function Update(current, hidden, enumerable) {
5262
- Metrics.update += 1;
5263
- const settings = Get();
5264
- const result = Clone(current);
5265
- for (const key of Object.keys(hidden)) {
5305
+ function WithCurrent(current, hiddenKeys, enumerableKeys, result) {
5306
+ for (const key of Keys2(current)) {
5307
+ if (IsUnsafePropertyKey(key) || hiddenKeys.includes(key) || enumerableKeys.includes(key))
5308
+ continue;
5309
+ const descriptor = Object.getOwnPropertyDescriptor(current, key);
5310
+ Object.defineProperty(result, key, descriptor);
5311
+ }
5312
+ }
5313
+ function WithHidden2(hidden, keys, result) {
5314
+ const enumerableKind = Get().enumerableKind;
5315
+ for (const key of keys) {
5316
+ if (IsUnsafePropertyKey(key))
5317
+ continue;
5266
5318
  Object.defineProperty(result, key, {
5267
5319
  configurable: true,
5268
5320
  writable: true,
5269
- enumerable: settings.enumerableKind,
5321
+ enumerable: enumerableKind,
5270
5322
  value: hidden[key]
5271
5323
  });
5272
5324
  }
5273
- for (const key of Object.keys(enumerable)) {
5325
+ }
5326
+ function WithEnumerable2(enumerable, keys, result) {
5327
+ for (const key of keys) {
5328
+ if (IsUnsafePropertyKey(key))
5329
+ continue;
5274
5330
  Object.defineProperty(result, key, {
5275
5331
  configurable: true,
5276
5332
  enumerable: true,
@@ -5278,13 +5334,21 @@ function Update(current, hidden, enumerable) {
5278
5334
  value: enumerable[key]
5279
5335
  });
5280
5336
  }
5281
- return Freeze(result);
5337
+ }
5338
+ function Update(current, hidden, enumerable) {
5339
+ Metrics.update += 1;
5340
+ const result = {}, hiddenKeys = Keys2(hidden), enumerableKeys = Keys2(enumerable);
5341
+ WithCurrent(current, hiddenKeys, enumerableKeys, result);
5342
+ WithHidden2(hidden, hiddenKeys, result);
5343
+ WithEnumerable2(enumerable, enumerableKeys, result);
5344
+ return Finalize(result);
5282
5345
  }
5283
5346
  var init_update = __esm(() => {
5347
+ init_guard2();
5284
5348
  init_settings2();
5285
5349
  init_metrics();
5286
- init_freeze();
5287
- init_clone();
5350
+ init_finalize();
5351
+ init_keys();
5288
5352
  });
5289
5353
 
5290
5354
  // node_modules/typebox/build/system/memory/memory.mjs
@@ -5326,11 +5390,8 @@ var init_deferred = __esm(() => {
5326
5390
  });
5327
5391
 
5328
5392
  // node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs
5329
- function AddReadonlyOperation(type) {
5330
- return Update(type, { "~readonly": true }, {});
5331
- }
5332
5393
  function AddReadonlyAction(type, options) {
5333
- const result = Update(AddReadonlyOperation(type), {}, options);
5394
+ const result = Update(type, { "~readonly": true }, options);
5334
5395
  return result;
5335
5396
  }
5336
5397
  function AddReadonlyInstantiate(context, state, type, options) {
@@ -5343,11 +5404,8 @@ var init_instantiate_add = __esm(() => {
5343
5404
  });
5344
5405
 
5345
5406
  // node_modules/typebox/build/type/engine/optional/instantiate_add.mjs
5346
- function AddOptionalOperation(type) {
5347
- return Update(type, { "~optional": true }, {});
5348
- }
5349
5407
  function AddOptionalAction(type, options) {
5350
- const result = Update(AddOptionalOperation(type), {}, options);
5408
+ const result = Update(type, { "~optional": true }, options);
5351
5409
  return result;
5352
5410
  }
5353
5411
  function AddOptionalInstantiate(context, state, type, options) {
@@ -5665,13 +5723,20 @@ function IsIEEE754(value) {
5665
5723
  return typeof value === "number";
5666
5724
  }
5667
5725
  function FNV1A64_OP(byte) {
5668
- Accumulator = Accumulator ^ Bytes[byte];
5669
- Accumulator = Accumulator * Prime % Size;
5726
+ const L0 = A0 ^ byte;
5727
+ const T0 = L0 * 435;
5728
+ const T1 = A1 * 435 + (T0 >>> 16);
5729
+ const T2 = A2 * 435 + (T1 >>> 16) + (L0 << 8);
5730
+ const T3 = A3 * 435 + (T2 >>> 16) + (A1 << 8);
5731
+ A0 = T0 & 65535;
5732
+ A1 = T1 & 65535;
5733
+ A2 = T2 & 65535;
5734
+ A3 = T3 & 65535;
5670
5735
  }
5671
- function FromArray2(value) {
5736
+ function FromArray(value) {
5672
5737
  FNV1A64_OP(ByteMarker.Array);
5673
5738
  for (const item of value) {
5674
- FromValue2(item);
5739
+ FromValue(item);
5675
5740
  }
5676
5741
  }
5677
5742
  function FromBigInt(value) {
@@ -5687,15 +5752,15 @@ function FromBoolean(value) {
5687
5752
  }
5688
5753
  function FromConstructor(value) {
5689
5754
  FNV1A64_OP(ByteMarker.Constructor);
5690
- FromValue2(value.toString());
5755
+ FromValue(value.toString());
5691
5756
  }
5692
5757
  function FromDate(value) {
5693
5758
  FNV1A64_OP(ByteMarker.Date);
5694
- FromValue2(value.getTime());
5759
+ FromValue(value.getTime());
5695
5760
  }
5696
5761
  function FromFunction(value) {
5697
5762
  FNV1A64_OP(ByteMarker.Function);
5698
- FromValue2(value.toString());
5763
+ FromValue(value.toString());
5699
5764
  }
5700
5765
  function FromNull(_value) {
5701
5766
  FNV1A64_OP(ByteMarker.Null);
@@ -5707,26 +5772,33 @@ function FromNumber(value) {
5707
5772
  FNV1A64_OP(byte);
5708
5773
  }
5709
5774
  }
5710
- function FromObject2(value) {
5775
+ function FromObject(value) {
5711
5776
  FNV1A64_OP(ByteMarker.Object);
5712
5777
  for (const key of InstanceKeys(value).sort()) {
5713
- FromValue2(key);
5714
- FromValue2(value[key]);
5778
+ FromValue(key);
5779
+ FromValue(value[key]);
5715
5780
  }
5716
5781
  }
5717
- function FromRegExp2(value) {
5782
+ function FromRegExp(value) {
5718
5783
  FNV1A64_OP(ByteMarker.RegExp);
5719
5784
  FromString(value.toString());
5720
5785
  }
5721
5786
  function FromString(value) {
5722
5787
  FNV1A64_OP(ByteMarker.String);
5723
- for (const byte of encoder.encode(value)) {
5724
- FNV1A64_OP(byte);
5788
+ for (let i = 0;i < value.length; i++) {
5789
+ const code = value.charCodeAt(i);
5790
+ if (code > 127) {
5791
+ for (const byte of encoder.encode(value.slice(i))) {
5792
+ FNV1A64_OP(byte);
5793
+ }
5794
+ return;
5795
+ }
5796
+ FNV1A64_OP(code);
5725
5797
  }
5726
5798
  }
5727
5799
  function FromSymbol(value) {
5728
5800
  FNV1A64_OP(ByteMarker.Symbol);
5729
- FromValue2(value.toString());
5801
+ FromValue(value.toString());
5730
5802
  }
5731
5803
  function FromTypeArray(value) {
5732
5804
  FNV1A64_OP(ByteMarker.TypeArray);
@@ -5738,18 +5810,18 @@ function FromTypeArray(value) {
5738
5810
  function FromUndefined(_value) {
5739
5811
  return FNV1A64_OP(ByteMarker.Undefined);
5740
5812
  }
5741
- function FromValue2(value) {
5742
- 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();
5813
+ function FromValue(value) {
5814
+ 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();
5743
5815
  }
5744
- function HashCode(value) {
5745
- Accumulator = BigInt("14695981039346656037");
5746
- FromValue2(value);
5747
- return Accumulator;
5816
+ function Hex(limb) {
5817
+ return limb.toString(16).padStart(4, "0");
5748
5818
  }
5749
5819
  function Hash(value) {
5750
- return HashCode(value).toString(16).padStart(16, "0");
5820
+ A0 = 8997, A1 = 33826, A2 = 40164, A3 = 52210;
5821
+ FromValue(value);
5822
+ return `${Hex(A3)}${Hex(A2)}${Hex(A1)}${Hex(A0)}`;
5751
5823
  }
5752
- var ByteMarker, Accumulator, Prime, Size, Bytes, F64, F64In, F64Out, encoder;
5824
+ var ByteMarker, A0 = 8997, A1 = 33826, A2 = 40164, A3 = 52210, F64, F64In, F64Out, encoder;
5753
5825
  var init_hash = __esm(() => {
5754
5826
  init_unreachable();
5755
5827
  init_guard2();
@@ -5769,9 +5841,6 @@ var init_hash = __esm(() => {
5769
5841
  TypeArray: 12,
5770
5842
  Undefined: 13
5771
5843
  };
5772
- Accumulator = BigInt("14695981039346656037");
5773
- [Prime, Size] = [BigInt("1099511628211"), BigInt("18446744073709551616")];
5774
- Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
5775
5844
  F64 = new Float64Array(1);
5776
5845
  F64In = new DataView(F64.buffer);
5777
5846
  F64Out = new Uint8Array(F64.buffer);
@@ -6234,30 +6303,20 @@ var init_tuple = __esm(() => {
6234
6303
  init_schema();
6235
6304
  });
6236
6305
 
6237
- // node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs
6238
- function RemoveReadonlyOperation(type) {
6239
- return Discard(type, ["~readonly"]);
6240
- }
6241
- function RemoveReadonlyAction(type, options) {
6242
- const result = Update(RemoveReadonlyOperation(type), {}, options);
6306
+ // node_modules/typebox/build/type/engine/tuple/to_object.mjs
6307
+ function TupleElementsToProperties(types) {
6308
+ const result = types.reduceRight((result, right, index) => {
6309
+ return { [index]: right, ...result };
6310
+ }, {});
6243
6311
  return result;
6244
6312
  }
6245
- function RemoveReadonlyInstantiate(context, state, type, options) {
6246
- const instantiatedType = InstantiateType(context, state, type);
6247
- return RemoveReadonlyAction(instantiatedType, options);
6248
- }
6249
- var init_instantiate_remove = __esm(() => {
6250
- init_memory2();
6251
- init_instantiate27();
6252
- });
6253
-
6254
- // node_modules/typebox/build/type/action/_remove_readonly.mjs
6255
- function RemoveReadonly(type, options = {}) {
6256
- return RemoveReadonlyAction(type, options);
6313
+ function TupleToObject(type) {
6314
+ const properties = TupleElementsToProperties(type.items);
6315
+ const result = _Object_(properties);
6316
+ return result;
6257
6317
  }
6258
- var init__remove_readonly = __esm(() => {
6259
- init_deferred();
6260
- init_instantiate_remove();
6318
+ var init_to_object = __esm(() => {
6319
+ init_object();
6261
6320
  });
6262
6321
 
6263
6322
  // node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs
@@ -6272,55 +6331,57 @@ function RemoveOptionalInstantiate(context, state, type, options) {
6272
6331
  const instantiatedType = InstantiateType(context, state, type);
6273
6332
  return RemoveOptionalAction(instantiatedType, options);
6274
6333
  }
6275
- var init_instantiate_remove2 = __esm(() => {
6334
+ var init_instantiate_remove = __esm(() => {
6276
6335
  init_memory2();
6277
6336
  init_instantiate27();
6278
6337
  });
6279
6338
 
6280
- // node_modules/typebox/build/type/action/_remove_optional.mjs
6281
- function RemoveOptional(type, options = {}) {
6282
- return RemoveOptionalAction(type, options);
6339
+ // node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs
6340
+ function RemoveReadonlyOperation(type) {
6341
+ return Discard(type, ["~readonly"]);
6283
6342
  }
6284
- var init__remove_optional = __esm(() => {
6285
- init_deferred();
6286
- init_instantiate_remove2();
6287
- });
6288
-
6289
- // node_modules/typebox/build/type/engine/tuple/to_object.mjs
6290
- function TupleElementsToProperties(types) {
6291
- const result = types.reduceRight((result, right, index) => {
6292
- return { [index]: right, ...result };
6293
- }, {});
6343
+ function RemoveReadonlyAction(type, options) {
6344
+ const result = Update(RemoveReadonlyOperation(type), {}, options);
6294
6345
  return result;
6295
6346
  }
6296
- function TupleToObject(type) {
6297
- const properties = TupleElementsToProperties(type.items);
6298
- const result = _Object_(properties);
6299
- return result;
6347
+ function RemoveReadonlyInstantiate(context, state, type, options) {
6348
+ const instantiatedType = InstantiateType(context, state, type);
6349
+ return RemoveReadonlyAction(instantiatedType, options);
6300
6350
  }
6301
- var init_to_object = __esm(() => {
6302
- init_object();
6351
+ var init_instantiate_remove2 = __esm(() => {
6352
+ init_memory2();
6353
+ init_instantiate27();
6303
6354
  });
6304
6355
 
6305
- // node_modules/typebox/build/type/engine/evaluate/composite.mjs
6306
- function CanComposite(type) {
6307
- return IsObject2(type) || IsTuple(type);
6308
- }
6309
- function IsReadonlyProperty(left, right) {
6310
- return IsReadonly(left) ? IsReadonly(right) ? true : false : false;
6311
- }
6312
- function IsOptionalProperty(left, right) {
6313
- return IsOptional(left) ? IsOptional(right) ? true : false : false;
6314
- }
6315
- function CompositeProperty(left, right) {
6316
- const isReadonly = IsReadonlyProperty(left, right);
6317
- const isOptional = IsOptionalProperty(left, right);
6356
+ // node_modules/typebox/build/type/engine/evaluate/property.mjs
6357
+ function EvaluatePropertyIntersect(left, right) {
6358
+ const isReadonly = IsReadonly(left) && IsReadonly(right);
6359
+ const isOptional = IsOptional(left) && IsOptional(right);
6318
6360
  const evaluated = EvaluateIntersect([left, right]);
6319
- const property = RemoveReadonly(RemoveOptional(evaluated));
6320
- return isReadonly && isOptional ? AddReadonly(AddOptional(property)) : isReadonly && !isOptional ? AddReadonly(property) : !isReadonly && isOptional ? AddOptional(property) : property;
6321
- }
6361
+ const property = RemoveReadonlyAction(RemoveOptionalAction(evaluated, {}), {});
6362
+ return isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) : isReadonly ? AddReadonlyAction(property, {}) : isOptional ? AddOptionalAction(property, {}) : property;
6363
+ }
6364
+ function EvaluatePropertyUnion(left, right) {
6365
+ const isReadonly = IsReadonly(left) || IsReadonly(right);
6366
+ const isOptional = IsOptional(left) || IsOptional(right);
6367
+ const leftProperty = RemoveReadonlyAction(RemoveOptionalAction(left, {}), {});
6368
+ const rightProperty = RemoveReadonlyAction(RemoveOptionalAction(right, {}), {});
6369
+ const property = EvaluateUnion([leftProperty, rightProperty]);
6370
+ return isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) : isReadonly ? AddReadonlyAction(property, {}) : isOptional ? AddOptionalAction(property, {}) : property;
6371
+ }
6372
+ var init_property = __esm(() => {
6373
+ init__optional();
6374
+ init__readonly();
6375
+ init_instantiate_add2();
6376
+ init_instantiate_add();
6377
+ init_instantiate_remove();
6378
+ init_instantiate_remove2();
6379
+ init_evaluate2();
6380
+ });
6381
+
6382
+ // node_modules/typebox/build/type/engine/evaluate/composite.mjs
6322
6383
  function CompositePropertyKey(left, right, key) {
6323
- return key in left ? key in right ? CompositeProperty(left[key], right[key]) : left[key] : (key in right) ? right[key] : Never();
6384
+ return key in left ? key in right ? EvaluatePropertyIntersect(left[key], right[key]) : left[key] : (key in right) ? right[key] : Never();
6324
6385
  }
6325
6386
  function CompositeProperties(left, right) {
6326
6387
  const keys = new Set([...Keys(left), ...Keys(right)]);
@@ -6342,17 +6403,11 @@ function Composite(left, right) {
6342
6403
  }
6343
6404
  var init_composite = __esm(() => {
6344
6405
  init_guard2();
6345
- init__readonly();
6346
- init__optional();
6347
6406
  init_object();
6348
6407
  init_never();
6349
6408
  init_tuple();
6350
- init__add_readonly();
6351
- init__add_optional();
6352
- init__remove_readonly();
6353
- init__remove_optional();
6354
6409
  init_to_object();
6355
- init_evaluate2();
6410
+ init_property();
6356
6411
  });
6357
6412
 
6358
6413
  // node_modules/typebox/build/type/engine/evaluate/narrow.mjs
@@ -6360,6 +6415,9 @@ function NarrowCompareRule(left, right) {
6360
6415
  const result = Compare(left, right);
6361
6416
  return IsEqual(result, CompareResultLeftInside) ? left : IsEqual(result, CompareResultRightInside) ? right : IsEqual(result, CompareResultEqual) ? right : Never();
6362
6417
  }
6418
+ function CanComposite(type) {
6419
+ return IsObject2(type) || IsTuple(type);
6420
+ }
6363
6421
  function NarrowCompositeRule(left, right) {
6364
6422
  const canCompositeLeft = CanComposite(left);
6365
6423
  const canCompositeRight = CanComposite(right);
@@ -6370,8 +6428,10 @@ function Narrow(left, right) {
6370
6428
  }
6371
6429
  var init_narrow = __esm(() => {
6372
6430
  init_guard2();
6431
+ init_object();
6373
6432
  init_any();
6374
6433
  init_never();
6434
+ init_tuple();
6375
6435
  init_unknown();
6376
6436
  init_compare();
6377
6437
  init_composite();
@@ -7536,14 +7596,14 @@ var init_object2 = __esm(() => {
7536
7596
  });
7537
7597
 
7538
7598
  // node_modules/typebox/build/type/extends/record.mjs
7539
- function FromObject3(inferred, properties) {
7599
+ function FromObject2(inferred, properties) {
7540
7600
  return IsEqual(Keys(properties).length, 0) ? ExtendsTrue(inferred) : ExtendsFalse();
7541
7601
  }
7542
7602
  function FromRecord(inferred, _leftKey, leftValue, _rightKey, rightValue) {
7543
7603
  return ExtendsLeft(inferred, leftValue, rightValue);
7544
7604
  }
7545
7605
  function ExtendsRecord(inferred, leftPattern, leftValue, right) {
7546
- 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();
7606
+ 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();
7547
7607
  }
7548
7608
  var init_record2 = __esm(() => {
7549
7609
  init_guard2();
@@ -8101,6 +8161,7 @@ var init_evaluate3 = __esm(() => {
8101
8161
  init_flatten();
8102
8162
  init_instantiate5();
8103
8163
  init_narrow();
8164
+ init_property();
8104
8165
  });
8105
8166
 
8106
8167
  // node_modules/typebox/build/type/engine/call/distribute_arguments.mjs
@@ -8629,7 +8690,7 @@ function CollapseIntersectProperties(left, right) {
8629
8690
  const sharedKeys = Keys(left).filter((key) => HasPropertyKey(right, key));
8630
8691
  const leftProperties = leftKeys.reduce((result, key) => ({ ...result, [key]: left[key] }), {});
8631
8692
  const rightProperties = rightKeys.reduce((result, key) => ({ ...result, [key]: right[key] }), {});
8632
- const sharedProperties = sharedKeys.reduce((result, key) => ({ ...result, [key]: EvaluateIntersect([left[key], right[key]]) }), {});
8693
+ const sharedProperties = sharedKeys.reduce((result, key) => ({ ...result, [key]: EvaluatePropertyIntersect(left[key], right[key]) }), {});
8633
8694
  const unique = Assign(leftProperties, rightProperties);
8634
8695
  const shared = Assign(unique, sharedProperties);
8635
8696
  return shared;
@@ -8643,11 +8704,11 @@ var init_from_intersect = __esm(() => {
8643
8704
  init_memory2();
8644
8705
  init_guard2();
8645
8706
  init_from_type2();
8646
- init_evaluate2();
8707
+ init_property();
8647
8708
  });
8648
8709
 
8649
8710
  // node_modules/typebox/build/type/engine/object/from_object.mjs
8650
- function FromObject4(properties) {
8711
+ function FromObject3(properties) {
8651
8712
  return properties;
8652
8713
  }
8653
8714
 
@@ -8667,7 +8728,7 @@ var init_from_tuple = __esm(() => {
8667
8728
  function CollapseUnionProperties(left, right) {
8668
8729
  const sharedKeys = Keys(left).filter((key) => (key in right));
8669
8730
  const result = sharedKeys.reduce((result, key) => {
8670
- return { ...result, [key]: EvaluateUnion([left[key], right[key]]) };
8731
+ return { ...result, [key]: EvaluatePropertyUnion(left[key], right[key]) };
8671
8732
  }, {});
8672
8733
  return result;
8673
8734
  }
@@ -8680,13 +8741,13 @@ function FromUnion3(types) {
8680
8741
  var init_from_union2 = __esm(() => {
8681
8742
  init_guard2();
8682
8743
  init_unreachable();
8683
- init_evaluate2();
8744
+ init_property();
8684
8745
  init_from_type2();
8685
8746
  });
8686
8747
 
8687
8748
  // node_modules/typebox/build/type/engine/object/from_type.mjs
8688
8749
  function FromType8(type) {
8689
- 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) : {};
8750
+ 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) : {};
8690
8751
  }
8691
8752
  var init_from_type2 = __esm(() => {
8692
8753
  init_cyclic();
@@ -8724,7 +8785,7 @@ function ConvertToIntegerKey(value) {
8724
8785
  return integerKeyPattern.test(normal) ? parseInt(normal) : value;
8725
8786
  }
8726
8787
  var integerKeyPattern;
8727
- var init_keys = __esm(() => {
8788
+ var init_keys2 = __esm(() => {
8728
8789
  integerKeyPattern = new RegExp("^(?:0|[1-9][0-9]*)$");
8729
8790
  });
8730
8791
 
@@ -8738,7 +8799,7 @@ function NormalizeIndexerTypes(types) {
8738
8799
  function NormalizeIndexer(type) {
8739
8800
  return IsIntersect(type) ? Intersect(NormalizeIndexerTypes(type.allOf)) : IsUnion(type) ? Union(NormalizeIndexerTypes(type.anyOf)) : IsLiteral(type) ? NormalizeLiteral(type.const) : type;
8740
8801
  }
8741
- function FromArray3(type, indexer) {
8802
+ function FromArray2(type, indexer) {
8742
8803
  const normalizedIndexer = NormalizeIndexer(indexer);
8743
8804
  const check = Extends({}, normalizedIndexer, Number2());
8744
8805
  const result = IsExtendsTrueLike(check) ? type : IsLiteral(indexer) && IsEqual(indexer.const, "length") ? Number2() : Never();
@@ -8752,7 +8813,7 @@ var init_from_array = __esm(() => {
8752
8813
  init_number();
8753
8814
  init_never();
8754
8815
  init_extends3();
8755
- init_keys();
8816
+ init_keys2();
8756
8817
  });
8757
8818
 
8758
8819
  // node_modules/typebox/build/type/engine/indexable/from_cyclic.mjs
@@ -8905,7 +8966,7 @@ function FromIndexerNumber(properties) {
8905
8966
  const result = EvaluateUnion(variants);
8906
8967
  return result;
8907
8968
  }
8908
- function FromObject5(properties, indexer) {
8969
+ function FromObject4(properties, indexer) {
8909
8970
  const result = IsNumber3(indexer) ? FromIndexerNumber(properties) : FromIndexer(properties, indexer);
8910
8971
  return result;
8911
8972
  }
@@ -8935,7 +8996,7 @@ var init_array_indexer = __esm(() => {
8935
8996
  init_union();
8936
8997
  init_intersect();
8937
8998
  init_literal();
8938
- init_keys();
8999
+ init_keys2();
8939
9000
  });
8940
9001
 
8941
9002
  // node_modules/typebox/build/type/engine/indexed/from_tuple.mjs
@@ -8968,7 +9029,7 @@ var init_from_tuple2 = __esm(() => {
8968
9029
 
8969
9030
  // node_modules/typebox/build/type/engine/indexed/from_type.mjs
8970
9031
  function FromType11(type, indexer) {
8971
- return IsArray2(type) ? FromArray3(type.items, indexer) : IsObject2(type) ? FromObject5(type.properties, indexer) : IsTuple(type) ? FromTuple2(type.items, indexer) : Never();
9032
+ return IsArray2(type) ? FromArray2(type.items, indexer) : IsObject2(type) ? FromObject4(type.properties, indexer) : IsTuple(type) ? FromTuple2(type.items, indexer) : Never();
8972
9033
  }
8973
9034
  var init_from_type4 = __esm(() => {
8974
9035
  init_array();
@@ -9056,7 +9117,7 @@ var init_from_any = __esm(() => {
9056
9117
  });
9057
9118
 
9058
9119
  // node_modules/typebox/build/type/engine/keyof/from_array.mjs
9059
- function FromArray4(_type) {
9120
+ function FromArray3(_type) {
9060
9121
  return Number2();
9061
9122
  }
9062
9123
  var init_from_array2 = __esm(() => {
@@ -9070,7 +9131,7 @@ function FromPropertyKeys(keys) {
9070
9131
  }, []);
9071
9132
  return result;
9072
9133
  }
9073
- function FromObject6(properties) {
9134
+ function FromObject5(properties) {
9074
9135
  const propertyKeys = Keys(properties);
9075
9136
  const variants = FromPropertyKeys(propertyKeys);
9076
9137
  const result = EvaluateUnionFast(variants);
@@ -9080,7 +9141,7 @@ var init_from_object2 = __esm(() => {
9080
9141
  init_unreachable();
9081
9142
  init_guard2();
9082
9143
  init_literal();
9083
- init_keys();
9144
+ init_keys2();
9084
9145
  init_evaluate2();
9085
9146
  });
9086
9147
 
@@ -9104,7 +9165,7 @@ var init_from_tuple3 = __esm(() => {
9104
9165
 
9105
9166
  // node_modules/typebox/build/type/engine/keyof/from_type.mjs
9106
9167
  function FromType12(type) {
9107
- return IsAny(type) ? FromAny() : IsArray2(type) ? FromArray4(type.items) : IsObject2(type) ? FromObject6(type.properties) : IsRecord(type) ? FromRecord2(type) : IsTuple(type) ? FromTuple3(type.items) : Never();
9168
+ return IsAny(type) ? FromAny() : IsArray2(type) ? FromArray3(type.items) : IsObject2(type) ? FromObject5(type.properties) : IsRecord(type) ? FromRecord2(type) : IsTuple(type) ? FromTuple3(type.items) : Never();
9108
9169
  }
9109
9170
  var init_from_type5 = __esm(() => {
9110
9171
  init_any();
@@ -9466,7 +9527,7 @@ var init_from_union4 = __esm(() => {
9466
9527
  });
9467
9528
 
9468
9529
  // node_modules/typebox/build/type/engine/partial/from_object.mjs
9469
- function FromObject7(properties) {
9530
+ function FromObject6(properties) {
9470
9531
  const mapped = Keys(properties).reduce((result, left) => {
9471
9532
  return { ...result, [left]: AddOptional(properties[left]) };
9472
9533
  }, {});
@@ -9481,7 +9542,7 @@ var init_from_object3 = __esm(() => {
9481
9542
 
9482
9543
  // node_modules/typebox/build/type/engine/partial/from_type.mjs
9483
9544
  function FromType15(type) {
9484
- 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_({});
9545
+ 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_({});
9485
9546
  }
9486
9547
  var init_from_type7 = __esm(() => {
9487
9548
  init_cyclic();
@@ -9572,7 +9633,7 @@ var init_readonly_object = __esm(() => {
9572
9633
  });
9573
9634
 
9574
9635
  // node_modules/typebox/build/type/engine/readonly_object/from_array.mjs
9575
- function FromArray5(type) {
9636
+ function FromArray4(type) {
9576
9637
  const result = AddImmutable(_Array_(type));
9577
9638
  return result;
9578
9639
  }
@@ -9618,7 +9679,7 @@ var init_from_intersect4 = __esm(() => {
9618
9679
  });
9619
9680
 
9620
9681
  // node_modules/typebox/build/type/engine/readonly_object/from_object.mjs
9621
- function FromObject8(properties) {
9682
+ function FromObject7(properties) {
9622
9683
  const mapped = Keys(properties).reduce((result, left) => {
9623
9684
  return { ...result, [left]: AddReadonly(properties[left]) };
9624
9685
  }, {});
@@ -9653,7 +9714,7 @@ var init_from_union5 = __esm(() => {
9653
9714
 
9654
9715
  // node_modules/typebox/build/type/engine/readonly_object/from_type.mjs
9655
9716
  function FromType17(type) {
9656
- 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;
9717
+ 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;
9657
9718
  }
9658
9719
  var init_from_type9 = __esm(() => {
9659
9720
  init_array();
@@ -9743,8 +9804,17 @@ var init_from_union6 = __esm(() => {
9743
9804
  init_from_type10();
9744
9805
  });
9745
9806
 
9807
+ // node_modules/typebox/build/type/action/_remove_optional.mjs
9808
+ function RemoveOptional(type, options = {}) {
9809
+ return RemoveOptionalAction(type, options);
9810
+ }
9811
+ var init__remove_optional = __esm(() => {
9812
+ init_deferred();
9813
+ init_instantiate_remove();
9814
+ });
9815
+
9746
9816
  // node_modules/typebox/build/type/engine/required/from_object.mjs
9747
- function FromObject9(properties) {
9817
+ function FromObject8(properties) {
9748
9818
  const mapped = Keys(properties).reduce((result, left) => {
9749
9819
  return { ...result, [left]: RemoveOptional(properties[left]) };
9750
9820
  }, {});
@@ -9759,7 +9829,7 @@ var init_from_object5 = __esm(() => {
9759
9829
 
9760
9830
  // node_modules/typebox/build/type/engine/required/from_type.mjs
9761
9831
  function FromType18(type) {
9762
- 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_({});
9832
+ 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_({});
9763
9833
  }
9764
9834
  var init_from_type10 = __esm(() => {
9765
9835
  init_cyclic();
@@ -9941,9 +10011,9 @@ var init_instantiate27 = __esm(() => {
9941
10011
  init_instantiate_add3();
9942
10012
  init_instantiate_remove3();
9943
10013
  init_instantiate_add();
9944
- init_instantiate_remove();
9945
- init_instantiate_add2();
9946
10014
  init_instantiate_remove2();
10015
+ init_instantiate_add2();
10016
+ init_instantiate_remove();
9947
10017
  init__optional();
9948
10018
  init__immutable();
9949
10019
  init__readonly();
@@ -9979,11 +10049,8 @@ var init_instantiate27 = __esm(() => {
9979
10049
  });
9980
10050
 
9981
10051
  // node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs
9982
- function AddImmutableOperation(type) {
9983
- return Update(type, { "~immutable": true }, {});
9984
- }
9985
10052
  function AddImmutableAction(type, options) {
9986
- const result = Update(AddImmutableOperation(type), {}, options);
10053
+ const result = Update(type, { "~immutable": true }, options);
9987
10054
  return result;
9988
10055
  }
9989
10056
  function AddImmutableInstantiate(context, state, type, options) {
@@ -10010,6 +10077,12 @@ var init__remove_immutable = __esm(() => {
10010
10077
  init_instantiate_remove3();
10011
10078
  });
10012
10079
 
10080
+ // node_modules/typebox/build/type/action/_remove_readonly.mjs
10081
+ var init__remove_readonly = __esm(() => {
10082
+ init_deferred();
10083
+ init_instantiate_remove2();
10084
+ });
10085
+
10013
10086
  // node_modules/typebox/build/type/action/evaluate.mjs
10014
10087
  function Evaluate(type, options = {}) {
10015
10088
  return EvaluateAction(type, options);
@@ -10086,7 +10159,7 @@ var init_union3 = () => {};
10086
10159
  // node_modules/typebox/build/type/engine/helpers/index.mjs
10087
10160
  var init_helpers = __esm(() => {
10088
10161
  init_keys_to_indexer();
10089
- init_keys();
10162
+ init_keys2();
10090
10163
  init_union3();
10091
10164
  });
10092
10165
 
@@ -10372,14 +10445,14 @@ var init__refine2 = __esm(() => {
10372
10445
  });
10373
10446
 
10374
10447
  // node_modules/typebox/build/schema/types/schema.mjs
10375
- function IsSchemaObject2(value) {
10448
+ function IsSchemaObject(value) {
10376
10449
  return IsObject(value) && !IsArray(value);
10377
10450
  }
10378
10451
  function IsSchemaBoolean(value) {
10379
10452
  return IsBoolean(value);
10380
10453
  }
10381
10454
  function IsSchema2(value) {
10382
- return IsSchemaObject2(value) || IsSchemaBoolean(value);
10455
+ return IsSchemaObject(value) || IsSchemaBoolean(value);
10383
10456
  }
10384
10457
  var init_schema2 = __esm(() => {
10385
10458
  init_guard2();
@@ -10951,7 +11024,7 @@ function NextUri(ref, base) {
10951
11024
  return URL.canParse(ref, base) ? new URL(ref, base) : IsEqual(base, DefaultUri) ? new URL(`${base}:${ref}`) : new URL(`${base.slice(0, base.lastIndexOf(":"))}:${ref}`);
10952
11025
  }
10953
11026
  function Stack(context, schema) {
10954
- const base = IsSchemaObject2(schema) && IsId(schema) ? NextUri(schema.$id, DefaultUri).href : DefaultUri;
11027
+ const base = IsSchemaObject(schema) && IsId(schema) ? NextUri(schema.$id, DefaultUri).href : DefaultUri;
10955
11028
  return {
10956
11029
  context,
10957
11030
  schema,
@@ -10973,7 +11046,7 @@ function RegisterResourceAnchors(anchors, schema, isRoot = true) {
10973
11046
  return anchors;
10974
11047
  if (Array.isArray(schema))
10975
11048
  return schema.reduce((result, item) => RegisterResourceAnchors(result, item, false), anchors);
10976
- if (!IsSchemaObject2(schema))
11049
+ if (!IsSchemaObject(schema))
10977
11050
  return anchors;
10978
11051
  if (!isRoot && IsId(schema))
10979
11052
  return anchors;
@@ -11029,7 +11102,7 @@ function NextLexicalSchema(stack, schema) {
11029
11102
  return IsId(schema) ? schema : stack.lexicalSchema;
11030
11103
  }
11031
11104
  function HasStackKeywords(stack, schema) {
11032
- return IsSchemaObject2(schema) && (IsId(schema) || IsDynamicAnchor(schema) || IsUndefined(stack.recursiveAnchor) && IsRecursiveAnchorTrue(schema) || !IsUndefined(ResourceEntry(stack, schema)));
11105
+ return IsSchemaObject(schema) && (IsId(schema) || IsDynamicAnchor(schema) || IsUndefined(stack.recursiveAnchor) && IsRecursiveAnchorTrue(schema) || !IsUndefined(ResourceEntry(stack, schema)));
11033
11106
  }
11034
11107
  function NextStack(stack, schema) {
11035
11108
  return HasStackKeywords(stack, schema) ? {
@@ -11328,7 +11401,7 @@ var init_pointer2 = __esm(() => {
11328
11401
 
11329
11402
  // node_modules/typebox/build/schema/resolve/resolve.mjs
11330
11403
  function RelativeBase(schema, base) {
11331
- return IsSchemaObject2(schema) && IsId(schema) ? NextUri(schema.$id, base.href) : base;
11404
+ return IsSchemaObject(schema) && IsId(schema) ? NextUri(schema.$id, base.href) : base;
11332
11405
  }
11333
11406
  function AbsoluteBase(base) {
11334
11407
  return NextUri(base, DefaultUri);
@@ -11413,7 +11486,7 @@ function MatchWithDynamicAnchor(schema, base, ref) {
11413
11486
  return isMatch ? schema : undefined;
11414
11487
  }
11415
11488
  function MatchSchemaObject(schema, base, ref) {
11416
- if (!IsSchemaObject2(schema))
11489
+ if (!IsSchemaObject(schema))
11417
11490
  return;
11418
11491
  return MatchWithId(schema, base, ref) ?? MatchWithAnchor(schema, base, ref) ?? MatchWithDynamicAnchor(schema, base, ref) ?? MatchWithHash(schema, ref);
11419
11492
  }
@@ -11441,12 +11514,12 @@ function Match4(schema, base, ref) {
11441
11514
  }
11442
11515
  function Resource(context, schema, base, ref) {
11443
11516
  const result = RefInternal(context, schema, base, ref);
11444
- return IsSchemaObject2(result) && IsId(result) ? result : undefined;
11517
+ return IsSchemaObject(result) && IsId(result) ? result : undefined;
11445
11518
  }
11446
11519
  function FindDeferredResourceLegacy(stack, ref, schema) {
11447
11520
  if (!ref.$ref.startsWith("#"))
11448
11521
  return;
11449
- if (!IsSchemaObject2(stack.schema) || HasPropertyKey(stack.schema, "$schema"))
11522
+ if (!IsSchemaObject(stack.schema) || HasPropertyKey(stack.schema, "$schema"))
11450
11523
  return;
11451
11524
  const targetBase = Base(stack.lexicalSchema, stack.referenceBase, schema);
11452
11525
  if (IsUndefined(targetBase) || IsEqual(targetBase, stack.referenceBase))
@@ -11455,7 +11528,7 @@ function FindDeferredResourceLegacy(stack, ref, schema) {
11455
11528
  }
11456
11529
  function FindDeferredResourceModern(stack, canonical, schema) {
11457
11530
  const remoteRoot = stack.context[canonical];
11458
- if (!IsSchemaObject2(remoteRoot))
11531
+ if (!IsSchemaObject(remoteRoot))
11459
11532
  return;
11460
11533
  return { target: schema, base: canonical, root: remoteRoot };
11461
11534
  }
@@ -11517,10 +11590,10 @@ function RefResultNotFound(stack, schema) {
11517
11590
  }
11518
11591
  function Ref2(stack, ref) {
11519
11592
  const schema = RefInternal(stack.context, RefRoot(stack, ref), stack.referenceBase, ref.$ref);
11520
- return IsSchemaObject2(schema) ? RefResultFound(stack, ref, schema) : RefResultNotFound(stack, schema);
11593
+ return IsSchemaObject(schema) ? RefResultFound(stack, ref, schema) : RefResultNotFound(stack, schema);
11521
11594
  }
11522
11595
  function IsRecursiveAnchorInScope(stack) {
11523
- return IsSchemaObject2(stack.lexicalSchema) && IsRecursiveAnchorTrue(stack.lexicalSchema);
11596
+ return IsSchemaObject(stack.lexicalSchema) && IsRecursiveAnchorTrue(stack.lexicalSchema);
11524
11597
  }
11525
11598
  function RecursiveRef(stack, recursiveRef) {
11526
11599
  const schema = IsRecursiveAnchorInScope(stack) ? stack.recursiveAnchor : stack.lexicalSchema;
@@ -11533,7 +11606,7 @@ function FindScopedDynamicAnchor(stack, name) {
11533
11606
  return stack.dynamicAnchors.find((anchor) => IsEqual(anchor.$dynamicAnchor, name)) ?? SearchDynamicAnchor(stack.schema, name);
11534
11607
  }
11535
11608
  function DynamicRefWhenFound(stack, dynamicRef, fragmentTarget) {
11536
- if (!IsSchemaObject2(fragmentTarget) || !IsDynamicAnchor(fragmentTarget))
11609
+ if (!IsSchemaObject(fragmentTarget) || !IsDynamicAnchor(fragmentTarget))
11537
11610
  return fragmentTarget;
11538
11611
  const fragment = DynamicRefFragment(stack, dynamicRef);
11539
11612
  return IsPointerFragment(fragment) ? fragmentTarget : FindScopedDynamicAnchor(stack, fragmentTarget.$dynamicAnchor);
@@ -13177,7 +13250,7 @@ var init_type3 = __esm(() => {
13177
13250
  });
13178
13251
 
13179
13252
  // node_modules/typebox/build/value/clean/from_array.mjs
13180
- function FromArray6(context, type, value) {
13253
+ function FromArray5(context, type, value) {
13181
13254
  if (!IsArray(value))
13182
13255
  return value;
13183
13256
  return value.map((value) => FromType19(context, type.items, value));
@@ -13223,7 +13296,7 @@ var init_additional = __esm(() => {
13223
13296
  });
13224
13297
 
13225
13298
  // node_modules/typebox/build/value/clean/from_object.mjs
13226
- function FromObject10(context, type, value) {
13299
+ function FromObject9(context, type, value) {
13227
13300
  if (!IsObject(value) || IsArray(value))
13228
13301
  return value;
13229
13302
  const additionalProperties = GetAdditionalProperties(type);
@@ -13301,12 +13374,74 @@ var init_from_tuple5 = __esm(() => {
13301
13374
  init_from_type11();
13302
13375
  });
13303
13376
 
13377
+ // node_modules/typebox/build/system/memory/deep.mjs
13378
+ function FromClassInstance(value) {
13379
+ return value;
13380
+ }
13381
+ function IsSchemaObject2(value) {
13382
+ return HasPropertyKey(value, "~kind") || HasPropertyKey(value, "~unsafe");
13383
+ }
13384
+ function FromSchemaObject(value) {
13385
+ const result = {};
13386
+ for (const key of Keys(value)) {
13387
+ if (IsUnsafePropertyKey(key))
13388
+ continue;
13389
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
13390
+ descriptor.value = FromValue2(descriptor.value);
13391
+ if (IsEqual(descriptor.enumerable, true)) {
13392
+ result[key] = descriptor.value;
13393
+ } else {
13394
+ Object.defineProperty(result, key, descriptor);
13395
+ }
13396
+ }
13397
+ return result;
13398
+ }
13399
+ function FromPlainObject(value) {
13400
+ const result = {};
13401
+ for (const key of Keys(value)) {
13402
+ if (IsUnsafePropertyKey(key))
13403
+ continue;
13404
+ result[key] = FromValue2(value[key]);
13405
+ }
13406
+ for (const key of Symbols(value)) {
13407
+ result[key] = FromValue2(value[key]);
13408
+ }
13409
+ return result;
13410
+ }
13411
+ function FromObject10(value) {
13412
+ return IsClassInstance(value) ? FromClassInstance(value) : IsSchemaObject2(value) ? FromSchemaObject(value) : FromPlainObject(value);
13413
+ }
13414
+ function FromArray6(value) {
13415
+ return value.map((element) => FromValue2(element));
13416
+ }
13417
+ function FromTypedArray(value) {
13418
+ return value.slice();
13419
+ }
13420
+ function FromRegExp2(value) {
13421
+ return new RegExp(value.source, value.flags);
13422
+ }
13423
+ function FromMap(value) {
13424
+ return new Map(FromValue2([...value.entries()]));
13425
+ }
13426
+ function FromSet(value) {
13427
+ return new Set(FromValue2([...value.values()]));
13428
+ }
13429
+ function FromValue2(value) {
13430
+ 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;
13431
+ }
13432
+ function Deep(value) {
13433
+ return FromValue2(value);
13434
+ }
13435
+ var init_deep = __esm(() => {
13436
+ init_guard2();
13437
+ });
13438
+
13304
13439
  // node_modules/typebox/build/value/clone/clone.mjs
13305
- function Clone2(value) {
13306
- return Clone(value);
13440
+ function Clone(value) {
13441
+ return Deep(value);
13307
13442
  }
13308
13443
  var init_clone2 = __esm(() => {
13309
- init_clone();
13444
+ init_deep();
13310
13445
  });
13311
13446
 
13312
13447
  // node_modules/typebox/build/value/clone/index.mjs
@@ -13317,7 +13452,7 @@ var init_clone3 = __esm(() => {
13317
13452
  // node_modules/typebox/build/value/clean/from_union.mjs
13318
13453
  function FromUnion9(context, type, value) {
13319
13454
  for (const schema of type.anyOf) {
13320
- const clean = FromType19(context, schema, Clone2(value));
13455
+ const clean = FromType19(context, schema, Clone(value));
13321
13456
  if (Check2(context, schema, clean))
13322
13457
  return clean;
13323
13458
  }
@@ -13331,7 +13466,7 @@ var init_from_union7 = __esm(() => {
13331
13466
 
13332
13467
  // node_modules/typebox/build/value/clean/from_type.mjs
13333
13468
  function FromType19(context, type, value) {
13334
- 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;
13469
+ 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;
13335
13470
  }
13336
13471
  var init_from_type11 = __esm(() => {
13337
13472
  init_type3();
@@ -13347,12 +13482,7 @@ var init_from_type11 = __esm(() => {
13347
13482
 
13348
13483
  // node_modules/typebox/build/value/shared/union_priority_sort.mjs
13349
13484
  function Modifiers(type, next) {
13350
- for (const key of Keys(type)) {
13351
- if (HasPropertyKey(next, key))
13352
- continue;
13353
- next[key] = type[key];
13354
- }
13355
- return next;
13485
+ return Assign(type, next);
13356
13486
  }
13357
13487
  function FromProperties4(properties) {
13358
13488
  const result = {};
@@ -13379,6 +13509,7 @@ function UnionPrioritySort(type) {
13379
13509
  }
13380
13510
  var init_union_priority_sort = __esm(() => {
13381
13511
  init_guard2();
13512
+ init_memory2();
13382
13513
  init_type3();
13383
13514
  init_type3();
13384
13515
  init_type3();
@@ -13823,7 +13954,7 @@ function FromUnion10(context, type, value) {
13823
13954
  const matched = type.anyOf.some((type) => Check2(context, type, value));
13824
13955
  if (matched)
13825
13956
  return value;
13826
- const candidates = type.anyOf.map((type) => FromType21(context, type, Clone2(value)));
13957
+ const candidates = type.anyOf.map((type) => FromType21(context, type, Clone(value)));
13827
13958
  const selected = candidates.find((value) => Check2(context, type, value));
13828
13959
  return IsUndefined(selected) ? value : selected;
13829
13960
  }
@@ -13915,7 +14046,7 @@ var init_from_cyclic8 = __esm(() => {
13915
14046
  function FromDefault(type, value) {
13916
14047
  if (!IsUndefined(value))
13917
14048
  return value;
13918
- return IsFunction(type.default) ? type.default() : Clone2(type.default);
14049
+ return IsFunction(type.default) ? type.default() : Clone(type.default);
13919
14050
  }
13920
14051
  var init_from_default = __esm(() => {
13921
14052
  init_guard2();
@@ -14015,7 +14146,7 @@ var init_from_tuple7 = __esm(() => {
14015
14146
  // node_modules/typebox/build/value/default/from_union.mjs
14016
14147
  function FromUnion11(context, schema, value) {
14017
14148
  for (const inner of schema.anyOf) {
14018
- const result = FromType22(context, inner, Clone2(value));
14149
+ const result = FromType22(context, inner, Clone(value));
14019
14150
  if (Check2(context, inner, result)) {
14020
14151
  return result;
14021
14152
  }
@@ -14152,7 +14283,7 @@ function NonMatchingInterior(value, interiors) {
14152
14283
  function Decode5(direction, context, type, value) {
14153
14284
  if (IsEqual(type.allOf.length, 0))
14154
14285
  return Callback(direction, context, type, value);
14155
- const interiors = type.allOf.map((schema) => FromType23(direction, context, schema, Clean(schema, Clone2(value))));
14286
+ const interiors = type.allOf.map((schema) => FromType23(direction, context, schema, Clean(schema, Clone(value))));
14156
14287
  const structural = interiors.every((result) => IsObject(result));
14157
14288
  const exterior = structural ? MergeInteriors(interiors) : NonMatchingInterior(value, interiors);
14158
14289
  return Callback(direction, context, type, exterior);
@@ -14161,7 +14292,7 @@ function Encode5(direction, context, type, value) {
14161
14292
  if (IsEqual(type.allOf.length, 0))
14162
14293
  return Callback(direction, context, type, value);
14163
14294
  const exterior = Callback(direction, context, type, value);
14164
- const interiors = type.allOf.map((schema) => FromType23(direction, context, schema, Clean(schema, Clone2(exterior))));
14295
+ const interiors = type.allOf.map((schema) => FromType23(direction, context, schema, Clean(schema, Clone(exterior))));
14165
14296
  const structural = interiors.every((result) => IsObject(result));
14166
14297
  if (structural)
14167
14298
  return MergeInteriors(interiors);
@@ -14297,7 +14428,7 @@ function Decode9(direction, context, type, value) {
14297
14428
  function Encode9(direction, context, type, value) {
14298
14429
  const exterior = Callback(direction, context, type, value);
14299
14430
  for (const schema of type.anyOf) {
14300
- const variant = FromType23(direction, context, schema, Clone2(exterior));
14431
+ const variant = FromType23(direction, context, schema, Clone(exterior));
14301
14432
  if (!Check2(context, schema, variant))
14302
14433
  continue;
14303
14434
  return variant;
@@ -14361,7 +14492,7 @@ var init_decode2 = __esm(() => {
14361
14492
  }
14362
14493
  };
14363
14494
  Decoder = Pipeline([
14364
- (_context, _type, value) => Clone2(value),
14495
+ (_context, _type, value) => Clone(value),
14365
14496
  (context, type, value) => Default(context, type, value),
14366
14497
  (context, type, value) => Convert(context, type, value),
14367
14498
  (context, type, value) => Clean(context, type, value),
@@ -14399,7 +14530,7 @@ var init_encode2 = __esm(() => {
14399
14530
  }
14400
14531
  };
14401
14532
  Encoder = Pipeline([
14402
- (_context, _type, value) => Clone2(value),
14533
+ (_context, _type, value) => Clone(value),
14403
14534
  (context, type, value) => EncodeUnsafe(context, type, value),
14404
14535
  (context, type, value) => Default(context, type, value),
14405
14536
  (context, type, value) => Convert(context, type, value),
@@ -14618,7 +14749,7 @@ var init_parse2 = __esm(() => {
14618
14749
  }
14619
14750
  };
14620
14751
  Parser = Pipeline([
14621
- (_context, _type, value) => Clone2(value),
14752
+ (_context, _type, value) => Clone(value),
14622
14753
  (context, type, value) => Default(context, type, value),
14623
14754
  (context, type, value) => Convert(context, type, value),
14624
14755
  (context, type, value) => Clean(context, type, value),
@@ -17276,7 +17407,7 @@ async function applyDiagnosticFix(fix, options = {}) {
17276
17407
  throw new Error("Command mode fix requires an explicit property and policy value");
17277
17408
  }
17278
17409
  const object = decoratorObject(findClass(source, fix.command), "Command");
17279
- const current = property(object, fix.property);
17410
+ const current = property2(object, fix.property);
17280
17411
  if (!current || current.initializer.getText(source) !== fix.expectedExpression) {
17281
17412
  throw new Error("Command mode changed since diagnosis; analyze the project again");
17282
17413
  }
@@ -17290,7 +17421,7 @@ async function applyDiagnosticFix(fix, options = {}) {
17290
17421
  const withImport = importSymbol(source, fix.importPath, fix.symbol);
17291
17422
  source = parse5(file, withImport);
17292
17423
  const object = unique(moduleObjects(source).filter((candidate) => !fix.targetModule || stringProperty(candidate, "name") === fix.targetModule), "target module");
17293
- const imports = property(object, "imports");
17424
+ const imports = property2(object, "imports");
17294
17425
  if (imports && !ts16.isArrayLiteralExpression(imports.initializer)) {
17295
17426
  throw new Error("Module imports must be a static array");
17296
17427
  }
@@ -17310,7 +17441,7 @@ async function applyDiagnosticFix(fix, options = {}) {
17310
17441
  }
17311
17442
  const command = findClass(source, fix.command);
17312
17443
  const object = decoratorObject(command, "Command");
17313
- const current = property(object, "permission");
17444
+ const current = property2(object, "permission");
17314
17445
  if (current && (!ts16.isStringLiteral(current.initializer) || current.initializer.text !== permission)) {
17315
17446
  throw new Error("Command permission already exists with a different value");
17316
17447
  }
@@ -17380,7 +17511,7 @@ function nameOf(name) {
17380
17511
  return "";
17381
17512
  return ts16.isIdentifier(name) || ts16.isStringLiteral(name) || ts16.isNumericLiteral(name) ? name.text : "";
17382
17513
  }
17383
- function property(object, key) {
17514
+ function property2(object, key) {
17384
17515
  if (object.properties.some((item) => !ts16.isPropertyAssignment(item) || ts16.isComputedPropertyName(item.name))) {
17385
17516
  throw new Error("Fix requires explicit static object properties");
17386
17517
  }
@@ -17390,11 +17521,11 @@ function property(object, key) {
17390
17521
  return values[0];
17391
17522
  }
17392
17523
  function stringProperty(object, key) {
17393
- const value = property(object, key)?.initializer;
17524
+ const value = property2(object, key)?.initializer;
17394
17525
  return value && ts16.isStringLiteral(value) ? value.text : undefined;
17395
17526
  }
17396
17527
  function replaceProperty(source, object, key, value) {
17397
- const previous = property(object, key);
17528
+ const previous = property2(object, key);
17398
17529
  const replacement = ts16.factory.createPropertyAssignment(key, value);
17399
17530
  const properties = object.properties.map((item) => item === previous ? replacement : item);
17400
17531
  if (!previous)
@@ -19547,10 +19678,12 @@ function parseModule(candidate, nameByNode, ctx) {
19547
19678
  if (queryDec) {
19548
19679
  const meta = decoratorObjectArg(queryDec);
19549
19680
  if (meta) {
19681
+ const permission = stringLiteralProp(meta, "permission");
19550
19682
  const tenantScope = commandModeProp(meta, "tenantScope");
19551
19683
  queries.push({
19552
19684
  className: cls.name?.text ?? "<anonymous>",
19553
19685
  name: stringLiteralProp(meta, "name") ?? cls.name?.text ?? "<anonymous>",
19686
+ ...permission === undefined ? {} : { permission },
19554
19687
  ...tenantScope === undefined ? {} : { tenantScope }
19555
19688
  });
19556
19689
  }
@@ -19611,11 +19744,23 @@ function parseFeatureSpec(input, ctx, seen = new Set) {
19611
19744
  if (databaseExpr !== undefined && database === undefined)
19612
19745
  return invalid();
19613
19746
  const tenantField = stringLiteralProp(input, "tenantField");
19747
+ const readPermission = stringLiteralProp(input, "readPermission");
19748
+ const requiredAdaptersExpr = getProp(input, "requiredAdapters");
19749
+ const requiredAdapterScopesExpr = getProp(input, "requiredAdapterScopes");
19614
19750
  const statesExpr = getProp(input, "states");
19615
19751
  const transitionObject = getProp(input, "transitions");
19616
19752
  if (!name || !statesExpr || !ts7.isArrayLiteralExpression(statesExpr) || statesExpr.elements.some((state) => !ts7.isStringLiteral(state)) || !transitionObject || !ts7.isObjectLiteralExpression(transitionObject) || input.properties.some((property) => !ts7.isPropertyAssignment(property))) {
19617
19753
  return invalid();
19618
19754
  }
19755
+ 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;
19756
+ if (requiredAdaptersExpr !== undefined && requiredAdapters === undefined)
19757
+ return invalid();
19758
+ 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) => [
19759
+ propertyName(property.name),
19760
+ property.initializer.getText().slice(1, -1)
19761
+ ])) : undefined;
19762
+ if (requiredAdapterScopesExpr !== undefined && requiredAdapterScopes === undefined)
19763
+ return invalid();
19619
19764
  const states = [];
19620
19765
  for (const state of statesExpr.elements) {
19621
19766
  if (!ts7.isStringLiteral(state))
@@ -19671,6 +19816,9 @@ function parseFeatureSpec(input, ctx, seen = new Set) {
19671
19816
  states,
19672
19817
  ...database === undefined ? {} : { database },
19673
19818
  ...tenantField === undefined ? {} : { tenantField },
19819
+ ...readPermission === undefined ? {} : { readPermission },
19820
+ ...requiredAdapters === undefined ? {} : { requiredAdapters },
19821
+ ...requiredAdapterScopes === undefined ? {} : { requiredAdapterScopes },
19674
19822
  transitions,
19675
19823
  file: sourcePath(ctx.rootDir, input.getSourceFile().fileName),
19676
19824
  line: lineOf(input)
@@ -20607,6 +20755,9 @@ function parseController(input, ctx) {
20607
20755
  const optionsArg = args[1];
20608
20756
  const optionsObject = resolveStaticObjectLiteral(optionsArg, ctx);
20609
20757
  if (optionsObject) {
20758
+ const permission = stringLiteralProp(optionsObject, "permission");
20759
+ if (permission !== undefined)
20760
+ route.permission = permission;
20610
20761
  const parsePolicy = routePolicyProperty(optionsObject, "parse", ctx);
20611
20762
  const deletePolicy = routePolicyProperty(optionsObject, "allowDeleteBody", ctx);
20612
20763
  const idempotency = checkedRouteIdempotency(optionsObject, ctx, route.handler);
@@ -24688,10 +24839,10 @@ import { readFileSync as readFileSync4 } from "node:fs";
24688
24839
  import { resolve as resolve17 } from "node:path";
24689
24840
 
24690
24841
  // src/migration-app-version.ts
24691
- var MIGRATION_APP_VERSION = "0.31.1";
24842
+ var MIGRATION_APP_VERSION = "0.33.0";
24692
24843
 
24693
24844
  // src/migration-elysia-version.ts
24694
- var MIGRATION_ELYSIA_VERSION = "0.35.2";
24845
+ var MIGRATION_ELYSIA_VERSION = "0.36.1";
24695
24846
 
24696
24847
  // src/migration-policy.ts
24697
24848
  var cachedCompilerVersion;
@@ -24710,7 +24861,7 @@ function migrationDependencies() {
24710
24861
  "@supacloud/app": MIGRATION_APP_VERSION,
24711
24862
  "@supacloud/compiler": compilerVersion(),
24712
24863
  "@supacloud/elysia": MIGRATION_ELYSIA_VERSION,
24713
- elysia: "2.0.0-beta.32",
24864
+ elysia: "2.0.0-rc.0",
24714
24865
  typescript: "7.0.2"
24715
24866
  };
24716
24867
  }