@standards/schema 1.0.0-alpha.413 → 1.0.0-alpha.415

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 (136) hide show
  1. package/dist/all-Bldqj4jl.d.ts +4360 -0
  2. package/dist/all-BxsoHW0V.js +4 -0
  3. package/dist/all-C27HT84u.mjs +4 -0
  4. package/dist/all-CmG4j3B_.d.mts +4360 -0
  5. package/dist/api/index.d.mts +376 -709
  6. package/dist/api/index.d.ts +376 -709
  7. package/dist/api/index.js +1 -1
  8. package/dist/api/index.mjs +1 -1
  9. package/dist/{exceptions-BHqt4Omx.d.ts → exceptions-BIqEbF4H.d.mts} +0 -1
  10. package/dist/{exceptions-BHqt4Omx.d.mts → exceptions-BIqEbF4H.d.ts} +0 -1
  11. package/dist/exceptions.d.mts +1 -1
  12. package/dist/exceptions.d.ts +1 -1
  13. package/dist/exceptions.js +1 -1
  14. package/dist/exceptions.mjs +1 -1
  15. package/dist/{index-CkhBfmkf.d.mts → index-BGdQIO0V.d.mts} +535 -524
  16. package/dist/{index-C8VygCbt.d.ts → index-DIo9VcVh.d.ts} +535 -524
  17. package/dist/index.d.mts +5 -10
  18. package/dist/index.d.ts +5 -10
  19. package/dist/index.js +1653 -1
  20. package/dist/index.mjs +1653 -1
  21. package/dist/primitives-DpBFjzxV.mjs +11 -0
  22. package/dist/primitives-s7GS1T3w.js +11 -0
  23. package/dist/record-operation-C-qr4zs3.js +2 -0
  24. package/dist/record-operation-DM8ZJvmH.mjs +2 -0
  25. package/dist/{utils-BT8u9zYO.d.mts → utils-CIVBFpC3.d.mts} +1 -1
  26. package/dist/{utils-CChBw_3d.d.ts → utils-iNW5feob.d.ts} +1 -1
  27. package/dist/utils.d.mts +1 -1
  28. package/dist/utils.d.ts +1 -1
  29. package/dist/validation/all.d.mts +1 -4
  30. package/dist/validation/all.d.ts +1 -4
  31. package/dist/validation/all.js +1 -1
  32. package/dist/validation/all.mjs +1 -1
  33. package/package.json +2 -172
  34. package/dist/all-B9epSh3g.mjs +0 -2
  35. package/dist/all-Cg6JJd0x.d.ts +0 -2967
  36. package/dist/all-CkcnOJxd.d.mts +0 -2967
  37. package/dist/all-iuPkq14_.js +0 -2
  38. package/dist/attributes-DW19xkoM.d.ts +0 -561
  39. package/dist/attributes-QBySx30F.d.mts +0 -561
  40. package/dist/checkbox-O7Onsazk.d.mts +0 -10
  41. package/dist/checkbox-u5bh3lq-.d.ts +0 -10
  42. package/dist/config-YSw2jzWj.js +0 -2
  43. package/dist/config-iUwnquKr.mjs +0 -2
  44. package/dist/core-DAxRlJ5i.js +0 -2
  45. package/dist/core-rKI7Q9_U.mjs +0 -2
  46. package/dist/date-Bn8fqwCq.d.ts +0 -23
  47. package/dist/date-D7JMxFgD.d.mts +0 -23
  48. package/dist/index-BFKJEyq-.d.ts +0 -52
  49. package/dist/index-Cc3a-97k.d.ts +0 -271
  50. package/dist/index-CtmwL85u.d.ts +0 -100
  51. package/dist/index-DR5eSskq.d.mts +0 -271
  52. package/dist/index-D_IPqiMd.d.mts +0 -100
  53. package/dist/index-jE6uAt4g.d.mts +0 -52
  54. package/dist/number-DGfXEFnt.d.mts +0 -10
  55. package/dist/number-DiV9wvFE.d.ts +0 -10
  56. package/dist/object-5-wnsH0o.js +0 -4
  57. package/dist/object-BF5y6bgs.mjs +0 -4
  58. package/dist/objects-B4OojzI4.d.mts +0 -478
  59. package/dist/objects-Cvd1pe1g.d.ts +0 -478
  60. package/dist/phone-BGJea5sr.mjs +0 -2
  61. package/dist/phone-DHXyNkVY.js +0 -2
  62. package/dist/primitives-BCJLtpaI.mjs +0 -11
  63. package/dist/primitives-CVbrjJ24.js +0 -11
  64. package/dist/record-aggregates-BrLE4IsX.mjs +0 -2
  65. package/dist/record-aggregates-BuOfVWPJ.js +0 -2
  66. package/dist/record-operation-B4DrBgkp.mjs +0 -2
  67. package/dist/record-operation-BA4V9LB0.js +0 -2
  68. package/dist/rolldown-runtime-DETHMehu.js +0 -2
  69. package/dist/text-8GklpZzL.d.mts +0 -10
  70. package/dist/text-BaxaZ5Vv.mjs +0 -2
  71. package/dist/text-Biomo4m8.d.ts +0 -10
  72. package/dist/text-DVrTGjjX.js +0 -2
  73. package/dist/validation/complex/currency.d.mts +0 -13
  74. package/dist/validation/complex/currency.d.ts +0 -13
  75. package/dist/validation/complex/currency.js +0 -2
  76. package/dist/validation/complex/currency.mjs +0 -2
  77. package/dist/validation/complex/location.d.mts +0 -20
  78. package/dist/validation/complex/location.d.ts +0 -20
  79. package/dist/validation/complex/location.js +0 -2
  80. package/dist/validation/complex/location.mjs +0 -2
  81. package/dist/validation/complex/phone.d.mts +0 -20
  82. package/dist/validation/complex/phone.d.ts +0 -20
  83. package/dist/validation/complex/phone.js +0 -2
  84. package/dist/validation/complex/phone.mjs +0 -2
  85. package/dist/validation/complex/relation.d.mts +0 -23
  86. package/dist/validation/complex/relation.d.ts +0 -23
  87. package/dist/validation/complex/relation.js +0 -2
  88. package/dist/validation/complex/relation.mjs +0 -2
  89. package/dist/validation/complex/richtext.d.mts +0 -11
  90. package/dist/validation/complex/richtext.d.ts +0 -11
  91. package/dist/validation/complex/richtext.js +0 -2
  92. package/dist/validation/complex/richtext.mjs +0 -2
  93. package/dist/validation/complex/select.d.mts +0 -18
  94. package/dist/validation/complex/select.d.ts +0 -18
  95. package/dist/validation/complex/select.js +0 -2
  96. package/dist/validation/complex/select.mjs +0 -2
  97. package/dist/validation/complex/user.d.mts +0 -11
  98. package/dist/validation/complex/user.d.ts +0 -11
  99. package/dist/validation/complex/user.js +0 -2
  100. package/dist/validation/complex/user.mjs +0 -2
  101. package/dist/validation/computed/formula.d.mts +0 -12
  102. package/dist/validation/computed/formula.d.ts +0 -12
  103. package/dist/validation/computed/formula.js +0 -2
  104. package/dist/validation/computed/formula.mjs +0 -2
  105. package/dist/validation/computed/rollup.d.mts +0 -12
  106. package/dist/validation/computed/rollup.d.ts +0 -12
  107. package/dist/validation/computed/rollup.js +0 -2
  108. package/dist/validation/computed/rollup.mjs +0 -2
  109. package/dist/validation/config/index.d.mts +0 -3
  110. package/dist/validation/config/index.d.ts +0 -3
  111. package/dist/validation/config/index.js +0 -2
  112. package/dist/validation/config/index.mjs +0 -2
  113. package/dist/validation/core/index.d.mts +0 -3
  114. package/dist/validation/core/index.d.ts +0 -3
  115. package/dist/validation/core/index.js +0 -2
  116. package/dist/validation/core/index.mjs +0 -2
  117. package/dist/validation/object/index.d.mts +0 -3
  118. package/dist/validation/object/index.d.ts +0 -3
  119. package/dist/validation/object/index.js +0 -2
  120. package/dist/validation/object/index.mjs +0 -2
  121. package/dist/validation/primitives/checkbox.d.mts +0 -3
  122. package/dist/validation/primitives/checkbox.d.ts +0 -3
  123. package/dist/validation/primitives/checkbox.js +0 -2
  124. package/dist/validation/primitives/checkbox.mjs +0 -2
  125. package/dist/validation/primitives/date.d.mts +0 -3
  126. package/dist/validation/primitives/date.d.ts +0 -3
  127. package/dist/validation/primitives/date.js +0 -2
  128. package/dist/validation/primitives/date.mjs +0 -2
  129. package/dist/validation/primitives/number.d.mts +0 -3
  130. package/dist/validation/primitives/number.d.ts +0 -3
  131. package/dist/validation/primitives/number.js +0 -2
  132. package/dist/validation/primitives/number.mjs +0 -2
  133. package/dist/validation/primitives/text.d.mts +0 -3
  134. package/dist/validation/primitives/text.d.ts +0 -3
  135. package/dist/validation/primitives/text.js +0 -2
  136. package/dist/validation/primitives/text.mjs +0 -2
