@api-client/core 0.14.1 → 0.14.2

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 (49) hide show
  1. package/build/src/browser.d.ts +1 -1
  2. package/build/src/browser.d.ts.map +1 -1
  3. package/build/src/browser.js.map +1 -1
  4. package/build/src/index.d.ts +1 -1
  5. package/build/src/index.d.ts.map +1 -1
  6. package/build/src/index.js.map +1 -1
  7. package/build/src/modeling/DomainAssociation.d.ts +35 -0
  8. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  9. package/build/src/modeling/DomainAssociation.js +42 -5
  10. package/build/src/modeling/DomainAssociation.js.map +1 -1
  11. package/build/src/modeling/Semantics.d.ts +8 -0
  12. package/build/src/modeling/Semantics.d.ts.map +1 -1
  13. package/build/src/modeling/Semantics.js +15 -0
  14. package/build/src/modeling/Semantics.js.map +1 -1
  15. package/build/tsconfig.tsbuildinfo +1 -1
  16. package/data/models/APIC-187.json +3 -3
  17. package/data/models/APIC-188.json +3 -3
  18. package/data/models/APIC-233.json +1 -1
  19. package/data/models/APIC-391.json +2 -2
  20. package/data/models/APIC-483.json +1 -1
  21. package/data/models/APIC-487.json +1 -1
  22. package/data/models/APIC-655.json +1 -1
  23. package/data/models/APIC-689.json +1 -1
  24. package/data/models/APIC-690.json +5 -5
  25. package/data/models/SE-10469.json +1 -1
  26. package/data/models/SE-13092.json +5 -5
  27. package/data/models/SE-22063.json +12 -2
  28. package/data/models/amf-helper-api.json +154 -14
  29. package/data/models/arc-demo-api.json +95 -15
  30. package/data/models/async-api.json +1 -1
  31. package/data/models/example-generator-api.json +366 -26
  32. package/data/models/expanded-api.json +1 -1
  33. package/data/models/flattened-api.json +1 -1
  34. package/data/models/multiple-servers.json +1 -1
  35. package/data/models/oas-3-api.json +1 -1
  36. package/data/models/oas-date.json +1 -1
  37. package/data/models/oas-types.json +1 -1
  38. package/data/models/oas-unions.json +1 -1
  39. package/data/models/petstore.json +1 -1
  40. package/data/models/raml-date.json +1 -1
  41. package/data/models/recursive.json +1 -1
  42. package/data/models/schema-api.json +62 -2
  43. package/data/models/secured-api.json +16 -16
  44. package/data/models/tracked-to-linked.json +4 -4
  45. package/package.json +2 -2
  46. package/src/modeling/DomainAssociation.ts +56 -0
  47. package/src/modeling/Semantics.ts +17 -0
  48. package/tests/unit/modeling/domain_asociation.spec.ts +92 -2
  49. package/tests/unit/modeling/semantics.spec.ts +149 -0
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "RAML 1.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "RAML 1.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "OAS 3.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "OAS 3.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "OAS 3.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "OAS 3.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "OAS 3.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "OAS 3.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "RAML 1.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "RAML 1.0"
11
11
  },
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "RAML 1.0"
11
11
  },
@@ -12732,7 +12732,7 @@
12732
12732
  "@type": [
12733
12733
  "doc:APIContractProcessingData"
12734
12734
  ],
12735
- "apiContract:modelVersion": "3.10.0",
12735
+ "apiContract:modelVersion": "3.11.0",
12736
12736
  "doc:sourceSpec": "RAML 1.0"
12737
12737
  },
12738
12738
  {
@@ -26128,6 +26128,11 @@
26128
26128
  "@id": "#331/source-map/inherited-shapes/element_0"
26129
26129
  }
26130
26130
  ],
26131
+ "sourcemaps:default-node": [
26132
+ {
26133
+ "@id": "#331/source-map/default-node/element_0"
26134
+ }
26135
+ ],
26131
26136
  "sourcemaps:synthesized-field": [
26132
26137
  {
26133
26138
  "@id": "#331/source-map/synthesized-field/element_0"
@@ -26226,6 +26231,11 @@
26226
26231
  "@id": "#334/source-map/inherited-shapes/element_0"
26227
26232
  }
26228
26233
  ],
