@api-client/core 0.18.56 → 0.18.58

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 (269) hide show
  1. package/build/src/modeling/ApiModel.d.ts +7 -5
  2. package/build/src/modeling/ApiModel.d.ts.map +1 -1
  3. package/build/src/modeling/ApiModel.js +35 -16
  4. package/build/src/modeling/ApiModel.js.map +1 -1
  5. package/build/src/modeling/ExposedEntity.d.ts +5 -2
  6. package/build/src/modeling/ExposedEntity.d.ts.map +1 -1
  7. package/build/src/modeling/ExposedEntity.js +11 -8
  8. package/build/src/modeling/ExposedEntity.js.map +1 -1
  9. package/build/src/modeling/actions/Action.d.ts +41 -0
  10. package/build/src/modeling/actions/Action.d.ts.map +1 -0
  11. package/build/src/modeling/actions/Action.js +64 -0
  12. package/build/src/modeling/actions/Action.js.map +1 -0
  13. package/build/src/modeling/actions/CreateAction.d.ts +18 -0
  14. package/build/src/modeling/actions/CreateAction.d.ts.map +1 -0
  15. package/build/src/modeling/actions/CreateAction.js +37 -0
  16. package/build/src/modeling/actions/CreateAction.js.map +1 -0
  17. package/build/src/modeling/actions/DeleteAction.d.ts +34 -0
  18. package/build/src/modeling/actions/DeleteAction.d.ts.map +1 -0
  19. package/build/src/modeling/actions/DeleteAction.js +57 -0
  20. package/build/src/modeling/actions/DeleteAction.js.map +1 -0
  21. package/build/src/modeling/actions/ListAction.d.ts +37 -0
  22. package/build/src/modeling/actions/ListAction.d.ts.map +1 -0
  23. package/build/src/modeling/actions/ListAction.js +70 -0
  24. package/build/src/modeling/actions/ListAction.js.map +1 -0
  25. package/build/src/modeling/actions/ReadAction.d.ts +18 -0
  26. package/build/src/modeling/actions/ReadAction.d.ts.map +1 -0
  27. package/build/src/modeling/actions/ReadAction.js +37 -0
  28. package/build/src/modeling/actions/ReadAction.js.map +1 -0
  29. package/build/src/modeling/actions/SearchAction.d.ts +24 -0
  30. package/build/src/modeling/actions/SearchAction.d.ts.map +1 -0
  31. package/build/src/modeling/actions/SearchAction.js +47 -0
  32. package/build/src/modeling/actions/SearchAction.js.map +1 -0
  33. package/build/src/modeling/actions/UpdateAction.d.ts +27 -0
  34. package/build/src/modeling/actions/UpdateAction.d.ts.map +1 -0
  35. package/build/src/modeling/actions/UpdateAction.js +47 -0
  36. package/build/src/modeling/actions/UpdateAction.js.map +1 -0
  37. package/build/src/modeling/actions/index.d.ts +24 -0
  38. package/build/src/modeling/actions/index.d.ts.map +1 -0
  39. package/build/src/modeling/actions/index.js +9 -0
  40. package/build/src/modeling/actions/index.js.map +1 -0
  41. package/build/src/modeling/helpers/Intelisense.d.ts +1 -0
  42. package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
  43. package/build/src/modeling/helpers/Intelisense.js +23 -0
  44. package/build/src/modeling/helpers/Intelisense.js.map +1 -1
  45. package/build/src/modeling/index.d.ts +12 -0
  46. package/build/src/modeling/index.d.ts.map +1 -0
  47. package/build/src/modeling/index.js +12 -0
  48. package/build/src/modeling/index.js.map +1 -0
  49. package/build/src/modeling/rules/AccessRule.d.ts +17 -0
  50. package/build/src/modeling/rules/AccessRule.d.ts.map +1 -0
  51. package/build/src/modeling/rules/AccessRule.js +19 -0
  52. package/build/src/modeling/rules/AccessRule.js.map +1 -0
  53. package/build/src/modeling/rules/AllowAuthenticated.d.ts +19 -0
  54. package/build/src/modeling/rules/AllowAuthenticated.d.ts.map +1 -0
  55. package/build/src/modeling/rules/AllowAuthenticated.js +14 -0
  56. package/build/src/modeling/rules/AllowAuthenticated.js.map +1 -0
  57. package/build/src/modeling/rules/AllowPublic.d.ts +19 -0
  58. package/build/src/modeling/rules/AllowPublic.d.ts.map +1 -0
  59. package/build/src/modeling/rules/AllowPublic.js +14 -0
  60. package/build/src/modeling/rules/AllowPublic.js.map +1 -0
  61. package/build/src/modeling/rules/MatchEmailDomain.d.ts +25 -0
  62. package/build/src/modeling/rules/MatchEmailDomain.d.ts.map +1 -0
  63. package/build/src/modeling/rules/MatchEmailDomain.js +40 -0
  64. package/build/src/modeling/rules/MatchEmailDomain.js.map +1 -0
  65. package/build/src/modeling/rules/MatchResourceOwner.d.ts +29 -0
  66. package/build/src/modeling/rules/MatchResourceOwner.d.ts.map +1 -0
  67. package/build/src/modeling/rules/MatchResourceOwner.js +40 -0
  68. package/build/src/modeling/rules/MatchResourceOwner.js.map +1 -0
  69. package/build/src/modeling/rules/MatchUserProperty.d.ts +28 -0
  70. package/build/src/modeling/rules/MatchUserProperty.d.ts.map +1 -0
  71. package/build/src/modeling/rules/MatchUserProperty.js +49 -0
  72. package/build/src/modeling/rules/MatchUserProperty.js.map +1 -0
  73. package/build/src/modeling/rules/MatchUserRole.d.ts +29 -0
  74. package/build/src/modeling/rules/MatchUserRole.d.ts.map +1 -0
  75. package/build/src/modeling/rules/MatchUserRole.js +40 -0
  76. package/build/src/modeling/rules/MatchUserRole.js.map +1 -0
  77. package/build/src/modeling/rules/RateLimitRule.d.ts +61 -0
  78. package/build/src/modeling/rules/RateLimitRule.d.ts.map +1 -0
  79. package/build/src/modeling/rules/RateLimitRule.js +101 -0
  80. package/build/src/modeling/rules/RateLimitRule.js.map +1 -0
  81. package/build/src/modeling/rules/RateLimitingConfiguration.d.ts +18 -0
  82. package/build/src/modeling/rules/RateLimitingConfiguration.d.ts.map +1 -0
  83. package/build/src/modeling/rules/RateLimitingConfiguration.js +35 -0
  84. package/build/src/modeling/rules/RateLimitingConfiguration.js.map +1 -0
  85. package/build/src/modeling/rules/index.d.ts +13 -0
  86. package/build/src/modeling/rules/index.d.ts.map +1 -0
  87. package/build/src/modeling/rules/index.js +10 -0
  88. package/build/src/modeling/rules/index.js.map +1 -0
  89. package/build/src/modeling/types.d.ts +6 -257
  90. package/build/src/modeling/types.d.ts.map +1 -1
  91. package/build/src/modeling/types.js.map +1 -1
  92. package/build/tsconfig.tsbuildinfo +1 -1
  93. package/data/models/example-generator-api.json +27 -27
  94. package/package.json +2 -7
  95. package/src/modeling/ApiModel.ts +21 -19
  96. package/src/modeling/ExposedEntity.ts +13 -18
  97. package/src/modeling/actions/Action.ts +64 -0
  98. package/src/modeling/actions/CreateAction.ts +30 -0
  99. package/src/modeling/actions/DeleteAction.ts +51 -0
  100. package/src/modeling/actions/ListAction.ts +58 -0
  101. package/src/modeling/actions/ReadAction.ts +32 -0
  102. package/src/modeling/actions/SearchAction.ts +38 -0
  103. package/src/modeling/actions/UpdateAction.ts +41 -0
  104. package/src/modeling/helpers/Intelisense.ts +23 -0
  105. package/src/modeling/rules/AccessRule.ts +29 -0
  106. package/src/modeling/rules/AllowAuthenticated.ts +24 -0
  107. package/src/modeling/rules/AllowPublic.ts +24 -0
  108. package/src/modeling/rules/MatchEmailDomain.ts +39 -0
  109. package/src/modeling/rules/MatchResourceOwner.ts +43 -0
  110. package/src/modeling/rules/MatchUserProperty.ts +44 -0
  111. package/src/modeling/rules/MatchUserRole.ts +43 -0
  112. package/src/modeling/rules/RateLimitRule.ts +104 -0
  113. package/src/modeling/rules/RateLimitingConfiguration.ts +32 -0
  114. package/src/modeling/types.ts +6 -276
  115. package/tests/unit/modeling/actions/Action.spec.ts +109 -0
  116. package/tests/unit/modeling/actions/CreateAction.spec.ts +65 -0
  117. package/tests/unit/modeling/actions/DeleteAction.spec.ts +78 -0
  118. package/tests/unit/modeling/actions/ListAction.spec.ts +106 -0
  119. package/tests/unit/modeling/actions/ReadAction.spec.ts +77 -0
  120. package/tests/unit/modeling/actions/SearchAction.spec.ts +73 -0
  121. package/tests/unit/modeling/actions/UpdateAction.spec.ts +73 -0
  122. package/tests/unit/modeling/api_model.spec.ts +48 -3
  123. package/tests/unit/modeling/exposed_entity.spec.ts +73 -0
  124. package/tests/unit/modeling/helpers/intellisense.spec.ts +46 -0
  125. package/tests/unit/modeling/rules/AccessRule.spec.ts +42 -0
  126. package/tests/unit/modeling/rules/AllowAuthenticated.spec.ts +28 -0
  127. package/tests/unit/modeling/rules/AllowPublic.spec.ts +28 -0
  128. package/tests/unit/modeling/rules/MatchEmailDomain.spec.ts +52 -0
  129. package/tests/unit/modeling/rules/MatchResourceOwner.spec.ts +37 -0
  130. package/tests/unit/modeling/rules/MatchUserProperty.spec.ts +58 -0
  131. package/tests/unit/modeling/rules/MatchUserRole.spec.ts +52 -0
  132. package/tests/unit/modeling/rules/RateLimitRule.spec.ts +70 -0
  133. package/tests/unit/modeling/rules/RateLimitingConfiguration.spec.ts +61 -0
  134. package/build/src/modeling/templates/index.d.ts +0 -21
  135. package/build/src/modeling/templates/index.d.ts.map +0 -1
  136. package/build/src/modeling/templates/index.js +0 -176
  137. package/build/src/modeling/templates/index.js.map +0 -1
  138. package/build/src/modeling/templates/meta/blog-publishing-platform.json +0 -1
  139. package/build/src/modeling/templates/meta/ecommerce-platform.json +0 -1
  140. package/build/src/modeling/templates/meta/education-management-platform.json +0 -1
  141. package/build/src/modeling/templates/meta/financial-services-platform.json +0 -1
  142. package/build/src/modeling/templates/meta/gaming-platform.json +0 -1
  143. package/build/src/modeling/templates/meta/healthcare-management-platform.json +0 -1
  144. package/build/src/modeling/templates/meta/hospitality-platform.json +0 -1
  145. package/build/src/modeling/templates/meta/index.d.ts +0 -64
  146. package/build/src/modeling/templates/meta/index.d.ts.map +0 -1
  147. package/build/src/modeling/templates/meta/index.js +0 -150
  148. package/build/src/modeling/templates/meta/index.js.map +0 -1
  149. package/build/src/modeling/templates/meta/iot-smart-home-platform.json +0 -1
  150. package/build/src/modeling/templates/meta/legal-services-platform.json +0 -1
  151. package/build/src/modeling/templates/meta/manufacturing-platform.json +0 -1
  152. package/build/src/modeling/templates/meta/non-profit-platform.json +0 -1
  153. package/build/src/modeling/templates/meta/real-estate-management-platform.json +0 -1
  154. package/build/src/modeling/templates/template-registry.d.ts +0 -55
  155. package/build/src/modeling/templates/template-registry.d.ts.map +0 -1
  156. package/build/src/modeling/templates/template-registry.js +0 -111
  157. package/build/src/modeling/templates/template-registry.js.map +0 -1
  158. package/build/src/modeling/templates/types.d.ts +0 -167
  159. package/build/src/modeling/templates/types.d.ts.map +0 -1
  160. package/build/src/modeling/templates/types.js +0 -2
  161. package/build/src/modeling/templates/types.js.map +0 -1
  162. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.d.ts +0 -39
  163. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.d.ts.map +0 -1
  164. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.js +0 -672
  165. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.js.map +0 -1
  166. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts +0 -40
  167. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts.map +0 -1
  168. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js +0 -942
  169. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js.map +0 -1
  170. package/build/src/modeling/templates/verticals/business-services/hospitality-domain.d.ts +0 -45
  171. package/build/src/modeling/templates/verticals/business-services/hospitality-domain.d.ts.map +0 -1
  172. package/build/src/modeling/templates/verticals/business-services/hospitality-domain.js +0 -797
  173. package/build/src/modeling/templates/verticals/business-services/hospitality-domain.js.map +0 -1
  174. package/build/src/modeling/templates/verticals/business-services/index.d.ts +0 -21
  175. package/build/src/modeling/templates/verticals/business-services/index.d.ts.map +0 -1
  176. package/build/src/modeling/templates/verticals/business-services/index.js +0 -50
  177. package/build/src/modeling/templates/verticals/business-services/index.js.map +0 -1
  178. package/build/src/modeling/templates/verticals/business-services/legal-services-domain.d.ts +0 -46
  179. package/build/src/modeling/templates/verticals/business-services/legal-services-domain.d.ts.map +0 -1
  180. package/build/src/modeling/templates/verticals/business-services/legal-services-domain.js +0 -837
  181. package/build/src/modeling/templates/verticals/business-services/legal-services-domain.js.map +0 -1
  182. package/build/src/modeling/templates/verticals/education-training/education-domain.d.ts +0 -40
  183. package/build/src/modeling/templates/verticals/education-training/education-domain.d.ts.map +0 -1
  184. package/build/src/modeling/templates/verticals/education-training/education-domain.js +0 -725
  185. package/build/src/modeling/templates/verticals/education-training/education-domain.js.map +0 -1
  186. package/build/src/modeling/templates/verticals/education-training/index.d.ts +0 -18
  187. package/build/src/modeling/templates/verticals/education-training/index.d.ts.map +0 -1
  188. package/build/src/modeling/templates/verticals/education-training/index.js +0 -21
  189. package/build/src/modeling/templates/verticals/education-training/index.js.map +0 -1
  190. package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.d.ts +0 -40
  191. package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.d.ts.map +0 -1
  192. package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.js +0 -859
  193. package/build/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.js.map +0 -1
  194. package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.d.ts +0 -18
  195. package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.d.ts.map +0 -1
  196. package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.js +0 -21
  197. package/build/src/modeling/templates/verticals/healthcare-life-sciences/index.js.map +0 -1
  198. package/build/src/modeling/templates/verticals/index.d.ts +0 -79
  199. package/build/src/modeling/templates/verticals/index.d.ts.map +0 -1
  200. package/build/src/modeling/templates/verticals/index.js +0 -186
  201. package/build/src/modeling/templates/verticals/index.js.map +0 -1
  202. package/build/src/modeling/templates/verticals/manufacturing-logistics/index.d.ts +0 -18
  203. package/build/src/modeling/templates/verticals/manufacturing-logistics/index.d.ts.map +0 -1
  204. package/build/src/modeling/templates/verticals/manufacturing-logistics/index.js +0 -22
  205. package/build/src/modeling/templates/verticals/manufacturing-logistics/index.js.map +0 -1
  206. package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.d.ts +0 -45
  207. package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.d.ts.map +0 -1
  208. package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.js +0 -710
  209. package/build/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.js.map +0 -1
  210. package/build/src/modeling/templates/verticals/public-sector/index.d.ts +0 -18
  211. package/build/src/modeling/templates/verticals/public-sector/index.d.ts.map +0 -1
  212. package/build/src/modeling/templates/verticals/public-sector/index.js +0 -22
  213. package/build/src/modeling/templates/verticals/public-sector/index.js.map +0 -1
  214. package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.d.ts +0 -47
  215. package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.d.ts.map +0 -1
  216. package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.js +0 -864
  217. package/build/src/modeling/templates/verticals/public-sector/non-profit-domain.js.map +0 -1
  218. package/build/src/modeling/templates/verticals/real-estate-construction/index.d.ts +0 -18
  219. package/build/src/modeling/templates/verticals/real-estate-construction/index.d.ts.map +0 -1
  220. package/build/src/modeling/templates/verticals/real-estate-construction/index.js +0 -21
  221. package/build/src/modeling/templates/verticals/real-estate-construction/index.js.map +0 -1
  222. package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.d.ts +0 -40
  223. package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.d.ts.map +0 -1
  224. package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.js +0 -727
  225. package/build/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.js.map +0 -1
  226. package/build/src/modeling/templates/verticals/technology-media/blog-domain.d.ts +0 -40
  227. package/build/src/modeling/templates/verticals/technology-media/blog-domain.d.ts.map +0 -1
  228. package/build/src/modeling/templates/verticals/technology-media/blog-domain.js +0 -629
  229. package/build/src/modeling/templates/verticals/technology-media/blog-domain.js.map +0 -1
  230. package/build/src/modeling/templates/verticals/technology-media/gaming-domain.d.ts +0 -46
  231. package/build/src/modeling/templates/verticals/technology-media/gaming-domain.d.ts.map +0 -1
  232. package/build/src/modeling/templates/verticals/technology-media/gaming-domain.js +0 -1033
  233. package/build/src/modeling/templates/verticals/technology-media/gaming-domain.js.map +0 -1
  234. package/build/src/modeling/templates/verticals/technology-media/index.d.ts +0 -21
  235. package/build/src/modeling/templates/verticals/technology-media/index.d.ts.map +0 -1
  236. package/build/src/modeling/templates/verticals/technology-media/index.js +0 -42
  237. package/build/src/modeling/templates/verticals/technology-media/index.js.map +0 -1
  238. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts +0 -47
  239. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.d.ts.map +0 -1
  240. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js +0 -1029
  241. package/build/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.js.map +0 -1
  242. package/src/modeling/templates/meta/blog-publishing-platform.json +0 -1
  243. package/src/modeling/templates/meta/ecommerce-platform.json +0 -1
  244. package/src/modeling/templates/meta/education-management-platform.json +0 -1
  245. package/src/modeling/templates/meta/financial-services-platform.json +0 -1
  246. package/src/modeling/templates/meta/gaming-platform.json +0 -1
  247. package/src/modeling/templates/meta/healthcare-management-platform.json +0 -1
  248. package/src/modeling/templates/meta/hospitality-platform.json +0 -1
  249. package/src/modeling/templates/meta/iot-smart-home-platform.json +0 -1
  250. package/src/modeling/templates/meta/legal-services-platform.json +0 -1
  251. package/src/modeling/templates/meta/manufacturing-platform.json +0 -1
  252. package/src/modeling/templates/meta/non-profit-platform.json +0 -1
  253. package/src/modeling/templates/meta/real-estate-management-platform.json +0 -1
  254. package/src/modeling/templates/readme.md +0 -260
  255. package/src/modeling/templates/template-registry.ts +0 -140
  256. package/src/modeling/templates/types.ts +0 -175
  257. package/src/modeling/templates/verticals/README.md +0 -122
  258. package/src/modeling/templates/verticals/business-services/ecommerce-domain.ts +0 -844
  259. package/src/modeling/templates/verticals/business-services/financial-services-domain.ts +0 -1177
  260. package/src/modeling/templates/verticals/business-services/hospitality-domain.ts +0 -994
  261. package/src/modeling/templates/verticals/business-services/legal-services-domain.ts +0 -1059
  262. package/src/modeling/templates/verticals/education-training/education-domain.ts +0 -922
  263. package/src/modeling/templates/verticals/healthcare-life-sciences/healthcare-domain.ts +0 -1111
  264. package/src/modeling/templates/verticals/manufacturing-logistics/manufacturing-domain.ts +0 -895
  265. package/src/modeling/templates/verticals/public-sector/non-profit-domain.ts +0 -1109
  266. package/src/modeling/templates/verticals/real-estate-construction/real-estate-domain.ts +0 -944
  267. package/src/modeling/templates/verticals/technology-media/blog-domain.ts +0 -796
  268. package/src/modeling/templates/verticals/technology-media/gaming-domain.ts +0 -1290
  269. package/src/modeling/templates/verticals/technology-media/iot-smart-home-domain.ts +0 -1289
