@stndrds/schema 0.1.0-alpha.57 → 0.1.0-alpha.59

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/index.mjs CHANGED
@@ -5,8 +5,10 @@ import {
5
5
  AuditService,
6
6
  AuthMethodSchema,
7
7
  BEHAVIOR_PROPERTIES,
8
+ BasePropertyBuilder,
8
9
  BaseRepository,
9
10
  BaseService,
11
+ CheckboxPropertyBuilder,
10
12
  ConcurrentModificationError,
11
13
  ConditionExecutor,
12
14
  ConditionGroupSchema,
@@ -14,11 +16,12 @@ import {
14
16
  ConditionOperatorSchema,
15
17
  ConditionRuleSchema,
16
18
  CreateShareInputSchema,
19
+ CurrencyPropertyBuilder,
17
20
  CustomTabConfig,
18
21
  DEFAULT_LABEL_FALLBACK,
19
22
  DEFAULT_THEME,
20
- DEFAULT_VALIDATION_MESSAGES,
21
23
  DRIVING_LICENSE,
24
+ DatePropertyBuilder,
22
25
  DetailViewBuilder,
23
26
  DirectTableTabConfig,
24
27
  DocumentExecutor,
@@ -38,6 +41,7 @@ import {
38
41
  EndExecutor,
39
42
  EndNodeSchema,
40
43
  ExecutorRegistry,
44
+ FORBIDDEN_PROPERTY_TYPES,
41
45
  FRENCH_ID_CARD,
42
46
  FeatureFlagsContextError,
43
47
  FileNotFoundError,
@@ -66,7 +70,9 @@ import {
66
70
  InvitationRevokedError,
67
71
  ListViewBuilder,
68
72
  ListViewTabConfigBuilder,
73
+ LocationPropertyBuilder,
69
74
  MaxDepthExceededError,
75
+ MultiselectPropertyBuilder,
70
76
  NodePositionSchema,
71
77
  NoopCacheAdapter,
72
78
  NoopGeocodingAdapter,
@@ -74,6 +80,7 @@ import {
74
80
  NotFoundError,
75
81
  NotSystemObjectError,
76
82
  NotesTabConfig,
83
+ NumberPropertyBuilder,
77
84
  ObjectBuilder,
78
85
  ObjectNotFoundError,
79
86
  ObjectReferencedError,
@@ -82,8 +89,11 @@ import {
82
89
  PRESENTATION_PROPERTIES,
83
90
  PROOF_OF_ADDRESS,
84
91
  PermissionService,
92
+ PhonePropertyBuilder,
85
93
  PolicyRegistry,
86
94
  PolicyViolationError,
95
+ PropertySchemaBuilder,
96
+ PropertyTypeBuilder,
87
97
  ProtectedResourceError,
88
98
  ProtectedRoleError,
89
99
  QueryBuilder,
@@ -91,11 +101,13 @@ import {
91
101
  QueryNoResultError,
92
102
  RELATION_TARGET_ANY,
93
103
  RESERVED_ATTRIBUTE_NAMES,
104
+ RatingPropertyBuilder,
94
105
  RecordNotFoundError,
95
106
  RecordQueryService,
96
107
  RecordReferencedError,
97
108
  RecordResolverService,
98
109
  RecordService,
110
+ RelationPropertiesService,
99
111
  RelationService,
100
112
  RoleNotFoundError,
101
113
  RollupScheduler,
@@ -109,14 +121,18 @@ import {
109
121
  SchemaContextAwareRepository,
110
122
  SchemaError,
111
123
  SchemaErrorCode,
124
+ SelectPropertyBuilder,
112
125
  ShareStatusSchema,
113
126
  SlotModeSchema,
114
127
  StartExecutor,
115
128
  StartNodeSchema,
129
+ StatusPropertyBuilder,
116
130
  StorageDownloadNotSupportedError,
117
131
  SyncError,
118
132
  TabBuilder,
119
133
  TenantContextError,
134
+ TextPropertyBuilder,
135
+ TextareaPropertyBuilder,
120
136
  ThemeColorsSchema,
121
137
  ThemeLogoSchema,
122
138
  TokenRevokedError,
@@ -151,9 +167,6 @@ import {
151
167
  addSchemaToContext,
152
168
  and,
153
169
  applyDefaultValues,
154
- asTenantId,
155
- asUserId,
156
- attributeConfigSchemas,
157
170
  buildAuditChanges,
158
171
  buildPolicyContext,
159
172
  cacheKeys,
@@ -166,54 +179,25 @@ import {
166
179
  checkRecordModifyOrThrow,
167
180
  checkSharedObjectWriteAccess,
168
181
  checkbox,
169
- checkboxConfigSchema,
170
182
  complete,
171
183
  computeLabel,
172
184
  computeLabelWithRelations,
173
- computeRecordStatus,
174
- createAttributeValidator,
175
- createCheckboxValidator,
176
185
  createContextForCreate,
177
186
  createContextForDelete,
178
187
  createContextForRestore,
179
188
  createContextForUpdate,
180
- createCurrencyValidator,
181
- createDateValidator,
182
189
  createDefaultExecutorRegistry,
183
190
  createDefaultState,
184
- createDraftValidator,
185
191
  createEmptyContext,
186
- createFileValidator,
187
- createFormAttributeValidator,
188
- createFormulaValidator,
189
- createLocationValidator,
190
192
  createMockAdapter,
191
- createMultiRelationValidator,
192
- createMultiselectValidator,
193
- createNumberValidator,
194
- createObjectValidator,
195
- createPhoneValidator,
196
193
  createQueryBuilder,
197
- createRatingValidator,
198
- createRelationValidator,
199
- createRichtextValidator,
200
- createRollupValidator,
201
- createSelectValidator,
202
- createSingleRelationValidator,
203
194
  createStartTransition,
204
- createStatusValidator,
205
- createTextAreaValidator,
206
- createTextValidator,
207
- createUserValidator,
208
195
  currency,
209
- currencyConfigSchema,
210
196
  date,
211
- dateConfigSchema,
212
197
  defaultPolicyRegistry,
213
198
  defaultTtl,
214
199
  detailView,
215
200
  document,
216
- documentConfigSchema,
217
201
  enrichRecordsWithFormulas,
218
202
  enrichValuesForDisplay,
219
203
  enrichValuesWithSelectLabels,
@@ -234,30 +218,21 @@ import {
234
218
  extractRelationNames,
235
219
  extractRelationReferences,
236
220
  file,
237
- fileConfigSchema,
238
- filterPropertiesByCategory,
239
221
  flattenRelationsForEval,
240
222
  formatAttributeValue,
241
223
  formatFormulaResult,
242
224
  formatRecord,
243
225
  formatRecords,
244
226
  formula,
245
- formulaConfigSchema,
246
227
  generateCssVariables,
247
- generateId,
248
- generatePrefixedId,
249
- generateTemplateName,
250
- getAttributeConfigSchema,
251
228
  getContext,
252
229
  getContextValue,
253
230
  getDefaultExecutorRegistry,
254
231
  getFeatureFlags,
255
232
  getFeatureValue,
256
- getMissingRequiredAttributes,
257
233
  getNodeOutputs,
258
234
  getPathDepth,
259
235
  getPolicy,
260
- getPropertyProtectionLevel,
261
236
  getRelationPath,
262
237
  getSchemaByNameFromContext,
263
238
  getSchemaContext,
@@ -273,13 +248,13 @@ import {
273
248
  group,
274
249
  hasContext,
275
250
  hasFeatureFlagsContext,
251
+ hasProperties,
276
252
  hasRelationReferences,
277
253
  hasSchemaContext,
278
254
  hashOptions,
279
255
  inValues,
280
256
  isAdvancedFormNode,
281
257
  isBehaviorProperty,
282
- isConcurrentModificationError,
283
258
  isConditionGroup,
284
259
  isConditionNode,
285
260
  isConditionRule,
@@ -306,7 +281,6 @@ import {
306
281
  isNotFoundError,
307
282
  isPresentationProperty,
308
283
  isProtectedResourceError,
309
- isRecordComplete,
310
284
  isSchemaError,
311
285
  isSimpleFormNode,
312
286
  isStartNode,
@@ -321,67 +295,46 @@ import {
321
295
  isWorkflowPublished,
322
296
  listView,
323
297
  location,
324
- locationConfigSchema,
325
- mergeFormToSlot,
326
298
  mergeWithDefaults,
327
299
  multiselect,
328
- multiselectConfigSchema,
329
300
  neq,
330
301
  notesPolicy,
331
302
  number,
332
- numberConfigSchema,
333
303
  object,
334
304
  or,
335
- parseAttributeConfig,
336
305
  parsePath,
337
306
  pathHasManyCardinality,
338
307
  phone,
339
- phoneConfigSchema,
340
308
  rating,
341
- ratingConfigSchema,
342
309
  recalculateParentRollups,
343
310
  registry,
344
311
  relation,
345
- relationConfigSchema,
346
312
  renderLabelExpression,
347
313
  resolveMultiplePaths,
348
314
  resolveSingleValue,
349
315
  richtext,
350
- richtextConfigSchema,
351
316
  rollup,
352
- rollupConfigSchema,
353
317
  runWithContext,
354
318
  runWithFeatureFlags,
355
319
  runWithMergedSchemaContext,
356
320
  runWithSchemaContext,
357
- safeParseAttributeConfig,
358
321
  seedRegistryViews,
359
322
  select,
360
- selectConfigSchema,
361
323
  setContextValue,
362
- slugify,
363
324
  status,
364
- statusConfigSchema,
365
325
  success,
366
326
  syncAll,
367
327
  syncNativeObjects,
368
328
  syncNativeViews,
369
329
  text,
370
- textConfigSchema,
371
330
  textarea,
372
- textareaConfigSchema,
331
+ toUndefinedIfEmpty,
373
332
  traversePath,
374
333
  tryGetFeatureValue,
375
334
  user,
376
- userConfigSchema,
377
- validateAttribute,
378
- validateAttributeConfig,
379
- validateDraft,
380
- validateDraftOrThrow,
381
335
  validateFormulaExpression,
382
- validateObject,
383
- validateObjectOrThrow,
384
336
  validatePath,
337
+ validatePropertyType,
385
338
  verifyNativeObjectsSync,
386
339
  verifyNativeViewsSync,
387
340
  verifyRegistryViewsSeeded,
@@ -390,7 +343,76 @@ import {
390
343
  withFeatureFlags,
391
344
  withTenantContext,
392
345
  workflow
393
- } from "./chunk-YVUSATKC.mjs";
346
+ } from "./chunk-O7FGYLYG.mjs";
347
+ import {
348
+ asTenantId,
349
+ asUserId,
350
+ generateId,
351
+ generatePrefixedId,
352
+ generateTemplateName,
353
+ indexBy,
354
+ slugify
355
+ } from "./chunk-V2RPPE2Y.mjs";
356
+ import {
357
+ DEFAULT_VALIDATION_MESSAGES,
358
+ attributeConfigSchemas,
359
+ checkboxConfigSchema,
360
+ computeRecordStatus,
361
+ createAttributeValidator,
362
+ createCheckboxValidator,
363
+ createCurrencyValidator,
364
+ createDateValidator,
365
+ createDraftValidator,
366
+ createFileValidator,
367
+ createFormAttributeValidator,
368
+ createFormulaValidator,
369
+ createLocationValidator,
370
+ createMultiRelationValidator,
371
+ createMultiselectValidator,
372
+ createNumberValidator,
373
+ createObjectValidator,
374
+ createPhoneValidator,
375
+ createRatingValidator,
376
+ createRelationValidator,
377
+ createRichtextValidator,
378
+ createRollupValidator,
379
+ createSelectValidator,
380
+ createSingleRelationValidator,
381
+ createStatusValidator,
382
+ createTextAreaValidator,
383
+ createTextValidator,
384
+ createUserValidator,
385
+ currencyConfigSchema,
386
+ dateConfigSchema,
387
+ documentConfigSchema,
388
+ fileConfigSchema,
389
+ formatZodErrors,
390
+ formulaConfigSchema,
391
+ getAttributeConfigSchema,
392
+ getMissingRequiredAttributes,
393
+ isRecordComplete,
394
+ locationConfigSchema,
395
+ multiselectConfigSchema,
396
+ numberConfigSchema,
397
+ parseAttributeConfig,
398
+ phoneConfigSchema,
399
+ ratingConfigSchema,
400
+ relationConfigSchema,
401
+ richtextConfigSchema,
402
+ rollupConfigSchema,
403
+ safeParseAttributeConfig,
404
+ selectConfigSchema,
405
+ statusConfigSchema,
406
+ textConfigSchema,
407
+ textareaConfigSchema,
408
+ userConfigSchema,
409
+ validateAttribute,
410
+ validateAttributeConfig,
411
+ validateDraft,
412
+ validateDraftOrThrow,
413
+ validateObject,
414
+ validateObjectOrThrow
415
+ } from "./chunk-SV4BCGQU.mjs";
394
416
  import {
395
417
  ALL_SYSTEM_RESOURCES,
396
418
  DEFAULT_ROLES,
@@ -403,43 +425,7 @@ import {
403
425
  } from "./chunk-V5QXU2OK.mjs";
404
426
  import "./chunk-Y6FXYEAI.mjs";
405
427
 
406
- // src/types/document-generation.ts
407
- function isPdfTemplateSource(source) {
408
- return source.type === "pdf";
409
- }
410
- function isDocxTemplateSource(source) {
411
- return source.type === "docx";
412
- }
413
-
414
428
  // src/types/filters.ts
415
- function isAdvancedFilterState(state) {
416
- return "groups" in state;
417
- }
418
- function toAdvancedFilterState(state) {
419
- if (state.rules.length === 0) {
420
- return {
421
- combinator: state.combinator,
422
- groups: []
423
- };
424
- }
425
- return {
426
- combinator: "and",
427
- groups: [
428
- {
429
- id: crypto.randomUUID(),
430
- combinator: state.combinator,
431
- rules: state.rules
432
- }
433
- ]
434
- };
435
- }
436
- function toSimpleFilterState(state) {
437
- const allRules = state.groups.flatMap((group2) => group2.rules);
438
- return {
439
- combinator: state.combinator,
440
- rules: allRules
441
- };
442
- }
443
429
  var OPERATORS_BY_TYPE = {
444
430
  text: [
445
431
  "is",
@@ -1390,57 +1376,6 @@ function generateFallbackView(object2, type, options = {}) {
1390
1376
  throw new Error(`Fallback generation not supported for view type: ${type}`);
1391
1377
  }
1392
1378
  }
1393
- function generateModalDetailView(object2, attributeNames) {
1394
- const excludeAttributes = attributeNames ? object2.attributes.filter((attr) => !attributeNames.includes(attr.name)).map((attr) => attr.name) : [];
1395
- const visibleAttrs = getVisibleAttributes(object2.attributes, excludeAttributes);
1396
- const sortedAttrs = sortAttributes(visibleAttrs);
1397
- const formTab = {
1398
- id: "form",
1399
- name: "form",
1400
- label: "Details",
1401
- type: "form",
1402
- groups: [
1403
- {
1404
- id: "general",
1405
- label: "General",
1406
- fields: sortedAttrs.map(attributeToField),
1407
- order: 0
1408
- }
1409
- ],
1410
- order: 0
1411
- };
1412
- const config = {
1413
- layout: "modal",
1414
- tabs: [formTab]
1415
- };
1416
- return {
1417
- name: "default-modal",
1418
- label: "Default Modal View",
1419
- object: object2.name,
1420
- type: "detail",
1421
- config,
1422
- default: true
1423
- };
1424
- }
1425
- function generateKanbanListView(object2, groupByAttribute, options = {}) {
1426
- const { excludeAttributes = [], maxListColumns = 5 } = options;
1427
- const visibleAttrs = getVisibleAttributes(object2.attributes, excludeAttributes);
1428
- const sortedAttrs = sortAttributes(visibleAttrs);
1429
- const columns = sortedAttrs.filter((attr) => attr.name !== groupByAttribute).slice(0, maxListColumns).map((attr) => attr.name);
1430
- const config = {
1431
- layout: "kanban",
1432
- columns,
1433
- groupByAttribute
1434
- };
1435
- return {
1436
- name: "kanban",
1437
- label: "Kanban View",
1438
- object: object2.name,
1439
- type: "list",
1440
- config,
1441
- default: false
1442
- };
1443
- }
1444
1379
 
1445
1380
  // src/views/view-reset.ts
1446
1381
  function getPreservedDetailTabs(view2, options) {
@@ -1583,8 +1518,10 @@ export {
1583
1518
  AuditService,
1584
1519
  AuthMethodSchema,
1585
1520
  BEHAVIOR_PROPERTIES,
1521
+ BasePropertyBuilder,
1586
1522
  BaseRepository,
1587
1523
  BaseService,
1524
+ CheckboxPropertyBuilder,
1588
1525
  ConcurrentModificationError,
1589
1526
  ConditionExecutor,
1590
1527
  ConditionGroupSchema,
@@ -1592,6 +1529,7 @@ export {
1592
1529
  ConditionOperatorSchema,
1593
1530
  ConditionRuleSchema,
1594
1531
  CreateShareInputSchema,
1532
+ CurrencyPropertyBuilder,
1595
1533
  CustomTabConfig,
1596
1534
  DEFAULT_LABEL_FALLBACK,
1597
1535
  DEFAULT_ROLES,
@@ -1601,6 +1539,7 @@ export {
1601
1539
  DEFAULT_THEME,
1602
1540
  DEFAULT_VALIDATION_MESSAGES,
1603
1541
  DRIVING_LICENSE,
1542
+ DatePropertyBuilder,
1604
1543
  DetailViewBuilder,
1605
1544
  DirectTableTabConfig,
1606
1545
  DocumentExecutor,
@@ -1620,6 +1559,7 @@ export {
1620
1559
  EndExecutor,
1621
1560
  EndNodeSchema,
1622
1561
  ExecutorRegistry,
1562
+ FORBIDDEN_PROPERTY_TYPES,
1623
1563
  FRENCH_ID_CARD,
1624
1564
  FeatureFlagsContextError,
1625
1565
  FileNotFoundError,
@@ -1650,7 +1590,9 @@ export {
1650
1590
  InvitationRevokedError,
1651
1591
  ListViewBuilder,
1652
1592
  ListViewTabConfigBuilder,
1593
+ LocationPropertyBuilder,
1653
1594
  MaxDepthExceededError,
1595
+ MultiselectPropertyBuilder,
1654
1596
  NOTES,
1655
1597
  NO_VALUE_OPERATORS,
1656
1598
  NodePositionSchema,
@@ -1660,6 +1602,7 @@ export {
1660
1602
  NotFoundError,
1661
1603
  NotSystemObjectError,
1662
1604
  NotesTabConfig,
1605
+ NumberPropertyBuilder,
1663
1606
  OPERATORS_BY_TYPE,
1664
1607
  ObjectBuilder,
1665
1608
  ObjectNotFoundError,
@@ -1669,8 +1612,11 @@ export {
1669
1612
  PRESENTATION_PROPERTIES,
1670
1613
  PROOF_OF_ADDRESS,
1671
1614
  PermissionService,
1615
+ PhonePropertyBuilder,
1672
1616
  PolicyRegistry,
1673
1617
  PolicyViolationError,
1618
+ PropertySchemaBuilder,
1619
+ PropertyTypeBuilder,
1674
1620
  ProtectedResourceError,
1675
1621
  ProtectedRoleError,
1676
1622
  QueryBuilder,
@@ -1678,11 +1624,13 @@ export {
1678
1624
  QueryNoResultError,
1679
1625
  RELATION_TARGET_ANY,
1680
1626
  RESERVED_ATTRIBUTE_NAMES,
1627
+ RatingPropertyBuilder,
1681
1628
  RecordNotFoundError,
1682
1629
  RecordQueryService,
1683
1630
  RecordReferencedError,
1684
1631
  RecordResolverService,
1685
1632
  RecordService,
1633
+ RelationPropertiesService,
1686
1634
  RelationService,
1687
1635
  RoleNotFoundError,
1688
1636
  RollupScheduler,
@@ -1698,14 +1646,18 @@ export {
1698
1646
  SchemaContextAwareRepository,
1699
1647
  SchemaError,
1700
1648
  SchemaErrorCode,
1649
+ SelectPropertyBuilder,
1701
1650
  ShareStatusSchema,
1702
1651
  SlotModeSchema,
1703
1652
  StartExecutor,
1704
1653
  StartNodeSchema,
1654
+ StatusPropertyBuilder,
1705
1655
  StorageDownloadNotSupportedError,
1706
1656
  SyncError,
1707
1657
  TabBuilder,
1708
1658
  TenantContextError,
1659
+ TextPropertyBuilder,
1660
+ TextareaPropertyBuilder,
1709
1661
  ThemeColorsSchema,
1710
1662
  ThemeLogoSchema,
1711
1663
  TokenRevokedError,
@@ -1827,13 +1779,13 @@ export {
1827
1779
  extractRelationReferences,
1828
1780
  file,
1829
1781
  fileConfigSchema,
1830
- filterPropertiesByCategory,
1831
1782
  flagRegistry,
1832
1783
  flattenRelationsForEval,
1833
1784
  formatAttributeValue,
1834
1785
  formatFormulaResult,
1835
1786
  formatRecord,
1836
1787
  formatRecords,
1788
+ formatZodErrors,
1837
1789
  formula,
1838
1790
  formulaConfigSchema,
1839
1791
  generateCssVariables,
@@ -1841,8 +1793,6 @@ export {
1841
1793
  generateDefaultListView,
1842
1794
  generateFallbackView,
1843
1795
  generateId,
1844
- generateKanbanListView,
1845
- generateModalDetailView,
1846
1796
  generatePrefixedId,
1847
1797
  generateTemplateName,
1848
1798
  getAttributeConfigSchema,
@@ -1855,7 +1805,6 @@ export {
1855
1805
  getNodeOutputs,
1856
1806
  getPathDepth,
1857
1807
  getPolicy,
1858
- getPropertyProtectionLevel,
1859
1808
  getRelationPath,
1860
1809
  getSchemaByNameFromContext,
1861
1810
  getSchemaContext,
@@ -1871,16 +1820,16 @@ export {
1871
1820
  group,
1872
1821
  hasContext,
1873
1822
  hasFeatureFlagsContext,
1823
+ hasProperties,
1874
1824
  hasRelationReferences,
1875
1825
  hasSchemaContext,
1876
1826
  hashOptions,
1877
1827
  inValues,
1828
+ indexBy,
1878
1829
  isActivityTab,
1879
- isAdvancedFilterState,
1880
1830
  isAdvancedFormNode,
1881
1831
  isBehaviorProperty,
1882
1832
  isCalendarView,
1883
- isConcurrentModificationError,
1884
1833
  isConditionGroup,
1885
1834
  isConditionNode,
1886
1835
  isConditionRule,
@@ -1890,7 +1839,6 @@ export {
1890
1839
  isDirectTableTab,
1891
1840
  isDocumentNode,
1892
1841
  isDocumentsTab,
1893
- isDocxTemplateSource,
1894
1842
  isEmpty,
1895
1843
  isEndNode,
1896
1844
  isFeatureEnabled,
@@ -1920,7 +1868,6 @@ export {
1920
1868
  isNotEmpty,
1921
1869
  isNotFoundError,
1922
1870
  isNotesTab,
1923
- isPdfTemplateSource,
1924
1871
  isPresentationProperty,
1925
1872
  isProtectedResourceError,
1926
1873
  isRecordComplete,
@@ -1944,7 +1891,6 @@ export {
1944
1891
  listView,
1945
1892
  location,
1946
1893
  locationConfigSchema,
1947
- mergeFormToSlot,
1948
1894
  mergeWithDefaults,
1949
1895
  multiselect,
1950
1896
  multiselectConfigSchema,
@@ -1995,8 +1941,7 @@ export {
1995
1941
  textConfigSchema,
1996
1942
  textarea,
1997
1943
  textareaConfigSchema,
1998
- toAdvancedFilterState,
1999
- toSimpleFilterState,
1944
+ toUndefinedIfEmpty,
2000
1945
  traversePath,
2001
1946
  tryGetFeatureValue,
2002
1947
  user,
@@ -2009,6 +1954,7 @@ export {
2009
1954
  validateObject,
2010
1955
  validateObjectOrThrow,
2011
1956
  validatePath,
1957
+ validatePropertyType,
2012
1958
  verifyNativeObjectsSync,
2013
1959
  verifyNativeViewsSync,
2014
1960
  verifyRegistryViewsSeeded,