@standards/schema 0.0.0-stage → 1.0.0-alpha.382

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 (133) hide show
  1. package/LICENSE +111 -0
  2. package/README.md +8 -2
  3. package/dist/all-BgYwavNm.d.mts +2956 -0
  4. package/dist/all-DjdKldjX.d.ts +2956 -0
  5. package/dist/api/index.d.mts +11838 -0
  6. package/dist/api/index.d.ts +11838 -0
  7. package/dist/api/index.js +2 -0
  8. package/dist/api/index.mjs +2 -0
  9. package/dist/attribute-validators-DRqhAt2t.mjs +11 -0
  10. package/dist/attribute-validators-WAoJbap5.js +11 -0
  11. package/dist/attributes-aTeqx6cK.d.mts +557 -0
  12. package/dist/attributes-kAhQzg8-.d.ts +557 -0
  13. package/dist/checkbox-BZvZOraX.d.mts +11 -0
  14. package/dist/checkbox-n0YV1O13.d.ts +11 -0
  15. package/dist/config-BIxnbUN8.mjs +2 -0
  16. package/dist/config-DdjlHdPg.js +2 -0
  17. package/dist/core-397tQy5q.js +2 -0
  18. package/dist/core-BLHhNykL.mjs +2 -0
  19. package/dist/date-CxqDOhA0.d.mts +24 -0
  20. package/dist/date-D007KyTI.d.ts +24 -0
  21. package/dist/exceptions-DjPVyS-Q.d.mts +761 -0
  22. package/dist/exceptions-DjPVyS-Q.d.ts +761 -0
  23. package/dist/exceptions.d.mts +3 -0
  24. package/dist/exceptions.d.ts +3 -0
  25. package/dist/exceptions.js +2 -0
  26. package/dist/exceptions.mjs +2 -0
  27. package/dist/index-3HZjBOpj.d.mts +53 -0
  28. package/dist/index-BmNMneu3.d.mts +278 -0
  29. package/dist/index-Bu9xF5Nq.d.ts +278 -0
  30. package/dist/index-CiTBL4gH.d.ts +101 -0
  31. package/dist/index-D7TEaPqX.d.ts +16519 -0
  32. package/dist/index-DLO8JpnY.d.ts +53 -0
  33. package/dist/index-DPO5w-fC.d.mts +101 -0
  34. package/dist/index-DwQWBzYJ.d.mts +16519 -0
  35. package/dist/index.d.mts +15 -0
  36. package/dist/index.d.ts +15 -0
  37. package/dist/index.js +2 -0
  38. package/dist/index.mjs +2 -0
  39. package/dist/number-CgBxEbjI.d.mts +11 -0
  40. package/dist/number-DncH-WRO.d.ts +11 -0
  41. package/dist/object-DcgxLvip.js +4 -0
  42. package/dist/object-Dzl7sfq8.mjs +4 -0
  43. package/dist/objects-B4DgFZ82.d.ts +398 -0
  44. package/dist/objects-C9f6hFW_.d.mts +398 -0
  45. package/dist/phone-BB-tzcSr.js +2 -0
  46. package/dist/phone-Bca_xiOX.mjs +2 -0
  47. package/dist/record-aggregates-CzG86pUS.mjs +2 -0
  48. package/dist/record-aggregates-DwpIJ2Dv.js +2 -0
  49. package/dist/record-operation-BSXczk7v.js +2 -0
  50. package/dist/record-operation-C9oXHmfF.mjs +2 -0
  51. package/dist/text-A9AJ1wUO.js +2 -0
  52. package/dist/text-C8Lb-NFo.mjs +2 -0
  53. package/dist/text-DDoY_LcQ.d.ts +11 -0
  54. package/dist/text-DeUqCFp9.d.mts +11 -0
  55. package/dist/utils-B7Dlrtnx.d.ts +163 -0
  56. package/dist/utils-DbRMK8NI.d.mts +163 -0
  57. package/dist/utils-fXIvFFl6.mjs +2 -0
  58. package/dist/utils-gY3d9Dwp.js +2 -0
  59. package/dist/utils.d.mts +3 -0
  60. package/dist/utils.d.ts +3 -0
  61. package/dist/utils.js +2 -0
  62. package/dist/utils.mjs +2 -0
  63. package/dist/validation/all.d.mts +6 -0
  64. package/dist/validation/all.d.ts +6 -0
  65. package/dist/validation/all.js +2 -0
  66. package/dist/validation/all.mjs +2 -0
  67. package/dist/validation/complex/currency.d.mts +13 -0
  68. package/dist/validation/complex/currency.d.ts +13 -0
  69. package/dist/validation/complex/currency.js +2 -0
  70. package/dist/validation/complex/currency.mjs +2 -0
  71. package/dist/validation/complex/location.d.mts +20 -0
  72. package/dist/validation/complex/location.d.ts +20 -0
  73. package/dist/validation/complex/location.js +2 -0
  74. package/dist/validation/complex/location.mjs +2 -0
  75. package/dist/validation/complex/phone.d.mts +20 -0
  76. package/dist/validation/complex/phone.d.ts +20 -0
  77. package/dist/validation/complex/phone.js +2 -0
  78. package/dist/validation/complex/phone.mjs +2 -0
  79. package/dist/validation/complex/relation.d.mts +23 -0
  80. package/dist/validation/complex/relation.d.ts +23 -0
  81. package/dist/validation/complex/relation.js +2 -0
  82. package/dist/validation/complex/relation.mjs +2 -0
  83. package/dist/validation/complex/richtext.d.mts +11 -0
  84. package/dist/validation/complex/richtext.d.ts +11 -0
  85. package/dist/validation/complex/richtext.js +2 -0
  86. package/dist/validation/complex/richtext.mjs +2 -0
  87. package/dist/validation/complex/select.d.mts +18 -0
  88. package/dist/validation/complex/select.d.ts +18 -0
  89. package/dist/validation/complex/select.js +2 -0
  90. package/dist/validation/complex/select.mjs +2 -0
  91. package/dist/validation/complex/user.d.mts +11 -0
  92. package/dist/validation/complex/user.d.ts +11 -0
  93. package/dist/validation/complex/user.js +2 -0
  94. package/dist/validation/complex/user.mjs +2 -0
  95. package/dist/validation/computed/formula.d.mts +12 -0
  96. package/dist/validation/computed/formula.d.ts +12 -0
  97. package/dist/validation/computed/formula.js +2 -0
  98. package/dist/validation/computed/formula.mjs +2 -0
  99. package/dist/validation/computed/rollup.d.mts +12 -0
  100. package/dist/validation/computed/rollup.d.ts +12 -0
  101. package/dist/validation/computed/rollup.js +2 -0
  102. package/dist/validation/computed/rollup.mjs +2 -0
  103. package/dist/validation/config/index.d.mts +3 -0
  104. package/dist/validation/config/index.d.ts +3 -0
  105. package/dist/validation/config/index.js +2 -0
  106. package/dist/validation/config/index.mjs +2 -0
  107. package/dist/validation/core/index.d.mts +3 -0
  108. package/dist/validation/core/index.d.ts +3 -0
  109. package/dist/validation/core/index.js +2 -0
  110. package/dist/validation/core/index.mjs +2 -0
  111. package/dist/validation/object/index.d.mts +3 -0
  112. package/dist/validation/object/index.d.ts +3 -0
  113. package/dist/validation/object/index.js +2 -0
  114. package/dist/validation/object/index.mjs +2 -0
  115. package/dist/validation/primitives/checkbox.d.mts +3 -0
  116. package/dist/validation/primitives/checkbox.d.ts +3 -0
  117. package/dist/validation/primitives/checkbox.js +2 -0
  118. package/dist/validation/primitives/checkbox.mjs +2 -0
  119. package/dist/validation/primitives/date.d.mts +3 -0
  120. package/dist/validation/primitives/date.d.ts +3 -0
  121. package/dist/validation/primitives/date.js +2 -0
  122. package/dist/validation/primitives/date.mjs +2 -0
  123. package/dist/validation/primitives/number.d.mts +3 -0
  124. package/dist/validation/primitives/number.d.ts +3 -0
  125. package/dist/validation/primitives/number.js +2 -0
  126. package/dist/validation/primitives/number.mjs +2 -0
  127. package/dist/validation/primitives/text.d.mts +3 -0
  128. package/dist/validation/primitives/text.d.ts +3 -0
  129. package/dist/validation/primitives/text.js +2 -0
  130. package/dist/validation/primitives/text.mjs +2 -0
  131. package/dist/view-config.schema-BQ9tU_9G.js +2 -0
  132. package/dist/view-config.schema-BmjCQJ51.mjs +2 -0
  133. package/package.json +279 -3
