@api-client/core 0.17.4 → 0.17.6

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 (64) hide show
  1. package/build/src/modeling/Semantics.d.ts +9 -5
  2. package/build/src/modeling/Semantics.d.ts.map +1 -1
  3. package/build/src/modeling/Semantics.js +14 -10
  4. package/build/src/modeling/Semantics.js.map +1 -1
  5. package/build/src/modeling/definitions/{Price.d.ts → Currency.d.ts} +24 -24
  6. package/build/src/modeling/definitions/Currency.d.ts.map +1 -0
  7. package/build/src/modeling/definitions/{Price.js → Currency.js} +18 -18
  8. package/build/src/modeling/definitions/Currency.js.map +1 -0
  9. package/build/src/modeling/definitions/Email.d.ts +2 -2
  10. package/build/src/modeling/definitions/Email.d.ts.map +1 -1
  11. package/build/src/modeling/definitions/Email.js.map +1 -1
  12. package/build/src/modeling/definitions/GeospatialCoordinates.d.ts +46 -1
  13. package/build/src/modeling/definitions/GeospatialCoordinates.d.ts.map +1 -1
  14. package/build/src/modeling/definitions/GeospatialCoordinates.js.map +1 -1
  15. package/build/src/modeling/definitions/HTML.d.ts +17 -4
  16. package/build/src/modeling/definitions/HTML.d.ts.map +1 -1
  17. package/build/src/modeling/definitions/HTML.js +0 -1
  18. package/build/src/modeling/definitions/HTML.js.map +1 -1
  19. package/build/src/modeling/definitions/Markdown.d.ts +12 -4
  20. package/build/src/modeling/definitions/Markdown.d.ts.map +1 -1
  21. package/build/src/modeling/definitions/Markdown.js +0 -1
  22. package/build/src/modeling/definitions/Markdown.js.map +1 -1
  23. package/build/src/modeling/definitions/Phone.d.ts +5 -7
  24. package/build/src/modeling/definitions/Phone.d.ts.map +1 -1
  25. package/build/src/modeling/definitions/Phone.js +2 -2
  26. package/build/src/modeling/definitions/Phone.js.map +1 -1
  27. package/build/src/modeling/definitions/PublicUniqueName.d.ts +1 -9
  28. package/build/src/modeling/definitions/PublicUniqueName.d.ts.map +1 -1
  29. package/build/src/modeling/definitions/PublicUniqueName.js +0 -1
  30. package/build/src/modeling/definitions/PublicUniqueName.js.map +1 -1
  31. package/build/src/modeling/definitions/SKU.d.ts +4 -1
  32. package/build/src/modeling/definitions/SKU.d.ts.map +1 -1
  33. package/build/src/modeling/definitions/SKU.js.map +1 -1
  34. package/build/src/modeling/definitions/Status.d.ts +1 -1
  35. package/build/src/modeling/definitions/Status.d.ts.map +1 -1
  36. package/build/src/modeling/definitions/Status.js +1 -0
  37. package/build/src/modeling/definitions/Status.js.map +1 -1
  38. package/build/src/modeling/definitions/URL.d.ts +1 -4
  39. package/build/src/modeling/definitions/URL.d.ts.map +1 -1
  40. package/build/src/modeling/definitions/URL.js +0 -1
  41. package/build/src/modeling/definitions/URL.js.map +1 -1
  42. package/build/tsconfig.tsbuildinfo +1 -1
  43. package/data/models/example-generator-api.json +10 -10
  44. package/package.json +1 -1
  45. package/src/modeling/Semantics.ts +14 -10
  46. package/src/modeling/definitions/{Price.examples.md → Currency.examples.md} +12 -12
  47. package/src/modeling/definitions/{Price.ts → Currency.ts} +26 -26
  48. package/src/modeling/definitions/Email.ts +2 -2
  49. package/src/modeling/definitions/GeospatialCoordinates.ts +46 -1
  50. package/src/modeling/definitions/HTML.ts +17 -5
  51. package/src/modeling/definitions/Markdown.ts +12 -5
  52. package/src/modeling/definitions/Phone.ts +6 -8
  53. package/src/modeling/definitions/PublicUniqueName.ts +1 -10
  54. package/src/modeling/definitions/SKU.ts +4 -1
  55. package/src/modeling/definitions/Status.ts +2 -1
  56. package/src/modeling/definitions/URL.ts +1 -5
  57. package/tests/unit/modeling/definitions/{price.spec.ts → currency.spec.ts} +114 -114
  58. package/tests/unit/modeling/definitions/derived.spec.ts +1 -2
  59. package/tests/unit/modeling/definitions/description.spec.ts +0 -2
  60. package/tests/unit/modeling/definitions/url.spec.ts +0 -1
  61. package/tests/unit/modeling/semantic-configs.spec.ts +45 -46
  62. package/tests/unit/modeling/semantics.spec.ts +10 -1
  63. package/build/src/modeling/definitions/Price.d.ts.map +0 -1
  64. package/build/src/modeling/definitions/Price.js.map +0 -1