26234
+ "sourcemaps:default-node": [
26235
+ {
26236
+ "@id": "#334/source-map/default-node/element_0"
26237
+ }
26238
+ ],
26229
26239
  "sourcemaps:synthesized-field": [
26230
26240
  {
26231
26241
  "@id": "#334/source-map/synthesized-field/element_0"
@@ -28525,6 +28535,11 @@
28525
28535
  "@id": "#19/source-map/inherited-shapes/element_0"
28526
28536
  }
28527
28537
  ],
28538
+ "sourcemaps:default-node": [
28539
+ {
28540
+ "@id": "#19/source-map/default-node/element_0"
28541
+ }
28542
+ ],
28528
28543
  "sourcemaps:synthesized-field": [
28529
28544
  {
28530
28545
  "@id": "#19/source-map/synthesized-field/element_0"
@@ -28639,6 +28654,11 @@
28639
28654
  "@id": "#25/source-map/inherited-shapes/element_0"
28640
28655
  }
28641
28656
  ],
28657
+ "sourcemaps:default-node": [
28658
+ {
28659
+ "@id": "#25/source-map/default-node/element_0"
28660
+ }
28661
+ ],
28642
28662
  "sourcemaps:synthesized-field": [
28643
28663
  {
28644
28664
  "@id": "#25/source-map/synthesized-field/element_0"
@@ -28719,6 +28739,11 @@
28719
28739
  "@id": "#28/source-map/inherited-shapes/element_0"
28720
28740
  }
28721
28741
  ],
28742
+ "sourcemaps:default-node": [
28743
+ {
28744
+ "@id": "#28/source-map/default-node/element_0"
28745
+ }
28746
+ ],
28722
28747
  "sourcemaps:synthesized-field": [
28723
28748
  {
28724
28749
  "@id": "#28/source-map/synthesized-field/element_0"
@@ -30399,6 +30424,11 @@
30399
30424
  "sourcemaps:value": "amf://id#11"
30400
30425
  },
30401
30426
  {
30427
+ "@id": "#331/source-map/default-node/element_0",
30428
+ "sourcemaps:element": "amf://id#331",
30429
+ "sourcemaps:value": ""
30430
+ },
30431
+ {
30402
30432
  "@id": "#331/source-map/synthesized-field/element_0",
30403
30433
  "sourcemaps:element": "shacl:datatype",
30404
30434
  "sourcemaps:value": "true"
@@ -30472,6 +30502,11 @@
30472
30502
  "sourcemaps:value": "amf://id#13"
30473
30503
  },
30474
30504
  {
30505
+ "@id": "#334/source-map/default-node/element_0",
30506
+ "sourcemaps:element": "amf://id#334",
30507
+ "sourcemaps:value": ""
30508
+ },
30509
+ {
30475
30510
  "@id": "#334/source-map/synthesized-field/element_0",
30476
30511
  "sourcemaps:element": "shacl:datatype",
30477
30512
  "sourcemaps:value": "true"
@@ -32263,6 +32298,11 @@
32263
32298
  "sourcemaps:value": "amf://id#13"
32264
32299
  },
32265
32300
  {
32301
+ "@id": "#19/source-map/default-node/element_0",
32302
+ "sourcemaps:element": "amf://id#19",
32303
+ "sourcemaps:value": ""
32304
+ },
32305
+ {
32266
32306
  "@id": "#19/source-map/synthesized-field/element_0",
32267
32307
  "sourcemaps:element": "shacl:datatype",
32268
32308
  "sourcemaps:value": "true"
@@ -32327,6 +32367,11 @@
32327
32367
  "sourcemaps:value": "amf://id#11"
32328
32368
  },
32329
32369
  {
32370
+ "@id": "#25/source-map/default-node/element_0",
32371
+ "sourcemaps:element": "amf://id#25",
32372
+ "sourcemaps:value": ""
32373
+ },
32374
+ {
32330
32375
  "@id": "#25/source-map/synthesized-field/element_0",
32331
32376
  "sourcemaps:element": "shacl:datatype",
32332
32377
  "sourcemaps:value": "true"
@@ -32381,6 +32426,11 @@
32381
32426
  "sourcemaps:value": "amf://id#13"
32382
32427
  },
32383
32428
  {
32429
+ "@id": "#28/source-map/default-node/element_0",
32430
+ "sourcemaps:element": "amf://id#28",
32431
+ "sourcemaps:value": ""
32432
+ },
32433
+ {
32384
32434
  "@id": "#28/source-map/synthesized-field/element_0",
32385
32435
  "sourcemaps:element": "shacl:datatype",
32386
32436
  "sourcemaps:value": "true"
@@ -33397,6 +33447,11 @@
33397
33447
  "@id": "#373/source-map/synthesized-field/element_0"
33398
33448
  }
33399
33449
  ],
