@api-client/core 0.15.1 → 0.16.0

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 (126) hide show
  1. package/TESTING_READY.md +114 -0
  2. package/TESTING_SETUP.md +198 -0
  3. package/build/src/modeling/Semantics.d.ts +126 -2
  4. package/build/src/modeling/Semantics.d.ts.map +1 -1
  5. package/build/src/modeling/Semantics.js +281 -13
  6. package/build/src/modeling/Semantics.js.map +1 -1
  7. package/build/src/modeling/definitions/Calculated.d.ts +54 -0
  8. package/build/src/modeling/definitions/Calculated.d.ts.map +1 -0
  9. package/build/src/modeling/definitions/Calculated.js +31 -0
  10. package/build/src/modeling/definitions/Calculated.js.map +1 -0
  11. package/build/src/modeling/definitions/Categories.d.ts +60 -0
  12. package/build/src/modeling/definitions/Categories.d.ts.map +1 -0
  13. package/build/src/modeling/definitions/Categories.js +33 -0
  14. package/build/src/modeling/definitions/Categories.js.map +1 -0
  15. package/build/src/modeling/definitions/Derived.d.ts +54 -0
  16. package/build/src/modeling/definitions/Derived.d.ts.map +1 -0
  17. package/build/src/modeling/definitions/Derived.js +31 -0
  18. package/build/src/modeling/definitions/Derived.js.map +1 -0
  19. package/build/src/modeling/definitions/Description.d.ts +36 -0
  20. package/build/src/modeling/definitions/Description.d.ts.map +1 -0
  21. package/build/src/modeling/definitions/Description.js +28 -0
  22. package/build/src/modeling/definitions/Description.js.map +1 -0
  23. package/build/src/modeling/definitions/Email.d.ts +66 -0
  24. package/build/src/modeling/definitions/Email.d.ts.map +1 -0
  25. package/build/src/modeling/definitions/Email.js +33 -0
  26. package/build/src/modeling/definitions/Email.js.map +1 -0
  27. package/build/src/modeling/definitions/GeospatialCoordinates.d.ts +212 -0
  28. package/build/src/modeling/definitions/GeospatialCoordinates.d.ts.map +1 -0
  29. package/build/src/modeling/definitions/GeospatialCoordinates.js +129 -0
  30. package/build/src/modeling/definitions/GeospatialCoordinates.js.map +1 -0
  31. package/build/src/modeling/definitions/HTML.d.ts +88 -0
  32. package/build/src/modeling/definitions/HTML.d.ts.map +1 -0
  33. package/build/src/modeling/definitions/HTML.js +42 -0
  34. package/build/src/modeling/definitions/HTML.js.map +1 -0
  35. package/build/src/modeling/definitions/Markdown.d.ts +84 -0
  36. package/build/src/modeling/definitions/Markdown.d.ts.map +1 -0
  37. package/build/src/modeling/definitions/Markdown.js +41 -0
  38. package/build/src/modeling/definitions/Markdown.js.map +1 -0
  39. package/build/src/modeling/definitions/Password.d.ts +112 -0
  40. package/build/src/modeling/definitions/Password.d.ts.map +1 -0
  41. package/build/src/modeling/definitions/Password.js +57 -0
  42. package/build/src/modeling/definitions/Password.js.map +1 -0
  43. package/build/src/modeling/definitions/Phone.d.ts +83 -0
  44. package/build/src/modeling/definitions/Phone.d.ts.map +1 -0
  45. package/build/src/modeling/definitions/Phone.js +39 -0
  46. package/build/src/modeling/definitions/Phone.js.map +1 -0
  47. package/build/src/modeling/definitions/Price.d.ts +102 -0
  48. package/build/src/modeling/definitions/Price.d.ts.map +1 -0
  49. package/build/src/modeling/definitions/Price.js +99 -0
  50. package/build/src/modeling/definitions/Price.js.map +1 -0
  51. package/build/src/modeling/definitions/PublicUniqueName.d.ts +69 -0
  52. package/build/src/modeling/definitions/PublicUniqueName.d.ts.map +1 -0
  53. package/build/src/modeling/definitions/PublicUniqueName.js +34 -0
  54. package/build/src/modeling/definitions/PublicUniqueName.js.map +1 -0
  55. package/build/src/modeling/definitions/SKU.d.ts +127 -0
  56. package/build/src/modeling/definitions/SKU.d.ts.map +1 -0
  57. package/build/src/modeling/definitions/SKU.js +142 -0
  58. package/build/src/modeling/definitions/SKU.js.map +1 -0
  59. package/build/src/modeling/definitions/Status.d.ts +150 -0
  60. package/build/src/modeling/definitions/Status.d.ts.map +1 -0
  61. package/build/src/modeling/definitions/Status.js +60 -0
  62. package/build/src/modeling/definitions/Status.js.map +1 -0
  63. package/build/src/modeling/definitions/Summary.d.ts +53 -0
  64. package/build/src/modeling/definitions/Summary.d.ts.map +1 -0
  65. package/build/src/modeling/definitions/Summary.js +50 -0
  66. package/build/src/modeling/definitions/Summary.js.map +1 -0
  67. package/build/src/modeling/definitions/Tags.d.ts +52 -0
  68. package/build/src/modeling/definitions/Tags.d.ts.map +1 -0
  69. package/build/src/modeling/definitions/Tags.js +32 -0
  70. package/build/src/modeling/definitions/Tags.js.map +1 -0
  71. package/build/src/modeling/definitions/URL.d.ts +68 -0
  72. package/build/src/modeling/definitions/URL.d.ts.map +1 -0
  73. package/build/src/modeling/definitions/URL.js +37 -0
  74. package/build/src/modeling/definitions/URL.js.map +1 -0
  75. package/build/src/modeling/validation/semantic_validation.d.ts +4 -0
  76. package/build/src/modeling/validation/semantic_validation.d.ts.map +1 -1
  77. package/build/src/modeling/validation/semantic_validation.js +32 -1
  78. package/build/src/modeling/validation/semantic_validation.js.map +1 -1
  79. package/build/tsconfig.tsbuildinfo +1 -1
  80. package/data/models/example-generator-api.json +11 -11
  81. package/package.json +1 -1
  82. package/src/modeling/Semantics.ts +297 -14
  83. package/src/modeling/definitions/Calculated.ts +76 -0
  84. package/src/modeling/definitions/Categories.ts +84 -0
  85. package/src/modeling/definitions/Derived.ts +76 -0
  86. package/src/modeling/definitions/Description.ts +55 -0
  87. package/src/modeling/definitions/Email.ts +90 -0
  88. package/src/modeling/definitions/GeospatialCoordinates.ts +274 -0
  89. package/src/modeling/definitions/HTML.ts +121 -0
  90. package/src/modeling/definitions/Markdown.ts +116 -0
  91. package/src/modeling/definitions/Password.ts +156 -0
  92. package/src/modeling/definitions/Phone.ts +116 -0
  93. package/src/modeling/definitions/Price.examples.md +158 -0
  94. package/src/modeling/definitions/Price.ts +180 -0
  95. package/src/modeling/definitions/PublicUniqueName.ts +98 -0
  96. package/src/modeling/definitions/SKU.examples.md +230 -0
  97. package/src/modeling/definitions/SKU.ts +254 -0
  98. package/src/modeling/definitions/Status.ts +227 -0
  99. package/src/modeling/definitions/Summary.ts +73 -0
  100. package/src/modeling/definitions/Tags.ts +75 -0
  101. package/src/modeling/definitions/URL.ts +96 -0
  102. package/src/modeling/validation/semantic_validation.ts +35 -1
  103. package/tests/example-test-setup.ts +133 -0
  104. package/tests/template-node.spec.ts +75 -0
  105. package/tests/test-utils.ts +293 -0
  106. package/tests/unit/modeling/definitions/calculated.spec.ts +33 -0
  107. package/tests/unit/modeling/definitions/categories.spec.ts +38 -0
  108. package/tests/unit/modeling/definitions/derived.spec.ts +34 -0
  109. package/tests/unit/modeling/definitions/description.spec.ts +38 -0
  110. package/tests/unit/modeling/definitions/email.spec.ts +38 -0
  111. package/tests/unit/modeling/definitions/geospatial-coordinates.spec.ts +41 -0
  112. package/tests/unit/modeling/definitions/html.spec.ts +38 -0
  113. package/tests/unit/modeling/definitions/markdown.spec.ts +38 -0
  114. package/tests/unit/modeling/definitions/password.spec.ts +347 -0
  115. package/tests/unit/modeling/definitions/phone.spec.ts +38 -0
  116. package/tests/unit/modeling/definitions/price.spec.ts +465 -0
  117. package/tests/unit/modeling/definitions/public-unique-name.spec.ts +38 -0
  118. package/tests/unit/modeling/definitions/sku.spec.ts +240 -0
  119. package/tests/unit/modeling/definitions/status.spec.ts +37 -0
  120. package/tests/unit/modeling/definitions/summary.spec.ts +36 -0
  121. package/tests/unit/modeling/definitions/tags.spec.ts +38 -0
  122. package/tests/unit/modeling/definitions/url.spec.ts +38 -0
  123. package/tests/unit/modeling/domain_property.spec.ts +106 -0
  124. package/tests/unit/modeling/domain_validation.spec.ts +5 -5
  125. package/tests/unit/modeling/semantic-configs.spec.ts +569 -0
  126. package/tests/unit/modeling/semantics.spec.ts +52 -0