@@ -1,561 +0,0 @@
1
-
2
- import { Uuid } from "./utils-BT8u9zYO.mjs";
3
- import { ColorId, CountryIso3, CurrencyCode, IconName } from "@standards/constants";
4
- //#region src/types/computed.d.ts
5
- export declare const COMPUTED_RETURN_TYPES: readonly ["text", "number", "boolean", "date", "select", "multiselect"];
6
- export type ComputedReturnType = (typeof COMPUTED_RETURN_TYPES)[number];
7
- export interface ComputedOptionsSource {
8
- objectName: string;
9
- attributeName: string;
10
- attributeId?: string;
11
- }
12
- //#endregion
13
- //#region src/types/relation-properties.d.ts
14
- /**
15
- * Allowed attribute types in .qualifyWith()
16
- *
17
- * IMPORTANT: Complex types (formula, rollup, relation, file, user, document, richtext)
18
- * are NOT supported to avoid duplicating backend behavior.
19
- */
20
- export type PropertyType = "text" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "select" | "multiselect" | "location";
21
- /**
22
- * Union of attribute types allowed as qualified relation properties.
23
- *
24
- * These are the same Attribute types used for object attributes,
25
- * restricted to simple types that don't require complex backend duplication.
26
- */
27
- export type PropertyAttribute = TextAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | SelectAttribute | MultiselectAttribute | LocationAttribute;
28
- /**
29
- * Schema defining properties for a qualified relation.
30
- *
31
- * Uses the same Attribute types as object attributes, enabling DRY builders:
32
- *
33
- * @example
34
- * ```typescript
35
- * relation("companies", "Companies")
36
- * .to("companies").many()
37
- * .qualifyWith(
38
- * select("role", "Role").options([...]).required(),
39
- * number("shares", "Shares").min(0),
40
- * )
41
- * ```
42
- */
43
- export interface PropertySchema {
44
- definitions: PropertyAttribute[];
45
- }
46
- /**
47
- * Normalizes an attribute's `properties` field to a flat list of
48
- * {@link PropertyAttribute}. Handles both the production {@link PropertySchema}
49
- * shape (`{ definitions: [...] }`) and the raw-array shape used in test
50
- * fixtures (`PropertyAttribute[]`).
51
- */
52
- export declare function resolvePropertyDefinitions(attr: unknown): PropertyAttribute[];
53
- /**
54
- * Property attribute types that have an `options` array.
55
- */
56
- export type OptionPropertyAttribute = SelectAttribute | StatusAttribute | MultiselectAttribute;
57
- /**
58
- * Type guard to check if a property attribute has options.
59
- *
60
- * @param attr - The property attribute to check
61
- * @returns true if the attribute is a select, status, or multiselect type with options
62
- *
63
- * @example
64
- * ```typescript
65
- * for (const def of definitions) {
66
- * if (hasOptions(def)) {
67
- * // TypeScript knows def.options exists and is Option[]
68
- * for (const option of def.options) {
69
- * console.log(option.value);
70
- * }
71
- * }
72
- * }
73
- * ```
74
- */
75
- export declare function hasOptions(attr: PropertyAttribute): attr is OptionPropertyAttribute;
76
- //#endregion
77
- //#region src/types/attributes.d.ts
78
- export declare const ATTRIBUTE_TYPES: readonly ["text", "richtext", "number", "checkbox", "date", "phone", "currency", "status", "location", "select", "multiselect", "user", "relation", "formula", "rollup", "document"];
79
- export type AttributeType = (typeof ATTRIBUTE_TYPES)[number];
80
- /**
81
- * Status group categorization
82
- */
83
- export type StatusGroup = "idle" | "in_progress" | "finished";
84
- /**
85
- * Unified option type for select-like fields
86
- */
87
- export interface Option {
88
- value: string;
89
- label: string;
90
- color?: ColorId;
91
- description?: string;
92
- group?: StatusGroup;
93
- /** Value of the inverse option for bilateral relations (e.g. "parent" → "child") */
94
- inverse?: string;
95
- archived?: boolean;
96
- }
97
- /**
98
- * Attribute grouping for UI organization
99
- */
100
- export interface AttributeGroup {
101
- id: string;
102
- label: string;
103
- description?: string;
104
- attributeIds: string[];
105
- collapsible?: boolean;
106
- collapsed?: boolean;
107
- order?: number;
108
- }
109
- export interface BaseAttribute<DefaultValueType = unknown> {
110
- id?: Uuid;
111
- objectId?: Uuid;
112
- name: string;
113
- label: string;
114
- type: AttributeType;
115
- required?: boolean;
116
- placeholder?: string;
117
- description?: string;
118
- defaultValue?: DefaultValueType;
119
- icon?: IconName;
120
- order?: number;
121
- hidden?: boolean;
122
- archived?: boolean;
123
- deprecated?: boolean;
124
- system?: boolean;
125
- unique?: boolean;
126
- metadata?: Record<string, unknown>;
127
- }
128
- export interface TextAttribute extends BaseAttribute<string> {
129
- type: "text";
130
- multiline?: boolean;
131
- minLength?: number;
132
- maxLength?: number;
133
- pattern?: string;
134
- format?: "email" | "url" | "slug";
135
- }
136
- export type NumberUnit = "integer" | "decimal" | "percentage";
137
- export interface NumberAttribute extends BaseAttribute<number> {
138
- type: "number";
139
- min?: number;
140
- max?: number;
141
- unit?: NumberUnit;
142
- decimals?: number;
143
- renderAs?: "number" | "rating";
144
- }
145
- export interface CheckboxAttribute extends BaseAttribute<boolean> {
146
- type: "checkbox";
147
- }
148
- export type DateFormat = "short" | "long" | "full" | "relative";
149
- export type DateValue = string | "today";
150
- export type TimeFormat = "12h" | "24h";
151
- /** Stored value of a date attribute configured with `.endDate()`. */
152
- export interface DateRangeValue {
153
- start: string;
154
- end: string | null;
155
- }
156
- /**
157
- * How much of a calendar date the value is meant to carry. The stored value is
158
- * always a full day; a narrower precision says the day (and the month, for a
159
- * year) is not part of the fact.
160
- */
161
- export type DatePrecision = "day" | "month" | "year";
162
- export interface DateAttribute extends BaseAttribute<string | DateRangeValue> {
163
- type: "date";
164
- dateFormat?: DateFormat;
165
- /** Defaults to "day". Refused with `includeTime` or `endDate` when narrower. */
166
- precision?: DatePrecision;
167
- minDate?: DateValue;
168
- maxDate?: DateValue;
169
- /** Values carry a time component; stored as full ISO UTC datetimes. */
170
- includeTime?: boolean;
171
- /** Values are ranges stored as { start, end } objects. */
172
- endDate?: boolean;
173
- /** Display format for the time component. Defaults to "24h". */
174
- timeFormat?: TimeFormat;
175
- }
176
- export interface Phone {
177
- countryCode: CountryIso3;
178
- phoneNumber: string;
179
- }
180
- export interface PhoneAttribute extends BaseAttribute<Phone> {
181
- type: "phone";
182
- defaultCountryCode?: CountryIso3;
183
- }
184
- export interface Currency {
185
- code: CurrencyCode;
186
- value: number;
187
- }
188
- export interface CurrencyAttribute extends BaseAttribute<Currency> {
189
- type: "currency";
190
- defaultCurrency?: CurrencyCode;
191
- allowedCurrencies?: CurrencyCode[];
192
- /** Allow negative currency values (e.g. refunds, credits). Defaults to false. */
193
- allowNegative?: boolean;
194
- }
195
- /**
196
- * StatusAttribute - For workflow states with semantic grouping (idle/in_progress/finished)
197
- * Use this for: Task status, Order status, Project phases, Process states
198
- * Use SelectAttribute for: Categories, Types, simple choices without workflow
199
- */
200
- export interface StatusAttribute extends BaseAttribute<string> {
201
- type: "status";
202
- options: Option[];
203
- }
204
- export interface Location {
205
- address?: string;
206
- address2?: string;
207
- city?: string;
208
- state?: string;
209
- postalCode?: string;
210
- country?: CountryIso3;
211
- latitude?: number;
212
- longitude?: number;
213
- }
214
- export type LocationGranularity = "full" | "address" | "city" | "state" | "country" | "coordinates";
215
- export interface LocationAttribute extends BaseAttribute<Location> {
216
- type: "location";
217
- granularity?: LocationGranularity;
218
- defaultCountry?: CountryIso3;
219
- allowedCountries?: CountryIso3[];
220
- }
221
- /**
222
- * SelectAttribute - For simple single-choice selection
223
- * Use this for: Categories, Document types, Departments, Priorities
224
- * Options can be grouped (e.g., countries by continent) but no workflow logic
225
- */
226
- export interface SelectAttribute extends BaseAttribute<string> {
227
- type: "select";
228
- options: Option[];
229
- renderAs?: "badges";
230
- }
231
- export interface MultiselectAttribute extends BaseAttribute<string[]> {
232
- type: "multiselect";
233
- options: Option[];
234
- renderAs?: "badges";
235
- }
236
- export type UserReferenceType = "user" | "agent";
237
- export interface UserAttribute extends BaseAttribute<string | string[]> {
238
- type: "user";
239
- types?: UserReferenceType[];
240
- multiple?: boolean;
241
- /** Each person added to the value is notified (`record.assigned`), when they can read the record. */
242
- notifiesOnAssign?: boolean;
243
- /**
244
- * The value holds actor ids — members and agents, within `types` — named by
245
- * each actor's current display name rather than looked up as users. (The
246
- * built-in `createdBy` / `lastUpdatedBy` also name API keys and the system.)
247
- */
248
- actors?: boolean;
249
- }
250
- /**
251
- * Wildcard marker for universal relations (can link to any object)
252
- * Use with `.toAny()` builder method
253
- */
254
- export declare const RELATION_TARGET_ANY: "*";
255
- /**
256
- * Configuration for bilateral synchronization (bidirectional relations)
257
- */
258
- export interface BilateralConfig {
259
- /** Target object containing the inverse attribute */
260
- object: string;
261
- /** Name of the inverse attribute */
262
- attribute: string;
263
- /** Optional cardinality override (inferred by default) */
264
- cardinality?: "one" | "many";
265
- /** Label for the inverse attribute when it is generated from this declaration. */
266
- label?: string;
267
- /** When true, this side owns the storage direction for qualified properties.
268
- * Set to false on the inverse side (enriched at read time). */
269
- storageOwner?: boolean;
270
- }
271
- /**
272
- * Target object for a relation - defines which objects can be linked
273
- */
274
- export interface RelationTarget {
275
- /** Object name (e.g., "companies", "contacts") or "*" for any object */
276
- object: string;
277
- /**
278
- * Display template for the label using mustache-like syntax
279
- * @example "{name}" or "{firstName} {lastName} — {email}"
280
- */
281
- displayTemplate?: string;
282
- /**
283
- * Optional filter to restrict available records
284
- * @example { status: "active" }
285
- */
286
- filter?: Record<string, unknown>;
287
- }
288
- /**
289
- * Base properties shared by both single and multi relation attributes
290
- *
291
- * Note: Deletion behavior is always "restrict" - if a record is referenced
292
- * by other records, it cannot be deleted until those references are removed.
293
- * This is enforced by RecordService.deleteRecord() which throws
294
- * RecordReferencedError when attempting to delete a referenced record.
295
- */
296
- interface RelationAttributeBase extends Omit<BaseAttribute<unknown>, "defaultValue"> {
297
- type: "relation";
298
- /** Target objects that can be linked */
299
- targets: RelationTarget[];
300
- /** Optional properties schema for qualified relations */
301
- properties?: PropertySchema;
302
- /** Configuration for bilateral synchronization (opt-in) */
303
- bilateral?: BilateralConfig;
304
- }
305
- /**
306
- * Single relation attribute (one-to-one or many-to-one)
307
- * Stores a single record ID or null
308
- */
309
- export interface SingleRelationAttribute extends RelationAttributeBase {
310
- cardinality: "one";
311
- defaultValue?: string | null;
312
- }
313
- /**
314
- * Multi relation attribute (one-to-many or many-to-many)
315
- * Stores an array of record IDs
316
- */
317
- export interface MultiRelationAttribute extends RelationAttributeBase {
318
- cardinality: "many";
319
- defaultValue?: string[];
320
- /** Maximum number of relations allowed */
321
- maxItems?: number;
322
- }
323
- /**
324
- * RelationAttribute links to other objects/records
325
- * Discriminated union by cardinality for type-safe value handling
326
- *
327
- * @example Single relation (many-to-one)
328
- * ```typescript
329
- * relation("company", "Company")
330
- * .to("companies")
331
- * .required()
332
- * // → Value: "rec-uuid-123" | null
333
- * ```
334
- *
335
- * @example Multi relation (many-to-many)
336
- * ```typescript
337
- * relation("contacts", "Contacts")
338
- * .to("contacts", { displayTemplate: "{firstName} {lastName}" })
339
- * .many()
340
- * .maxItems(5)
341
- * // → Value: ["rec-1", "rec-2", ...]
342
- * ```
343
- *
344
- * @example Polymorphic relation (multiple target objects)
345
- * ```typescript
346
- * relation("linked", "Linked Items")
347
- * .to("companies")
348
- * .to("contacts")
349
- * .to("deals")
350
- * .many()
351
- * // → Can link to records from any of these objects
352
- * ```
353
- */
354
- export type RelationAttribute = SingleRelationAttribute | MultiRelationAttribute;
355
- /**
356
- * Check if a relation attribute is universal (can link to any object)
357
- * Universal relations have `targets: [{ object: "*" }]`
358
- */
359
- /**
360
- * The object names a relation attribute can point at, universal marker
361
- * stripped. Any other attribute type — and a relation row whose config lost
362
- * its `targets` — yields no names.
363
- */
364
- export declare function relationTargetsOf(attribute: Attribute): string[];
365
- export declare function isUniversalRelation(attr: RelationAttribute): boolean;
366
- /**
367
- * Check if a relation attribute has bilateral synchronization enabled
368
- */
369
- export declare function isBilateralRelation(attr: RelationAttribute): attr is RelationAttribute & {
370
- bilateral: BilateralConfig;
371
- };
372
- /**
373
- * Infer the cardinality of the inverse relation
374
- * - one → many (contact.company ↔ company.contacts)
375
- * - many → many (contact.tags ↔ tag.contacts)
376
- */
377
- export declare function inferInverseCardinality(cardinality: "one" | "many"): "one" | "many";
378
- /**
379
- * RichtextAttribute - Rich text content using semantic markdown
380
- *
381
- * Stores content as semantic markdown string (with directives like :::callout).
382
- * Parsed at runtime to Tiptap JSON for editing.
383
- * Use this for: Notes, articles, descriptions, long-form content.
384
- *
385
- * @example
386
- * ```typescript
387
- * richtext("content", "Content").required()
388
- * ```
389
- */
390
- export interface RichtextAttribute extends BaseAttribute<string> {
391
- type: "richtext";
392
- }
393
- /**
394
- * Return type for formula expressions
395
- */
396
- export type FormulaReturnType = ComputedReturnType;
397
- /**
398
- * FormulaAttribute - Computed value based on other attributes
399
- *
400
- * Formulas are calculated at read-time and are always read-only.
401
- * Users cannot directly edit formula values.
402
- *
403
- * @example Simple calculation
404
- * ```typescript
405
- * formula("total", "Total")
406
- * .expression("price * quantity")
407
- * .returns("number")
408
- * .decimals(2)
409
- * ```
410
- *
411
- * @example With functions
412
- * ```typescript
413
- * formula("fullName", "Full Name")
414
- * .expression("CONCAT(firstName, ' ', lastName)")
415
- * .returns("text")
416
- * ```
417
- */
418
- export interface FormulaAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "required"> {
419
- type: "formula";
420
- /** Expression to evaluate (e.g., "price * quantity") */
421
- expression: string;
422
- /** Expected return type for formatting */
423
- returnType: FormulaReturnType;
424
- /** Decimal places for number results */
425
- decimals?: number;
426
- /**
427
- * ISO 4217 code a `number` result renders with — `123 456 €` instead of
428
- * `123456` — for a formula over money (#3419). Presentation only: the
429
- * stored value stays a number, sort, filter and aggregation are untouched,
430
- * and `returnType` stays `"number"` because that IS what the expression
431
- * returns. The rollup's `targetCurrencyCode` (#2644), mirrored. Absent →
432
- * the bare number, exactly as before.
433
- */
434
- currencyCode?: CurrencyCode;
435
- /** Source attribute for select-like computed options */
436
- optionsSource?: ComputedOptionsSource;
437
- /** Whether to allow relation references in the expression (e.g., "company.name") */
438
- allowRelations?: boolean;
439
- /** Formula is always not required (read-only) */
440
- required: false;
441
- }
442
- /**
443
- * Aggregation functions for rollup attributes
444
- *
445
- * Categories:
446
- * - Numeric (sum, avg): Only for number and currency types
447
- * - Date (earliest, latest): Only for date type
448
- * - Count (count, countValues, countUniqueValues, countEmpty): Universal
449
- * - Percent (percentEmpty, percentNotEmpty): Universal
450
- * - Lookup (original): Returns all values as array, rendered as target type
451
- */
452
- export type RollupFunction = "sum" | "avg" | "earliest" | "latest" | "count" | "countValues" | "countUniqueValues" | "countEmpty" | "percentEmpty" | "percentNotEmpty" | "original";
453
- /**
454
- * RollupAttribute - Aggregates values from related records
455
- *
456
- * Rollups are calculated and stored (denormalized) for performance.
457
- * They are automatically recalculated when related records change.
458
- * Users cannot directly edit rollup values.
459
- *
460
- * @example Sum of related amounts
461
- * ```typescript
462
- * rollup("totalOrders", "Total Orders")
463
- * .from("orders") // relation attribute name
464
- * .aggregate("amount") // target attribute to sum
465
- * .using("sum")
466
- * .decimals(2)
467
- * ```
468
- *
469
- * @example Count of related records
470
- * ```typescript
471
- * rollup("orderCount", "Number of Orders")
472
- * .from("orders")
473
- * .using("count")
474
- * ```
475
- */
476
- export interface RollupAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "required"> {
477
- type: "rollup";
478
- /** Name of the relation attribute on this object */
479
- relationAttribute: string;
480
- /**
481
- * Dot notation path for multi-level traversal (Phase 4+)
482
- * @example "orders.items" - traverse through orders to items
483
- */
484
- relationPath?: string;
485
- /**
486
- * Attribute name on the target object to aggregate. Absent for `count`,
487
- * which aggregates the linked records themselves (#3571).
488
- */
489
- targetAttribute?: string;
490
- /** Aggregation function to apply */
491
- function: RollupFunction;
492
- /** Decimal places for numeric results */
493
- decimals?: number;
494
- /** Rollup is always not required (read-only) */
495
- required: false;
496
- /**
497
- * Cached type of the target attribute for display purposes
498
- * Used when function="original" to render values as the target type
499
- */
500
- targetAttributeType?: AttributeType;
501
- /**
502
- * Cached currency code of a currency target, from its `defaultCurrency`
503
- * (#2644). The stored rollup value stays a bare number; this is the
504
- * schema-derived channel that lets a single-code sum/avg render with its
505
- * symbol. Absent → the value renders bare, exactly as before.
506
- *
507
- * Named for what it holds — an ISO 4217 CODE — rather than the siblings'
508
- * `targetAttribute*` prefix: `targetAttributeCurrency` would read as a
509
- * `Currency` value, which this deliberately is not.
510
- */
511
- targetCurrencyCode?: CurrencyCode;
512
- /**
513
- * Cached options from target attribute (for select/status/multiselect display)
514
- * Required when function="original" and target is a select-like type
515
- */
516
- targetAttributeOptions?: Option[];
517
- /** Source attribute for select-like computed options */
518
- optionsSource?: ComputedOptionsSource;
519
- }
520
- /**
521
- * DocumentAttribute - References structured documents.
522
- *
523
- * A DocumentAttribute references packs of anonymous files with typed edge
524
- * properties.
525
- *
526
- * Every document attribute is multi by construction — the underlying storage
527
- * (documents + files) supports 1 Doc → N files uniformly.
528
- *
529
- * @example
530
- * ```typescript
531
- * document("contracts", "Contrats")
532
- * .accepts(["application/pdf"])
533
- * ```
534
- */
535
- export interface DocumentAttribute extends BaseAttribute<string[]> {
536
- type: "document";
537
- /**
538
- * Schema for typed properties on the record→document edge.
539
- * Symmetric with `RelationAttribute.properties`; populated by `.qualifyWith(...)`.
540
- * Stored on `record_reference_edges.properties`, not on the document itself.
541
- */
542
- properties?: PropertySchema;
543
- /** MIME prefixes/globs (e.g. "image/*", "application/pdf") applied to every file of the pack. */
544
- accepts?: string[];
545
- /** Hard ceiling in bytes applied to every file of the pack. */
546
- maxFileSize?: number;
547
- }
548
- /**
549
- * Union of every attribute definition supported by Standards objects.
550
- *
551
- * Use this type when code needs to inspect or render attributes generically
552
- * across primitive, relation, computed, user, and document fields.
553
- */
554
- export type Attribute = TextAttribute | RichtextAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | LocationAttribute | SelectAttribute | MultiselectAttribute | UserAttribute | RelationAttribute | FormulaAttribute | RollupAttribute | DocumentAttribute;
555
- /**
556
- * Check if an attribute supports sorting based on its type.
557
- */
558
- export declare function isAttributeSortable(attr: {
559
- type: AttributeType;
560
- }): boolean;
561
- //#endregion
@@ -1,10 +0,0 @@
1
-
2
- import { CheckboxAttribute } from "./attributes-QBySx30F.mjs";
3
- import { ValidationMessages } from "./index-jE6uAt4g.mjs";
4
- import * as z$2 from "zod";
5
- //#region src/validation/primitives/checkbox.d.ts
6
- /**
7
- * Create a Zod schema for a checkbox attribute
8
- */
9
- export declare function createCheckboxValidator(_attr: CheckboxAttribute, _messages?: ValidationMessages): z$2.ZodBoolean;
10
- //#endregion
@@ -1,10 +0,0 @@
1
-
2
- import { CheckboxAttribute } from "./attributes-DW19xkoM.js";
3
- import { ValidationMessages } from "./index-BFKJEyq-.js";
4
- import * as z$2 from "zod";
5
- //#region src/validation/primitives/checkbox.d.ts
6
- /**
7
- * Create a Zod schema for a checkbox attribute
8
- */
9
- export declare function createCheckboxValidator(_attr: CheckboxAttribute, _messages?: ValidationMessages): z$2.ZodBoolean;
10
- //#endregion
@@ -1,2 +0,0 @@
1
- /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- const e=require("./rolldown-runtime-DETHMehu.js"),t=require("./exceptions.js");require("./zod-locale.js");const n=require("./primitives-CVbrjJ24.js");let r=require("zod");r=e.__toESM(r);const i=[`text`,`number`,`boolean`,`date`,`select`,`multiselect`],a=r.object({placeholder:r.string().optional(),description:r.string().optional(),defaultValue:r.unknown().optional(),icon:r.string().optional(),order:r.number().int().optional(),hidden:r.boolean().optional(),archived:r.boolean().optional(),deprecated:r.boolean().optional(),metadata:r.record(r.string(),r.unknown()).optional()}),o=[`placeholder`,`description`,`defaultValue`,`icon`,`order`,`hidden`,`archived`,`deprecated`,`metadata`],s={icon:n.iconNameSchema.optional().describe(`Field icon from search_icons`)},c={date:[`precision`],user:[`notifiesOnAssign`,`actors`]};function wireOmittedConfigKeysFor(e){return[...o,...c[e]??[]]}function wireHiddenTypeConfigMask(e){return Object.fromEntries((c[e]??[]).map(e=>[e,!0]))}function refuseForeignKeys(e,t,n=[]){let r=new Set(n);return function refuse(n,i,a,o=[]){let s=e[n];if(s!==void 0&&i!==void 0)for(let e of Object.keys(i))s.has(e)||r.has(e)||a.addIssue({code:`custom`,path:[...o,e],message:`"${e}" is not a ${n} ${t}; keys of ${n}: ${[...s].join(`, `)}`})}}const l=r.object({value:r.string().min(1).describe(`Stored value`),label:r.string().min(1).describe(`Label people see`),description:r.string().describe(`Extra context`).optional(),inverse:r.string().describe(`Paired option's value (symmetric)`).optional(),archived:r.boolean().describe(`Hides without deleting`).optional()}),u=r.enum([`idle`,`in_progress`,`finished`]).describe(`Workflow stage`),d=l.extend({color:n.colorIdSchema}).strict(),f=l.extend({color:n.colorIdSchema,group:u}).strict(),p=l.extend({color:r.string().optional().describe(`A color id`),group:u.optional()}).strict(),m=new Set(p.keyof().options),h=[`options`,`targetAttributeOptions`];function withoutUnknownOptionKeys(e){let t=e;for(let r of h){let i=e[r];if(!Array.isArray(i))continue;let a=!1,o=i.map(e=>!n.isPlainRecord(e)||Object.keys(e).every(e=>m.has(e))?e:(a=!0,Object.fromEntries(Object.entries(e).filter(([e])=>m.has(e)))));a&&(t={...t,[r]:o})}let r=e.properties;if(n.isPlainRecord(r)&&Array.isArray(r.definitions)){let e=r.definitions,i=e.map(e=>n.isPlainRecord(e)?withoutUnknownOptionKeys(e):e);i.some((t,n)=>t!==e[n])&&(t={...t,properties:{...r,definitions:i}})}return t}const g=r.array(p).min(1).refine(e=>{let t=e.map(e=>e.value);return new Set(t).size===t.length},{message:`Duplicate option values are not allowed`});function writeOptionsArraySchema(e){return r.array(e).min(1).max(n.SCHEMA_LIMITS.optionsPerAttribute).refine(e=>{let t=e.map(e=>e.value);return new Set(t).size===t.length},{message:`Duplicate option values are not allowed`})}const _=writeOptionsArraySchema(d),v=writeOptionsArraySchema(d),y=writeOptionsArraySchema(f),b=r.object({object:r.string().min(1).describe(`Target object`),displayTemplate:r.string().optional().describe(`Linked record label template`),filter:r.record(r.string(),r.unknown()).optional().describe(`Restricts linkable records`)}),x=r.object({object:r.string().min(1).describe(`Other side's object`),attribute:r.string().min(1).describe(`Other side's attribute`),cardinality:r.enum([`one`,`many`]).optional().describe(`Other side's cardinality`),label:r.string().min(1).optional().describe(`Other side's label`),storageOwner:r.boolean().optional().describe(`Owns the join storage`)}),S=r.object({objectName:r.string().min(1).describe(`API name of the object whose options are mirrored`),attributeName:r.string().min(1).describe(`API name of the select/status attribute to mirror options from`),attributeId:r.string().optional().describe(`Id of the source attribute, resolved by the server`)}),C=a.extend({multiline:r.boolean().describe(`Renders as a multi-line textarea`).optional(),minLength:r.number().int().min(0).describe(`Minimum character count`).optional(),maxLength:r.number().int().min(1).describe(`Maximum character count`).optional(),pattern:r.string().describe(`Regular expression the value must match`).optional(),format:r.enum([`email`,`url`,`slug`]).describe(`Validates and renders as this format`).optional()}),w=a,T=a.extend({renderAs:r.enum([`number`,`rating`]).describe(`Plain number or a star rating`).optional(),min:r.number().describe(`Minimum allowed value`).optional(),max:r.number().describe(`Maximum allowed value`).optional(),unit:r.enum([`integer`,`decimal`,`percentage`]).describe(`How the value is stored and rendered`).optional(),decimals:r.number().int().min(0).max(10).describe(`Decimal places shown`).optional()}),E=a,D=a.extend({dateFormat:r.enum([`short`,`long`,`full`,`relative`]).describe(`How the date is rendered`).optional(),precision:r.enum([`day`,`month`,`year`]).describe(`Whether the value records a day, a month or a year`).optional(),minDate:r.string().describe(`Earliest allowed date (ISO)`).optional(),maxDate:r.string().describe(`Latest allowed date (ISO)`).optional(),includeTime:r.boolean().describe(`Also captures a time of day`).optional(),endDate:r.boolean().describe(`Paired with another date attribute as a range's end`).optional(),timeFormat:r.enum([`12h`,`24h`]).describe(`Clock format when a time is included`).optional()}),O=a.extend({defaultCountryCode:r.string().length(3).describe(`ISO country code preselected in the dialer`).optional()}),k=a.extend({defaultCurrency:r.string().length(3).describe(`ISO currency code preselected for new values`).optional(),allowedCurrencies:r.array(r.string().length(3)).describe(`ISO currency codes a value may use; any currency when omitted`).optional(),allowNegative:r.boolean().describe(`Whether a negative amount is accepted`).optional()}),A=a.extend({options:g.describe(`The workflow statuses, in order`)}),j=a.extend({granularity:r.enum([`full`,`address`,`city`,`state`,`country`,`coordinates`]).describe(`How precise a location must be captured`).optional(),defaultCountry:r.string().length(3).describe(`ISO country code preselected for new values`).optional(),allowedCountries:r.array(r.string().length(3)).describe(`ISO country codes a value may use; any country when omitted`).optional()}),M=a.extend({options:g.describe(`Options`),renderAs:r.literal(`badges`).optional().describe(`Renders the chosen option as a colored badge`)}),N=a.extend({options:g.describe(`Options`),renderAs:r.literal(`badges`).optional().describe(`Renders the chosen options as colored badges`)}),P=a.extend({types:r.array(r.enum([`user`,`agent`])).min(1).optional().describe(`Which kinds of actor can be picked; both when omitted`),multiple:r.boolean().optional().describe(`Whether more than one actor can be picked`),notifiesOnAssign:r.boolean().optional().describe(`Whether each person added to the value is notified`),actors:r.boolean().optional().describe(`Whether the value holds actor ids, named by each actor's current name`)}),F={name:n.ATTRIBUTE_NAME_SCHEMA.describe(`Property API name`),label:r.string().min(1).describe(`Label people see`),required:r.boolean().describe(`Required on every edge`).optional()},I={id:r.string().optional(),objectId:r.string().optional(),system:r.boolean().optional(),unique:r.boolean().optional()},L=Object.fromEntries(o.map(e=>[e,!0])),R=[`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`location`],z=[...R,`select`,`multiselect`,`status`],B={text:C,number:T,checkbox:E,date:D,phone:O,currency:k,location:j,select:M,multiselect:N,status:A},V={...B,select:M.extend({options:_.describe(`Options`)}),multiselect:N.extend({options:v.describe(`Options`)}),status:A.extend({options:y.describe(`Statuses`)})},propertyWireConfigShapeFor=e=>V[e].omit(L).omit(wireHiddenTypeConfigMask(e)).shape,storedPropertyMember=e=>r.object({...F,...I,type:r.literal(e).describe(`Property type`),...B[e].shape}).strip(),H=r.discriminatedUnion(`type`,z.map(storedPropertyMember)),U=r.object({definitions:r.array(H).min(1).max(n.SCHEMA_LIMITS.optionsPerAttribute).describe(`Edge properties`)}).strip().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),W=refuseForeignKeys(Object.fromEntries(z.map(e=>[e,new Set(Object.keys(propertyWireConfigShapeFor(e)))])),`property key`,[...Object.keys(F),`type`]);function refuseForeignPropertyKeys(e,t){W(e.type,e,t)}const G=R.reduce((e,t)=>(Object.assign(e,propertyWireConfigShapeFor(t)),e),{}),optionPropertyWireMember=e=>r.object({...F,type:e.length===1?r.literal(e[0]).describe(`Property type`):r.enum(e).describe(`Property type`),...propertyWireConfigShapeFor(e[0])}).strict(),K=r.discriminatedUnion(`type`,[optionPropertyWireMember([`select`,`multiselect`]),optionPropertyWireMember([`status`]),r.object({...F,type:r.enum(R).describe(`Property type`),...G}).strict().superRefine(refuseForeignPropertyKeys)]),q=r.object({definitions:r.array(K).min(1).max(n.SCHEMA_LIMITS.optionsPerAttribute).describe(`Edge properties`)}).strict().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),J=a.extend({targets:r.array(b).min(1).describe(`Target object(s)`),cardinality:r.enum([`one`,`many`]).describe(`one or many`),maxItems:r.number().int().min(1).optional().describe(`Max linked records`),bilateral:x.optional().describe(`Syncs the other side's attribute`),properties:U.optional()}),Y=a.extend({expression:r.string().min(1).describe(`The formula expression, compiled against this object's attributes`),returnType:r.enum(i).describe(`The formula's result type`),decimals:r.number().int().min(0).max(10).optional().describe(`Decimal places shown for a number result`),currencyCode:r.string().length(3).optional().describe(`ISO 4217 code a number result renders with; presentation only`),allowRelations:r.boolean().optional().describe(`Whether the expression may read across a relation`),optionsSource:S.optional().describe(`Mirrors an option set`)}),X=a.extend({relationAttribute:r.string().min(1).optional().describe(`API name of the relation this rollup aggregates through`),relationPath:r.string().optional().describe(`Not supported yet — single-hop only`),targetAttribute:r.string().min(1).optional().describe(`API name of the attribute aggregated on the relation's target object; not read by count`),function:r.enum([`sum`,`avg`,`earliest`,`latest`,`count`,`countValues`,`countUniqueValues`,`countEmpty`,`percentEmpty`,`percentNotEmpty`,`original`]).describe(`The aggregation applied across the linked records`),decimals:r.number().int().min(0).max(10).optional().describe(`Decimal places shown for a numeric result`),targetAttributeType:r.string().optional().describe(`Server-set`),targetAttributeOptions:r.array(p).optional().describe(`Server-set`),targetCurrencyCode:r.string().length(3).optional().describe(`Server-set`),optionsSource:S.optional().describe(`Mirrors an option set`)});function rollupTargetIssue(e,t){if(e===`rollup`&&t.function!==`count`&&t.targetAttribute===void 0)return{path:[`targetAttribute`],message:`targetAttribute is required for a "${String(t.function)}" rollup`}}function datePrecisionIssues(e,t,r=[]){let i=[],a=t.precision;if(e===`date`&&a!==void 0&&a!==`day`)for(let e of[`includeTime`,`endDate`])t[e]===!0&&i.push({path:[...r,`precision`],message:`A "${String(a)}" precision cannot be combined with ${e}`});let o=t.properties;return n.isPlainRecord(o)&&Array.isArray(o.definitions)&&o.definitions.forEach((e,t)=>{n.isPlainRecord(e)&&i.push(...datePrecisionIssues(String(e.type),e,[...r,`properties`,`definitions`,t]))}),i}const Z={text:C,richtext:w,number:T,checkbox:E,date:D,phone:O,currency:k,status:A,location:j,select:M,multiselect:N,user:P,relation:J,formula:Y,rollup:X,document:a.extend({properties:U.optional(),accepts:r.array(r.string().min(1)).optional().describe("MIME prefixes or globs a file must match (e.g. `image/*`, `*.pdf`)"),maxFileSize:r.number().int().min(1).optional().describe(`Maximum file size in bytes`)})};function getAttributeConfigSchema(e){let n=Z[e];if(!n)throw new t.ValidationError(`Unsupported attribute type: ${e}`,[]);return n}function parseAttributeConfig(e,t){let n=getAttributeConfigSchema(e).strip().parse(t),r=rollupTargetIssue(e,n);if(r)throw validationErrorFromIssues([r]);return n}function getAttributeConfigWriteSchema(e){let t=getAttributeConfigSchema(e).extend({icon:n.iconNameSchema.optional()});switch(e){case`select`:return t.extend({options:_.describe(`Options`)});case`multiselect`:return t.extend({options:v.describe(`Options`)});case`status`:return t.extend({options:y.describe(`Statuses`)});default:return t}}function validationErrorFromIssues(e){return t.ValidationError.fromZodErrors(e.map(e=>({path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message})))}function parseWriteSchema(e,t){let n=getAttributeConfigWriteSchema(e).strip().safeParse(t);if(!n.success)throw validationErrorFromIssues(n.error.issues);let r=rollupTargetIssue(e,n.data);if(r)throw validationErrorFromIssues([r]);let i=datePrecisionIssues(e,n.data);if(i.length>0)throw validationErrorFromIssues(i);return n.data}function parseAttributeConfigForCreate(e,t){return parseWriteSchema(e,t)}function validatePatchedIcon(e){if(!Object.prototype.hasOwnProperty.call(e,`icon`))return;let r=n.iconNameSchema.optional().safeParse(e.icon);if(!r.success)throw t.ValidationError.fromZodErrors(r.error.issues.map(e=>({path:[`icon`,...e.path.map(e=>typeof e==`symbol`?String(e):e)],message:e.message})))}function isSelectLike(e){return e===`select`||e===`multiselect`||e===`status`}function parseAttributeConfigForUpdate(e,t){let n=Object.prototype.hasOwnProperty.call(t,`options`),r=Object.prototype.hasOwnProperty.call(t,`icon`),i={...e,...t};if(validatePatchedIcon(t),n){let{icon:t,...n}=i,a=parseWriteSchema(e.type,r?i:n);return!r&&t!==void 0&&(a.icon=t),a}let a=e.options;isSelectLike(e.type)&&(i.options=[{value:`__legacy__`,label:`__legacy__`}]);let o=getAttributeConfigSchema(e.type).strip().safeParse(i);if(!o.success)throw validationErrorFromIssues(o.error.issues);let s=o.data,c=datePrecisionIssues(e.type,s);if(c.length>0)throw validationErrorFromIssues(c);return isSelectLike(e.type)&&(s.options=a),s}Object.defineProperty(exports,"COMPUTED_RETURN_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"SIMPLE_PROPERTY_TYPES",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"WIRE_OFFERED_BASE_CONFIG",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"WIRE_OMITTED_CONFIG_KEYS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"attributeConfigSchemas",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"datePrecisionIssues",{enumerable:!0,get:function(){return datePrecisionIssues}}),Object.defineProperty(exports,"getAttributeConfigSchema",{enumerable:!0,get:function(){return getAttributeConfigSchema}}),Object.defineProperty(exports,"getAttributeConfigWriteSchema",{enumerable:!0,get:function(){return getAttributeConfigWriteSchema}}),Object.defineProperty(exports,"parseAttributeConfig",{enumerable:!0,get:function(){return parseAttributeConfig}}),Object.defineProperty(exports,"parseAttributeConfigForCreate",{enumerable:!0,get:function(){return parseAttributeConfigForCreate}}),Object.defineProperty(exports,"parseAttributeConfigForUpdate",{enumerable:!0,get:function(){return parseAttributeConfigForUpdate}}),Object.defineProperty(exports,"propertyAttributeSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"propertyAttributeWireSchema",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"propertySchemaSchema",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"propertySchemaWireSchema",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"refuseForeignKeys",{enumerable:!0,get:function(){return refuseForeignKeys}}),Object.defineProperty(exports,"selectOptionWriteSchema",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"statusGroupSchema",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"statusOptionWriteSchema",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"wireHiddenTypeConfigMask",{enumerable:!0,get:function(){return wireHiddenTypeConfigMask}}),Object.defineProperty(exports,"wireOmittedConfigKeysFor",{enumerable:!0,get:function(){return wireOmittedConfigKeysFor}}),Object.defineProperty(exports,"withoutUnknownOptionKeys",{enumerable:!0,get:function(){return withoutUnknownOptionKeys}});
@@ -1,2 +0,0 @@
1
- /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- import{ValidationError as e}from"./exceptions.mjs";import"./zod-locale.mjs";import{ATTRIBUTE_NAME_SCHEMA as t,SCHEMA_LIMITS as n,colorIdSchema as r,iconNameSchema as i,isPlainRecord as a}from"./primitives-BCJLtpaI.mjs";import*as o from"zod";const s=[`text`,`number`,`boolean`,`date`,`select`,`multiselect`],c=o.object({placeholder:o.string().optional(),description:o.string().optional(),defaultValue:o.unknown().optional(),icon:o.string().optional(),order:o.number().int().optional(),hidden:o.boolean().optional(),archived:o.boolean().optional(),deprecated:o.boolean().optional(),metadata:o.record(o.string(),o.unknown()).optional()}),l=[`placeholder`,`description`,`defaultValue`,`icon`,`order`,`hidden`,`archived`,`deprecated`,`metadata`],ee={icon:i.optional().describe(`Field icon from search_icons`)},u={date:[`precision`],user:[`notifiesOnAssign`,`actors`]};function wireOmittedConfigKeysFor(e){return[...l,...u[e]??[]]}function wireHiddenTypeConfigMask(e){return Object.fromEntries((u[e]??[]).map(e=>[e,!0]))}function refuseForeignKeys(e,t,n=[]){let r=new Set(n);return function refuse(n,i,a,o=[]){let s=e[n];if(s!==void 0&&i!==void 0)for(let e of Object.keys(i))s.has(e)||r.has(e)||a.addIssue({code:`custom`,path:[...o,e],message:`"${e}" is not a ${n} ${t}; keys of ${n}: ${[...s].join(`, `)}`})}}const d=o.object({value:o.string().min(1).describe(`Stored value`),label:o.string().min(1).describe(`Label people see`),description:o.string().describe(`Extra context`).optional(),inverse:o.string().describe(`Paired option's value (symmetric)`).optional(),archived:o.boolean().describe(`Hides without deleting`).optional()}),f=o.enum([`idle`,`in_progress`,`finished`]).describe(`Workflow stage`),p=d.extend({color:r}).strict(),m=d.extend({color:r,group:f}).strict(),h=d.extend({color:o.string().optional().describe(`A color id`),group:f.optional()}).strict(),g=new Set(h.keyof().options),_=[`options`,`targetAttributeOptions`];function withoutUnknownOptionKeys(e){let t=e;for(let n of _){let r=e[n];if(!Array.isArray(r))continue;let i=!1,o=r.map(e=>!a(e)||Object.keys(e).every(e=>g.has(e))?e:(i=!0,Object.fromEntries(Object.entries(e).filter(([e])=>g.has(e)))));i&&(t={...t,[n]:o})}let n=e.properties;if(a(n)&&Array.isArray(n.definitions)){let e=n.definitions,r=e.map(e=>a(e)?withoutUnknownOptionKeys(e):e);r.some((t,n)=>t!==e[n])&&(t={...t,properties:{...n,definitions:r}})}return t}const v=o.array(h).min(1).refine(e=>{let t=e.map(e=>e.value);return new Set(t).size===t.length},{message:`Duplicate option values are not allowed`});function writeOptionsArraySchema(e){return o.array(e).min(1).max(n.optionsPerAttribute).refine(e=>{let t=e.map(e=>e.value);return new Set(t).size===t.length},{message:`Duplicate option values are not allowed`})}const y=writeOptionsArraySchema(p),b=writeOptionsArraySchema(p),x=writeOptionsArraySchema(m),S=o.object({object:o.string().min(1).describe(`Target object`),displayTemplate:o.string().optional().describe(`Linked record label template`),filter:o.record(o.string(),o.unknown()).optional().describe(`Restricts linkable records`)}),C=o.object({object:o.string().min(1).describe(`Other side's object`),attribute:o.string().min(1).describe(`Other side's attribute`),cardinality:o.enum([`one`,`many`]).optional().describe(`Other side's cardinality`),label:o.string().min(1).optional().describe(`Other side's label`),storageOwner:o.boolean().optional().describe(`Owns the join storage`)}),w=o.object({objectName:o.string().min(1).describe(`API name of the object whose options are mirrored`),attributeName:o.string().min(1).describe(`API name of the select/status attribute to mirror options from`),attributeId:o.string().optional().describe(`Id of the source attribute, resolved by the server`)}),T=c.extend({multiline:o.boolean().describe(`Renders as a multi-line textarea`).optional(),minLength:o.number().int().min(0).describe(`Minimum character count`).optional(),maxLength:o.number().int().min(1).describe(`Maximum character count`).optional(),pattern:o.string().describe(`Regular expression the value must match`).optional(),format:o.enum([`email`,`url`,`slug`]).describe(`Validates and renders as this format`).optional()}),E=c,D=c.extend({renderAs:o.enum([`number`,`rating`]).describe(`Plain number or a star rating`).optional(),min:o.number().describe(`Minimum allowed value`).optional(),max:o.number().describe(`Maximum allowed value`).optional(),unit:o.enum([`integer`,`decimal`,`percentage`]).describe(`How the value is stored and rendered`).optional(),decimals:o.number().int().min(0).max(10).describe(`Decimal places shown`).optional()}),O=c,k=c.extend({dateFormat:o.enum([`short`,`long`,`full`,`relative`]).describe(`How the date is rendered`).optional(),precision:o.enum([`day`,`month`,`year`]).describe(`Whether the value records a day, a month or a year`).optional(),minDate:o.string().describe(`Earliest allowed date (ISO)`).optional(),maxDate:o.string().describe(`Latest allowed date (ISO)`).optional(),includeTime:o.boolean().describe(`Also captures a time of day`).optional(),endDate:o.boolean().describe(`Paired with another date attribute as a range's end`).optional(),timeFormat:o.enum([`12h`,`24h`]).describe(`Clock format when a time is included`).optional()}),A=c.extend({defaultCountryCode:o.string().length(3).describe(`ISO country code preselected in the dialer`).optional()}),j=c.extend({defaultCurrency:o.string().length(3).describe(`ISO currency code preselected for new values`).optional(),allowedCurrencies:o.array(o.string().length(3)).describe(`ISO currency codes a value may use; any currency when omitted`).optional(),allowNegative:o.boolean().describe(`Whether a negative amount is accepted`).optional()}),M=c.extend({options:v.describe(`The workflow statuses, in order`)}),N=c.extend({granularity:o.enum([`full`,`address`,`city`,`state`,`country`,`coordinates`]).describe(`How precise a location must be captured`).optional(),defaultCountry:o.string().length(3).describe(`ISO country code preselected for new values`).optional(),allowedCountries:o.array(o.string().length(3)).describe(`ISO country codes a value may use; any country when omitted`).optional()}),P=c.extend({options:v.describe(`Options`),renderAs:o.literal(`badges`).optional().describe(`Renders the chosen option as a colored badge`)}),F=c.extend({options:v.describe(`Options`),renderAs:o.literal(`badges`).optional().describe(`Renders the chosen options as colored badges`)}),I=c.extend({types:o.array(o.enum([`user`,`agent`])).min(1).optional().describe(`Which kinds of actor can be picked; both when omitted`),multiple:o.boolean().optional().describe(`Whether more than one actor can be picked`),notifiesOnAssign:o.boolean().optional().describe(`Whether each person added to the value is notified`),actors:o.boolean().optional().describe(`Whether the value holds actor ids, named by each actor's current name`)}),L={name:t.describe(`Property API name`),label:o.string().min(1).describe(`Label people see`),required:o.boolean().describe(`Required on every edge`).optional()},R={id:o.string().optional(),objectId:o.string().optional(),system:o.boolean().optional(),unique:o.boolean().optional()},z=Object.fromEntries(l.map(e=>[e,!0])),B=[`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`location`],V=[...B,`select`,`multiselect`,`status`],H={text:T,number:D,checkbox:O,date:k,phone:A,currency:j,location:N,select:P,multiselect:F,status:M},U={...H,select:P.extend({options:y.describe(`Options`)}),multiselect:F.extend({options:b.describe(`Options`)}),status:M.extend({options:x.describe(`Statuses`)})},propertyWireConfigShapeFor=e=>U[e].omit(z).omit(wireHiddenTypeConfigMask(e)).shape,storedPropertyMember=e=>o.object({...L,...R,type:o.literal(e).describe(`Property type`),...H[e].shape}).strip(),W=o.discriminatedUnion(`type`,V.map(storedPropertyMember)),G=o.object({definitions:o.array(W).min(1).max(n.optionsPerAttribute).describe(`Edge properties`)}).strip().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),K=refuseForeignKeys(Object.fromEntries(V.map(e=>[e,new Set(Object.keys(propertyWireConfigShapeFor(e)))])),`property key`,[...Object.keys(L),`type`]);function refuseForeignPropertyKeys(e,t){K(e.type,e,t)}const q=B.reduce((e,t)=>(Object.assign(e,propertyWireConfigShapeFor(t)),e),{}),optionPropertyWireMember=e=>o.object({...L,type:e.length===1?o.literal(e[0]).describe(`Property type`):o.enum(e).describe(`Property type`),...propertyWireConfigShapeFor(e[0])}).strict(),J=o.discriminatedUnion(`type`,[optionPropertyWireMember([`select`,`multiselect`]),optionPropertyWireMember([`status`]),o.object({...L,type:o.enum(B).describe(`Property type`),...q}).strict().superRefine(refuseForeignPropertyKeys)]),Y=o.object({definitions:o.array(J).min(1).max(n.optionsPerAttribute).describe(`Edge properties`)}).strict().describe(`Properties carried by the edge itself (role, share, since…), never a third object`),X=c.extend({targets:o.array(S).min(1).describe(`Target object(s)`),cardinality:o.enum([`one`,`many`]).describe(`one or many`),maxItems:o.number().int().min(1).optional().describe(`Max linked records`),bilateral:C.optional().describe(`Syncs the other side's attribute`),properties:G.optional()}),Z=c.extend({expression:o.string().min(1).describe(`The formula expression, compiled against this object's attributes`),returnType:o.enum(s).describe(`The formula's result type`),decimals:o.number().int().min(0).max(10).optional().describe(`Decimal places shown for a number result`),currencyCode:o.string().length(3).optional().describe(`ISO 4217 code a number result renders with; presentation only`),allowRelations:o.boolean().optional().describe(`Whether the expression may read across a relation`),optionsSource:w.optional().describe(`Mirrors an option set`)}),Q=c.extend({relationAttribute:o.string().min(1).optional().describe(`API name of the relation this rollup aggregates through`),relationPath:o.string().optional().describe(`Not supported yet — single-hop only`),targetAttribute:o.string().min(1).optional().describe(`API name of the attribute aggregated on the relation's target object; not read by count`),function:o.enum([`sum`,`avg`,`earliest`,`latest`,`count`,`countValues`,`countUniqueValues`,`countEmpty`,`percentEmpty`,`percentNotEmpty`,`original`]).describe(`The aggregation applied across the linked records`),decimals:o.number().int().min(0).max(10).optional().describe(`Decimal places shown for a numeric result`),targetAttributeType:o.string().optional().describe(`Server-set`),targetAttributeOptions:o.array(h).optional().describe(`Server-set`),targetCurrencyCode:o.string().length(3).optional().describe(`Server-set`),optionsSource:w.optional().describe(`Mirrors an option set`)});function rollupTargetIssue(e,t){if(e===`rollup`&&t.function!==`count`&&t.targetAttribute===void 0)return{path:[`targetAttribute`],message:`targetAttribute is required for a "${String(t.function)}" rollup`}}function datePrecisionIssues(e,t,n=[]){let r=[],i=t.precision;if(e===`date`&&i!==void 0&&i!==`day`)for(let e of[`includeTime`,`endDate`])t[e]===!0&&r.push({path:[...n,`precision`],message:`A "${String(i)}" precision cannot be combined with ${e}`});let o=t.properties;return a(o)&&Array.isArray(o.definitions)&&o.definitions.forEach((e,t)=>{a(e)&&r.push(...datePrecisionIssues(String(e.type),e,[...n,`properties`,`definitions`,t]))}),r}const $={text:T,richtext:E,number:D,checkbox:O,date:k,phone:A,currency:j,status:M,location:N,select:P,multiselect:F,user:I,relation:X,formula:Z,rollup:Q,document:c.extend({properties:G.optional(),accepts:o.array(o.string().min(1)).optional().describe("MIME prefixes or globs a file must match (e.g. `image/*`, `*.pdf`)"),maxFileSize:o.number().int().min(1).optional().describe(`Maximum file size in bytes`)})};function getAttributeConfigSchema(t){let n=$[t];if(!n)throw new e(`Unsupported attribute type: ${t}`,[]);return n}function parseAttributeConfig(e,t){let n=getAttributeConfigSchema(e).strip().parse(t),r=rollupTargetIssue(e,n);if(r)throw validationErrorFromIssues([r]);return n}function getAttributeConfigWriteSchema(e){let t=getAttributeConfigSchema(e).extend({icon:i.optional()});switch(e){case`select`:return t.extend({options:y.describe(`Options`)});case`multiselect`:return t.extend({options:b.describe(`Options`)});case`status`:return t.extend({options:x.describe(`Statuses`)});default:return t}}function validationErrorFromIssues(t){return e.fromZodErrors(t.map(e=>({path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message})))}function parseWriteSchema(e,t){let n=getAttributeConfigWriteSchema(e).strip().safeParse(t);if(!n.success)throw validationErrorFromIssues(n.error.issues);let r=rollupTargetIssue(e,n.data);if(r)throw validationErrorFromIssues([r]);let i=datePrecisionIssues(e,n.data);if(i.length>0)throw validationErrorFromIssues(i);return n.data}function parseAttributeConfigForCreate(e,t){return parseWriteSchema(e,t)}function validatePatchedIcon(t){if(!Object.prototype.hasOwnProperty.call(t,`icon`))return;let n=i.optional().safeParse(t.icon);if(!n.success)throw e.fromZodErrors(n.error.issues.map(e=>({path:[`icon`,...e.path.map(e=>typeof e==`symbol`?String(e):e)],message:e.message})))}function isSelectLike(e){return e===`select`||e===`multiselect`||e===`status`}function parseAttributeConfigForUpdate(e,t){let n=Object.prototype.hasOwnProperty.call(t,`options`),r=Object.prototype.hasOwnProperty.call(t,`icon`),i={...e,...t};if(validatePatchedIcon(t),n){let{icon:t,...n}=i,a=parseWriteSchema(e.type,r?i:n);return!r&&t!==void 0&&(a.icon=t),a}let a=e.options;isSelectLike(e.type)&&(i.options=[{value:`__legacy__`,label:`__legacy__`}]);let o=getAttributeConfigSchema(e.type).strip().safeParse(i);if(!o.success)throw validationErrorFromIssues(o.error.issues);let s=o.data,c=datePrecisionIssues(e.type,s);if(c.length>0)throw validationErrorFromIssues(c);return isSelectLike(e.type)&&(s.options=a),s}export{s as COMPUTED_RETURN_TYPES,B as SIMPLE_PROPERTY_TYPES,ee as WIRE_OFFERED_BASE_CONFIG,l as WIRE_OMITTED_CONFIG_KEYS,$ as attributeConfigSchemas,datePrecisionIssues,getAttributeConfigSchema,getAttributeConfigWriteSchema,parseAttributeConfig,parseAttributeConfigForCreate,parseAttributeConfigForUpdate,W as propertyAttributeSchema,J as propertyAttributeWireSchema,G as propertySchemaSchema,Y as propertySchemaWireSchema,refuseForeignKeys,p as selectOptionWriteSchema,f as statusGroupSchema,m as statusOptionWriteSchema,wireHiddenTypeConfigMask,wireOmittedConfigKeysFor,withoutUnknownOptionKeys};
@@ -1,2 +0,0 @@
1
- /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- const e={required:e=>`${e.label} is required`,invalidType:(e,t)=>`${e.label} must be a ${t}`,minLength:(e,t)=>`${e.label} must be at least ${t} characters`,maxLength:(e,t)=>`${e.label} must be at most ${t} characters`,invalidPattern:e=>`${e.label} format is invalid`,minValue:(e,t)=>`${e.label} must be at least ${t}`,maxValue:(e,t)=>`${e.label} must be at most ${t}`,mustBeInteger:e=>`${e.label} must be an integer`,invalidDate:e=>`${e.label} must be a valid date`,invalidOption:(e,t)=>`${e.label} must be one of: ${t.join(`, `)}`,invalidId:e=>`${e.label} must be a valid ID`,maxItems:(e,t)=>`${e.label} must have at most ${t} item${t>1?`s`:``}`,invalidRichtext:e=>`${e.label} must be valid rich text content`,invalidPhone:e=>`${e.label} must be a valid phone number`,invalidCurrency:e=>`${e.label} must be a valid currency value`,invalidLocation:e=>`${e.label} must be a valid location`};function formatZodErrors(e){return e.issues.map(e=>({path:e.path.map(String),message:e.message}))}Object.defineProperty(exports,"DEFAULT_VALIDATION_MESSAGES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"formatZodErrors",{enumerable:!0,get:function(){return formatZodErrors}});
@@ -1,2 +0,0 @@
1
- /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- const e={required:e=>`${e.label} is required`,invalidType:(e,t)=>`${e.label} must be a ${t}`,minLength:(e,t)=>`${e.label} must be at least ${t} characters`,maxLength:(e,t)=>`${e.label} must be at most ${t} characters`,invalidPattern:e=>`${e.label} format is invalid`,minValue:(e,t)=>`${e.label} must be at least ${t}`,maxValue:(e,t)=>`${e.label} must be at most ${t}`,mustBeInteger:e=>`${e.label} must be an integer`,invalidDate:e=>`${e.label} must be a valid date`,invalidOption:(e,t)=>`${e.label} must be one of: ${t.join(`, `)}`,invalidId:e=>`${e.label} must be a valid ID`,maxItems:(e,t)=>`${e.label} must have at most ${t} item${t>1?`s`:``}`,invalidRichtext:e=>`${e.label} must be valid rich text content`,invalidPhone:e=>`${e.label} must be a valid phone number`,invalidCurrency:e=>`${e.label} must be a valid currency value`,invalidLocation:e=>`${e.label} must be a valid location`};function formatZodErrors(e){return e.issues.map(e=>({path:e.path.map(String),message:e.message}))}export{e as DEFAULT_VALIDATION_MESSAGES,formatZodErrors};