@stndrds/schema 1.0.0-alpha.276 → 1.0.0-alpha.278

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 (73) hide show
  1. package/dist/{all-D5zeUllO.d.mts → all-BSeTO0fj.d.mts} +20 -3
  2. package/dist/{all--B2_3ksI.d.ts → all-DoYgTt64.d.ts} +20 -3
  3. package/dist/{attributes-_b3Db8vT.d.ts → attributes-Da15v-sw.d.ts} +1 -1
  4. package/dist/{attributes-lBLiOIY3.d.mts → attributes-VsYmgI0A.d.mts} +1 -1
  5. package/dist/{chunk-4USPA67J.mjs → chunk-5PLJHYSL.mjs} +139 -26
  6. package/dist/{chunk-T7BST4JS.js → chunk-DEHBEFGO.js} +3 -3
  7. package/dist/{chunk-RAF6K6VG.js → chunk-NELH4AXI.js} +30 -18
  8. package/dist/{chunk-U7QUIEFF.mjs → chunk-PQEOIDXD.mjs} +1 -1
  9. package/dist/{chunk-EDOEX3O7.js → chunk-QMAVKX3Y.js} +178 -55
  10. package/dist/{chunk-QLU5QR7M.mjs → chunk-V2WJFUZW.mjs} +16 -8
  11. package/dist/{chunk-RBG2YMF2.mjs → chunk-YCWGUPSI.mjs} +26 -16
  12. package/dist/{chunk-F3YPU2N6.js → chunk-ZBWTAKZO.js} +16 -8
  13. package/dist/exceptions.d.mts +15 -10
  14. package/dist/exceptions.d.ts +15 -10
  15. package/dist/exceptions.js +39 -39
  16. package/dist/exceptions.mjs +1 -1
  17. package/dist/{helpers-C1VVEAOO.d.mts → helpers-BYhVd4Gw.d.mts} +3 -3
  18. package/dist/{helpers-vQ6kp8ET.d.ts → helpers-D2cL7hI2.d.ts} +3 -3
  19. package/dist/index-CixTESyP.d.mts +790 -0
  20. package/dist/index-dJ6fAwcG.d.ts +790 -0
  21. package/dist/index.d.mts +2662 -433
  22. package/dist/index.d.ts +2662 -433
  23. package/dist/index.js +641 -391
  24. package/dist/index.mjs +416 -223
  25. package/dist/{migrations-BXd2ZGfM.d.mts → migrations-Dy9K8kJ0.d.mts} +1 -1
  26. package/dist/{migrations-DcuJZ8qO.d.ts → migrations-hbZHm8Tm.d.ts} +1 -1
  27. package/dist/{objects-BCaBw2ef.d.mts → objects-Cvt2T2Q5.d.mts} +19 -3
  28. package/dist/{objects-A1ED9af-.d.ts → objects-_6M6ngH3.d.ts} +19 -3
  29. package/dist/{types-DNz3ITS-.d.mts → types-CX7S3Fhh.d.mts} +1 -1
  30. package/dist/{types-DqLi1tx1.d.ts → types-DseDsbMu.d.ts} +1 -1
  31. package/dist/validation/all.d.mts +7 -7
  32. package/dist/validation/all.d.ts +7 -7
  33. package/dist/validation/all.js +33 -33
  34. package/dist/validation/all.mjs +8 -8
  35. package/dist/validation/complex/currency.d.mts +2 -2
  36. package/dist/validation/complex/currency.d.ts +2 -2
  37. package/dist/validation/complex/location.d.mts +2 -2
  38. package/dist/validation/complex/location.d.ts +2 -2
  39. package/dist/validation/complex/phone.d.mts +2 -2
  40. package/dist/validation/complex/phone.d.ts +2 -2
  41. package/dist/validation/complex/relation.d.mts +2 -2
  42. package/dist/validation/complex/relation.d.ts +2 -2
  43. package/dist/validation/complex/richtext.d.mts +2 -2
  44. package/dist/validation/complex/richtext.d.ts +2 -2
  45. package/dist/validation/complex/select.d.mts +2 -2
  46. package/dist/validation/complex/select.d.ts +2 -2
  47. package/dist/validation/complex/user.d.mts +2 -2
  48. package/dist/validation/complex/user.d.ts +2 -2
  49. package/dist/validation/computed/formula.d.mts +2 -2
  50. package/dist/validation/computed/formula.d.ts +2 -2
  51. package/dist/validation/computed/rollup.d.mts +2 -2
  52. package/dist/validation/computed/rollup.d.ts +2 -2
  53. package/dist/validation/config/index.d.mts +4 -4
  54. package/dist/validation/config/index.d.ts +4 -4
  55. package/dist/validation/config/index.js +11 -11
  56. package/dist/validation/config/index.mjs +2 -2
  57. package/dist/validation/core/index.d.mts +3 -3
  58. package/dist/validation/core/index.d.ts +3 -3
  59. package/dist/validation/object/index.d.mts +5 -5
  60. package/dist/validation/object/index.d.ts +5 -5
  61. package/dist/validation/object/index.js +18 -18
  62. package/dist/validation/object/index.mjs +6 -6
  63. package/dist/validation/primitives/checkbox.d.mts +2 -2
  64. package/dist/validation/primitives/checkbox.d.ts +2 -2
  65. package/dist/validation/primitives/date.d.mts +2 -2
  66. package/dist/validation/primitives/date.d.ts +2 -2
  67. package/dist/validation/primitives/number.d.mts +2 -2
  68. package/dist/validation/primitives/number.d.ts +2 -2
  69. package/dist/validation/primitives/text.d.mts +2 -2
  70. package/dist/validation/primitives/text.d.ts +2 -2
  71. package/package.json +2 -2
  72. package/dist/index-Bq1KrQkR.d.ts +0 -2413
  73. package/dist/index-DtxtOBYT.d.mts +0 -2413
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkT7BST4JS_js = require('./chunk-T7BST4JS.js');
4
- var chunkF3YPU2N6_js = require('./chunk-F3YPU2N6.js');
3
+ var chunkDEHBEFGO_js = require('./chunk-DEHBEFGO.js');
4
+ var chunkZBWTAKZO_js = require('./chunk-ZBWTAKZO.js');
5
5
  var zod = require('zod');