@@ -4,12 +4,16 @@
4
4
  */
5
5
  export var SemanticType;
6
6
  (function (SemanticType) {
7
+ //
7
8
  // Entity-Level Semantics
9
+ //
8
10
  /**
9
11
  * Designates a Data Entity that represents users of the system.
10
12
  */
11
13
  SemanticType["User"] = "Semantic#User";
14
+ //
12
15
  // Property-Level Semantics
16
+ //
13
17
  /**
14
18
  * Annotates the field as the user password.
15
19
  * The runtime should treat this field with special care,
@@ -40,11 +44,19 @@ export var SemanticType;
40
44
  */
41
45
  SemanticType["DeletedFlag"] = "Semantic#DeletedFlag";
42
46
  /**
43
- * Designates a Data Property as a unique public identifier for a resource.
47
+ * Designates a Data Property as a unique public identifier for a resource (the slug).
44
48
  * This is often used in URLs to provide a user-friendly way to access the resource.
45
49
  * For example, a blog post might have a public unique name like "my-first-post".
50
+ * A URL-friendly text field. The runtime automatically generates a unique, URL-safe string from another field (like a title or name). The user needs to specify which field is used to generate
51
+ * the slug.
46
52
  */
47
53
  SemanticType["PublicUniqueName"] = "Semantic#PublicUniqueName";
54
+ /**
55
+ * A semantic that describes a title of an article, blog post, and so on. This semantic is used with
56
+ * the `PublicUniqueName` to determine which field is responsible for the slug generation. However,
57
+ * we may add more automation related to the `title` property in the future.
58
+ */
59
+ SemanticType["Title"] = "Semantic#Title";
48
60
  /**
49
61
  * Designates a Data Property as the `role` of a user within the system.
50
62
  * This is used to define the user's permissions and access levels.
@@ -53,13 +65,131 @@ export var SemanticType;
53
65
  * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.
54
66
  */
55
67
  SemanticType["UserRole"] = "Semantic#UserRole";
68
+ /**
69
+ * A text or enum field to represent the state of a record (e.g., `draft`, `published`, `pending_review`, `archived`).
70
+ *
71
+ * Defined behaviors:
72
+ * - State-Based Filtering: Automatically prevents public users from seeing records in a draft state.
73
+ * - State Transitions: In principle, the runtime should prevent the user from skipping some states.
74
+ * For example, when the record is in the `draft` state, it cannot be moved to the `archived` state without publishing it first. However,
75
+ * we do not have enough customer feedback to design this functionality correctly right now, so
76
+ * it serves as a placeholder semantic annotation.
77
+ */
78
+ SemanticType["Status"] = "Semantic#Status";
79
+ /**
80
+ * Annotates an integer field that automatically increments.
81
+ * The runtime automatically increments this number on every update, providing a simple way
82
+ * to track changes and implement optimistic locking to prevent mid-air collisions.
83
+ */
84
+ SemanticType["Version"] = "Semantic#Version";
85
+ /**
86
+ * Annotates a field that holds a reference to an image data via an URL.
87
+ * The application + runtime should validate that the input is a well-formed URL.
88
+ */
89
+ SemanticType["ImageURL"] = "Semantic#ImageURL";
90
+ /**
91
+ * Annotates a field that holds a reference to a file object via an URL. Ity is distinct from the
92
+ * `ImageURL` semantic as it implicitly states that the target is non-image, binary data (an attachment, for example).
93
+ */
94
+ SemanticType["FileURL"] = "Semantic#FileURL";
95
+ /**
96
+ * Annotates the field as a markdown-interpreted field.
97
+ * When an object is created, the runtime performs additional sanitization to prevent XSS attacks.
98
+ *
99
+ * The annotation describes whether the data should be translated to the HTML output when
100
+ * record is read or the original MD content should be returned.
101
+ */
102
+ SemanticType["Markdown"] = "Semantic#Markdown";
103
+ /**
104
+ * Annotates the field as containing HTML content.
105
+ * The runtime performs sanitization to prevent XSS attacks and validates HTML structure.
106
+ *
107
+ * The annotation describes whether the data should be rendered as HTML output when
108
+ * record is read or the original HTML content should be returned.
109
+ */
110
+ SemanticType["HTML"] = "Semantic#HTML";
111
+ /**
112
+ * Annotates a field that holds geospatial coordinate data (latitude/longitude).
113
+ * The runtime automatically generates API capabilities for location-based queries,
114
+ * such as "find all restaurants within a 5-mile radius."
115
+ *
116
+ * The field should contain coordinate data in a standard format:
117
+ * - "40.7128,-74.0060" (lat,lon)
118
+ * - "POINT(-74.0060 40.7128)" (PostGIS format)
119
+ * - "40.7128°N, 74.0060°W" (degree format)
120
+ *
121
+ * Defined behaviors:
122
+ * - Spatial Indexing: The runtime automatically creates spatial indexes for efficient location-based queries
123
+ * - Distance Queries: Enables API endpoints for finding records within specified distances
124
+ * - Coordinate Validation: Validates that the input follows proper coordinate format
125
+ * - PostGIS Integration: When using PostgreSQL, automatically maps to PostGIS geometry types
126
+ */
127
+ SemanticType["GeospatialCoordinates"] = "Semantic#GeospatialCoordinates";
128
+ /**
129
+ * Annotates a field as an email address with validation and verification options.
130
+ */
131
+ SemanticType["Email"] = "Semantic#Email";
132
+ /**
133
+ * Annotates a field as a phone number with validation and formatting options.
134
+ */
135
+ SemanticType["Phone"] = "Semantic#Phone";
136
+ /**
137
+ * Annotates a field as a monetary value with currency support and precision control.
138
+ * Can store simple decimal amounts or complex objects with amount and currency.
139
+ * Enforces proper decimal handling to avoid floating-point errors.
140
+ */
141
+ SemanticType["Price"] = "Semantic#Price";
142
+ /**
143
+ * Annotates a field as a URL with validation and allowed protocols.
144
+ */
145
+ SemanticType["URL"] = "Semantic#URL";
146
+ /**
147
+ * Annotates a field as a Stock Keeping Unit (SKU).
148
+ * Enforces uniqueness at the database level, critical for product catalogs.
149
+ * Provides automatic validation and formatting for product identification codes.
150
+ */
151
+ SemanticType["SKU"] = "Semantic#SKU";
152
+ /**
153
+ * Annotates a field as a long-form description.
154
+ */
155
+ SemanticType["Description"] = "Semantic#Description";
156
+ /**
157
+ * Annotates a field as a short summary.
158
+ */
159
+ SemanticType["Summary"] = "Semantic#Summary";
160
+ /**
161
+ * Annotates a field as a calculated value based on a formula.
162
+ */
163
+ SemanticType["Calculated"] = "Semantic#Calculated";
164
+ /**
165
+ * Annotates a field as derived from other fields.
166
+ */
167
+ SemanticType["Derived"] = "Semantic#Derived";
168
+ //
56
169
  // Association-Level Semantics
170
+ //
57
171
  /**
58
172
  * Designates an association that links a resource to a "User" entity instance.
59
173
  * This is used to indicate ownership of the resource for access control purposes.
60
174
  * For example, a blog post might have a resource owner identifier that points to the user who created it.
175
+ *
176
+ * Defined behaviors:
177
+ * - Automatic Ownership: When a new record is created, this field is automatically populated with the ID of the authenticated user. It also creates a foreign relationship to the `User` semantic object.
178
+ * - Scoped Access: The runtime automatically filters list and read operations to show only records where the Owner matches the current user. update and delete operations are similarly restricted.
61
179
  */
62
180
  SemanticType["ResourceOwnerIdentifier"] = "Semantic#ResourceOwnerIdentifier";
181
+ /**
182
+ * Annotates an association as supporting tag functionality.
183
+ * Applied to associations between entities to enable tagging behavior.
184
+ * For example, a Product-Category association with Tags semantic enables product tagging.
185
+ */
186
+ SemanticType["Tags"] = "Semantic#Tags";
187
+ /**
188
+ * Annotates an association as supporting category functionality.
189
+ * Applied to associations between entities to enable categorization behavior.
190
+ * For example, a Product-Category association with Categories semantic enables product categorization.
191
+ */
192
+ SemanticType["Categories"] = "Semantic#Categories";
63
193
  })(SemanticType || (SemanticType = {}));