@@ -0,0 +1,4 @@
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{t}from"./text-C8Lb-NFo.mjs";import{n,t as r}from"./core-BLHhNykL.mjs";import{createNumberValidator as i}from"./validation/primitives/number.mjs";import{createCheckboxValidator as a}from"./validation/primitives/checkbox.mjs";import{createDateValidator as o}from"./validation/primitives/date.mjs";import{createCurrencyValidator as s}from"./validation/complex/currency.mjs";import{createLocationValidator as c}from"./validation/complex/location.mjs";import{t as l}from"./phone-Bca_xiOX.mjs";import{createRelationValidator as u}from"./validation/complex/relation.mjs";import{createRichtextValidator as d}from"./validation/complex/richtext.mjs";import{createMultiselectValidator as f,createSelectValidator as p,createStatusValidator as m}from"./validation/complex/select.mjs";import{createUserValidator as h}from"./validation/complex/user.mjs";import{createFormulaValidator as g}from"./validation/computed/formula.mjs";import{createRollupValidator as _}from"./validation/computed/rollup.mjs";import{z as v}from"zod";function isNullishOrEmptyString(e){return e==null||e===``}function isValuePresent(e){return e==null?!1:typeof e==`string`?e.trim()!==``:!Array.isArray(e)||e.length>0}const y={phone:[`countryCode`]};function isEmptyValue(e,t=[]){return e==null||typeof e==`string`&&e.trim()===``?!0:e instanceof Date?!1:typeof e==`object`&&!Array.isArray(e)&&Object.entries(e).filter(([e])=>!t.includes(e)).every(([,e])=>e==null||typeof e==`string`&&e.trim()===``)}function withEmptyToNull(e,t){return v.preprocess(e=>isEmptyValue(e,t)?null:e,e.nullish())}function createAttributeValidator(e,r=n){switch(e.type){case`text`:return t(e,r);case`richtext`:return d(e,r);case`number`:return i(e,r);case`checkbox`:return a(e,r);case`date`:return o(e,r);case`phone`:return l(e,r);case`currency`:return s(e,r);case`status`:return m(e,r);case`location`:return c(e,r);case`select`:return p(e,r);case`multiselect`:return f(e,r);case`user`:return h(e,r);case`relation`:return u(e,r);case`formula`:return g(e,r);case`rollup`:return _(e,r);default:return v.unknown()}}function createFormAttributeValidator(e,t=n){let r=createAttributeValidator(e,t);return e.required?r:withEmptyToNull(r,y[e.type])}const b=new WeakMap,x=new WeakMap;function createObjectValidator(e){let t=b.get(e);if(t)return t;let r={};for(let t of e.attributes){let e=createAttributeValidator(t);t.required?r[t.name]=e.refine(isValuePresent,{message:n.required(t)}):r[t.name]=withEmptyToNull(e,y[t.type])}let i=v.object(r).passthrough();return b.set(e,i),i}function createDraftValidator(e){let t=x.get(e);if(t)return t;let n={};for(let t of e.attributes){let e=createAttributeValidator(t);n[t.name]=withEmptyToNull(e,y[t.type])}let r=v.object(n).passthrough();return x.set(e,r),r}function validateAttribute(e,t){let n=createAttributeValidator(e);if(!e.required&&t==null)return{success:!0,data:{[e.name]:t}};let i=n.safeParse(t);return i.success?{success:!0,data:{[e.name]:i.data}}:{success:!1,errors:r(i.error).map(t=>({path:[e.name,...t.path],message:t.message}))}}function validateObject(e,t){let n=createObjectValidator(e).safeParse(t);return n.success?{success:!0,data:n.data}:{success:!1,errors:r(n.error)}}function validateObjectOrThrow(t,n){let r=validateObject(t,n);if(!r.success){let n=r.errors??[],i=n.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`
3
+ `)||`Unknown validation error`;throw new e(`Validation failed for ${t.label}:\n${i}`,n.map(e=>({path:e.path,message:e.message})))}return r.data}function validateDraft(e,t){let n=createDraftValidator(e).safeParse(t);return n.success?{success:!0,data:n.data}:{success:!1,errors:r(n.error)}}function validateDraftOrThrow(t,n){let r=validateDraft(t,n);if(!r.success){let n=r.errors??[],i=n.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`
4
+ `)||`Unknown validation error`;throw new e(`Draft validation failed for ${t.label}:\n${i}`,n.map(e=>({path:e.path,message:e.message})))}return r.data}function rejectUnknownAttributesOrThrow(t,n){let r=new Set(t.attributes.map(e=>e.name)),i=Object.keys(n).filter(e=>!r.has(e));if(i.length>0)throw new e(`Unknown attribute${i.length>1?`s`:``} for ${t.label}: ${i.join(`, `)}`,i.map(e=>({path:[e],message:`Unknown attribute`})))}function getMissingRequiredAttributes(e,t){let n=[];for(let r of e.attributes)r.required&&!isValuePresent(t[r.name])&&n.push(r);return n}function isRecordComplete(e,t){return getMissingRequiredAttributes(e,t).length>0?!1:validateObject(e,t).success}export{validateDraft as a,validateObjectOrThrow as c,createAttributeValidator as d,createFormAttributeValidator as f,isValuePresent as h,validateAttribute as i,createDraftValidator as l,isNullishOrEmptyString as m,isRecordComplete as n,validateDraftOrThrow as o,isEmptyValue as p,rejectUnknownAttributesOrThrow as r,validateObject as s,getMissingRequiredAttributes as t,createObjectValidator as u};
@@ -0,0 +1,398 @@
1
+
2
+ import { r as Uuid } from "./utils-B7Dlrtnx.js";
3
+ import { n as Attribute } from "./attributes-kAhQzg8-.js";
4
+ import { ColorId, IconName } from "@standards/constants";
5
+ //#region src/types/appearance.d.ts
6
+ /** Icon used when neither the entity nor its parent has one. */
7
+ declare const DEFAULT_APPEARANCE_ICON: IconName;
8
+ declare const IMAGE_SHAPES: readonly ["circle", "square"];
9
+ type ImageShape = (typeof IMAGE_SHAPES)[number];
10
+ /** The one appearance shape: every entity stores the facets it accepts. */
11
+ interface Appearance {
12
+ icon?: IconName;
13
+ color?: ColorId;
14
+ imageFileId?: Uuid;
15
+ }
16
+ type AppearanceFacet = "icon" | "color" | "image";
17
+ type AppearanceEntity = "object" | "record" | "emailCategory" | "option" | "view" | "agent" | "user";
18
+ declare const APPEARANCE_FACETS: Record<AppearanceEntity, readonly AppearanceFacet[]>;
19
+ type ResolvedAppearance = {
20
+ kind: "image";
21
+ imageFileId: Uuid;
22
+ shape: ImageShape;
23
+ } | {
24
+ kind: "tile";
25
+ icon: IconName;
26
+ color: ColorId;
27
+ } | {
28
+ kind: "glyph";
29
+ icon: IconName;
30
+ };
31
+ type Named = Appearance & {
32
+ name?: string;
33
+ };
34
+ /** Image wins; else an icon in a colour (own, parent's or derived from the name) is a tile, without colour a glyph. */
35
+ declare function resolveAppearance(entity: Named, parent?: Named & {
36
+ imageShape?: ImageShape;
37
+ }): ResolvedAppearance;
38
+ //#endregion
39
+ //#region src/types/document-layout.d.ts
40
+ interface DocumentLayout {
41
+ /** Dev-declared folder structures the user can instantiate via the UI inside a record's drive. */
42
+ presets?: FolderPreset[];
43
+ }
44
+ interface FolderPreset {
45
+ id: string;
46
+ label: string;
47
+ icon?: IconName;
48
+ description?: string;
49
+ structure: PresetNode[];
50
+ /** When true, this preset is auto-instantiated on every new record's drive for the owning object. */
51
+ autoInstantiate?: boolean;
52
+ }
53
+ interface PresetNode {
54
+ title: string;
55
+ description?: string;
56
+ children?: PresetNode[];
57
+ }
58
+ /** Max depth allowed for preset.structure to keep instantiation predictable. */
59
+ declare const MAX_PRESET_DEPTH = 5;
60
+ //#endregion
61
+ //#region src/types/record-access.d.ts
62
+ /**
63
+ * Every role a resource access grant can carry, weakest first (spec
64
+ * 2026-10-08 §3.2): `reader` sees, `runner` also uses (agents only),
65
+ * `editor` also modifies and manages the grants.
66
+ */
67
+ declare const ACCESS_ROLES: readonly ["reader", "runner", "editor"];
68
+ type AccessRole = (typeof ACCESS_ROLES)[number];
69
+ /** Roles a record access grant can carry (spec 2026-09-25 §5.1): a record is never "used". */
70
+ declare const RECORD_ACCESS_ROLES: readonly ["reader", "editor"];
71
+ type RecordAccessRole = (typeof RECORD_ACCESS_ROLES)[number];
72
+ /**
73
+ * Why a grant exists — the equivalent of Salesforce's `RowCause` (spec §3):
74
+ * automatic grants are recomputed without ever touching manual shares.
75
+ */
76
+ declare const RECORD_ACCESS_SOURCES: readonly ["manual", "meeting_attendee"];
77
+ type RecordAccessSource = (typeof RECORD_ACCESS_SOURCES)[number];
78
+ /**
79
+ * Agent-internal objects whose records are never shared (spec 2026-09-25
80
+ * §5.3.4): the memory resolver reads "private and visible" as "mine", and an
81
+ * extraction could rewrite another member's memory through an `editor` grant.
82
+ * A constant in v1 — a definition flag would mean editing native objects. The
83
+ * server refuses them; the UI hides the share control for them.
84
+ */
85
+ declare const UNSHAREABLE_OBJECT_NAMES: ReadonlySet<string>;
86
+ /** What the reading actor may do with a resource (spec §6.6); records never produce `runner`. */
87
+ type ViewerAccess = "owner" | "editor" | "runner" | "reader" | "workspace";
88
+ /** One beneficiary of a private resource: its effective role and every source that grants it. */
89
+ interface ResourceAccessGrant<TRole extends AccessRole = AccessRole, TSource extends string = RecordAccessSource> {
90
+ actorId: Uuid;
91
+ role: TRole;
92
+ sources: TSource[];
93
+ }
94
+ /** One beneficiary of a private record (shape unchanged since 2026-09-25, D11). */
95
+ type RecordAudienceGrant = ResourceAccessGrant<RecordAccessRole, RecordAccessSource>;
96
+ /** Who can reach a record beyond its owner (`GET /records/:object/:id/access`). */
97
+ interface RecordAudience {
98
+ recordId: Uuid;
99
+ visibility: ResourceVisibility;
100
+ ownedBy: Uuid | null;
101
+ /** The caller's own level; additive (D11), always sent by the server. */
102
+ viewerAccess?: ViewerAccess;
103
+ grants: RecordAudienceGrant[];
104
+ }
105
+ /** Who can reach an agent definition beyond its owner (`GET /agents/definitions/:id/access`). */
106
+ interface AgentDefinitionAudience {
107
+ definitionId: string;
108
+ visibility: ResourceVisibility;
109
+ ownedBy: Uuid | null;
110
+ viewerAccess: ViewerAccess;
111
+ /** Agents only carry manual grants (spec §3.1). */
112
+ grants: ResourceAccessGrant<AccessRole, "manual">[];
113
+ }
114
+ /** Who can reach a private page beyond its owner (`GET /pages/:id/access`). */
115
+ interface PageAudience {
116
+ pageId: Uuid;
117
+ visibility: ResourceVisibility;
118
+ ownedBy: Uuid | null;
119
+ viewerAccess: ViewerAccess;
120
+ /** Pages only carry manual grants (screens spec § 8). */
121
+ grants: ResourceAccessGrant<RecordAccessRole, "manual">[];
122
+ }
123
+ /** The resource an access operation addresses. */
124
+ type ResourceAccessTarget = {
125
+ kind: "record";
126
+ object: string;
127
+ id: string;
128
+ } | {
129
+ kind: "agent_definition";
130
+ id: string;
131
+ } | {
132
+ kind: "page";
133
+ id: string;
134
+ };
135
+ /** Narrow an untrusted value (HTTP body, CLI flag) to a record grant role. */
136
+ declare function parseRecordAccessRole(value: unknown): RecordAccessRole;
137
+ /** Narrow an untrusted value to an agent definition grant role. */
138
+ declare function parseAgentDefinitionAccessRole(value: unknown): AccessRole;
139
+ /** Narrow an untrusted value to a page grant role: a page is read or edited, never "used". */
140
+ declare function parsePageAccessRole(value: unknown): RecordAccessRole;
141
+ /**
142
+ * The single derivation of `viewerAccess`, from the row's owner and the
143
+ * `viewer_grant` storage computed FOR this viewer. A private resource that is
144
+ * neither owned nor granted can only have been read by the system reader,
145
+ * which reads and never writes: `reader`.
146
+ */
147
+ declare function deriveViewerAccess(resource: {
148
+ visibility: ResourceVisibility;
149
+ ownedBy: string | null;
150
+ viewerGrant?: AccessRole | null;
151
+ }, actorIds: readonly string[]): ViewerAccess;
152
+ //#endregion
153
+ //#region src/types/objects.d.ts
154
+ /** Visibility scopes shared by resources that can be workspace-wide or actor-private. */
155
+ declare const RESOURCE_VISIBILITIES: readonly ["workspace", "private"];
156
+ type ResourceVisibility = (typeof RESOURCE_VISIBILITIES)[number];
157
+ /**
158
+ * Scope a list-view tab reads. Deliberately a SEPARATE union from
159
+ * {@link ResourceVisibility}: a stored resource is always exactly one of
160
+ * `workspace` or `private`, while a tab may also read across both.
161
+ *
162
+ * `all` is not a third resource state — it means "impose no scope", so the tab
163
+ * returns whatever the mandatory viewer predicate already allows. `shared` is
164
+ * not one either: it reads the private resources other members shared with
165
+ * the viewer (spec 2026-10-08 §5). Never assign a tab scope to a record's
166
+ * `visibility` column.
167
+ */
168
+ declare const LIST_VIEW_TAB_VISIBILITIES: readonly ["all", "workspace", "private", "shared"];
169
+ type ListViewTabVisibility = (typeof LIST_VIEW_TAB_VISIBILITIES)[number];
170
+ /** The exact scope a record list query may impose: a visibility, or `shared` (owned by someone else, granted to me). */
171
+ declare const RECORD_LIST_SCOPES: readonly ["workspace", "private", "shared"];
172
+ type RecordListScope = (typeof RECORD_LIST_SCOPES)[number];
173
+ /** Narrow an untrusted list scope (HTTP body) or reject it — `all` is a tab value, never a query scope. */
174
+ declare function parseRecordListScope(value: unknown): RecordListScope;
175
+ /**
176
+ * Narrow an untrusted value from an edge (HTTP body, CLI flag) to a
177
+ * {@link ResourceVisibility}, or reject it.
178
+ *
179
+ * It lives beside the union so that whoever changes the union sees the one
180
+ * gate that admits values into it. Every edge had grown its own copy, and the
181
+ * one edge that instead trusted a `@IsIn` decorator had no gate at all: the
182
+ * API host installs a zod-only global pipe, so class-validator DTOs never ran
183
+ * and `"all"` — a real member of the sibling {@link ListViewTabVisibility}
184
+ * union, so the first thing a confused client sends — reached the visibility
185
+ * state machine as a 404, and Postgres as a SQLSTATE 22023 (#1715).
186
+ *
187
+ * Throws {@link ValidationError} rather than a transport exception so it can
188
+ * be used below the controller layer; the HTTP filter maps its code to 400.
189
+ */
190
+ declare function parseResourceVisibility(value: unknown): ResourceVisibility;
191
+ /**
192
+ * Timestamps for tracking creation and updates
193
+ */
194
+ interface Timestamps {
195
+ createdAt: Date;
196
+ updatedAt: Date;
197
+ }
198
+ /**
199
+ * Object definition - Represents a database table/entity
200
+ */
201
+ interface ObjectDefinition {
202
+ id?: Uuid;
203
+ name: string;
204
+ label: string;
205
+ pluralLabel?: string;
206
+ description?: string;
207
+ icon?: IconName;
208
+ color?: ColorId;
209
+ /** How the images of this object's records are cropped. */
210
+ imageShape?: ImageShape;
211
+ /**
212
+ * Template expression used to compute the object's display label.
213
+ * Supports variable interpolation and pipes for formatting.
214
+ *
215
+ * @example
216
+ * ```typescript
217
+ * // Simple attribute reference
218
+ * labelExpression: "{{ name }}"
219
+ *
220
+ * // Multiple attributes
221
+ * labelExpression: "{{ firstName }} {{ lastName }}"
222
+ *
223
+ * // With pipes for formatting
224
+ * labelExpression: "{{ code | UPPER }} - {{ name | capitalize }}"
225
+ * ```
226
+ *
227
+ * Available pipes: UPPER, LOWER, capitalize, trim
228
+ */
229
+ labelExpression: string;
230
+ /**
231
+ * Optional template expression used to compute the semantic text sent to
232
+ * Meilisearch for vector generation. When absent, records opt out of semantic
233
+ * embedding generation.
234
+ */
235
+ embeddingExpression?: string;
236
+ attributes: Attribute[];
237
+ system?: boolean;
238
+ /**
239
+ * If true, no custom (user-created) attributes are allowed on this object.
240
+ * `standards diff` will report an error if any custom attribute is found.
241
+ * Use .sealed() on the ObjectBuilder to set this.
242
+ */
243
+ sealed?: boolean;
244
+ /**
245
+ * List of custom attribute names explicitly acknowledged by the developer.
246
+ * On a sealed object, these names will NOT trigger a CI failure.
247
+ * On an extensible object, this is purely documentary.
248
+ * Use .tolerate(["name"]) on the ObjectBuilder to set this.
249
+ */
250
+ toleratedAttributes?: string[];
251
+ metadata?: Record<string, unknown>;
252
+ /** Smart-folder layout convention for documents attached to records of this object. */
253
+ documentLayout?: DocumentLayout;
254
+ }
255
+ /**
256
+ * Links an attribute to an object
257
+ */
258
+ interface ObjectAttribute {
259
+ objectId: Uuid;
260
+ attributeId: Uuid;
261
+ order?: number;
262
+ required?: boolean;
263
+ }
264
+ /** A record's own icon and image file (`APPEARANCE_FACETS.record`); each key is absent when unset. */
265
+ type RecordAppearance = Pick<Appearance, "icon" | "imageFileId">;
266
+ /**
267
+ * Record - Instance of an Object (a row in the database)
268
+ */
269
+ interface ObjectRecord<TValues extends Record<string, unknown> = Record<string, unknown>> extends Timestamps {
270
+ id: Uuid;
271
+ objectId: Uuid;
272
+ /**
273
+ * Name of the owning object. Present on every row read through the repository
274
+ * (`object_records.object_name` is denormalized and always selected), absent
275
+ * on records built in memory before a write.
276
+ */
277
+ objectName?: string;
278
+ /** Workspace-wide or owner-private visibility enforced by repository queries. */
279
+ visibility: ResourceVisibility;
280
+ /** Owning actor for private records; always null for workspace records. */
281
+ ownedBy: Uuid | null;
282
+ /**
283
+ * What the reading actor may do with this record (spec §6.6): its owner,
284
+ * an editor or reader by grant, or any member of a workspace record.
285
+ * Computed for the viewer that read the row; absent on records built in
286
+ * memory and on rows read without a viewer. Never broadcast nor indexed.
287
+ */
288
+ viewerAccess?: ViewerAccess;
289
+ /**
290
+ * Display label computed from the object's labelExpression.
291
+ * Computed dynamically based on record values.
292
+ *
293
+ * @example "John Doe" (from "{{ firstName }} {{ lastName }}")
294
+ */
295
+ label: string;
296
+ /**
297
+ * Semantic text computed from the object's embeddingExpression and persisted
298
+ * for Meilisearch documentTemplate-based vector generation.
299
+ */
300
+ embeddingText?: string;
301
+ /**
302
+ * The record's own icon and image (a `files` row id; clients compose
303
+ * `{publicFilesUrl}/{imageFileId}`). Absent when it has neither: the record
304
+ * then shows its object's appearance.
305
+ */
306
+ appearance?: RecordAppearance;
307
+ values: TValues;
308
+ /**
309
+ * Custom metadata for the record.
310
+ * Use this for UI/UX state, feature flags, or any application-specific data.
311
+ * Unlike system fields (id, createdAt, updatedAt), metadata can be updated.
312
+ */
313
+ metadata?: Record<string, unknown>;
314
+ /**
315
+ * Soft delete timestamp.
316
+ * If set, the record is considered deleted but can be restored.
317
+ * Queries exclude soft-deleted records by default.
318
+ */
319
+ deletedAt?: Date | null;
320
+ /**
321
+ * Actor ID who soft-deleted this record.
322
+ * Set alongside deletedAt when a record is soft-deleted.
323
+ */
324
+ deletedBy?: string | null;
325
+ /**
326
+ * Actor ID who created this record.
327
+ * Automatically set by RecordService when actorId is configured.
328
+ * Optional for backward compatibility with existing records.
329
+ */
330
+ createdBy?: string;
331
+ /**
332
+ * Actor ID who last updated this record.
333
+ * Automatically set by RecordService when actorId is configured.
334
+ * Optional for backward compatibility with existing records.
335
+ */
336
+ lastUpdatedBy?: string;
337
+ /** Monotonic record version: moves on every stored change, computed recalculations included. */
338
+ version?: number;
339
+ /**
340
+ * Storage-managed compare-and-set token the engine's own writers retry on.
341
+ * Not part of the API contract: no route accepts it as a precondition (a
342
+ * write's precondition is an operation step's `base`); read `version`.
343
+ * @internal
344
+ */
345
+ writeVersion?: number;
346
+ /** Schema version at the time this record was last migrated */
347
+ schemaVersion: number;
348
+ }
349
+ /**
350
+ * System-managed field names on ObjectRecord.
351
+ * These are stored as SQL columns (not in JSONB `values`).
352
+ *
353
+ * Use this in adapters to determine if a filter/sort attribute is a table column
354
+ * vs. a JSONB value field.
355
+ *
356
+ * @example
357
+ * ```typescript
358
+ * if (SYSTEM_FIELD_NAMES.includes(filter.attribute)) {
359
+ * // Filter on SQL column (e.g., WHERE created_at > ...)
360
+ * } else {
361
+ * // Filter on JSONB field (e.g., WHERE values->>'name' = ...)
362
+ * }
363
+ * ```
364
+ */
365
+ declare const SYSTEM_FIELD_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy", "visibility", "ownedBy"];
366
+ /**
367
+ * Type for system field names
368
+ */
369
+ type SystemFieldName = (typeof SYSTEM_FIELD_NAMES)[number];
370
+ /**
371
+ * Reserved attribute names that cannot be used for custom attributes.
372
+ * These names conflict with ObjectRecord properties.
373
+ *
374
+ * Includes:
375
+ * - System fields (id, timestamps, actor audit fields, visibility, ownership)
376
+ * - Other ObjectRecord properties (objectId, label, values, metadata, deletedAt)
377
+ *
378
+ * @example
379
+ * ```typescript
380
+ * if (RESERVED_ATTRIBUTE_NAMES.includes(attributeName)) {
381
+ * throw new Error(`"${attributeName}" is a reserved name`);
382
+ * }
383
+ * ```
384
+ */
385
+ declare const RESERVED_ATTRIBUTE_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy", "visibility", "ownedBy", "objectId", "label", "embeddingText", "values", "metadata", "deletedAt", "deletedBy", "schemaVersion", "appearance", "owned_by"];
386
+ /**
387
+ * Type for reserved attribute names
388
+ */
389
+ type ReservedAttributeName = (typeof RESERVED_ATTRIBUTE_NAMES)[number];
390
+ /**
391
+ * Reserved object names: every framework-native object. They cannot be used
392
+ * for user-created (runtime) objects, nor declared by a consumer's builder,
393
+ * registry entry, bundle or schema source — see `native/names.ts`.
394
+ */
395
+ declare const RESERVED_OBJECT_NAMES: readonly ["skill", "memory", "drives", "artifact", "meeting"];
396
+ type ReservedObjectName = (typeof RESERVED_OBJECT_NAMES)[number];
397
+ //#endregion
398
+ export { ResourceAccessGrant as A, MAX_PRESET_DEPTH as B, PageAudience as C, RecordAccessSource as D, RecordAccessRole as E, parseAgentDefinitionAccessRole as F, AppearanceFacet as G, APPEARANCE_FACETS as H, parsePageAccessRole as I, ImageShape as J, DEFAULT_APPEARANCE_ICON as K, parseRecordAccessRole as L, UNSHAREABLE_OBJECT_NAMES as M, ViewerAccess as N, RecordAudience as O, deriveViewerAccess as P, DocumentLayout as R, AgentDefinitionAudience as S, RECORD_ACCESS_SOURCES as T, Appearance as U, PresetNode as V, AppearanceEntity as W, resolveAppearance as X, ResolvedAppearance as Y, Timestamps as _, ObjectRecord as a, ACCESS_ROLES as b, RESERVED_OBJECT_NAMES as c, RecordListScope as d, ReservedAttributeName as f, SystemFieldName as g, SYSTEM_FIELD_NAMES as h, ObjectDefinition as i, ResourceAccessTarget as j, RecordAudienceGrant as k, RESOURCE_VISIBILITIES as l, ResourceVisibility as m, ListViewTabVisibility as n, RECORD_LIST_SCOPES as o, ReservedObjectName as p, IMAGE_SHAPES as q, ObjectAttribute as r, RESERVED_ATTRIBUTE_NAMES as s, LIST_VIEW_TAB_VISIBILITIES as t, RecordAppearance as u, parseRecordListScope as v, RECORD_ACCESS_ROLES as w, AccessRole as x, parseResourceVisibility as y, FolderPreset as z };