@@ -42810,6 +42810,9 @@
42810
42810
  "@id": "#219"
42811
42811
  },
42812
42812
  {
42813
+ "@id": "#219"
42814
+ },
42815
+ {
42813
42816
  "@id": "#210"
42814
42817
  },
42815
42818
  {
@@ -42817,9 +42820,6 @@
42817
42820
  },
42818
42821
  {
42819
42822
  "@id": "#216"
42820
- },
42821
- {
42822
- "@id": "#219"
42823
42823
  }
42824
42824
  ],
42825
42825
  "doc:root": false,
@@ -44232,7 +44232,7 @@
44232
44232
  "doc:ExternalDomainElement",
44233
44233
  "doc:DomainElement"
44234
44234
  ],
44235
- "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
44235
+ "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
44236
44236
  "core:mediaType": "application/yaml",
44237
44237
  "sourcemaps:sources": [
44238
44238
  {
@@ -44253,7 +44253,7 @@
44253
44253
  "doc:ExternalDomainElement",
44254
44254
  "doc:DomainElement"
44255
44255
  ],
44256
- "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
44256
+ "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
44257
44257
  "core:mediaType": "application/yaml",
44258
44258
  "sourcemaps:sources": [
44259
44259
  {
@@ -44274,7 +44274,7 @@
44274
44274
  "doc:ExternalDomainElement",
44275
44275
  "doc:DomainElement"
44276
44276
  ],
44277
- "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
44277
+ "doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
44278
44278
  "core:mediaType": "application/yaml",
44279
44279
  "sourcemaps:sources": [
44280
44280
  {
@@ -44295,7 +44295,7 @@
44295
44295
  "doc:ExternalDomainElement",
44296
44296
  "doc:DomainElement"
44297
44297
  ],
44298
- "doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
44298
+ "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
44299
44299
  "core:mediaType": "application/yaml",
44300
44300
  "sourcemaps:sources": [
44301
44301
  {
@@ -45121,17 +45121,17 @@
45121
45121
  {
45122
45122
  "@id": "#215/source-map/lexical/element_0",
45123
45123
  "sourcemaps:element": "amf://id#215",
45124
- "sourcemaps:value": "[(1,0)-(6,0)]"
45124
+ "sourcemaps:value": "[(1,0)-(7,0)]"
45125
45125
  },
45126
45126
  {
45127
45127
  "@id": "#218/source-map/lexical/element_0",
45128
45128
  "sourcemaps:element": "amf://id#218",
45129
- "sourcemaps:value": "[(1,0)-(7,0)]"
45129
+ "sourcemaps:value": "[(1,0)-(3,0)]"
45130
45130
  },
45131
45131
  {
45132
45132
  "@id": "#221/source-map/lexical/element_0",
45133
45133
  "sourcemaps:element": "amf://id#221",
45134
- "sourcemaps:value": "[(1,0)-(3,0)]"
45134
+ "sourcemaps:value": "[(1,0)-(6,0)]"
45135
45135
  },
45136
45136
  {
45137
45137
  "@id": "#338/source-map/synthesized-field/element_1",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
3
  "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.17.4",
4
+ "version": "0.17.6",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -50,11 +50,12 @@ export enum SemanticType {
50
50
  */
51
51
  DeletedFlag = 'Semantic#DeletedFlag',
52
52
  /**
53
- * Designates a Data Property as a unique public identifier for a resource (the slug).
53
+ * Designates a Data Property as a public identifier for a resource (the slug).
54
54
  * This is often used in URLs to provide a user-friendly way to access the resource.
55
55
  * For example, a blog post might have a public unique name like "my-first-post".
56
- * 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
57
- * the slug.
56
+ * The runtime automatically generates a URL-safe string from another field (like a title).
57
+ * By default, slugs are generated to be unique, but the configuration allows for duplicates
58
+ * in scenarios where uniqueness is handled by a combination of fields (e.g., year and slug).
58
59
  */
59
60
  PublicUniqueName = 'Semantic#PublicUniqueName',
60
61
  /**
@@ -149,9 +150,12 @@ export enum SemanticType {
149
150
  /**
150
151
  * Annotates a field as a monetary value with currency support and precision control.
151
152
  * Can store simple decimal amounts or complex objects with amount and currency.
152
- * Enforces proper decimal handling to avoid floating-point errors.
153
+ *
154
+ * As a semantic, it provides flexibility by annotating a base `number` or `string` type,
155
+ * allowing for different storage strategies (e.g., decimal, integer cents, or a JSON object)
156
+ * while maintaining a consistent API for currency operations.
153
157
  */
154
- Price = 'Semantic#Price',
158
+ Currency = 'Semantic#Currency',
155
159
  /**
156
160
  * Annotates a field as a URL with validation and allowed protocols.
157
161
  */
@@ -463,7 +467,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
463
467
  description: 'Detailed description text',
464
468
  category: SemanticCategory.Content,
465
469
  applicableDataTypes: ['string'],
466
- hasConfig: true,
470
+ hasConfig: false,
467
471
  },
468
472
  [SemanticType.Summary]: {
469
473
  id: SemanticType.Summary,
@@ -472,7 +476,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
472
476
  description: 'Brief summary text',
473
477
  category: SemanticCategory.Content,
474
478
  applicableDataTypes: ['string'],
475
- hasConfig: true,
479
+ hasConfig: false,
476
480
  },
477
481
  [SemanticType.Markdown]: {
478
482
  id: SemanticType.Markdown,
@@ -524,9 +528,9 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
524
528
  applicableDataTypes: ['string'],
525
529
  hasConfig: true,
526
530
  },
527
- [SemanticType.Price]: {
528
- id: SemanticType.Price,
529
- displayName: 'Price',
531
+ [SemanticType.Currency]: {
532
+ id: SemanticType.Currency,
533
+ displayName: 'Currency',
530
534
  scope: SemanticScope.Property,
531
535
  description: 'Monetary value with currency',
532
536
  category: SemanticCategory.Business,
@@ -1,14 +1,14 @@
1
- # Price Semantic Examples
1
+ # Currency Semantic Examples
2
2
 
3
- This document provides examples of how to use the Price semantic with different configurations.
3
+ This document provides examples of how to use the Currency semantic with different configurations.
4
4
 
5
5
  ## Basic Usage
6
6
 
7
7
  ```typescript
8
- import { createPriceSemantic, PRICE_PRESETS } from './Price.js'
8
+ import { createCurrencySemantic, CURRENCY_PRESETS } from './Currency.js'
9
9
 
10
10
  // Simple USD decimal storage
11
- const basicPrice = createPriceSemantic({
11
+ const basicCurrency = createCurrencySemantic({
12
12
  storageFormat: 'decimal',
13
13
  defaultCurrency: 'USD',
14
14
  decimalPlaces: 2,
@@ -16,7 +16,7 @@ const basicPrice = createPriceSemantic({
16
16
  })
17
17
 
18
18
  // Using a preset
19
- const usdDecimal = PRICE_PRESETS.USD_DECIMAL
19
+ const usdDecimal = CURRENCY_PRESETS.USD_DECIMAL
20
20
  ```
21
21
 
22
22
  ## Configuration Examples
@@ -24,7 +24,7 @@ const usdDecimal = PRICE_PRESETS.USD_DECIMAL
24
24
  ### 1. Simple E-commerce Store (USD only)
25
25
 
26
26
  ```typescript
27
- const ecommercePrice = createPriceSemantic({
27
+ const ecommerceCurrency = createCurrencySemantic({
28
28
  storageFormat: 'decimal',
29
29
  defaultCurrency: 'USD',
30
30
  decimalPlaces: 2,
@@ -35,7 +35,7 @@ const ecommercePrice = createPriceSemantic({
35
35
  ### 2. International E-commerce (Multi-currency)
36
36
 
37
37
  ```typescript
38
- const internationalPrice = createPriceSemantic({
38
+ const internationalCurrency = createCurrencySemantic({
39
39
  storageFormat: 'complex_object',
40
40
  allowedCurrencies: ['USD', 'EUR', 'GBP', 'JPY', 'CAD', 'AUD'],
41
41
  decimalPlaces: 2,
@@ -46,7 +46,7 @@ const internationalPrice = createPriceSemantic({
46
46
  ### 3. Financial System (High precision, allows negatives)
47
47
 
48
48
  ```typescript
49
- const financialPrice = createPriceSemantic({
49
+ const financialCurrency = createCurrencySemantic({
50
50
  storageFormat: 'integer_cents',
51
51
  defaultCurrency: 'USD',
52
52
  decimalPlaces: 4,
@@ -57,7 +57,7 @@ const financialPrice = createPriceSemantic({
57
57
  ### 4. Cryptocurrency Trading
58
58
 
59
59
  ```typescript
60
- const cryptoPrice = createPriceSemantic({
60
+ const cryptoCurrency = createCurrencySemantic({
61
61
  storageFormat: 'decimal',
62
62
  defaultCurrency: 'BTC',
63
63
  decimalPlaces: 8,
@@ -142,10 +142,10 @@ CREATE INDEX idx_products_price_currency ON products USING GIN ((price->>'curren
142
142
 
143
143
  ## Validation Examples
144
144
 
145
- The Price semantic includes built-in validation:
145
+ The Currency semantic includes built-in validation:
146
146
 
147
147
  ```typescript
148
- import { validatePriceConfig } from './Price.js'
148
+ import { validateCurrencyConfig } from './Currency.js'
149
149
 
150
150
  const config = {
151
151
  storageFormat: 'decimal' as const,
@@ -153,6 +153,6 @@ const config = {
153
153
  decimalPlaces: 2,
154
154
  }
155
155
 
156
- const errors = validatePriceConfig(config)
156
+ const errors = validateCurrencyConfig(config)
157
157
  console.log(errors) // ['defaultCurrency is required when storageFormat is not complex_object']
158
158
  ```
@@ -4,13 +4,13 @@ import { SemanticType } from '../Semantics.js'
4
4
  /**
5
5
  * Supported storage formats for monetary values.
6
6
  */
7
- export type PriceStorageFormat = 'decimal' | 'integer_cents' | 'complex_object'
7
+ export type CurrencyStorageFormat = 'decimal' | 'integer_cents' | 'complex_object'
8
8
 
9
9
  /**
10
- * Configuration options for the Price semantic.
10
+ * Configuration options for the Currency semantic.
11
11
  * Controls monetary value storage, validation, currency handling, and precision.
12
12
  */
13
- export interface PriceConfig {
13
+ export interface CurrencyConfig {
14
14
  /**
15
15
  * How the monetary value is stored in the database.
16
16
  *
@@ -18,7 +18,7 @@ export interface PriceConfig {
18
18
  * - 'integer_cents': Store as INTEGER in smallest currency unit (e.g., 1999 for $19.99)
19
19
  * - 'complex_object': Store as JSON/JSONB with amount and currency (e.g., {"amount": 1999, "currency": "USD"})
20
20
  */
21
- storageFormat?: PriceStorageFormat
21
+ storageFormat?: CurrencyStorageFormat
22
22
 
23
23
  /**
24
24
  * Default currency code (ISO 4217) when not specified.
@@ -50,7 +50,7 @@ export interface PriceConfig {
50
50
  validateCurrencyCode?: boolean
51
51
 
52
52
  /**
53
- * Custom metadata for the price field.
53
+ * Custom metadata for the currency field.
54
54
  */
55
55
  metadata?: Record<string, unknown>
56
56
 
@@ -61,26 +61,26 @@ export interface PriceConfig {
61
61
  }
62
62
 
63
63
  /**
64
- * Type-safe configuration for Price semantic.
64
+ * Type-safe configuration for Currency semantic.
65
65
  */
66
- export interface AppliedPriceSemantic extends AppliedDataSemantic {
67
- id: SemanticType.Price
68
- config?: PriceConfig
66
+ export interface AppliedCurrencySemantic extends AppliedDataSemantic {
67
+ id: SemanticType.Currency
68
+ config?: CurrencyConfig
69
69
  }
70
70
 
71
71
  /**
72
- * Type guard to check if a semantic is a Price semantic.
72
+ * Type guard to check if a semantic is a Currency semantic.
73
73
  */
74
- export const isPriceSemantic = (semantic: AppliedDataSemantic): semantic is AppliedPriceSemantic => {
75
- return semantic.id === SemanticType.Price
74
+ export const isCurrencySemantic = (semantic: AppliedDataSemantic): semantic is AppliedCurrencySemantic => {
75
+ return semantic.id === SemanticType.Currency
76
76
  }
77
77
 
78
78
  /**
79
- * Helper function to create a Price semantic with configuration.
79
+ * Helper function to create a Currency semantic with configuration.
80
80
  */
81
- export const createPriceSemantic = (config: PriceConfig = {}): AppliedPriceSemantic => {
81
+ export const createCurrencySemantic = (config: CurrencyConfig = {}): AppliedCurrencySemantic => {
82
82
  const mergedConfig = {
83
- ...DEFAULT_PRICE_CONFIG,
83
+ ...DEFAULT_CURRENCY_CONFIG,
84
84
  ...config,
85
85
  }
86
86
 
@@ -90,16 +90,16 @@ export const createPriceSemantic = (config: PriceConfig = {}): AppliedPriceSeman
90
90
  }
91
91
 
92
92
  return {
93
- id: SemanticType.Price,
93
+ id: SemanticType.Currency,
94
94
  config: mergedConfig,
95
95
  }
96
96
  }
97
97
 
98
98
  /**
99
- * Default configuration for Price semantic.
99
+ * Default configuration for Currency semantic.
100
100
  * Optimized for common e-commerce use cases with USD currency.
101
101
  */
102
- export const DEFAULT_PRICE_CONFIG: PriceConfig = {
102
+ export const DEFAULT_CURRENCY_CONFIG: CurrencyConfig = {
103
103
  storageFormat: 'decimal',
104
104
  defaultCurrency: 'USD',
105
105
  decimalPlaces: 2,
@@ -110,11 +110,11 @@ export const DEFAULT_PRICE_CONFIG: PriceConfig = {
110
110
  /**
111
111
  * Predefined configurations for common use cases.
112
112
  */
113
- export const PRICE_PRESETS = {
113
+ export const CURRENCY_PRESETS = {
114
114
  /**
115
115
  * Simple USD decimal storage - good for most e-commerce sites.
116
116
  */
117
- USD_DECIMAL: createPriceSemantic({
117
+ USD_DECIMAL: createCurrencySemantic({
118
118
  storageFormat: 'decimal',
119
119
  defaultCurrency: 'USD',
120
120
  decimalPlaces: 2,
@@ -124,7 +124,7 @@ export const PRICE_PRESETS = {
124
124
  /**
125
125
  * Integer cents storage - avoids floating point issues, good for financial calculations.
126
126
  */
127
- USD_CENTS: createPriceSemantic({
127
+ USD_CENTS: createCurrencySemantic({
128
128
  storageFormat: 'integer_cents',
129
129
  defaultCurrency: 'USD',
130
130
  decimalPlaces: 2,
@@ -134,7 +134,7 @@ export const PRICE_PRESETS = {
134
134
  /**
135
135
  * Multi-currency support with complex object storage.
136
136
  */
137
- MULTI_CURRENCY: createPriceSemantic({
137
+ MULTI_CURRENCY: createCurrencySemantic({
138
138
  storageFormat: 'complex_object',
139
139
  allowedCurrencies: ['USD', 'EUR', 'GBP', 'JPY', 'CAD'],
140
140
  decimalPlaces: 2,
@@ -144,7 +144,7 @@ export const PRICE_PRESETS = {
144
144
  /**
145
145
  * Configuration that allows negative values for refunds, discounts, etc.
146
146
  */
147
- WITH_NEGATIVES: createPriceSemantic({
147
+ WITH_NEGATIVES: createCurrencySemantic({
148
148
  storageFormat: 'decimal',
149
149
  defaultCurrency: 'USD',
150
150
  decimalPlaces: 2,
@@ -154,7 +154,7 @@ export const PRICE_PRESETS = {
154
154
  /**
155
155
  * High-precision configuration for cryptocurrency or precious metals.
156
156
  */
157
- HIGH_PRECISION: createPriceSemantic({
157
+ HIGH_PRECISION: createCurrencySemantic({
158
158
  storageFormat: 'decimal',
159
159
  defaultCurrency: 'BTC',
160
160
  decimalPlaces: 8,
@@ -163,9 +163,9 @@ export const PRICE_PRESETS = {
163
163
  } as const
164
164
 
165
165
  /**
166
- * Helper function to validate a price configuration.
166
+ * Helper function to validate a currency configuration.
167
167
  */
168
- export const validatePriceConfig = (config: PriceConfig): string[] => {
168
+ export const validateCurrencyConfig = (config: CurrencyConfig): string[] => {
169
169
  const errors: string[] = []
170
170
 
171
171
  if (config.storageFormat !== 'complex_object' && !config.defaultCurrency) {
@@ -15,9 +15,9 @@ export interface EmailConfig {
15
15
  */
16
16
  requireVerification?: boolean
17
17
  /**
18
- * Method to use for verification: 'email', 'sms', or 'none'.
18
+ * Method to use for verification: 'email' or 'sms'.
19
19
  */
20
- verificationMethod?: 'email' | 'sms' | 'none'
20
+ verificationMethod?: 'email' | 'sms'
21
21
  /**
22
22
  * Whether to allow subaddressing (user+tag@domain.com).
23
23
  */
@@ -97,12 +97,16 @@ export interface GeospatialCoordinatesConfig {
97
97
  /**
98
98
  * The spatial reference system (SRS) for the coordinates.
99
99
  * Defaults to WGS84 (EPSG:4326) if not specified.
100
+ *
101
+ * Note: If `format` is set to `GeoJSON`, this value is automatically locked to `WGS84`
102
+ * as per the GeoJSON specification (RFC 7946).
100
103
  */
101
104
  spatialReferenceSystem?: GeospatialSpatialReferenceSystem
102
105
 
103
106
  /**
104
107
  * The default distance unit for spatial queries.
105
108
  * Defaults to 'meters' if not specified.
109
+ * Only applicable when `enableDistanceQueries` is true.
106
110
  */
107
111
  defaultDistanceUnit?: GeospatialDistanceUnit
108
112
 
@@ -120,7 +124,8 @@ export interface GeospatialCoordinatesConfig {
120
124
 
121
125
  /**
122
126
  * Custom validation rules for coordinate bounds.
123
- * If not specified, uses standard latitude (-90 to 90) and longitude (-180 to 180) bounds.
127
+ * Values are in decimal degrees.
128
+ * If not specified, uses standard latitude (-90.0 to 90.0) and longitude (-180.0 to 180.0) bounds.
124
129
  */
125
130
  validationBounds?: {
126
131
  /**
@@ -144,35 +149,55 @@ export interface GeospatialCoordinatesConfig {
144
149
  /**
145
150
  * Whether to enable automatic PostGIS integration when using PostgreSQL.
146
151
  * Defaults to true if not specified.
152
+ *
153
+ * This is an advanced setting. For UIs targeting non-technical users,
154
+ * it is safe to hide this option and keep it enabled. The backend should
155
+ * gracefully handle cases where the database is not PostgreSQL.
147
156
  */
148
157
  enablePostGISIntegration?: boolean
149
158
 
150
159
  /**
151
160
  * The PostGIS geometry type to use for storage.
152
161
  * Defaults to 'POINT' if not specified.
162
+ * This choice fundamentally defines the shape of the data and the types of queries that can be performed.
163
+ *
164
+ * - **POINT**: For single locations (e.g., a store, a user's location).
165
+ * - **LINESTRING**: For paths or routes (e.g., a delivery route, a hiking trail).
166
+ * - **POLYGON**: For defined areas (e.g., a delivery zone, a sales territory, a city boundary).
167
+ * - **MULTI***: For collections of the above types (e.g., all stores in a chain as a MULTIPOINT).
153
168
  */
154
169
  postGISGeometryType?: 'POINT' | 'LINESTRING' | 'POLYGON' | 'MULTIPOINT' | 'MULTILINESTRING' | 'MULTIPOLYGON'
155
170
 
156
171
  /**
157
172
  * Whether to enable distance-based query endpoints.
173
+ * This is not mutually exclusive with other query types and is useful for all geometry types.
158
174
  * Defaults to true if not specified.
175
+ *
176
+ * - For **POINT**: Finds points within a certain radius.
177
+ * - For **POLYGON**: Finds polygons that are within a certain distance of a point
178
+ * (e.g., "find all parks within 5 miles").
179
+ * - For **LINESTRING**: Finds paths/routes within a certain distance of a point
180
+ * (e.g., "find all subway lines near me").
159
181
  */
160
182
  enableDistanceQueries?: boolean
161
183
 
162
184
  /**
163
185
  * Maximum distance allowed in distance queries (in the default distance unit).
164
186
  * Defaults to 100000 (100km) if not specified.
187
+ * Only applicable when `enableDistanceQueries` is true.
165
188
  */
166
189
  maxQueryDistance?: number
167
190
 
168
191
  /**
169
192
  * Whether to enable bounding box query endpoints.
193
+ * This is not mutually exclusive with other query types.
170
194
  * Defaults to true if not specified.
171
195
  */
172
196
  enableBoundingBoxQueries?: boolean
173
197
 
174
198
  /**
175
199
  * Whether to enable polygon intersection query endpoints.
200
+ * This is not mutually exclusive with other query types.
176
201
  * Defaults to false if not specified.
177
202
  */
178
203
  enablePolygonQueries?: boolean
@@ -180,12 +205,26 @@ export interface GeospatialCoordinatesConfig {
180
205
  /**
181
206
  * Custom API endpoint prefix for geospatial queries.
182
207
  * Defaults to '/nearby' if not specified.
208
+ * Only applicable if `enableDistanceQueries`, `enableBoundingBoxQueries`,
209
+ * or `enablePolygonQueries` is true.
210
+ *
211
+ * The generated endpoints would be:
212
+ * - **Distance Query**: `GET {apiEndpointPrefix}`
213
+ * - **Bounding Box Query**: `GET {apiEndpointPrefix}/bbox`
214
+ * - **Polygon Query**: `POST {apiEndpointPrefix}/polygon`
183
215
  */
184
216
  apiEndpointPrefix?: string
185
217
 
186
218
  /**
187
219
  * Whether to include elevation data in coordinates (3D coordinates).
188
220
  * Defaults to false if not specified.
221
+ * When true, a third value for elevation is expected in the coordinate data.
222
+ *
223
+ * - **LatLon**: `"40.7128,-74.0060,10"` (latitude, longitude, elevation)
224
+ * - **PostGIS/WKT**: `"POINT Z (-74.0060 40.7128 10)"`
225
+ * - **GeoJSON**: `{"type": "Point", "coordinates": [-74.0060, 40.7128, 10]}`
226
+ *
227
+ * The unit for elevation is determined by `defaultDistanceUnit`.
189
228
  */
190
229
  includeElevation?: boolean
191
230
 
@@ -198,6 +237,12 @@ export interface GeospatialCoordinatesConfig {
198
237
  /**
199
238
  * Whether to enable reverse geocoding capabilities.
200
239
  * Defaults to false if not specified.
240
+ *
241
+ * When enabled, the system can convert geographic coordinates (e.g., `40.7128, -74.0060`)
242
+ * into a human-readable address (e.g., "New York, NY, USA").
243
+ *
244
+ * This often requires integration with an external geocoding service and may have
245
+ * associated costs or usage limits.
201
246
  */
202
247
  enableReverseGeocoding?: boolean
203
248
 
@@ -10,12 +10,25 @@ export interface HTMLConfig {
10
10
  * List of allowed HTML tags in the content.
11
11
  */
12
12
  allowedTags?: string[]
13
- /**
14
- * Maximum length of the HTML content.
15
- */
16
- maxLength?: number
17
13
  /**
18
14
  * Render mode: 'html', 'text', or 'both'.
15
+ *
16
+ * - `html` - The API returns the HTML content as-is (after sanitization based on your other rules like allowedTags).
17
+ * - `text` - The API returns the text content, stripping out all HTML tags.
18
+ * This is extremely useful for various backend and frontend tasks:
19
+ * - **Search Indexing**: You can easily feed the plain text content into a search engine like Elasticsearch
20
+ * without the noise of HTML tags.
21
+ * - **Content Previews/Summaries**: Displaying a snippet of the content in a list view or a notification
22
+ * where formatting is not desired.
23
+ * - **Compatibility**: Sending the content to systems that don't support HTML, such as plain-text
24
+ * emails or SMS notifications.
25
+ * - `both` - The API returns an object containing both the raw HTML and the plain text version. For example:
26
+ * ```json
27
+ * {
28
+ * "html": "<p>Hello, <strong>world</strong>!</p>",
29
+ * "text": "Hello, world!"
30
+ * }
31
+ * ```
19
32
  */
20
33
  renderMode?: 'html' | 'text' | 'both'
21
34
  /**
@@ -106,7 +119,6 @@ export const createHTMLSemantic = (config: HTMLConfig = {}): AppliedHTMLSemantic
106
119
  */
107
120
  export const DEFAULT_HTML_CONFIG: HTMLConfig = {
108
121
  allowedTags: ['b', 'i', 'em', 'strong', 'a', 'ul', 'ol', 'li', 'p', 'br', 'pre', 'code', 'div', 'span'],
109
- maxLength: 10000,
110
122
  renderMode: 'html',
111
123
  sanitizeLevel: 'strict',
112
124
  allowImages: true,
@@ -10,12 +10,20 @@ export interface MarkdownConfig {
10
10
  * List of allowed HTML tags in the rendered output.
11
11
  */
12
12
  allowedTags?: string[]
13
- /**
14
- * Maximum length of the markdown content.
15
- */
16
- maxLength?: number
17
13
  /**
18
14
  * Render mode: 'html', 'text', or 'both'.
15
+ * This controls how the stored Markdown content is transformed and returned by the API.
16
+ *
17
+ * - `html` - The API converts the Markdown to HTML and returns the sanitized result.
18
+ * - `text` - The original Markdown as when created, but sanitized.
19
+ * - `both` - The API returns an object containing both the rendered HTML and the plain text version.
20
+ * This provides maximum flexibility for client applications.
21
+ * ```json
22
+ * {
23
+ * "html": "<h1>Title</h1><p>Some <strong>bold</strong> text.</p>",
24
+ * "text": "Title Some bold text."
25
+ * }
26
+ * ```
19
27
  */
20
28
  renderMode?: 'html' | 'text' | 'both'
21
29
  /**
@@ -102,7 +110,6 @@ export const createMarkdownSemantic = (config: MarkdownConfig = {}): AppliedMark
102
110
  */
103
111
  export const DEFAULT_MARKDOWN_CONFIG: MarkdownConfig = {
104
112
  allowedTags: ['b', 'i', 'em', 'strong', 'a', 'ul', 'ol', 'li', 'p', 'br', 'pre', 'code'],
105
- maxLength: 10000,
106
113
  renderMode: 'html',
107
114
  sanitizeLevel: 'strict',
108
115
  allowImages: true,
@@ -15,18 +15,17 @@ export interface PhoneConfig {
15
15
 
16
16
  /**
17
17
  * Whether the phone number must include a country code.
18
- * Defaults to true for E.164 format.
18
+ * Defaults to true for international format.
19
19
  */
20
20
  requireCountryCode?: boolean
21
21
 
22
22
  /**
23
23
  * Format for phone number validation and display.
24
- * - 'E.164': International format with + prefix (e.g., +1234567890)
25
24
  * - 'national': Country-specific format without country code
26
- * - 'international': International format with country code
25
+ * - 'international': E.164 international format with + prefix (e.g., +1234567890)
27
26
  * - 'custom': Use customFormat pattern
28
27
  */
29
- format?: 'E.164' | 'national' | 'international' | 'custom'
28
+ format?: 'national' | 'international' | 'custom'
30
29
 
31
30
  /**
32
31
  * Custom format pattern for phone number validation.
@@ -51,9 +50,8 @@ export interface PhoneConfig {
51
50
  * Method to use for phone verification.
52
51
  * - 'sms': Send verification code via SMS
53
52
  * - 'call': Make verification call
54
- * - 'none': No verification required
55
53
  */
56
- verificationMethod?: 'sms' | 'call' | 'none'
54
+ verificationMethod?: 'sms' | 'call'
57
55
 
58
56
  /**
59
57
  * Custom metadata for the phone field.
@@ -105,11 +103,11 @@ export const createPhoneSemantic = (config: PhoneConfig = {}): AppliedPhoneSeman
105
103
 
106
104
  /**
107
105
  * Default configuration for Phone semantic.
108
- * Uses E.164 format with country code required and SMS verification.
106
+ * Uses international format with country code required and SMS verification.
109
107
  */
110
108
  export const DEFAULT_PHONE_CONFIG: PhoneConfig = {
111
109
  requireCountryCode: true,
112
- format: 'E.164',
110
+ format: 'international',
113
111
  allowExtension: false,
114
112
  requireVerification: false,
115
113
  verificationMethod: 'sms',
@@ -7,7 +7,7 @@ import { SemanticType } from '../Semantics.js'
7
7
  */
8
8
  export interface PublicUniqueNameConfig {
9
9
  /**
10
- * The source field to generate the slug from (e.g., 'title').
10
+ * The key of the source field to generate the slug from.
11
11
  * Default to the field that is annotated with the Title semantic.
12
12
  */
13
13
  sourceField?: string
@@ -15,10 +15,6 @@ export interface PublicUniqueNameConfig {
15
15
  * Separator character to use in the slug (default: '-').
16
16
  */
17
17
  separator?: string
18
- /**
19
- * Maximum length of the slug (default: 64).
20
- */
21
- maxLength?: number
22
18
  /**
23
19
  * Whether the slug is case sensitive (default: false).
24
20
  */
@@ -27,10 +23,6 @@ export interface PublicUniqueNameConfig {
27
23
  * Whether to allow Unicode characters in the slug (default: false).
28
24
  */
29
25
  allowUnicode?: boolean
30
- /**
31
- * Name of a custom generator function to use for slug creation.
32
- */
33
- customGenerator?: string
34
26
  /**
35
27
  * Whether to allow duplicate slugs (default: false).
36
28
  */
@@ -91,7 +83,6 @@ export const createPublicUniqueNameSemantic = (
91
83
  */
92
84
  export const DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG: PublicUniqueNameConfig = {
93
85
  separator: '-',
94
- maxLength: 64,
95
86
  caseSensitive: false,
96
87
  allowUnicode: false,
97
88
  allowDuplicates: false,