33450
+ "sourcemaps:default-node": [
33451
+ {
33452
+ "@id": "#373/source-map/default-node/element_0"
33453
+ }
33454
+ ],
33400
33455
  "sourcemaps:lexical": [
33401
33456
  {
33402
33457
  "@id": "#373/source-map/lexical/element_1"
@@ -34765,6 +34820,11 @@
34765
34820
  "sourcemaps:value": "true"
34766
34821
  },
34767
34822
  {
34823
+ "@id": "#373/source-map/default-node/element_0",
34824
+ "sourcemaps:element": "amf://id#373",
34825
+ "sourcemaps:value": ""
34826
+ },
34827
+ {
34768
34828
  "@id": "#373/source-map/lexical/element_1",
34769
34829
  "sourcemaps:element": "amf://id#373",
34770
34830
  "sourcemaps:value": "[(486,10)-(490,0)]"
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "RAML 1.0"
11
11
  },
@@ -17110,7 +17110,7 @@
17110
17110
  "@type": [
17111
17111
  "doc:APIContractProcessingData"
17112
17112
  ],
17113
- "apiContract:modelVersion": "3.10.0",
17113
+ "apiContract:modelVersion": "3.11.0",
17114
17114
  "doc:sourceSpec": "RAML 1.0"
17115
17115
  },
17116
17116
  {
@@ -17156,7 +17156,7 @@
17156
17156
  "@type": [
17157
17157
  "doc:APIContractProcessingData"
17158
17158
  ],
17159
- "apiContract:modelVersion": "3.10.0",
17159
+ "apiContract:modelVersion": "3.11.0",
17160
17160
  "doc:sourceSpec": "RAML 1.0"
17161
17161
  },
17162
17162
  {
@@ -17192,7 +17192,7 @@
17192
17192
  "@type": [
17193
17193
  "doc:APIContractProcessingData"
17194
17194
  ],
17195
- "apiContract:modelVersion": "3.10.0",
17195
+ "apiContract:modelVersion": "3.11.0",
17196
17196
  "doc:sourceSpec": "RAML 1.0"
17197
17197
  },
17198
17198
  {
@@ -17246,7 +17246,7 @@
17246
17246
  "@type": [
17247
17247
  "doc:APIContractProcessingData"
17248
17248
  ],
17249
- "apiContract:modelVersion": "3.10.0",
17249
+ "apiContract:modelVersion": "3.11.0",
17250
17250
  "doc:sourceSpec": "RAML 1.0"
17251
17251
  },
17252
17252
  {
@@ -17292,7 +17292,7 @@
17292
17292
  "@type": [
17293
17293
  "doc:APIContractProcessingData"
17294
17294
  ],
17295
- "apiContract:modelVersion": "3.10.0",
17295
+ "apiContract:modelVersion": "3.11.0",
17296
17296
  "doc:sourceSpec": "RAML 1.0"
17297
17297
  },