@@ -42062,6 +42062,9 @@
42062
42062
  "@id": "#209"
42063
42063
  },
42064
42064
  {
42065
+ "@id": "#206"
42066
+ },
42067
+ {
42065
42068
  "@id": "#191"
42066
42069
  },
42067
42070
  {
@@ -42077,9 +42080,6 @@
42077
42080
  "@id": "#203"
42078
42081
  },
42079
42082
  {
42080
- "@id": "#206"
42081
- },
42082
- {
42083
42083
  "@id": "#209"
42084
42084
  }
42085
42085
  ],
@@ -42810,16 +42810,16 @@
42810
42810
  "@id": "#219"
42811
42811
  },
42812
42812
  {
42813
- "@id": "#210"
42813
+ "@id": "#219"
42814
42814
  },
42815
42815
  {
42816
- "@id": "#213"
42816
+ "@id": "#216"
42817
42817
  },
42818
42818
  {
42819
- "@id": "#216"
42819
+ "@id": "#210"
42820
42820
  },
42821
42821
  {
42822
- "@id": "#219"
42822
+ "@id": "#213"
42823
42823
  }
42824
42824
  ],
42825
42825
  "doc:root": false,
@@ -43436,7 +43436,7 @@
43436
43436
  "doc:ExternalDomainElement",
