@stndrds/schema 0.1.0-alpha.63 → 0.1.0-alpha.65

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,10 +5,8 @@ import {
5
5
  AuditService,
6
6
  AuthMethodSchema,
7
7
  BEHAVIOR_PROPERTIES,
8
- BasePropertyBuilder,
9
8
  BaseRepository,
10
9
  BaseService,
11
- CheckboxPropertyBuilder,
12
10
  ConcurrentModificationError,
13
11
  ConditionExecutor,
14
12
  ConditionGroupSchema,
@@ -16,14 +14,11 @@ import {
16
14
  ConditionOperatorSchema,
17
15
  ConditionRuleSchema,
18
16
  CreateShareInputSchema,
19
- CurrencyPropertyBuilder,
20
17
  CustomTabConfig,
21
18
  DEFAULT_LABEL_FALLBACK,
22
19
  DEFAULT_THEME,
23
20
  DRIVING_LICENSE,
24
- DatePropertyBuilder,
25
21
  DetailViewBuilder,
26
- DirectTableTabConfig,
27
22
  DocumentExecutor,
28
23
  DocumentGenerationNotConfiguredError,
29
24
  DocumentGenerationService,
@@ -63,24 +58,19 @@ import {
63
58
  GroupBuilder,
64
59
  IDENTITY_PROPERTIES,
65
60
  InvalidPathError,
66
- InverseTableTabConfig,
67
61
  InvitationAlreadyAcceptedError,
68
62
  InvitationExpiredError,
69
63
  InvitationNotFoundError,
70
64
  InvitationRevokedError,
71
65
  ListViewBuilder,
72
66
  ListViewTabConfigBuilder,
73
- LocationPropertyBuilder,
74
67
  MaxDepthExceededError,
75
- MultiselectPropertyBuilder,
76
68
  NodePositionSchema,
77
69
  NoopCacheAdapter,
78
70
  NoopGeocodingAdapter,
79
71
  NoopHookRegistry,
80
72
  NotFoundError,
81
73
  NotSystemObjectError,
82
- NotesTabConfig,
83
- NumberPropertyBuilder,
84
74
  ObjectBuilder,
85
75
  ObjectNotFoundError,
86
76
  ObjectReferencedError,
@@ -89,11 +79,8 @@ import {
89
79
  PRESENTATION_PROPERTIES,
90
80
  PROOF_OF_ADDRESS,
91
81
  PermissionService,
92
- PhonePropertyBuilder,
93
82
  PolicyRegistry,
94
83
  PolicyViolationError,
95
- PropertySchemaBuilder,
96
- PropertyTypeBuilder,
97
84
  ProtectedResourceError,
98
85
  ProtectedRoleError,
99
86
  QueryBuilder,
@@ -101,14 +88,15 @@ import {
101
88
  QueryNoResultError,
102
89
  RELATION_TARGET_ANY,
103
90
  RESERVED_ATTRIBUTE_NAMES,
104
- RatingPropertyBuilder,
105
91
  RecordNotFoundError,
106
92
  RecordQueryService,
107
93
  RecordReferencedError,
108
94
  RecordResolverService,
109
95
  RecordService,
96
+ RelationGroupBuilder,
110
97
  RelationPropertiesService,
111
98
  RelationService,
99
+ RichtextTabConfig,
112
100
  RoleNotFoundError,
113
101
  RollupScheduler,
114
102
  RollupService,
@@ -121,18 +109,15 @@ import {
121
109
  SchemaContextAwareRepository,
122
110
  SchemaError,
123
111
  SchemaErrorCode,
124
- SelectPropertyBuilder,
125
112
  ShareStatusSchema,
126
113
  SlotModeSchema,
127
114
  StartExecutor,
128
115
  StartNodeSchema,
129
- StatusPropertyBuilder,
130
116
  StorageDownloadNotSupportedError,
131
117
  SyncError,
132
118
  TabBuilder,
119
+ TableTabConfig,
133
120
  TenantContextError,
134
- TextPropertyBuilder,
135
- TextareaPropertyBuilder,
136
121
  ThemeColorsSchema,
137
122
  ThemeLogoSchema,
138
123
  TokenRevokedError,
@@ -254,8 +239,10 @@ import {
254
239
  hasSchemaContext,
255
240
  hashOptions,
256
241
  inValues,
242
+ inferInverseCardinality,
257
243
  isAdvancedFormNode,
258
244
  isBehaviorProperty,
245
+ isBilateralRelation,
259
246
  isConditionGroup,
260
247
  isConditionNode,
261
248
  isConditionRule,
@@ -299,7 +286,6 @@ import {
299
286
  mergeWithDefaults,
300
287
  multiselect,
301
288
  neq,
302
- notesPolicy,
303
289
  number,
304
290
  object,
305
291
  or,
@@ -310,6 +296,7 @@ import {
310
296
  recalculateParentRollups,
311
297
  registry,
312
298
  relation,
299
+ relationGroup,
313
300
  renderLabelExpression,
314
301
  resolveMultiplePaths,
315
302
  resolveSingleValue,
@@ -335,7 +322,6 @@ import {
335
322
  user,
336
323
  validateFormulaExpression,
337
324
  validatePath,
338
- validatePropertyType,
339
325
  verifyNativeObjectsSync,
340
326
  verifyNativeViewsSync,
341
327
  verifyRegistryViewsSeeded,
@@ -344,7 +330,7 @@ import {
344
330
  withFeatureFlags,
345
331
  withTenantContext,
346
332
  workflow
347
- } from "./chunk-MUJVBSBL.mjs";
333
+ } from "./chunk-A6T4UUZ2.mjs";
348
334
  import {
349
335
  asTenantId,
350
336
  asUserId,
@@ -529,17 +515,23 @@ function isTimelineView(view2) {
529
515
  function isGalleryView(view2) {
530
516
  return view2.type === "gallery";
531
517
  }
518
+ function isFieldGroup(group2) {
519
+ return !group2.type || group2.type === "fields";
520
+ }
521
+ function isRelationGroup(group2) {
522
+ return group2.type === "relation";
523
+ }
532
524
  function isFormTab(tab) {
533
525
  return tab.type === "form";
534
526
  }
535
527
  function isTableTab(tab) {
536
528
  return tab.type === "table";
537
529
  }
538
- function isDirectTableTab(tab) {
539
- return tab.type === "table" && tab.relationMode === "direct";
530
+ function isRelationSourceTab(tab) {
531
+ return tab.type === "table" && tab.source?.type === "relation";
540
532
  }
541
- function isInverseTableTab(tab) {
542
- return tab.type === "table" && tab.relationMode === "inverse";
533
+ function isInverseSourceTab(tab) {
534
+ return tab.type === "table" && tab.source?.type === "inverse";
543
535
  }
544
536
  function isCustomTab(tab) {
545
537
  return tab.type === "custom";
@@ -547,8 +539,8 @@ function isCustomTab(tab) {
547
539
  function isActivityTab(tab) {
548
540
  return tab.type === "activity";
549
541
  }
550
- function isNotesTab(tab) {
551
- return tab.type === "notes";
542
+ function isRichtextTab(tab) {
543
+ return tab.type === "richtext";
552
544
  }
553
545
  function isFlowsTab(tab) {
554
546
  return tab.type === "flows";
@@ -557,6 +549,28 @@ function isDocumentsTab(tab) {
557
549
  return tab.type === "documents";
558
550
  }
559
551
 
552
+ // src/lib/relation-label.ts
553
+ var PROPS_TOKEN_RE = /\{\{\s*props\./;
554
+ function applyRelationProps(label, props, propertyDefs) {
555
+ if (!PROPS_TOKEN_RE.test(label)) return label;
556
+ const formattedProps = {};
557
+ const defMap = new Map(propertyDefs?.map((d) => [d.name, d]));
558
+ if (props) {
559
+ for (const [key, value] of Object.entries(props)) {
560
+ if (value == null) continue;
561
+ const def = defMap.get(key);
562
+ if (def) {
563
+ const formatted = formatAttributeValue(value, def);
564
+ formattedProps[key] = formatted === EMPTY_VALUE_PLACEHOLDER ? "" : formatted;
565
+ } else {
566
+ formattedProps[key] = value;
567
+ }
568
+ }
569
+ }
570
+ const result = renderLabelExpression(label, { props: formattedProps }, "");
571
+ return result.replace(/\(\s*\)/g, "").replace(/\[\s*\]/g, "").replace(/\s*[-\u2014|:]\s*$/g, "").replace(/\s{2,}/g, " ").trim();
572
+ }
573
+
560
574
  // src/feature-flags/flag-builder.ts
561
575
  function validateFlagName(name) {
562
576
  if (!/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/.test(name)) {
@@ -1074,15 +1088,6 @@ function createFlagService(options) {
1074
1088
  return new FlagService(options);
1075
1089
  }
1076
1090
 
1077
- // src/native/notes.ts
1078
- var NOTES = object({ name: "notes", label: "Note" }).pluralLabel("Notes").icon("file-text").description("Notes that can be linked to any record or used globally").system().labelExpression("{{ title }}").attribute(text({ name: "title", label: "Title" }).placeholder("Untitled").required()).attribute(richtext({ name: "content", label: "Content" }).required()).attribute(
1079
- select({ name: "visibility", label: "Visibility" }).options([
1080
- { id: "private", label: "Private", value: "private", icon: "lock" },
1081
- { id: "shared", label: "Shared", value: "shared", icon: "users" }
1082
- ]).defaultValue("private").required()
1083
- ).attribute(relation({ name: "linkedTo", label: "Linked To" }).toAny().hidden());
1084
- registry.register(NOTES);
1085
-
1086
1091
  // src/views/registry.ts
1087
1092
  var ViewRegistry = class {
1088
1093
  constructor() {
@@ -1278,7 +1283,6 @@ function attributeToField(attr) {
1278
1283
  function generateDefaultDetailView(object2, options = {}) {
1279
1284
  const {
1280
1285
  includeActivityTab = true,
1281
- includeNotesTab = true,
1282
1286
  includeDocumentsTab = true,
1283
1287
  includeFlowsTab = false,
1284
1288
  excludeAttributes = []
@@ -1324,16 +1328,6 @@ function generateDefaultDetailView(object2, options = {}) {
1324
1328
  order: tabOrder++
1325
1329
  });
1326
1330
  }
1327
- if (includeNotesTab) {
1328
- tabs.push({
1329
- id: "notes",
1330
- name: "notes",
1331
- label: "Notes",
1332
- type: "notes",
1333
- order: tabOrder++,
1334
- allowCreate: true
1335
- });
1336
- }
1337
1331
  if (includeFlowsTab) {
1338
1332
  tabs.push({
1339
1333
  id: "flows",
@@ -1492,13 +1486,18 @@ function isDetailViewCustomized(view2, object2) {
1492
1486
  if (viewGroup.id !== defaultGroup.id) {
1493
1487
  return true;
1494
1488
  }
1495
- if (viewGroup.fields.length !== defaultGroup.fields.length) {
1489
+ if ((viewGroup.type ?? "fields") !== (defaultGroup.type ?? "fields")) {
1496
1490
  return true;
1497
1491
  }
1498
- for (let j = 0; j < viewGroup.fields.length; j++) {
1499
- if (viewGroup.fields[j].attribute !== defaultGroup.fields[j].attribute) {
1492
+ if (isFieldGroup(viewGroup) && isFieldGroup(defaultGroup)) {
1493
+ if (viewGroup.fields.length !== defaultGroup.fields.length) {
1500
1494
  return true;
1501
1495
  }
1496
+ for (let j = 0; j < viewGroup.fields.length; j++) {
1497
+ if (viewGroup.fields[j].attribute !== defaultGroup.fields[j].attribute) {
1498
+ return true;
1499
+ }
1500
+ }
1502
1501
  }
1503
1502
  }
1504
1503
  return false;
@@ -1547,10 +1546,8 @@ export {
1547
1546
  AuditService,
1548
1547
  AuthMethodSchema,
1549
1548
  BEHAVIOR_PROPERTIES,
1550
- BasePropertyBuilder,
1551
1549
  BaseRepository,
1552
1550
  BaseService,
1553
- CheckboxPropertyBuilder,
1554
1551
  ConcurrentModificationError,
1555
1552
  ConditionExecutor,
1556
1553
  ConditionGroupSchema,
@@ -1558,7 +1555,6 @@ export {
1558
1555
  ConditionOperatorSchema,
1559
1556
  ConditionRuleSchema,
1560
1557
  CreateShareInputSchema,
1561
- CurrencyPropertyBuilder,
1562
1558
  CustomTabConfig,
1563
1559
  DEFAULT_LABEL_FALLBACK,
1564
1560
  DEFAULT_ROLES,
@@ -1568,9 +1564,7 @@ export {
1568
1564
  DEFAULT_THEME,
1569
1565
  DEFAULT_VALIDATION_MESSAGES,
1570
1566
  DRIVING_LICENSE,
1571
- DatePropertyBuilder,
1572
1567
  DetailViewBuilder,
1573
- DirectTableTabConfig,
1574
1568
  DocumentExecutor,
1575
1569
  DocumentGenerationNotConfiguredError,
1576
1570
  DocumentGenerationService,
@@ -1612,17 +1606,13 @@ export {
1612
1606
  GroupBuilder,
1613
1607
  IDENTITY_PROPERTIES,
1614
1608
  InvalidPathError,
1615
- InverseTableTabConfig,
1616
1609
  InvitationAlreadyAcceptedError,
1617
1610
  InvitationExpiredError,
1618
1611
  InvitationNotFoundError,
1619
1612
  InvitationRevokedError,
1620
1613
  ListViewBuilder,
1621
1614
  ListViewTabConfigBuilder,
1622
- LocationPropertyBuilder,
1623
1615
  MaxDepthExceededError,
1624
- MultiselectPropertyBuilder,
1625
- NOTES,
1626
1616
  NO_VALUE_OPERATORS,
1627
1617
  NodePositionSchema,
1628
1618
  NoopCacheAdapter,
@@ -1630,8 +1620,6 @@ export {
1630
1620
  NoopHookRegistry,
1631
1621
  NotFoundError,
1632
1622
  NotSystemObjectError,
1633
- NotesTabConfig,
1634
- NumberPropertyBuilder,
1635
1623
  OPERATORS_BY_TYPE,
1636
1624
  ObjectBuilder,
1637
1625
  ObjectNotFoundError,
@@ -1641,11 +1629,8 @@ export {
1641
1629
  PRESENTATION_PROPERTIES,
1642
1630
  PROOF_OF_ADDRESS,
1643
1631
  PermissionService,
1644
- PhonePropertyBuilder,
1645
1632
  PolicyRegistry,
1646
1633
  PolicyViolationError,
1647
- PropertySchemaBuilder,
1648
- PropertyTypeBuilder,
1649
1634
  ProtectedResourceError,
1650
1635
  ProtectedRoleError,
1651
1636
  QueryBuilder,
@@ -1653,14 +1638,15 @@ export {
1653
1638
  QueryNoResultError,
1654
1639
  RELATION_TARGET_ANY,
1655
1640
  RESERVED_ATTRIBUTE_NAMES,
1656
- RatingPropertyBuilder,
1657
1641
  RecordNotFoundError,
1658
1642
  RecordQueryService,
1659
1643
  RecordReferencedError,
1660
1644
  RecordResolverService,
1661
1645
  RecordService,
1646
+ RelationGroupBuilder,
1662
1647
  RelationPropertiesService,
1663
1648
  RelationService,
1649
+ RichtextTabConfig,
1664
1650
  RoleNotFoundError,
1665
1651
  RollupScheduler,
1666
1652
  RollupService,
@@ -1675,18 +1661,15 @@ export {
1675
1661
  SchemaContextAwareRepository,
1676
1662
  SchemaError,
1677
1663
  SchemaErrorCode,
1678
- SelectPropertyBuilder,
1679
1664
  ShareStatusSchema,
1680
1665
  SlotModeSchema,
1681
1666
  StartExecutor,
1682
1667
  StartNodeSchema,
1683
- StatusPropertyBuilder,
1684
1668
  StorageDownloadNotSupportedError,
1685
1669
  SyncError,
1686
1670
  TabBuilder,
1671
+ TableTabConfig,
1687
1672
  TenantContextError,
1688
- TextPropertyBuilder,
1689
- TextareaPropertyBuilder,
1690
1673
  ThemeColorsSchema,
1691
1674
  ThemeLogoSchema,
1692
1675
  TokenRevokedError,
@@ -1721,6 +1704,7 @@ export {
1721
1704
  addSchemaToContext,
1722
1705
  and,
1723
1706
  applyDefaultValues,
1707
+ applyRelationProps,
1724
1708
  asTenantId,
1725
1709
  asUserId,
1726
1710
  attributeConfigSchemas,
@@ -1857,9 +1841,11 @@ export {
1857
1841
  hashOptions,
1858
1842
  inValues,
1859
1843
  indexBy,
1844
+ inferInverseCardinality,
1860
1845
  isActivityTab,
1861
1846
  isAdvancedFormNode,
1862
1847
  isBehaviorProperty,
1848
+ isBilateralRelation,
1863
1849
  isCalendarView,
1864
1850
  isConditionGroup,
1865
1851
  isConditionNode,
@@ -1867,12 +1853,12 @@ export {
1867
1853
  isCustomTab,
1868
1854
  isDefaultRole,
1869
1855
  isDetailView,
1870
- isDirectTableTab,
1871
1856
  isDocumentNode,
1872
1857
  isDocumentsTab,
1873
1858
  isEmpty,
1874
1859
  isEndNode,
1875
1860
  isFeatureEnabled,
1861
+ isFieldGroup,
1876
1862
  isFlowDefinition,
1877
1863
  isFlowPublished,
1878
1864
  isFlowsTab,
@@ -1887,7 +1873,7 @@ export {
1887
1873
  isInstanceEvent,
1888
1874
  isInstanceTerminal,
1889
1875
  isInstanceWaiting,
1890
- isInverseTableTab,
1876
+ isInverseSourceTab,
1891
1877
  isInvitationAccepted,
1892
1878
  isInvitationExpired,
1893
1879
  isInvitationOrGrantEvent,
@@ -1898,10 +1884,12 @@ export {
1898
1884
  isNodeEvent,
1899
1885
  isNotEmpty,
1900
1886
  isNotFoundError,
1901
- isNotesTab,
1902
1887
  isPresentationProperty,
1903
1888
  isProtectedResourceError,
1904
1889
  isRecordComplete,
1890
+ isRelationGroup,
1891
+ isRelationSourceTab,
1892
+ isRichtextTab,
1905
1893
  isSchemaError,
1906
1894
  isSimpleFormNode,
1907
1895
  isStartNode,
@@ -1926,7 +1914,6 @@ export {
1926
1914
  multiselect,
1927
1915
  multiselectConfigSchema,
1928
1916
  neq,
1929
- notesPolicy,
1930
1917
  number,
1931
1918
  numberConfigSchema,
1932
1919
  numberFlag,
@@ -1943,6 +1930,7 @@ export {
1943
1930
  registry,
1944
1931
  relation,
1945
1932
  relationConfigSchema,
1933
+ relationGroup,
1946
1934
  renderLabelExpression,
1947
1935
  resetViewToDefault,
1948
1936
  resolveMultiplePaths,
@@ -1985,7 +1973,6 @@ export {
1985
1973
  validateObject,
1986
1974
  validateObjectOrThrow,
1987
1975
  validatePath,
1988
- validatePropertyType,
1989
1976
  verifyNativeObjectsSync,
1990
1977
  verifyNativeViewsSync,
1991
1978
  verifyRegistryViewsSeeded,