@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
@@ -36,22 +36,11 @@ type ComputedValueType = {
36
36
  kind: "collection";
37
37
  itemType: "text" | "number" | "boolean" | "date" | "select";
38
38
  };
39
- type ComputedStateStatus = "pending" | "fresh" | "stale" | "failed";
40
39
  interface ComputedOptionsSource {
41
40
  objectName: string;
42
41
  attributeName: string;
43
42
  attributeId?: string;
44
43
  }
45
- interface ComputedAttributeState {
46
- attributeName: string;
47
- status: ComputedStateStatus;
48
- computedAt: Date | null;
49
- staleSince: Date | null;
50
- dependenciesHash: string | null;
51
- jobId: string | null;
52
- error: string | null;
53
- updatedAt: Date;
54
- }
55
44
  type ComputedDependency = {
56
45
  kind: "local";
57
46
  attributeName: string;
@@ -143,7 +132,8 @@ type OptionPropertyAttribute = SelectAttribute | StatusAttribute | MultiselectAt
143
132
  */
144
133
  declare function hasOptions(attr: PropertyAttribute): attr is OptionPropertyAttribute;
145
134
 
146
- type AttributeType = "text" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "user" | "relation" | "formula" | "rollup" | "document";
135
+ declare const ATTRIBUTE_TYPES: readonly ["text", "richtext", "number", "checkbox", "date", "phone", "currency", "status", "location", "select", "multiselect", "user", "relation", "formula", "rollup", "document"];
136
+ type AttributeType = (typeof ATTRIBUTE_TYPES)[number];
147
137
  /**
148
138
  * Status group categorization
149
139
  */
@@ -530,6 +520,17 @@ interface RollupAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "r
530
520
  * Used when function="original" to render values as the target type
531
521
  */
532
522
  targetAttributeType?: AttributeType;
523
+ /**
524
+ * Cached currency code of a currency target, from its `defaultCurrency`
525
+ * (#2644). The stored rollup value stays a bare number; this is the
526
+ * schema-derived channel that lets a single-code sum/avg render with its
527
+ * symbol. Absent → the value renders bare, exactly as before.
528
+ *
529
+ * Named for what it holds — an ISO 4217 CODE — rather than the siblings'
530
+ * `targetAttribute*` prefix: `targetAttributeCurrency` would read as a
531
+ * `Currency` value, which this deliberately is not.
532
+ */
533
+ targetCurrencyCode?: CurrencyCode;
533
534
  /**
534
535
  * Cached options from target attribute (for select/status/multiselect display)
535
536
  * Required when function="original" and target is a select-like type
@@ -580,4 +581,4 @@ declare function isAttributeSortable(attr: {
580
581
  type: AttributeType;
581
582
  }): boolean;
582
583
 
583
- export { type NumberUnit as $, type Attribute as A, type BilateralConfig as B, type CurrencyAttribute as C, type DateAttribute as D, type UserReferenceType as E, type FormulaAttribute as F, type AttributeGroup as G, type BaseAttribute as H, type ComputedFieldKind as I, type ComputedFormulaBinaryNode as J, type ComputedFormulaBinaryOperator as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type Option as O, type PhoneAttribute as P, type ComputedFormulaCallNode as Q, type RelationAttribute as R, type SingleRelationAttribute as S, type TextAttribute as T, type UserAttribute as U, type ComputedFormulaLiteralNode as V, ComputedFormulaParseError as W, type ComputedFormulaPathNode as X, type ComputedStateStatus as Y, type DateFormat as Z, type DateValue as _, type RichtextAttribute as a, type OptionPropertyAttribute as a0, type PropertyType as a1, RELATION_TARGET_ANY as a2, type RichTextAttribute as a3, type StatusGroup as a4, hasOptions as a5, inferInverseCardinality as a6, isAttributeSortable as a7, isBilateralRelation as a8, isUniversalRelation as a9, parseComputedFormula as aa, resolvePropertyDefinitions as ab, type MultiselectAttribute as b, type SelectAttribute as c, type StatusAttribute as d, type RollupAttribute as e, type AttributeType as f, type CheckboxAttribute as g, type ComputedAttributeState as h, type ComputedValueType as i, type ComputedReturnType as j, type ComputedOptionsSource as k, type ComputedDependency as l, type ComputedPlan as m, type ComputedFormulaAstNode as n, type LocationGranularity as o, type Location as p, type DateRangeValue as q, type DocumentAttribute as r, type Phone as s, type Currency as t, type PropertySchema as u, type TimeFormat as v, type PropertyAttribute as w, type FormulaReturnType as x, type RelationTarget as y, type RollupFunction as z };
584
+ export { type OptionPropertyAttribute as $, type Attribute as A, type BilateralConfig as B, type CurrencyAttribute as C, type DateAttribute as D, ATTRIBUTE_TYPES as E, type FormulaAttribute as F, type AttributeGroup as G, type BaseAttribute as H, type ComputedFieldKind as I, type ComputedFormulaBinaryNode as J, type ComputedFormulaBinaryOperator as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type Option as O, type PhoneAttribute as P, type ComputedFormulaCallNode as Q, type RelationAttribute as R, type SingleRelationAttribute as S, type TextAttribute as T, type UserAttribute as U, type ComputedFormulaLiteralNode as V, ComputedFormulaParseError as W, type ComputedFormulaPathNode as X, type DateFormat as Y, type DateValue as Z, type NumberUnit as _, type RichtextAttribute as a, type PropertyType as a0, RELATION_TARGET_ANY as a1, type RichTextAttribute as a2, type StatusGroup as a3, hasOptions as a4, inferInverseCardinality as a5, isAttributeSortable as a6, isBilateralRelation as a7, isUniversalRelation as a8, parseComputedFormula as a9, resolvePropertyDefinitions as aa, type MultiselectAttribute as b, type SelectAttribute as c, type StatusAttribute as d, type RollupAttribute as e, type AttributeType as f, type CheckboxAttribute as g, type ComputedValueType as h, type ComputedReturnType as i, type ComputedOptionsSource as j, type ComputedDependency as k, type ComputedPlan as l, type ComputedFormulaAstNode as m, type LocationGranularity as n, type Location as o, type DateRangeValue as p, type DocumentAttribute as q, type Phone as r, type Currency as s, type PropertySchema as t, type TimeFormat as u, type PropertyAttribute as v, type FormulaReturnType as w, type RelationTarget as x, type RollupFunction as y, type UserReferenceType as z };
@@ -36,22 +36,11 @@ type ComputedValueType = {
36
36
  kind: "collection";
37
37
  itemType: "text" | "number" | "boolean" | "date" | "select";
38
38
  };
39
- type ComputedStateStatus = "pending" | "fresh" | "stale" | "failed";
40
39
  interface ComputedOptionsSource {
41
40
  objectName: string;
42
41
  attributeName: string;
43
42
  attributeId?: string;
44
43
  }
45
- interface ComputedAttributeState {
46
- attributeName: string;
47
- status: ComputedStateStatus;
48
- computedAt: Date | null;
49
- staleSince: Date | null;
50
- dependenciesHash: string | null;
51
- jobId: string | null;
52
- error: string | null;
53
- updatedAt: Date;
54
- }
55
44
  type ComputedDependency = {
56
45
  kind: "local";
57
46
  attributeName: string;
@@ -143,7 +132,8 @@ type OptionPropertyAttribute = SelectAttribute | StatusAttribute | MultiselectAt
143
132
  */
144
133
  declare function hasOptions(attr: PropertyAttribute): attr is OptionPropertyAttribute;
145
134
 
146
- type AttributeType = "text" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "user" | "relation" | "formula" | "rollup" | "document";
135
+ declare const ATTRIBUTE_TYPES: readonly ["text", "richtext", "number", "checkbox", "date", "phone", "currency", "status", "location", "select", "multiselect", "user", "relation", "formula", "rollup", "document"];
136
+ type AttributeType = (typeof ATTRIBUTE_TYPES)[number];
147
137
  /**
148
138
  * Status group categorization
149
139
  */
@@ -530,6 +520,17 @@ interface RollupAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "r
530
520
  * Used when function="original" to render values as the target type
531
521
  */
532
522
  targetAttributeType?: AttributeType;
523
+ /**
524
+ * Cached currency code of a currency target, from its `defaultCurrency`
525
+ * (#2644). The stored rollup value stays a bare number; this is the
526
+ * schema-derived channel that lets a single-code sum/avg render with its
527
+ * symbol. Absent → the value renders bare, exactly as before.
528
+ *
529
+ * Named for what it holds — an ISO 4217 CODE — rather than the siblings'
530
+ * `targetAttribute*` prefix: `targetAttributeCurrency` would read as a
531
+ * `Currency` value, which this deliberately is not.
532
+ */
533
+ targetCurrencyCode?: CurrencyCode;
533
534
  /**
534
535
  * Cached options from target attribute (for select/status/multiselect display)
535
536
  * Required when function="original" and target is a select-like type
@@ -580,4 +581,4 @@ declare function isAttributeSortable(attr: {
580
581
  type: AttributeType;
581
582
  }): boolean;
582
583
 
583
- export { type NumberUnit as $, type Attribute as A, type BilateralConfig as B, type CurrencyAttribute as C, type DateAttribute as D, type UserReferenceType as E, type FormulaAttribute as F, type AttributeGroup as G, type BaseAttribute as H, type ComputedFieldKind as I, type ComputedFormulaBinaryNode as J, type ComputedFormulaBinaryOperator as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type Option as O, type PhoneAttribute as P, type ComputedFormulaCallNode as Q, type RelationAttribute as R, type SingleRelationAttribute as S, type TextAttribute as T, type UserAttribute as U, type ComputedFormulaLiteralNode as V, ComputedFormulaParseError as W, type ComputedFormulaPathNode as X, type ComputedStateStatus as Y, type DateFormat as Z, type DateValue as _, type RichtextAttribute as a, type OptionPropertyAttribute as a0, type PropertyType as a1, RELATION_TARGET_ANY as a2, type RichTextAttribute as a3, type StatusGroup as a4, hasOptions as a5, inferInverseCardinality as a6, isAttributeSortable as a7, isBilateralRelation as a8, isUniversalRelation as a9, parseComputedFormula as aa, resolvePropertyDefinitions as ab, type MultiselectAttribute as b, type SelectAttribute as c, type StatusAttribute as d, type RollupAttribute as e, type AttributeType as f, type CheckboxAttribute as g, type ComputedAttributeState as h, type ComputedValueType as i, type ComputedReturnType as j, type ComputedOptionsSource as k, type ComputedDependency as l, type ComputedPlan as m, type ComputedFormulaAstNode as n, type LocationGranularity as o, type Location as p, type DateRangeValue as q, type DocumentAttribute as r, type Phone as s, type Currency as t, type PropertySchema as u, type TimeFormat as v, type PropertyAttribute as w, type FormulaReturnType as x, type RelationTarget as y, type RollupFunction as z };
584
+ export { type OptionPropertyAttribute as $, type Attribute as A, type BilateralConfig as B, type CurrencyAttribute as C, type DateAttribute as D, ATTRIBUTE_TYPES as E, type FormulaAttribute as F, type AttributeGroup as G, type BaseAttribute as H, type ComputedFieldKind as I, type ComputedFormulaBinaryNode as J, type ComputedFormulaBinaryOperator as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type Option as O, type PhoneAttribute as P, type ComputedFormulaCallNode as Q, type RelationAttribute as R, type SingleRelationAttribute as S, type TextAttribute as T, type UserAttribute as U, type ComputedFormulaLiteralNode as V, ComputedFormulaParseError as W, type ComputedFormulaPathNode as X, type DateFormat as Y, type DateValue as Z, type NumberUnit as _, type RichtextAttribute as a, type PropertyType as a0, RELATION_TARGET_ANY as a1, type RichTextAttribute as a2, type StatusGroup as a3, hasOptions as a4, inferInverseCardinality as a5, isAttributeSortable as a6, isBilateralRelation as a7, isUniversalRelation as a8, parseComputedFormula as a9, resolvePropertyDefinitions as aa, type MultiselectAttribute as b, type SelectAttribute as c, type StatusAttribute as d, type RollupAttribute as e, type AttributeType as f, type CheckboxAttribute as g, type ComputedValueType as h, type ComputedReturnType as i, type ComputedOptionsSource as j, type ComputedDependency as k, type ComputedPlan as l, type ComputedFormulaAstNode as m, type LocationGranularity as n, type Location as o, type DateRangeValue as p, type DocumentAttribute as q, type Phone as r, type Currency as s, type PropertySchema as t, type TimeFormat as u, type PropertyAttribute as v, type FormulaReturnType as w, type RelationTarget as x, type RollupFunction as y, type UserReferenceType as z };
@@ -0,0 +1,146 @@
1
+ import { z } from 'zod';
2
+
3
+ /** Accepted forms of the object identifier every object-scoped capability takes. */
4
+ declare const OBJECT_ID_DESCRIPTION = "Object UUID, kebab-case name (e.g., 'contacts'), or display label (e.g., 'Personne physique'). All three are accepted; UUID is most precise.";
5
+ /** Shared suffix for record `data` inputs that accept `$fromSandboxFile` references for large content. */
6
+ declare const SANDBOX_FILE_DATA_HINT = " For large text content (> a few KB), write it to a sandbox file first and pass {\"$fromSandboxFile\": \"/workspace/<file>\"} as the attribute value \u2014 the server substitutes the file content.";
7
+ /**
8
+ * The LLM-facing filter shape, deliberately looser than its two siblings:
9
+ * `types/filters.ts` (`FilterState`, the canonical TS model — its `quantifier`
10
+ * is omitted here on purpose, agents don't set edge quantifiers) and
11
+ * `validators/view-config.schema.ts` (`filterStateSchema`, the strict capped
12
+ * variant for stored view config). The operator list in the describe text
13
+ * restates `filters/operators.ts` (`OPERATOR_SPECS`) and
14
+ * `filters/normalize-operator.ts` (`SYNONYM_ALIASES`) — those are the source
15
+ * of truth; keep the prose in sync when adding an operator.
16
+ */
17
+ declare const filtersSchema: z.ZodObject<{
18
+ combinator: z.ZodDefault<z.ZodEnum<{
19
+ and: "and";
20
+ or: "or";
21
+ }>>;
22
+ rules: z.ZodArray<z.ZodObject<{
23
+ attribute: z.ZodString;
24
+ property: z.ZodOptional<z.ZodString>;
25
+ operator: z.ZodString;
26
+ value: z.ZodNullable<z.ZodUnknown>;
27
+ }, z.core.$strip>>;
28
+ }, z.core.$strip>;
29
+ declare const sortsSchema: z.ZodArray<z.ZodObject<{
30
+ attribute: z.ZodString;
31
+ direction: z.ZodEnum<{
32
+ asc: "asc";
33
+ desc: "desc";
34
+ }>;
35
+ }, z.core.$strip>>;
36
+ /**
37
+ * Filter shapes derived from {@link filtersSchema} so the capability schema stays
38
+ * the single source of truth.
39
+ *
40
+ * The *parsed* shape (`z.infer`), deliberately: the runtime holds these after
41
+ * validation, when `combinator` has already been defaulted. What a caller may
42
+ * omit is `z.input`, and that is what {@link CapabilityInput} exposes.
43
+ */
44
+ type FilterStateInput = z.infer<typeof filtersSchema>;
45
+ type FilterRuleInput = FilterStateInput["rules"][number];
46
+ /** How a capability mutates data, which decides whether a rehearsal captures it. */
47
+ type CapabilityKind = "read" | "create" | "update" | "delete";
48
+ /**
49
+ * Every capability a Reflex may call, defined once.
50
+ *
51
+ * Deliberately five entries — the single-record tools whose input the gateway can
52
+ * turn into a faithful `RunEffect`. Excluded on purpose: `get_schema`,
53
+ * `global_search` and `bulk_search`, which are not scoped to one object and so
54
+ * yield no object to grant a permission on; and the `bulk_*` record tools, where
55
+ * one call mutates many records and would be recorded as a single effect, making
56
+ * an effects report understate what happened.
57
+ *
58
+ * `description` is NOT here: the tools compute it per call from their config
59
+ * (`schemaInContext` changes the wording), and `schema-tools-descriptions.test.ts`
60
+ * pins both variants. The name, the kind and the input schema are what must exist
61
+ * exactly once, and they do.
62
+ */
63
+ declare const RECORD_CAPABILITIES: {
64
+ readonly get_record: {
65
+ readonly name: "get_record";
66
+ readonly kind: "read";
67
+ readonly input: z.ZodObject<{
68
+ recordId: z.ZodString;
69
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
+ }, z.core.$strip>;
71
+ };
72
+ readonly search_records: {
73
+ readonly name: "search_records";
74
+ readonly kind: "read";
75
+ readonly input: z.ZodObject<{
76
+ objectId: z.ZodString;
77
+ _displayLabel: z.ZodOptional<z.ZodString>;
78
+ query: z.ZodOptional<z.ZodString>;
79
+ limit: z.ZodOptional<z.ZodNumber>;
80
+ offset: z.ZodOptional<z.ZodNumber>;
81
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
+ filters: z.ZodOptional<z.ZodObject<{
83
+ combinator: z.ZodDefault<z.ZodEnum<{
84
+ and: "and";
85
+ or: "or";
86
+ }>>;
87
+ rules: z.ZodArray<z.ZodObject<{
88
+ attribute: z.ZodString;
89
+ property: z.ZodOptional<z.ZodString>;
90
+ operator: z.ZodString;
91
+ value: z.ZodNullable<z.ZodUnknown>;
92
+ }, z.core.$strip>>;
93
+ }, z.core.$strip>>;
94
+ sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
95
+ attribute: z.ZodString;
96
+ direction: z.ZodEnum<{
97
+ asc: "asc";
98
+ desc: "desc";
99
+ }>;
100
+ }, z.core.$strip>>>;
101
+ }, z.core.$strip>;
102
+ };
103
+ readonly create_record: {
104
+ readonly name: "create_record";
105
+ readonly kind: "create";
106
+ readonly input: z.ZodObject<{
107
+ objectId: z.ZodString;
108
+ _displayLabel: z.ZodOptional<z.ZodString>;
109
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
110
+ }, z.core.$strip>;
111
+ };
112
+ readonly update_record: {
113
+ readonly name: "update_record";
114
+ readonly kind: "update";
115
+ readonly input: z.ZodObject<{
116
+ recordId: z.ZodString;
117
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
118
+ }, z.core.$strip>;
119
+ };
120
+ readonly delete_record: {
121
+ readonly name: "delete_record";
122
+ readonly kind: "delete";
123
+ readonly input: z.ZodObject<{
124
+ recordId: z.ZodString;
125
+ }, z.core.$strip>;
126
+ };
127
+ };
128
+ type RecordCapabilityName = keyof typeof RECORD_CAPABILITIES;
129
+ /**
130
+ * A capability's argument type, inferred from the very schema the runtime
131
+ * validates against.
132
+ *
133
+ * `z.input`, not `z.infer`: these are the arguments a caller supplies, and the
134
+ * two sides differ wherever a field has a `.default()` — `filtersSchema`'s
135
+ * `combinator` is required on the output and optional on the input. Typing
136
+ * arguments with the output side made the SDK demand a `combinator` the runtime
137
+ * would have filled in anyway.
138
+ */
139
+ type CapabilityInput<N extends RecordCapabilityName> = z.input<(typeof RECORD_CAPABILITIES)[N]["input"]>;
140
+ /**
141
+ * The capability → kind projection, derived rather than restated. The reflexes
142
+ * module reads this instead of maintaining its own table (D26/D28).
143
+ */
144
+ declare const RECORD_CAPABILITY_KINDS: Readonly<Record<RecordCapabilityName, CapabilityKind>>;
145
+
146
+ export { type CapabilityInput, type CapabilityKind, type FilterRuleInput, type FilterStateInput, OBJECT_ID_DESCRIPTION, RECORD_CAPABILITIES, RECORD_CAPABILITY_KINDS, type RecordCapabilityName, SANDBOX_FILE_DATA_HINT, filtersSchema, sortsSchema };
@@ -0,0 +1,146 @@
1
+ import { z } from 'zod';
2
+
3
+ /** Accepted forms of the object identifier every object-scoped capability takes. */
4
+ declare const OBJECT_ID_DESCRIPTION = "Object UUID, kebab-case name (e.g., 'contacts'), or display label (e.g., 'Personne physique'). All three are accepted; UUID is most precise.";
5
+ /** Shared suffix for record `data` inputs that accept `$fromSandboxFile` references for large content. */
6
+ declare const SANDBOX_FILE_DATA_HINT = " For large text content (> a few KB), write it to a sandbox file first and pass {\"$fromSandboxFile\": \"/workspace/<file>\"} as the attribute value \u2014 the server substitutes the file content.";
7
+ /**
8
+ * The LLM-facing filter shape, deliberately looser than its two siblings:
9
+ * `types/filters.ts` (`FilterState`, the canonical TS model — its `quantifier`
10
+ * is omitted here on purpose, agents don't set edge quantifiers) and
11
+ * `validators/view-config.schema.ts` (`filterStateSchema`, the strict capped
12
+ * variant for stored view config). The operator list in the describe text
13
+ * restates `filters/operators.ts` (`OPERATOR_SPECS`) and
14
+ * `filters/normalize-operator.ts` (`SYNONYM_ALIASES`) — those are the source
15
+ * of truth; keep the prose in sync when adding an operator.
16
+ */
17
+ declare const filtersSchema: z.ZodObject<{
18
+ combinator: z.ZodDefault<z.ZodEnum<{
19
+ and: "and";
20
+ or: "or";
21
+ }>>;
22
+ rules: z.ZodArray<z.ZodObject<{
23
+ attribute: z.ZodString;
24
+ property: z.ZodOptional<z.ZodString>;
25
+ operator: z.ZodString;
26
+ value: z.ZodNullable<z.ZodUnknown>;
27
+ }, z.core.$strip>>;
28
+ }, z.core.$strip>;
29
+ declare const sortsSchema: z.ZodArray<z.ZodObject<{
30
+ attribute: z.ZodString;
31
+ direction: z.ZodEnum<{
32
+ asc: "asc";
33
+ desc: "desc";
34
+ }>;
35
+ }, z.core.$strip>>;
36
+ /**
37
+ * Filter shapes derived from {@link filtersSchema} so the capability schema stays
38
+ * the single source of truth.
39
+ *
40
+ * The *parsed* shape (`z.infer`), deliberately: the runtime holds these after
41
+ * validation, when `combinator` has already been defaulted. What a caller may
42
+ * omit is `z.input`, and that is what {@link CapabilityInput} exposes.
43
+ */
44
+ type FilterStateInput = z.infer<typeof filtersSchema>;
45
+ type FilterRuleInput = FilterStateInput["rules"][number];
46
+ /** How a capability mutates data, which decides whether a rehearsal captures it. */
47
+ type CapabilityKind = "read" | "create" | "update" | "delete";
48
+ /**
49
+ * Every capability a Reflex may call, defined once.
50
+ *
51
+ * Deliberately five entries — the single-record tools whose input the gateway can
52
+ * turn into a faithful `RunEffect`. Excluded on purpose: `get_schema`,
53
+ * `global_search` and `bulk_search`, which are not scoped to one object and so
54
+ * yield no object to grant a permission on; and the `bulk_*` record tools, where
55
+ * one call mutates many records and would be recorded as a single effect, making
56
+ * an effects report understate what happened.
57
+ *
58
+ * `description` is NOT here: the tools compute it per call from their config
59
+ * (`schemaInContext` changes the wording), and `schema-tools-descriptions.test.ts`
60
+ * pins both variants. The name, the kind and the input schema are what must exist
61
+ * exactly once, and they do.
62
+ */
63
+ declare const RECORD_CAPABILITIES: {
64
+ readonly get_record: {
65
+ readonly name: "get_record";
66
+ readonly kind: "read";
67
+ readonly input: z.ZodObject<{
68
+ recordId: z.ZodString;
69
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
+ }, z.core.$strip>;
71
+ };
72
+ readonly search_records: {
73
+ readonly name: "search_records";
74
+ readonly kind: "read";
75
+ readonly input: z.ZodObject<{
76
+ objectId: z.ZodString;
77
+ _displayLabel: z.ZodOptional<z.ZodString>;
78
+ query: z.ZodOptional<z.ZodString>;
79
+ limit: z.ZodOptional<z.ZodNumber>;
80
+ offset: z.ZodOptional<z.ZodNumber>;
81
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
+ filters: z.ZodOptional<z.ZodObject<{
83
+ combinator: z.ZodDefault<z.ZodEnum<{
84
+ and: "and";
85
+ or: "or";
86
+ }>>;
87
+ rules: z.ZodArray<z.ZodObject<{
88
+ attribute: z.ZodString;
89
+ property: z.ZodOptional<z.ZodString>;
90
+ operator: z.ZodString;
91
+ value: z.ZodNullable<z.ZodUnknown>;
92
+ }, z.core.$strip>>;
93
+ }, z.core.$strip>>;
94
+ sorts: z.ZodOptional<z.ZodArray<z.ZodObject<{
95
+ attribute: z.ZodString;
96
+ direction: z.ZodEnum<{
97
+ asc: "asc";
98
+ desc: "desc";
99
+ }>;
100
+ }, z.core.$strip>>>;
101
+ }, z.core.$strip>;
102
+ };
103
+ readonly create_record: {
104
+ readonly name: "create_record";
105
+ readonly kind: "create";
106
+ readonly input: z.ZodObject<{
107
+ objectId: z.ZodString;
108
+ _displayLabel: z.ZodOptional<z.ZodString>;
109
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
110
+ }, z.core.$strip>;
111
+ };
112
+ readonly update_record: {
113
+ readonly name: "update_record";
114
+ readonly kind: "update";
115
+ readonly input: z.ZodObject<{
116
+ recordId: z.ZodString;
117
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
118
+ }, z.core.$strip>;
119
+ };
120
+ readonly delete_record: {
121
+ readonly name: "delete_record";
122
+ readonly kind: "delete";
123
+ readonly input: z.ZodObject<{
124
+ recordId: z.ZodString;
125
+ }, z.core.$strip>;
126
+ };
127
+ };
128
+ type RecordCapabilityName = keyof typeof RECORD_CAPABILITIES;
129
+ /**
130
+ * A capability's argument type, inferred from the very schema the runtime
131
+ * validates against.
132
+ *
133
+ * `z.input`, not `z.infer`: these are the arguments a caller supplies, and the
134
+ * two sides differ wherever a field has a `.default()` — `filtersSchema`'s
135
+ * `combinator` is required on the output and optional on the input. Typing
136
+ * arguments with the output side made the SDK demand a `combinator` the runtime
137
+ * would have filled in anyway.
138
+ */
139
+ type CapabilityInput<N extends RecordCapabilityName> = z.input<(typeof RECORD_CAPABILITIES)[N]["input"]>;
140
+ /**
141
+ * The capability → kind projection, derived rather than restated. The reflexes
142
+ * module reads this instead of maintaining its own table (D26/D28).
143
+ */
144
+ declare const RECORD_CAPABILITY_KINDS: Readonly<Record<RecordCapabilityName, CapabilityKind>>;
145
+
146
+ export { type CapabilityInput, type CapabilityKind, type FilterRuleInput, type FilterStateInput, OBJECT_ID_DESCRIPTION, RECORD_CAPABILITIES, RECORD_CAPABILITY_KINDS, type RecordCapabilityName, SANDBOX_FILE_DATA_HINT, filtersSchema, sortsSchema };
@@ -0,0 +1,77 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // src/capabilities.ts
6
+ var OBJECT_ID_DESCRIPTION = "Object UUID, kebab-case name (e.g., 'contacts'), or display label (e.g., 'Personne physique'). All three are accepted; UUID is most precise.";
7
+ var SANDBOX_FILE_DATA_HINT = ' For large text content (> a few KB), write it to a sandbox file first and pass {"$fromSandboxFile": "/workspace/<file>"} as the attribute value \u2014 the server substitutes the file content.';
8
+ var filtersSchema = zod.z.object({
9
+ combinator: zod.z.enum(["and", "or"]).default("and"),
10
+ rules: zod.z.array(
11
+ zod.z.object({
12
+ attribute: zod.z.string().describe("Attribute name on the object being searched"),
13
+ property: zod.z.string().optional().describe(
14
+ "Optional. Only valid when 'attribute' is a relation / document / user attribute declared with .qualifyWith({...}). When set, the rule filters on the named EDGE property (not the linked record) and the operator must be valid for that property's type. See <filter_operators>."
15
+ ),
16
+ operator: zod.z.string().describe(
17
+ "Filter operator (canonical: is, is_not, contains, not_contains, starts_with, ends_with, less_than, greater_than, less_or_equal, greater_or_equal, is_within, on_day_month, any_of, none_of, is_empty, is_not_empty). Short codes (lt, gt, lte, gte, eq, neq, in) are accepted as input and auto-normalized to the canonical names. The valid set depends on the attribute type (or property type when 'property' is set) \u2014 see <filter_operators>."
18
+ ),
19
+ value: zod.z.unknown().nullable().describe(
20
+ "Value matching the attribute (or property) type: scalar for is/contains/less_than/etc (checkbox is: true|false); array (string[]) for any_of/none_of; null for is_empty/is_not_empty; { amount, unit, direction } for is_within; { day, month } for on_day_month."
21
+ )
22
+ })
23
+ )
24
+ });
25
+ var sortsSchema = zod.z.array(
26
+ zod.z.object({
27
+ attribute: zod.z.string().describe("Attribute name"),
28
+ direction: zod.z.enum(["asc", "desc"])
29
+ })
30
+ );
31
+ var getRecordInput = zod.z.object({
32
+ recordId: zod.z.string().describe("Record UUID"),
33
+ fields: zod.z.array(zod.z.string()).optional().describe("Attribute names to return")
34
+ });
35
+ var searchRecordsInput = zod.z.object({
36
+ objectId: zod.z.string().describe(OBJECT_ID_DESCRIPTION),
37
+ _displayLabel: zod.z.string().optional().describe("Display label"),
38
+ query: zod.z.string().optional().describe("Full-text search query (omit to browse/list)"),
39
+ limit: zod.z.number().optional().describe("Max results per call: 1-1000 (default 20). Paginate via offset for more."),
40
+ offset: zod.z.number().optional().describe("Skip N records (default 0)"),
41
+ fields: zod.z.array(zod.z.string()).optional().describe("Attribute names to include in values"),
42
+ filters: filtersSchema.optional().describe(
43
+ "Structured filter: { combinator: 'and'|'or', rules: [{attribute, operator, value, property?}] }. Operators are constrained per attribute type \u2014 see <filter_operators>. Use 'property' on a rule to filter on a qualified edge property."
44
+ ),
45
+ sorts: sortsSchema.optional().describe("Sorts: [{ attribute, direction: 'asc'|'desc' }]")
46
+ });
47
+ var createRecordInput = zod.z.object({
48
+ objectId: zod.z.string().describe(OBJECT_ID_DESCRIPTION),
49
+ _displayLabel: zod.z.string().optional().describe("Display label"),
50
+ data: zod.z.record(zod.z.string(), zod.z.unknown()).describe(`Record data.${SANDBOX_FILE_DATA_HINT}`)
51
+ });
52
+ var updateRecordInput = zod.z.object({
53
+ recordId: zod.z.string().describe("Record UUID"),
54
+ data: zod.z.record(zod.z.string(), zod.z.unknown()).describe(`Fields to update.${SANDBOX_FILE_DATA_HINT}`)
55
+ });
56
+ var deleteRecordInput = zod.z.object({
57
+ recordId: zod.z.string().describe("Record UUID")
58
+ });
59
+ var RECORD_CAPABILITIES = {
60
+ get_record: { name: "get_record", kind: "read", input: getRecordInput },
61
+ search_records: { name: "search_records", kind: "read", input: searchRecordsInput },
62
+ create_record: { name: "create_record", kind: "create", input: createRecordInput },
63
+ update_record: { name: "update_record", kind: "update", input: updateRecordInput },
64
+ delete_record: { name: "delete_record", kind: "delete", input: deleteRecordInput }
65
+ };
66
+ var RECORD_CAPABILITY_KINDS = Object.freeze(
67
+ Object.fromEntries(
68
+ Object.values(RECORD_CAPABILITIES).map((capability) => [capability.name, capability.kind])
69
+ )
70
+ );
71
+
72
+ exports.OBJECT_ID_DESCRIPTION = OBJECT_ID_DESCRIPTION;
73
+ exports.RECORD_CAPABILITIES = RECORD_CAPABILITIES;
74
+ exports.RECORD_CAPABILITY_KINDS = RECORD_CAPABILITY_KINDS;
75
+ exports.SANDBOX_FILE_DATA_HINT = SANDBOX_FILE_DATA_HINT;
76
+ exports.filtersSchema = filtersSchema;
77
+ exports.sortsSchema = sortsSchema;
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/capabilities.ts
4
+ var OBJECT_ID_DESCRIPTION = "Object UUID, kebab-case name (e.g., 'contacts'), or display label (e.g., 'Personne physique'). All three are accepted; UUID is most precise.";
5
+ var SANDBOX_FILE_DATA_HINT = ' For large text content (> a few KB), write it to a sandbox file first and pass {"$fromSandboxFile": "/workspace/<file>"} as the attribute value \u2014 the server substitutes the file content.';
6
+ var filtersSchema = z.object({
7
+ combinator: z.enum(["and", "or"]).default("and"),
8
+ rules: z.array(
9
+ z.object({
10
+ attribute: z.string().describe("Attribute name on the object being searched"),
11
+ property: z.string().optional().describe(
12
+ "Optional. Only valid when 'attribute' is a relation / document / user attribute declared with .qualifyWith({...}). When set, the rule filters on the named EDGE property (not the linked record) and the operator must be valid for that property's type. See <filter_operators>."
13
+ ),
14
+ operator: z.string().describe(
15
+ "Filter operator (canonical: is, is_not, contains, not_contains, starts_with, ends_with, less_than, greater_than, less_or_equal, greater_or_equal, is_within, on_day_month, any_of, none_of, is_empty, is_not_empty). Short codes (lt, gt, lte, gte, eq, neq, in) are accepted as input and auto-normalized to the canonical names. The valid set depends on the attribute type (or property type when 'property' is set) \u2014 see <filter_operators>."
16
+ ),
17
+ value: z.unknown().nullable().describe(
18
+ "Value matching the attribute (or property) type: scalar for is/contains/less_than/etc (checkbox is: true|false); array (string[]) for any_of/none_of; null for is_empty/is_not_empty; { amount, unit, direction } for is_within; { day, month } for on_day_month."
19
+ )
20
+ })
21
+ )
22
+ });
23
+ var sortsSchema = z.array(
24
+ z.object({
25
+ attribute: z.string().describe("Attribute name"),
26
+ direction: z.enum(["asc", "desc"])
27
+ })
28
+ );
29
+ var getRecordInput = z.object({
30
+ recordId: z.string().describe("Record UUID"),
31
+ fields: z.array(z.string()).optional().describe("Attribute names to return")
32
+ });
33
+ var searchRecordsInput = z.object({
34
+ objectId: z.string().describe(OBJECT_ID_DESCRIPTION),
35
+ _displayLabel: z.string().optional().describe("Display label"),
36
+ query: z.string().optional().describe("Full-text search query (omit to browse/list)"),
37
+ limit: z.number().optional().describe("Max results per call: 1-1000 (default 20). Paginate via offset for more."),
38
+ offset: z.number().optional().describe("Skip N records (default 0)"),
39
+ fields: z.array(z.string()).optional().describe("Attribute names to include in values"),
40
+ filters: filtersSchema.optional().describe(
41
+ "Structured filter: { combinator: 'and'|'or', rules: [{attribute, operator, value, property?}] }. Operators are constrained per attribute type \u2014 see <filter_operators>. Use 'property' on a rule to filter on a qualified edge property."
42
+ ),
43
+ sorts: sortsSchema.optional().describe("Sorts: [{ attribute, direction: 'asc'|'desc' }]")
44
+ });
45
+ var createRecordInput = z.object({
46
+ objectId: z.string().describe(OBJECT_ID_DESCRIPTION),
47
+ _displayLabel: z.string().optional().describe("Display label"),
48
+ data: z.record(z.string(), z.unknown()).describe(`Record data.${SANDBOX_FILE_DATA_HINT}`)
49
+ });
50
+ var updateRecordInput = z.object({
51
+ recordId: z.string().describe("Record UUID"),
52
+ data: z.record(z.string(), z.unknown()).describe(`Fields to update.${SANDBOX_FILE_DATA_HINT}`)
53
+ });
54
+ var deleteRecordInput = z.object({
55
+ recordId: z.string().describe("Record UUID")
56
+ });
57
+ var RECORD_CAPABILITIES = {
58
+ get_record: { name: "get_record", kind: "read", input: getRecordInput },
59
+ search_records: { name: "search_records", kind: "read", input: searchRecordsInput },
60
+ create_record: { name: "create_record", kind: "create", input: createRecordInput },
61
+ update_record: { name: "update_record", kind: "update", input: updateRecordInput },
62
+ delete_record: { name: "delete_record", kind: "delete", input: deleteRecordInput }
63
+ };
64
+ var RECORD_CAPABILITY_KINDS = Object.freeze(
65
+ Object.fromEntries(
66
+ Object.values(RECORD_CAPABILITIES).map((capability) => [capability.name, capability.kind])
67
+ )
68
+ );
69
+
70
+ export { OBJECT_ID_DESCRIPTION, RECORD_CAPABILITIES, RECORD_CAPABILITY_KINDS, SANDBOX_FILE_DATA_HINT, filtersSchema, sortsSchema };
@@ -1,4 +1,4 @@
1
- import { ValidationError } from './chunk-SYQDFZ74.mjs';
1
+ import { ValidationError } from './chunk-RUO25ERR.mjs';
2
2
  import { z } from 'zod';