43437
43437
  "doc:DomainElement"
43438
43438
  ],
43439
- "doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
43439
+ "doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
43440
43440
  "core:mediaType": "application/yaml",
43441
43441
  "sourcemaps:sources": [
43442
43442
  {
@@ -43457,7 +43457,7 @@
43457
43457
  "doc:ExternalDomainElement",
43458
43458
  "doc:DomainElement"
43459
43459
  ],
43460
- "doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
43460
+ "doc:raw": "code: '5'\ndescription: 'Limited company'\n",
43461
43461
  "core:mediaType": "application/yaml",
43462
43462
  "sourcemaps:sources": [
43463
43463
  {
@@ -43478,7 +43478,7 @@
43478
43478
  "doc:ExternalDomainElement",
43479
43479
  "doc:DomainElement"
43480
43480
  ],
43481
- "doc:raw": "code: '5'\ndescription: 'Limited company'\n",
43481
+ "doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
43482
43482
  "core:mediaType": "application/yaml",
43483
43483
  "sourcemaps:sources": [
43484
43484
  {
@@ -43499,7 +43499,7 @@
43499
43499
  "doc:ExternalDomainElement",
43500
43500
  "doc:DomainElement"
43501
43501
  ],
43502
- "doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
43502
+ "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43503
43503
  "core:mediaType": "application/yaml",
43504
43504
  "sourcemaps:sources": [
43505
43505
  {
@@ -43520,7 +43520,7 @@
43520
43520
  "doc:ExternalDomainElement",
43521
43521
  "doc:DomainElement"
43522
43522
  ],
43523
- "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43523
+ "doc:raw": "code: '7487'\ndescription: 'Financial and insurance activities'\ntype: \"PRIMARY\"\nclassificationCode: 'BE_NACEBEL2008'\nactivityGroupCode: 'ABCDE'\n",
43524
43524
  "core:mediaType": "application/yaml",
43525
43525
  "sourcemaps:sources": [
43526
43526
  {
@@ -43541,7 +43541,7 @@
43541
43541
  "doc:ExternalDomainElement",
43542
43542
  "doc:DomainElement"
43543
43543
  ],
43544
- "doc:raw": "code: '7487'\ndescription: 'Financial and insurance activities'\ntype: \"PRIMARY\"\nclassificationCode: 'BE_NACEBEL2008'\nactivityGroupCode: 'ABCDE'\n",
43544
+ "doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
43545
43545
  "core:mediaType": "application/yaml",
43546
43546
  "sourcemaps:sources": [
43547
43547
  {
@@ -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": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\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": "type: \"GENERAL\"\nvalue: \"www.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'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\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
  {
@@ -44756,32 +44756,32 @@
44756
44756
  {
44757
44757
  "@id": "#193/source-map/lexical/element_0",
44758
44758
  "sourcemaps:element": "amf://id#193",
44759
- "sourcemaps:value": "[(1,0)-(7,0)]"
44759
+ "sourcemaps:value": "[(1,0)-(10,0)]"
44760
44760
  },
44761
44761
  {
44762
44762
  "@id": "#196/source-map/lexical/element_0",
44763
44763
  "sourcemaps:element": "amf://id#196",
44764
- "sourcemaps:value": "[(1,0)-(10,0)]"
44764
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44765
44765
  },
44766
44766
  {
44767
44767
  "@id": "#199/source-map/lexical/element_0",
44768
44768
  "sourcemaps:element": "amf://id#199",
44769
- "sourcemaps:value": "[(1,0)-(3,0)]"
44769
+ "sourcemaps:value": "[(1,0)-(5,0)]"
44770
44770
  },
44771
44771
  {
44772
44772
  "@id": "#202/source-map/lexical/element_0",
44773
44773
  "sourcemaps:element": "amf://id#202",
44774
- "sourcemaps:value": "[(1,0)-(5,0)]"
44774
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44775
44775
  },
44776
44776
  {
44777
44777
  "@id": "#205/source-map/lexical/element_0",
44778
44778
  "sourcemaps:element": "amf://id#205",
44779
- "sourcemaps:value": "[(1,0)-(3,0)]"
44779
+ "sourcemaps:value": "[(1,0)-(6,0)]"
44780
44780
  },
44781
44781
  {
44782
44782
  "@id": "#208/source-map/lexical/element_0",
44783
44783
  "sourcemaps:element": "amf://id#208",
44784
- "sourcemaps:value": "[(1,0)-(6,0)]"
44784
+ "sourcemaps:value": "[(1,0)-(7,0)]"
44785
44785
  },
44786
44786
  {
44787
44787
  "@id": "#223/source-map/lexical/element_0",
@@ -45116,22 +45116,22 @@
45116
45116
  {
45117
45117
  "@id": "#212/source-map/lexical/element_0",
45118
45118
  "sourcemaps:element": "amf://id#212",
45119
- "sourcemaps:value": "[(1,0)-(6,0)]"
45119
+ "sourcemaps:value": "[(1,0)-(7,0)]"
45120
45120
  },
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)-(3,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)-(6,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.18.56",
4
+ "version": "0.18.58",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -288,14 +288,9 @@
288
288
  "command": "prettier \"**/*.ts\" --write"
289
289
  }
290
290
  },
291
- "husky": {
292
- "hooks": {
293
- "pre-commit": "lint-staged"
294
- }
295
- },
296
291
  "lint-staged": {
297
292
  "*.ts": [
298
- "eslint --fix"
293
+ "npm run format"
299
294
  ]
300
295
  },
301
296
  "engines": {
@@ -2,12 +2,10 @@ import { nanoid } from '../nanoid.js'
2
2
  import { ApiModelKind, DataDomainKind, ExposedEntityKind } from '../models/kinds.js'
3
3
  import { type IThing, Thing } from '../models/Thing.js'
4
4
  import type {
5
- AccessRule,
6
5
  AssociationTarget,
7
6
  AuthenticationConfiguration,
8
7
  AuthorizationConfiguration,
9
8
  ExposedEntitySchema,
10
- RateLimitingConfiguration,
11
9
  RolesBasedAccessControl,
12
10
  SessionConfiguration,
13
11
  UsernamePasswordConfiguration,
@@ -19,6 +17,8 @@ import { observed, toRaw } from '../decorators/observed.js'
19
17
  import pluralize from '@jarrodek/pluralize'
20
18
  import { createDomainKey } from './helpers/keying.js'
21
19
  import { ExposedEntity } from './ExposedEntity.js'
20
+ import { AccessRule, AccessRuleSchema } from './rules/AccessRule.js'
21
+ import { RateLimitingConfiguration, RateLimitingConfigurationSchema } from './rules/RateLimitingConfiguration.js'
22
22
 
23
23
  /**
24
24
  * Contact information for the exposed API.
@@ -106,12 +106,12 @@ export interface ApiModelSchema extends DependentModelSchema {
106
106
  * These rules apply to all exposed entities and actions. An API action
107
107
  * can declare its own access rules, which will override these.
108
108
  */
109
- accessRule?: AccessRule[]
109
+ accessRule?: AccessRuleSchema[]
110
110
  /**
111
111
  * Optional configuration for API-wide rate limiting and throttling.
112
112
  * Defines rules to protect the API from overuse.
113
113
  */
114
- rateLimiting?: RateLimitingConfiguration
114
+ rateLimiting?: RateLimitingConfigurationSchema
115
115
  /**
116
116
  * A URL to the Terms of Service for the API.
117
117
  */
@@ -179,12 +179,12 @@ export class ApiModel extends DependentModel {
179
179
  * These rules apply to all exposed entities and actions. An API action
180
180
  * can declare its own access rules, which will override these.
181
181
  */
182
- accessRule?: AccessRule[]
182
+ @observed({ deep: true }) accessor accessRule: AccessRule[]
183
183
  /**
184
184
  * Optional configuration for API-wide rate limiting and throttling.
185
185
  * Defines rules to protect the API from overuse.
186
186
  */
187
- rateLimiting?: RateLimitingConfiguration
187
+ @observed() accessor rateLimiting: RateLimitingConfiguration | undefined
188
188
  /**
189
189
  * A URL to the Terms of Service for the API.
190
190
  */
@@ -238,25 +238,25 @@ export class ApiModel extends DependentModel {
238
238
  exposes,
239
239
  }
240
240
  if (input.user) {
241
- result.user = { ...input.user }
241
+ result.user = structuredClone(input.user)
242
242
  }
243
243
  if (input.dependencyList) {
244
244
  result.dependencyList = structuredClone(input.dependencyList)
245
245
  }
246
246
  if (input.authentication) {
247
- result.authentication = input.authentication
247
+ result.authentication = structuredClone(input.authentication)
248
248
  }
249
249
  if (input.authorization) {
250
- result.authorization = input.authorization
250
+ result.authorization = structuredClone(input.authorization)
251
251
  }
252
252
  if (input.session) {
253
- result.session = input.session
253
+ result.session = structuredClone(input.session)
254
254
  }
255
- if (input.accessRule) {
256
- result.accessRule = input.accessRule
255
+ if (Array.isArray(input.accessRule)) {
256
+ result.accessRule = structuredClone(input.accessRule)
257
257
  }
258
258
  if (input.rateLimiting) {
259
- result.rateLimiting = input.rateLimiting
259
+ result.rateLimiting = structuredClone(input.rateLimiting)
260
260
  }
261
261
  if (input.termsOfService) {
262
262
  result.termsOfService = input.termsOfService
@@ -309,11 +309,13 @@ export class ApiModel extends DependentModel {
309
309
  } else {
310
310
  this.exposes = []
311
311
  }
312
- if (init.accessRule) {
313
- this.accessRule = structuredClone(init.accessRule)
312
+ if (Array.isArray(init.accessRule)) {
313
+ this.accessRule = init.accessRule.map((rule) => new AccessRule(rule))
314
+ } else {
315
+ this.accessRule = []
314
316
  }
315
317
  if (init.rateLimiting) {
316
- this.rateLimiting = structuredClone(init.rateLimiting)
318
+ this.rateLimiting = new RateLimitingConfiguration(init.rateLimiting)
317
319
  }
318
320
  if (init.termsOfService) {
319
321
  this.termsOfService = init.termsOfService
@@ -352,11 +354,11 @@ export class ApiModel extends DependentModel {
352
354
  if (this.session) {
353
355
  result.session = structuredClone(this.session)
354
356
  }
355
- if (this.accessRule) {
356
- result.accessRule = structuredClone(this.accessRule)
357
+ if (Array.isArray(this.accessRule) && this.accessRule.length > 0) {
358
+ result.accessRule = this.accessRule.map((rule) => rule.toJSON())
357
359
  }
358
360
  if (this.rateLimiting) {
359
- result.rateLimiting = structuredClone(this.rateLimiting)
361
+ result.rateLimiting = this.rateLimiting.toJSON()
360
362
  }
361
363
  if (this.termsOfService) {
362
364
  result.termsOfService = this.termsOfService
@@ -1,17 +1,12 @@
1
1
  import { observed } from '../decorators/observed.js'
2
2
  import { ExposedEntityKind } from '../models/kinds.js'
3
3
  import { nanoid } from '../nanoid.js'
4
+ import { Action } from './actions/Action.js'
4
5
  import type { ApiModel } from './ApiModel.js'
5
6
  import { ensureLeadingSlash, joinPaths } from './helpers/endpointHelpers.js'
6
- import type {
7
- AccessRule,
8
- ApiAction,
9
- AssociationTarget,
10
- ExposeOptions,
11
- ExposeParentRef,
12
- RateLimitingConfiguration,
13
- ExposedEntitySchema,
14
- } from './types.js'
7
+ import { AccessRule } from './rules/AccessRule.js'
8
+ import { RateLimitingConfiguration } from './rules/RateLimitingConfiguration.js'
9
+ import type { AssociationTarget, ExposeOptions, ExposeParentRef, ExposedEntitySchema } from './types.js'
15
10
 
16
11
  /**
17
12
  * A class that specializes in representing an exposed Data Entity within an API Model.
@@ -91,7 +86,7 @@ export class ExposedEntity extends EventTarget {
91
86
  /**
92
87
  * The list of enabled API actions for this exposure (List/Read/Create/etc.)
93
88
  */
94
- @observed({ deep: true }) accessor actions: ApiAction[]
89
+ @observed({ deep: true }) accessor actions: Action[]
95
90
 
96
91
  /**
97
92
  * Optional array of access rules that define the access control policies for this exposure.
@@ -162,7 +157,7 @@ export class ExposedEntity extends EventTarget {
162
157
  if (exposeOptions !== undefined) {
163
158
  result.exposeOptions = { ...exposeOptions }
164
159
  }
165
- if (accessRule !== undefined) {
160
+ if (Array.isArray(accessRule)) {
166
161
  result.accessRule = accessRule.map((ar) => ({ ...ar }))
167
162
  }
168
163
  if (rateLimiting !== undefined) {
@@ -187,9 +182,9 @@ export class ExposedEntity extends EventTarget {
187
182
  this.isRoot = init.isRoot
188
183
  this.parent = init.parent
189
184
  this.exposeOptions = init.exposeOptions
190
- this.actions = init.actions
191
- this.accessRule = init.accessRule
192
- this.rateLimiting = init.rateLimiting
185
+ this.actions = init.actions ? init.actions.map((a) => new Action(a)) : []
186
+ this.accessRule = init.accessRule ? init.accessRule.map((ar) => new AccessRule(ar)) : []
187
+ this.rateLimiting = init.rateLimiting ? new RateLimitingConfiguration(init.rateLimiting) : undefined
193
188
  this.truncated = init.truncated
194
189
  this.#initializing = false
195
190
  }
@@ -212,7 +207,7 @@ export class ExposedEntity extends EventTarget {
212
207
  key: this.key,
213
208
  entity: { ...this.entity },
214
209
  resourcePath: this.resourcePath,
215
- actions: this.actions.map((a) => ({ ...a })),
210
+ actions: this.actions.map((a) => a.toJSON()),
216
211
  hasCollection: this.hasCollection,
217
212
  }
218
213
  if (this.collectionPath !== undefined) {
@@ -227,11 +222,11 @@ export class ExposedEntity extends EventTarget {
227
222
  if (this.exposeOptions !== undefined) {
228
223
  result.exposeOptions = { ...this.exposeOptions }
229
224
  }
230
- if (this.accessRule !== undefined) {
231
- result.accessRule = this.accessRule.map((ar) => ({ ...ar }))
225
+ if (Array.isArray(this.accessRule) && this.accessRule.length > 0) {
226
+ result.accessRule = this.accessRule.map((ar) => ar.toJSON())
232
227
  }
233
228
  if (this.rateLimiting !== undefined) {
234
- result.rateLimiting = { ...this.rateLimiting }
229
+ result.rateLimiting = this.rateLimiting.toJSON()
235
230
  }
236
231
  if (this.truncated !== undefined) {
237
232
  result.truncated = this.truncated
@@ -0,0 +1,64 @@
1
+ import { AccessRule, AccessRuleSchema } from '../rules/AccessRule.js'
2
+ import { RateLimitingConfiguration, RateLimitingConfigurationSchema } from '../rules/RateLimitingConfiguration.js'
3
+ import { observed } from '../../decorators/observed.js'
4
+
5
+ /**
6
+ * A base interface for common properties across all actions.
7
+ */
8
+ export interface ActionSchema {
9
+ /**
10
+ * The specific kind of action (e.g., 'List', 'Read', etc.)
11
+ */
12
+ kind: string
13
+ /**
14
+ * Access control rules defining who can perform this action. It is only applied if the
15
+ * authorization strategy is set to 'RBAC'.
16
+ * If no rules grant access, it's denied by default making it essentially private.
17
+ *
18
+ * Note, the API can defined top level access rules that apply to all actions. If this property is set,
19
+ * it overrides the top level access rules for this specific action.
20
+ *
21
+ * It is an ordered list, meaning the first rule that matches the user will be applied.
22
+ * If multiple rules match, the first one in the list takes precedence.
23
+ * If no rules match, the action is denied.
24
+ */
25
+ accessRule?: AccessRuleSchema[]
26
+ /**
27
+ * Optional configuration for action-wide rate limiting and throttling.
28
+ * Defines rules to protect the action from overuse.
29
+ */
30
+ rateLimiting?: RateLimitingConfigurationSchema
31
+ }
32
+
33
+ /**
34
+ * A base class for common properties across all actions.
35
+ */
36
+ export class Action extends EventTarget implements ActionSchema {
37
+ @observed() accessor kind: string
38
+ @observed({ deep: true }) accessor accessRule: AccessRule[]
39
+ @observed({ deep: true }) accessor rateLimiting: RateLimitingConfiguration | undefined
40
+
41
+ constructor(state: Partial<ActionSchema> = {}) {
42
+ super()
43
+ this.kind = state.kind || ''
44
+ this.accessRule = state.accessRule ? state.accessRule.map((rule) => new AccessRule(rule)) : []
45
+ this.rateLimiting = state.rateLimiting ? new RateLimitingConfiguration(state.rateLimiting) : undefined
46
+ }
47
+
48
+ notifyChange() {
49
+ this.dispatchEvent(new Event('change'))
50
+ }
51
+
52
+ toJSON(): ActionSchema {
53
+ const result: ActionSchema = {
54
+ kind: this.kind,
55
+ }
56
+ if (this.accessRule.length) {
57
+ result.accessRule = this.accessRule.map((rule) => rule.toJSON())
58
+ }
59
+ if (this.rateLimiting) {
60
+ result.rateLimiting = this.rateLimiting.toJSON()
61
+ }
62
+ return result
63
+ }
64
+ }
@@ -0,0 +1,30 @@
1
+ import { Action, type ActionSchema } from './Action.js'
2
+ import { observed } from '../../decorators/observed.js'
3
+
4
+ /**
5
+ * Enables adding a new resource to a collection.
6
+ * Endpoint: POST /[entity-collection-name]
7
+ */
8
+ export interface CreateActionSchema extends ActionSchema {
9
+ kind: 'create'
10
+ }
11
+
12
+ /**
13
+ * Enables adding a new resource to a collection.
14
+ * Endpoint: POST /[entity-collection-name]
15
+ */
16
+ export class CreateAction extends Action implements CreateActionSchema {
17
+ @observed() override accessor kind: 'create'
18
+
19
+ constructor(state: Partial<CreateActionSchema> = {}) {
20
+ super(state)
21
+ this.kind = 'create'
22
+ }
23
+
24
+ override toJSON(): CreateActionSchema {
25
+ return {
26
+ ...(super.toJSON() as CreateActionSchema),
27
+ kind: 'create',
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,51 @@
1
+ import { Action, type ActionSchema } from './Action.js'
2
+ import { observed } from '../../decorators/observed.js'
3
+
4
+ export type DeleteStrategy = 'soft' | 'hard'
5
+
6
+ /**
7
+ * Enables removing an existing resource.
8
+ * Endpoint: DELETE /[entity-collection-name]/{id}
9
+ */
10
+ export interface DeleteActionSchema extends ActionSchema {
11
+ kind: 'delete'
12
+ /**
13
+ * The strategy for deletion. Default: Soft Delete.
14
+ *
15
+ * @default 'soft'
16
+ */
17
+ strategy?: DeleteStrategy
18
+ /**
19
+ * The data retention period (in days) for soft-deleted resources.
20
+ * This defines how long the data should be kept before it is permanently deleted.
21
+ *
22
+ * @default 30
23
+ */
24
+ retentionPeriod?: number
25
+ }
26
+
27
+ /**
28
+ * Enables removing an existing resource.
29
+ * Endpoint: DELETE /[entity-collection-name]/{id}
30
+ */
31
+ export class DeleteAction extends Action implements DeleteActionSchema {
32
+ @observed() override accessor kind: 'delete'
33
+ @observed() accessor strategy: DeleteStrategy
34
+ @observed() accessor retentionPeriod: number
35
+
36
+ constructor(state: Partial<DeleteActionSchema> = {}) {
37
+ super(state)
38
+ this.kind = 'delete'
39
+ this.strategy = state.strategy || 'soft'
40
+ this.retentionPeriod = state.retentionPeriod ?? 30
41
+ }
42
+
43
+ override toJSON(): DeleteActionSchema {
44
+ return {
45
+ ...(super.toJSON() as DeleteActionSchema),
46
+ kind: 'delete',
47
+ strategy: this.strategy,
48
+ retentionPeriod: this.retentionPeriod,
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,58 @@
1
+ import type { PaginationStrategy } from '../types.js'
2
+ import { Action, type ActionSchema } from './Action.js'
3
+ import { observed, toRaw } from '../../decorators/observed.js'
4
+
5
+ /**
6
+ * Enables retrieving a collection of resources.
7
+ * Endpoint: GET /[entity-collection-name]
8
+ */
9
+ export interface ListActionSchema extends ActionSchema {
10
+ kind: 'list'
11
+ /**
12
+ * The pagination strategy used for this action.
13
+ * This defines how the results are paginated when retrieving a collection of resources.
14
+ * It can be either 'cursor' or 'offset'.
15
+ */
16
+ pagination: PaginationStrategy
17
+ /**
18
+ * Fields from the entity that can be used for filtering.
19
+ * Must be marked as "indexable" in the Data Model.
20
+ */
21
+ filterableFields: string[]
22
+ /**
23
+ * Fields from the entity that can be used for sorting.
24
+ */
25
+ sortableFields: string[]
26
+ }
27
+
28
+ /**
29
+ * Enables retrieving a collection of resources.
30
+ * Endpoint: GET /[entity-collection-name]
31
+ */
32
+ export class ListAction extends Action implements ListActionSchema {
33
+ @observed() override accessor kind: 'list'
34
+ @observed({ deep: true }) accessor pagination: PaginationStrategy
35
+ @observed({ deep: true }) accessor filterableFields: string[]
36
+ @observed({ deep: true }) accessor sortableFields: string[]
37
+
38
+ constructor(state: Partial<ListActionSchema> = {}) {
39
+ super(state)
40
+ this.kind = state.kind || 'list'
41
+ this.pagination = state.pagination
42
+ ? { ...state.pagination }
43
+ : {
44
+ kind: 'offset',
45
+ }
46
+ this.filterableFields = state.filterableFields ? [...state.filterableFields] : []
47
+ this.sortableFields = state.sortableFields ? [...state.sortableFields] : []
48
+ }
49
+
50
+ override toJSON(): ListActionSchema {
51
+ return {
52
+ ...(super.toJSON() as ListActionSchema),
53
+ pagination: structuredClone(toRaw(this, this.pagination)) as PaginationStrategy,
54
+ filterableFields: structuredClone(toRaw(this, this.filterableFields)) as string[],
55
+ sortableFields: structuredClone(toRaw(this, this.sortableFields)) as string[],
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,32 @@
1
+ import { Action, type ActionSchema } from './Action.js'
2
+ import { observed } from '../../decorators/observed.js'
3
+
4
+ /**
5
+ * Enables retrieving a single resource by its ID.
6
+ * Endpoint: GET /[entity-collection-name]/{id}
7
+ */
8
+ export interface ReadActionSchema extends ActionSchema {
9
+ kind: 'read'
10
+ // Association handling (Link IDs vs. Embed) is defined on the
11
+ // data association itself in the Data Modeler.
12
+ }
13
+
14
+ /**
15
+ * Enables retrieving a single resource by its ID.
16
+ * Endpoint: GET /[entity-collection-name]/{id}
17
+ */
18
+ export class ReadAction extends Action implements ReadActionSchema {
19
+ @observed() override accessor kind: 'read'
20
+
21
+ constructor(state: Partial<ReadActionSchema> = {}) {
22
+ super(state)
23
+ this.kind = 'read'
24
+ }
25
+
26
+ override toJSON(): ReadActionSchema {
27
+ return {
28
+ ...(super.toJSON() as ReadActionSchema),
29
+ kind: 'read',
30
+ }
31
+ }
32
+ }