@stndrds/schema 1.0.0-alpha.281 → 1.0.0-alpha.284

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/all-DanoPxKr.d.ts +879 -0
  2. package/dist/all-bG_ha0VV.d.mts +879 -0
  3. package/dist/{attributes-D8eHv5Kf.d.ts → attributes-CNYwg_Nr.d.ts} +14 -13
  4. package/dist/{attributes--M1ifW8_.d.mts → attributes-CWPLbp7c.d.mts} +14 -13
  5. package/dist/capabilities.d.mts +146 -0
  6. package/dist/capabilities.d.ts +146 -0
  7. package/dist/capabilities.js +77 -0
  8. package/dist/capabilities.mjs +70 -0
  9. package/dist/{chunk-A5PPZ2FM.mjs → chunk-5OBQRDRM.mjs} +7 -3
  10. package/dist/{chunk-ORPCS24B.mjs → chunk-AGRAFDGU.mjs} +72 -16
  11. package/dist/{chunk-LRFLSFIA.js → chunk-BOICAZHR.js} +9 -4
  12. package/dist/{chunk-E47WAI5K.js → chunk-I3EYILYO.js} +5 -5
  13. package/dist/{chunk-OYHBQMC7.js → chunk-K6ET4CXP.js} +3 -3
  14. package/dist/{chunk-MLTXSBOB.mjs → chunk-PNOWKRH2.mjs} +2 -2
  15. package/dist/{chunk-XCLVXM7F.mjs → chunk-R57T4UDX.mjs} +1 -1
  16. package/dist/{chunk-SYQDFZ74.mjs → chunk-RUO25ERR.mjs} +36 -0
  17. package/dist/{chunk-HWZRSXFB.js → chunk-V26R64A4.js} +36 -0
  18. package/dist/{chunk-TU6ECJFZ.js → chunk-YZ5RCMIQ.js} +112 -45
  19. package/dist/exceptions.d.mts +24 -3
  20. package/dist/exceptions.d.ts +24 -3
  21. package/dist/exceptions.js +39 -39
  22. package/dist/exceptions.mjs +1 -1
  23. package/dist/{helpers-DyoPqiSz.d.ts → helpers-CXkVwpsl.d.ts} +3 -3
  24. package/dist/{helpers-BiABdSxK.d.mts → helpers-Dul_r9rJ.d.mts} +3 -3
  25. package/dist/{index-DWoqObyG.d.mts → index-Ca-MzQuU.d.mts} +46 -6
  26. package/dist/{index-TMlrIKAY.d.ts → index-Ns6KGfrZ.d.ts} +46 -6
  27. package/dist/index.d.mts +1508 -357
  28. package/dist/index.d.ts +1508 -357
  29. package/dist/index.js +1396 -363
  30. package/dist/index.mjs +1072 -124
  31. package/dist/{migrations-B1kkIhIX.d.ts → migrations-DaFneOfx.d.ts} +1 -1
  32. package/dist/{migrations-BNlQVzDC.d.mts → migrations-fRvadl6i.d.mts} +1 -1
  33. package/dist/{objects-DmMqHn3L.d.mts → objects-CDwMSnqv.d.mts} +2 -4
  34. package/dist/{objects-DgFojgwH.d.ts → objects-DJv6WrDE.d.ts} +2 -4
  35. package/dist/{types-DHqXzkgW.d.mts → types-CVYiFc69.d.mts} +1 -1
  36. package/dist/{types-DYYFto8d.d.ts → types-NGEww_ln.d.ts} +1 -1
  37. package/dist/utils.js +8 -8
  38. package/dist/utils.mjs +2 -2
  39. package/dist/validation/all.d.mts +7 -7
  40. package/dist/validation/all.d.ts +7 -7
  41. package/dist/validation/all.js +46 -46
  42. package/dist/validation/all.mjs +5 -5
  43. package/dist/validation/complex/currency.d.mts +2 -2
  44. package/dist/validation/complex/currency.d.ts +2 -2
  45. package/dist/validation/complex/location.d.mts +2 -2
  46. package/dist/validation/complex/location.d.ts +2 -2
  47. package/dist/validation/complex/phone.d.mts +2 -2
  48. package/dist/validation/complex/phone.d.ts +2 -2
  49. package/dist/validation/complex/relation.d.mts +2 -2
  50. package/dist/validation/complex/relation.d.ts +2 -2
  51. package/dist/validation/complex/richtext.d.mts +2 -2
  52. package/dist/validation/complex/richtext.d.ts +2 -2
  53. package/dist/validation/complex/select.d.mts +2 -2
  54. package/dist/validation/complex/select.d.ts +2 -2
  55. package/dist/validation/complex/user.d.mts +2 -2
  56. package/dist/validation/complex/user.d.ts +2 -2
  57. package/dist/validation/computed/formula.d.mts +2 -2
  58. package/dist/validation/computed/formula.d.ts +2 -2
  59. package/dist/validation/computed/rollup.d.mts +2 -2
  60. package/dist/validation/computed/rollup.d.ts +2 -2
  61. package/dist/validation/config/index.d.mts +4 -4
  62. package/dist/validation/config/index.d.ts +4 -4
  63. package/dist/validation/config/index.js +15 -11
  64. package/dist/validation/config/index.mjs +2 -2
  65. package/dist/validation/core/index.d.mts +3 -3
  66. package/dist/validation/core/index.d.ts +3 -3
  67. package/dist/validation/object/index.d.mts +5 -5
  68. package/dist/validation/object/index.d.ts +5 -5
  69. package/dist/validation/object/index.js +15 -15
  70. package/dist/validation/object/index.mjs +3 -3
  71. package/dist/validation/primitives/checkbox.d.mts +2 -2
  72. package/dist/validation/primitives/checkbox.d.ts +2 -2
  73. package/dist/validation/primitives/date.d.mts +2 -2
  74. package/dist/validation/primitives/date.d.ts +2 -2
  75. package/dist/validation/primitives/number.d.mts +2 -2
  76. package/dist/validation/primitives/number.d.ts +2 -2
  77. package/dist/validation/primitives/text.d.mts +2 -2
  78. package/dist/validation/primitives/text.d.ts +2 -2
  79. package/package.json +10 -5
  80. package/dist/all-BVp3k9Hi.d.ts +0 -471
  81. package/dist/all-CnIU2anT.d.mts +0 -471