3
3
  import { ICONS, COLORS } from '@stndrds/constants';
4
4
 
@@ -316,6 +316,7 @@ var SCHEMA_LIMITS = {
316
316
  columnsPerTab: 50,
317
317
  optionsPerAttribute: 200,
318
318
  sidePanelAttributes: 100,
319
+ sidePanelPanes: 20,
319
320
  filterRulesPerTab: 50,
320
321
  sortsPerTab: 20,
321
322
  emailAttributesPerTab: 30,
@@ -510,6 +511,9 @@ var rollupConfigSchema = baseConfigSchema.extend({
510
511
  decimals: z.number().int().min(0).max(10).optional(),
511
512
  targetAttributeType: z.string().optional(),
512
513
  targetAttributeOptions: z.array(optionSchema).optional(),
514
+ // The sum's symbol (#2644) — declared here or `.strip()` eats it before
515
+ // storage, exactly the fate this schema spares its two siblings above.
516
+ targetCurrencyCode: z.string().length(3).optional(),
513
517
  optionsSource: computedOptionsSourceSchema.optional()
514
518
  });
515
519
  var propertySchemaPassthrough = z.object({ definitions: z.array(z.record(z.string(), z.unknown())) }).passthrough();
@@ -545,7 +549,7 @@ var attributeConfigSchemas = {
545
549
  function getAttributeConfigSchema(type) {
546
550
  const schema = attributeConfigSchemas[type];
547
551
  if (!schema) {
548
- throw new Error(`Unsupported attribute type: ${type}`);
552
+ throw new ValidationError(`Unsupported attribute type: ${type}`, []);
549
553
  }
550
554
  return schema;
551
555
  }
@@ -634,4 +638,4 @@ function parseAttributeConfigForUpdate(stored, patch) {
634
638
  return parsed;
635
639
  }
636
640
 
637
- export { ComputedFormulaParseError, SCHEMA_LIMITS, attributeConfigSchemas, colorIdSchema, getAttributeConfigSchema, iconNameSchema, multiselectOptionWriteSchema, parseAttributeConfig, parseAttributeConfigForCreate, parseAttributeConfigForUpdate, parseComputedFormula, selectOptionWriteSchema, statusGroupSchema, statusOptionWriteSchema };
641
+ export { ComputedFormulaParseError, SCHEMA_LIMITS, attributeConfigSchemas, colorIdSchema, getAttributeConfigSchema, getAttributeConfigWriteSchema, iconNameSchema, multiselectOptionWriteSchema, parseAttributeConfig, parseAttributeConfigForCreate, parseAttributeConfigForUpdate, parseComputedFormula, selectOptionWriteSchema, statusGroupSchema, statusOptionWriteSchema };