17298
17298
  {
@@ -17328,7 +17328,7 @@
17328
17328
  "@type": [
17329
17329
  "doc:APIContractProcessingData"
17330
17330
  ],
17331
- "apiContract:modelVersion": "3.10.0",
17331
+ "apiContract:modelVersion": "3.11.0",
17332
17332
  "doc:sourceSpec": "RAML 1.0"
17333
17333
  },
17334
17334
  {
@@ -17369,7 +17369,7 @@
17369
17369
  "@type": [
17370
17370
  "doc:APIContractProcessingData"
17371
17371
  ],
17372
- "apiContract:modelVersion": "3.10.0",
17372
+ "apiContract:modelVersion": "3.11.0",
17373
17373
  "doc:sourceSpec": "RAML 1.0"
17374
17374
  },
17375
17375
  {
@@ -17410,7 +17410,7 @@
17410
17410
  "@type": [
17411
17411
  "doc:APIContractProcessingData"
17412
17412
  ],
17413
- "apiContract:modelVersion": "3.10.0",
17413
+ "apiContract:modelVersion": "3.11.0",
17414
17414
  "doc:sourceSpec": "RAML 1.0"
17415
17415
  },
17416
17416
  {
@@ -17446,7 +17446,7 @@
17446
17446
  "@type": [
17447
17447
  "doc:APIContractProcessingData"
17448
17448
  ],
17449
- "apiContract:modelVersion": "3.10.0",
17449
+ "apiContract:modelVersion": "3.11.0",
17450
17450
  "doc:sourceSpec": "RAML 1.0"
17451
17451
  },
17452
17452
  {
@@ -17487,7 +17487,7 @@
17487
17487
  "@type": [
17488
17488
  "doc:APIContractProcessingData"
17489
17489
  ],
17490
- "apiContract:modelVersion": "3.10.0",
17490
+ "apiContract:modelVersion": "3.11.0",
17491
17491
  "doc:sourceSpec": "RAML 1.0"
17492
17492
  },
17493
17493
  {
@@ -17528,7 +17528,7 @@
17528
17528
  "@type": [
17529
17529
  "doc:APIContractProcessingData"
17530
17530
  ],
17531
- "apiContract:modelVersion": "3.10.0",
17531
+ "apiContract:modelVersion": "3.11.0",
17532
17532
  "doc:sourceSpec": "RAML 1.0"
17533
17533
  },
17534
17534
  {
@@ -17564,7 +17564,7 @@
17564
17564
  "@type": [
17565
17565
  "doc:APIContractProcessingData"
17566
17566
  ],
17567
- "apiContract:modelVersion": "3.10.0",
17567
+ "apiContract:modelVersion": "3.11.0",
17568
17568
  "doc:sourceSpec": "RAML 1.0"
17569
17569
  },
17570
17570
  {
@@ -17600,7 +17600,7 @@
17600
17600
  "@type": [
17601
17601
  "doc:APIContractProcessingData"
17602
17602
  ],
17603
- "apiContract:modelVersion": "3.10.0",
17603
+ "apiContract:modelVersion": "3.11.0",
17604
17604
  "doc:sourceSpec": "RAML 1.0"
17605
17605
  },
17606
17606
  {
@@ -17636,7 +17636,7 @@
17636
17636
  "@type": [
17637
17637
  "doc:APIContractProcessingData"
17638
17638
  ],
17639
- "apiContract:modelVersion": "3.10.0",
17639
+ "apiContract:modelVersion": "3.11.0",
17640
17640
  "doc:sourceSpec": "RAML 1.0"
17641
17641
  },
17642
17642
  {
@@ -17669,7 +17669,7 @@
17669
17669
  "@type": [
17670
17670
  "doc:APIContractProcessingData"
17671
17671
  ],
17672
- "apiContract:modelVersion": "3.10.0",
17672
+ "apiContract:modelVersion": "3.11.0",
17673
17673
  "doc:sourceSpec": "RAML 1.0"
17674
17674
  },
17675
17675
  {
@@ -5,7 +5,7 @@
5
5
  "@type": [
6
6
  "doc:APIContractProcessingData"
7
7
  ],
8
- "apiContract:modelVersion": "3.10.0",
8
+ "apiContract:modelVersion": "3.11.0",
9
9
  "doc:transformed": true,
10
10
  "doc:sourceSpec": "RAML 1.0"
11
11
  },
