@api-client/core 0.17.3 → 0.17.5

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 (34) hide show
  1. package/build/src/modeling/Semantics.d.ts +6 -1
  2. package/build/src/modeling/Semantics.d.ts.map +1 -1
  3. package/build/src/modeling/Semantics.js +32 -4
  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/HTML.d.ts +17 -4
  10. package/build/src/modeling/definitions/HTML.d.ts.map +1 -1
  11. package/build/src/modeling/definitions/HTML.js +0 -1
  12. package/build/src/modeling/definitions/HTML.js.map +1 -1
  13. package/build/src/modeling/definitions/Markdown.d.ts +12 -4
  14. package/build/src/modeling/definitions/Markdown.d.ts.map +1 -1
  15. package/build/src/modeling/definitions/Markdown.js +0 -1
  16. package/build/src/modeling/definitions/Markdown.js.map +1 -1
  17. package/build/src/modeling/definitions/Status.d.ts +1 -1
  18. package/build/src/modeling/definitions/Status.d.ts.map +1 -1
  19. package/build/src/modeling/definitions/Status.js +1 -0
  20. package/build/src/modeling/definitions/Status.js.map +1 -1
  21. package/build/tsconfig.tsbuildinfo +1 -1
  22. package/package.json +1 -1
  23. package/src/modeling/Semantics.ts +37 -4
  24. package/src/modeling/definitions/{Price.examples.md → Currency.examples.md} +12 -12
  25. package/src/modeling/definitions/{Price.ts → Currency.ts} +26 -26
  26. package/src/modeling/definitions/HTML.ts +17 -5
  27. package/src/modeling/definitions/Markdown.ts +12 -5
  28. package/src/modeling/definitions/Status.ts +2 -1
  29. package/tests/unit/modeling/definitions/{price.spec.ts → currency.spec.ts} +114 -114
  30. package/tests/unit/modeling/definitions/description.spec.ts +0 -2
  31. package/tests/unit/modeling/semantic-configs.spec.ts +44 -44
  32. package/tests/unit/modeling/semantics.spec.ts +10 -1
  33. package/build/src/modeling/definitions/Price.d.ts.map +0 -1
  34. package/build/src/modeling/definitions/Price.js.map +0 -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.3",