@@ -1,5 +1,5 @@
1
- import { SCHEMA_LIMITS, iconNameSchema } from './chunk-A5PPZ2FM.mjs';
2
- import { ValidationError } from './chunk-SYQDFZ74.mjs';
1
+ import { SCHEMA_LIMITS, iconNameSchema } from './chunk-5OBQRDRM.mjs';
2
+ import { ValidationError } from './chunk-RUO25ERR.mjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  // src/types/system-attributes.ts
@@ -959,20 +959,25 @@ var fieldPresentationShape = {
959
959
  label: z.string().optional(),
960
960
  readOnly: z.boolean().optional()
961
961
  };
962
- var fieldSchema = z.object({
963
- /** Stable slot identity. Optional: a builder may omit it, `ensureFieldIds` assigns it. */
964
- id: z.string().optional(),
962
+ var fieldShape = {
965
963
  attribute: z.string().optional(),
966
964
  attributeGroup: attributeGroupFieldSchema.optional(),
967
965
  ...fieldPresentationShape
968
- }).strict().superRefine((field, ctx) => {
966
+ };
967
+ function refineField(field, ctx) {
969
968
  if (field.attribute === void 0 === (field.attributeGroup === void 0)) {
970
969
  ctx.addIssue({
971
970
  code: "custom",
972
971
  message: "A field must define exactly one of attribute or attributeGroup"
973
972
  });
974
973
  }
975
- });
974
+ }
975
+ var fieldSchema = z.object({
976
+ /** Stable slot identity. Optional: a builder may omit it, `ensureFieldIds` assigns it. */
977
+ id: z.string().optional(),
978
+ ...fieldShape
979
+ }).strict().superRefine(refineField);
980
+ var fieldSlotSchema = z.object({ id: z.string().min(1), ...fieldShape }).strict().superRefine(refineField);
976
981
  var baseGroupShape = {
977
982
  id: z.string(),
978
983
  label: z.string(),
@@ -994,13 +999,16 @@ var baseTabShape = {
994
999
  icon: iconNameSchema.optional(),
995
1000
  order: z.number().optional()
996
1001
  };
997
- var formTabWriteSchema = z.object({
1002
+ var formTabGroupsSchema = z.array(groupWriteSchema).max(SCHEMA_LIMITS.groupsPerFormTab);
1003
+ var formTabShape = {
998
1004
  ...baseTabShape,
999
1005
  type: z.literal("form"),
1000
- groups: z.array(groupWriteSchema).min(1).max(SCHEMA_LIMITS.groupsPerFormTab),
1006
+ groups: formTabGroupsSchema,
1001
1007
  formColumns: z.union([z.literal(1), z.literal(2), z.literal(3)]).optional(),
1002
1008
  density: z.enum(["compact", "comfortable", "spacious"]).optional()
1003
- }).strict().superRefine((tab, ctx) => {
1009
+ };
1010
+ var formTabDraftObjectSchema = z.object(formTabShape).strict();
1011
+ function refineFormTab(tab, ctx) {
1004
1012
  addDuplicateIdIssues(tab.groups, ctx, ["groups"]);
1005
1013
  const totalFields = tab.groups.reduce(
1006
1014
  (count, group) => count + (group.type === "fields" ? group.fields.length : 0),
@@ -1032,7 +1040,9 @@ var formTabWriteSchema = z.object({
1032
1040
  seenAttributeGroupIds.add(id);
1033
1041
  });
1034
1042
  });
1035
- });
1043
+ }
1044
+ var formTabWriteSchema = z.object({ ...formTabShape, groups: formTabGroupsSchema.min(1) }).strict().superRefine(refineFormTab);
1045
+ var formTabDraftSchema = formTabDraftObjectSchema.superRefine(refineFormTab);
1036
1046
  var relationSourceSchema = z.object({
1037
1047
  type: z.literal("relation"),
1038
1048
  attribute: z.string()
@@ -1221,8 +1231,7 @@ var meetingsTabSchema = z.object({
1221
1231
  type: z.literal("meetings"),
1222
1232
  emailAttributeIds: z.array(z.string()).max(SCHEMA_LIMITS.emailAttributesPerTab)
1223
1233
  }).strict();
1224
- var detailTabSchema = z.discriminatedUnion("type", [
1225
- formTabWriteSchema,
1234
+ var nonFormDetailTabSchemas = [
1226
1235
  tableTabSchema,
1227
1236
  customTabSchema,
1228
1237
  activityTabSchema,
@@ -1231,6 +1240,14 @@ var detailTabSchema = z.discriminatedUnion("type", [
1231
1240
  formsTabSchema,
1232
1241
  emailsTabSchema,
1233
1242
  meetingsTabSchema
1243
+ ];
1244
+ var detailTabSchema = z.discriminatedUnion("type", [
1245
+ formTabWriteSchema,
1246
+ ...nonFormDetailTabSchemas
1247
+ ]);
1248
+ var detailTabDraftSchema = z.discriminatedUnion("type", [
1249
+ formTabDraftSchema,
1250
+ ...nonFormDetailTabSchemas
1234
1251
  ]);
1235
1252
  var listTabCommonShape = {
1236
1253
  id: z.string(),
@@ -1285,12 +1302,42 @@ var _listViewConfigSchema = z.object({
1285
1302
  hasDefault = true;
1286
1303
  });
1287
1304
  });
1305
+ var sidePanelPaneSchema = z.discriminatedUnion("kind", [
1306
+ z.object({
1307
+ kind: z.literal("fields"),
1308
+ id: z.string().optional(),
1309
+ label: z.string().optional(),
1310
+ attributes: z.array(z.string()).max(SCHEMA_LIMITS.sidePanelAttributes)
1311
+ }).strict(),
1312
+ z.object({
1313
+ kind: z.literal("activity"),
1314
+ id: z.string().optional(),
1315
+ label: z.string().optional()
1316
+ }).strict(),
1317
+ z.object({
1318
+ kind: z.literal("documents"),
1319
+ // Required here alone: the documents content keys its stored sort mode
1320
+ // on this id, so a pane without one would share the main-column
1321
+ // documents tab's sort.
1322
+ id: z.string(),
1323
+ label: z.string().optional(),
1324
+ allowUpload: z.boolean().optional(),
1325
+ allowRemove: z.boolean().optional()
1326
+ }).strict()
1327
+ ]);
1288
1328
  var _detailViewConfigSchema = z.object({
1289
1329
  tabs: z.array(detailTabSchema).min(1).max(SCHEMA_LIMITS.tabsPerView),
1290
1330
  sidePanel: z.object({
1291
- attributes: z.array(z.string()).max(SCHEMA_LIMITS.sidePanelAttributes),
1331
+ attributes: z.array(z.string()).max(SCHEMA_LIMITS.sidePanelAttributes).optional(),
1332
+ panes: z.array(sidePanelPaneSchema).max(SCHEMA_LIMITS.sidePanelPanes).optional(),
1292
1333
  width: z.number().optional()
1293
- }).strict().optional()
1334
+ }).strict().refine((sidePanel) => sidePanel.attributes !== void 0 || sidePanel.panes !== void 0, {
1335
+ message: "sidePanel requires attributes or panes"
1336
+ }).refine((sidePanel) => sidePanel.panes === void 0 || sidePanel.panes.length > 0, {
1337
+ message: "sidePanel panes must not be empty"
1338
+ }).refine((sidePanel) => sidePanel.attributes === void 0 || sidePanel.panes === void 0, {
1339
+ message: "sidePanel takes attributes or panes, not both"
1340
+ }).optional()
1294
1341
  }).strict().superRefine((config, ctx) => {
1295
1342
  addDuplicateIdIssues(config.tabs, ctx, ["tabs"]);
1296
1343
  addDuplicateNameIssues(config.tabs, ctx, ["tabs"]);
@@ -1318,5 +1365,14 @@ function parseViewConfig(type, input) {
1318
1365
  return viewConfigByTypeSchema.parse({ type, config: input }).config;
1319
1366
  }
1320
1367
  }
1368
+ var LIST_TAB_TABLE_KEYS = ["columnSizing"];
1369
+ var LIST_TAB_KANBAN_KEYS = [
1370
+ "groupByAttribute",
1371
+ "cardUserAttribute",
1372
+ "cardDateAttribute",
1373
+ "kanbanColumnOrder",
1374
+ "kanbanColumnVisibility",
1375
+ "kanbanPinnedColumns"
1376
+ ];
1321
1377
 
1322
- export { ATTRIBUTE_FILTER_OPERATORS, LIST_VIEW_TAB_VISIBILITIES, NO_VALUE_OPERATORS, OPERATORS_BY_TYPE, REMOVED_OPERATOR_REPLACEMENTS, RESERVED_ATTRIBUTE_NAMES, RESERVED_OBJECT_NAMES, RESOURCE_VISIBILITIES, SYNONYM_ALIASES, SYSTEM_ATTRIBUTES, SYSTEM_ATTRIBUTE_I18N_KEYS, SYSTEM_FIELD_NAMES, SYSTEM_FILTER_ATTRIBUTE_TYPES, canonicalizeFilterValue, collectQualifiedRuleIssues, currentActor, detailTabSchema, detailViewConfigSchema, extractCurrencyFilterValue, extractFilterValue, getAttributeCapabilities, getAttributeFilterOperators, getOperatorPolarity, getRollupFilterOperators2 as getRollupFilterOperators, getSystemAttributeI18nKey, getSystemAttributeList, inverseSourceSchema, isAttributeFilterable, isAttributeGroupable, isAttributeKanbanGroupable, isAttributeSearchable, isAttributeSortable, isDynamicValue, isManagedSystemAttribute, isNoValueOperator, isRelativeDateValue, isSetMembershipOperator, listViewConfigSchema, listViewTabSchema, normalizeFilterRule, normalizeForEdgeRpc, normalizeOperator, now, parseResourceVisibility, parseViewConfig, relationSourceSchema, resolveEffectiveFilterType, resolveIsWithinBounds, resolveUtcDayBounds, tableSourceSchema, toMultiValueOperator, toUtcDayString, today, validateQualifiedRule, viewConfigByTypeSchema, viewTypeSchema };
1378
+ export { ATTRIBUTE_FILTER_OPERATORS, LIST_TAB_KANBAN_KEYS, LIST_TAB_TABLE_KEYS, LIST_VIEW_TAB_VISIBILITIES, NO_VALUE_OPERATORS, OPERATORS_BY_TYPE, REMOVED_OPERATOR_REPLACEMENTS, RESERVED_ATTRIBUTE_NAMES, RESERVED_OBJECT_NAMES, RESOURCE_VISIBILITIES, SYNONYM_ALIASES, SYSTEM_ATTRIBUTES, SYSTEM_ATTRIBUTE_I18N_KEYS, SYSTEM_FIELD_NAMES, SYSTEM_FILTER_ATTRIBUTE_TYPES, canonicalizeFilterValue, collectQualifiedRuleIssues, columnsSchema, currentActor, detailTabDraftSchema, detailTabSchema, detailViewConfigSchema, extractCurrencyFilterValue, extractFilterValue, fieldSchema, fieldShape, fieldSlotSchema, filterGroupSchema, filterStateSchema, getAttributeCapabilities, getAttributeFilterOperators, getOperatorPolarity, getRollupFilterOperators2 as getRollupFilterOperators, getSystemAttributeI18nKey, getSystemAttributeList, groupWriteSchema, inverseSourceSchema, isAttributeFilterable, isAttributeGroupable, isAttributeKanbanGroupable, isAttributeSearchable, isAttributeSortable, isDynamicValue, isManagedSystemAttribute, isNoValueOperator, isRelativeDateValue, isSetMembershipOperator, listViewConfigSchema, listViewTabSchema, normalizeFilterRule, normalizeForEdgeRpc, normalizeOperator, now, parseResourceVisibility, parseViewConfig, relationSourceSchema, resolveEffectiveFilterType, resolveIsWithinBounds, resolveUtcDayBounds, sortsSchema, tableSourceSchema, toMultiValueOperator, toUtcDayString, today, validateQualifiedRule, viewConfigByTypeSchema, viewTypeSchema };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHWZRSXFB_js = require('./chunk-HWZRSXFB.js');
3
+ var chunkV26R64A4_js = require('./chunk-V26R64A4.js');
4
4
  var zod = require('zod');
5
5
  var constants = require('@stndrds/constants');
6
6
 
@@ -318,6 +318,7 @@ var SCHEMA_LIMITS = {
318
318
  columnsPerTab: 50,
319
319
  optionsPerAttribute: 200,
320
320
  sidePanelAttributes: 100,
321
+ sidePanelPanes: 20,
321
322
  filterRulesPerTab: 50,
322
323
  sortsPerTab: 20,
323
324
  emailAttributesPerTab: 30,
@@ -512,6 +513,9 @@ var rollupConfigSchema = baseConfigSchema.extend({
512
513
  decimals: zod.z.number().int().min(0).max(10).optional(),
513
514
  targetAttributeType: zod.z.string().optional(),
514
515
  targetAttributeOptions: zod.z.array(optionSchema).optional(),
516
+ // The sum's symbol (#2644) — declared here or `.strip()` eats it before
517
+ // storage, exactly the fate this schema spares its two siblings above.
518
+ targetCurrencyCode: zod.z.string().length(3).optional(),
515
519
  optionsSource: computedOptionsSourceSchema.optional()
516
520
  });
517
521
  var propertySchemaPassthrough = zod.z.object({ definitions: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown())) }).passthrough();
@@ -547,7 +551,7 @@ var attributeConfigSchemas = {
547
551
  function getAttributeConfigSchema(type) {
548
552
  const schema = attributeConfigSchemas[type];
549
553
  if (!schema) {
550
- throw new Error(`Unsupported attribute type: ${type}`);
554
+ throw new chunkV26R64A4_js.ValidationError(`Unsupported attribute type: ${type}`, []);
551
555
  }
552
556
  return schema;
553
557
  }
@@ -571,7 +575,7 @@ function getAttributeConfigWriteSchema(type) {
571
575
  }
572
576
  }
573
577
  function validationErrorFromIssues(issues) {
574
- return chunkHWZRSXFB_js.ValidationError.fromZodErrors(
578
+ return chunkV26R64A4_js.ValidationError.fromZodErrors(
575
579
  issues.map((issue) => ({
576
580
  path: issue.path.map((segment) => typeof segment === "symbol" ? String(segment) : segment),
577
581
  message: issue.message
@@ -594,7 +598,7 @@ function validatePatchedIcon(patch) {
594
598
  }
595
599
  const result = iconNameSchema.optional().safeParse(patch.icon);
596
600
  if (!result.success) {
597
- throw chunkHWZRSXFB_js.ValidationError.fromZodErrors(
601
+ throw chunkV26R64A4_js.ValidationError.fromZodErrors(
598
602
  result.error.issues.map((issue) => ({
599
603
  path: [
600
604
  "icon",
@@ -641,6 +645,7 @@ exports.SCHEMA_LIMITS = SCHEMA_LIMITS;
641
645
  exports.attributeConfigSchemas = attributeConfigSchemas;
642
646
  exports.colorIdSchema = colorIdSchema;
643
647
  exports.getAttributeConfigSchema = getAttributeConfigSchema;
648
+ exports.getAttributeConfigWriteSchema = getAttributeConfigWriteSchema;
644
649
  exports.iconNameSchema = iconNameSchema;
645
650
  exports.multiselectOptionWriteSchema = multiselectOptionWriteSchema;
646
651
  exports.parseAttributeConfig = parseAttributeConfig;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var chunkEEH4XQ7W_js = require('./chunk-EEH4XQ7W.js');
3
4
  var chunkEW5XR2X3_js = require('./chunk-EW5XR2X3.js');
4
5
  var chunkQWKLQRBX_js = require('./chunk-QWKLQRBX.js');
5
6
  var chunkKNGWHQLR_js = require('./chunk-KNGWHQLR.js');
@@ -9,11 +10,10 @@ var chunk5WATIVCA_js = require('./chunk-5WATIVCA.js');
9
10
  var chunkSI34M4IC_js = require('./chunk-SI34M4IC.js');
10
11
  var chunkYIP5FJ5H_js = require('./chunk-YIP5FJ5H.js');
11
12
  var chunkZPFOKBIN_js = require('./chunk-ZPFOKBIN.js');
12
- var chunkHWZRSXFB_js = require('./chunk-HWZRSXFB.js');
13
+ var chunkV26R64A4_js = require('./chunk-V26R64A4.js');
13
14
  var chunkACKMC6FL_js = require('./chunk-ACKMC6FL.js');
14
15
  var chunkE6JUYGJX_js = require('./chunk-E6JUYGJX.js');
15
16
  var chunkQ4SZAMJT_js = require('./chunk-Q4SZAMJT.js');
16
- var chunkEEH4XQ7W_js = require('./chunk-EEH4XQ7W.js');
17
17
  var chunkYKWSHBT5_js = require('./chunk-YKWSHBT5.js');
18
18
  var zod = require('zod');
19
19
 
@@ -162,7 +162,7 @@ function validateObjectOrThrow(objectDef, data) {
162
162
  if (!result.success) {
163
163
  const errors = result.errors ?? [];
164
164
  const detail = errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("\n") || "Unknown validation error";
165
- throw new chunkHWZRSXFB_js.ValidationError(
165
+ throw new chunkV26R64A4_js.ValidationError(
166
166
  `Validation failed for ${objectDef.label}:
167
167
  ${detail}`,
168
168
  errors.map((err) => ({ path: err.path, message: err.message }))
@@ -189,7 +189,7 @@ function validateDraftOrThrow(objectDef, data) {
189
189
  if (!result.success) {
190
190
  const errors = result.errors ?? [];
191
191
  const detail = errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("\n") || "Unknown validation error";
192
- throw new chunkHWZRSXFB_js.ValidationError(
192
+ throw new chunkV26R64A4_js.ValidationError(
193
193
  `Draft validation failed for ${objectDef.label}:
194
194
  ${detail}`,
195
195
  errors.map((err) => ({ path: err.path, message: err.message }))
@@ -201,7 +201,7 @@ function rejectUnknownAttributesOrThrow(objectDef, data) {
201
201
  const knownNames = new Set(objectDef.attributes.map((a) => a.name));
202
202
  const unknownKeys = Object.keys(data).filter((key) => !knownNames.has(key));
203
203
  if (unknownKeys.length > 0) {
204
- throw new chunkHWZRSXFB_js.ValidationError(
204
+ throw new chunkV26R64A4_js.ValidationError(
205
205
  `Unknown attribute${unknownKeys.length > 1 ? "s" : ""} for ${objectDef.label}: ${unknownKeys.join(", ")}`,
206
206
  unknownKeys.map((key) => ({ path: [key], message: "Unknown attribute" }))
207
207
  );
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkHWZRSXFB_js = require('./chunk-HWZRSXFB.js');
3
+ var chunkV26R64A4_js = require('./chunk-V26R64A4.js');
4
4
 
5
5
  // src/utils/canonical-json.ts
6
6
  function canonicalStringify(value) {
@@ -17,10 +17,10 @@ function canonicalStringify(value) {
17
17
  case "object":
18
18
  break;
19
19
  default:
20
- throw new chunkHWZRSXFB_js.ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
20
+ throw new chunkV26R64A4_js.ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
21
21
  }
22
22
  const obj = v;
23
- if (seen.has(obj)) throw new chunkHWZRSXFB_js.ValidationError("Cannot canonicalize circular structure", []);
23
+ if (seen.has(obj)) throw new chunkV26R64A4_js.ValidationError("Cannot canonicalize circular structure", []);
24
24
  seen.add(obj);
25
25
  try {
26
26
  if (Array.isArray(obj)) return `[${obj.map((e) => encode(e) ?? "null").join(",")}]`;
@@ -1,3 +1,4 @@
1
+ import { createRelationValidator } from './chunk-GO6LQADH.mjs';
1
2
  import { createRichtextValidator } from './chunk-QVLQPW3O.mjs';
2
3
  import { createMultiselectValidator, createSelectValidator, createStatusValidator } from './chunk-ZDQ5AP26.mjs';
3
4
  import { createUserValidator } from './chunk-LV3FEUKU.mjs';
@@ -7,11 +8,10 @@ import { createCheckboxValidator } from './chunk-OSSGN43B.mjs';
7
8
  import { createDateValidator } from './chunk-Q44QKLN4.mjs';
8
9
  import { createNumberValidator } from './chunk-UANQJ2GH.mjs';
9
10
  import { createTextValidator } from './chunk-O73ROMWQ.mjs';
10
- import { ValidationError } from './chunk-SYQDFZ74.mjs';
11
+ import { ValidationError } from './chunk-RUO25ERR.mjs';
11
12
  import { createCurrencyValidator } from './chunk-AYVHMVKQ.mjs';
12
13
  import { createLocationValidator } from './chunk-YUFTHPOE.mjs';
13
14
  import { createPhoneValidator } from './chunk-R5LAJCBU.mjs';
14
- import { createRelationValidator } from './chunk-GO6LQADH.mjs';
15
15
  import { DEFAULT_VALIDATION_MESSAGES, formatZodErrors } from './chunk-HRQEZUAA.mjs';
16
16
  import { z } from 'zod';
17
17
 
@@ -1,4 +1,4 @@
1
- import { ValidationError } from './chunk-SYQDFZ74.mjs';
1
+ import { ValidationError } from './chunk-RUO25ERR.mjs';
2
2
 
3
3
  // src/utils/canonical-json.ts
4
4
  function canonicalStringify(value) {
@@ -19,8 +19,40 @@ var SchemaErrorCode = {
19
19
  PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW",
20
20
  PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE",
21
21
  // Permissions
22
+ //
23
+ // `FORBIDDEN` means "you lack permission", and only that (#2681).
22
24
  FORBIDDEN: "SCHEMA_FORBIDDEN",
23
25
  ACCESS_DENIED: "SCHEMA_ACCESS_DENIED",
26
+ // Refusals that are NOT permission denials (#2681)
27
+ //
28
+ // `FORBIDDEN`'s message is redacted to a neutral sentence (#2675), which is
29
+ // honest only while the code means one thing. It did not: a workspace
30
+ // invariant (the last owner), a state gate (a disarmed reflex), an
31
+ // immutability refusal (system forms) and a missing actor context each told
32
+ // a caller who holds every permission that they lack one, sending them to an
33
+ // administrator with nothing to grant. So a refusal a permission grant would
34
+ // NOT lift takes one of the codes below — plus `SYSTEM_ENTITY_IMMUTABLE`,
35
+ // which already existed — and keeps the explanatory message that names its
36
+ // remedy. Every one answers 403, exactly as it did while miscoded: the
37
+ // ruling changed the semantics, not a single HTTP status.
38
+ //
39
+ // A fifth site was seen and deliberately left alone: `ApiKeyService`'s
40
+ // missing-actor refusal answers 400 `VALIDATION_FAILED`, and moving it here
41
+ // would change a public HTTP status — which the ruling forbids. It stays at
42
+ // its 400 pending a ruling of its own.
43
+ /**
44
+ * A workspace RULE refuses the write — the last owner cannot be removed.
45
+ *
46
+ * Not `INVARIANT_VIOLATION`, despite the name: that one is an internal
47
+ * "should never happen" assertion, a bug signal nobody outside the codebase
48
+ * can act on. This is the opposite — a rule the caller can act on, reached
49
+ * by a request that was entirely well-formed, whose message tells them how.
50
+ */
51
+ WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT",
52
+ /** The resource's own state refuses the operation — a disarmed reflex run. */
53
+ STATE_GATE: "SCHEMA_STATE_GATE",
54
+ /** The operation needs an actor and the request carried none. */
55
+ ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED",
24
56
  // Connectors
25
57
  CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED",
26
58
  CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE",
@@ -171,6 +203,8 @@ var NotFoundError = class extends SchemaError {
171
203
  resourceType,
172
204
  resourceId
173
205
  });
206
+ /** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
207
+ this._tag = "NotFoundError";
174
208
  this.name = "NotFoundError";
175
209
  this.resourceType = resourceType;
176
210
  this.resourceId = resourceId;
@@ -203,6 +237,8 @@ var SchemaPlanNotFoundError = class extends NotFoundError {
203
237
  var ValidationError = class _ValidationError extends SchemaError {
204
238
  constructor(message, errors) {
205
239
  super(message, SchemaErrorCode.VALIDATION_FAILED, { errors });
240
+ /** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
241
+ this._tag = "ValidationError";
206
242
  this.name = "ValidationError";
207
243
  this.errors = errors;
208
244
  }
@@ -21,8 +21,40 @@ var SchemaErrorCode = {
21
21
  PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW",
22
22
  PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE",
23
23
  // Permissions
24
+ //
25
+ // `FORBIDDEN` means "you lack permission", and only that (#2681).
24
26
  FORBIDDEN: "SCHEMA_FORBIDDEN",
25
27
  ACCESS_DENIED: "SCHEMA_ACCESS_DENIED",
28
+ // Refusals that are NOT permission denials (#2681)
29
+ //
30
+ // `FORBIDDEN`'s message is redacted to a neutral sentence (#2675), which is
31
+ // honest only while the code means one thing. It did not: a workspace
32
+ // invariant (the last owner), a state gate (a disarmed reflex), an
33
+ // immutability refusal (system forms) and a missing actor context each told
34
+ // a caller who holds every permission that they lack one, sending them to an
35
+ // administrator with nothing to grant. So a refusal a permission grant would
36
+ // NOT lift takes one of the codes below — plus `SYSTEM_ENTITY_IMMUTABLE`,
37
+ // which already existed — and keeps the explanatory message that names its
38
+ // remedy. Every one answers 403, exactly as it did while miscoded: the
39
+ // ruling changed the semantics, not a single HTTP status.
40
+ //
41
+ // A fifth site was seen and deliberately left alone: `ApiKeyService`'s
42
+ // missing-actor refusal answers 400 `VALIDATION_FAILED`, and moving it here
43
+ // would change a public HTTP status — which the ruling forbids. It stays at
44
+ // its 400 pending a ruling of its own.
45
+ /**
46
+ * A workspace RULE refuses the write — the last owner cannot be removed.
47
+ *
48
+ * Not `INVARIANT_VIOLATION`, despite the name: that one is an internal
49
+ * "should never happen" assertion, a bug signal nobody outside the codebase
50
+ * can act on. This is the opposite — a rule the caller can act on, reached
51
+ * by a request that was entirely well-formed, whose message tells them how.
52
+ */
53
+ WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT",
54
+ /** The resource's own state refuses the operation — a disarmed reflex run. */
55
+ STATE_GATE: "SCHEMA_STATE_GATE",
56
+ /** The operation needs an actor and the request carried none. */
57
+ ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED",
26
58
  // Connectors
27
59
  CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED",
28
60
  CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE",
@@ -173,6 +205,8 @@ var NotFoundError = class extends SchemaError {
173
205
  resourceType,
174
206
  resourceId
175
207
  });
208
+ /** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
209
+ this._tag = "NotFoundError";
176
210
  this.name = "NotFoundError";
177
211
  this.resourceType = resourceType;
178
212
  this.resourceId = resourceId;
@@ -205,6 +239,8 @@ var SchemaPlanNotFoundError = class extends NotFoundError {
205
239
  var ValidationError = class _ValidationError extends SchemaError {
206
240
  constructor(message, errors) {
207
241
  super(message, SchemaErrorCode.VALIDATION_FAILED, { errors });
242
+ /** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
243
+ this._tag = "ValidationError";
208
244
  this.name = "ValidationError";
209
245
  this.errors = errors;
210
246
  }