@@ -1777,7 +1777,7 @@
1777
1777
  "@type": [
1778
1778
  "doc:APIContractProcessingData"
1779
1779
  ],
1780
- "apiContract:modelVersion": "3.10.0",
1780
+ "apiContract:modelVersion": "3.11.0",
1781
1781
  "doc:sourceSpec": "RAML 1.0"
1782
1782
  },
1783
1783
  {
@@ -1805,7 +1805,7 @@
1805
1805
  "@type": [
1806
1806
  "doc:APIContractProcessingData"
1807
1807
  ],
1808
- "apiContract:modelVersion": "3.10.0",
1808
+ "apiContract:modelVersion": "3.11.0",
1809
1809
  "doc:sourceSpec": "RAML 1.0"
1810
1810
  },
1811
1811
  {
@@ -1833,7 +1833,7 @@
1833
1833
  "@type": [
1834
1834
  "doc:APIContractProcessingData"
1835
1835
  ],
1836
- "apiContract:modelVersion": "3.10.0",
1836
+ "apiContract:modelVersion": "3.11.0",
1837
1837
  "doc:sourceSpec": "RAML 1.0"
1838
1838
  },
1839
1839
  {
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.14.1",
4
+ "version": "0.14.2",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -111,7 +111,7 @@
111
111
  "@types/express-ntlm": "^2.3.3",
112
112
  "@types/jsdom": "^21.1.7",
113
113
  "@types/mocha": "^10.0.10",
114
- "@types/node": "^22.13.4",
114
+ "@types/node": "^24.0.1",
115
115
  "@types/sinon": "^17.0.1",
116
116
  "@web/dev-server": "^0.4.6",
117
117
  "@web/dev-server-rollup": "^0.6.4",
@@ -12,6 +12,26 @@ import type { AssociationTarget, DomainGraphEdge } from './types.js'
12
12
  import { ShapeGenerator } from './amf/ShapeGenerator.js'
13
13
  import { DataSemantics, isAssociationSemantic, type SemanticType, type AppliedDataSemantic } from './Semantics.js'
14
14
 
15
+ /**
16
+ * Defines the behavior when a parent entity in an association is deleted.
17
+ *
18
+ * - `restrict`: Prevents the deletion of a parent entity if it has any associated child entities.
19
+ * The generated API should return a clear and specific error message (e.g., 409 Conflict).
20
+ * - _Example_: Do not allow a Department to be deleted if it still has Employees.
21
+ * - `cascade`: Automatically deletes all associated child entities when the parent entity is deleted.
22
+ * - _Example_: Deleting a User will also delete all their associated Posts and Comments.
23
+ * - `setNull`: Sets the foreign key of the associated child entities to NULL. This is only valid if the
24
+ * association property on the child entity is nullable.
25
+ * - _Example_: When a `Project` is deleted, the `project_id` on associated `Tasks` is set to NULL,
26
+ * making them unassigned but not deleting them.
27
+ * - `doNothing`: No action is taken on the associated child entities when the parent entity is deleted.
28
+ * - _Example_: Deleting a `Category` does not affect associated `Products`, which remain in the database
29
+ * but may become orphaned.
30
+ * This is useful when the association is optional or when child entities should not be deleted
31
+ * or modified upon the deletion of a parent entity.
32
+ */
33
+ export type OnDeleteRule = 'restrict' | 'cascade' | 'setNull' | 'doNothing'
34
+
15
35
  export interface DomainAssociationSchema extends DomainElementSchema {
16
36
  kind: typeof DomainAssociationKind
17
37
  /**
@@ -54,6 +74,14 @@ export interface DomainAssociationSchema extends DomainElementSchema {
54
74
  * describe the association in more detail.
55
75
  */
56
76
  semantics?: AppliedDataSemantic[]
77
+ /**
78
+ * Defines the behavior when a parent entity in an association is deleted.
79
+ */
80
+ onDelete?: OnDeleteRule
81
+ /**
82
+ * Whether the association is read-only.
83
+ */
84
+ readOnly?: boolean
57
85
  }
58
86
 
59
87
  /**
@@ -153,6 +181,16 @@ export class DomainAssociation extends DomainElement {
153
181
  */
154
182
  @observed({ deep: true }) accessor semantics: AppliedDataSemantic[] = []
155
183
 
184
+ /**
185
+ * Defines the behavior when a parent entity in an association is deleted.
186
+ */
187
+ @observed() accessor onDelete: OnDeleteRule | undefined
188
+
189
+ /**
190
+ * Whether the association is read-only.
191
+ */
192
+ @observed() accessor readOnly: boolean | undefined
193
+
156
194
  /**
157
195
  * Creates a full data association schema with defaults.
158
196
  *
@@ -170,6 +208,12 @@ export class DomainAssociation extends DomainElement {
170
208
  if (Array.isArray(semantics)) {
171
209
  result.semantics = [...semantics]
172
210
  }
211
+ if (input.onDelete) {
212
+ result.onDelete = input.onDelete
213
+ }
214
+ if (typeof input.readOnly === 'boolean') {
215
+ result.readOnly = input.readOnly
216
+ }
173
217
  if (input.schema) {
174
218
  result.schema = structuredClone(input.schema)
175
219
  }
@@ -227,6 +271,12 @@ export class DomainAssociation extends DomainElement {
227
271
  } else {
228
272
  this.semantics = []
229
273
  }
274
+ if (init.onDelete) {
275
+ this.onDelete = init.onDelete
276
+ }
277
+ if (typeof init.readOnly === 'boolean') {
278
+ this.readOnly = init.readOnly
279
+ }
230
280
  }
231
281
 
232
282
  /**
@@ -258,6 +308,12 @@ export class DomainAssociation extends DomainElement {
258
308
  if (Array.isArray(this.semantics) && this.semantics.length) {
259
309
  result.semantics = toRaw(this, this.semantics)?.map((i) => structuredClone(i))
260
310
  }
311
+ if (this.onDelete) {
312
+ result.onDelete = this.onDelete
313
+ }
314
+ if (typeof this.readOnly === 'boolean' && this.readOnly) {
315
+ result.readOnly = this.readOnly
316
+ }
261
317
  return result
262
318
  }
263
319
 
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-len */
1
2
  import type { DomainPropertyType } from './DataFormat.js'
2
3
 
3
4
  /**
@@ -17,6 +18,14 @@ export enum SemanticType {
17
18
  DeletedTimestamp = 'https://apinow.app/semantics/properties/#DeletedTimestamp',
18
19
  DeletedFlag = 'https://apinow.app/semantics/properties/#DeletedFlag',
19
20
  PublicUniqueName = 'https://apinow.app/semantics/properties/#PublicUniqueName',
21
+ /**
22
+ * Designates a Data Property as the `role` of a user within the system.
23
+ * This is used to define the user's permissions and access levels.
24
+ * For example, a user with the role of "admin" would have elevated permissions
25
+ * compared to a user with the role of "guest".
26
+ * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.
27
+ */
28
+ UserRole = 'https://apinow.app/semantics/entities/#UserRole',
20
29
  // Association-Level Semantics
21
30
  ResourceOwnerIdentifier = 'https://apinow.app/semantics/associations/#ResourceOwnerIdentifier',
22
31
  }
@@ -159,6 +168,14 @@ export const DataSemantics: Record<SemanticType, DataSemantic> = {
159
168
  description: 'A user-friendly, unique public identifier for a resource, often used in URLs.',
160
169
  applicableDataTypes: ['string'],
161
170
  },
171
+ [SemanticType.UserRole]: {
172
+ id: SemanticType.UserRole,
173
+ displayName: 'User Role Field',
174
+ scope: SemanticScope.Property,
175
+ description:
176
+ '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.',
177
+ applicableDataTypes: ['string'],
178
+ },
162
179
  }
163
180
 
164
181
  /**