4
+ "version": "0.17.5",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -151,7 +151,7 @@ export enum SemanticType {
151
151
  * Can store simple decimal amounts or complex objects with amount and currency.
152
152
  * Enforces proper decimal handling to avoid floating-point errors.
153
153
  */
154
- Price = 'Semantic#Price',
154
+ Currency = 'Semantic#Currency',
155
155
  /**
156
156
  * Annotates a field as a URL with validation and allowed protocols.
157
157
  */
@@ -293,6 +293,11 @@ interface BaseDataSemantic {
293
293
  * The category this semantic belongs to for UI organization.
294
294
  */
295
295
  category: SemanticCategory
296
+ /**
297
+ * Whether the semantic has a configuration or additional options.
298
+ * This is used to determine if the semantic requires additional setup or configuration.
299
+ */
300
+ hasConfig: boolean
296
301
  }
297
302
 
298
303
  /**
@@ -359,6 +364,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
359
364
  scope: SemanticScope.Entity,
360
365
  description: 'System users and accounts',
361
366
  category: SemanticCategory.Identity,
367
+ hasConfig: false,
362
368
  },
363
369
  [SemanticType.Password]: {
364
370
  id: SemanticType.Password,
@@ -367,6 +373,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
367
373
  description: 'Secure password field',
368
374
  category: SemanticCategory.Identity,
369
375
  applicableDataTypes: ['string'],
376
+ hasConfig: true,
370
377
  },
371
378
  [SemanticType.UserRole]: {
372
379
  id: SemanticType.UserRole,
@@ -375,6 +382,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
375
382
  description: 'User permissions and access level',
376
383
  category: SemanticCategory.Identity,
377
384
  applicableDataTypes: ['string'],
385
+ hasConfig: false,
378
386
  },
379
387
  [SemanticType.ResourceOwnerIdentifier]: {
380
388
  id: SemanticType.ResourceOwnerIdentifier,
@@ -382,6 +390,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
382
390
  scope: SemanticScope.Association,
383
391
  description: 'Links record to owner user',
384
392
  category: SemanticCategory.Identity,
393
+ hasConfig: false,
385
394
  },
386
395
 
387
396
  //
@@ -395,6 +404,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
395
404
  description: 'When record was created',
396
405
  category: SemanticCategory.Lifecycle,
397
406
  applicableDataTypes: ['datetime'],
407
+ hasConfig: false,
398
408
  },
399
409
  [SemanticType.UpdatedTimestamp]: {
400
410
  id: SemanticType.UpdatedTimestamp,
@@ -403,6 +413,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
403
413
  description: 'When record was last modified',
404
414
  category: SemanticCategory.Lifecycle,
405
415
  applicableDataTypes: ['datetime'],
416
+ hasConfig: false,
406
417
  },
407
418
  [SemanticType.DeletedTimestamp]: {
408
419
  id: SemanticType.DeletedTimestamp,
@@ -411,6 +422,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
411
422
  description: 'When record was marked deleted',
412
423
  category: SemanticCategory.Lifecycle,
413
424
  applicableDataTypes: ['datetime'],
425
+ hasConfig: false,
414
426
  },
415
427
  [SemanticType.DeletedFlag]: {
416
428
  id: SemanticType.DeletedFlag,
@@ -419,6 +431,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
419
431
  description: 'Mark record as deleted',
420
432
  category: SemanticCategory.Lifecycle,
421
433
  applicableDataTypes: ['boolean'],
434
+ hasConfig: false,
422
435
  },
423
436
  [SemanticType.Version]: {
424
437
  id: SemanticType.Version,
@@ -427,6 +440,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
427
440
  description: 'Auto-incrementing version counter',
428
441
  category: SemanticCategory.Lifecycle,
429
442
  applicableDataTypes: ['number'],
443
+ hasConfig: false,
430
444
  },
431
445
 
432
446
  //
@@ -440,6 +454,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
440
454
  description: 'Main title or heading',
441
455
  category: SemanticCategory.Content,
442
456
  applicableDataTypes: ['string'],
457
+ hasConfig: false,
443
458
  },
444
459
  [SemanticType.Description]: {
445
460
  id: SemanticType.Description,
@@ -448,6 +463,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
448
463
  description: 'Detailed description text',
449
464
  category: SemanticCategory.Content,
450
465
  applicableDataTypes: ['string'],
466
+ hasConfig: false,
451
467
  },
452
468
  [SemanticType.Summary]: {
453
469
  id: SemanticType.Summary,
@@ -456,6 +472,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
456
472
  description: 'Brief summary text',
457
473
  category: SemanticCategory.Content,
458
474
  applicableDataTypes: ['string'],
475
+ hasConfig: false,
459
476
  },
460
477
  [SemanticType.Markdown]: {
461
478
  id: SemanticType.Markdown,
@@ -464,6 +481,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
464
481
  description: 'Formatted text content',
465
482
  category: SemanticCategory.Content,
466
483
  applicableDataTypes: ['string'],
484
+ hasConfig: true,
467
485
  },
468
486
  [SemanticType.HTML]: {
469
487
  id: SemanticType.HTML,
@@ -472,6 +490,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
472
490
  description: 'Rich HTML content',
473
491
  category: SemanticCategory.Content,
474
492
  applicableDataTypes: ['string'],
493
+ hasConfig: true,
475
494
  },
476
495
  [SemanticType.ImageURL]: {
477
496
  id: SemanticType.ImageURL,
@@ -480,6 +499,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
480
499
  description: 'Link to image file',
481
500
  category: SemanticCategory.Content,
482
501
  applicableDataTypes: ['string'],
502
+ hasConfig: false,
483
503
  },
484
504
  [SemanticType.FileURL]: {
485
505
  id: SemanticType.FileURL,
@@ -488,6 +508,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
488
508
  description: 'Link to file attachment',
489
509
  category: SemanticCategory.Content,
490
510
  applicableDataTypes: ['string'],
511
+ hasConfig: false,
491
512
  },
492
513
 
493
514
  //
@@ -501,14 +522,16 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
501
522
  description: 'Current state of record',
502
523
  category: SemanticCategory.Business,
503
524
  applicableDataTypes: ['string'],
525
+ hasConfig: true,
504
526
  },
505
- [SemanticType.Price]: {
506
- id: SemanticType.Price,
507
- displayName: 'Price',
527
+ [SemanticType.Currency]: {
528
+ id: SemanticType.Currency,
529
+ displayName: 'Currency',
508
530
  scope: SemanticScope.Property,
509
531
  description: 'Monetary value with currency',
510
532
  category: SemanticCategory.Business,
511
533
  applicableDataTypes: ['number', 'string'],
534
+ hasConfig: true,
512
535
  },
513
536
  [SemanticType.SKU]: {
514
537
  id: SemanticType.SKU,
@@ -517,6 +540,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
517
540
  description: 'Product identification code',
518
541
  category: SemanticCategory.Business,
519
542
  applicableDataTypes: ['string'],
543
+ hasConfig: true,
520
544
  },
521
545
 
522
546
  //
@@ -530,6 +554,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
530
554
  description: 'Email address',
531
555
  category: SemanticCategory.Contact,
532
556
  applicableDataTypes: ['string'],
557
+ hasConfig: true,
533
558
  },
534
559
  [SemanticType.Phone]: {
535
560
  id: SemanticType.Phone,
@@ -538,6 +563,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
538
563
  description: 'Phone number',
539
564
  category: SemanticCategory.Contact,
540
565
  applicableDataTypes: ['string'],
566
+ hasConfig: true,
541
567
  },
542
568
  [SemanticType.URL]: {
543
569
  id: SemanticType.URL,
@@ -546,6 +572,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
546
572
  description: 'Web address or link',
547
573
  category: SemanticCategory.Contact,
548
574
  applicableDataTypes: ['string'],
575
+ hasConfig: true,
549
576
  },
550
577
 
551
578
  //
@@ -559,6 +586,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
559
586
  description: 'URL-friendly unique identifier',
560
587
  category: SemanticCategory.Organization,
561
588
  applicableDataTypes: ['string'],
589
+ hasConfig: true,
562
590
  },
563
591
  [SemanticType.Tags]: {
564
592
  id: SemanticType.Tags,
@@ -566,6 +594,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
566
594
  scope: SemanticScope.Association,
567
595
  description: 'Enable tagging functionality',
568
596
  category: SemanticCategory.Organization,
597
+ hasConfig: true,
569
598
  },
570
599
  [SemanticType.Categories]: {
571
600
  id: SemanticType.Categories,
@@ -573,6 +602,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
573
602
  scope: SemanticScope.Association,
574
603
  description: 'Enable categorization functionality',
575
604
  category: SemanticCategory.Organization,
605
+ hasConfig: true,
576
606
  },
577
607
 
578
608
  //
@@ -586,6 +616,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
586
616
  description: 'Location coordinates',
587
617
  category: SemanticCategory.Location,
588
618
  applicableDataTypes: ['string'],
619
+ hasConfig: true,
589
620
  },
590
621
 
591
622
  //
@@ -599,6 +630,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
599
630
  description: 'Auto-calculated field value',
600
631
  category: SemanticCategory.Computed,
601
632
  applicableDataTypes: ['string'],
633
+ hasConfig: true,
602
634
  },
603
635
  [SemanticType.Derived]: {
604
636
  id: SemanticType.Derived,
@@ -607,6 +639,7 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
607
639
  description: 'Value derived from other fields',
608
640
  category: SemanticCategory.Computed,
609
641
  applicableDataTypes: ['string'],
642
+ hasConfig: true,
610
643
  },
611
644
  }
612
645
 
@@ -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) {
@@ -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,
@@ -17,7 +17,7 @@ export interface StatusConfig {
17
17
  * Default state when creating new records.
18
18
  * Must be one of the allowedStates (if specified) or enum values from the schema.
19
19
  */
20
- defaultState: string
20
+ defaultState?: string
21
21
 
22
22
  /**
23
23
  * State transitions configuration.
@@ -200,6 +200,7 @@ export const createStatusSemantic = (config: Partial<StatusConfig> = {}): Applie
200
200
  * Default configuration for Status semantic.
201
201
  */
202
202
  export const DEFAULT_STATUS_CONFIG: StatusConfig = {
203
+ allowedStates: ['draft', 'published', 'archived'],
203
204
  defaultState: 'draft',
204
205
  stateBehaviors: {
205
206
  draft: {