64
194
  /**
65
195
  * Defines the scope at which a semantic can be applied.
@@ -99,14 +229,18 @@ export const isAssociationSemantic = (semantic) => semantic.scope === SemanticSc
99
229
  * This acts as a central registry for the application.
100
230
  */
101
231
  export const DataSemantics = {
232
+ //
102
233
  // Entity-Level Definitions
234
+ //
103
235
  [SemanticType.User]: {
104
236
  id: SemanticType.User,
105
237
  displayName: 'User Entity',
106
238
  scope: SemanticScope.Entity,
107
239
  description: 'Designates an entity that represents system users, crucial for authentication and authorization.',
108
240
  },
241
+ //
109
242
  // Property-Level Definitions
243
+ //
110
244
  [SemanticType.Password]: {
111
245
  id: SemanticType.Password,
112
246
  displayName: 'User Password',
@@ -135,6 +269,55 @@ export const DataSemantics = {
135
269
  description: "Marks a field as the field that contains object's deletion timestamp.",
136
270
  applicableDataTypes: ['datetime'],
137
271
  },
272
+ [SemanticType.PublicUniqueName]: {
273
+ id: SemanticType.PublicUniqueName,
274
+ displayName: 'Public Unique Name (Slug)',
275
+ scope: SemanticScope.Property,
276
+ description: 'A user-friendly, unique public identifier for a resource, often used in URLs.',
277
+ applicableDataTypes: ['string'],
278
+ },
279
+ [SemanticType.Title]: {
280
+ id: SemanticType.Title,
281
+ displayName: 'Record Title',
282
+ scope: SemanticScope.Property,
283
+ description: 'A title for the record. Used as a source for the PublicUniqueName semantic.',
284
+ applicableDataTypes: ['string'],
285
+ },
286
+ [SemanticType.UserRole]: {
287
+ id: SemanticType.UserRole,
288
+ displayName: 'User Role Field',
289
+ scope: SemanticScope.Property,
290
+ description: "A text or enum field that defines the user's role for role-based authorization.",
291
+ applicableDataTypes: ['string'],
292
+ },
293
+ [SemanticType.Status]: {
294
+ id: SemanticType.Status,
295
+ displayName: 'Record Status',
296
+ scope: SemanticScope.Property,
297
+ description: 'A text or enum field to represent the state of a record.',
298
+ applicableDataTypes: ['string'],
299
+ },
300
+ [SemanticType.Version]: {
301
+ id: SemanticType.Version,
302
+ displayName: 'Version Number',
303
+ scope: SemanticScope.Property,
304
+ description: 'An integer field that automatically increments on every update.',
305
+ applicableDataTypes: ['number'],
306
+ },
307
+ [SemanticType.ImageURL]: {
308
+ id: SemanticType.ImageURL,
309
+ displayName: 'Image URL',
310
+ scope: SemanticScope.Property,
311
+ description: 'Annotates a field that holds a reference to an image data via an URL.',
312
+ applicableDataTypes: ['string'],
313
+ },
314
+ [SemanticType.FileURL]: {
315
+ id: SemanticType.FileURL,
316
+ displayName: 'File URL',
317
+ scope: SemanticScope.Property,
318
+ description: 'Annotates a field that holds a reference to a file object via an URL (non-image binary data).',
319
+ applicableDataTypes: ['string'],
320
+ },
138
321
  [SemanticType.DeletedFlag]: {
139
322
  id: SemanticType.DeletedFlag,
140
323
  displayName: 'Soft Delete Flag',
@@ -142,25 +325,110 @@ export const DataSemantics = {
142
325
  description: 'A boolean property that marks the object as deleted without physically removing it.',
143
326
  applicableDataTypes: ['boolean'],
144
327
  },
328
+ [SemanticType.Markdown]: {
329
+ id: SemanticType.Markdown,
330
+ displayName: 'Markdown Content',
331
+ scope: SemanticScope.Property,
332
+ description: 'A text field that contains markdown content.',
333
+ applicableDataTypes: ['string'],
334
+ },
335
+ [SemanticType.HTML]: {
336
+ id: SemanticType.HTML,
337
+ displayName: 'HTML Content',
338
+ scope: SemanticScope.Property,
339
+ description: 'Annotates a field that contains HTML content.',
340
+ applicableDataTypes: ['string'],
341
+ },
342
+ [SemanticType.GeospatialCoordinates]: {
343
+ id: SemanticType.GeospatialCoordinates,
344
+ displayName: 'Geospatial Coordinates',
345
+ scope: SemanticScope.Property,
346
+ description: 'Annotates a field that holds geospatial coordinate data (latitude/longitude).',
347
+ applicableDataTypes: ['string'],
348
+ },
349
+ [SemanticType.Email]: {
350
+ id: SemanticType.Email,
351
+ displayName: 'Email',
352
+ scope: SemanticScope.Property,
353
+ description: 'Annotates a field as an email address with validation and verification options.',
354
+ applicableDataTypes: ['string'],
355
+ },
356
+ [SemanticType.Phone]: {
357
+ id: SemanticType.Phone,
358
+ displayName: 'Phone',
359
+ scope: SemanticScope.Property,
360
+ description: 'Annotates a field as a phone number with validation and formatting options.',
361
+ applicableDataTypes: ['string'],
362
+ },
363
+ [SemanticType.Price]: {
364
+ id: SemanticType.Price,
365
+ displayName: 'Price',
366
+ scope: SemanticScope.Property,
367
+ description: 'Annotates a field as a monetary value with currency support and precision control.',
368
+ applicableDataTypes: ['number', 'string'],
369
+ },
370
+ [SemanticType.URL]: {
371
+ id: SemanticType.URL,
372
+ displayName: 'URL',
373
+ scope: SemanticScope.Property,
374
+ description: 'Annotates a field as a URL with validation and allowed protocols.',
375
+ applicableDataTypes: ['string'],
376
+ },
377
+ [SemanticType.SKU]: {
378
+ id: SemanticType.SKU,
379
+ displayName: 'SKU',
380
+ scope: SemanticScope.Property,
381
+ description: 'Annotates a field as a Stock Keeping Unit (SKU). Enforces uniqueness at the database level, critical for product catalogs. Provides automatic validation and formatting for product identification codes.',
382
+ applicableDataTypes: ['string'],
383
+ },
384
+ [SemanticType.Description]: {
385
+ id: SemanticType.Description,
386
+ displayName: 'Description',
387
+ scope: SemanticScope.Property,
388
+ description: 'Annotates a field as a long-form description.',
389
+ applicableDataTypes: ['string'],
390
+ },
391
+ [SemanticType.Summary]: {
392
+ id: SemanticType.Summary,
393
+ displayName: 'Summary',
394
+ scope: SemanticScope.Property,
395
+ description: 'Annotates a field as a short summary.',
396
+ applicableDataTypes: ['string'],
397
+ },
398
+ [SemanticType.Calculated]: {
399
+ id: SemanticType.Calculated,
400
+ displayName: 'Calculated',
401
+ scope: SemanticScope.Property,
402
+ description: 'Annotates a field as a calculated value based on a formula.',
403
+ applicableDataTypes: ['string'],
404
+ },
405
+ [SemanticType.Derived]: {
406
+ id: SemanticType.Derived,
407
+ displayName: 'Derived',
408
+ scope: SemanticScope.Property,
409
+ description: 'Annotates a field as derived from other fields.',
410
+ applicableDataTypes: ['string'],
411
+ },
412
+ //
413
+ // Association-Level Definitions
414
+ //
145
415
  [SemanticType.ResourceOwnerIdentifier]: {
146
416
  id: SemanticType.ResourceOwnerIdentifier,
147
417
  displayName: 'Resource Owner Identifier',
148
418
  scope: SemanticScope.Association,
149
419
  description: 'Links a resource to a "User" entity instance, indicating ownership for access control.',
150
420
  },
151
- [SemanticType.PublicUniqueName]: {
152
- id: SemanticType.PublicUniqueName,
153
- displayName: 'Public Unique Name (Slug)',
154
- scope: SemanticScope.Property,
155
- description: 'A user-friendly, unique public identifier for a resource, often used in URLs.',
156
- applicableDataTypes: ['string'],
421
+ [SemanticType.Tags]: {
422
+ id: SemanticType.Tags,
423
+ displayName: 'Tags',
424
+ scope: SemanticScope.Association,
425
+ description: 'Annotates an association as supporting tag functionality.',
157
426
  },
158
- [SemanticType.UserRole]: {
159
- id: SemanticType.UserRole,
160
- displayName: 'User Role Field',
161
- scope: SemanticScope.Property,
162
- description: 'A text field that is recognized by the runtime as a role of a user in the API. Used with the role-based authorization strategy.',
163
- applicableDataTypes: ['string'],
427
+ [SemanticType.Categories]: {
428
+ id: SemanticType.Categories,
429
+ displayName: 'Categories',
430
+ scope: SemanticScope.Association,
431
+ description: 'Annotates an association as supporting category functionality.',
164
432
  },
165
433
  };
166
434
  //# sourceMappingURL=Semantics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Semantics.js","sourceRoot":"","sources":["../../../src/modeling/Semantics.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAN,IAAY,YA0DX;AA1DD,WAAY,YAAY;IACtB,yBAAyB;IACzB;;OAEG;IACH,sCAAsB,CAAA;IAEtB,2BAA2B;IAC3B;;;;OAIG;IACH,8CAA8B,CAAA;IAC9B;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;;;OAKG;IACH,8DAA8C,CAAA;IAC9C;;;;OAIG;IACH,oD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AAQ;QAC7B,WAAW,EAAE,+EAA+E;QAC5F,mBAAmB,EAAE,CAAC,QAAQ,CAAC;KAChC;IACD,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;QACvB,EAAE,EAAE,YAAY,CAAC,QAAQ;QACzB,WAAW,EAAE,iBAAiB;QAC9B,KAAK,EAAE,aAAa,CAAC,QAAQ;QAC7B,WAAW,EACT,iIAAiI;QACnI,mBAAmB,EAAE,CAAC,QAAQ,CAAC;KAChC;CACF,CAAA","sourcesContent":["/* eslint-disable max-len */\nimport type { DomainPropertyType } from './DataFormat.js'\n\n/**\n * Defines the names for all available data semantics.\n * Using a string enum makes it easy to add or remove semantics in a single place.\n */\nexport enum SemanticType {\n // Entity-Level Semantics\n /**\n * Designates a Data Entity that represents users of the system.\n */\n User = 'Semantic#User',\n\n // Property-Level Semantics\n /**\n * Annotates the field as the user password.\n * The runtime should treat this field with special care,\n * ensuring it is encrypted and not exposed in API responses.\n */\n Password = 'Semantic#Password',\n /**\n * Designates a Data Property as the `createdAt` timestamp of an entity.\n * This is used to track when the entity was first created.\n */\n CreatedTimestamp = 'Semantic#CreatedTimestamp',\n /**\n * Designates a Data Property as the `updatedAt` timestamp of an entity.\n * This is used to track when the entity was last modified.\n */\n UpdatedTimestamp = 'Semantic#UpdatedTimestamp',\n /**\n * Designates a Data Property as the `deletedAt` timestamp of an entity.\n * This is used to track when the entity was soft-deleted.\n * Soft-deletion means the entity is not physically removed from the database,\n * but marked as deleted for logical deletion purposes.\n */\n DeletedTimestamp = 'Semantic#DeletedTimestamp',\n /**\n * Designates a Data Property as a boolean flag indicating whether the entity is deleted.\n * This is used for soft-deletion, where the entity is not physically removed from the database,\n * but marked as deleted.\n */\n DeletedFlag = 'Semantic#DeletedFlag',\n /**\n * Designates a Data Property as a unique public identifier for a resource.\n * This is often used in URLs to provide a user-friendly way to access the resource.\n * For example, a blog post might have a public unique name like \"my-first-post\".\n */\n PublicUniqueName = 'Semantic#PublicUniqueName',\n /**\n * Designates a Data Property as the `role` of a user within the system.\n * This is used to define the user's permissions and access levels.\n * For example, a user with the role of \"admin\" would have elevated permissions\n * compared to a user with the role of \"guest\".\n * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.\n */\n UserRole = 'Semantic#UserRole',\n // Association-Level Semantics\n /**\n * Designates an association that links a resource to a \"User\" entity instance.\n * This is used to indicate ownership of the resource for access control purposes.\n * For example, a blog post might have a resource owner identifier that points to the user who created it.\n */\n ResourceOwnerIdentifier = 'Semantic#ResourceOwnerIdentifier',\n}\n\n/**\n * Defines the scope at which a semantic can be applied.\n */\nexport enum SemanticScope {\n /**\n * The semantic applies to an entire Data Entity.\n * This is used for semantics that provide context or constraints at the entity level.\n */\n Entity = 'Entity',\n /**\n * The semantic applies to a single Data Property.\n * This is used for semantics that provide context or constraints at the property level.\n */\n Property = 'Property',\n /**\n * The semantic applies to an Association between Data Entities.\n * This is used for semantics that provide context or constraints at the association level.\n */\n Association = 'Association',\n}\n\n/**\n * A base interface for all Data Semantics, containing common properties.\n * A semantic is an annotation applied to a Data Entity, Property, or Association\n * to provide additional context or constraints.\n * This interface is extended by more specific semantic types.\n */\ninterface BaseDataSemantic {\n /**\n * A unique identifier for the semantic definition.\n */\n id: SemanticType\n /**\n * A human-readable name for the semantic.\n */\n displayName: string\n /**\n * A description of the semantic's purpose and impact.\n */\n description: string\n /**\n * Specifies whether the semantic applies to an Entity, Property, or Association.\n */\n scope: SemanticScope\n}\n\n/**\n * Represents a semantic that can be applied to an entire Data Entity.\n */\nexport interface EntitySemantic extends BaseDataSemantic {\n scope: SemanticScope.Entity\n}\n\n/**\n * Represents a semantic that can be applied to a single property.\n */\nexport interface PropertySemantic extends BaseDataSemantic {\n scope: SemanticScope.Property\n /**\n * Optional array of data types this semantic can be applied to.\n * Enforces constraints, e.g., DeletedTimestamp on a DateTime property.\n */\n applicableDataTypes?: DomainPropertyType[]\n}\n\n/**\n * Represents a semantic that can be applied to an association between entities.\n */\nexport interface AssociationSemantic extends BaseDataSemantic {\n scope: SemanticScope.Association\n}\n\n/**\n * A type guard to check if a semantic is an EntitySemantic.\n */\nexport const isEntitySemantic = (semantic: DataSemantic): semantic is EntitySemantic =>\n semantic.scope === SemanticScope.Entity\n\n/**\n * A type guard to check if a semantic is a PropertySemantic.\n */\nexport const isPropertySemantic = (semantic: DataSemantic): semantic is PropertySemantic =>\n semantic.scope === SemanticScope.Property\n\n/**\n * A type guard to check if a semantic is a AssociationSemantic.\n */\nexport const isAssociationSemantic = (semantic: DataSemantic): semantic is AssociationSemantic =>\n semantic.scope === SemanticScope.Association\n\n/**\n * Union type for any kind of data semantic\n */\nexport type DataSemantic = EntitySemantic | PropertySemantic | AssociationSemantic\n\n/**\n * A map to store the definitions of all available data semantics.\n * This acts as a central registry for the application.\n */\nexport const DataSemantics: Record<SemanticType, DataSemantic> = {\n // Entity-Level Definitions\n [SemanticType.User]: {\n id: SemanticType.User,\n displayName: 'User Entity',\n scope: SemanticScope.Entity,\n description: 'Designates an entity that represents system users, crucial for authentication and authorization.',\n },\n\n // Property-Level Definitions\n [SemanticType.Password]: {\n id: SemanticType.Password,\n displayName: 'User Password',\n scope: SemanticScope.Property,\n description:\n 'Annotates the field as the user password. The runtime should treat this field with special care, ensuring it is encrypted and not exposed in API responses.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.CreatedTimestamp]: {\n id: SemanticType.CreatedTimestamp,\n displayName: 'Creation Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the one that contains the object's creation timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.UpdatedTimestamp]: {\n id: SemanticType.UpdatedTimestamp,\n displayName: 'Update Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the field that contains object's last modification timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.DeletedTimestamp]: {\n id: SemanticType.DeletedTimestamp,\n displayName: 'Soft Delete Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the field that contains object's deletion timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.DeletedFlag]: {\n id: SemanticType.DeletedFlag,\n displayName: 'Soft Delete Flag',\n scope: SemanticScope.Property,\n description: 'A boolean property that marks the object as deleted without physically removing it.',\n applicableDataTypes: ['boolean'],\n },\n [SemanticType.ResourceOwnerIdentifier]: {\n id: SemanticType.ResourceOwnerIdentifier,\n displayName: 'Resource Owner Identifier',\n scope: SemanticScope.Association,\n description: 'Links a resource to a \"User\" entity instance, indicating ownership for access control.',\n },\n [SemanticType.PublicUniqueName]: {\n id: SemanticType.PublicUniqueName,\n displayName: 'Public Unique Name (Slug)',\n scope: SemanticScope.Property,\n description: 'A user-friendly, unique public identifier for a resource, often used in URLs.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.UserRole]: {\n id: SemanticType.UserRole,\n displayName: 'User Role Field',\n scope: SemanticScope.Property,\n description:\n 'A text field that is recognized by the runtime as a role of a user in the API. Used with the role-based authorization strategy.',\n applicableDataTypes: ['string'],\n },\n}\n\n/**\n * Represents the application of a data semantic to a specific\n * entity or property within a user's data model.\n */\nexport interface AppliedDataSemantic {\n /**\n * The unique identifier of the semantic being applied.\n */\n id: SemanticType\n\n /**\n * Optional configuration or values specific to this application.\n */\n config?: Record<string, unknown>\n}\n"]}
1
+ {"version":3,"file":"Semantics.js","sourceRoot":"","sources":["../../../src/modeling/Semantics.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAN,IAAY,YAuMX;AAvMD,WAAY,YAAY;IACtB,EAAE;IACF,yBAAyB;IACzB,EAAE;IAEF;;OAEG;IACH,sCAAsB,CAAA;IAEtB,EAAE;IACF,2BAA2B;IAC3B,EAAE;IAEF;;;;OAIG;IACH,8CAA8B,CAAA;IAC9B;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;;;OAKG;IACH,8DAA8C,CAAA;IAC9C;;;;OAIG;IACH,oDAAoC,CAAA;IACpC;;;;;;OAMG;I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,EAAE,EAAE,YAAY,CAAC,UAAU;QAC3B,WAAW,EAAE,YAAY;QACzB,KAAK,EAAE,aAAa,CAAC,WAAW;QAChC,WAAW,EAAE,gEAAgE;KAC9E;CACF,CAAA","sourcesContent":["/* eslint-disable max-len */\nimport type { DomainPropertyType } from './DataFormat.js'\n\n/**\n * Defines the names for all available data semantics.\n * Using a string enum makes it easy to add or remove semantics in a single place.\n */\nexport enum SemanticType {\n //\n // Entity-Level Semantics\n //\n\n /**\n * Designates a Data Entity that represents users of the system.\n */\n User = 'Semantic#User',\n\n //\n // Property-Level Semantics\n //\n\n /**\n * Annotates the field as the user password.\n * The runtime should treat this field with special care,\n * ensuring it is encrypted and not exposed in API responses.\n */\n Password = 'Semantic#Password',\n /**\n * Designates a Data Property as the `createdAt` timestamp of an entity.\n * This is used to track when the entity was first created.\n */\n CreatedTimestamp = 'Semantic#CreatedTimestamp',\n /**\n * Designates a Data Property as the `updatedAt` timestamp of an entity.\n * This is used to track when the entity was last modified.\n */\n UpdatedTimestamp = 'Semantic#UpdatedTimestamp',\n /**\n * Designates a Data Property as the `deletedAt` timestamp of an entity.\n * This is used to track when the entity was soft-deleted.\n * Soft-deletion means the entity is not physically removed from the database,\n * but marked as deleted for logical deletion purposes.\n */\n DeletedTimestamp = 'Semantic#DeletedTimestamp',\n /**\n * Designates a Data Property as a boolean flag indicating whether the entity is deleted.\n * This is used for soft-deletion, where the entity is not physically removed from the database,\n * but marked as deleted.\n */\n DeletedFlag = 'Semantic#DeletedFlag',\n /**\n * Designates a Data Property as a unique public identifier for a resource (the slug).\n * This is often used in URLs to provide a user-friendly way to access the resource.\n * For example, a blog post might have a public unique name like \"my-first-post\".\n * A URL-friendly text field. The runtime automatically generates a unique, URL-safe string from another field (like a title or name). The user needs to specify which field is used to generate\n * the slug.\n */\n PublicUniqueName = 'Semantic#PublicUniqueName',\n /**\n * A semantic that describes a title of an article, blog post, and so on. This semantic is used with\n * the `PublicUniqueName` to determine which field is responsible for the slug generation. However,\n * we may add more automation related to the `title` property in the future.\n */\n Title = 'Semantic#Title',\n /**\n * Designates a Data Property as the `role` of a user within the system.\n * This is used to define the user's permissions and access levels.\n * For example, a user with the role of \"admin\" would have elevated permissions\n * compared to a user with the role of \"guest\".\n * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.\n */\n UserRole = 'Semantic#UserRole',\n /**\n * A text or enum field to represent the state of a record (e.g., `draft`, `published`, `pending_review`, `archived`).\n *\n * Defined behaviors:\n * - State-Based Filtering: Automatically prevents public users from seeing records in a draft state.\n * - State Transitions: In principle, the runtime should prevent the user from skipping some states.\n * For example, when the record is in the `draft` state, it cannot be moved to the `archived` state without publishing it first. However,\n * we do not have enough customer feedback to design this functionality correctly right now, so\n * it serves as a placeholder semantic annotation.\n */\n Status = 'Semantic#Status',\n\n /**\n * Annotates an integer field that automatically increments.\n * The runtime automatically increments this number on every update, providing a simple way\n * to track changes and implement optimistic locking to prevent mid-air collisions.\n */\n Version = 'Semantic#Version',\n\n /**\n * Annotates a field that holds a reference to an image data via an URL.\n * The application + runtime should validate that the input is a well-formed URL.\n */\n ImageURL = 'Semantic#ImageURL',\n\n /**\n * Annotates a field that holds a reference to a file object via an URL. Ity is distinct from the\n * `ImageURL` semantic as it implicitly states that the target is non-image, binary data (an attachment, for example).\n */\n FileURL = 'Semantic#FileURL',\n\n /**\n * Annotates the field as a markdown-interpreted field.\n * When an object is created, the runtime performs additional sanitization to prevent XSS attacks.\n *\n * The annotation describes whether the data should be translated to the HTML output when\n * record is read or the original MD content should be returned.\n */\n Markdown = 'Semantic#Markdown',\n\n /**\n * Annotates the field as containing HTML content.\n * The runtime performs sanitization to prevent XSS attacks and validates HTML structure.\n *\n * The annotation describes whether the data should be rendered as HTML output when\n * record is read or the original HTML content should be returned.\n */\n HTML = 'Semantic#HTML',\n\n /**\n * Annotates a field that holds geospatial coordinate data (latitude/longitude).\n * The runtime automatically generates API capabilities for location-based queries,\n * such as \"find all restaurants within a 5-mile radius.\"\n *\n * The field should contain coordinate data in a standard format:\n * - \"40.7128,-74.0060\" (lat,lon)\n * - \"POINT(-74.0060 40.7128)\" (PostGIS format)\n * - \"40.7128°N, 74.0060°W\" (degree format)\n *\n * Defined behaviors:\n * - Spatial Indexing: The runtime automatically creates spatial indexes for efficient location-based queries\n * - Distance Queries: Enables API endpoints for finding records within specified distances\n * - Coordinate Validation: Validates that the input follows proper coordinate format\n * - PostGIS Integration: When using PostgreSQL, automatically maps to PostGIS geometry types\n */\n GeospatialCoordinates = 'Semantic#GeospatialCoordinates',\n\n /**\n * Annotates a field as an email address with validation and verification options.\n */\n Email = 'Semantic#Email',\n /**\n * Annotates a field as a phone number with validation and formatting options.\n */\n Phone = 'Semantic#Phone',\n /**\n * Annotates a field as a monetary value with currency support and precision control.\n * Can store simple decimal amounts or complex objects with amount and currency.\n * Enforces proper decimal handling to avoid floating-point errors.\n */\n Price = 'Semantic#Price',\n /**\n * Annotates a field as a URL with validation and allowed protocols.\n */\n URL = 'Semantic#URL',\n /**\n * Annotates a field as a Stock Keeping Unit (SKU).\n * Enforces uniqueness at the database level, critical for product catalogs.\n * Provides automatic validation and formatting for product identification codes.\n */\n SKU = 'Semantic#SKU',\n /**\n * Annotates a field as a long-form description.\n */\n Description = 'Semantic#Description',\n /**\n * Annotates a field as a short summary.\n */\n Summary = 'Semantic#Summary',\n /**\n * Annotates a field as a calculated value based on a formula.\n */\n Calculated = 'Semantic#Calculated',\n /**\n * Annotates a field as derived from other fields.\n */\n Derived = 'Semantic#Derived',\n\n //\n // Association-Level Semantics\n //\n\n /**\n * Designates an association that links a resource to a \"User\" entity instance.\n * This is used to indicate ownership of the resource for access control purposes.\n * For example, a blog post might have a resource owner identifier that points to the user who created it.\n *\n * Defined behaviors:\n * - Automatic Ownership: When a new record is created, this field is automatically populated with the ID of the authenticated user. It also creates a foreign relationship to the `User` semantic object.\n * - Scoped Access: The runtime automatically filters list and read operations to show only records where the Owner matches the current user. update and delete operations are similarly restricted.\n */\n ResourceOwnerIdentifier = 'Semantic#ResourceOwnerIdentifier',\n /**\n * Annotates an association as supporting tag functionality.\n * Applied to associations between entities to enable tagging behavior.\n * For example, a Product-Category association with Tags semantic enables product tagging.\n */\n Tags = 'Semantic#Tags',\n /**\n * Annotates an association as supporting category functionality.\n * Applied to associations between entities to enable categorization behavior.\n * For example, a Product-Category association with Categories semantic enables product categorization.\n */\n Categories = 'Semantic#Categories',\n}\n\n/**\n * Defines the scope at which a semantic can be applied.\n */\nexport enum SemanticScope {\n /**\n * The semantic applies to an entire Data Entity.\n * This is used for semantics that provide context or constraints at the entity level.\n */\n Entity = 'Entity',\n /**\n * The semantic applies to a single Data Property.\n * This is used for semantics that provide context or constraints at the property level.\n */\n Property = 'Property',\n /**\n * The semantic applies to an Association between Data Entities.\n * This is used for semantics that provide context or constraints at the association level.\n */\n Association = 'Association',\n}\n\n/**\n * A base interface for all Data Semantics, containing common properties.\n * A semantic is an annotation applied to a Data Entity, Property, or Association\n * to provide additional context or constraints.\n * This interface is extended by more specific semantic types.\n */\ninterface BaseDataSemantic {\n /**\n * A unique identifier for the semantic definition.\n */\n id: SemanticType\n /**\n * A human-readable name for the semantic.\n */\n displayName: string\n /**\n * A description of the semantic's purpose and impact.\n */\n description: string\n /**\n * Specifies whether the semantic applies to an Entity, Property, or Association.\n */\n scope: SemanticScope\n}\n\n/**\n * Represents a semantic that can be applied to an entire Data Entity.\n */\nexport interface EntitySemantic extends BaseDataSemantic {\n scope: SemanticScope.Entity\n}\n\n/**\n * Represents a semantic that can be applied to a single property.\n */\nexport interface PropertySemantic extends BaseDataSemantic {\n scope: SemanticScope.Property\n /**\n * Optional array of data types this semantic can be applied to.\n * Enforces constraints, e.g., DeletedTimestamp on a DateTime property.\n */\n applicableDataTypes?: DomainPropertyType[]\n}\n\n/**\n * Represents a semantic that can be applied to an association between entities.\n */\nexport interface AssociationSemantic extends BaseDataSemantic {\n scope: SemanticScope.Association\n}\n\n/**\n * A type guard to check if a semantic is an EntitySemantic.\n */\nexport const isEntitySemantic = (semantic: DataSemantic): semantic is EntitySemantic =>\n semantic.scope === SemanticScope.Entity\n\n/**\n * A type guard to check if a semantic is a PropertySemantic.\n */\nexport const isPropertySemantic = (semantic: DataSemantic): semantic is PropertySemantic =>\n semantic.scope === SemanticScope.Property\n\n/**\n * A type guard to check if a semantic is a AssociationSemantic.\n */\nexport const isAssociationSemantic = (semantic: DataSemantic): semantic is AssociationSemantic =>\n semantic.scope === SemanticScope.Association\n\n/**\n * Union type for any kind of data semantic\n */\nexport type DataSemantic = EntitySemantic | PropertySemantic | AssociationSemantic\n\n/**\n * A map to store the definitions of all available data semantics.\n * This acts as a central registry for the application.\n */\nexport const DataSemantics: Record<SemanticType, DataSemantic> = {\n //\n // Entity-Level Definitions\n //\n\n [SemanticType.User]: {\n id: SemanticType.User,\n displayName: 'User Entity',\n scope: SemanticScope.Entity,\n description: 'Designates an entity that represents system users, crucial for authentication and authorization.',\n },\n\n //\n // Property-Level Definitions\n //\n\n [SemanticType.Password]: {\n id: SemanticType.Password,\n displayName: 'User Password',\n scope: SemanticScope.Property,\n description:\n 'Annotates the field as the user password. The runtime should treat this field with special care, ensuring it is encrypted and not exposed in API responses.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.CreatedTimestamp]: {\n id: SemanticType.CreatedTimestamp,\n displayName: 'Creation Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the one that contains the object's creation timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.UpdatedTimestamp]: {\n id: SemanticType.UpdatedTimestamp,\n displayName: 'Update Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the field that contains object's last modification timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.DeletedTimestamp]: {\n id: SemanticType.DeletedTimestamp,\n displayName: 'Soft Delete Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the field that contains object's deletion timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.PublicUniqueName]: {\n id: SemanticType.PublicUniqueName,\n displayName: 'Public Unique Name (Slug)',\n scope: SemanticScope.Property,\n description: 'A user-friendly, unique public identifier for a resource, often used in URLs.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Title]: {\n id: SemanticType.Title,\n displayName: 'Record Title',\n scope: SemanticScope.Property,\n description: 'A title for the record. Used as a source for the PublicUniqueName semantic.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.UserRole]: {\n id: SemanticType.UserRole,\n displayName: 'User Role Field',\n scope: SemanticScope.Property,\n description: \"A text or enum field that defines the user's role for role-based authorization.\",\n applicableDataTypes: ['string'],\n },\n [SemanticType.Status]: {\n id: SemanticType.Status,\n displayName: 'Record Status',\n scope: SemanticScope.Property,\n description: 'A text or enum field to represent the state of a record.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Version]: {\n id: SemanticType.Version,\n displayName: 'Version Number',\n scope: SemanticScope.Property,\n description: 'An integer field that automatically increments on every update.',\n applicableDataTypes: ['number'],\n },\n [SemanticType.ImageURL]: {\n id: SemanticType.ImageURL,\n displayName: 'Image URL',\n scope: SemanticScope.Property,\n description: 'Annotates a field that holds a reference to an image data via an URL.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.FileURL]: {\n id: SemanticType.FileURL,\n displayName: 'File URL',\n scope: SemanticScope.Property,\n description: 'Annotates a field that holds a reference to a file object via an URL (non-image binary data).',\n applicableDataTypes: ['string'],\n },\n [SemanticType.DeletedFlag]: {\n id: SemanticType.DeletedFlag,\n displayName: 'Soft Delete Flag',\n scope: SemanticScope.Property,\n description: 'A boolean property that marks the object as deleted without physically removing it.',\n applicableDataTypes: ['boolean'],\n },\n [SemanticType.Markdown]: {\n id: SemanticType.Markdown,\n displayName: 'Markdown Content',\n scope: SemanticScope.Property,\n description: 'A text field that contains markdown content.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.HTML]: {\n id: SemanticType.HTML,\n displayName: 'HTML Content',\n scope: SemanticScope.Property,\n description: 'Annotates a field that contains HTML content.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.GeospatialCoordinates]: {\n id: SemanticType.GeospatialCoordinates,\n displayName: 'Geospatial Coordinates',\n scope: SemanticScope.Property,\n description: 'Annotates a field that holds geospatial coordinate data (latitude/longitude).',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Email]: {\n id: SemanticType.Email,\n displayName: 'Email',\n scope: SemanticScope.Property,\n description: 'Annotates a field as an email address with validation and verification options.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Phone]: {\n id: SemanticType.Phone,\n displayName: 'Phone',\n scope: SemanticScope.Property,\n description: 'Annotates a field as a phone number with validation and formatting options.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Price]: {\n id: SemanticType.Price,\n displayName: 'Price',\n scope: SemanticScope.Property,\n description: 'Annotates a field as a monetary value with currency support and precision control.',\n applicableDataTypes: ['number', 'string'],\n },\n [SemanticType.URL]: {\n id: SemanticType.URL,\n displayName: 'URL',\n scope: SemanticScope.Property,\n description: 'Annotates a field as a URL with validation and allowed protocols.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.SKU]: {\n id: SemanticType.SKU,\n displayName: 'SKU',\n scope: SemanticScope.Property,\n description:\n 'Annotates a field as a Stock Keeping Unit (SKU). Enforces uniqueness at the database level, critical for product catalogs. Provides automatic validation and formatting for product identification codes.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Description]: {\n id: SemanticType.Description,\n displayName: 'Description',\n scope: SemanticScope.Property,\n description: 'Annotates a field as a long-form description.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Summary]: {\n id: SemanticType.Summary,\n displayName: 'Summary',\n scope: SemanticScope.Property,\n description: 'Annotates a field as a short summary.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Calculated]: {\n id: SemanticType.Calculated,\n displayName: 'Calculated',\n scope: SemanticScope.Property,\n description: 'Annotates a field as a calculated value based on a formula.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.Derived]: {\n id: SemanticType.Derived,\n displayName: 'Derived',\n scope: SemanticScope.Property,\n description: 'Annotates a field as derived from other fields.',\n applicableDataTypes: ['string'],\n },\n\n //\n // Association-Level Definitions\n //\n\n [SemanticType.ResourceOwnerIdentifier]: {\n id: SemanticType.ResourceOwnerIdentifier,\n displayName: 'Resource Owner Identifier',\n scope: SemanticScope.Association,\n description: 'Links a resource to a \"User\" entity instance, indicating ownership for access control.',\n },\n [SemanticType.Tags]: {\n id: SemanticType.Tags,\n displayName: 'Tags',\n scope: SemanticScope.Association,\n description: 'Annotates an association as supporting tag functionality.',\n },\n [SemanticType.Categories]: {\n id: SemanticType.Categories,\n displayName: 'Categories',\n scope: SemanticScope.Association,\n description: 'Annotates an association as supporting category functionality.',\n },\n}\n\n/**\n * Represents the application of a data semantic to a specific\n * entity or property within a user's data model.\n */\nexport interface AppliedDataSemantic {\n /**\n * The unique identifier of the semantic being applied.\n */\n id: SemanticType\n\n /**\n * Optional configuration or values specific to this application.\n */\n config?: Record<string, unknown>\n}\n"]}
@@ -0,0 +1,54 @@
1
+ import type { AppliedDataSemantic } from '../Semantics.js';
2
+ import { SemanticType } from '../Semantics.js';
3
+ /**
4
+ * Configuration options for the Calculated semantic.
5
+ * Controls formula, dependencies, and recalculation behavior.
6
+ *
7
+ * Use Calculated when you need mathematical operations, aggregations, or complex business logic.
8
+ */
9
+ export interface CalculatedConfig {
10
+ /**
11
+ * Formula to calculate the value (e.g., 'price * quantity').
12
+ */
13
+ formula: string;
14
+ /**
15
+ * List of field names this calculation depends on.
16
+ */
17
+ dependencies?: string[];
18
+ /**
19
+ * Whether to recalculate the value on update (default: true).
20
+ */
21
+ recalculateOnUpdate?: boolean;
22
+ /**
23
+ * Whether to allow manual override of the calculated value.
24
+ */
25
+ allowManualOverride?: boolean;
26
+ /**
27
+ * Custom metadata for the calculated field.
28
+ */
29
+ metadata?: Record<string, unknown>;
30
+ /**
31
+ * Index signature to allow additional properties.
32
+ */
33
+ [key: string]: unknown;
34
+ }
35
+ /**
36
+ * Type-safe configuration for Calculated semantic.
37
+ */
38
+ export interface AppliedCalculatedSemantic extends AppliedDataSemantic {
39
+ id: SemanticType.Calculated;
40
+ config?: CalculatedConfig;
41
+ }
42
+ /**
43
+ * Type guard to check if a semantic is a Calculated semantic.
44
+ */
45
+ export declare const isCalculatedSemantic: (semantic: AppliedDataSemantic) => semantic is AppliedCalculatedSemantic;
46
+ /**
47
+ * Helper function to create a Calculated semantic with configuration.
48
+ */
49
+ export declare const createCalculatedSemantic: (config: CalculatedConfig) => AppliedCalculatedSemantic;
50
+ /**
51
+ * Default configuration for Calculated semantic.
52
+ */
53
+ export declare const DEFAULT_CALCULATED_CONFIG: Partial<CalculatedConfig>;
54
+ //# sourceMappingURL=Calculated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calculated.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Calculated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,EAAE,EAAE,YAAY,CAAC,UAAU,CAAA;IAC3B,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,yBAEhF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,gBAAgB,KAAG,yBAanE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAAC,gBAAgB,CAG/D,CAAA"}
@@ -0,0 +1,31 @@
1
+ import { SemanticType } from '../Semantics.js';
2
+ /**
3
+ * Type guard to check if a semantic is a Calculated semantic.
4
+ */
5
+ export const isCalculatedSemantic = (semantic) => {
6
+ return semantic.id === SemanticType.Calculated;
7
+ };
8
+ /**
9
+ * Helper function to create a Calculated semantic with configuration.
10
+ */
11
+ export const createCalculatedSemantic = (config) => {
12
+ const mergedConfig = {
13
+ ...DEFAULT_CALCULATED_CONFIG,
14
+ ...config,
15
+ };
16
+ if (config.metadata) {
17
+ mergedConfig.metadata = { ...config.metadata };
18
+ }
19
+ return {
20
+ id: SemanticType.Calculated,
21
+ config: mergedConfig,
22
+ };
23
+ };
24
+ /**
25
+ * Default configuration for Calculated semantic.
26
+ */
27
+ export const DEFAULT_CALCULATED_CONFIG = {
28
+ recalculateOnUpdate: true,
29
+ allowManualOverride: false,
30
+ };
31
+ //# sourceMappingURL=Calculated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calculated.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Calculated.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AA2C9C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,QAA6B,EAAyC,EAAE;IAC3G,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,UAAU,CAAA;AAChD,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAwB,EAA6B,EAAE;IAC9F,MAAM,YAAY,GAAG;QACnB,GAAG,yBAAyB;QAC5B,GAAG,MAAM;KACV,CAAA;IACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,UAAU;QAC3B,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA8B;IAClE,mBAAmB,EAAE,IAAI;IACzB,mBAAmB,EAAE,KAAK;CAC3B,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Configuration options for the Calculated semantic.\n * Controls formula, dependencies, and recalculation behavior.\n *\n * Use Calculated when you need mathematical operations, aggregations, or complex business logic.\n */\nexport interface CalculatedConfig {\n /**\n * Formula to calculate the value (e.g., 'price * quantity').\n */\n formula: string\n /**\n * List of field names this calculation depends on.\n */\n dependencies?: string[]\n /**\n * Whether to recalculate the value on update (default: true).\n */\n recalculateOnUpdate?: boolean\n /**\n * Whether to allow manual override of the calculated value.\n */\n allowManualOverride?: boolean\n /**\n * Custom metadata for the calculated field.\n */\n metadata?: Record<string, unknown>\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for Calculated semantic.\n */\nexport interface AppliedCalculatedSemantic extends AppliedDataSemantic {\n id: SemanticType.Calculated\n config?: CalculatedConfig\n}\n\n/**\n * Type guard to check if a semantic is a Calculated semantic.\n */\nexport const isCalculatedSemantic = (semantic: AppliedDataSemantic): semantic is AppliedCalculatedSemantic => {\n return semantic.id === SemanticType.Calculated\n}\n\n/**\n * Helper function to create a Calculated semantic with configuration.\n */\nexport const createCalculatedSemantic = (config: CalculatedConfig): AppliedCalculatedSemantic => {\n const mergedConfig = {\n ...DEFAULT_CALCULATED_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.Calculated,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for Calculated semantic.\n */\nexport const DEFAULT_CALCULATED_CONFIG: Partial<CalculatedConfig> = {\n recalculateOnUpdate: true,\n allowManualOverride: false,\n}\n"]}
@@ -0,0 +1,60 @@
1
+ import type { AppliedDataSemantic } from '../Semantics.js';
2
+ import { SemanticType } from '../Semantics.js';
3
+ /**
4
+ * Configuration options for the Categories semantic.
5
+ * Controls allowed categories, hierarchy, and formatting for associations.
6
+ */
7
+ export interface CategoriesConfig {
8
+ /**
9
+ * List of allowed categories.
10
+ */
11
+ allowedCategories?: string[];
12
+ /**
13
+ * Whether to allow custom categories not in the allowedCategories list.
14
+ */
15
+ allowCustomCategories?: boolean;
16
+ /**
17
+ * Whether to allow hierarchical categories (tree structure).
18
+ */
19
+ allowHierarchy?: boolean;
20
+ /**
21
+ * Maximum depth of the category hierarchy.
22
+ */
23
+ maxDepth?: number;
24
+ /**
25
+ * Whether categories are case sensitive.
26
+ */
27
+ caseSensitive?: boolean;
28
+ /**
29
+ * Whether to allow Unicode characters in categories.
30
+ */
31
+ allowUnicode?: boolean;
32
+ /**
33
+ * Custom metadata for the categories association.
34
+ */
35
+ metadata?: Record<string, unknown>;
36
+ /**
37
+ * Index signature to allow additional properties.
38
+ */
39
+ [key: string]: unknown;
40
+ }
41
+ /**
42
+ * Type-safe configuration for Categories semantic.
43
+ */
44
+ export interface AppliedCategoriesSemantic extends AppliedDataSemantic {
45
+ id: SemanticType.Categories;
46
+ config?: CategoriesConfig;
47
+ }
48
+ /**
49
+ * Type guard to check if a semantic is a Categories semantic.
50
+ */
51
+ export declare const isCategoriesSemantic: (semantic: AppliedDataSemantic) => semantic is AppliedCategoriesSemantic;
52
+ /**
53
+ * Helper function to create a Categories semantic with configuration.
54
+ */
55
+ export declare const createCategoriesSemantic: (config?: CategoriesConfig) => AppliedCategoriesSemantic;
56
+ /**
57
+ * Default configuration for Categories semantic.
58
+ */
59
+ export declare const DEFAULT_CATEGORIES_CONFIG: CategoriesConfig;
60
+ //# sourceMappingURL=Categories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Categories.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Categories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,EAAE,EAAE,YAAY,CAAC,UAAU,CAAA;IAC3B,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,yBAEhF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAQ,gBAAqB,KAAG,yBAaxE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,gBAKvC,CAAA"}