@stndrds/schema 1.0.0-alpha.294 → 1.0.0-alpha.69

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 (161) hide show
  1. package/dist/chunk-36UBIXJN.js +82 -0
  2. package/dist/chunk-3RG5ZIWI.js +10 -0
  3. package/dist/chunk-IXHWBBIY.mjs +721 -0
  4. package/dist/chunk-KG75T7MA.mjs +18664 -0
  5. package/dist/chunk-NEVERCM3.js +41 -0
  6. package/dist/chunk-V2RPPE2Y.mjs +41 -0
  7. package/dist/chunk-V32FQLWX.js +721 -0
  8. package/dist/chunk-V5QXU2OK.mjs +82 -0
  9. package/dist/chunk-XGFBT4K2.js +18664 -0
  10. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  11. package/dist/default-roles-42X3TJI5.mjs +21 -0
  12. package/dist/default-roles-C3FYDYMN.js +21 -0
  13. package/dist/index.d.mts +3392 -10868
  14. package/dist/index.d.ts +3392 -10868
  15. package/dist/index.js +1705 -10256
  16. package/dist/index.mjs +1735 -9398
  17. package/dist/runtime-B0G6eBXO.d.ts +12810 -0
  18. package/dist/runtime-fj4EKCWH.d.mts +12810 -0
  19. package/dist/runtime.d.mts +6 -0
  20. package/dist/runtime.d.ts +6 -0
  21. package/dist/runtime.js +323 -0
  22. package/dist/runtime.mjs +323 -0
  23. package/dist/utils.d.mts +55 -35
  24. package/dist/utils.d.ts +55 -35
  25. package/dist/utils.js +19 -31
  26. package/dist/utils.mjs +19 -2
  27. package/dist/validation/validators.d.mts +4 -0
  28. package/dist/validation/validators.d.ts +4 -0
  29. package/dist/validation/validators.js +121 -0
  30. package/dist/validation/validators.mjs +121 -0
  31. package/dist/validators-B6L_hVBw.d.ts +1564 -0
  32. package/dist/validators-CgiGGhyH.d.mts +1564 -0
  33. package/package.json +16 -106
  34. package/dist/all-CDJSpI46.d.ts +0 -978
  35. package/dist/all-Cru_CaSY.d.mts +0 -978
  36. package/dist/attributes-CNYwg_Nr.d.ts +0 -584
  37. package/dist/attributes-CWPLbp7c.d.mts +0 -584
  38. package/dist/capabilities.d.mts +0 -146
  39. package/dist/capabilities.d.ts +0 -146
  40. package/dist/capabilities.js +0 -77
  41. package/dist/capabilities.mjs +0 -70
  42. package/dist/chunk-2WWGHULM.mjs +0 -226
  43. package/dist/chunk-4KMUATDG.js +0 -609
  44. package/dist/chunk-5WATIVCA.js +0 -10
  45. package/dist/chunk-ACKMC6FL.js +0 -17
  46. package/dist/chunk-AYVHMVKQ.mjs +0 -15
  47. package/dist/chunk-CLZORRMS.mjs +0 -570
  48. package/dist/chunk-DVXGSTWJ.js +0 -81
  49. package/dist/chunk-E6JUYGJX.js +0 -22
  50. package/dist/chunk-EEH4XQ7W.js +0 -61
  51. package/dist/chunk-EW5XR2X3.js +0 -12
  52. package/dist/chunk-GO6LQADH.mjs +0 -57
  53. package/dist/chunk-HRQEZUAA.mjs +0 -29
  54. package/dist/chunk-HTSTPTNZ.js +0 -10
  55. package/dist/chunk-HURC6CW3.js +0 -241
  56. package/dist/chunk-JZNR4HKQ.mjs +0 -1432
  57. package/dist/chunk-KAWYU7TE.js +0 -657
  58. package/dist/chunk-KNGWHQLR.js +0 -16
  59. package/dist/chunk-LV3FEUKU.mjs +0 -14
  60. package/dist/chunk-NS63SPNN.mjs +0 -8
  61. package/dist/chunk-O73ROMWQ.mjs +0 -85
  62. package/dist/chunk-OSSGN43B.mjs +0 -8
  63. package/dist/chunk-Q44QKLN4.mjs +0 -43
  64. package/dist/chunk-Q4SZAMJT.js +0 -72
  65. package/dist/chunk-QT35SI3K.mjs +0 -641
  66. package/dist/chunk-QVLQPW3O.mjs +0 -10
  67. package/dist/chunk-QWKLQRBX.js +0 -35
  68. package/dist/chunk-R2DAEDRF.mjs +0 -74
  69. package/dist/chunk-R5LAJCBU.mjs +0 -67
  70. package/dist/chunk-SI34M4IC.js +0 -45
  71. package/dist/chunk-T5PM73EF.js +0 -1504
  72. package/dist/chunk-UANQJ2GH.mjs +0 -25
  73. package/dist/chunk-UXAHLSWC.mjs +0 -8
  74. package/dist/chunk-V2UA2D4E.js +0 -10
  75. package/dist/chunk-YIP5FJ5H.js +0 -27
  76. package/dist/chunk-YKWSHBT5.js +0 -32
  77. package/dist/chunk-YUFTHPOE.mjs +0 -20
  78. package/dist/chunk-ZDQ5AP26.mjs +0 -31
  79. package/dist/chunk-ZPFOKBIN.js +0 -89
  80. package/dist/exceptions.d.mts +0 -511
  81. package/dist/exceptions.d.ts +0 -511
  82. package/dist/exceptions.js +0 -158
  83. package/dist/exceptions.mjs +0 -1
  84. package/dist/helpers-CXkVwpsl.d.ts +0 -76
  85. package/dist/helpers-Dul_r9rJ.d.mts +0 -76
  86. package/dist/index-BdVnHL3F.d.mts +0 -853
  87. package/dist/index-CFhPHQaI.d.ts +0 -853
  88. package/dist/migrations-DaFneOfx.d.ts +0 -39
  89. package/dist/migrations-fRvadl6i.d.mts +0 -39
  90. package/dist/objects-CDwMSnqv.d.mts +0 -250
  91. package/dist/objects-DJv6WrDE.d.ts +0 -250
  92. package/dist/types-CVYiFc69.d.mts +0 -38
  93. package/dist/types-NGEww_ln.d.ts +0 -38
  94. package/dist/validation/all.d.mts +0 -11
  95. package/dist/validation/all.d.ts +0 -11
  96. package/dist/validation/all.js +0 -131
  97. package/dist/validation/all.mjs +0 -18
  98. package/dist/validation/complex/currency.d.mts +0 -15
  99. package/dist/validation/complex/currency.d.ts +0 -15
  100. package/dist/validation/complex/currency.js +0 -11
  101. package/dist/validation/complex/currency.mjs +0 -2
  102. package/dist/validation/complex/location.d.mts +0 -22
  103. package/dist/validation/complex/location.d.ts +0 -22
  104. package/dist/validation/complex/location.js +0 -11
  105. package/dist/validation/complex/location.mjs +0 -2
  106. package/dist/validation/complex/phone.d.mts +0 -22
  107. package/dist/validation/complex/phone.d.ts +0 -22
  108. package/dist/validation/complex/phone.js +0 -11
  109. package/dist/validation/complex/phone.mjs +0 -2
  110. package/dist/validation/complex/relation.d.mts +0 -25
  111. package/dist/validation/complex/relation.d.ts +0 -25
  112. package/dist/validation/complex/relation.js +0 -19
  113. package/dist/validation/complex/relation.mjs +0 -2
  114. package/dist/validation/complex/richtext.d.mts +0 -13
  115. package/dist/validation/complex/richtext.d.ts +0 -13
  116. package/dist/validation/complex/richtext.js +0 -11
  117. package/dist/validation/complex/richtext.mjs +0 -2
  118. package/dist/validation/complex/select.d.mts +0 -20
  119. package/dist/validation/complex/select.d.ts +0 -20
  120. package/dist/validation/complex/select.js +0 -19
  121. package/dist/validation/complex/select.mjs +0 -2
  122. package/dist/validation/complex/user.d.mts +0 -13
  123. package/dist/validation/complex/user.d.ts +0 -13
  124. package/dist/validation/complex/user.js +0 -11
  125. package/dist/validation/complex/user.mjs +0 -2
  126. package/dist/validation/computed/formula.d.mts +0 -14
  127. package/dist/validation/computed/formula.d.ts +0 -14
  128. package/dist/validation/computed/formula.js +0 -11
  129. package/dist/validation/computed/formula.mjs +0 -2
  130. package/dist/validation/computed/rollup.d.mts +0 -14
  131. package/dist/validation/computed/rollup.d.ts +0 -14
  132. package/dist/validation/computed/rollup.js +0 -11
  133. package/dist/validation/computed/rollup.mjs +0 -2
  134. package/dist/validation/config/index.d.mts +0 -7
  135. package/dist/validation/config/index.d.ts +0 -7
  136. package/dist/validation/config/index.js +0 -52
  137. package/dist/validation/config/index.mjs +0 -7
  138. package/dist/validation/core/index.d.mts +0 -19
  139. package/dist/validation/core/index.d.ts +0 -19
  140. package/dist/validation/core/index.js +0 -14
  141. package/dist/validation/core/index.mjs +0 -1
  142. package/dist/validation/object/index.d.mts +0 -32
  143. package/dist/validation/object/index.d.ts +0 -32
  144. package/dist/validation/object/index.js +0 -69
  145. package/dist/validation/object/index.mjs +0 -16
  146. package/dist/validation/primitives/checkbox.d.mts +0 -12
  147. package/dist/validation/primitives/checkbox.d.ts +0 -12
  148. package/dist/validation/primitives/checkbox.js +0 -11
  149. package/dist/validation/primitives/checkbox.mjs +0 -2
  150. package/dist/validation/primitives/date.d.mts +0 -25
  151. package/dist/validation/primitives/date.d.ts +0 -25
  152. package/dist/validation/primitives/date.js +0 -11
  153. package/dist/validation/primitives/date.mjs +0 -2
  154. package/dist/validation/primitives/number.d.mts +0 -12
  155. package/dist/validation/primitives/number.d.ts +0 -12
  156. package/dist/validation/primitives/number.js +0 -11
  157. package/dist/validation/primitives/number.mjs +0 -2
  158. package/dist/validation/primitives/text.d.mts +0 -12
  159. package/dist/validation/primitives/text.d.ts +0 -12
  160. package/dist/validation/primitives/text.js +0 -11
  161. package/dist/validation/primitives/text.mjs +0 -2
