@entifix/core 0.1.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/base-entities/configuration-client/configuration-client-singleton.d.ts +39 -0
  4. package/dist/base-entities/configuration-client/configuration-client-singleton.d.ts.map +1 -0
  5. package/dist/base-entities/configuration-client/configuration-client-singleton.js +164 -0
  6. package/dist/base-entities/configuration-client/configuration-client-singleton.js.map +1 -0
  7. package/dist/base-entities/configuration-client/index.d.ts +4 -0
  8. package/dist/base-entities/configuration-client/index.d.ts.map +1 -0
  9. package/dist/base-entities/configuration-client/index.js +5 -0
  10. package/dist/base-entities/configuration-client/index.js.map +1 -0
  11. package/dist/base-entities/configuration-client/read-configuration-from-process.d.ts +11 -0
  12. package/dist/base-entities/configuration-client/read-configuration-from-process.d.ts.map +1 -0
  13. package/dist/base-entities/configuration-client/read-configuration-from-process.js +26 -0
  14. package/dist/base-entities/configuration-client/read-configuration-from-process.js.map +1 -0
  15. package/dist/base-entities/configuration-client/types.d.ts +38 -0
  16. package/dist/base-entities/configuration-client/types.d.ts.map +1 -0
  17. package/dist/base-entities/configuration-client/types.js +3 -0
  18. package/dist/base-entities/configuration-client/types.js.map +1 -0
  19. package/dist/base-entities/entifix-error/entifix-error.d.ts +31 -0
  20. package/dist/base-entities/entifix-error/entifix-error.d.ts.map +1 -0
  21. package/dist/base-entities/entifix-error/entifix-error.js +56 -0
  22. package/dist/base-entities/entifix-error/entifix-error.js.map +1 -0
  23. package/dist/base-entities/entifix-error/index.d.ts +2 -0
  24. package/dist/base-entities/entifix-error/index.d.ts.map +1 -0
  25. package/dist/base-entities/entifix-error/index.js +3 -0
  26. package/dist/base-entities/entifix-error/index.js.map +1 -0
  27. package/dist/command-palette/command-matching.d.ts +79 -0
  28. package/dist/command-palette/command-matching.d.ts.map +1 -0
  29. package/dist/command-palette/command-matching.js +116 -0
  30. package/dist/command-palette/command-matching.js.map +1 -0
  31. package/dist/command-palette/command-source.d.ts +109 -0
  32. package/dist/command-palette/command-source.d.ts.map +1 -0
  33. package/dist/command-palette/command-source.js +11 -0
  34. package/dist/command-palette/command-source.js.map +1 -0
  35. package/dist/command-palette/index.d.ts +3 -0
  36. package/dist/command-palette/index.d.ts.map +1 -0
  37. package/dist/command-palette/index.js +4 -0
  38. package/dist/command-palette/index.js.map +1 -0
  39. package/dist/entity-definition/decorators/accessor/accessor.d.ts +3 -0
  40. package/dist/entity-definition/decorators/accessor/accessor.d.ts.map +1 -0
  41. package/dist/entity-definition/decorators/accessor/accessor.js +11 -0
  42. package/dist/entity-definition/decorators/accessor/accessor.js.map +1 -0
  43. package/dist/entity-definition/decorators/accessor/index.d.ts +2 -0
  44. package/dist/entity-definition/decorators/accessor/index.d.ts.map +1 -0
  45. package/dist/entity-definition/decorators/accessor/index.js +3 -0
  46. package/dist/entity-definition/decorators/accessor/index.js.map +1 -0
  47. package/dist/entity-definition/decorators/entity/entity.d.ts +4 -0
  48. package/dist/entity-definition/decorators/entity/entity.d.ts.map +1 -0
  49. package/dist/entity-definition/decorators/entity/entity.js +9 -0
  50. package/dist/entity-definition/decorators/entity/entity.js.map +1 -0
  51. package/dist/entity-definition/decorators/entity/index.d.ts +2 -0
  52. package/dist/entity-definition/decorators/entity/index.d.ts.map +1 -0
  53. package/dist/entity-definition/decorators/entity/index.js +3 -0
  54. package/dist/entity-definition/decorators/entity/index.js.map +1 -0
  55. package/dist/entity-definition/decorators/method/index.d.ts +2 -0
  56. package/dist/entity-definition/decorators/method/index.d.ts.map +1 -0
  57. package/dist/entity-definition/decorators/method/index.js +3 -0
  58. package/dist/entity-definition/decorators/method/index.js.map +1 -0
  59. package/dist/entity-definition/decorators/method/method.d.ts +3 -0
  60. package/dist/entity-definition/decorators/method/method.d.ts.map +1 -0
  61. package/dist/entity-definition/decorators/method/method.js +10 -0
  62. package/dist/entity-definition/decorators/method/method.js.map +1 -0
  63. package/dist/entity-definition/decorators/use-case/index.d.ts +2 -0
  64. package/dist/entity-definition/decorators/use-case/index.d.ts.map +1 -0
  65. package/dist/entity-definition/decorators/use-case/index.js +3 -0
  66. package/dist/entity-definition/decorators/use-case/index.js.map +1 -0
  67. package/dist/entity-definition/decorators/use-case/use-case.d.ts +18 -0
  68. package/dist/entity-definition/decorators/use-case/use-case.d.ts.map +1 -0
  69. package/dist/entity-definition/decorators/use-case/use-case.js +26 -0
  70. package/dist/entity-definition/decorators/use-case/use-case.js.map +1 -0
  71. package/dist/entity-definition/describe/describe-child-columns.d.ts +33 -0
  72. package/dist/entity-definition/describe/describe-child-columns.d.ts.map +1 -0
  73. package/dist/entity-definition/describe/describe-child-columns.js +44 -0
  74. package/dist/entity-definition/describe/describe-child-columns.js.map +1 -0
  75. package/dist/entity-definition/describe/describe-entity-columns.d.ts +83 -0
  76. package/dist/entity-definition/describe/describe-entity-columns.d.ts.map +1 -0
  77. package/dist/entity-definition/describe/describe-entity-columns.js +112 -0
  78. package/dist/entity-definition/describe/describe-entity-columns.js.map +1 -0
  79. package/dist/entity-definition/describe/describe-entity-use-cases.d.ts +34 -0
  80. package/dist/entity-definition/describe/describe-entity-use-cases.d.ts.map +1 -0
  81. package/dist/entity-definition/describe/describe-entity-use-cases.js +24 -0
  82. package/dist/entity-definition/describe/describe-entity-use-cases.js.map +1 -0
  83. package/dist/entity-definition/describe/index.d.ts +4 -0
  84. package/dist/entity-definition/describe/index.d.ts.map +1 -0
  85. package/dist/entity-definition/describe/index.js +5 -0
  86. package/dist/entity-definition/describe/index.js.map +1 -0
  87. package/dist/entity-definition/field-path.d.ts +49 -0
  88. package/dist/entity-definition/field-path.d.ts.map +1 -0
  89. package/dist/entity-definition/field-path.js +58 -0
  90. package/dist/entity-definition/field-path.js.map +1 -0
  91. package/dist/entity-definition/helpers/entity-definition-helpers.d.ts +59 -0
  92. package/dist/entity-definition/helpers/entity-definition-helpers.d.ts.map +1 -0
  93. package/dist/entity-definition/helpers/entity-definition-helpers.js +115 -0
  94. package/dist/entity-definition/helpers/entity-definition-helpers.js.map +1 -0
  95. package/dist/entity-definition/helpers/index.d.ts +2 -0
  96. package/dist/entity-definition/helpers/index.d.ts.map +1 -0
  97. package/dist/entity-definition/helpers/index.js +3 -0
  98. package/dist/entity-definition/helpers/index.js.map +1 -0
  99. package/dist/entity-definition/links/apply-entity-links/apply-entity-links.d.ts +48 -0
  100. package/dist/entity-definition/links/apply-entity-links/apply-entity-links.d.ts.map +1 -0
  101. package/dist/entity-definition/links/apply-entity-links/apply-entity-links.js +88 -0
  102. package/dist/entity-definition/links/apply-entity-links/apply-entity-links.js.map +1 -0
  103. package/dist/entity-definition/links/apply-entity-links/index.d.ts +2 -0
  104. package/dist/entity-definition/links/apply-entity-links/index.d.ts.map +1 -0
  105. package/dist/entity-definition/links/apply-entity-links/index.js +3 -0
  106. package/dist/entity-definition/links/apply-entity-links/index.js.map +1 -0
  107. package/dist/entity-definition/links/entity-collection-link/entity-collection-link.d.ts +29 -0
  108. package/dist/entity-definition/links/entity-collection-link/entity-collection-link.d.ts.map +1 -0
  109. package/dist/entity-definition/links/entity-collection-link/entity-collection-link.js +61 -0
  110. package/dist/entity-definition/links/entity-collection-link/entity-collection-link.js.map +1 -0
  111. package/dist/entity-definition/links/entity-collection-link/index.d.ts +2 -0
  112. package/dist/entity-definition/links/entity-collection-link/index.d.ts.map +1 -0
  113. package/dist/entity-definition/links/entity-collection-link/index.js +3 -0
  114. package/dist/entity-definition/links/entity-collection-link/index.js.map +1 -0
  115. package/dist/entity-definition/links/entity-link/entity-link.d.ts +58 -0
  116. package/dist/entity-definition/links/entity-link/entity-link.d.ts.map +1 -0
  117. package/dist/entity-definition/links/entity-link/entity-link.js +79 -0
  118. package/dist/entity-definition/links/entity-link/entity-link.js.map +1 -0
  119. package/dist/entity-definition/links/entity-link/index.d.ts +2 -0
  120. package/dist/entity-definition/links/entity-link/index.d.ts.map +1 -0
  121. package/dist/entity-definition/links/entity-link/index.js +3 -0
  122. package/dist/entity-definition/links/entity-link/index.js.map +1 -0
  123. package/dist/entity-definition/links/entity-link-source/entity-link-source.d.ts +74 -0
  124. package/dist/entity-definition/links/entity-link-source/entity-link-source.d.ts.map +1 -0
  125. package/dist/entity-definition/links/entity-link-source/entity-link-source.js +11 -0
  126. package/dist/entity-definition/links/entity-link-source/entity-link-source.js.map +1 -0
  127. package/dist/entity-definition/links/entity-link-source/index.d.ts +2 -0
  128. package/dist/entity-definition/links/entity-link-source/index.d.ts.map +1 -0
  129. package/dist/entity-definition/links/entity-link-source/index.js +3 -0
  130. package/dist/entity-definition/links/entity-link-source/index.js.map +1 -0
  131. package/dist/entity-definition/meta-entities/meta-accessor/index.d.ts +2 -0
  132. package/dist/entity-definition/meta-entities/meta-accessor/index.d.ts.map +1 -0
  133. package/dist/entity-definition/meta-entities/meta-accessor/index.js +3 -0
  134. package/dist/entity-definition/meta-entities/meta-accessor/index.js.map +1 -0
  135. package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.d.ts +137 -0
  136. package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.d.ts.map +1 -0
  137. package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.js +52 -0
  138. package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.js.map +1 -0
  139. package/dist/entity-definition/meta-entities/meta-entity/index.d.ts +2 -0
  140. package/dist/entity-definition/meta-entities/meta-entity/index.d.ts.map +1 -0
  141. package/dist/entity-definition/meta-entities/meta-entity/index.js +3 -0
  142. package/dist/entity-definition/meta-entities/meta-entity/index.js.map +1 -0
  143. package/dist/entity-definition/meta-entities/meta-entity/meta-entity.d.ts +17 -0
  144. package/dist/entity-definition/meta-entities/meta-entity/meta-entity.d.ts.map +1 -0
  145. package/dist/entity-definition/meta-entities/meta-entity/meta-entity.js +13 -0
  146. package/dist/entity-definition/meta-entities/meta-entity/meta-entity.js.map +1 -0
  147. package/dist/entity-definition/meta-entities/meta-method/index.d.ts +2 -0
  148. package/dist/entity-definition/meta-entities/meta-method/index.d.ts.map +1 -0
  149. package/dist/entity-definition/meta-entities/meta-method/index.js +3 -0
  150. package/dist/entity-definition/meta-entities/meta-method/index.js.map +1 -0
  151. package/dist/entity-definition/meta-entities/meta-method/meta-method.d.ts +16 -0
  152. package/dist/entity-definition/meta-entities/meta-method/meta-method.d.ts.map +1 -0
  153. package/dist/entity-definition/meta-entities/meta-method/meta-method.js +11 -0
  154. package/dist/entity-definition/meta-entities/meta-method/meta-method.js.map +1 -0
  155. package/dist/entity-definition/meta-entities/meta-use-case/index.d.ts +2 -0
  156. package/dist/entity-definition/meta-entities/meta-use-case/index.d.ts.map +1 -0
  157. package/dist/entity-definition/meta-entities/meta-use-case/index.js +3 -0
  158. package/dist/entity-definition/meta-entities/meta-use-case/index.js.map +1 -0
  159. package/dist/entity-definition/meta-entities/meta-use-case/meta-use-case.d.ts +94 -0
  160. package/dist/entity-definition/meta-entities/meta-use-case/meta-use-case.d.ts.map +1 -0
  161. package/dist/entity-definition/meta-entities/meta-use-case/meta-use-case.js +17 -0
  162. package/dist/entity-definition/meta-entities/meta-use-case/meta-use-case.js.map +1 -0
  163. package/dist/entity-definition/metadata/entity-metadata-document.d.ts +23 -0
  164. package/dist/entity-definition/metadata/entity-metadata-document.d.ts.map +1 -0
  165. package/dist/entity-definition/metadata/entity-metadata-document.js +16 -0
  166. package/dist/entity-definition/metadata/entity-metadata-document.js.map +1 -0
  167. package/dist/entity-definition/metadata/entity-metadata-source.d.ts +19 -0
  168. package/dist/entity-definition/metadata/entity-metadata-source.d.ts.map +1 -0
  169. package/dist/entity-definition/metadata/entity-metadata-source.js +15 -0
  170. package/dist/entity-definition/metadata/entity-metadata-source.js.map +1 -0
  171. package/dist/entity-definition/metadata/index.d.ts +3 -0
  172. package/dist/entity-definition/metadata/index.d.ts.map +1 -0
  173. package/dist/entity-definition/metadata/index.js +4 -0
  174. package/dist/entity-definition/metadata/index.js.map +1 -0
  175. package/dist/entity-definition/reconstruct/clone-entity-draft.d.ts +34 -0
  176. package/dist/entity-definition/reconstruct/clone-entity-draft.d.ts.map +1 -0
  177. package/dist/entity-definition/reconstruct/clone-entity-draft.js +75 -0
  178. package/dist/entity-definition/reconstruct/clone-entity-draft.js.map +1 -0
  179. package/dist/entity-definition/reconstruct/coerce-field-value.d.ts +34 -0
  180. package/dist/entity-definition/reconstruct/coerce-field-value.d.ts.map +1 -0
  181. package/dist/entity-definition/reconstruct/coerce-field-value.js +42 -0
  182. package/dist/entity-definition/reconstruct/coerce-field-value.js.map +1 -0
  183. package/dist/entity-definition/reconstruct/index.d.ts +5 -0
  184. package/dist/entity-definition/reconstruct/index.d.ts.map +1 -0
  185. package/dist/entity-definition/reconstruct/index.js +6 -0
  186. package/dist/entity-definition/reconstruct/index.js.map +1 -0
  187. package/dist/entity-definition/reconstruct/reconstruct-child.d.ts +35 -0
  188. package/dist/entity-definition/reconstruct/reconstruct-child.d.ts.map +1 -0
  189. package/dist/entity-definition/reconstruct/reconstruct-child.js +47 -0
  190. package/dist/entity-definition/reconstruct/reconstruct-child.js.map +1 -0
  191. package/dist/entity-definition/reconstruct/reconstruct-entity.d.ts +49 -0
  192. package/dist/entity-definition/reconstruct/reconstruct-entity.d.ts.map +1 -0
  193. package/dist/entity-definition/reconstruct/reconstruct-entity.js +116 -0
  194. package/dist/entity-definition/reconstruct/reconstruct-entity.js.map +1 -0
  195. package/dist/entity-definition/serializer/deserialize.d.ts +13 -0
  196. package/dist/entity-definition/serializer/deserialize.d.ts.map +1 -0
  197. package/dist/entity-definition/serializer/deserialize.js +145 -0
  198. package/dist/entity-definition/serializer/deserialize.js.map +1 -0
  199. package/dist/entity-definition/serializer/index.d.ts +3 -0
  200. package/dist/entity-definition/serializer/index.d.ts.map +1 -0
  201. package/dist/entity-definition/serializer/index.js +4 -0
  202. package/dist/entity-definition/serializer/index.js.map +1 -0
  203. package/dist/entity-definition/serializer/serialize.d.ts +26 -0
  204. package/dist/entity-definition/serializer/serialize.d.ts.map +1 -0
  205. package/dist/entity-definition/serializer/serialize.js +64 -0
  206. package/dist/entity-definition/serializer/serialize.js.map +1 -0
  207. package/dist/envelope/event-pattern.d.ts +14 -0
  208. package/dist/envelope/event-pattern.d.ts.map +1 -0
  209. package/dist/envelope/event-pattern.js +30 -0
  210. package/dist/envelope/event-pattern.js.map +1 -0
  211. package/dist/envelope/index.d.ts +5 -0
  212. package/dist/envelope/index.d.ts.map +1 -0
  213. package/dist/envelope/index.js +6 -0
  214. package/dist/envelope/index.js.map +1 -0
  215. package/dist/envelope/make-envelope.d.ts +45 -0
  216. package/dist/envelope/make-envelope.d.ts.map +1 -0
  217. package/dist/envelope/make-envelope.js +111 -0
  218. package/dist/envelope/make-envelope.js.map +1 -0
  219. package/dist/envelope/read-envelope.d.ts +48 -0
  220. package/dist/envelope/read-envelope.d.ts.map +1 -0
  221. package/dist/envelope/read-envelope.js +138 -0
  222. package/dist/envelope/read-envelope.js.map +1 -0
  223. package/dist/envelope/types.d.ts +173 -0
  224. package/dist/envelope/types.d.ts.map +1 -0
  225. package/dist/envelope/types.js +6 -0
  226. package/dist/envelope/types.js.map +1 -0
  227. package/dist/http/session-cookies.d.ts +25 -0
  228. package/dist/http/session-cookies.d.ts.map +1 -0
  229. package/dist/http/session-cookies.js +22 -0
  230. package/dist/http/session-cookies.js.map +1 -0
  231. package/dist/i18n/format.d.ts +22 -0
  232. package/dist/i18n/format.d.ts.map +1 -0
  233. package/dist/i18n/format.js +49 -0
  234. package/dist/i18n/format.js.map +1 -0
  235. package/dist/i18n/index.d.ts +4 -0
  236. package/dist/i18n/index.d.ts.map +1 -0
  237. package/dist/i18n/index.js +5 -0
  238. package/dist/i18n/index.js.map +1 -0
  239. package/dist/i18n/locales.d.ts +23 -0
  240. package/dist/i18n/locales.d.ts.map +1 -0
  241. package/dist/i18n/locales.js +25 -0
  242. package/dist/i18n/locales.js.map +1 -0
  243. package/dist/i18n/negotiate.d.ts +39 -0
  244. package/dist/i18n/negotiate.d.ts.map +1 -0
  245. package/dist/i18n/negotiate.js +63 -0
  246. package/dist/i18n/negotiate.js.map +1 -0
  247. package/dist/index.d.ts +42 -0
  248. package/dist/index.d.ts.map +1 -0
  249. package/dist/index.js +43 -0
  250. package/dist/index.js.map +1 -0
  251. package/dist/rsql/coerce-rsql.d.ts +27 -0
  252. package/dist/rsql/coerce-rsql.d.ts.map +1 -0
  253. package/dist/rsql/coerce-rsql.js +121 -0
  254. package/dist/rsql/coerce-rsql.js.map +1 -0
  255. package/dist/rsql/index.d.ts +8 -0
  256. package/dist/rsql/index.d.ts.map +1 -0
  257. package/dist/rsql/index.js +9 -0
  258. package/dist/rsql/index.js.map +1 -0
  259. package/dist/rsql/load-request-url.d.ts +30 -0
  260. package/dist/rsql/load-request-url.d.ts.map +1 -0
  261. package/dist/rsql/load-request-url.js +67 -0
  262. package/dist/rsql/load-request-url.js.map +1 -0
  263. package/dist/rsql/parse-rsql.d.ts +35 -0
  264. package/dist/rsql/parse-rsql.d.ts.map +1 -0
  265. package/dist/rsql/parse-rsql.js +235 -0
  266. package/dist/rsql/parse-rsql.js.map +1 -0
  267. package/dist/rsql/rsql-operators.d.ts +36 -0
  268. package/dist/rsql/rsql-operators.d.ts.map +1 -0
  269. package/dist/rsql/rsql-operators.js +65 -0
  270. package/dist/rsql/rsql-operators.js.map +1 -0
  271. package/dist/rsql/rsql-values.d.ts +11 -0
  272. package/dist/rsql/rsql-values.d.ts.map +1 -0
  273. package/dist/rsql/rsql-values.js +26 -0
  274. package/dist/rsql/rsql-values.js.map +1 -0
  275. package/dist/rsql/serialize-rsql.d.ts +19 -0
  276. package/dist/rsql/serialize-rsql.d.ts.map +1 -0
  277. package/dist/rsql/serialize-rsql.js +71 -0
  278. package/dist/rsql/serialize-rsql.js.map +1 -0
  279. package/dist/rsql/sort-param.d.ts +20 -0
  280. package/dist/rsql/sort-param.d.ts.map +1 -0
  281. package/dist/rsql/sort-param.js +66 -0
  282. package/dist/rsql/sort-param.js.map +1 -0
  283. package/dist/types/BulkOutcome.d.ts +27 -0
  284. package/dist/types/BulkOutcome.d.ts.map +1 -0
  285. package/dist/types/BulkOutcome.js +8 -0
  286. package/dist/types/BulkOutcome.js.map +1 -0
  287. package/dist/types/Entity.d.ts +6 -0
  288. package/dist/types/Entity.d.ts.map +1 -0
  289. package/dist/types/Entity.js +3 -0
  290. package/dist/types/Entity.js.map +1 -0
  291. package/dist/types/EntityAction.d.ts +15 -0
  292. package/dist/types/EntityAction.d.ts.map +1 -0
  293. package/dist/types/EntityAction.js +18 -0
  294. package/dist/types/EntityAction.js.map +1 -0
  295. package/dist/types/EntityDraft.d.ts +47 -0
  296. package/dist/types/EntityDraft.d.ts.map +1 -0
  297. package/dist/types/EntityDraft.js +14 -0
  298. package/dist/types/EntityDraft.js.map +1 -0
  299. package/dist/types/EntityFiltering.d.ts +45 -0
  300. package/dist/types/EntityFiltering.d.ts.map +1 -0
  301. package/dist/types/EntityFiltering.js +30 -0
  302. package/dist/types/EntityFiltering.js.map +1 -0
  303. package/dist/types/EntityLoadRequest.d.ts +10 -0
  304. package/dist/types/EntityLoadRequest.d.ts.map +1 -0
  305. package/dist/types/EntityLoadRequest.js +3 -0
  306. package/dist/types/EntityLoadRequest.js.map +1 -0
  307. package/dist/types/EntityPage.d.ts +8 -0
  308. package/dist/types/EntityPage.d.ts.map +1 -0
  309. package/dist/types/EntityPage.js +3 -0
  310. package/dist/types/EntityPage.js.map +1 -0
  311. package/dist/types/EntityRowDraft.d.ts +79 -0
  312. package/dist/types/EntityRowDraft.d.ts.map +1 -0
  313. package/dist/types/EntityRowDraft.js +65 -0
  314. package/dist/types/EntityRowDraft.js.map +1 -0
  315. package/dist/types/EntitySelection.d.ts +117 -0
  316. package/dist/types/EntitySelection.d.ts.map +1 -0
  317. package/dist/types/EntitySelection.js +107 -0
  318. package/dist/types/EntitySelection.js.map +1 -0
  319. package/dist/types/EntitySorting.d.ts +7 -0
  320. package/dist/types/EntitySorting.d.ts.map +1 -0
  321. package/dist/types/EntitySorting.js +3 -0
  322. package/dist/types/EntitySorting.js.map +1 -0
  323. package/dist/types/Json.d.ts +37 -0
  324. package/dist/types/Json.d.ts.map +1 -0
  325. package/dist/types/Json.js +43 -0
  326. package/dist/types/Json.js.map +1 -0
  327. package/dist/types/StandardSchema.d.ts +45 -0
  328. package/dist/types/StandardSchema.d.ts.map +1 -0
  329. package/dist/types/StandardSchema.js +15 -0
  330. package/dist/types/StandardSchema.js.map +1 -0
  331. package/dist/types/UseCase.d.ts +10 -0
  332. package/dist/types/UseCase.d.ts.map +1 -0
  333. package/dist/types/UseCase.js +10 -0
  334. package/dist/types/UseCase.js.map +1 -0
  335. package/dist/wizard/index.d.ts +4 -0
  336. package/dist/wizard/index.d.ts.map +1 -0
  337. package/dist/wizard/index.js +5 -0
  338. package/dist/wizard/index.js.map +1 -0
  339. package/dist/wizard/wizard-definition.d.ts +108 -0
  340. package/dist/wizard/wizard-definition.d.ts.map +1 -0
  341. package/dist/wizard/wizard-definition.js +125 -0
  342. package/dist/wizard/wizard-definition.js.map +1 -0
  343. package/dist/wizard/wizard-navigation.d.ts +81 -0
  344. package/dist/wizard/wizard-navigation.d.ts.map +1 -0
  345. package/dist/wizard/wizard-navigation.js +139 -0
  346. package/dist/wizard/wizard-navigation.js.map +1 -0
  347. package/dist/wizard/wizard-state.d.ts +89 -0
  348. package/dist/wizard/wizard-state.d.ts.map +1 -0
  349. package/dist/wizard/wizard-state.js +103 -0
  350. package/dist/wizard/wizard-state.js.map +1 -0
  351. package/package.json +64 -0
@@ -0,0 +1,39 @@
1
+ import { type Locale } from './locales.js';
2
+ export interface LocalePath {
3
+ /** The locale carried by the path's first segment, if it names one. */
4
+ readonly locale?: Locale;
5
+ /** The path with that segment removed. Always starts with `/`. */
6
+ readonly rest: string;
7
+ }
8
+ /**
9
+ * Splits `/es/catalog/product` into `{ locale: 'es', rest: '/catalog/product' }`.
10
+ * A path whose first segment is not a locale comes back untouched, which is how
11
+ * the middleware tells "needs a redirect" from "needs a rewrite".
12
+ */
13
+ export declare function splitLocalePath(pathname: string): LocalePath;
14
+ /**
15
+ * Prefixes an in-app href with a locale. Absolute URLs and already-prefixed
16
+ * paths are returned as-is so this is safe to apply blindly at every call site
17
+ * — which is the point, since a single unprefixed `href` would bounce the user
18
+ * through a redirect and lose their place.
19
+ */
20
+ export declare function localeHref(locale: Locale, href: string): string;
21
+ /**
22
+ * Picks the best supported locale out of an `Accept-Language` header, honouring
23
+ * q-values and matching `es-419`/`es-MX` onto `es`. Returns `undefined` when the
24
+ * header names nothing we speak, so the caller can fall through to its default.
25
+ */
26
+ export declare function parseAcceptLanguage(header: string | null | undefined): Locale | undefined;
27
+ export interface NegotiateLocaleInput {
28
+ readonly pathname?: string;
29
+ readonly cookie?: string | null;
30
+ readonly acceptLanguage?: string | null;
31
+ }
32
+ /**
33
+ * The one place the precedence lives: an explicit path prefix beats the visitor's
34
+ * remembered choice, which beats what their browser asks for, which beats the
35
+ * fleet default. Pure, so the same function runs in edge middleware, in a server
36
+ * component and in a test.
37
+ */
38
+ export declare function negotiateLocale({ pathname, cookie, acceptLanguage, }: NegotiateLocaleInput): Locale;
39
+ //# sourceMappingURL=negotiate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negotiate.d.ts","sourceRoot":"","sources":["../../src/i18n/negotiate.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAM5D;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAChC,MAAM,GAAG,SAAS,CA4BpB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,MAAM,EACN,cAAc,GACf,EAAE,oBAAoB,GAAG,MAAM,CAO/B"}
@@ -0,0 +1,63 @@
1
+ import { DEFAULT_LOCALE, isLocale } from './locales.js';
2
+ /**
3
+ * Splits `/es/catalog/product` into `{ locale: 'es', rest: '/catalog/product' }`.
4
+ * A path whose first segment is not a locale comes back untouched, which is how
5
+ * the middleware tells "needs a redirect" from "needs a rewrite".
6
+ */ export function splitLocalePath(pathname) {
7
+ const [, first = '', ...others] = pathname.split('/');
8
+ if (!isLocale(first)) return {
9
+ rest: pathname === '' ? '/' : pathname
10
+ };
11
+ const rest = others.join('/');
12
+ return {
13
+ locale: first,
14
+ rest: `/${rest}`
15
+ };
16
+ }
17
+ /**
18
+ * Prefixes an in-app href with a locale. Absolute URLs and already-prefixed
19
+ * paths are returned as-is so this is safe to apply blindly at every call site
20
+ * — which is the point, since a single unprefixed `href` would bounce the user
21
+ * through a redirect and lose their place.
22
+ */ export function localeHref(locale, href) {
23
+ if (/^[a-z][a-z0-9+.-]*:|^\/\//i.test(href)) return href;
24
+ if (!href.startsWith('/')) return href;
25
+ if (splitLocalePath(href).locale !== undefined) return href;
26
+ return href === '/' ? `/${locale}` : `/${locale}${href}`;
27
+ }
28
+ /**
29
+ * Picks the best supported locale out of an `Accept-Language` header, honouring
30
+ * q-values and matching `es-419`/`es-MX` onto `es`. Returns `undefined` when the
31
+ * header names nothing we speak, so the caller can fall through to its default.
32
+ */ export function parseAcceptLanguage(header) {
33
+ if (!header) return undefined;
34
+ const ranked = header.split(',').map((part)=>{
35
+ const [tag = '', ...params] = part.trim().split(';');
36
+ // A `q` that is present but unparseable makes the entry malformed rather
37
+ // than top-priority — the `NaN` is filtered out below.
38
+ const q = params.find((param)=>/^\s*q=/i.test(param));
39
+ return {
40
+ tag: tag.trim().toLowerCase(),
41
+ quality: q === undefined ? 1 : Number(q.trim().slice(2))
42
+ };
43
+ }).filter((entry)=>entry.tag !== '' && !Number.isNaN(entry.quality) && entry.quality > 0).sort((left, right)=>right.quality - left.quality);
44
+ for (const { tag } of ranked){
45
+ const base = tag.split('-')[0];
46
+ if (isLocale(base)) return base;
47
+ }
48
+ return undefined;
49
+ }
50
+ /**
51
+ * The one place the precedence lives: an explicit path prefix beats the visitor's
52
+ * remembered choice, which beats what their browser asks for, which beats the
53
+ * fleet default. Pure, so the same function runs in edge middleware, in a server
54
+ * component and in a test.
55
+ */ export function negotiateLocale({ pathname, cookie, acceptLanguage }) {
56
+ var _parseAcceptLanguage;
57
+ const fromPath = pathname === undefined ? undefined : splitLocalePath(pathname).locale;
58
+ if (fromPath !== undefined) return fromPath;
59
+ if (isLocale(cookie)) return cookie;
60
+ return (_parseAcceptLanguage = parseAcceptLanguage(acceptLanguage)) != null ? _parseAcceptLanguage : DEFAULT_LOCALE;
61
+ }
62
+
63
+ //# sourceMappingURL=negotiate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/i18n/negotiate.ts"],"sourcesContent":["import { DEFAULT_LOCALE, isLocale, type Locale } from './locales.js';\n\nexport interface LocalePath {\n /** The locale carried by the path's first segment, if it names one. */\n readonly locale?: Locale;\n /** The path with that segment removed. Always starts with `/`. */\n readonly rest: string;\n}\n\n/**\n * Splits `/es/catalog/product` into `{ locale: 'es', rest: '/catalog/product' }`.\n * A path whose first segment is not a locale comes back untouched, which is how\n * the middleware tells \"needs a redirect\" from \"needs a rewrite\".\n */\nexport function splitLocalePath(pathname: string): LocalePath {\n const [, first = '', ...others] = pathname.split('/');\n if (!isLocale(first)) return { rest: pathname === '' ? '/' : pathname };\n\n const rest = others.join('/');\n return { locale: first, rest: `/${rest}` };\n}\n\n/**\n * Prefixes an in-app href with a locale. Absolute URLs and already-prefixed\n * paths are returned as-is so this is safe to apply blindly at every call site\n * — which is the point, since a single unprefixed `href` would bounce the user\n * through a redirect and lose their place.\n */\nexport function localeHref(locale: Locale, href: string): string {\n if (/^[a-z][a-z0-9+.-]*:|^\\/\\//i.test(href)) return href;\n if (!href.startsWith('/')) return href;\n if (splitLocalePath(href).locale !== undefined) return href;\n\n return href === '/' ? `/${locale}` : `/${locale}${href}`;\n}\n\n/**\n * Picks the best supported locale out of an `Accept-Language` header, honouring\n * q-values and matching `es-419`/`es-MX` onto `es`. Returns `undefined` when the\n * header names nothing we speak, so the caller can fall through to its default.\n */\nexport function parseAcceptLanguage(\n header: string | null | undefined,\n): Locale | undefined {\n if (!header) return undefined;\n\n const ranked = header\n .split(',')\n .map(part => {\n const [tag = '', ...params] = part.trim().split(';');\n // A `q` that is present but unparseable makes the entry malformed rather\n // than top-priority — the `NaN` is filtered out below.\n const q = params.find(param => /^\\s*q=/i.test(param));\n\n return {\n tag: tag.trim().toLowerCase(),\n quality: q === undefined ? 1 : Number(q.trim().slice(2)),\n };\n })\n .filter(\n entry =>\n entry.tag !== '' && !Number.isNaN(entry.quality) && entry.quality > 0,\n )\n .sort((left, right) => right.quality - left.quality);\n\n for (const { tag } of ranked) {\n const base = tag.split('-')[0];\n if (isLocale(base)) return base;\n }\n\n return undefined;\n}\n\nexport interface NegotiateLocaleInput {\n readonly pathname?: string;\n readonly cookie?: string | null;\n readonly acceptLanguage?: string | null;\n}\n\n/**\n * The one place the precedence lives: an explicit path prefix beats the visitor's\n * remembered choice, which beats what their browser asks for, which beats the\n * fleet default. Pure, so the same function runs in edge middleware, in a server\n * component and in a test.\n */\nexport function negotiateLocale({\n pathname,\n cookie,\n acceptLanguage,\n}: NegotiateLocaleInput): Locale {\n const fromPath =\n pathname === undefined ? undefined : splitLocalePath(pathname).locale;\n if (fromPath !== undefined) return fromPath;\n if (isLocale(cookie)) return cookie;\n\n return parseAcceptLanguage(acceptLanguage) ?? DEFAULT_LOCALE;\n}\n"],"names":["DEFAULT_LOCALE","isLocale","splitLocalePath","pathname","first","others","split","rest","join","locale","localeHref","href","test","startsWith","undefined","parseAcceptLanguage","header","ranked","map","part","tag","params","trim","q","find","param","toLowerCase","quality","Number","slice","filter","entry","isNaN","sort","left","right","base","negotiateLocale","cookie","acceptLanguage","fromPath"],"mappings":"AAAA,SAASA,cAAc,EAAEC,QAAQ,QAAqB,eAAe;AASrE;;;;CAIC,GACD,OAAO,SAASC,gBAAgBC,QAAgB;IAC9C,MAAM,GAAGC,QAAQ,EAAE,EAAE,GAAGC,OAAO,GAAGF,SAASG,KAAK,CAAC;IACjD,IAAI,CAACL,SAASG,QAAQ,OAAO;QAAEG,MAAMJ,aAAa,KAAK,MAAMA;IAAS;IAEtE,MAAMI,OAAOF,OAAOG,IAAI,CAAC;IACzB,OAAO;QAAEC,QAAQL;QAAOG,MAAM,CAAC,CAAC,EAAEA,MAAM;IAAC;AAC3C;AAEA;;;;;CAKC,GACD,OAAO,SAASG,WAAWD,MAAc,EAAEE,IAAY;IACrD,IAAI,6BAA6BC,IAAI,CAACD,OAAO,OAAOA;IACpD,IAAI,CAACA,KAAKE,UAAU,CAAC,MAAM,OAAOF;IAClC,IAAIT,gBAAgBS,MAAMF,MAAM,KAAKK,WAAW,OAAOH;IAEvD,OAAOA,SAAS,MAAM,CAAC,CAAC,EAAEF,QAAQ,GAAG,CAAC,CAAC,EAAEA,SAASE,MAAM;AAC1D;AAEA;;;;CAIC,GACD,OAAO,SAASI,oBACdC,MAAiC;IAEjC,IAAI,CAACA,QAAQ,OAAOF;IAEpB,MAAMG,SAASD,OACZV,KAAK,CAAC,KACNY,GAAG,CAACC,CAAAA;QACH,MAAM,CAACC,MAAM,EAAE,EAAE,GAAGC,OAAO,GAAGF,KAAKG,IAAI,GAAGhB,KAAK,CAAC;QAChD,yEAAyE;QACzE,uDAAuD;QACvD,MAAMiB,IAAIF,OAAOG,IAAI,CAACC,CAAAA,QAAS,UAAUb,IAAI,CAACa;QAE9C,OAAO;YACLL,KAAKA,IAAIE,IAAI,GAAGI,WAAW;YAC3BC,SAASJ,MAAMT,YAAY,IAAIc,OAAOL,EAAED,IAAI,GAAGO,KAAK,CAAC;QACvD;IACF,GACCC,MAAM,CACLC,CAAAA,QACEA,MAAMX,GAAG,KAAK,MAAM,CAACQ,OAAOI,KAAK,CAACD,MAAMJ,OAAO,KAAKI,MAAMJ,OAAO,GAAG,GAEvEM,IAAI,CAAC,CAACC,MAAMC,QAAUA,MAAMR,OAAO,GAAGO,KAAKP,OAAO;IAErD,KAAK,MAAM,EAAEP,GAAG,EAAE,IAAIH,OAAQ;QAC5B,MAAMmB,OAAOhB,IAAId,KAAK,CAAC,IAAI,CAAC,EAAE;QAC9B,IAAIL,SAASmC,OAAO,OAAOA;IAC7B;IAEA,OAAOtB;AACT;AAQA;;;;;CAKC,GACD,OAAO,SAASuB,gBAAgB,EAC9BlC,QAAQ,EACRmC,MAAM,EACNC,cAAc,EACO;QAMdxB;IALP,MAAMyB,WACJrC,aAAaW,YAAYA,YAAYZ,gBAAgBC,UAAUM,MAAM;IACvE,IAAI+B,aAAa1B,WAAW,OAAO0B;IACnC,IAAIvC,SAASqC,SAAS,OAAOA;IAE7B,QAAOvB,uBAAAA,oBAAoBwB,2BAApBxB,uBAAuCf;AAChD"}
@@ -0,0 +1,42 @@
1
+ export * from './base-entities/configuration-client/index.js';
2
+ export * from './base-entities/entifix-error/index.js';
3
+ export * from './command-palette/index.js';
4
+ export * from './entity-definition/decorators/accessor/index.js';
5
+ export * from './entity-definition/decorators/entity/index.js';
6
+ export * from './entity-definition/decorators/method/index.js';
7
+ export * from './entity-definition/decorators/use-case/index.js';
8
+ export * from './entity-definition/describe/index.js';
9
+ export * from './entity-definition/field-path.js';
10
+ export * from './entity-definition/helpers/index.js';
11
+ export * from './entity-definition/links/apply-entity-links/index.js';
12
+ export * from './entity-definition/links/entity-collection-link/index.js';
13
+ export * from './entity-definition/links/entity-link/index.js';
14
+ export * from './entity-definition/links/entity-link-source/index.js';
15
+ export * from './entity-definition/meta-entities/meta-accessor/index.js';
16
+ export * from './entity-definition/meta-entities/meta-entity/index.js';
17
+ export * from './entity-definition/meta-entities/meta-method/index.js';
18
+ export * from './entity-definition/meta-entities/meta-use-case/index.js';
19
+ export * from './entity-definition/metadata/index.js';
20
+ export * from './entity-definition/reconstruct/index.js';
21
+ export * from './entity-definition/serializer/index.js';
22
+ export * from './envelope/index.js';
23
+ export * from './http/session-cookies.js';
24
+ export * from './i18n/format.js';
25
+ export * from './i18n/locales.js';
26
+ export * from './i18n/negotiate.js';
27
+ export * from './rsql/index.js';
28
+ export * from './types/BulkOutcome.js';
29
+ export * from './types/Entity.js';
30
+ export * from './types/EntityAction.js';
31
+ export * from './types/EntityDraft.js';
32
+ export * from './types/EntityFiltering.js';
33
+ export * from './types/EntityLoadRequest.js';
34
+ export * from './types/EntityPage.js';
35
+ export * from './types/EntityRowDraft.js';
36
+ export * from './types/EntitySelection.js';
37
+ export * from './types/EntitySorting.js';
38
+ export * from './types/Json.js';
39
+ export * from './types/StandardSchema.js';
40
+ export * from './types/UseCase.js';
41
+ export * from './wizard/index.js';
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uDAAuD,CAAC;AACtE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uDAAuD,CAAC;AACtE,cAAc,0DAA0D,CAAC;AACzE,cAAc,wDAAwD,CAAC;AACvE,cAAc,wDAAwD,CAAC;AACvE,cAAc,0DAA0D,CAAC;AACzE,cAAc,uCAAuC,CAAC;AACtD,cAAc,0CAA0C,CAAC;AACzD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ export * from './base-entities/configuration-client/index.js';
2
+ export * from './base-entities/entifix-error/index.js';
3
+ export * from './command-palette/index.js';
4
+ export * from './entity-definition/decorators/accessor/index.js';
5
+ export * from './entity-definition/decorators/entity/index.js';
6
+ export * from './entity-definition/decorators/method/index.js';
7
+ export * from './entity-definition/decorators/use-case/index.js';
8
+ export * from './entity-definition/describe/index.js';
9
+ export * from './entity-definition/field-path.js';
10
+ export * from './entity-definition/helpers/index.js';
11
+ export * from './entity-definition/links/apply-entity-links/index.js';
12
+ export * from './entity-definition/links/entity-collection-link/index.js';
13
+ export * from './entity-definition/links/entity-link/index.js';
14
+ export * from './entity-definition/links/entity-link-source/index.js';
15
+ export * from './entity-definition/meta-entities/meta-accessor/index.js';
16
+ export * from './entity-definition/meta-entities/meta-entity/index.js';
17
+ export * from './entity-definition/meta-entities/meta-method/index.js';
18
+ export * from './entity-definition/meta-entities/meta-use-case/index.js';
19
+ export * from './entity-definition/metadata/index.js';
20
+ export * from './entity-definition/reconstruct/index.js';
21
+ export * from './entity-definition/serializer/index.js';
22
+ export * from './envelope/index.js';
23
+ export * from './http/session-cookies.js';
24
+ export * from './i18n/format.js';
25
+ export * from './i18n/locales.js';
26
+ export * from './i18n/negotiate.js';
27
+ export * from './rsql/index.js';
28
+ export * from './types/BulkOutcome.js';
29
+ export * from './types/Entity.js';
30
+ export * from './types/EntityAction.js';
31
+ export * from './types/EntityDraft.js';
32
+ export * from './types/EntityFiltering.js';
33
+ export * from './types/EntityLoadRequest.js';
34
+ export * from './types/EntityPage.js';
35
+ export * from './types/EntityRowDraft.js';
36
+ export * from './types/EntitySelection.js';
37
+ export * from './types/EntitySorting.js';
38
+ export * from './types/Json.js';
39
+ export * from './types/StandardSchema.js';
40
+ export * from './types/UseCase.js';
41
+ export * from './wizard/index.js';
42
+
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './base-entities/configuration-client/index.js';\nexport * from './base-entities/entifix-error/index.js';\nexport * from './command-palette/index.js';\nexport * from './entity-definition/decorators/accessor/index.js';\nexport * from './entity-definition/decorators/entity/index.js';\nexport * from './entity-definition/decorators/method/index.js';\nexport * from './entity-definition/decorators/use-case/index.js';\nexport * from './entity-definition/describe/index.js';\nexport * from './entity-definition/field-path.js';\nexport * from './entity-definition/helpers/index.js';\nexport * from './entity-definition/links/apply-entity-links/index.js';\nexport * from './entity-definition/links/entity-collection-link/index.js';\nexport * from './entity-definition/links/entity-link/index.js';\nexport * from './entity-definition/links/entity-link-source/index.js';\nexport * from './entity-definition/meta-entities/meta-accessor/index.js';\nexport * from './entity-definition/meta-entities/meta-entity/index.js';\nexport * from './entity-definition/meta-entities/meta-method/index.js';\nexport * from './entity-definition/meta-entities/meta-use-case/index.js';\nexport * from './entity-definition/metadata/index.js';\nexport * from './entity-definition/reconstruct/index.js';\nexport * from './entity-definition/serializer/index.js';\nexport * from './envelope/index.js';\nexport * from './http/session-cookies.js';\nexport * from './i18n/format.js';\nexport * from './i18n/locales.js';\nexport * from './i18n/negotiate.js';\nexport * from './rsql/index.js';\nexport * from './types/BulkOutcome.js';\nexport * from './types/Entity.js';\nexport * from './types/EntityAction.js';\nexport * from './types/EntityDraft.js';\nexport * from './types/EntityFiltering.js';\nexport * from './types/EntityLoadRequest.js';\nexport * from './types/EntityPage.js';\nexport * from './types/EntityRowDraft.js';\nexport * from './types/EntitySelection.js';\nexport * from './types/EntitySorting.js';\nexport * from './types/Json.js';\nexport * from './types/StandardSchema.js';\nexport * from './types/UseCase.js';\nexport * from './wizard/index.js';\n"],"names":[],"mappings":"AAAA,cAAc,gDAAgD;AAC9D,cAAc,yCAAyC;AACvD,cAAc,6BAA6B;AAC3C,cAAc,mDAAmD;AACjE,cAAc,iDAAiD;AAC/D,cAAc,iDAAiD;AAC/D,cAAc,mDAAmD;AACjE,cAAc,wCAAwC;AACtD,cAAc,oCAAoC;AAClD,cAAc,uCAAuC;AACrD,cAAc,wDAAwD;AACtE,cAAc,4DAA4D;AAC1E,cAAc,iDAAiD;AAC/D,cAAc,wDAAwD;AACtE,cAAc,2DAA2D;AACzE,cAAc,yDAAyD;AACvE,cAAc,yDAAyD;AACvE,cAAc,2DAA2D;AACzE,cAAc,wCAAwC;AACtD,cAAc,2CAA2C;AACzD,cAAc,0CAA0C;AACxD,cAAc,sBAAsB;AACpC,cAAc,4BAA4B;AAC1C,cAAc,mBAAmB;AACjC,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,yBAAyB;AACvC,cAAc,oBAAoB;AAClC,cAAc,0BAA0B;AACxC,cAAc,yBAAyB;AACvC,cAAc,6BAA6B;AAC3C,cAAc,+BAA+B;AAC7C,cAAc,wBAAwB;AACtC,cAAc,4BAA4B;AAC1C,cAAc,6BAA6B;AAC3C,cAAc,2BAA2B;AACzC,cAAc,kBAAkB;AAChC,cAAc,4BAA4B;AAC1C,cAAc,qBAAqB;AACnC,cAAc,oBAAoB"}
@@ -0,0 +1,27 @@
1
+ import { type EntityFieldDescriptor } from '../entity-definition/describe/index.js';
2
+ import type { Entity, EntityConstructor } from '../types/Entity.js';
3
+ import type { FilterGroup } from '../types/EntityFiltering.js';
4
+ import { type RawFilterGroup } from './parse-rsql.js';
5
+ /**
6
+ * Resolves the members a client is allowed to name, keyed by both the accessor
7
+ * name and its wire key so a URL may use either.
8
+ *
9
+ * `select` is what makes this an allowlist rather than a lookup: a member the
10
+ * entity did not mark `filterable`/`sortable` is simply not in the map, and a
11
+ * request naming it is rejected. That is the guard against a client filtering
12
+ * on a `hidden` member or an unindexed one.
13
+ */
14
+ export declare function allowedDescriptors<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, select: (descriptor: EntityFieldDescriptor) => boolean): Map<string, EntityFieldDescriptor>;
15
+ /**
16
+ * Turns a parsed, untyped RSQL tree into a typed {@link FilterGroup} the
17
+ * repositories can execute, validating it against the entity's metadata on the
18
+ * way through.
19
+ *
20
+ * This is the trust boundary of the query protocol. Everything before it is a
21
+ * string a client chose; everything after it names only members the entity
22
+ * declared `filterable` and carries only values of those members' declared
23
+ * types. A violation throws {@link EntifixBuildError}, which services already
24
+ * map to a `400`.
25
+ */
26
+ export declare function coerceFiltering<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, parsed: RawFilterGroup): FilterGroup<TEntity>;
27
+ //# sourceMappingURL=coerce-rsql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coerce-rsql.d.ts","sourceRoot":"","sources":["../../src/rsql/coerce-rsql.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,MAAM,EACvD,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC7C,MAAM,EAAE,CAAC,UAAU,EAAE,qBAAqB,KAAK,OAAO,GACrD,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAQpC;AA8FD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,MAAM,EACpD,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC7C,MAAM,EAAE,cAAc,GACrB,WAAW,CAAC,OAAO,CAAC,CAUtB"}
@@ -0,0 +1,121 @@
1
+ import { EntifixBuildError } from '../base-entities/entifix-error/index.js';
2
+ import { describeEntityColumns } from '../entity-definition/describe/index.js';
3
+ import { isRawFilter } from './parse-rsql.js';
4
+ /**
5
+ * Resolves the members a client is allowed to name, keyed by both the accessor
6
+ * name and its wire key so a URL may use either.
7
+ *
8
+ * `select` is what makes this an allowlist rather than a lookup: a member the
9
+ * entity did not mark `filterable`/`sortable` is simply not in the map, and a
10
+ * request naming it is rejected. That is the guard against a client filtering
11
+ * on a `hidden` member or an unindexed one.
12
+ */ export function allowedDescriptors(entityConstructor, select) {
13
+ const allowed = new Map();
14
+ for (const descriptor of describeEntityColumns(entityConstructor)){
15
+ if (!select(descriptor)) continue;
16
+ allowed.set(descriptor.name, descriptor);
17
+ allowed.set(descriptor.key, descriptor);
18
+ }
19
+ return allowed;
20
+ }
21
+ const reject = (message, details)=>new EntifixBuildError(message, undefined, details);
22
+ /** Re-types one raw argument from the member's declared type. */ function coerceValue(raw, descriptor) {
23
+ switch(descriptor.type){
24
+ case 'number':
25
+ {
26
+ const value = Number(raw);
27
+ if (raw.trim() === '' || Number.isNaN(value)) {
28
+ throw reject(`"${raw}" is not a number for "${descriptor.name}"`);
29
+ }
30
+ return value;
31
+ }
32
+ case 'boolean':
33
+ {
34
+ if (raw !== 'true' && raw !== 'false') {
35
+ throw reject(`"${raw}" is not a boolean for "${descriptor.name}"`);
36
+ }
37
+ return raw === 'true';
38
+ }
39
+ case 'date':
40
+ {
41
+ const value = new Date(raw);
42
+ if (Number.isNaN(value.getTime())) {
43
+ throw reject(`"${raw}" is not a date for "${descriptor.name}"`);
44
+ }
45
+ return value;
46
+ }
47
+ case 'enum':
48
+ {
49
+ if (descriptor.enumValues && !descriptor.enumValues.includes(raw)) {
50
+ throw reject(`"${raw}" is not a value of "${descriptor.name}"`);
51
+ }
52
+ return raw;
53
+ }
54
+ default:
55
+ return raw;
56
+ }
57
+ }
58
+ function coerceFilter(raw, allowed) {
59
+ const descriptor = allowed.get(raw.property);
60
+ if (!descriptor) {
61
+ throw reject(`"${raw.property}" is not a filterable member`, {
62
+ property: raw.property
63
+ });
64
+ }
65
+ // The wire key is also the stored field name, so this is what the Mongo
66
+ // translator downstream will use.
67
+ const property = descriptor.key;
68
+ const coerce = (value)=>coerceValue(value, descriptor);
69
+ if (raw.values) {
70
+ return {
71
+ property,
72
+ operator: raw.operator,
73
+ values: raw.values.map(coerce)
74
+ };
75
+ }
76
+ if (raw.start !== undefined && raw.end !== undefined) {
77
+ return {
78
+ property,
79
+ operator: raw.operator,
80
+ start: coerce(raw.start),
81
+ end: coerce(raw.end)
82
+ };
83
+ }
84
+ if (raw.value !== undefined) {
85
+ return {
86
+ property,
87
+ operator: raw.operator,
88
+ value: coerce(raw.value)
89
+ };
90
+ }
91
+ // `isNull`/`isNotNull` — no argument to coerce.
92
+ return {
93
+ property,
94
+ operator: raw.operator
95
+ };
96
+ }
97
+ function coerceNode(node, allowed) {
98
+ return isRawFilter(node) ? coerceFilter(node, allowed) : {
99
+ operator: node.operator,
100
+ values: node.values.map((child)=>coerceNode(child, allowed))
101
+ };
102
+ }
103
+ /**
104
+ * Turns a parsed, untyped RSQL tree into a typed {@link FilterGroup} the
105
+ * repositories can execute, validating it against the entity's metadata on the
106
+ * way through.
107
+ *
108
+ * This is the trust boundary of the query protocol. Everything before it is a
109
+ * string a client chose; everything after it names only members the entity
110
+ * declared `filterable` and carries only values of those members' declared
111
+ * types. A violation throws {@link EntifixBuildError}, which services already
112
+ * map to a `400`.
113
+ */ export function coerceFiltering(entityConstructor, parsed) {
114
+ const allowed = allowedDescriptors(entityConstructor, (descriptor)=>descriptor.filterable);
115
+ return {
116
+ operator: parsed.operator,
117
+ values: parsed.values.map((node)=>coerceNode(node, allowed))
118
+ };
119
+ }
120
+
121
+ //# sourceMappingURL=coerce-rsql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/rsql/coerce-rsql.ts"],"sourcesContent":["import { EntifixBuildError } from '../base-entities/entifix-error/index.js';\nimport {\n describeEntityColumns,\n type EntityFieldDescriptor,\n} from '../entity-definition/describe/index.js';\nimport type { MetaAccessorType } from '../entity-definition/meta-entities/meta-accessor/index.js';\nimport type { Entity, EntityConstructor } from '../types/Entity.js';\nimport type { EntityFilter, FilterGroup } from '../types/EntityFiltering.js';\nimport {\n isRawFilter,\n type RawFilter,\n type RawFilterGroup,\n} from './parse-rsql.js';\n\n/**\n * Resolves the members a client is allowed to name, keyed by both the accessor\n * name and its wire key so a URL may use either.\n *\n * `select` is what makes this an allowlist rather than a lookup: a member the\n * entity did not mark `filterable`/`sortable` is simply not in the map, and a\n * request naming it is rejected. That is the guard against a client filtering\n * on a `hidden` member or an unindexed one.\n */\nexport function allowedDescriptors<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n select: (descriptor: EntityFieldDescriptor) => boolean,\n): Map<string, EntityFieldDescriptor> {\n const allowed = new Map<string, EntityFieldDescriptor>();\n for (const descriptor of describeEntityColumns(entityConstructor)) {\n if (!select(descriptor)) continue;\n allowed.set(descriptor.name, descriptor);\n allowed.set(descriptor.key, descriptor);\n }\n return allowed;\n}\n\nconst reject = (message: string, details?: Record<string, unknown>) =>\n new EntifixBuildError(message, undefined, details);\n\n/** Re-types one raw argument from the member's declared type. */\nfunction coerceValue(raw: string, descriptor: EntityFieldDescriptor): unknown {\n switch (descriptor.type as MetaAccessorType) {\n case 'number': {\n const value = Number(raw);\n if (raw.trim() === '' || Number.isNaN(value)) {\n throw reject(`\"${raw}\" is not a number for \"${descriptor.name}\"`);\n }\n return value;\n }\n case 'boolean': {\n if (raw !== 'true' && raw !== 'false') {\n throw reject(`\"${raw}\" is not a boolean for \"${descriptor.name}\"`);\n }\n return raw === 'true';\n }\n case 'date': {\n const value = new Date(raw);\n if (Number.isNaN(value.getTime())) {\n throw reject(`\"${raw}\" is not a date for \"${descriptor.name}\"`);\n }\n return value;\n }\n case 'enum': {\n if (descriptor.enumValues && !descriptor.enumValues.includes(raw)) {\n throw reject(`\"${raw}\" is not a value of \"${descriptor.name}\"`);\n }\n return raw;\n }\n default:\n return raw;\n }\n}\n\nfunction coerceFilter<TEntity extends Entity>(\n raw: RawFilter,\n allowed: Map<string, EntityFieldDescriptor>,\n): EntityFilter<TEntity> {\n const descriptor = allowed.get(raw.property);\n if (!descriptor) {\n throw reject(`\"${raw.property}\" is not a filterable member`, {\n property: raw.property,\n });\n }\n\n // The wire key is also the stored field name, so this is what the Mongo\n // translator downstream will use.\n const property = descriptor.key as keyof TEntity;\n const coerce = (value: string) => coerceValue(value, descriptor);\n\n if (raw.values) {\n return {\n property,\n operator: raw.operator,\n values: raw.values.map(coerce),\n } as EntityFilter<TEntity>;\n }\n if (raw.start !== undefined && raw.end !== undefined) {\n return {\n property,\n operator: raw.operator,\n start: coerce(raw.start),\n end: coerce(raw.end),\n } as EntityFilter<TEntity>;\n }\n if (raw.value !== undefined) {\n return {\n property,\n operator: raw.operator,\n value: coerce(raw.value),\n } as EntityFilter<TEntity>;\n }\n\n // `isNull`/`isNotNull` — no argument to coerce.\n return { property, operator: raw.operator } as EntityFilter<TEntity>;\n}\n\nfunction coerceNode<TEntity extends Entity>(\n node: RawFilter | RawFilterGroup,\n allowed: Map<string, EntityFieldDescriptor>,\n): EntityFilter<TEntity> | FilterGroup<TEntity> {\n return isRawFilter(node)\n ? coerceFilter<TEntity>(node, allowed)\n : {\n operator: node.operator,\n values: node.values.map(child => coerceNode<TEntity>(child, allowed)),\n };\n}\n\n/**\n * Turns a parsed, untyped RSQL tree into a typed {@link FilterGroup} the\n * repositories can execute, validating it against the entity's metadata on the\n * way through.\n *\n * This is the trust boundary of the query protocol. Everything before it is a\n * string a client chose; everything after it names only members the entity\n * declared `filterable` and carries only values of those members' declared\n * types. A violation throws {@link EntifixBuildError}, which services already\n * map to a `400`.\n */\nexport function coerceFiltering<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n parsed: RawFilterGroup,\n): FilterGroup<TEntity> {\n const allowed = allowedDescriptors(\n entityConstructor,\n descriptor => descriptor.filterable,\n );\n\n return {\n operator: parsed.operator,\n values: parsed.values.map(node => coerceNode<TEntity>(node, allowed)),\n };\n}\n"],"names":["EntifixBuildError","describeEntityColumns","isRawFilter","allowedDescriptors","entityConstructor","select","allowed","Map","descriptor","set","name","key","reject","message","details","undefined","coerceValue","raw","type","value","Number","trim","isNaN","Date","getTime","enumValues","includes","coerceFilter","get","property","coerce","values","operator","map","start","end","coerceNode","node","child","coerceFiltering","parsed","filterable"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,0CAA0C;AAC5E,SACEC,qBAAqB,QAEhB,yCAAyC;AAIhD,SACEC,WAAW,QAGN,kBAAkB;AAEzB;;;;;;;;CAQC,GACD,OAAO,SAASC,mBACdC,iBAA6C,EAC7CC,MAAsD;IAEtD,MAAMC,UAAU,IAAIC;IACpB,KAAK,MAAMC,cAAcP,sBAAsBG,mBAAoB;QACjE,IAAI,CAACC,OAAOG,aAAa;QACzBF,QAAQG,GAAG,CAACD,WAAWE,IAAI,EAAEF;QAC7BF,QAAQG,GAAG,CAACD,WAAWG,GAAG,EAAEH;IAC9B;IACA,OAAOF;AACT;AAEA,MAAMM,SAAS,CAACC,SAAiBC,UAC/B,IAAId,kBAAkBa,SAASE,WAAWD;AAE5C,+DAA+D,GAC/D,SAASE,YAAYC,GAAW,EAAET,UAAiC;IACjE,OAAQA,WAAWU,IAAI;QACrB,KAAK;YAAU;gBACb,MAAMC,QAAQC,OAAOH;gBACrB,IAAIA,IAAII,IAAI,OAAO,MAAMD,OAAOE,KAAK,CAACH,QAAQ;oBAC5C,MAAMP,OAAO,CAAC,CAAC,EAAEK,IAAI,uBAAuB,EAAET,WAAWE,IAAI,CAAC,CAAC,CAAC;gBAClE;gBACA,OAAOS;YACT;QACA,KAAK;YAAW;gBACd,IAAIF,QAAQ,UAAUA,QAAQ,SAAS;oBACrC,MAAML,OAAO,CAAC,CAAC,EAAEK,IAAI,wBAAwB,EAAET,WAAWE,IAAI,CAAC,CAAC,CAAC;gBACnE;gBACA,OAAOO,QAAQ;YACjB;QACA,KAAK;YAAQ;gBACX,MAAME,QAAQ,IAAII,KAAKN;gBACvB,IAAIG,OAAOE,KAAK,CAACH,MAAMK,OAAO,KAAK;oBACjC,MAAMZ,OAAO,CAAC,CAAC,EAAEK,IAAI,qBAAqB,EAAET,WAAWE,IAAI,CAAC,CAAC,CAAC;gBAChE;gBACA,OAAOS;YACT;QACA,KAAK;YAAQ;gBACX,IAAIX,WAAWiB,UAAU,IAAI,CAACjB,WAAWiB,UAAU,CAACC,QAAQ,CAACT,MAAM;oBACjE,MAAML,OAAO,CAAC,CAAC,EAAEK,IAAI,qBAAqB,EAAET,WAAWE,IAAI,CAAC,CAAC,CAAC;gBAChE;gBACA,OAAOO;YACT;QACA;YACE,OAAOA;IACX;AACF;AAEA,SAASU,aACPV,GAAc,EACdX,OAA2C;IAE3C,MAAME,aAAaF,QAAQsB,GAAG,CAACX,IAAIY,QAAQ;IAC3C,IAAI,CAACrB,YAAY;QACf,MAAMI,OAAO,CAAC,CAAC,EAAEK,IAAIY,QAAQ,CAAC,4BAA4B,CAAC,EAAE;YAC3DA,UAAUZ,IAAIY,QAAQ;QACxB;IACF;IAEA,wEAAwE;IACxE,kCAAkC;IAClC,MAAMA,WAAWrB,WAAWG,GAAG;IAC/B,MAAMmB,SAAS,CAACX,QAAkBH,YAAYG,OAAOX;IAErD,IAAIS,IAAIc,MAAM,EAAE;QACd,OAAO;YACLF;YACAG,UAAUf,IAAIe,QAAQ;YACtBD,QAAQd,IAAIc,MAAM,CAACE,GAAG,CAACH;QACzB;IACF;IACA,IAAIb,IAAIiB,KAAK,KAAKnB,aAAaE,IAAIkB,GAAG,KAAKpB,WAAW;QACpD,OAAO;YACLc;YACAG,UAAUf,IAAIe,QAAQ;YACtBE,OAAOJ,OAAOb,IAAIiB,KAAK;YACvBC,KAAKL,OAAOb,IAAIkB,GAAG;QACrB;IACF;IACA,IAAIlB,IAAIE,KAAK,KAAKJ,WAAW;QAC3B,OAAO;YACLc;YACAG,UAAUf,IAAIe,QAAQ;YACtBb,OAAOW,OAAOb,IAAIE,KAAK;QACzB;IACF;IAEA,gDAAgD;IAChD,OAAO;QAAEU;QAAUG,UAAUf,IAAIe,QAAQ;IAAC;AAC5C;AAEA,SAASI,WACPC,IAAgC,EAChC/B,OAA2C;IAE3C,OAAOJ,YAAYmC,QACfV,aAAsBU,MAAM/B,WAC5B;QACE0B,UAAUK,KAAKL,QAAQ;QACvBD,QAAQM,KAAKN,MAAM,CAACE,GAAG,CAACK,CAAAA,QAASF,WAAoBE,OAAOhC;IAC9D;AACN;AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASiC,gBACdnC,iBAA6C,EAC7CoC,MAAsB;IAEtB,MAAMlC,UAAUH,mBACdC,mBACAI,CAAAA,aAAcA,WAAWiC,UAAU;IAGrC,OAAO;QACLT,UAAUQ,OAAOR,QAAQ;QACzBD,QAAQS,OAAOT,MAAM,CAACE,GAAG,CAACI,CAAAA,OAAQD,WAAoBC,MAAM/B;IAC9D;AACF"}
@@ -0,0 +1,8 @@
1
+ export * from './coerce-rsql.js';
2
+ export * from './load-request-url.js';
3
+ export * from './parse-rsql.js';
4
+ export * from './rsql-operators.js';
5
+ export * from './rsql-values.js';
6
+ export * from './serialize-rsql.js';
7
+ export * from './sort-param.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rsql/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './coerce-rsql.js';
2
+ export * from './load-request-url.js';
3
+ export * from './parse-rsql.js';
4
+ export * from './rsql-operators.js';
5
+ export * from './rsql-values.js';
6
+ export * from './serialize-rsql.js';
7
+ export * from './sort-param.js';
8
+
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/rsql/index.ts"],"sourcesContent":["export * from './coerce-rsql.js';\nexport * from './load-request-url.js';\nexport * from './parse-rsql.js';\nexport * from './rsql-operators.js';\nexport * from './rsql-values.js';\nexport * from './serialize-rsql.js';\nexport * from './sort-param.js';\n"],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB"}
@@ -0,0 +1,30 @@
1
+ import type { Entity, EntityConstructor } from '../types/Entity.js';
2
+ import type { EntityLoadRequest } from '../types/EntityLoadRequest.js';
3
+ /** The query parameters a load request is expressed in. */
4
+ export declare const RSQL_PARAM = "rsql";
5
+ export declare const SORT_PARAM = "sort";
6
+ export declare const PAGE_PARAM = "page";
7
+ export declare const PAGE_SIZE_PARAM = "pageSize";
8
+ export interface LoadRequestDefaults {
9
+ page: number;
10
+ pageSize: number;
11
+ /** Upper bound on `pageSize`, so a client cannot ask for the whole table. */
12
+ maxPageSize?: number;
13
+ }
14
+ /**
15
+ * Serializes a load request into query parameters. Empty filtering, empty
16
+ * sorting and absent paging are all omitted rather than sent blank, so a plain
17
+ * listing keeps a clean URL.
18
+ */
19
+ export declare function serializeLoadRequestParams<TEntity extends Entity>(request: EntityLoadRequest<TEntity>): URLSearchParams;
20
+ /**
21
+ * Parses query parameters into an {@link EntityLoadRequest}, validated against
22
+ * the entity's own metadata — the server-side half of the query protocol.
23
+ *
24
+ * Every failure mode (malformed RSQL, an unknown or non-filterable member, a
25
+ * value that is not of the member's type, a nonsense page) is an
26
+ * {@link EntifixBuildError}: the client sent something wrong, so it is a `400`
27
+ * and never a `500`.
28
+ */
29
+ export declare function parseLoadRequestParams<TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, params: URLSearchParams, defaults?: Partial<LoadRequestDefaults>): EntityLoadRequest<TEntity>;
30
+ //# sourceMappingURL=load-request-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-request-url.d.ts","sourceRoot":"","sources":["../../src/rsql/load-request-url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMvE,2DAA2D;AAC3D,eAAO,MAAM,UAAU,SAAS,CAAC;AACjC,eAAO,MAAM,UAAU,SAAS,CAAC;AACjC,eAAO,MAAM,UAAU,SAAS,CAAC;AACjC,eAAO,MAAM,eAAe,aAAa,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAQD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,SAAS,MAAM,EAC/D,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAClC,eAAe,CAejB;AAsBD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,MAAM,EAC3D,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC7C,MAAM,EAAE,eAAe,EACvB,QAAQ,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAC1C,iBAAiB,CAAC,OAAO,CAAC,CAsB5B"}
@@ -0,0 +1,67 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { EntifixBuildError } from '../base-entities/entifix-error/index.js';
3
+ import { coerceFiltering } from './coerce-rsql.js';
4
+ import { parseRsql } from './parse-rsql.js';
5
+ import { serializeRsql } from './serialize-rsql.js';
6
+ import { parseSort, serializeSort } from './sort-param.js';
7
+ /** The query parameters a load request is expressed in. */ export const RSQL_PARAM = 'rsql';
8
+ export const SORT_PARAM = 'sort';
9
+ export const PAGE_PARAM = 'page';
10
+ export const PAGE_SIZE_PARAM = 'pageSize';
11
+ const DEFAULTS = {
12
+ page: 1,
13
+ pageSize: 10,
14
+ maxPageSize: 200
15
+ };
16
+ /**
17
+ * Serializes a load request into query parameters. Empty filtering, empty
18
+ * sorting and absent paging are all omitted rather than sent blank, so a plain
19
+ * listing keeps a clean URL.
20
+ */ export function serializeLoadRequestParams(request) {
21
+ const params = new URLSearchParams();
22
+ const rsql = serializeRsql(request.filtering);
23
+ if (rsql !== '') params.set(RSQL_PARAM, rsql);
24
+ const sort = serializeSort(request.sorting);
25
+ if (sort !== '') params.set(SORT_PARAM, sort);
26
+ if (request.page != null) params.set(PAGE_PARAM, String(request.page));
27
+ if (request.pageSize != null) {
28
+ params.set(PAGE_SIZE_PARAM, String(request.pageSize));
29
+ }
30
+ return params;
31
+ }
32
+ /** Reads a positive integer parameter, falling back when absent or unusable. */ function readPositiveInteger(params, name, fallback) {
33
+ const raw = params.get(name);
34
+ if (raw === null || raw.trim() === '') return fallback;
35
+ const value = Number(raw);
36
+ if (!Number.isInteger(value) || value < 1) {
37
+ throw new EntifixBuildError(`"${name}" must be a positive integer`, undefined, {
38
+ [name]: raw
39
+ });
40
+ }
41
+ return value;
42
+ }
43
+ /**
44
+ * Parses query parameters into an {@link EntityLoadRequest}, validated against
45
+ * the entity's own metadata — the server-side half of the query protocol.
46
+ *
47
+ * Every failure mode (malformed RSQL, an unknown or non-filterable member, a
48
+ * value that is not of the member's type, a nonsense page) is an
49
+ * {@link EntifixBuildError}: the client sent something wrong, so it is a `400`
50
+ * and never a `500`.
51
+ */ export function parseLoadRequestParams(entityConstructor, params, defaults = {}) {
52
+ const { page, pageSize, maxPageSize } = _extends({}, DEFAULTS, defaults);
53
+ const expression = params.get(RSQL_PARAM);
54
+ const filtering = (expression == null ? void 0 : expression.trim()) ? [
55
+ coerceFiltering(entityConstructor, parseRsql(expression))
56
+ ] : undefined;
57
+ const sorting = parseSort(entityConstructor, params.get(SORT_PARAM));
58
+ const request = {
59
+ page: readPositiveInteger(params, PAGE_PARAM, page),
60
+ pageSize: Math.min(readPositiveInteger(params, PAGE_SIZE_PARAM, pageSize), maxPageSize)
61
+ };
62
+ if (filtering) request.filtering = filtering;
63
+ if (sorting) request.sorting = sorting;
64
+ return request;
65
+ }
66
+
67
+ //# sourceMappingURL=load-request-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/rsql/load-request-url.ts"],"sourcesContent":["import { EntifixBuildError } from '../base-entities/entifix-error/index.js';\nimport type { Entity, EntityConstructor } from '../types/Entity.js';\nimport type { EntityLoadRequest } from '../types/EntityLoadRequest.js';\nimport { coerceFiltering } from './coerce-rsql.js';\nimport { parseRsql } from './parse-rsql.js';\nimport { serializeRsql } from './serialize-rsql.js';\nimport { parseSort, serializeSort } from './sort-param.js';\n\n/** The query parameters a load request is expressed in. */\nexport const RSQL_PARAM = 'rsql';\nexport const SORT_PARAM = 'sort';\nexport const PAGE_PARAM = 'page';\nexport const PAGE_SIZE_PARAM = 'pageSize';\n\nexport interface LoadRequestDefaults {\n page: number;\n pageSize: number;\n /** Upper bound on `pageSize`, so a client cannot ask for the whole table. */\n maxPageSize?: number;\n}\n\nconst DEFAULTS: Required<LoadRequestDefaults> = {\n page: 1,\n pageSize: 10,\n maxPageSize: 200,\n};\n\n/**\n * Serializes a load request into query parameters. Empty filtering, empty\n * sorting and absent paging are all omitted rather than sent blank, so a plain\n * listing keeps a clean URL.\n */\nexport function serializeLoadRequestParams<TEntity extends Entity>(\n request: EntityLoadRequest<TEntity>,\n): URLSearchParams {\n const params = new URLSearchParams();\n\n const rsql = serializeRsql(request.filtering);\n if (rsql !== '') params.set(RSQL_PARAM, rsql);\n\n const sort = serializeSort(request.sorting);\n if (sort !== '') params.set(SORT_PARAM, sort);\n\n if (request.page != null) params.set(PAGE_PARAM, String(request.page));\n if (request.pageSize != null) {\n params.set(PAGE_SIZE_PARAM, String(request.pageSize));\n }\n\n return params;\n}\n\n/** Reads a positive integer parameter, falling back when absent or unusable. */\nfunction readPositiveInteger(\n params: URLSearchParams,\n name: string,\n fallback: number,\n): number {\n const raw = params.get(name);\n if (raw === null || raw.trim() === '') return fallback;\n\n const value = Number(raw);\n if (!Number.isInteger(value) || value < 1) {\n throw new EntifixBuildError(\n `\"${name}\" must be a positive integer`,\n undefined,\n { [name]: raw },\n );\n }\n return value;\n}\n\n/**\n * Parses query parameters into an {@link EntityLoadRequest}, validated against\n * the entity's own metadata — the server-side half of the query protocol.\n *\n * Every failure mode (malformed RSQL, an unknown or non-filterable member, a\n * value that is not of the member's type, a nonsense page) is an\n * {@link EntifixBuildError}: the client sent something wrong, so it is a `400`\n * and never a `500`.\n */\nexport function parseLoadRequestParams<TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n params: URLSearchParams,\n defaults: Partial<LoadRequestDefaults> = {},\n): EntityLoadRequest<TEntity> {\n const { page, pageSize, maxPageSize } = { ...DEFAULTS, ...defaults };\n\n const expression = params.get(RSQL_PARAM);\n const filtering = expression?.trim()\n ? [coerceFiltering(entityConstructor, parseRsql(expression))]\n : undefined;\n\n const sorting = parseSort(entityConstructor, params.get(SORT_PARAM));\n\n const request: EntityLoadRequest<TEntity> = {\n page: readPositiveInteger(params, PAGE_PARAM, page),\n pageSize: Math.min(\n readPositiveInteger(params, PAGE_SIZE_PARAM, pageSize),\n maxPageSize,\n ),\n };\n\n if (filtering) request.filtering = filtering;\n if (sorting) request.sorting = sorting;\n\n return request;\n}\n"],"names":["EntifixBuildError","coerceFiltering","parseRsql","serializeRsql","parseSort","serializeSort","RSQL_PARAM","SORT_PARAM","PAGE_PARAM","PAGE_SIZE_PARAM","DEFAULTS","page","pageSize","maxPageSize","serializeLoadRequestParams","request","params","URLSearchParams","rsql","filtering","set","sort","sorting","String","readPositiveInteger","name","fallback","raw","get","trim","value","Number","isInteger","undefined","parseLoadRequestParams","entityConstructor","defaults","expression","Math","min"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,0CAA0C;AAG5E,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,SAAS,EAAEC,aAAa,QAAQ,kBAAkB;AAE3D,yDAAyD,GACzD,OAAO,MAAMC,aAAa,OAAO;AACjC,OAAO,MAAMC,aAAa,OAAO;AACjC,OAAO,MAAMC,aAAa,OAAO;AACjC,OAAO,MAAMC,kBAAkB,WAAW;AAS1C,MAAMC,WAA0C;IAC9CC,MAAM;IACNC,UAAU;IACVC,aAAa;AACf;AAEA;;;;CAIC,GACD,OAAO,SAASC,2BACdC,OAAmC;IAEnC,MAAMC,SAAS,IAAIC;IAEnB,MAAMC,OAAOf,cAAcY,QAAQI,SAAS;IAC5C,IAAID,SAAS,IAAIF,OAAOI,GAAG,CAACd,YAAYY;IAExC,MAAMG,OAAOhB,cAAcU,QAAQO,OAAO;IAC1C,IAAID,SAAS,IAAIL,OAAOI,GAAG,CAACb,YAAYc;IAExC,IAAIN,QAAQJ,IAAI,IAAI,MAAMK,OAAOI,GAAG,CAACZ,YAAYe,OAAOR,QAAQJ,IAAI;IACpE,IAAII,QAAQH,QAAQ,IAAI,MAAM;QAC5BI,OAAOI,GAAG,CAACX,iBAAiBc,OAAOR,QAAQH,QAAQ;IACrD;IAEA,OAAOI;AACT;AAEA,8EAA8E,GAC9E,SAASQ,oBACPR,MAAuB,EACvBS,IAAY,EACZC,QAAgB;IAEhB,MAAMC,MAAMX,OAAOY,GAAG,CAACH;IACvB,IAAIE,QAAQ,QAAQA,IAAIE,IAAI,OAAO,IAAI,OAAOH;IAE9C,MAAMI,QAAQC,OAAOJ;IACrB,IAAI,CAACI,OAAOC,SAAS,CAACF,UAAUA,QAAQ,GAAG;QACzC,MAAM,IAAI9B,kBACR,CAAC,CAAC,EAAEyB,KAAK,4BAA4B,CAAC,EACtCQ,WACA;YAAE,CAACR,KAAK,EAAEE;QAAI;IAElB;IACA,OAAOG;AACT;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASI,uBACdC,iBAA6C,EAC7CnB,MAAuB,EACvBoB,WAAyC,CAAC,CAAC;IAE3C,MAAM,EAAEzB,IAAI,EAAEC,QAAQ,EAAEC,WAAW,EAAE,GAAG,aAAKH,UAAa0B;IAE1D,MAAMC,aAAarB,OAAOY,GAAG,CAACtB;IAC9B,MAAMa,YAAYkB,CAAAA,8BAAAA,WAAYR,IAAI,MAC9B;QAAC5B,gBAAgBkC,mBAAmBjC,UAAUmC;KAAa,GAC3DJ;IAEJ,MAAMX,UAAUlB,UAAU+B,mBAAmBnB,OAAOY,GAAG,CAACrB;IAExD,MAAMQ,UAAsC;QAC1CJ,MAAMa,oBAAoBR,QAAQR,YAAYG;QAC9CC,UAAU0B,KAAKC,GAAG,CAChBf,oBAAoBR,QAAQP,iBAAiBG,WAC7CC;IAEJ;IAEA,IAAIM,WAAWJ,QAAQI,SAAS,GAAGA;IACnC,IAAIG,SAASP,QAAQO,OAAO,GAAGA;IAE/B,OAAOP;AACT"}
@@ -0,0 +1,35 @@
1
+ import { type RsqlOperator } from './rsql-operators.js';
2
+ /**
3
+ * A parsed filter before coercion: identical to an {@link EntityFilter} except
4
+ * every argument is still the raw string the URL carried. Re-typing needs the
5
+ * entity's metadata, which this parser deliberately does not have — see
6
+ * `coerce-rsql`.
7
+ */
8
+ export type RawFilter = {
9
+ property: string;
10
+ operator: RsqlOperator;
11
+ value?: string;
12
+ values?: string[];
13
+ start?: string;
14
+ end?: string;
15
+ };
16
+ export type RawFilterGroup = {
17
+ operator: 'and' | 'or';
18
+ values: Array<RawFilter | RawFilterGroup>;
19
+ };
20
+ /**
21
+ * Parses an RSQL expression into a raw (still untyped) filter tree.
22
+ *
23
+ * Precedence follows RSQL: `,` (or) binds looser than `;` (and), and
24
+ * parentheses override both. Values stay strings — {@link coerceFiltering} is
25
+ * what turns them into the entity's own types, and it is also what checks the
26
+ * properties against the metadata allowlist. Parsing alone never trusts the
27
+ * input enough to build a query from it.
28
+ *
29
+ * Throws {@link EntifixBuildError} on malformed input, which services surface
30
+ * as a `400`.
31
+ */
32
+ export declare function parseRsql(expression: string): RawFilterGroup;
33
+ /** Narrows a raw node to a comparison. */
34
+ export declare function isRawFilter(node: RawFilter | RawFilterGroup): node is RawFilter;
35
+ //# sourceMappingURL=parse-rsql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-rsql.d.ts","sourceRoot":"","sources":["../../src/rsql/parse-rsql.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,KAAK,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,cAAc,CAAC,CAAC;CAC3C,CAAC;AA4NF;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAiB5D;AAED,0CAA0C;AAC1C,wBAAgB,WAAW,CACzB,IAAI,EAAE,SAAS,GAAG,cAAc,GAC/B,IAAI,IAAI,SAAS,CAEnB"}