6
6
 
7
7
  // src/types/system-attributes.ts
@@ -313,19 +313,19 @@ function isAttributeGroupable(attribute) {
313
313
  function isAttributeKanbanGroupable(attribute) {
314
314
  return getAttributeCapabilities(attribute).query.kanbanGroupable;
315
315
  }
316
- function getRollupFilterOperators(attr) {
317
- const fn = attr.function;
318
- if (fn === "earliest" || fn === "latest") {
319
- return ATTRIBUTE_FILTER_OPERATORS.date;
320
- }
321
- if (fn === "original") {
322
- const targetType = attr.targetAttributeType;
323
- if (targetType && hasFilterOperatorEntry(targetType)) {
324
- return ATTRIBUTE_FILTER_OPERATORS[targetType];
325
- }
326
- return ATTRIBUTE_FILTER_OPERATORS.number;
316
+ function resolveEffectiveFilterType(attribute) {
317
+ if (attribute.type !== "rollup") return attribute.type;
318
+ const rollup = attribute;
319
+ if (rollup.function === "earliest" || rollup.function === "latest") return "date";
320
+ if (rollup.function === "original") {
321
+ const targetType = rollup.targetAttributeType;
322
+ if (targetType && hasFilterOperatorEntry(targetType)) return targetType;
327
323
  }
328
- return ATTRIBUTE_FILTER_OPERATORS.number;
324
+ return "number";
325
+ }
326
+ function getRollupFilterOperators(attr) {
327
+ const effectiveType = resolveEffectiveFilterType(attr);
328
+ return hasFilterOperatorEntry(effectiveType) ? ATTRIBUTE_FILTER_OPERATORS[effectiveType] : ATTRIBUTE_FILTER_OPERATORS.number;
329
329
  }
330
330
  function getRawFilterOperators(attribute) {
331
331
  if (attribute.type === "rollup") {
@@ -424,6 +424,90 @@ function now() {
424
424
  return { dynamic: "date", anchor: "now" };
425
425
  }
426
426
 
427
+ // src/filters/extract-filter-value.ts
428
+ function toAmount(value) {
429
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
430
+ if (typeof value === "string" && value.trim() !== "") {
431
+ const parsed = Number(value);
432
+ return Number.isFinite(parsed) ? parsed : null;
433
+ }
434
+ return null;
435
+ }
436
+ function extractCurrencyFilterValue(value) {
437
+ if (value !== null && typeof value === "object") {
438
+ return "value" in value ? toAmount(value.value) : null;
439
+ }
440
+ return toAmount(value);
441
+ }
442
+ function extractFilterValue(value) {
443
+ if (value === null || value === void 0) return null;
444
+ if (typeof value === "object" && "value" in value) {
445
+ return value.value ?? null;
446
+ }
447
+ return value;
448
+ }
449
+
450
+ // src/filters/polarity.ts
451
+ var NEGATIVE_OPERATORS = /* @__PURE__ */ new Set([
452
+ "is_not",
453
+ "not_contains",
454
+ "none_of",
455
+ "is_empty"
456
+ ]);
457
+ var NEGATIVE_TO_POSITIVE = {
458
+ is_not: "is",
459
+ not_contains: "contains",
460
+ none_of: "any_of",
461
+ is_empty: "is_not_empty"
462
+ };
463
+ function getOperatorPolarity(op) {
464
+ return NEGATIVE_OPERATORS.has(op) ? "none" : "any";
465
+ }
466
+ function normalizeForEdgeRpc(op) {
467
+ return NEGATIVE_TO_POSITIVE[op] ?? op;
468
+ }
469
+ var SINGLE_TO_MULTI = {
470
+ is: "any_of",
471
+ is_not: "none_of"
472
+ };
473
+ function toMultiValueOperator(op) {
474
+ return SINGLE_TO_MULTI[op] ?? op;
475
+ }
476
+ var SET_MEMBERSHIP_OPERATORS = new Set(
477
+ Object.values(SINGLE_TO_MULTI).filter((op) => op !== void 0)
478
+ );
479
+ function isSetMembershipOperator(op) {
480
+ return SET_MEMBERSHIP_OPERATORS.has(op);
481
+ }
482
+
483
+ // src/filters/canonicalize-value.ts
484
+ function canonicalizeFilterValue(rule, effectiveType) {
485
+ const value = rule.value;
486
+ if (isNoValueOperator(rule.operator)) return;
487
+ if (value === null || value === void 0) return;
488
+ if (isDynamicValue(value)) return;
489
+ if (isSetMembershipOperator(rule.operator)) {
490
+ if (!Array.isArray(value)) rule.value = [value];
491
+ return;
492
+ }
493
+ if (effectiveType !== "currency") return;
494
+ const amount = extractCurrencyFilterValue(value);
495
+ if (amount !== null) {
496
+ rule.value = amount;
497
+ return;
498
+ }
499
+ if (!hasCurrencyAmount(value)) return;
500
+ const message = `Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(
501
+ value
502
+ )}`;
503
+ throw new chunkZBWTAKZO_js.ValidationError(message, [{ path: ["value"], message }]);
504
+ }
505
+ function hasCurrencyAmount(value) {
506
+ if (typeof value !== "object") return true;
507
+ if (!("value" in value)) return false;
508
+ return value.value != null;
509
+ }
510
+
427
511
  // src/filters/normalize-operator.ts
428
512
  var SYNONYM_ALIASES = {
429
513
  // equality
@@ -507,6 +591,12 @@ function resolveIsWithinBounds(value, now2 = /* @__PURE__ */ new Date()) {
507
591
  if (!(Number.isFinite(bounds.startMs) && Number.isFinite(bounds.endMs))) return null;
508
592
  return bounds;
509
593
  }
594
+ function resolveUtcDayBounds(ms) {
595
+ if (!Number.isFinite(ms)) return null;
596
+ const startMs = utcDayStart(new Date(ms));
597
+ if (!Number.isFinite(startMs)) return null;
598
+ return { startMs, endMs: startMs + MS_PER_DAY };
599
+ }
510
600
  function toUtcDayString(ms) {
511
601
  return new Date(ms).toISOString().slice(0, 10);
512
602
  }
@@ -571,13 +661,13 @@ function resolveCanonicalOperator(rawOperator, effectiveType) {
571
661
  const replacement = REMOVED_OPERATOR_REPLACEMENTS[rawOperator];
572
662
  if (replacement) {
573
663
  const m = `Unknown filter operator "${rawOperator}" \u2014 use ${replacement}`;
574
- throw new chunkF3YPU2N6_js.ValidationError(m, [{ path: ["operator"], message: m }]);
664
+ throw new chunkZBWTAKZO_js.ValidationError(m, [{ path: ["operator"], message: m }]);
575
665
  }
576
666
  const normalized = normalizeOperator(rawOperator);
577
667
  const membership = SUBSTRING_TO_MEMBERSHIP[normalized];
578
668
  if (membership && SET_MEMBERSHIP_TYPES.has(effectiveType)) {
579
669
  const m = `Operator "${normalized}" is not valid for type "${effectiveType}" \u2014 use "${membership}"`;
580
- throw new chunkF3YPU2N6_js.ValidationError(m, [{ path: ["operator"], message: m }]);
670
+ throw new chunkZBWTAKZO_js.ValidationError(m, [{ path: ["operator"], message: m }]);
581
671
  }
582
672
  return normalized;
583
673
  }
@@ -587,7 +677,7 @@ function assertOperatorForType(operator, type, context) {
587
677
  if (!ops?.includes(normalized)) {
588
678
  const validList = ops?.length ? ops.join(", ") : "(no operators registered for this type)";
589
679
  const summary = `Operator "${operator}" is not valid for ${context} type "${type}". Valid operators: ${validList}.`;
590
- throw new chunkF3YPU2N6_js.ValidationError(summary, [
680
+ throw new chunkZBWTAKZO_js.ValidationError(summary, [
591
681
  {
592
682
  path: ["operator"],
593
683
  message: summary
@@ -600,19 +690,24 @@ function assertRelativeDateValue(rule) {
600
690
  if (rule.operator !== "is_within") return;
601
691
  if (!isRelativeDateValue(rule.value)) {
602
692
  const m = `Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }`;
603
- throw new chunkF3YPU2N6_js.ValidationError(m, [{ path: ["value"], message: m }]);
693
+ throw new chunkZBWTAKZO_js.ValidationError(m, [{ path: ["value"], message: m }]);
604
694
  }
605
695
  }
696
+ function applyCanonicalForm(rule, operator, effectiveType) {
697
+ rule.operator = operator;
698
+ canonicalizeFilterValue(rule, effectiveType);
699
+ assertRelativeDateValue(rule);
700
+ }
606
701
  function assertDynamicValueForAttribute(rule, attrType) {
607
702
  if (!isDynamicValue(rule.value)) return;
608
703
  const v = rule.value;
609
704
  if (v.dynamic === "actor" && attrType !== "user") {
610
705
  const m = `actor token (@me) is only valid on user attributes, not "${attrType}"`;
611
- throw new chunkF3YPU2N6_js.ValidationError(m, [{ path: ["value"], message: m }]);
706
+ throw new chunkZBWTAKZO_js.ValidationError(m, [{ path: ["value"], message: m }]);
612
707
  }
613
708
  if (v.dynamic === "date" && attrType !== "date") {
614
709
  const m = `date token (@today/@now) is only valid on date attributes, not "${attrType}"`;
615
- throw new chunkF3YPU2N6_js.ValidationError(m, [{ path: ["value"], message: m }]);
710
+ throw new chunkZBWTAKZO_js.ValidationError(m, [{ path: ["value"], message: m }]);
616
711
  }
617
712
  }
618
713
  function collectQualifiedRuleIssues(rule, context) {
@@ -620,7 +715,7 @@ function collectQualifiedRuleIssues(rule, context) {
620
715
  validateQualifiedRule({ ...rule }, context);
621
716
  return [];
622
717
  } catch (error) {
623
- if (!(error instanceof chunkF3YPU2N6_js.ValidationError)) throw error;
718
+ if (!(error instanceof chunkZBWTAKZO_js.ValidationError)) throw error;
624
719
  return error.errors.map((issue) => ({ ...issue, path: [...issue.path] }));
625
720
  }
626
721
  }
@@ -628,68 +723,75 @@ function validateQualifiedRule(rule, context) {
628
723
  const rootAttr = context.attributes.find((a) => a.name === rule.attribute);
629
724
  const systemOps = SYSTEM_FILTER_OPERATORS[rule.attribute];
630
725
  if (!(rootAttr || systemOps)) {
631
- throw new chunkF3YPU2N6_js.ValidationError(`Unknown attribute: ${rule.attribute}`, [
726
+ throw new chunkZBWTAKZO_js.ValidationError(`Unknown attribute: ${rule.attribute}`, [
632
727
  { path: ["attribute"], message: `Unknown attribute: ${rule.attribute}` }
633
728
  ]);
634
729
  }
635
730
  if (rule.quantifier !== void 0 && !rule.property) {
636
731
  const m = `quantifier is only valid on qualified edge rules (set "property")`;
637
- throw new chunkF3YPU2N6_js.ValidationError(m, [{ path: ["quantifier"], message: m }]);
732
+ throw new chunkZBWTAKZO_js.ValidationError(m, [{ path: ["quantifier"], message: m }]);
638
733
  }
639
734
  if (!rootAttr) {
640
735
  if (rule.property) {
641
- throw new chunkF3YPU2N6_js.ValidationError(`Cannot qualify system attribute "${rule.attribute}"`, [
736
+ throw new chunkZBWTAKZO_js.ValidationError(`Cannot qualify system attribute "${rule.attribute}"`, [
642
737
  { path: ["property"], message: `"${rule.attribute}" is a system column, not a reference` }
643
738
  ]);
644
739
  }
645
740
  const effectiveType = SYSTEM_FILTER_ATTRIBUTE_TYPES[rule.attribute] ?? "text";
646
- const normalizedOperator = resolveCanonicalOperator(rule.operator, effectiveType);
647
- if (!systemOps.includes(normalizedOperator)) {
741
+ const normalizedOperator2 = resolveCanonicalOperator(rule.operator, effectiveType);
742
+ if (!systemOps.includes(normalizedOperator2)) {
648
743
  const summary = `Operator "${rule.operator}" is not valid for system attribute "${rule.attribute}". Valid operators: ${systemOps.join(", ")}.`;
649
- throw new chunkF3YPU2N6_js.ValidationError(summary, [{ path: ["operator"], message: summary }]);
744
+ throw new chunkZBWTAKZO_js.ValidationError(summary, [{ path: ["operator"], message: summary }]);
650
745
  }
651
- rule.operator = normalizedOperator;
652
- assertRelativeDateValue(rule);
746
+ applyCanonicalForm(rule, normalizedOperator2, effectiveType);
653
747
  return;
654
748
  }
655
749
  if (!rule.property) {
656
750
  assertDynamicValueForAttribute(rule, rootAttr.type);
657
751
  const ops = getAttributeFilterOperators(rootAttr);
658
- const normalizedOperator = resolveCanonicalOperator(rule.operator, rootAttr.type);
659
- if (!ops.includes(normalizedOperator)) {
752
+ const normalizedOperator2 = resolveCanonicalOperator(rule.operator, rootAttr.type);
753
+ if (!ops.includes(normalizedOperator2)) {
660
754
  const validList = ops.length ? ops.join(", ") : "(not filterable)";
661
755
  const summary = `Operator "${rule.operator}" is not valid for attribute "${rootAttr.name}". Valid operators: ${validList}.`;
662
- throw new chunkF3YPU2N6_js.ValidationError(summary, [{ path: ["operator"], message: summary }]);
756
+ throw new chunkZBWTAKZO_js.ValidationError(summary, [{ path: ["operator"], message: summary }]);
663
757
  }
664
- rule.operator = normalizedOperator;
665
- assertRelativeDateValue(rule);
758
+ applyCanonicalForm(rule, normalizedOperator2, resolveEffectiveFilterType(rootAttr));
666
759
  return;
667
760
  }
668
761
  if (!REFERENCE_TYPES.has(rootAttr.type)) {
669
- throw new chunkF3YPU2N6_js.ValidationError(`Cannot qualify ${rootAttr.type} attribute "${rule.attribute}"`, [
762
+ throw new chunkZBWTAKZO_js.ValidationError(`Cannot qualify ${rootAttr.type} attribute "${rule.attribute}"`, [
670
763
  { path: ["property"], message: `Attribute "${rule.attribute}" is not a reference type` }
671
764
  ]);
672
765
  }
673
766
  const propSchema = rootAttr.properties;
674
767
  if (!propSchema) {
675
- throw new chunkF3YPU2N6_js.ValidationError(`Attribute "${rule.attribute}" has no qualifyWith schema`, [
768
+ throw new chunkZBWTAKZO_js.ValidationError(`Attribute "${rule.attribute}" has no qualifyWith schema`, [
676
769
  { path: ["property"], message: `"${rule.attribute}" has no qualifyWith` }
677
770
  ]);
678
771
  }
679
772
  const propDef = propSchema.definitions.find((p) => p.name === rule.property);
680
773
  if (!propDef) {
681
- throw new chunkF3YPU2N6_js.ValidationError(
774
+ throw new chunkZBWTAKZO_js.ValidationError(
682
775
  `Property "${rule.property}" not defined on "${rule.attribute}".qualifyWith()`,
683
776
  [{ path: ["property"], message: `Unknown property: ${rule.property}` }]
684
777
  );
685
778
  }
686
- rule.operator = assertOperatorForType(rule.operator, propDef.type, "property");
687
- assertRelativeDateValue(rule);
779
+ const normalizedOperator = assertOperatorForType(rule.operator, propDef.type, "property");
780
+ applyCanonicalForm(rule, normalizedOperator, propDef.type);
688
781
  }
689
782
 
690
783
  // src/types/objects.ts
691
784
  var RESOURCE_VISIBILITIES = ["workspace", "private"];
692
785
  var LIST_VIEW_TAB_VISIBILITIES = ["all", ...RESOURCE_VISIBILITIES];
786
+ function parseResourceVisibility(value) {
787
+ if (typeof value === "string" && RESOURCE_VISIBILITIES.includes(value)) {
788
+ return value;
789
+ }
790
+ throw new chunkZBWTAKZO_js.ValidationError(
791
+ `visibility must be one of: ${RESOURCE_VISIBILITIES.join(", ")} (received: ${String(value)})`,
792
+ []
793
+ );
794
+ }
693
795
  var SYSTEM_FIELD_NAMES = [
694
796
  "id",
695
797
  "createdAt",
@@ -719,12 +821,12 @@ var RESERVED_OBJECT_NAMES = ["skill"];
719
821
  // src/validators/view-config.schema.ts
720
822
  var createModeSchema = zod.z.enum(["redirect", "inline", "peek"]);
721
823
  var nonEmptyStringArraySchema = zod.z.array(zod.z.string()).min(1);
722
- var columnsSchema = zod.z.array(zod.z.string()).max(chunkT7BST4JS_js.SCHEMA_LIMITS.columnsPerTab);
824
+ var columnsSchema = zod.z.array(zod.z.string()).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.columnsPerTab);
723
825
  var sortRuleSchema = zod.z.object({
724
826
  attribute: zod.z.string(),
725
827
  direction: zod.z.enum(["asc", "desc"])
726
828
  }).strict();
727
- var sortsSchema = zod.z.array(sortRuleSchema).max(chunkT7BST4JS_js.SCHEMA_LIMITS.sortsPerTab);
829
+ var sortsSchema = zod.z.array(sortRuleSchema).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.sortsPerTab);
728
830
  var relativeDateValueSchema = zod.z.object({
729
831
  amount: zod.z.number(),
730
832
  unit: zod.z.enum(["days", "weeks", "months", "years"]),
@@ -748,6 +850,10 @@ var dynamicFilterValueSchema = zod.z.discriminatedUnion("dynamic", [
748
850
  anchor: zod.z.enum(["today", "now"])
749
851
  }).strict()
750
852
  ]);
853
+ var dayMonthValueSchema = zod.z.object({
854
+ month: zod.z.number(),
855
+ day: zod.z.number()
856
+ }).strict();
751
857
  var filterValueSchema = zod.z.union([
752
858
  zod.z.string(),
753
859
  zod.z.number(),
@@ -756,6 +862,7 @@ var filterValueSchema = zod.z.union([
756
862
  relativeDateValueSchema,
757
863
  currencyFilterValueSchema,
758
864
  phoneFilterValueSchema,
865
+ dayMonthValueSchema,
759
866
  dynamicFilterValueSchema,
760
867
  zod.z.null()
761
868
  ]);
@@ -793,7 +900,7 @@ var filterRuleSchema = zod.z.object({
793
900
  operator: filterOperatorSchema,
794
901
  value: filterValueSchema
795
902
  }).strict();
796
- var filterRulesSchema = zod.z.array(filterRuleSchema).max(chunkT7BST4JS_js.SCHEMA_LIMITS.filterRulesPerTab);
903
+ var filterRulesSchema = zod.z.array(filterRuleSchema).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.filterRulesPerTab);
797
904
  var filterStateSchema = zod.z.object({
798
905
  combinator: zod.z.enum(["and", "or"]),
799
906
  rules: filterRulesSchema
@@ -877,13 +984,13 @@ var baseGroupShape = {
877
984
  var fieldGroupWriteSchema = zod.z.object({
878
985
  ...baseGroupShape,
879
986
  type: zod.z.literal("fields"),
880
- fields: zod.z.array(fieldSchema).max(chunkT7BST4JS_js.SCHEMA_LIMITS.fieldsPerGroup)
987
+ fields: zod.z.array(fieldSchema).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.fieldsPerGroup)
881
988
  }).strict();
882
989
  var relationGroupSchema = zod.z.object({
883
990
  ...baseGroupShape,
884
991
  type: zod.z.literal("relation"),
885
992
  attribute: zod.z.string(),
886
- columns: zod.z.array(zod.z.string()).max(chunkT7BST4JS_js.SCHEMA_LIMITS.columnsPerTab).optional(),
993
+ columns: zod.z.array(zod.z.string()).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.columnsPerTab).optional(),
887
994
  readOnly: zod.z.boolean().optional(),
888
995
  allowCreate: zod.z.boolean().optional()
889
996
  }).strict();
@@ -892,13 +999,13 @@ var baseTabShape = {
892
999
  id: zod.z.string(),
893
1000
  name: zod.z.string(),
894
1001
  label: zod.z.string(),
895
- icon: chunkT7BST4JS_js.iconNameSchema.optional(),
1002
+ icon: chunkDEHBEFGO_js.iconNameSchema.optional(),
896
1003
  order: zod.z.number().optional()
897
1004
  };
898
1005
  var formTabWriteSchema = zod.z.object({
899
1006
  ...baseTabShape,
900
1007
  type: zod.z.literal("form"),
901
- groups: zod.z.array(groupWriteSchema).min(1).max(chunkT7BST4JS_js.SCHEMA_LIMITS.groupsPerFormTab),
1008
+ groups: zod.z.array(groupWriteSchema).min(1).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.groupsPerFormTab),
902
1009
  formColumns: zod.z.union([zod.z.literal(1), zod.z.literal(2), zod.z.literal(3)]).optional(),
903
1010
  density: zod.z.enum(["compact", "comfortable", "spacious"]).optional()
904
1011
  }).strict().superRefine((tab, ctx) => {
@@ -907,13 +1014,13 @@ var formTabWriteSchema = zod.z.object({
907
1014
  (count, group) => count + (group.type === "fields" ? group.fields.length : 0),
908
1015
  0
909
1016
  );
910
- if (totalFields > chunkT7BST4JS_js.SCHEMA_LIMITS.fieldsPerFormTab) {
1017
+ if (totalFields > chunkDEHBEFGO_js.SCHEMA_LIMITS.fieldsPerFormTab) {
911
1018
  ctx.addIssue({
912
1019
  code: "too_big",
913
1020
  origin: "array",
914
- maximum: chunkT7BST4JS_js.SCHEMA_LIMITS.fieldsPerFormTab,
1021
+ maximum: chunkDEHBEFGO_js.SCHEMA_LIMITS.fieldsPerFormTab,
915
1022
  inclusive: true,
916
- message: `A form tab can contain at most ${chunkT7BST4JS_js.SCHEMA_LIMITS.fieldsPerFormTab} fields`,
1023
+ message: `A form tab can contain at most ${chunkDEHBEFGO_js.SCHEMA_LIMITS.fieldsPerFormTab} fields`,
917
1024
  path: ["groups"]
918
1025
  });
919
1026
  }
@@ -1115,7 +1222,12 @@ var formsTabSchema = zod.z.object({
1115
1222
  var emailsTabSchema = zod.z.object({
1116
1223
  ...baseTabShape,
1117
1224
  type: zod.z.literal("emails"),
1118
- emailAttributeIds: zod.z.array(zod.z.string()).max(chunkT7BST4JS_js.SCHEMA_LIMITS.emailAttributesPerTab)
1225
+ emailAttributeIds: zod.z.array(zod.z.string()).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.emailAttributesPerTab)
1226
+ }).strict();
1227
+ var meetingsTabSchema = zod.z.object({
1228
+ ...baseTabShape,
1229
+ type: zod.z.literal("meetings"),
1230
+ emailAttributeIds: zod.z.array(zod.z.string()).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.emailAttributesPerTab)
1119
1231
  }).strict();
1120
1232
  var detailTabSchema = zod.z.discriminatedUnion("type", [
1121
1233
  formTabWriteSchema,
@@ -1125,12 +1237,13 @@ var detailTabSchema = zod.z.discriminatedUnion("type", [
1125
1237
  richtextTabSchema,
1126
1238
  documentsTabSchema,
1127
1239
  formsTabSchema,
1128
- emailsTabSchema
1240
+ emailsTabSchema,
1241
+ meetingsTabSchema
1129
1242
  ]);
1130
1243
  var listTabCommonShape = {
1131
1244
  id: zod.z.string(),
1132
1245
  label: zod.z.string(),
1133
- icon: chunkT7BST4JS_js.iconNameSchema.optional(),
1246
+ icon: chunkDEHBEFGO_js.iconNameSchema.optional(),
1134
1247
  default: zod.z.boolean().optional(),
1135
1248
  // Which records the tab scopes to. `"all"` is the default and means "impose
1136
1249
  // no scope" — the mandatory viewer predicate alone decides, so the tab shows
@@ -1164,7 +1277,7 @@ var listViewTabSchema = zod.z.discriminatedUnion("layout", [
1164
1277
  ]);
1165
1278
  var _listViewConfigSchema = zod.z.object({
1166
1279
  defaultFilters: filterGroupSchema.optional(),
1167
- tabs: zod.z.array(listViewTabSchema).min(1).max(chunkT7BST4JS_js.SCHEMA_LIMITS.tabsPerView)
1280
+ tabs: zod.z.array(listViewTabSchema).min(1).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.tabsPerView)
1168
1281
  }).strict().superRefine((config, ctx) => {
1169
1282
  addDuplicateIdIssues(config.tabs, ctx, ["tabs"]);
1170
1283
  let hasDefault = false;
@@ -1181,9 +1294,9 @@ var _listViewConfigSchema = zod.z.object({
1181
1294
  });
1182
1295
  });
1183
1296
  var _detailViewConfigSchema = zod.z.object({
1184
- tabs: zod.z.array(detailTabSchema).min(1).max(chunkT7BST4JS_js.SCHEMA_LIMITS.tabsPerView),
1297
+ tabs: zod.z.array(detailTabSchema).min(1).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.tabsPerView),
1185
1298
  sidePanel: zod.z.object({
1186
- attributes: zod.z.array(zod.z.string()).max(chunkT7BST4JS_js.SCHEMA_LIMITS.sidePanelAttributes),
1299
+ attributes: zod.z.array(zod.z.string()).max(chunkDEHBEFGO_js.SCHEMA_LIMITS.sidePanelAttributes),
1187
1300
  width: zod.z.number().optional()
1188
1301
  }).strict().optional()
1189
1302
  }).strict().superRefine((config, ctx) => {
@@ -1227,12 +1340,16 @@ exports.SYSTEM_ATTRIBUTES = SYSTEM_ATTRIBUTES;
1227
1340
  exports.SYSTEM_ATTRIBUTE_I18N_KEYS = SYSTEM_ATTRIBUTE_I18N_KEYS;
1228
1341
  exports.SYSTEM_FIELD_NAMES = SYSTEM_FIELD_NAMES;
1229
1342
  exports.SYSTEM_FILTER_ATTRIBUTE_TYPES = SYSTEM_FILTER_ATTRIBUTE_TYPES;
1343
+ exports.canonicalizeFilterValue = canonicalizeFilterValue;
1230
1344
  exports.collectQualifiedRuleIssues = collectQualifiedRuleIssues;
1231
1345
  exports.currentActor = currentActor;
1232
1346
  exports.detailTabSchema = detailTabSchema;
1233
1347
  exports.detailViewConfigSchema = detailViewConfigSchema;
1348
+ exports.extractCurrencyFilterValue = extractCurrencyFilterValue;
1349
+ exports.extractFilterValue = extractFilterValue;
1234
1350
  exports.getAttributeCapabilities = getAttributeCapabilities;
1235
1351
  exports.getAttributeFilterOperators = getAttributeFilterOperators;
1352
+ exports.getOperatorPolarity = getOperatorPolarity;
1236
1353
  exports.getRollupFilterOperators = getRollupFilterOperators2;
1237
1354
  exports.getSystemAttributeI18nKey = getSystemAttributeI18nKey;
1238
1355
  exports.getSystemAttributeList = getSystemAttributeList;
@@ -1246,15 +1363,21 @@ exports.isDynamicValue = isDynamicValue;
1246
1363
  exports.isManagedSystemAttribute = isManagedSystemAttribute;
1247
1364
  exports.isNoValueOperator = isNoValueOperator;
1248
1365
  exports.isRelativeDateValue = isRelativeDateValue;
1366
+ exports.isSetMembershipOperator = isSetMembershipOperator;
1249
1367
  exports.listViewConfigSchema = listViewConfigSchema;
1250
1368
  exports.listViewTabSchema = listViewTabSchema;
1251
1369
  exports.normalizeFilterRule = normalizeFilterRule;
1370
+ exports.normalizeForEdgeRpc = normalizeForEdgeRpc;
1252
1371
  exports.normalizeOperator = normalizeOperator;
1253
1372
  exports.now = now;
1373
+ exports.parseResourceVisibility = parseResourceVisibility;
1254
1374
  exports.parseViewConfig = parseViewConfig;
1255
1375
  exports.relationSourceSchema = relationSourceSchema;
1376
+ exports.resolveEffectiveFilterType = resolveEffectiveFilterType;
1256
1377
  exports.resolveIsWithinBounds = resolveIsWithinBounds;
1378
+ exports.resolveUtcDayBounds = resolveUtcDayBounds;
1257
1379
  exports.tableSourceSchema = tableSourceSchema;
1380
+ exports.toMultiValueOperator = toMultiValueOperator;
1258
1381
  exports.toUtcDayString = toUtcDayString;
1259
1382
  exports.today = today;
1260
1383
  exports.validateQualifiedRule = validateQualifiedRule;
@@ -24,6 +24,13 @@ var SchemaErrorCode = {
24
24
  // Connectors
25
25
  CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED",
26
26
  CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE",
27
+ /**
28
+ * The provider issued tokens and the flow failed AFTER that — resolving the
29
+ * connected address. Distinct from CONNECTOR_AUTH_FAILED because the user is
30
+ * left holding a real grant: consent happened, and it may still be live on the
31
+ * provider side even though no connection row exists here.
32
+ */
33
+ CONNECTOR_GRANT_ORPHANED: "SCHEMA_CONNECTOR_GRANT_ORPHANED",
27
34
  // Sync
28
35
  SYNC_FAILED: "SCHEMA_SYNC_FAILED",
29
36
  SYNC_CONFLICT: "SCHEMA_SYNC_CONFLICT",
@@ -67,6 +74,8 @@ var SchemaErrorCode = {
67
74
  // Configuration / wiring — a required runtime dependency is not configured
68
75
  CONFIGURATION_REQUIRED: "CONFIGURATION_REQUIRED",
69
76
  SEARCH_ADAPTER_REQUIRED: "SEARCH_ADAPTER_REQUIRED",
77
+ // Background jobs — one or more cron schedules could not be armed at boot
78
+ CRON_REGISTRATION_FAILED: "CRON_REGISTRATION_FAILED",
70
79
  // Search backend — a search read call failed at the transport level
71
80
  // (non-API transport error: JSON.parse on a non-JSON body, network failure)
72
81
  SEARCH_BACKEND_FAILED: "SEARCH_BACKEND_FAILED",
@@ -75,6 +84,10 @@ var SchemaErrorCode = {
75
84
  // Tenant / context
76
85
  TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING",
77
86
  FEATURE_FLAGS_CONTEXT: "FEATURE_FLAGS_CONTEXT",
87
+ // Realtime delivery — stable codes shared by runtime and transport adapters
88
+ REALTIME_RATE_LIMITED: "REALTIME_RATE_LIMITED",
89
+ REALTIME_DELIVERY_FAILED: "REALTIME_DELIVERY_FAILED",
90
+ REALTIME_SUBSCRIPTION_FAILED: "REALTIME_SUBSCRIPTION_FAILED",
78
91
  // Agents
79
92
  AGENT_UNKNOWN: "AGENT_UNKNOWN",
80
93
  AGENT_DEPTH_EXCEEDED: "AGENT_DEPTH_EXCEEDED",
@@ -89,8 +102,7 @@ var SchemaErrorCode = {
89
102
  AGENT_COMPACTION_IMPOSSIBLE: "AGENT_COMPACTION_IMPOSSIBLE",
90
103
  AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT",
91
104
  AGENT_LEASE_HELD: "AGENT_LEASE_HELD",
92
- AGENT_MISSION_CONFLICT: "AGENT_MISSION_CONFLICT",
93
- AGENT_MISSION_INCOMPLETE: "AGENT_MISSION_INCOMPLETE",
105
+ AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED",
94
106
  // AI / LLM
95
107
  AI_UNKNOWN: "AI_UNKNOWN",
96
108
  AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED",
@@ -115,15 +127,11 @@ var SchemaErrorCode = {
115
127
  DOCUMENT_FOLDER_SERVICE_UNAVAILABLE: "DOCUMENT_FOLDER_SERVICE_UNAVAILABLE",
116
128
  DOCUMENT_FOLDER_PATH_NOT_FOUND: "DOCUMENT_FOLDER_PATH_NOT_FOUND",
117
129
  // Email image proxy — token/fetch failures surfaced through the proxy route
118
- EMAIL_IMAGE_PROXY_INVALID_TOKEN: "EMAIL_IMAGE_PROXY_INVALID_TOKEN",
119
- EMAIL_IMAGE_PROXY_EXPIRED_TOKEN: "EMAIL_IMAGE_PROXY_EXPIRED_TOKEN",
120
- EMAIL_IMAGE_PROXY_TOO_LARGE: "EMAIL_IMAGE_PROXY_TOO_LARGE",
121
- EMAIL_IMAGE_PROXY_UNSUPPORTED_CONTENT_TYPE: "EMAIL_IMAGE_PROXY_UNSUPPORTED_CONTENT_TYPE",
122
- EMAIL_IMAGE_PROXY_UNSAFE_URL: "EMAIL_IMAGE_PROXY_UNSAFE_URL",
123
- EMAIL_IMAGE_PROXY_UPSTREAM_FAILED: "EMAIL_IMAGE_PROXY_UPSTREAM_FAILED",
124
130
  // Email provider sync — transport failures from Gmail / Microsoft Graph
125
131
  EMAIL_PROVIDER_API_FAILED: "EMAIL_PROVIDER_API_FAILED",
126
132
  EMAIL_BATCH_ITEM_FAILED: "EMAIL_BATCH_ITEM_FAILED",
133
+ // Calendar provider sync — transport failures from Google Calendar / Microsoft Graph
134
+ CALENDAR_PROVIDER_API_FAILED: "CALENDAR_PROVIDER_API_FAILED",
127
135
  // Reflexes — agent-authored deterministic automations
128
136
  REFLEX_INVALID_TRANSITION: "REFLEX_INVALID_TRANSITION",
129
137
  REFLEX_INVALID_TOKEN: "REFLEX_INVALID_TOKEN",
@@ -1,17 +1,17 @@
1
+ import { createPhoneValidator } from './chunk-R5LAJCBU.mjs';
2
+ import { createRelationValidator } from './chunk-GO6LQADH.mjs';
1
3
  import { createRichtextValidator } from './chunk-QVLQPW3O.mjs';
2
4
  import { createMultiselectValidator, createSelectValidator, createStatusValidator } from './chunk-ZDQ5AP26.mjs';
3
5
  import { createUserValidator } from './chunk-LV3FEUKU.mjs';
4
- import { createFormulaValidator } from './chunk-UXAHLSWC.mjs';
5
- import { createRollupValidator } from './chunk-NS63SPNN.mjs';
6
6
  import { createCheckboxValidator } from './chunk-OSSGN43B.mjs';
7
7
  import { createDateValidator } from './chunk-Q44QKLN4.mjs';
8
8
  import { createNumberValidator } from './chunk-UANQJ2GH.mjs';
9
9
  import { createTextValidator } from './chunk-O73ROMWQ.mjs';
10
- import { ValidationError } from './chunk-QLU5QR7M.mjs';
10
+ import { ValidationError } from './chunk-V2WJFUZW.mjs';
11
+ import { createFormulaValidator } from './chunk-UXAHLSWC.mjs';
12
+ import { createRollupValidator } from './chunk-NS63SPNN.mjs';
11
13
  import { createCurrencyValidator } from './chunk-AYVHMVKQ.mjs';
12
14
  import { createLocationValidator } from './chunk-YUFTHPOE.mjs';
13
- 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
 
@@ -74,6 +74,19 @@ function createFormAttributeValidator(attr, messages = DEFAULT_VALIDATION_MESSAG
74
74
  }
75
75
  return validator;
76
76
  }
77
+
78
+ // src/lib/empty.ts
79
+ function isNullishOrEmptyString(value) {
80
+ return value === null || value === void 0 || value === "";
81
+ }
82
+ function isValuePresent(value) {
83
+ if (value === null || value === void 0) return false;
84
+ if (typeof value === "string") return value.trim() !== "";
85
+ if (Array.isArray(value)) return value.length > 0;
86
+ return true;
87
+ }
88
+
89
+ // src/validation/object/object-validator.ts
77
90
  var objectValidatorCache = /* @__PURE__ */ new WeakMap();
78
91
  var draftValidatorCache = /* @__PURE__ */ new WeakMap();
79
92
  function createObjectValidator(objectDef) {
@@ -82,7 +95,13 @@ function createObjectValidator(objectDef) {
82
95
  const shape = {};
83
96
  for (const attr of objectDef.attributes) {
84
97
  const validator = createAttributeValidator(attr);
85
- shape[attr.name] = attr.required ? validator : withEmptyToNull(validator);
98
+ if (attr.required) {
99
+ shape[attr.name] = validator.refine(isValuePresent, {
100
+ message: DEFAULT_VALIDATION_MESSAGES.required(attr)
101
+ });
102
+ } else {
103
+ shape[attr.name] = withEmptyToNull(validator);
104
+ }
86
105
  }
87
106
  const schema = z.object(shape).passthrough();
88
107
  objectValidatorCache.set(objectDef, schema);
@@ -186,15 +205,6 @@ function rejectUnknownAttributesOrThrow(objectDef, data) {
186
205
  );
187
206
  }
188
207
  }
189
- function isValuePresent(value) {
190
- if (value === void 0 || value === null) {
191
- return false;
192
- }
193
- if (typeof value === "string" && value.trim() === "") {
194
- return false;
195
- }
196
- return true;
197
- }
198
208
  function getMissingRequiredAttributes(objectDef, data) {
199
209
  const missing = [];
200
210
  for (const attr of objectDef.attributes) {
@@ -213,4 +223,4 @@ function isRecordComplete(objectDef, data) {
213
223
  return validation.success;
214
224
  }
215
225
 
216
- export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow };
226
+ export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isNullishOrEmptyString, isRecordComplete, isValuePresent, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow };