@stndrds/schema 1.0.0-alpha.83 → 1.0.0-alpha.85
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.
- package/dist/{chunk-NEVERCM3.js → chunk-E6XO2STS.js} +21 -1
- package/dist/{chunk-OR44EVWO.mjs → chunk-HKT7LEYM.mjs} +114 -102
- package/dist/{chunk-7VNLLASJ.mjs → chunk-JUVFK6XD.mjs} +2 -1
- package/dist/{chunk-WHDJLJRK.js → chunk-UGWL4KQR.js} +374 -362
- package/dist/{chunk-V2RPPE2Y.mjs → chunk-XAORXFAX.mjs} +21 -1
- package/dist/{chunk-HUT6HYXJ.js → chunk-ZW4N6FV7.js} +2 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -7
- package/dist/index.mjs +5 -3
- package/dist/{runtime-B6Dt5_Gc.d.ts → runtime-DSh9YK1-.d.ts} +8 -49
- package/dist/{runtime-Ttkdn9W7.d.mts → runtime-Dz1KblvE.d.mts} +8 -49
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +4 -4
- package/dist/runtime.mjs +3 -3
- package/dist/utils.d.mts +20 -1
- package/dist/utils.d.ts +20 -1
- package/dist/utils.js +4 -2
- package/dist/utils.mjs +3 -1
- package/dist/validation/validators.d.mts +1 -1
- package/dist/validation/validators.d.ts +1 -1
- package/dist/validation/validators.js +2 -2
- package/dist/validation/validators.mjs +1 -1
- package/dist/{validators-BeBrdQCB.d.mts → validators-CJmtOk1a.d.mts} +29 -1
- package/dist/{validators-UuAMCPc6.d.ts → validators-pv_b6bI_.d.ts} +29 -1
- package/package.json +2 -2
package/dist/utils.d.ts
CHANGED
|
@@ -150,5 +150,24 @@ declare function generateTemplateName(label: string): string;
|
|
|
150
150
|
* ```
|
|
151
151
|
*/
|
|
152
152
|
declare function indexBy<T, K extends PropertyKey>(items: T[], keyFn: (item: T) => K): Map<K, T>;
|
|
153
|
+
/**
|
|
154
|
+
* Deep equality comparison for plain objects and arrays.
|
|
155
|
+
* Handles nested structures, arrays, primitives, null, and undefined.
|
|
156
|
+
*
|
|
157
|
+
* Time complexity: O(n) where n is total number of properties
|
|
158
|
+
*
|
|
159
|
+
* @param a - First value to compare
|
|
160
|
+
* @param b - Second value to compare
|
|
161
|
+
* @returns true if values are deeply equal
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* deepEqual({ a: 1, b: { c: 2 } }, { a: 1, b: { c: 2 } }); // true
|
|
166
|
+
* deepEqual({ a: 1, b: 2 }, { b: 2, a: 1 }); // true (order-independent)
|
|
167
|
+
* deepEqual([1, 2, 3], [1, 2, 3]); // true
|
|
168
|
+
* deepEqual([1, 2], [2, 1]); // false (arrays preserve order)
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
153
172
|
|
|
154
|
-
export { type TenantId, type UserId, type Uuid, asTenantId, asUserId, generateId, generatePrefixedId, generateTemplateName, indexBy, slugify };
|
|
173
|
+
export { type TenantId, type UserId, type Uuid, asTenantId, asUserId, deepEqual, generateId, generatePrefixedId, generateTemplateName, indexBy, slugify };
|
package/dist/utils.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunkE6XO2STSjs = require('./chunk-E6XO2STS.js');
|
|
10
11
|
require('./chunk-3RG5ZIWI.js');
|
|
11
12
|
|
|
12
13
|
|
|
@@ -16,4 +17,5 @@ require('./chunk-3RG5ZIWI.js');
|
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
exports.asTenantId = _chunkE6XO2STSjs.asTenantId; exports.asUserId = _chunkE6XO2STSjs.asUserId; exports.deepEqual = _chunkE6XO2STSjs.deepEqual; exports.generateId = _chunkE6XO2STSjs.generateId; exports.generatePrefixedId = _chunkE6XO2STSjs.generatePrefixedId; exports.generateTemplateName = _chunkE6XO2STSjs.generateTemplateName; exports.indexBy = _chunkE6XO2STSjs.indexBy; exports.slugify = _chunkE6XO2STSjs.slugify;
|
package/dist/utils.mjs
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
asTenantId,
|
|
3
3
|
asUserId,
|
|
4
|
+
deepEqual,
|
|
4
5
|
generateId,
|
|
5
6
|
generatePrefixedId,
|
|
6
7
|
generateTemplateName,
|
|
7
8
|
indexBy,
|
|
8
9
|
slugify
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XAORXFAX.mjs";
|
|
10
11
|
import "./chunk-Y6FXYEAI.mjs";
|
|
11
12
|
export {
|
|
12
13
|
asTenantId,
|
|
13
14
|
asUserId,
|
|
15
|
+
deepEqual,
|
|
14
16
|
generateId,
|
|
15
17
|
generatePrefixedId,
|
|
16
18
|
generateTemplateName,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export {
|
|
2
|
+
export { aj as DEFAULT_VALIDATION_MESSAGES, ai as ValidationMessages, b3 as ValidationResult, aD as attributeConfigSchemas, ao as checkboxConfigSchema, bc as computeRecordStatus, b0 as createAttributeValidator, aK as createCheckboxValidator, aN as createCurrencyValidator, aL as createDateValidator, b7 as createDraftValidator, aS as createFileValidator, b1 as createFormAttributeValidator, aY as createFormulaValidator, aR as createLocationValidator, aV as createMultiRelationValidator, aQ as createMultiselectValidator, aJ as createNumberValidator, b2 as createObjectValidator, aM as createPhoneValidator, aX as createRatingValidator, aW as createRelationValidator, a$ as createRichtextValidator, aZ as createRollupValidator, aP as createSelectValidator, aU as createSingleRelationValidator, aO as createStatusValidator, a_ as createTextAreaValidator, aI as createTextValidator, aT as createUserValidator, ar as currencyConfigSchema, ap as dateConfigSchema, aC as documentConfigSchema, aw as fileConfigSchema, ah as formatZodErrors, aA as formulaConfigSchema, aE as getAttributeConfigSchema, ba as getMissingRequiredAttributes, bb as isRecordComplete, at as locationConfigSchema, av as multiselectConfigSchema, an as numberConfigSchema, aG as parseAttributeConfig, aq as phoneConfigSchema, az as ratingConfigSchema, ay as relationConfigSchema, am as richtextConfigSchema, aB as rollupConfigSchema, aH as safeParseAttributeConfig, au as selectConfigSchema, as as statusConfigSchema, ak as textConfigSchema, al as textareaConfigSchema, ax as userConfigSchema, b4 as validateAttribute, aF as validateAttributeConfig, b8 as validateDraft, b9 as validateDraftOrThrow, b5 as validateObject, b6 as validateObjectOrThrow } from '../validators-CJmtOk1a.mjs';
|
|
3
3
|
import '@stndrds/constants';
|
|
4
4
|
import '../utils.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'zod';
|
|
2
|
-
export {
|
|
2
|
+
export { aj as DEFAULT_VALIDATION_MESSAGES, ai as ValidationMessages, b3 as ValidationResult, aD as attributeConfigSchemas, ao as checkboxConfigSchema, bc as computeRecordStatus, b0 as createAttributeValidator, aK as createCheckboxValidator, aN as createCurrencyValidator, aL as createDateValidator, b7 as createDraftValidator, aS as createFileValidator, b1 as createFormAttributeValidator, aY as createFormulaValidator, aR as createLocationValidator, aV as createMultiRelationValidator, aQ as createMultiselectValidator, aJ as createNumberValidator, b2 as createObjectValidator, aM as createPhoneValidator, aX as createRatingValidator, aW as createRelationValidator, a$ as createRichtextValidator, aZ as createRollupValidator, aP as createSelectValidator, aU as createSingleRelationValidator, aO as createStatusValidator, a_ as createTextAreaValidator, aI as createTextValidator, aT as createUserValidator, ar as currencyConfigSchema, ap as dateConfigSchema, aC as documentConfigSchema, aw as fileConfigSchema, ah as formatZodErrors, aA as formulaConfigSchema, aE as getAttributeConfigSchema, ba as getMissingRequiredAttributes, bb as isRecordComplete, at as locationConfigSchema, av as multiselectConfigSchema, an as numberConfigSchema, aG as parseAttributeConfig, aq as phoneConfigSchema, az as ratingConfigSchema, ay as relationConfigSchema, am as richtextConfigSchema, aB as rollupConfigSchema, aH as safeParseAttributeConfig, au as selectConfigSchema, as as statusConfigSchema, ak as textConfigSchema, al as textareaConfigSchema, ax as userConfigSchema, b4 as validateAttribute, aF as validateAttributeConfig, b8 as validateDraft, b9 as validateDraftOrThrow, b5 as validateObject, b6 as validateObjectOrThrow } from '../validators-pv_b6bI_.js';
|
|
3
3
|
import '@stndrds/constants';
|
|
4
4
|
import '../utils.js';
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
var
|
|
60
|
+
var _chunkZW4N6FV7js = require('../chunk-ZW4N6FV7.js');
|
|
61
61
|
require('../chunk-3RG5ZIWI.js');
|
|
62
62
|
|
|
63
63
|
|
|
@@ -118,4 +118,4 @@ require('../chunk-3RG5ZIWI.js');
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
exports.DEFAULT_VALIDATION_MESSAGES =
|
|
121
|
+
exports.DEFAULT_VALIDATION_MESSAGES = _chunkZW4N6FV7js.DEFAULT_VALIDATION_MESSAGES; exports.attributeConfigSchemas = _chunkZW4N6FV7js.attributeConfigSchemas; exports.checkboxConfigSchema = _chunkZW4N6FV7js.checkboxConfigSchema; exports.computeRecordStatus = _chunkZW4N6FV7js.computeRecordStatus; exports.createAttributeValidator = _chunkZW4N6FV7js.createAttributeValidator; exports.createCheckboxValidator = _chunkZW4N6FV7js.createCheckboxValidator; exports.createCurrencyValidator = _chunkZW4N6FV7js.createCurrencyValidator; exports.createDateValidator = _chunkZW4N6FV7js.createDateValidator; exports.createDraftValidator = _chunkZW4N6FV7js.createDraftValidator; exports.createFileValidator = _chunkZW4N6FV7js.createFileValidator; exports.createFormAttributeValidator = _chunkZW4N6FV7js.createFormAttributeValidator; exports.createFormulaValidator = _chunkZW4N6FV7js.createFormulaValidator; exports.createLocationValidator = _chunkZW4N6FV7js.createLocationValidator; exports.createMultiRelationValidator = _chunkZW4N6FV7js.createMultiRelationValidator; exports.createMultiselectValidator = _chunkZW4N6FV7js.createMultiselectValidator; exports.createNumberValidator = _chunkZW4N6FV7js.createNumberValidator; exports.createObjectValidator = _chunkZW4N6FV7js.createObjectValidator; exports.createPhoneValidator = _chunkZW4N6FV7js.createPhoneValidator; exports.createRatingValidator = _chunkZW4N6FV7js.createRatingValidator; exports.createRelationValidator = _chunkZW4N6FV7js.createRelationValidator; exports.createRichtextValidator = _chunkZW4N6FV7js.createRichtextValidator; exports.createRollupValidator = _chunkZW4N6FV7js.createRollupValidator; exports.createSelectValidator = _chunkZW4N6FV7js.createSelectValidator; exports.createSingleRelationValidator = _chunkZW4N6FV7js.createSingleRelationValidator; exports.createStatusValidator = _chunkZW4N6FV7js.createStatusValidator; exports.createTextAreaValidator = _chunkZW4N6FV7js.createTextAreaValidator; exports.createTextValidator = _chunkZW4N6FV7js.createTextValidator; exports.createUserValidator = _chunkZW4N6FV7js.createUserValidator; exports.currencyConfigSchema = _chunkZW4N6FV7js.currencyConfigSchema; exports.dateConfigSchema = _chunkZW4N6FV7js.dateConfigSchema; exports.documentConfigSchema = _chunkZW4N6FV7js.documentConfigSchema; exports.fileConfigSchema = _chunkZW4N6FV7js.fileConfigSchema; exports.formatZodErrors = _chunkZW4N6FV7js.formatZodErrors; exports.formulaConfigSchema = _chunkZW4N6FV7js.formulaConfigSchema; exports.getAttributeConfigSchema = _chunkZW4N6FV7js.getAttributeConfigSchema; exports.getMissingRequiredAttributes = _chunkZW4N6FV7js.getMissingRequiredAttributes; exports.isRecordComplete = _chunkZW4N6FV7js.isRecordComplete; exports.locationConfigSchema = _chunkZW4N6FV7js.locationConfigSchema; exports.multiselectConfigSchema = _chunkZW4N6FV7js.multiselectConfigSchema; exports.numberConfigSchema = _chunkZW4N6FV7js.numberConfigSchema; exports.parseAttributeConfig = _chunkZW4N6FV7js.parseAttributeConfig; exports.phoneConfigSchema = _chunkZW4N6FV7js.phoneConfigSchema; exports.ratingConfigSchema = _chunkZW4N6FV7js.ratingConfigSchema; exports.relationConfigSchema = _chunkZW4N6FV7js.relationConfigSchema; exports.richtextConfigSchema = _chunkZW4N6FV7js.richtextConfigSchema; exports.rollupConfigSchema = _chunkZW4N6FV7js.rollupConfigSchema; exports.safeParseAttributeConfig = _chunkZW4N6FV7js.safeParseAttributeConfig; exports.selectConfigSchema = _chunkZW4N6FV7js.selectConfigSchema; exports.statusConfigSchema = _chunkZW4N6FV7js.statusConfigSchema; exports.textConfigSchema = _chunkZW4N6FV7js.textConfigSchema; exports.textareaConfigSchema = _chunkZW4N6FV7js.textareaConfigSchema; exports.userConfigSchema = _chunkZW4N6FV7js.userConfigSchema; exports.validateAttribute = _chunkZW4N6FV7js.validateAttribute; exports.validateAttributeConfig = _chunkZW4N6FV7js.validateAttributeConfig; exports.validateDraft = _chunkZW4N6FV7js.validateDraft; exports.validateDraftOrThrow = _chunkZW4N6FV7js.validateDraftOrThrow; exports.validateObject = _chunkZW4N6FV7js.validateObject; exports.validateObjectOrThrow = _chunkZW4N6FV7js.validateObjectOrThrow;
|
|
@@ -190,6 +190,29 @@ type PropertyAttribute = TextAttribute | TextAreaAttribute | NumberAttribute | C
|
|
|
190
190
|
interface PropertySchema {
|
|
191
191
|
definitions: PropertyAttribute[];
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Property attribute types that have an `options` array.
|
|
195
|
+
*/
|
|
196
|
+
type OptionPropertyAttribute = SelectAttribute | StatusAttribute | MultiselectAttribute;
|
|
197
|
+
/**
|
|
198
|
+
* Type guard to check if a property attribute has options.
|
|
199
|
+
*
|
|
200
|
+
* @param attr - The property attribute to check
|
|
201
|
+
* @returns true if the attribute is a select, status, or multiselect type with options
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* for (const def of definitions) {
|
|
206
|
+
* if (hasOptions(def)) {
|
|
207
|
+
* // TypeScript knows def.options exists and is Option[]
|
|
208
|
+
* for (const option of def.options) {
|
|
209
|
+
* console.log(option.value);
|
|
210
|
+
* }
|
|
211
|
+
* }
|
|
212
|
+
* }
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
declare function hasOptions(attr: PropertyAttribute): attr is OptionPropertyAttribute;
|
|
193
216
|
|
|
194
217
|
type AttributeType = "text" | "textarea" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "file" | "user" | "relation" | "rating" | "formula" | "rollup" | "document";
|
|
195
218
|
/**
|
|
@@ -207,6 +230,8 @@ interface Option {
|
|
|
207
230
|
icon?: IconName;
|
|
208
231
|
description?: string;
|
|
209
232
|
group?: StatusGroup;
|
|
233
|
+
/** Value of the inverse option for bilateral relations (e.g. "parent" → "child") */
|
|
234
|
+
inverse?: string;
|
|
210
235
|
}
|
|
211
236
|
/**
|
|
212
237
|
* Attribute grouping for UI organization
|
|
@@ -1026,6 +1051,7 @@ declare const statusConfigSchema: z.ZodObject<{
|
|
|
1026
1051
|
idle: "idle";
|
|
1027
1052
|
finished: "finished";
|
|
1028
1053
|
}>>;
|
|
1054
|
+
inverse: z.ZodOptional<z.ZodString>;
|
|
1029
1055
|
}, z.core.$strip>>;
|
|
1030
1056
|
}, z.core.$strip>;
|
|
1031
1057
|
/**
|
|
@@ -1086,6 +1112,7 @@ declare const selectConfigSchema: z.ZodObject<{
|
|
|
1086
1112
|
idle: "idle";
|
|
1087
1113
|
finished: "finished";
|
|
1088
1114
|
}>>;
|
|
1115
|
+
inverse: z.ZodOptional<z.ZodString>;
|
|
1089
1116
|
}, z.core.$strip>>;
|
|
1090
1117
|
}, z.core.$strip>;
|
|
1091
1118
|
/**
|
|
@@ -1114,6 +1141,7 @@ declare const multiselectConfigSchema: z.ZodObject<{
|
|
|
1114
1141
|
idle: "idle";
|
|
1115
1142
|
finished: "finished";
|
|
1116
1143
|
}>>;
|
|
1144
|
+
inverse: z.ZodOptional<z.ZodString>;
|
|
1117
1145
|
}, z.core.$strip>>;
|
|
1118
1146
|
}, z.core.$strip>;
|
|
1119
1147
|
/**
|
|
@@ -1563,4 +1591,4 @@ declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<stri
|
|
|
1563
1591
|
*/
|
|
1564
1592
|
declare function computeRecordStatus(objectDef: ObjectDefinition, data: Record<string, unknown>): CompletionStatus;
|
|
1565
1593
|
|
|
1566
|
-
export { type FlagOverride as $, type Attribute as A, type BilateralConfig as B, type CheckboxAttribute as C, type DateAttribute as D, type BaseAttribute as E, type FeatureGate as F, type NumberUnit as G, type DateFormat as H, type DateValue as I, type Currency as J, type Location as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type Option as O, type Phone as P, type LocationGranularity as Q, type RichtextAttribute as R, type StatusAttribute as S, type TextAttribute as T, type UserAttribute as U, RELATION_TARGET_ANY as V, isUniversalRelation as W, isBilateralRelation as X, inferInverseCardinality as Y, NON_SORTABLE_TYPES as Z, isAttributeSortable as _, type DocumentAttribute as a,
|
|
1594
|
+
export { type FlagOverride as $, type Attribute as A, type BilateralConfig as B, type CheckboxAttribute as C, type DateAttribute as D, type BaseAttribute as E, type FeatureGate as F, type NumberUnit as G, type DateFormat as H, type DateValue as I, type Currency as J, type Location as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type Option as O, type Phone as P, type LocationGranularity as Q, type RichtextAttribute as R, type StatusAttribute as S, type TextAttribute as T, type UserAttribute as U, RELATION_TARGET_ANY as V, isUniversalRelation as W, isBilateralRelation as X, inferInverseCardinality as Y, NON_SORTABLE_TYPES as Z, isAttributeSortable as _, type DocumentAttribute as a, createRichtextValidator as a$, type FeatureFlagsConfig as a0, RESERVED_ATTRIBUTE_NAMES as a1, SYSTEM_FIELD_NAMES as a2, type ReservedAttributeName as a3, type SystemFieldName as a4, type Timestamps as a5, type SharingMode as a6, type ObjectAttribute as a7, type CompletionStatus as a8, type ObjectRecord as a9, formulaConfigSchema as aA, rollupConfigSchema as aB, documentConfigSchema as aC, attributeConfigSchemas as aD, getAttributeConfigSchema as aE, validateAttributeConfig as aF, parseAttributeConfig as aG, safeParseAttributeConfig as aH, createTextValidator as aI, createNumberValidator as aJ, createCheckboxValidator as aK, createDateValidator as aL, createPhoneValidator as aM, createCurrencyValidator as aN, createStatusValidator as aO, createSelectValidator as aP, createMultiselectValidator as aQ, createLocationValidator as aR, createFileValidator as aS, createUserValidator as aT, createSingleRelationValidator as aU, createMultiRelationValidator as aV, createRelationValidator as aW, createRatingValidator as aX, createFormulaValidator as aY, createRollupValidator as aZ, createTextAreaValidator as a_, type PropertyType as aa, FORBIDDEN_PROPERTY_TYPES as ab, type ForbiddenPropertyType as ac, type PropertyAttribute as ad, type PropertySchema as ae, type OptionPropertyAttribute as af, hasOptions as ag, formatZodErrors as ah, type ValidationMessages as ai, DEFAULT_VALIDATION_MESSAGES as aj, textConfigSchema as ak, textareaConfigSchema as al, richtextConfigSchema as am, numberConfigSchema as an, checkboxConfigSchema as ao, dateConfigSchema as ap, phoneConfigSchema as aq, currencyConfigSchema as ar, statusConfigSchema as as, locationConfigSchema as at, selectConfigSchema as au, multiselectConfigSchema as av, fileConfigSchema as aw, userConfigSchema as ax, relationConfigSchema as ay, ratingConfigSchema as az, type TextAreaAttribute as b, createAttributeValidator as b0, createFormAttributeValidator as b1, createObjectValidator as b2, type ValidationResult as b3, validateAttribute as b4, validateObject as b5, validateObjectOrThrow as b6, createDraftValidator as b7, validateDraft as b8, validateDraftOrThrow as b9, getMissingRequiredAttributes as ba, isRecordComplete as bb, computeRecordStatus as bc, type RichtextFeature as c, type PhoneAttribute as d, type CurrencyAttribute as e, type SelectAttribute as f, type FileAttribute as g, type RatingAttribute as h, type RelationAttribute as i, type SingleRelationAttribute as j, type MultiRelationAttribute as k, type RelationTarget as l, type FormulaAttribute as m, type FormulaReturnType as n, type RollupAttribute as o, type RollupFunction as p, type AttributeType as q, type ObjectDefinition as r, type FlagValueType as s, type FeatureFlagDefinition as t, type FlagLevel as u, type FeatureFlagsRepository as v, type StaticFlagDefault as w, type ResolvedFlag as x, type StatusGroup as y, type AttributeGroup as z };
|
|
@@ -190,6 +190,29 @@ type PropertyAttribute = TextAttribute | TextAreaAttribute | NumberAttribute | C
|
|
|
190
190
|
interface PropertySchema {
|
|
191
191
|
definitions: PropertyAttribute[];
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Property attribute types that have an `options` array.
|
|
195
|
+
*/
|
|
196
|
+
type OptionPropertyAttribute = SelectAttribute | StatusAttribute | MultiselectAttribute;
|
|
197
|
+
/**
|
|
198
|
+
* Type guard to check if a property attribute has options.
|
|
199
|
+
*
|
|
200
|
+
* @param attr - The property attribute to check
|
|
201
|
+
* @returns true if the attribute is a select, status, or multiselect type with options
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* for (const def of definitions) {
|
|
206
|
+
* if (hasOptions(def)) {
|
|
207
|
+
* // TypeScript knows def.options exists and is Option[]
|
|
208
|
+
* for (const option of def.options) {
|
|
209
|
+
* console.log(option.value);
|
|
210
|
+
* }
|
|
211
|
+
* }
|
|
212
|
+
* }
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
declare function hasOptions(attr: PropertyAttribute): attr is OptionPropertyAttribute;
|
|
193
216
|
|
|
194
217
|
type AttributeType = "text" | "textarea" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "file" | "user" | "relation" | "rating" | "formula" | "rollup" | "document";
|
|
195
218
|
/**
|
|
@@ -207,6 +230,8 @@ interface Option {
|
|
|
207
230
|
icon?: IconName;
|
|
208
231
|
description?: string;
|
|
209
232
|
group?: StatusGroup;
|
|
233
|
+
/** Value of the inverse option for bilateral relations (e.g. "parent" → "child") */
|
|
234
|
+
inverse?: string;
|
|
210
235
|
}
|
|
211
236
|
/**
|
|
212
237
|
* Attribute grouping for UI organization
|
|
@@ -1026,6 +1051,7 @@ declare const statusConfigSchema: z.ZodObject<{
|
|
|
1026
1051
|
idle: "idle";
|
|
1027
1052
|
finished: "finished";
|
|
1028
1053
|
}>>;
|
|
1054
|
+
inverse: z.ZodOptional<z.ZodString>;
|
|
1029
1055
|
}, z.core.$strip>>;
|
|
1030
1056
|
}, z.core.$strip>;
|
|
1031
1057
|
/**
|
|
@@ -1086,6 +1112,7 @@ declare const selectConfigSchema: z.ZodObject<{
|
|
|
1086
1112
|
idle: "idle";
|
|
1087
1113
|
finished: "finished";
|
|
1088
1114
|
}>>;
|
|
1115
|
+
inverse: z.ZodOptional<z.ZodString>;
|
|
1089
1116
|
}, z.core.$strip>>;
|
|
1090
1117
|
}, z.core.$strip>;
|
|
1091
1118
|
/**
|
|
@@ -1114,6 +1141,7 @@ declare const multiselectConfigSchema: z.ZodObject<{
|
|
|
1114
1141
|
idle: "idle";
|
|
1115
1142
|
finished: "finished";
|
|
1116
1143
|
}>>;
|
|
1144
|
+
inverse: z.ZodOptional<z.ZodString>;
|
|
1117
1145
|
}, z.core.$strip>>;
|
|
1118
1146
|
}, z.core.$strip>;
|
|
1119
1147
|
/**
|
|
@@ -1563,4 +1591,4 @@ declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<stri
|
|
|
1563
1591
|
*/
|
|
1564
1592
|
declare function computeRecordStatus(objectDef: ObjectDefinition, data: Record<string, unknown>): CompletionStatus;
|
|
1565
1593
|
|
|
1566
|
-
export { type FlagOverride as $, type Attribute as A, type BilateralConfig as B, type CheckboxAttribute as C, type DateAttribute as D, type BaseAttribute as E, type FeatureGate as F, type NumberUnit as G, type DateFormat as H, type DateValue as I, type Currency as J, type Location as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type Option as O, type Phone as P, type LocationGranularity as Q, type RichtextAttribute as R, type StatusAttribute as S, type TextAttribute as T, type UserAttribute as U, RELATION_TARGET_ANY as V, isUniversalRelation as W, isBilateralRelation as X, inferInverseCardinality as Y, NON_SORTABLE_TYPES as Z, isAttributeSortable as _, type DocumentAttribute as a,
|
|
1594
|
+
export { type FlagOverride as $, type Attribute as A, type BilateralConfig as B, type CheckboxAttribute as C, type DateAttribute as D, type BaseAttribute as E, type FeatureGate as F, type NumberUnit as G, type DateFormat as H, type DateValue as I, type Currency as J, type Location as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type Option as O, type Phone as P, type LocationGranularity as Q, type RichtextAttribute as R, type StatusAttribute as S, type TextAttribute as T, type UserAttribute as U, RELATION_TARGET_ANY as V, isUniversalRelation as W, isBilateralRelation as X, inferInverseCardinality as Y, NON_SORTABLE_TYPES as Z, isAttributeSortable as _, type DocumentAttribute as a, createRichtextValidator as a$, type FeatureFlagsConfig as a0, RESERVED_ATTRIBUTE_NAMES as a1, SYSTEM_FIELD_NAMES as a2, type ReservedAttributeName as a3, type SystemFieldName as a4, type Timestamps as a5, type SharingMode as a6, type ObjectAttribute as a7, type CompletionStatus as a8, type ObjectRecord as a9, formulaConfigSchema as aA, rollupConfigSchema as aB, documentConfigSchema as aC, attributeConfigSchemas as aD, getAttributeConfigSchema as aE, validateAttributeConfig as aF, parseAttributeConfig as aG, safeParseAttributeConfig as aH, createTextValidator as aI, createNumberValidator as aJ, createCheckboxValidator as aK, createDateValidator as aL, createPhoneValidator as aM, createCurrencyValidator as aN, createStatusValidator as aO, createSelectValidator as aP, createMultiselectValidator as aQ, createLocationValidator as aR, createFileValidator as aS, createUserValidator as aT, createSingleRelationValidator as aU, createMultiRelationValidator as aV, createRelationValidator as aW, createRatingValidator as aX, createFormulaValidator as aY, createRollupValidator as aZ, createTextAreaValidator as a_, type PropertyType as aa, FORBIDDEN_PROPERTY_TYPES as ab, type ForbiddenPropertyType as ac, type PropertyAttribute as ad, type PropertySchema as ae, type OptionPropertyAttribute as af, hasOptions as ag, formatZodErrors as ah, type ValidationMessages as ai, DEFAULT_VALIDATION_MESSAGES as aj, textConfigSchema as ak, textareaConfigSchema as al, richtextConfigSchema as am, numberConfigSchema as an, checkboxConfigSchema as ao, dateConfigSchema as ap, phoneConfigSchema as aq, currencyConfigSchema as ar, statusConfigSchema as as, locationConfigSchema as at, selectConfigSchema as au, multiselectConfigSchema as av, fileConfigSchema as aw, userConfigSchema as ax, relationConfigSchema as ay, ratingConfigSchema as az, type TextAreaAttribute as b, createAttributeValidator as b0, createFormAttributeValidator as b1, createObjectValidator as b2, type ValidationResult as b3, validateAttribute as b4, validateObject as b5, validateObjectOrThrow as b6, createDraftValidator as b7, validateDraft as b8, validateDraftOrThrow as b9, getMissingRequiredAttributes as ba, isRecordComplete as bb, computeRecordStatus as bc, type RichtextFeature as c, type PhoneAttribute as d, type CurrencyAttribute as e, type SelectAttribute as f, type FileAttribute as g, type RatingAttribute as h, type RelationAttribute as i, type SingleRelationAttribute as j, type MultiRelationAttribute as k, type RelationTarget as l, type FormulaAttribute as m, type FormulaReturnType as n, type RollupAttribute as o, type RollupFunction as p, type AttributeType as q, type ObjectDefinition as r, type FlagValueType as s, type FeatureFlagDefinition as t, type FlagLevel as u, type FeatureFlagsRepository as v, type StaticFlagDefault as w, type ResolvedFlag as x, type StatusGroup as y, type AttributeGroup as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stndrds/schema",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.85",
|
|
4
4
|
"description": "Standard schema definitions and utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"libphonenumber-js": "^1.12.31",
|
|
37
37
|
"pdf-lib": "^1.17.1",
|
|
38
38
|
"zod": "^4.2.1",
|
|
39
|
-
"@stndrds/constants": "1.0.0-alpha.
|
|
39
|
+
"@stndrds/constants": "1.0.0-alpha.85"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^25.0.3",
|