@@ -1,39 +0,0 @@
1
- import { A as Attribute, f as AttributeType } from './attributes-CNYwg_Nr.js';
2
-
3
- type BuiltInTransform = "toString" | "toNumber" | "toDate" | "toBoolean" | "toISOString";
4
- type SchemaOperation = {
5
- type: "add_attribute";
6
- attribute: Attribute;
7
- } | {
8
- type: "remove_attribute";
9
- name: string;
10
- backup_config: Attribute;
11
- } | {
12
- type: "rename_attribute";
13
- from: string;
14
- to: string;
15
- } | {
16
- type: "change_type";
17
- name: string;
18
- from: AttributeType;
19
- to: AttributeType;
20
- transform?: BuiltInTransform;
21
- } | {
22
- type: "update_config";
23
- name: string;
24
- from: Partial<Record<string, unknown>>;
25
- to: Partial<Record<string, unknown>>;
26
- } | {
27
- type: "remove_object";
28
- backup: Record<string, unknown>;
29
- } | {
30
- type: "rename_object";
31
- from: string;
32
- to: string;
33
- };
34
- interface MigrationDefinition {
35
- version: number;
36
- operations: SchemaOperation[];
37
- }
38
-
39
- export type { BuiltInTransform as B, MigrationDefinition as M, SchemaOperation as S };
@@ -1,39 +0,0 @@
1
- import { A as Attribute, f as AttributeType } from './attributes-CWPLbp7c.mjs';
2
-
3
- type BuiltInTransform = "toString" | "toNumber" | "toDate" | "toBoolean" | "toISOString";
4
- type SchemaOperation = {
5
- type: "add_attribute";
6
- attribute: Attribute;
7
- } | {
8
- type: "remove_attribute";
9
- name: string;
10
- backup_config: Attribute;
11
- } | {
12
- type: "rename_attribute";
13
- from: string;
14
- to: string;
15
- } | {
16
- type: "change_type";
17
- name: string;
18
- from: AttributeType;
19
- to: AttributeType;
20
- transform?: BuiltInTransform;
21
- } | {
22
- type: "update_config";
23
- name: string;
24
- from: Partial<Record<string, unknown>>;
25
- to: Partial<Record<string, unknown>>;
26
- } | {
27
- type: "remove_object";
28
- backup: Record<string, unknown>;
29
- } | {
30
- type: "rename_object";
31
- from: string;
32
- to: string;
33
- };
34
- interface MigrationDefinition {
35
- version: number;
36
- operations: SchemaOperation[];
37
- }
38
-
39
- export type { BuiltInTransform as B, MigrationDefinition as M, SchemaOperation as S };
@@ -1,250 +0,0 @@
1
- import { IconName } from '@stndrds/constants';
2
- import { Uuid } from './utils.mjs';
3
- import { A as Attribute } from './attributes-CWPLbp7c.mjs';
4
- import { M as MigrationDefinition } from './migrations-fRvadl6i.mjs';
5
-
6
- interface DocumentLayout {
7
- /** Named sub-folders auto-created at the top of the record's drive when first used via attach --variant. */
8
- variants?: Record<string, DocumentLayoutVariant>;
9
- /** Dev-declared folder structures the user can instantiate via the UI inside a record's drive. */
10
- presets?: FolderPreset[];
11
- }
12
- interface DocumentLayoutVariant {
13
- /** Display title for the auto-created sub-folder. */
14
- title: string;
15
- description?: string;
16
- }
17
- interface FolderPreset {
18
- id: string;
19
- label: string;
20
- icon?: IconName;
21
- description?: string;
22
- structure: PresetNode[];
23
- /** When true, this preset is auto-instantiated on every new record's drive for the owning object. */
24
- autoInstantiate?: boolean;
25
- }
26
- interface PresetNode {
27
- title: string;
28
- description?: string;
29
- children?: PresetNode[];
30
- }
31
- /** Max depth allowed for preset.structure to keep instantiation predictable. */
32
- declare const MAX_PRESET_DEPTH = 5;
33
-
34
- /** Visibility scopes shared by resources that can be workspace-wide or actor-private. */
35
- declare const RESOURCE_VISIBILITIES: readonly ["workspace", "private"];
36
- type ResourceVisibility = (typeof RESOURCE_VISIBILITIES)[number];
37
- /**
38
- * Scope a list-view tab reads. Deliberately a SEPARATE union from
39
- * {@link ResourceVisibility}: a stored resource is always exactly one of
40
- * `workspace` or `private`, while a tab may also read across both.
41
- *
42
- * `all` is not a third resource state — it means "impose no scope", so the tab
43
- * returns whatever the mandatory viewer predicate already allows: every
44
- * workspace record plus the viewer's own private ones. Never assign an `all`
45
- * tab scope to a record's `visibility` column.
46
- */
47
- declare const LIST_VIEW_TAB_VISIBILITIES: readonly ["all", "workspace", "private"];
48
- type ListViewTabVisibility = (typeof LIST_VIEW_TAB_VISIBILITIES)[number];
49
- /**
50
- * Narrow an untrusted value from an edge (HTTP body, CLI flag) to a
51
- * {@link ResourceVisibility}, or reject it.
52
- *
53
- * It lives beside the union so that whoever changes the union sees the one
54
- * gate that admits values into it. Every edge had grown its own copy, and the
55
- * one edge that instead trusted a `@IsIn` decorator had no gate at all: the
56
- * API host installs a zod-only global pipe, so class-validator DTOs never run
57
- * and `"all"` — a real member of the sibling {@link ListViewTabVisibility}
58
- * union, so the first thing a confused client sends — reached the visibility
59
- * state machine as a 404, and Postgres as a SQLSTATE 22023 (#1715).
60
- *
61
- * Throws {@link ValidationError} rather than a transport exception so it can
62
- * be used below the controller layer; the HTTP filter maps its code to 400.
63
- */
64
- declare function parseResourceVisibility(value: unknown): ResourceVisibility;
65
- /**
66
- * Timestamps for tracking creation and updates
67
- */
68
- interface Timestamps {
69
- createdAt: Date;
70
- updatedAt: Date;
71
- }
72
- /**
73
- * Object definition - Represents a database table/entity
74
- */
75
- interface ObjectDefinition {
76
- id?: Uuid;
77
- name: string;
78
- label: string;
79
- pluralLabel?: string;
80
- description?: string;
81
- icon?: IconName;
82
- /**
83
- * Template expression used to compute the object's display label.
84
- * Supports variable interpolation and pipes for formatting.
85
- *
86
- * @example
87
- * ```typescript
88
- * // Simple attribute reference
89
- * labelExpression: "{{ name }}"
90
- *
91
- * // Multiple attributes
92
- * labelExpression: "{{ firstName }} {{ lastName }}"
93
- *
94
- * // With pipes for formatting
95
- * labelExpression: "{{ code | UPPER }} - {{ name | capitalize }}"
96
- * ```
97
- *
98
- * Available pipes: UPPER, LOWER, capitalize, trim
99
- */
100
- labelExpression: string;
101
- /**
102
- * Optional template expression used to compute the semantic text sent to
103
- * Meilisearch for vector generation. When absent, records opt out of semantic
104
- * embedding generation.
105
- */
106
- embeddingExpression?: string;
107
- attributes: Attribute[];
108
- system?: boolean;
109
- /**
110
- * If true, no custom (user-created) attributes are allowed on this object.
111
- * `standards diff` will report an error if any custom attribute is found.
112
- * Use .sealed() on the ObjectBuilder to set this.
113
- */
114
- sealed?: boolean;
115
- /**
116
- * List of custom attribute names explicitly acknowledged by the developer.
117
- * On a sealed object, these names will NOT trigger a CI failure.
118
- * On an extensible object, this is purely documentary.
119
- * Use .tolerate(["name"]) on the ObjectBuilder to set this.
120
- */
121
- toleratedAttributes?: string[];
122
- metadata?: Record<string, unknown>;
123
- /** Current schema version (incremented with each migration) */
124
- schema_version: number;
125
- /** Ordered list of migrations applied to this object's schema */
126
- migrations: MigrationDefinition[];
127
- /** Smart-folder layout convention for documents attached to records of this object. */
128
- documentLayout?: DocumentLayout;
129
- }
130
- /**
131
- * Links an attribute to an object
132
- */
133
- interface ObjectAttribute {
134
- objectId: Uuid;
135
- attributeId: Uuid;
136
- order?: number;
137
- required?: boolean;
138
- }
139
- /**
140
- * Record - Instance of an Object (a row in the database)
141
- */
142
- interface ObjectRecord<TValues extends Record<string, unknown> = Record<string, unknown>> extends Timestamps {
143
- id: Uuid;
144
- objectId: Uuid;
145
- /**
146
- * Name of the owning object. Present on every row read through the repository
147
- * (`object_records.object_name` is denormalized and always selected), absent
148
- * on records built in memory before a write.
149
- */
150
- objectName?: string;
151
- /** Workspace-wide or owner-private visibility enforced by repository queries. */
152
- visibility: ResourceVisibility;
153
- /** Owning actor for private records; always null for workspace records. */
154
- ownedBy: Uuid | null;
155
- /**
156
- * Display label computed from the object's labelExpression.
157
- * Computed dynamically based on record values.
158
- *
159
- * @example "John Doe" (from "{{ firstName }} {{ lastName }}")
160
- */
161
- label: string;
162
- /**
163
- * Semantic text computed from the object's embeddingExpression and persisted
164
- * for Meilisearch documentTemplate-based vector generation.
165
- */
166
- embeddingText?: string;
167
- values: TValues;
168
- /**
169
- * Custom metadata for the record.
170
- * Use this for UI/UX state, feature flags, or any application-specific data.
171
- * Unlike system fields (id, createdAt, updatedAt), metadata can be updated.
172
- */
173
- metadata?: Record<string, unknown>;
174
- /**
175
- * Soft delete timestamp.
176
- * If set, the record is considered deleted but can be restored.
177
- * Queries exclude soft-deleted records by default.
178
- */
179
- deletedAt?: Date | null;
180
- /**
181
- * Actor ID who soft-deleted this record.
182
- * Set alongside deletedAt when a record is soft-deleted.
183
- */
184
- deletedBy?: string | null;
185
- /**
186
- * Actor ID who created this record.
187
- * Automatically set by RecordService when actorId is configured.
188
- * Optional for backward compatibility with existing records.
189
- */
190
- createdBy?: string;
191
- /**
192
- * Actor ID who last updated this record.
193
- * Automatically set by RecordService when actorId is configured.
194
- * Optional for backward compatibility with existing records.
195
- */
196
- lastUpdatedBy?: string;
197
- /** Storage-managed exact optimistic-lock token for atomic record writes. */
198
- writeVersion?: number;
199
- /** Schema version at the time this record was last migrated */
200
- schemaVersion: number;
201
- }
202
- /**
203
- * System-managed field names on ObjectRecord.
204
- * These are stored as SQL columns (not in JSONB `values`).
205
- *
206
- * Use this in adapters to determine if a filter/sort attribute is a table column
207
- * vs. a JSONB value field.
208
- *
209
- * @example
210
- * ```typescript
211
- * if (SYSTEM_FIELD_NAMES.includes(filter.attribute)) {
212
- * // Filter on SQL column (e.g., WHERE created_at > ...)
213
- * } else {
214
- * // Filter on JSONB field (e.g., WHERE values->>'name' = ...)
215
- * }
216
- * ```
217
- */
218
- declare const SYSTEM_FIELD_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy", "visibility", "ownedBy"];
219
- /**
220
- * Type for system field names
221
- */
222
- type SystemFieldName = (typeof SYSTEM_FIELD_NAMES)[number];
223
- /**
224
- * Reserved attribute names that cannot be used for custom attributes.
225
- * These names conflict with ObjectRecord properties.
226
- *
227
- * Includes:
228
- * - System fields (id, timestamps, actor audit fields, visibility, ownership)
229
- * - Other ObjectRecord properties (objectId, label, values, metadata, deletedAt)
230
- *
231
- * @example
232
- * ```typescript
233
- * if (RESERVED_ATTRIBUTE_NAMES.includes(attributeName)) {
234
- * throw new Error(`"${attributeName}" is a reserved name`);
235
- * }
236
- * ```
237
- */
238
- declare const RESERVED_ATTRIBUTE_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy", "visibility", "ownedBy", "objectId", "label", "embeddingText", "values", "metadata", "deletedAt", "deletedBy", "schemaVersion", "owned_by"];
239
- /**
240
- * Type for reserved attribute names
241
- */
242
- type ReservedAttributeName = (typeof RESERVED_ATTRIBUTE_NAMES)[number];
243
- /**
244
- * Reserved object names that cannot be used for user-created (runtime) objects.
245
- * These are owned by the framework as sealed system objects.
246
- */
247
- declare const RESERVED_OBJECT_NAMES: readonly ["skill"];
248
- type ReservedObjectName = (typeof RESERVED_OBJECT_NAMES)[number];
249
-
250
- export { type DocumentLayout as D, type FolderPreset as F, type ListViewTabVisibility as L, MAX_PRESET_DEPTH as M, type ObjectDefinition as O, type PresetNode as P, type ResourceVisibility as R, SYSTEM_FIELD_NAMES as S, type Timestamps as T, type ObjectRecord as a, type DocumentLayoutVariant as b, LIST_VIEW_TAB_VISIBILITIES as c, type ObjectAttribute as d, RESERVED_ATTRIBUTE_NAMES as e, RESERVED_OBJECT_NAMES as f, RESOURCE_VISIBILITIES as g, type ReservedAttributeName as h, type ReservedObjectName as i, type SystemFieldName as j, parseResourceVisibility as p };
@@ -1,250 +0,0 @@
1
- import { IconName } from '@stndrds/constants';
2
- import { Uuid } from './utils.js';
3
- import { A as Attribute } from './attributes-CNYwg_Nr.js';
4
- import { M as MigrationDefinition } from './migrations-DaFneOfx.js';
5
-
6
- interface DocumentLayout {
7
- /** Named sub-folders auto-created at the top of the record's drive when first used via attach --variant. */
8
- variants?: Record<string, DocumentLayoutVariant>;
9
- /** Dev-declared folder structures the user can instantiate via the UI inside a record's drive. */
10
- presets?: FolderPreset[];
11
- }
12
- interface DocumentLayoutVariant {
13
- /** Display title for the auto-created sub-folder. */
14
- title: string;
15
- description?: string;
16
- }
17
- interface FolderPreset {
18
- id: string;
19
- label: string;
20
- icon?: IconName;
21
- description?: string;
22
- structure: PresetNode[];
23
- /** When true, this preset is auto-instantiated on every new record's drive for the owning object. */
24
- autoInstantiate?: boolean;
25
- }
26
- interface PresetNode {
27
- title: string;
28
- description?: string;
29
- children?: PresetNode[];
30
- }
31
- /** Max depth allowed for preset.structure to keep instantiation predictable. */
32
- declare const MAX_PRESET_DEPTH = 5;
33
-
34
- /** Visibility scopes shared by resources that can be workspace-wide or actor-private. */
35
- declare const RESOURCE_VISIBILITIES: readonly ["workspace", "private"];
36
- type ResourceVisibility = (typeof RESOURCE_VISIBILITIES)[number];
37
- /**
38
- * Scope a list-view tab reads. Deliberately a SEPARATE union from
39
- * {@link ResourceVisibility}: a stored resource is always exactly one of
40
- * `workspace` or `private`, while a tab may also read across both.
41
- *
42
- * `all` is not a third resource state — it means "impose no scope", so the tab
43
- * returns whatever the mandatory viewer predicate already allows: every
44
- * workspace record plus the viewer's own private ones. Never assign an `all`
45
- * tab scope to a record's `visibility` column.
46
- */
47
- declare const LIST_VIEW_TAB_VISIBILITIES: readonly ["all", "workspace", "private"];
48
- type ListViewTabVisibility = (typeof LIST_VIEW_TAB_VISIBILITIES)[number];
49
- /**
50
- * Narrow an untrusted value from an edge (HTTP body, CLI flag) to a
51
- * {@link ResourceVisibility}, or reject it.
52
- *
53
- * It lives beside the union so that whoever changes the union sees the one
54
- * gate that admits values into it. Every edge had grown its own copy, and the
55
- * one edge that instead trusted a `@IsIn` decorator had no gate at all: the
56
- * API host installs a zod-only global pipe, so class-validator DTOs never run
57
- * and `"all"` — a real member of the sibling {@link ListViewTabVisibility}
58
- * union, so the first thing a confused client sends — reached the visibility
59
- * state machine as a 404, and Postgres as a SQLSTATE 22023 (#1715).
60
- *
61
- * Throws {@link ValidationError} rather than a transport exception so it can
62
- * be used below the controller layer; the HTTP filter maps its code to 400.
63
- */
64
- declare function parseResourceVisibility(value: unknown): ResourceVisibility;
65
- /**
66
- * Timestamps for tracking creation and updates
67
- */
68
- interface Timestamps {
69
- createdAt: Date;
70
- updatedAt: Date;
71
- }
72
- /**
73
- * Object definition - Represents a database table/entity
74
- */
75
- interface ObjectDefinition {
76
- id?: Uuid;
77
- name: string;
78
- label: string;
79
- pluralLabel?: string;
80
- description?: string;
81
- icon?: IconName;
82
- /**
83
- * Template expression used to compute the object's display label.
84
- * Supports variable interpolation and pipes for formatting.
85
- *
86
- * @example
87
- * ```typescript
88
- * // Simple attribute reference
89
- * labelExpression: "{{ name }}"
90
- *
91
- * // Multiple attributes
92
- * labelExpression: "{{ firstName }} {{ lastName }}"
93
- *
94
- * // With pipes for formatting
95
- * labelExpression: "{{ code | UPPER }} - {{ name | capitalize }}"
96
- * ```
97
- *
98
- * Available pipes: UPPER, LOWER, capitalize, trim
99
- */
100
- labelExpression: string;
101
- /**
102
- * Optional template expression used to compute the semantic text sent to
103
- * Meilisearch for vector generation. When absent, records opt out of semantic
104
- * embedding generation.
105
- */
106
- embeddingExpression?: string;
107
- attributes: Attribute[];
108
- system?: boolean;
109
- /**
110
- * If true, no custom (user-created) attributes are allowed on this object.
111
- * `standards diff` will report an error if any custom attribute is found.
112
- * Use .sealed() on the ObjectBuilder to set this.
113
- */
114
- sealed?: boolean;
115
- /**
116
- * List of custom attribute names explicitly acknowledged by the developer.
117
- * On a sealed object, these names will NOT trigger a CI failure.
118
- * On an extensible object, this is purely documentary.
119
- * Use .tolerate(["name"]) on the ObjectBuilder to set this.
120
- */
121
- toleratedAttributes?: string[];
122
- metadata?: Record<string, unknown>;
123
- /** Current schema version (incremented with each migration) */
124
- schema_version: number;
125
- /** Ordered list of migrations applied to this object's schema */
126
- migrations: MigrationDefinition[];
127
- /** Smart-folder layout convention for documents attached to records of this object. */
128
- documentLayout?: DocumentLayout;
129
- }
130
- /**
131
- * Links an attribute to an object
132
- */
133
- interface ObjectAttribute {
134
- objectId: Uuid;
135
- attributeId: Uuid;
136
- order?: number;
137
- required?: boolean;
138
- }
139
- /**
140
- * Record - Instance of an Object (a row in the database)
141
- */
142
- interface ObjectRecord<TValues extends Record<string, unknown> = Record<string, unknown>> extends Timestamps {
143
- id: Uuid;
144
- objectId: Uuid;
145
- /**
146
- * Name of the owning object. Present on every row read through the repository
147
- * (`object_records.object_name` is denormalized and always selected), absent
148
- * on records built in memory before a write.
149
- */
150
- objectName?: string;
151
- /** Workspace-wide or owner-private visibility enforced by repository queries. */
152
- visibility: ResourceVisibility;
153
- /** Owning actor for private records; always null for workspace records. */
154
- ownedBy: Uuid | null;
155
- /**
156
- * Display label computed from the object's labelExpression.
157
- * Computed dynamically based on record values.
158
- *
159
- * @example "John Doe" (from "{{ firstName }} {{ lastName }}")
160
- */
161
- label: string;
162
- /**
163
- * Semantic text computed from the object's embeddingExpression and persisted
164
- * for Meilisearch documentTemplate-based vector generation.
165
- */
166
- embeddingText?: string;
167
- values: TValues;
168
- /**
169
- * Custom metadata for the record.
170
- * Use this for UI/UX state, feature flags, or any application-specific data.
171
- * Unlike system fields (id, createdAt, updatedAt), metadata can be updated.
172
- */
173
- metadata?: Record<string, unknown>;
174
- /**
175
- * Soft delete timestamp.
176
- * If set, the record is considered deleted but can be restored.
177
- * Queries exclude soft-deleted records by default.
178
- */
179
- deletedAt?: Date | null;
180
- /**
181
- * Actor ID who soft-deleted this record.
182
- * Set alongside deletedAt when a record is soft-deleted.
183
- */
184
- deletedBy?: string | null;
185
- /**
186
- * Actor ID who created this record.
187
- * Automatically set by RecordService when actorId is configured.
188
- * Optional for backward compatibility with existing records.
189
- */
190
- createdBy?: string;
191
- /**
192
- * Actor ID who last updated this record.
193
- * Automatically set by RecordService when actorId is configured.
194
- * Optional for backward compatibility with existing records.
195
- */
196
- lastUpdatedBy?: string;
197
- /** Storage-managed exact optimistic-lock token for atomic record writes. */
198
- writeVersion?: number;
199
- /** Schema version at the time this record was last migrated */
200
- schemaVersion: number;
201
- }
202
- /**
203
- * System-managed field names on ObjectRecord.
204
- * These are stored as SQL columns (not in JSONB `values`).
205
- *
206
- * Use this in adapters to determine if a filter/sort attribute is a table column
207
- * vs. a JSONB value field.
208
- *
209
- * @example
210
- * ```typescript
211
- * if (SYSTEM_FIELD_NAMES.includes(filter.attribute)) {
212
- * // Filter on SQL column (e.g., WHERE created_at > ...)
213
- * } else {
214
- * // Filter on JSONB field (e.g., WHERE values->>'name' = ...)
215
- * }
216
- * ```
217
- */
218
- declare const SYSTEM_FIELD_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy", "visibility", "ownedBy"];
219
- /**
220
- * Type for system field names
221
- */
222
- type SystemFieldName = (typeof SYSTEM_FIELD_NAMES)[number];
223
- /**
224
- * Reserved attribute names that cannot be used for custom attributes.
225
- * These names conflict with ObjectRecord properties.
226
- *
227
- * Includes:
228
- * - System fields (id, timestamps, actor audit fields, visibility, ownership)
229
- * - Other ObjectRecord properties (objectId, label, values, metadata, deletedAt)
230
- *
231
- * @example
232
- * ```typescript
233
- * if (RESERVED_ATTRIBUTE_NAMES.includes(attributeName)) {
234
- * throw new Error(`"${attributeName}" is a reserved name`);
235
- * }
236
- * ```
237
- */
238
- declare const RESERVED_ATTRIBUTE_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy", "visibility", "ownedBy", "objectId", "label", "embeddingText", "values", "metadata", "deletedAt", "deletedBy", "schemaVersion", "owned_by"];
239
- /**
240
- * Type for reserved attribute names
241
- */
242
- type ReservedAttributeName = (typeof RESERVED_ATTRIBUTE_NAMES)[number];
243
- /**
244
- * Reserved object names that cannot be used for user-created (runtime) objects.
245
- * These are owned by the framework as sealed system objects.
246
- */
247
- declare const RESERVED_OBJECT_NAMES: readonly ["skill"];
248
- type ReservedObjectName = (typeof RESERVED_OBJECT_NAMES)[number];
249
-
250
- export { type DocumentLayout as D, type FolderPreset as F, type ListViewTabVisibility as L, MAX_PRESET_DEPTH as M, type ObjectDefinition as O, type PresetNode as P, type ResourceVisibility as R, SYSTEM_FIELD_NAMES as S, type Timestamps as T, type ObjectRecord as a, type DocumentLayoutVariant as b, LIST_VIEW_TAB_VISIBILITIES as c, type ObjectAttribute as d, RESERVED_ATTRIBUTE_NAMES as e, RESERVED_OBJECT_NAMES as f, RESOURCE_VISIBILITIES as g, type ReservedAttributeName as h, type ReservedObjectName as i, type SystemFieldName as j, parseResourceVisibility as p };
@@ -1,38 +0,0 @@
1
- import { A as Attribute } from './attributes-CWPLbp7c.mjs';
2
-
3
- /**
4
- * Validation messages for Zod validators.
5
- * All functions receive the full Attribute to access label, type, etc.
6
- * Can be customized for i18n support.
7
- */
8
- interface ValidationMessages {
9
- required: (attr: Attribute) => string;
10
- invalidType: (attr: Attribute, expected: string) => string;
11
- minLength: (attr: Attribute, min: number) => string;
12
- maxLength: (attr: Attribute, max: number) => string;
13
- invalidPattern: (attr: Attribute) => string;
14
- minValue: (attr: Attribute, min: number) => string;
15
- maxValue: (attr: Attribute, max: number) => string;
16
- mustBeInteger: (attr: Attribute) => string;
17
- invalidDate: (attr: Attribute) => string;
18
- invalidOption: (attr: Attribute, options: string[]) => string;
19
- invalidId: (attr: Attribute) => string;
20
- maxItems: (attr: Attribute, max: number) => string;
21
- invalidRichtext: (attr: Attribute) => string;
22
- invalidPhone: (attr: Attribute) => string;
23
- invalidCurrency: (attr: Attribute) => string;
24
- invalidLocation: (attr: Attribute) => string;
25
- }
26
- /**
27
- * Validation result
28
- */
29
- interface ValidationResult {
30
- success: boolean;
31
- data?: Record<string, unknown>;
32
- errors?: Array<{
33
- path: string[];
34
- message: string;
35
- }>;
36
- }
37
-
38
- export type { ValidationMessages as V, ValidationResult as a };
@@ -1,38 +0,0 @@
1
- import { A as Attribute } from './attributes-CNYwg_Nr.js';
2
-
3
- /**
4
- * Validation messages for Zod validators.
5
- * All functions receive the full Attribute to access label, type, etc.
6
- * Can be customized for i18n support.
7
- */
8
- interface ValidationMessages {
9
- required: (attr: Attribute) => string;
10
- invalidType: (attr: Attribute, expected: string) => string;
11
- minLength: (attr: Attribute, min: number) => string;
12
- maxLength: (attr: Attribute, max: number) => string;
13
- invalidPattern: (attr: Attribute) => string;
14
- minValue: (attr: Attribute, min: number) => string;
15
- maxValue: (attr: Attribute, max: number) => string;
16
- mustBeInteger: (attr: Attribute) => string;
17
- invalidDate: (attr: Attribute) => string;
18
- invalidOption: (attr: Attribute, options: string[]) => string;
19
- invalidId: (attr: Attribute) => string;
20
- maxItems: (attr: Attribute, max: number) => string;
21
- invalidRichtext: (attr: Attribute) => string;
22
- invalidPhone: (attr: Attribute) => string;
23
- invalidCurrency: (attr: Attribute) => string;
24
- invalidLocation: (attr: Attribute) => string;
25
- }
26
- /**
27
- * Validation result
28
- */
29
- interface ValidationResult {
30
- success: boolean;
31
- data?: Record<string, unknown>;
32
- errors?: Array<{
33
- path: string[];
34
- message: string;
35
- }>;
36
- }
37
-
38
- export type { ValidationMessages as V, ValidationResult as a };
@@ -1,11 +0,0 @@
1
- export { V as ValidationMessages } from '../types-CVYiFc69.mjs';
2
- export { DEFAULT_VALIDATION_MESSAGES, formatZodErrors } from './core/index.mjs';
3
- export { ad as multiselectOptionWriteSchema, ae as parseAttributeConfig, af as parseAttributeConfigForCreate, ag as parseAttributeConfigForUpdate, ah as selectOptionWriteSchema, ai as statusGroupSchema, aj as statusOptionWriteSchema } from '../index-BdVnHL3F.mjs';
4
- export { S as SCHEMA_LIMITS, c as colorIdSchema, e as detailTabSchema, f as detailViewConfigSchema, n as iconNameSchema, o as inverseSourceSchema, p as listViewConfigSchema, q as listViewTabSchema, r as parseViewConfig, s as relationSourceSchema, u as tableSourceSchema, v as viewConfigByTypeSchema } from '../all-Cru_CaSY.mjs';
5
- export { a as createFormAttributeValidator, r as rejectUnknownAttributesOrThrow, b as validateDraft, d as validateDraftOrThrow, e as validateObject, f as validateObjectOrThrow } from '../helpers-Dul_r9rJ.mjs';
6
- import '../attributes-CWPLbp7c.mjs';
7
- import '@stndrds/constants';
8
- import '../utils.mjs';
9
- import 'zod';
10
- import '../objects-CDwMSnqv.mjs';
11
- import '../migrations-fRvadl6i.mjs';
@@ -1,11 +0,0 @@
1
- export { V as ValidationMessages } from '../types-NGEww_ln.js';
2
- export { DEFAULT_VALIDATION_MESSAGES, formatZodErrors } from './core/index.js';
3
- export { ad as multiselectOptionWriteSchema, ae as parseAttributeConfig, af as parseAttributeConfigForCreate, ag as parseAttributeConfigForUpdate, ah as selectOptionWriteSchema, ai as statusGroupSchema, aj as statusOptionWriteSchema } from '../index-CFhPHQaI.js';
4
- export { S as SCHEMA_LIMITS, c as colorIdSchema, e as detailTabSchema, f as detailViewConfigSchema, n as iconNameSchema, o as inverseSourceSchema, p as listViewConfigSchema, q as listViewTabSchema, r as parseViewConfig, s as relationSourceSchema, u as tableSourceSchema, v as viewConfigByTypeSchema } from '../all-CDJSpI46.js';
5
- export { a as createFormAttributeValidator, r as rejectUnknownAttributesOrThrow, b as validateDraft, d as validateDraftOrThrow, e as validateObject, f as validateObjectOrThrow } from '../helpers-CXkVwpsl.js';
6
- import '../attributes-CNYwg_Nr.js';
7
- import '@stndrds/constants';
8
- import '../utils.js';
9
- import 'zod';
10
- import '../objects-DJv6WrDE.js';
11
- import '../migrations-DaFneOfx.js';