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

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,7 +88,6 @@ 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,
@@ -109,6 +95,7 @@ import {
109
95
  RecordService,
110
96
  RelationPropertiesService,
111
97
  RelationService,
98
+ RichtextTabConfig,
112
99
  RoleNotFoundError,
113
100
  RollupScheduler,
114
101
  RollupService,
@@ -121,18 +108,15 @@ import {
121
108
  SchemaContextAwareRepository,
122
109
  SchemaError,
123
110
  SchemaErrorCode,
124
- SelectPropertyBuilder,
125
111
  ShareStatusSchema,
126
112
  SlotModeSchema,
127
113
  StartExecutor,
128
114
  StartNodeSchema,
129
- StatusPropertyBuilder,
130
115
  StorageDownloadNotSupportedError,
131
116
  SyncError,
132
117
  TabBuilder,
118
+ TableTabConfig,
133
119
  TenantContextError,
134
- TextPropertyBuilder,
135
- TextareaPropertyBuilder,
136
120
  ThemeColorsSchema,
137
121
  ThemeLogoSchema,
138
122
  TokenRevokedError,
@@ -254,8 +238,10 @@ import {
254
238
  hasSchemaContext,
255
239
  hashOptions,
256
240
  inValues,
241
+ inferInverseCardinality,
257
242
  isAdvancedFormNode,
258
243
  isBehaviorProperty,
244
+ isBilateralRelation,
259
245
  isConditionGroup,
260
246
  isConditionNode,
261
247
  isConditionRule,
@@ -299,7 +285,6 @@ import {
299
285
  mergeWithDefaults,
300
286
  multiselect,
301
287
  neq,
302
- notesPolicy,
303
288
  number,
304
289
  object,
305
290
  or,
@@ -335,7 +320,6 @@ import {
335
320
  user,
336
321
  validateFormulaExpression,
337
322
  validatePath,
338
- validatePropertyType,
339
323
  verifyNativeObjectsSync,
340
324
  verifyNativeViewsSync,
341
325
  verifyRegistryViewsSeeded,
@@ -344,7 +328,7 @@ import {
344
328
  withFeatureFlags,
345
329
  withTenantContext,
346
330
  workflow
347
- } from "./chunk-MUJVBSBL.mjs";
331
+ } from "./chunk-IIKZXK57.mjs";
348
332
  import {
349
333
  asTenantId,
350
334
  asUserId,
@@ -535,11 +519,11 @@ function isFormTab(tab) {
535
519
  function isTableTab(tab) {
536
520
  return tab.type === "table";
537
521
  }
538
- function isDirectTableTab(tab) {
539
- return tab.type === "table" && tab.relationMode === "direct";
522
+ function isRelationSourceTab(tab) {
523
+ return tab.type === "table" && tab.source?.type === "relation";
540
524
  }
541
- function isInverseTableTab(tab) {
542
- return tab.type === "table" && tab.relationMode === "inverse";
525
+ function isInverseSourceTab(tab) {
526
+ return tab.type === "table" && tab.source?.type === "inverse";
543
527
  }
544
528
  function isCustomTab(tab) {
545
529
  return tab.type === "custom";
@@ -547,8 +531,8 @@ function isCustomTab(tab) {
547
531
  function isActivityTab(tab) {
548
532
  return tab.type === "activity";
549
533
  }
550
- function isNotesTab(tab) {
551
- return tab.type === "notes";
534
+ function isRichtextTab(tab) {
535
+ return tab.type === "richtext";
552
536
  }
553
537
  function isFlowsTab(tab) {
554
538
  return tab.type === "flows";
@@ -557,6 +541,28 @@ function isDocumentsTab(tab) {
557
541
  return tab.type === "documents";
558
542
  }
559
543
 
544
+ // src/lib/relation-label.ts
545
+ var PROPS_TOKEN_RE = /\{\{\s*props\./;
546
+ function applyRelationProps(label, props, propertyDefs) {
547
+ if (!PROPS_TOKEN_RE.test(label)) return label;
548
+ const formattedProps = {};
549
+ const defMap = new Map(propertyDefs?.map((d) => [d.name, d]));
550
+ if (props) {
551
+ for (const [key, value] of Object.entries(props)) {
552
+ if (value == null) continue;
553
+ const def = defMap.get(key);
554
+ if (def) {
555
+ const formatted = formatAttributeValue(value, def);
556
+ formattedProps[key] = formatted === EMPTY_VALUE_PLACEHOLDER ? "" : formatted;
557
+ } else {
558
+ formattedProps[key] = value;
559
+ }
560
+ }
561
+ }
562
+ const result = renderLabelExpression(label, { props: formattedProps }, "");
563
+ return result.replace(/\(\s*\)/g, "").replace(/\[\s*\]/g, "").replace(/\s*[-\u2014|:]\s*$/g, "").replace(/\s{2,}/g, " ").trim();
564
+ }
565
+
560
566
  // src/feature-flags/flag-builder.ts
561
567
  function validateFlagName(name) {
562
568
  if (!/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z]$/.test(name)) {
@@ -1074,15 +1080,6 @@ function createFlagService(options) {
1074
1080
  return new FlagService(options);
1075
1081
  }
1076
1082
 
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
1083
  // src/views/registry.ts
1087
1084
  var ViewRegistry = class {
1088
1085
  constructor() {
@@ -1278,7 +1275,6 @@ function attributeToField(attr) {
1278
1275
  function generateDefaultDetailView(object2, options = {}) {
1279
1276
  const {
1280
1277
  includeActivityTab = true,
1281
- includeNotesTab = true,
1282
1278
  includeDocumentsTab = true,
1283
1279
  includeFlowsTab = false,
1284
1280
  excludeAttributes = []
@@ -1324,16 +1320,6 @@ function generateDefaultDetailView(object2, options = {}) {
1324
1320
  order: tabOrder++
1325
1321
  });
1326
1322
  }
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
1323
  if (includeFlowsTab) {
1338
1324
  tabs.push({
1339
1325
  id: "flows",
@@ -1547,10 +1533,8 @@ export {
1547
1533
  AuditService,
1548
1534
  AuthMethodSchema,
1549
1535
  BEHAVIOR_PROPERTIES,
1550
- BasePropertyBuilder,
1551
1536
  BaseRepository,
1552
1537
  BaseService,
1553
- CheckboxPropertyBuilder,
1554
1538
  ConcurrentModificationError,
1555
1539
  ConditionExecutor,
1556
1540
  ConditionGroupSchema,
@@ -1558,7 +1542,6 @@ export {
1558
1542
  ConditionOperatorSchema,
1559
1543
  ConditionRuleSchema,
1560
1544
  CreateShareInputSchema,
1561
- CurrencyPropertyBuilder,
1562
1545
  CustomTabConfig,
1563
1546
  DEFAULT_LABEL_FALLBACK,
1564
1547
  DEFAULT_ROLES,
@@ -1568,9 +1551,7 @@ export {
1568
1551
  DEFAULT_THEME,
1569
1552
  DEFAULT_VALIDATION_MESSAGES,
1570
1553
  DRIVING_LICENSE,
1571
- DatePropertyBuilder,
1572
1554
  DetailViewBuilder,
1573
- DirectTableTabConfig,
1574
1555
  DocumentExecutor,
1575
1556
  DocumentGenerationNotConfiguredError,
1576
1557
  DocumentGenerationService,
@@ -1612,17 +1593,13 @@ export {
1612
1593
  GroupBuilder,
1613
1594
  IDENTITY_PROPERTIES,
1614
1595
  InvalidPathError,
1615
- InverseTableTabConfig,
1616
1596
  InvitationAlreadyAcceptedError,
1617
1597
  InvitationExpiredError,
1618
1598
  InvitationNotFoundError,
1619
1599
  InvitationRevokedError,
1620
1600
  ListViewBuilder,
1621
1601
  ListViewTabConfigBuilder,
1622
- LocationPropertyBuilder,
1623
1602
  MaxDepthExceededError,
1624
- MultiselectPropertyBuilder,
1625
- NOTES,
1626
1603
  NO_VALUE_OPERATORS,
1627
1604
  NodePositionSchema,
1628
1605
  NoopCacheAdapter,
@@ -1630,8 +1607,6 @@ export {
1630
1607
  NoopHookRegistry,
1631
1608
  NotFoundError,
1632
1609
  NotSystemObjectError,
1633
- NotesTabConfig,
1634
- NumberPropertyBuilder,
1635
1610
  OPERATORS_BY_TYPE,
1636
1611
  ObjectBuilder,
1637
1612
  ObjectNotFoundError,
@@ -1641,11 +1616,8 @@ export {
1641
1616
  PRESENTATION_PROPERTIES,
1642
1617
  PROOF_OF_ADDRESS,
1643
1618
  PermissionService,
1644
- PhonePropertyBuilder,
1645
1619
  PolicyRegistry,
1646
1620
  PolicyViolationError,
1647
- PropertySchemaBuilder,
1648
- PropertyTypeBuilder,
1649
1621
  ProtectedResourceError,
1650
1622
  ProtectedRoleError,
1651
1623
  QueryBuilder,
@@ -1653,7 +1625,6 @@ export {
1653
1625
  QueryNoResultError,
1654
1626
  RELATION_TARGET_ANY,
1655
1627
  RESERVED_ATTRIBUTE_NAMES,
1656
- RatingPropertyBuilder,
1657
1628
  RecordNotFoundError,
1658
1629
  RecordQueryService,
1659
1630
  RecordReferencedError,
@@ -1661,6 +1632,7 @@ export {
1661
1632
  RecordService,
1662
1633
  RelationPropertiesService,
1663
1634
  RelationService,
1635
+ RichtextTabConfig,
1664
1636
  RoleNotFoundError,
1665
1637
  RollupScheduler,
1666
1638
  RollupService,
@@ -1675,18 +1647,15 @@ export {
1675
1647
  SchemaContextAwareRepository,
1676
1648
  SchemaError,
1677
1649
  SchemaErrorCode,
1678
- SelectPropertyBuilder,
1679
1650
  ShareStatusSchema,
1680
1651
  SlotModeSchema,
1681
1652
  StartExecutor,
1682
1653
  StartNodeSchema,
1683
- StatusPropertyBuilder,
1684
1654
  StorageDownloadNotSupportedError,
1685
1655
  SyncError,
1686
1656
  TabBuilder,
1657
+ TableTabConfig,
1687
1658
  TenantContextError,
1688
- TextPropertyBuilder,
1689
- TextareaPropertyBuilder,
1690
1659
  ThemeColorsSchema,
1691
1660
  ThemeLogoSchema,
1692
1661
  TokenRevokedError,
@@ -1721,6 +1690,7 @@ export {
1721
1690
  addSchemaToContext,
1722
1691
  and,
1723
1692
  applyDefaultValues,
1693
+ applyRelationProps,
1724
1694
  asTenantId,
1725
1695
  asUserId,
1726
1696
  attributeConfigSchemas,
@@ -1857,9 +1827,11 @@ export {
1857
1827
  hashOptions,
1858
1828
  inValues,
1859
1829
  indexBy,
1830
+ inferInverseCardinality,
1860
1831
  isActivityTab,
1861
1832
  isAdvancedFormNode,
1862
1833
  isBehaviorProperty,
1834
+ isBilateralRelation,
1863
1835
  isCalendarView,
1864
1836
  isConditionGroup,
1865
1837
  isConditionNode,
@@ -1867,7 +1839,6 @@ export {
1867
1839
  isCustomTab,
1868
1840
  isDefaultRole,
1869
1841
  isDetailView,
1870
- isDirectTableTab,
1871
1842
  isDocumentNode,
1872
1843
  isDocumentsTab,
1873
1844
  isEmpty,
@@ -1887,7 +1858,7 @@ export {
1887
1858
  isInstanceEvent,
1888
1859
  isInstanceTerminal,
1889
1860
  isInstanceWaiting,
1890
- isInverseTableTab,
1861
+ isInverseSourceTab,
1891
1862
  isInvitationAccepted,
1892
1863
  isInvitationExpired,
1893
1864
  isInvitationOrGrantEvent,
@@ -1898,10 +1869,11 @@ export {
1898
1869
  isNodeEvent,
1899
1870
  isNotEmpty,
1900
1871
  isNotFoundError,
1901
- isNotesTab,
1902
1872
  isPresentationProperty,
1903
1873
  isProtectedResourceError,
1904
1874
  isRecordComplete,
1875
+ isRelationSourceTab,
1876
+ isRichtextTab,
1905
1877
  isSchemaError,
1906
1878
  isSimpleFormNode,
1907
1879
  isStartNode,
@@ -1926,7 +1898,6 @@ export {
1926
1898
  multiselect,
1927
1899
  multiselectConfigSchema,
1928
1900
  neq,
1929
- notesPolicy,
1930
1901
  number,
1931
1902
  numberConfigSchema,
1932
1903
  numberFlag,
@@ -1985,7 +1956,6 @@ export {
1985
1956
  validateObject,
1986
1957
  validateObjectOrThrow,
1987
1958
  validatePath,
1988
- validatePropertyType,
1989
1959
  verifyNativeObjectsSync,
1990
1960
  verifyNativeViewsSync,
1991
1961
  verifyRegistryViewsSeeded,