@ddd-ts-kit/kernel 0.110.1 → 0.112.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 (214) hide show
  1. package/README.fr.md +81 -17
  2. package/README.md +76 -13
  3. package/dist/application/criteria/filter-operator.d.ts +1 -1
  4. package/dist/application/criteria/filter-operator.d.ts.map +1 -1
  5. package/dist/application/criteria/filter-violations.d.ts.map +1 -1
  6. package/dist/application/criteria/filter-violations.js +4 -3
  7. package/dist/application/criteria/filter-violations.js.map +1 -1
  8. package/dist/application/criteria/finds-text.d.ts +4 -0
  9. package/dist/application/criteria/finds-text.d.ts.map +1 -0
  10. package/dist/application/criteria/finds-text.js +12 -0
  11. package/dist/application/criteria/finds-text.js.map +1 -0
  12. package/dist/application/criteria/fold-case.d.ts +14 -0
  13. package/dist/application/criteria/fold-case.d.ts.map +1 -0
  14. package/dist/application/criteria/fold-case.js +16 -0
  15. package/dist/application/criteria/fold-case.js.map +1 -0
  16. package/dist/application/criteria/holds.d.ts.map +1 -1
  17. package/dist/application/criteria/holds.js +5 -4
  18. package/dist/application/criteria/holds.js.map +1 -1
  19. package/dist/application/criteria/index.d.ts +3 -0
  20. package/dist/application/criteria/index.d.ts.map +1 -1
  21. package/dist/application/criteria/index.js +3 -0
  22. package/dist/application/criteria/index.js.map +1 -1
  23. package/dist/application/criteria/is-text-search.d.ts +5 -0
  24. package/dist/application/criteria/is-text-search.d.ts.map +1 -0
  25. package/dist/application/criteria/is-text-search.js +11 -0
  26. package/dist/application/criteria/is-text-search.js.map +1 -0
  27. package/dist/application/criteria/operand-of.d.ts +2 -1
  28. package/dist/application/criteria/operand-of.d.ts.map +1 -1
  29. package/dist/application/criteria/operator-of.d.ts +2 -1
  30. package/dist/application/criteria/operator-of.d.ts.map +1 -1
  31. package/dist/application/criteria/operators-of-type.js +1 -1
  32. package/dist/application/criteria/operators-of-type.js.map +1 -1
  33. package/dist/application/criteria/text-search.d.ts +3 -0
  34. package/dist/application/criteria/text-search.d.ts.map +1 -0
  35. package/dist/application/criteria/text-search.js +2 -0
  36. package/dist/application/criteria/text-search.js.map +1 -0
  37. package/dist/application/files/content-expectation.d.ts +6 -0
  38. package/dist/application/files/content-expectation.d.ts.map +1 -1
  39. package/dist/application/files/content-matches.d.ts +12 -3
  40. package/dist/application/files/content-matches.d.ts.map +1 -1
  41. package/dist/application/files/content-matches.js +23 -28
  42. package/dist/application/files/content-matches.js.map +1 -1
  43. package/dist/application/files/content-rule-defects.d.ts +9 -0
  44. package/dist/application/files/content-rule-defects.d.ts.map +1 -0
  45. package/dist/application/files/content-rule-defects.js +57 -0
  46. package/dist/application/files/content-rule-defects.js.map +1 -0
  47. package/dist/application/files/content-rule-of.d.ts +11 -0
  48. package/dist/application/files/content-rule-of.d.ts.map +1 -0
  49. package/dist/application/files/content-rule-of.js +28 -0
  50. package/dist/application/files/content-rule-of.js.map +1 -0
  51. package/dist/application/files/content-rule.d.ts +4 -0
  52. package/dist/application/files/content-rule.d.ts.map +1 -0
  53. package/dist/application/files/content-rule.js +2 -0
  54. package/dist/application/files/content-rule.js.map +1 -0
  55. package/dist/application/files/content-rules.d.ts +4 -0
  56. package/dist/application/files/content-rules.d.ts.map +1 -0
  57. package/dist/application/files/content-rules.js +2 -0
  58. package/dist/application/files/content-rules.js.map +1 -0
  59. package/dist/application/files/index.d.ts +10 -0
  60. package/dist/application/files/index.d.ts.map +1 -1
  61. package/dist/application/files/index.js +10 -0
  62. package/dist/application/files/index.js.map +1 -1
  63. package/dist/application/files/is-utf8.d.ts +8 -0
  64. package/dist/application/files/is-utf8.d.ts.map +1 -0
  65. package/dist/application/files/is-utf8.js +16 -0
  66. package/dist/application/files/is-utf8.js.map +1 -0
  67. package/dist/application/files/looks-like-text.d.ts +8 -0
  68. package/dist/application/files/looks-like-text.d.ts.map +1 -0
  69. package/dist/application/files/looks-like-text.js +28 -0
  70. package/dist/application/files/looks-like-text.js.map +1 -0
  71. package/dist/application/files/named-only-media-types.d.ts +6 -0
  72. package/dist/application/files/named-only-media-types.d.ts.map +1 -0
  73. package/dist/application/files/named-only-media-types.js +12 -0
  74. package/dist/application/files/named-only-media-types.js.map +1 -0
  75. package/dist/application/files/signed-media-types.d.ts +3 -0
  76. package/dist/application/files/signed-media-types.d.ts.map +1 -0
  77. package/dist/application/files/signed-media-types.js +13 -0
  78. package/dist/application/files/signed-media-types.js.map +1 -0
  79. package/dist/application/files/stated-content-rule.d.ts +7 -0
  80. package/dist/application/files/stated-content-rule.d.ts.map +1 -0
  81. package/dist/application/files/stated-content-rule.js +2 -0
  82. package/dist/application/files/stated-content-rule.js.map +1 -0
  83. package/dist/application/files/text-media-types.d.ts +3 -0
  84. package/dist/application/files/text-media-types.d.ts.map +1 -0
  85. package/dist/application/files/text-media-types.js +10 -0
  86. package/dist/application/files/text-media-types.js.map +1 -0
  87. package/dist/application/files/text-rule.d.ts +17 -0
  88. package/dist/application/files/text-rule.d.ts.map +1 -0
  89. package/dist/application/files/text-rule.js +2 -0
  90. package/dist/application/files/text-rule.js.map +1 -0
  91. package/dist/application/files/zip-containers.d.ts +3 -0
  92. package/dist/application/files/zip-containers.d.ts.map +1 -0
  93. package/dist/application/files/zip-containers.js +10 -0
  94. package/dist/application/files/zip-containers.js.map +1 -0
  95. package/dist/application/persistence/advisory-lock-options.d.ts +10 -0
  96. package/dist/application/persistence/advisory-lock-options.d.ts.map +1 -0
  97. package/dist/application/persistence/advisory-lock-options.js +2 -0
  98. package/dist/application/persistence/advisory-lock-options.js.map +1 -0
  99. package/dist/application/ports/read-model-rows.d.ts +8 -2
  100. package/dist/application/ports/read-model-rows.d.ts.map +1 -1
  101. package/dist/application/ports/read-model-rows.js.map +1 -1
  102. package/dist/application/ports/read-model-store.d.ts +29 -3
  103. package/dist/application/ports/read-model-store.d.ts.map +1 -1
  104. package/dist/application/ports/read-model-store.js +8 -1
  105. package/dist/application/ports/read-model-store.js.map +1 -1
  106. package/dist/application/ports/read-model-table.d.ts +7 -0
  107. package/dist/application/ports/read-model-table.d.ts.map +1 -1
  108. package/dist/application/ports/read-model-table.js.map +1 -1
  109. package/dist/application/read-model/event-stamp.d.ts +4 -2
  110. package/dist/application/read-model/event-stamp.d.ts.map +1 -1
  111. package/dist/application/read-model/is-newer.d.ts +8 -1
  112. package/dist/application/read-model/is-newer.d.ts.map +1 -1
  113. package/dist/application/read-model/is-newer.js +8 -1
  114. package/dist/application/read-model/is-newer.js.map +1 -1
  115. package/dist/application/read-model/read-model-table-state.d.ts +53 -0
  116. package/dist/application/read-model/read-model-table-state.d.ts.map +1 -0
  117. package/dist/application/read-model/read-model-table-state.js +2 -0
  118. package/dist/application/read-model/read-model-table-state.js.map +1 -0
  119. package/dist/application/read-model/read-model-write.d.ts +9 -4
  120. package/dist/application/read-model/read-model-write.d.ts.map +1 -1
  121. package/dist/application/read-model/same-stamp.d.ts +8 -0
  122. package/dist/application/read-model/same-stamp.d.ts.map +1 -0
  123. package/dist/application/read-model/same-stamp.js +11 -0
  124. package/dist/application/read-model/same-stamp.js.map +1 -0
  125. package/dist/index.d.ts +10 -0
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +10 -0
  128. package/dist/index.js.map +1 -1
  129. package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts +2 -1
  130. package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts.map +1 -1
  131. package/dist/infrastructure/event-sourcing/stored-stamp-of.js +2 -1
  132. package/dist/infrastructure/event-sourcing/stored-stamp-of.js.map +1 -1
  133. package/dist/infrastructure/files/file-inspection.js +1 -1
  134. package/dist/infrastructure/files/file-inspection.js.map +1 -1
  135. package/dist/infrastructure/files/file-staging.d.ts +4 -2
  136. package/dist/infrastructure/files/file-staging.d.ts.map +1 -1
  137. package/dist/infrastructure/files/file-staging.js +14 -6
  138. package/dist/infrastructure/files/file-staging.js.map +1 -1
  139. package/dist/infrastructure/in-memory/in-memory-read-model-table.d.ts.map +1 -1
  140. package/dist/infrastructure/in-memory/in-memory-read-model-table.js +2 -6
  141. package/dist/infrastructure/in-memory/in-memory-read-model-table.js.map +1 -1
  142. package/dist/infrastructure/persistence/advisory-lock-key.d.ts +16 -0
  143. package/dist/infrastructure/persistence/advisory-lock-key.d.ts.map +1 -0
  144. package/dist/infrastructure/persistence/advisory-lock-key.js +18 -0
  145. package/dist/infrastructure/persistence/advisory-lock-key.js.map +1 -0
  146. package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.d.ts +9 -0
  147. package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.d.ts.map +1 -0
  148. package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.js +12 -0
  149. package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.js.map +1 -0
  150. package/dist/infrastructure/read-model/database-failure.d.ts +19 -0
  151. package/dist/infrastructure/read-model/database-failure.d.ts.map +1 -0
  152. package/dist/infrastructure/read-model/database-failure.js +71 -0
  153. package/dist/infrastructure/read-model/database-failure.js.map +1 -0
  154. package/dist/infrastructure/read-model/live-rows-columns-of.d.ts +7 -0
  155. package/dist/infrastructure/read-model/live-rows-columns-of.d.ts.map +1 -0
  156. package/dist/infrastructure/read-model/live-rows-columns-of.js +20 -0
  157. package/dist/infrastructure/read-model/live-rows-columns-of.js.map +1 -0
  158. package/dist/infrastructure/read-model/live-rows-constraint-form.d.ts +11 -0
  159. package/dist/infrastructure/read-model/live-rows-constraint-form.d.ts.map +1 -0
  160. package/dist/infrastructure/read-model/live-rows-constraint-form.js +13 -0
  161. package/dist/infrastructure/read-model/live-rows-constraint-form.js.map +1 -0
  162. package/dist/infrastructure/read-model/live-rows-constraint-of.d.ts +6 -0
  163. package/dist/infrastructure/read-model/live-rows-constraint-of.d.ts.map +1 -0
  164. package/dist/infrastructure/read-model/live-rows-constraint-of.js +18 -0
  165. package/dist/infrastructure/read-model/live-rows-constraint-of.js.map +1 -0
  166. package/dist/infrastructure/read-model/postgres-trace-columns.d.ts +34 -0
  167. package/dist/infrastructure/read-model/postgres-trace-columns.d.ts.map +1 -0
  168. package/dist/infrastructure/read-model/postgres-trace-columns.js +124 -0
  169. package/dist/infrastructure/read-model/postgres-trace-columns.js.map +1 -0
  170. package/dist/infrastructure/read-model/projection-rebuild.d.ts +4 -1
  171. package/dist/infrastructure/read-model/projection-rebuild.d.ts.map +1 -1
  172. package/dist/infrastructure/read-model/projection-rebuild.js +4 -1
  173. package/dist/infrastructure/read-model/projection-rebuild.js.map +1 -1
  174. package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.d.ts +12 -0
  175. package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.d.ts.map +1 -0
  176. package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.js +16 -0
  177. package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.js.map +1 -0
  178. package/dist/infrastructure/read-model/read-model-table-migration.d.ts +31 -0
  179. package/dist/infrastructure/read-model/read-model-table-migration.d.ts.map +1 -0
  180. package/dist/infrastructure/read-model/read-model-table-migration.js +82 -0
  181. package/dist/infrastructure/read-model/read-model-table-migration.js.map +1 -0
  182. package/dist/infrastructure/read-model/read-model-table-not-ready-error.d.ts +28 -0
  183. package/dist/infrastructure/read-model/read-model-table-not-ready-error.d.ts.map +1 -0
  184. package/dist/infrastructure/read-model/read-model-table-not-ready-error.js +132 -0
  185. package/dist/infrastructure/read-model/read-model-table-not-ready-error.js.map +1 -0
  186. package/dist/infrastructure/read-model/read-model-table-notes.d.ts +9 -0
  187. package/dist/infrastructure/read-model/read-model-table-notes.d.ts.map +1 -0
  188. package/dist/infrastructure/read-model/read-model-table-notes.js +36 -0
  189. package/dist/infrastructure/read-model/read-model-table-notes.js.map +1 -0
  190. package/dist/infrastructure/read-model/read-model-table-ready.d.ts +4 -0
  191. package/dist/infrastructure/read-model/read-model-table-ready.d.ts.map +1 -0
  192. package/dist/infrastructure/read-model/read-model-table-ready.js +5 -0
  193. package/dist/infrastructure/read-model/read-model-table-ready.js.map +1 -0
  194. package/dist/infrastructure/read-model/read-model-tables-not-ready-error.d.ts +24 -0
  195. package/dist/infrastructure/read-model/read-model-tables-not-ready-error.d.ts.map +1 -0
  196. package/dist/infrastructure/read-model/read-model-tables-not-ready-error.js +40 -0
  197. package/dist/infrastructure/read-model/read-model-tables-not-ready-error.js.map +1 -0
  198. package/dist/infrastructure/read-model/read-model-tables.d.ts +82 -0
  199. package/dist/infrastructure/read-model/read-model-tables.d.ts.map +1 -0
  200. package/dist/infrastructure/read-model/read-model-tables.js +161 -0
  201. package/dist/infrastructure/read-model/read-model-tables.js.map +1 -0
  202. package/dist/infrastructure/read-model/shadow-read-model-store.d.ts +1 -0
  203. package/dist/infrastructure/read-model/shadow-read-model-store.d.ts.map +1 -1
  204. package/dist/infrastructure/read-model/shadow-read-model-store.js +3 -0
  205. package/dist/infrastructure/read-model/shadow-read-model-store.js.map +1 -1
  206. package/dist/infrastructure/read-model/table-read-model-store.d.ts +8 -0
  207. package/dist/infrastructure/read-model/table-read-model-store.d.ts.map +1 -1
  208. package/dist/infrastructure/read-model/table-read-model-store.js +11 -0
  209. package/dist/infrastructure/read-model/table-read-model-store.js.map +1 -1
  210. package/dist/infrastructure/read-model/write-if-newer.d.ts +14 -2
  211. package/dist/infrastructure/read-model/write-if-newer.d.ts.map +1 -1
  212. package/dist/infrastructure/read-model/write-if-newer.js +35 -5
  213. package/dist/infrastructure/read-model/write-if-newer.js.map +1 -1
  214. package/package.json +1 -1
package/README.fr.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [English](README.md) · **Français**
2
- <!-- translation-of: README.md sha256:97710c410f2344fb -->
2
+ <!-- translation-of: README.md sha256:bcc2bfaf4621aaee -->
3
3
 
4
4
  # @ddd-ts-kit/kernel
5
5
 
@@ -1505,8 +1505,10 @@ Une écriture dans le stockage n'est pas annulée avec une transaction.
1505
1505
 
1506
1506
  Pour un gros fichier, le client téléverse directement vers le stockage :
1507
1507
  `uploadUrl(key, { expiresInSeconds, mediaType, accepted, maxBytes })` renvoie le `link` pour le
1508
- client et l'autorisation `pending` (`PendingUpload` : clé, plafond de taille, types de média) que
1509
- la commande enregistre sur l'agrégat ; `confirm(pending)`, appelé par une commande qui relit
1508
+ client et l'autorisation `pending` (`PendingUpload` : clé, plafond de taille, types de média, et
1509
+ la règle `text` et les `contentRules` données avec eux) que la commande enregistre sur
1510
+ l'agrégat ; il lève une erreur quand un type accepté n'a pas de règle de contenu, puisqu'aucun
1511
+ fichier de ce type ne pourrait être confirmé ; `confirm(pending)`, appelé par une commande qui relit
1510
1512
  l'autorisation depuis l'agrégat, jamais depuis le client, vérifie ce qui est arrivé par rapport
1511
1513
  au plafond et sur ses octets (`contentMatches`), l'analyse, et renvoie le `StoredFile`. Aucune
1512
1514
  clé finale ne peut commencer par `staging/` (`assertFinalKey`).
@@ -1517,6 +1519,19 @@ média déclaré (`acceptsMediaType`, `contentMatches` : un PDF commence par `%P
1517
1519
  bureautiques sont des archives zip, le texte est de l'UTF-8 sans caractères de contrôle, SVG et
1518
1520
  les formats binaires inconnus ne correspondent jamais).
1519
1521
 
1522
+ Chaque type de média a une règle de contenu (`contentRuleOf`) : une signature
1523
+ (`SIGNED_MEDIA_TYPES`), le texte (`TEXT_MEDIA_TYPES`), ou celle que l'attente énonce dans
1524
+ `contentRules` pour un type pour lequel le kit n'en a pas, `text` ou `unchecked` (les octets
1525
+ sont pris tels quels) ; une règle énoncée pour une famille (`image/*`) n'atteint jamais un type
1526
+ qu'un navigateur exécute (`NAMED_ONLY_MEDIA_TYPES` : SVG, HTML, JavaScript), qui s'énonce par
1527
+ son nom. `contentRuleDefects` liste, avant qu'un contenu n'arrive, les types
1528
+ acceptés qu'aucun contenu ne pourrait prouver et les règles énoncées qui ne font rien :
1529
+ `@ddd-ts-kit/http` refuse une route là-dessus, `uploadUrl` un lien. L'attente dit aussi le
1530
+ texte qu'elle prend (`TextRule`) : `utf-8`, le défaut, ou `single-byte`, qui laisse aussi passer
1531
+ un texte en Windows-1252 ou en ISO-8859-1 (aucun NUL, aucun caractère de contrôle, aucune marque
1532
+ d'ordre d'octets UTF-16 ou UTF-32) et refuse toujours un fichier binaire. Le kit ne décode
1533
+ jamais les octets : `isUtf8(bytes)` dit à un lecteur quel décodeur prendre.
1534
+
1520
1535
  Connecteurs : `InMemoryFileStorage` pour les tests (`keys()` liste ce qu'il contient) et
1521
1536
  `LocalFileStorage({ directory, baseUrl, secret })` pour le développement, tous deux
1522
1537
  `ServedFileStorage` : leurs liens signés pointent vers l'application, qui y répond avec
@@ -1853,7 +1868,8 @@ store est tenu au même tableau par `criteriaContract` de `@ddd-ts-kit/testing/c
1853
1868
  | `eq`, `ne`, `in` | par valeur : deux instants identiques sont égaux quel que soit le fuseau dans lequel ils ont été écrits, `10.5` vaut `10.50` |
1854
1869
  | `gt`, `gte`, `lt`, `lte` | nombres, décimaux et instants par valeur ; chaînes par point de code Unicode, si bien que les majuscules viennent avant les minuscules (`'B' < 'a'`) ; pas sur un booléen |
1855
1870
  | `between` | les deux bornes incluses |
1856
- | `contains`, `startsWith` | sur une chaîne seulement, sensibles à la casse, le texte pris littéralement : `%`, `_` et `\` sont des caractères. Une recherche qui ignore la casse lit une colonne en minuscules qu'écrit la projection |
1871
+ | `contains`, `startsWith` | sur une chaîne seulement, sensibles à la casse, le texte pris littéralement : `%`, `_` et `\` sont des caractères ; un texte vide est refusé |
1872
+ | `containsIgnoringCase`, `startsWithIgnoringCase` | les mêmes recherches, chaque lettre des deux côtés mise en minuscule, et rien d'autre : un accent est gardé (`e` ne trouve pas `é`), aucune lettre n'est réécrite (`ss` ne trouve pas `ß`). Tous les stockages répondent la même chose pour les lettres ASCII et pour une lettre qui a une seule majuscule et une seule minuscule, d'un caractère chacune (`É` et `é`, `Ñ` et `ñ`, grec et cyrillique compris) ; voir plus bas pour les autres |
1857
1873
  | `isNull` | `true` garde les lignes sans valeur, `false` celles qui en ont une ; seulement sur un champ déclaré `nullable` |
1858
1874
  | Un nul | ne satisfait jamais une comparaison, `ne` compris ; seul `isNull` le voit |
1859
1875
  | Conditions | jointes par ET |
@@ -1866,6 +1882,17 @@ store est tenu au même tableau par `criteriaContract` de `@ddd-ts-kit/testing/c
1866
1882
  | Page par curseur | pas de `total` ; `nextCursor` quand une autre page suit. Le curseur contient les valeurs de tri de la dernière ligne, est vérifié par rapport aux types déclarés à son retour, et appartient à un seul tri |
1867
1883
  | Pas de page | la première page de la taille par défaut |
1868
1884
 
1885
+ **Une recherche qui ignore la casse.** `foldCase(text)` est la règle en mémoire : le
1886
+ `toLowerCase()` de JavaScript des deux côtés. Les *packages* d'ORM écrivent un `ILIKE` (le mode
1887
+ `insensitive` de Prisma), que PostgreSQL replie avec la locale de la base : une base créée avec
1888
+ la locale `C` ne replie que les lettres ASCII. OpenSearch reçoit une expression régulière qui
1889
+ nomme les deux formes de chaque lettre. Hors des lettres que le tableau garantit, chaque
1890
+ stockage suit sa propre table : le `I` avec et sans point du turc, `ß` et `ẞ`, le sigma final,
1891
+ les ligatures et le signe Kelvin peuvent être trouvés par un stockage et pas par un autre. Un
1892
+ index b-tree ne sert ni `LIKE '%x%'` ni aucun `ILIKE` : sur PostgreSQL, un index GIN de
1893
+ l'extension `pg_trgm` sur la colonne (`gin_trgm_ops`) sert les deux, pour un texte de trois
1894
+ caractères ou plus. Le kit ne le crée pas : il va dans une migration du projet.
1895
+
1869
1896
  Deux conséquences découlent de l'endroit où un store garde ses données, et sont écrites dans le
1870
1897
  README de chaque adaptateur. **Les chaînes sont ordonnées par la collation de leur colonne** : la
1871
1898
  référence est la collation `"C"` de PostgreSQL, si bien qu'une colonne de texte triée ou comparée
@@ -2013,9 +2040,10 @@ export class AppointmentListProjection {
2013
2040
 
2014
2041
  @On(PaymentCaptured)
2015
2042
  paid(event: IntegrationEvent<PaymentCapturedPayload>) {
2016
- return this.appointments.upsertIfNewer(event.payload.appointmentId, stampOf(event), (row) =>
2017
- row === undefined ? undefined : { ...row, paid: true },
2018
- );
2043
+ return this.appointments.updateIfNewer(event.payload.appointmentId, stampOf(event), (row) => ({
2044
+ ...row,
2045
+ paid: true,
2046
+ }));
2019
2047
  }
2020
2048
 
2021
2049
  @On(AppointmentCancelled)
@@ -2042,27 +2070,29 @@ constructeur, et `ddd-ts-kit describe` et la référence de `CONTEXT.md` le list
2042
2070
 
2043
2071
  ### Idempotentes et ordonnées par construction
2044
2072
 
2045
- `ReadModelStore<Row>` est le port d'un modèle de lecture : `get`, `upsertIfNewer`, `delete` et
2073
+ `ReadModelStore<Row>` est le port d'un modèle de lecture : `get`, `upsertIfNewer`, `updateIfNewer`, `delete` et
2046
2074
  `search(scopedCriteria)`. Chaque ligne porte le tampon de l'événement qui l'a modifiée en dernier,
2047
2075
  et une écriture n'a lieu que si son événement est plus récent :
2048
2076
 
2049
2077
  | Règle | |
2050
2078
  |---|---|
2051
2079
  | Tampon | `stampOf(event)` : l'id et l'instant d'un événement d'intégration ; le nom, l'agrégat et l'instant d'un événement du domaine ; plus `stampOf(event, version)` quand l'événement porte une version par clé |
2052
- | Plus récent | une `version` plus grande quand les deux tampons en portent une ; sinon un instant plus tardif ; au même instant, le plus grand id d'événement. Un même événement n'est jamais plus récent que lui-même |
2053
- | `upsertIfNewer(key, stamp, next)` | écrit `next(current)` ; `stale` quand la ligne contient cet événement ou un plus tardif ; `ignored` quand `next` renvoie `undefined` (un correctif d'une ligne qui n'existe pas) |
2054
- | `delete(key, stamp)` | la ligne disparaît pour `get` et `search`, et son tampon reste : un événement plus ancien livré en retard ne la ramène pas, un plus tardif oui |
2055
- | Concurrence | une écriture est conditionnée au tampon qu'elle a lu et est relue quand une autre est arrivée d'abord ; cinq tentatives, puis `ConcurrencyError` et la nouvelle livraison de l'événement |
2080
+ | Plus récent | une `version` plus grande quand les deux tampons en portent une ; sinon un instant plus tardif ; au même instant, le plus grand id d'événement. Un même événement n'est jamais plus récent que lui-même. L'ordre est total parmi des tampons qui portent tous une version, et parmi des tampons qui n'en portent aucune ; entre un de chaque les instants décident, ce qui n'est pas un ordre, si bien qu'une clé devrait n'en voir qu'une sorte ([une seule sorte de tampon par clé](../../docs/concepts/cqrs.fr.md#quelle-écriture-pour-quel-événement)) |
2081
+ | `upsertIfNewer(key, stamp, next)` | pour un événement qui dit toute la ligne, ou peut la créer : écrit `next(current)`, `current` valant `undefined` quand la clé ne tient aucune ligne ; `stale` quand la ligne contient cet événement ou un plus tardif ; `ignored` quand `next` renvoie `undefined`, ce qui est un filtre (l'événement ne concerne pas ce modèle de lecture) et jamais la façon d'attendre une ligne |
2082
+ | `updateIfNewer(key, stamp, change)` | pour un événement qui change une partie d'une ligne qu'un autre événement a créée : écrit `change(current)` ; `stale` quand la ligne, ou la trace de sa suppression, contient cet événement ou un plus tardif ; `missing` quand la clé ne tient aucune ligne, la trace d'une suppression plus ancienne que l'événement, ou une ligne d'un autre locataire : rien n'est écrit, le store ne lève jamais pour cela, et la projection décide. Juste seulement quand les événements de la clé sont appliqués dans l'ordre ([quelle écriture pour quel événement](../../docs/concepts/cqrs.fr.md#quelle-écriture-pour-quel-événement)) |
2083
+ | `delete(key, stamp)` | la ligne disparaît pour `get` et `search`, et une trace reste, sa clé et son tampon sans aucune de ses données : un événement plus ancien livré en retard ne la ramène pas, un plus tardif oui. Une clé que le modèle de lecture ne tient pas prend la même trace et répond `traced`, puisqu'aucune ligne n'a été retirée (comme une suppression par-dessus une trace antérieure), si bien que la création que cette suppression suit est `stale` quand elle est livrée après elle. Sur un stockage SQL, chaque colonne de la ligne accepte NULL, sinon le registre refuse la table par `ReadModelTableNotReadyError` ([ce que laisse une ligne supprimée](../../docs/concepts/cqrs.fr.md#la-table-dun-modèle-de-lecture-et-ce-que-laisse-une-ligne-supprimée)) |
2084
+ | Concurrence | une écriture est conditionnée au tampon entier qu'elle a lu (`sameStamp` : l'id de l'événement, l'instant et la version, dans chaque store) et est relue quand une autre est arrivée d'abord ; cinq tentatives, puis `ConcurrencyError` et la nouvelle livraison de l'événement |
2056
2085
  | Transaction | le store écrit sur l'exécuteur de l'unité de travail, si bien que la ligne et la marque d'événement traité sont validées ou annulées ensemble |
2057
2086
 
2058
2087
  Ainsi une nouvelle livraison, un doublon et deux événements d'une même clé livrés dans le
2059
2088
  désordre aboutissent tous à la même ligne. **Ce que cela ne donne pas** : un événement plus
2060
2089
  ancien écarté comme périmé n'est pas appliqué plus tard, si bien qu'un événement devrait porter
2061
- l'état des champs qu'il pose, ou arriver dans l'ordre par clé (l'outbox ordonne par clé) ; une
2062
- suppression qui atteint une ligne jamais vue ne laisse aucune trace ; avec des instants et sans
2090
+ l'état des champs qu'il pose, ou arriver dans l'ordre par clé (l'outbox ordonne par clé) ; un
2091
+ changement pour lequel `updateIfNewer` a répondu `missing` ou `stale` n'est pas appliqué plus tard
2092
+ non plus ; avec des instants et sans
2063
2093
  version, l'ordre de deux événements d'une même clé est l'ordre des horloges qui les ont
2064
2094
  tamponnés ; une version est comparée à la version que contient la ligne, alors n'en passez une
2065
- que si chaque événement d'une ligne vient du même flux. Une écriture vaut une ligne : un événement
2095
+ que si chaque événement d'une ligne vient du même flux, et alors sur chacun d'eux. Une écriture vaut une ligne : un événement
2066
2096
  qui concerne de nombreuses lignes les liste avec des critères et écrit chacune.
2067
2097
 
2068
2098
  `TableReadModelStore` est l'unique implémentation du port, sur une `ReadModelTable` que donne un
@@ -2070,6 +2100,40 @@ adaptateur (trois instructions et la requête d'un plan) : `InMemoryReadModelSto
2070
2100
  *fakes*, `KnexReadModelStore`, `DrizzleReadModelStore`, `PrismaReadModelStore` et
2071
2101
  `TypeOrmReadModelStore` dans les *packages* d'adaptateurs, tous tenus à `readModelStoreContract`.
2072
2102
 
2103
+ Sur PostgreSQL, la table d'un tel store ne contient la trace d'une ligne supprimée que si chaque
2104
+ colonne que le store associe comme champ de sa ligne accepte NULL. `PostgresTraceColumns` le lit
2105
+ dans la base, pour ces colonnes et aucune autre : celles qui refusent NULL, celles que rien ne peut
2106
+ ouvrir (une partie de la clé primaire, une colonne d'identité ou générée, une colonne d'un domaine
2107
+ qui refuse NULL, une colonne qui n'existe pas), si la table existe, ce que sa contrainte de
2108
+ vérification `<table>_live_rows_whole` garde entier, quelles autres contraintes de vérification
2109
+ nomment une colonne de la ligne, et si c'est une vue. C'est le refus d'un store avant sa première
2110
+ trace, et `tableState()` d'un `TableReadModelStore` rend la même lecture sous la forme d'un
2111
+ `ReadModelTableState`. `ReadModelTables` le demande aux stores qu'une application liste, chaque
2112
+ entrée un nom et ce qui construit le store comme l'application le lie : `hosting(contexts)` garde
2113
+ les entrées des contextes qu'une application héberge et `contexts` nomme ceux que tient la liste ;
2114
+ `states()` et `notReady()` listent, `require()` refuse avec `ReadModelTablesNotReadyError`, `atStart(logger)` est ce
2115
+ qu'appelle une application à son démarrage (`atStart(logger, 'reported')` journalise les tables en
2116
+ une erreur et laisse le démarrage se poursuivre), et `report()` est ce qu'affiche une commande,
2117
+ avec un `outcome` qui distingue une table qui n'est pas prête d'une base qui n'a pas pu être lue.
2118
+ Chaque entrée est essayée : celle dont le store ne peut pas être construit ou dont la base refuse
2119
+ de lire la table est dite sous son nom, dans `unread` de l'erreur, avec sa cause en quelques mots
2120
+ (le message du pilote, jamais l'instruction), et les autres sont lues quand même. Une base
2121
+ injoignable n'est pas un refus de démarrage : `atStart` journalise un seul avertissement avec la
2122
+ cause courte et poursuit, `report()` rend `unread`. Le verdict est celui du store par construction, une table que personne ne liste n'est jamais
2123
+ lue, et un store sans table (mémoire, OpenSearch) n'a rien à dire. Ce que la vérification ne peut
2124
+ pas trancher est un avertissement : une contrainte non validée, une contrainte de ce nom qui n'est
2125
+ pas écrite comme le kit l'écrit (la forme est lue exactement, telle que PostgreSQL l'affiche), une
2126
+ autre vérification sur une colonne de la ligne sauf si elle est écrite pour les seules lignes
2127
+ vivantes (`deleted or ..`), une vue, un store que l'application nomme comme
2128
+ non listé. Un refus nomme la table, ce qui l'empêche de contenir une trace et la migration à
2129
+ écrire, dans `steps` (`statements` tient les deux dans l'ordre) : le changement de définition, une
2130
+ instruction qui ne touche que les colonnes associées, écrit la contrainte `not valid` et ne
2131
+ supprime jamais une contrainte qui n'est pas celle du kit ; puis la validation et le nettoyage des
2132
+ lignes supprimées auparavant, qu'une grande table exécute hors de la transaction de la première
2133
+ étape. Elle peut être exécutée deux fois. Le tout tenu à `readModelTablesContract` sur les quatre
2134
+ ORM : voir
2135
+ [Chaque table vérifiée au démarrage, et avant un déploiement](../../docs/concepts/cqrs.fr.md#chaque-table-vérifiée-au-démarrage-et-avant-un-déploiement).
2136
+
2073
2137
  ### Reconstruction
2074
2138
 
2075
2139
  Un modèle de lecture alimenté par des événements qu'aucun *event store* ne garde se reconstruit à
@@ -2151,9 +2215,9 @@ une telle projection lève au chargement du fichier.
2151
2215
  ### Vue de l'extérieur
2152
2216
 
2153
2217
  Par les ports qui existent. `@ddd-ts-kit/di` compte `projection_events_total` par `context`,
2154
- `projection`, `event` et `result` (`applied`, `stale`, `ignored`, `failed`) sur `Metrics`, et
2218
+ `projection`, `event` et `result` (`applied`, `traced`, `stale`, `ignored`, `missing`, `failed`) sur `Metrics`, et
2155
2219
  pose `projection_last_event_age_ms`, l'âge du dernier événement appliqué au moment où il l'a été :
2156
- le retard. Une projection est abonnée comme consommateur sous son nom, si bien que chaque
2220
+ le retard. `missing` est un changement pour lequel `updateIfNewer` n'a trouvé aucune ligne. Une projection est abonnée comme consommateur sous son nom, si bien que chaque
2157
2221
  livraison est un *span* `process <projection>`, avec les appels à son modèle de lecture en
2158
2222
  dessous, et qu'un événement enterré après ses nouvelles tentatives atteint le rapporteur
2159
2223
  d'erreurs comme pour tout consommateur.
package/README.md CHANGED
@@ -1445,7 +1445,9 @@ reporter)` gives the order that keeps both consistent, each step once:
1445
1445
 
1446
1446
  For a large file the client uploads straight to the storage: `uploadUrl(key, { expiresInSeconds,
1447
1447
  mediaType, accepted, maxBytes })` answers the `link` for the client and the `pending` grant
1448
- (`PendingUpload`: key, size cap, media types) that the command records on the aggregate;
1448
+ (`PendingUpload`: key, size cap, media types, and the `text` rule and `contentRules` given with
1449
+ them) that the command records on the aggregate; it throws when an accepted type has no content
1450
+ rule, since no file of it could be confirmed;
1449
1451
  `confirm(pending)`, called by a command that reads the grant back from the aggregate, never
1450
1452
  from the client, checks what arrived against the cap and on its bytes (`contentMatches`), scans
1451
1453
  it, and answers the `StoredFile`. No final key may start with `staging/` (`assertFinalKey`).
@@ -1456,6 +1458,18 @@ with an expectation holds back the first bytes until they prove the declared med
1456
1458
  archives, text is UTF-8 without control characters, SVG and unknown binary formats never
1457
1459
  match).
1458
1460
 
1461
+ Each media type has a content rule (`contentRuleOf`): a signature (`SIGNED_MEDIA_TYPES`), text
1462
+ (`TEXT_MEDIA_TYPES`), or the one the expectation states in `contentRules` for a type the kit
1463
+ has none for, `text` or `unchecked` (the bytes are taken as they are); a rule stated for a
1464
+ family (`image/*`) never reaches a type a browser runs (`NAMED_ONLY_MEDIA_TYPES`: SVG, HTML,
1465
+ JavaScript), which is stated by its name. `contentRuleDefects`
1466
+ lists, before any content arrives, the accepted types no content could prove and the stated
1467
+ rules that do nothing: `@ddd-ts-kit/http` refuses a route on it, `uploadUrl` a link. The
1468
+ expectation also says the text it takes (`TextRule`): `utf-8`, the default, or `single-byte`,
1469
+ which also passes text in Windows-1252 or ISO-8859-1 (no NUL, no control character, no UTF-16
1470
+ or UTF-32 byte order mark) and still refuses a binary file. The bytes are never decoded by the
1471
+ kit: `isUtf8(bytes)` tells a reader which decoder to take.
1472
+
1459
1473
  Connectors: `InMemoryFileStorage` for the tests (`keys()` lists what it holds) and
1460
1474
  `LocalFileStorage({ directory, baseUrl, secret })` for development, both `ServedFileStorage`:
1461
1475
  their signed links point at the application, which answers them with `signedFileRoutes` of
@@ -1777,7 +1791,8 @@ held to the same table by `criteriaContract` of `@ddd-ts-kit/testing/contracts`.
1777
1791
  | `eq`, `ne`, `in` | by value: two instants of the same time are equal whatever the zone they were written in, `10.5` is `10.50` |
1778
1792
  | `gt`, `gte`, `lt`, `lte` | numbers, decimals and instants by value; strings by Unicode code point, so upper case comes before lower case (`'B' < 'a'`); not on a boolean |
1779
1793
  | `between` | both bounds included |
1780
- | `contains`, `startsWith` | on a string only, case sensitive, the text taken literally: `%`, `_` and `\` are characters. A search that ignores case reads a lower-cased column the projection writes |
1794
+ | `contains`, `startsWith` | on a string only, case sensitive, the text taken literally: `%`, `_` and `\` are characters; an empty text is refused |
1795
+ | `containsIgnoringCase`, `startsWithIgnoringCase` | the same searches with each letter of both sides in lower case, and nothing else folded: an accent is kept (`e` does not find `é`), no letter is rewritten (`ss` does not find `ß`). Every store answers the same for the ASCII letters and for a letter with one upper-case and one lower-case form, each one character long (`É` and `é`, `Ñ` and `ñ`, Greek and Cyrillic included); see below for the others |
1781
1796
  | `isNull` | `true` keeps the rows without a value, `false` those with one; only on a field declared `nullable` |
1782
1797
  | A null | never satisfies a comparison, `ne` included; only `isNull` sees it |
1783
1798
  | Conditions | joined by AND |
@@ -1790,6 +1805,17 @@ held to the same table by `criteriaContract` of `@ddd-ts-kit/testing/contracts`.
1790
1805
  | Cursor page | no `total`; `nextCursor` when another page follows. The cursor holds the sort values of the last row, is checked against the declared types when it comes back, and belongs to one sort |
1791
1806
  | No page | the first page of the default size |
1792
1807
 
1808
+ **A search that ignores case.** `foldCase(text)` is the rule in memory: `toLowerCase()` of
1809
+ JavaScript on both sides. The ORM packages write an `ILIKE` (the `insensitive` mode of Prisma),
1810
+ which PostgreSQL folds with the locale of the database: a database created with the `C` locale
1811
+ folds the ASCII letters alone. OpenSearch gets a regular expression that names both forms of
1812
+ each letter. Outside the letters the table above guarantees, each store follows its own table:
1813
+ the dotted and dotless `I` of Turkish, `ß` and `ẞ`, the final sigma, the ligatures and the
1814
+ Kelvin sign may be found by one store and not by another. A b-tree index serves neither
1815
+ `LIKE '%x%'` nor any `ILIKE`: on PostgreSQL, a GIN index of the `pg_trgm` extension on the
1816
+ column (`gin_trgm_ops`) serves both, for a text of three characters or more. The kit does not
1817
+ create it: it goes in a migration of the project.
1818
+
1793
1819
  Two things follow from where a store keeps its data, and are written in each adapter README.
1794
1820
  **Strings are ordered by the collation of their column**: the reference is the `"C"` collation
1795
1821
  of PostgreSQL, so a text column that is sorted or compared by range is declared `COLLATE "C"`.
@@ -1930,9 +1956,10 @@ export class AppointmentListProjection {
1930
1956
 
1931
1957
  @On(PaymentCaptured)
1932
1958
  paid(event: IntegrationEvent<PaymentCapturedPayload>) {
1933
- return this.appointments.upsertIfNewer(event.payload.appointmentId, stampOf(event), (row) =>
1934
- row === undefined ? undefined : { ...row, paid: true },
1935
- );
1959
+ return this.appointments.updateIfNewer(event.payload.appointmentId, stampOf(event), (row) => ({
1960
+ ...row,
1961
+ paid: true,
1962
+ }));
1936
1963
  }
1937
1964
 
1938
1965
  @On(AppointmentCancelled)
@@ -1959,26 +1986,28 @@ the events it applies.
1959
1986
 
1960
1987
  ### Idempotent and ordered by construction
1961
1988
 
1962
- `ReadModelStore<Row>` is the port of a read model: `get`, `upsertIfNewer`, `delete` and
1989
+ `ReadModelStore<Row>` is the port of a read model: `get`, `upsertIfNewer`, `updateIfNewer`, `delete` and
1963
1990
  `search(scopedCriteria)`. Every row carries the stamp of the event that last changed it, and a
1964
1991
  write happens only if its event is newer:
1965
1992
 
1966
1993
  | Rule | |
1967
1994
  |---|---|
1968
1995
  | Stamp | `stampOf(event)`: the id and the instant of an integration event; the name, the aggregate and the instant of a domain event; plus `stampOf(event, version)` when the event carries a per-key version |
1969
- | Newer | a greater `version` when both stamps carry one; else a later instant; at the same instant, the greater event id. The same event is never newer than itself |
1970
- | `upsertIfNewer(key, stamp, next)` | writes `next(current)`; `stale` when the row holds this event or a later one; `ignored` when `next` answers `undefined` (a patch of a row that does not exist) |
1971
- | `delete(key, stamp)` | the row is gone for `get` and `search`, and its stamp stays: an older event delivered late does not bring it back, a later one does |
1972
- | Concurrency | a write is conditional on the stamp it read and is read again when another got there first; five attempts, then `ConcurrencyError` and the redelivery of the event |
1996
+ | Newer | a greater `version` when both stamps carry one; else a later instant; at the same instant, the greater event id. The same event is never newer than itself. The order is total among stamps that all carry a version, and among stamps that carry none; between one of each the instants decide, which is not an order, so a key should see one kind ([one kind of stamp per key](../../docs/concepts/cqrs.md#which-write-for-which-event)) |
1997
+ | `upsertIfNewer(key, stamp, next)` | for an event that says the whole row, or may create it: writes `next(current)`, `current` being `undefined` when the key holds no row; `stale` when the row holds this event or a later one; `ignored` when `next` answers `undefined`, which is a filter (the event does not concern this read model) and never the way to wait for a row |
1998
+ | `updateIfNewer(key, stamp, change)` | for an event that changes part of a row another event created: writes `change(current)`; `stale` when the row, or the trace of its deletion, holds this event or a later one; `missing` when the key holds no row, the trace of a deletion older than the event, or a row of another tenant: nothing is written, the store never throws for it, and the projection decides. Right only when the events of the key are applied in order ([which write for which event](../../docs/concepts/cqrs.md#which-write-for-which-event)) |
1999
+ | `delete(key, stamp)` | the row is gone for `get` and `search`, and a trace stays, its key and its stamp without any of its data: an older event delivered late does not bring it back, a later one does. A key the read model does not hold takes the same trace and answers `traced`, since no row was removed (as does a deletion over an earlier trace), so the creation this deletion follows is `stale` when it is delivered after it. On an SQL store every column of the row is nullable, or the store refuses the table with `ReadModelTableNotReadyError` ([what a deleted row leaves](../../docs/concepts/cqrs.md#the-table-of-a-read-model-and-what-a-deleted-row-leaves)) |
2000
+ | Concurrency | a write is conditional on the whole stamp it read (`sameStamp`: the event id, the instant and the version, in every store) and is read again when another got there first; five attempts, then `ConcurrencyError` and the redelivery of the event |
1973
2001
  | Transaction | the store writes on the executor of the unit of work, so the row and the processed-event mark of the event commit or roll back together |
1974
2002
 
1975
2003
  So a redelivery, a duplicate and two events of one key delivered out of order all end on the
1976
2004
  same row. **What this does not give**: an older event skipped as stale is not applied later, so
1977
2005
  an event should carry the state of the fields it sets, or come in order per key (the outbox
1978
- orders per key); a deletion that reaches a row never seen leaves no trace; with instants and
2006
+ orders per key); a change `updateIfNewer` answered `missing` or `stale` for is not applied later
2007
+ either; with instants and
1979
2008
  no version, the order of two events of one key is the order of the clocks that stamped them;
1980
2009
  a version is compared with the version the row holds, so pass one only when every event of a
1981
- row comes from the same stream. One write is one row: an event that concerns many rows lists
2010
+ row comes from the same stream, and then on every one of them. One write is one row: an event that concerns many rows lists
1982
2011
  them with a criteria and writes each.
1983
2012
 
1984
2013
  `TableReadModelStore` is the one implementation of the port, over a `ReadModelTable` an
@@ -1986,6 +2015,39 @@ adapter gives (three statements and the query of a plan): `InMemoryReadModelStor
1986
2015
  the fakes, `KnexReadModelStore`, `DrizzleReadModelStore`, `PrismaReadModelStore` and
1987
2016
  `TypeOrmReadModelStore` in the adapter packages, all held to `readModelStoreContract`.
1988
2017
 
2018
+ On PostgreSQL the table of such a store holds the trace of a deleted row only if every column the
2019
+ store maps as a field of its row accepts NULL. `PostgresTraceColumns` reads it from the database,
2020
+ for those columns and no other: which refuse NULL, which nothing can open (a part of the primary
2021
+ key, an identity or a generated column, a column of a domain that refuses NULL, a column that is
2022
+ not there), whether the table exists, what its check constraint `<table>_live_rows_whole` keeps
2023
+ whole, which other check constraints name a column of the row, and whether it is a view. It is
2024
+ the refusal of one store before its first trace, and `tableState()` of a `TableReadModelStore`
2025
+ answers the same reading as a `ReadModelTableState`. `ReadModelTables` asks it of the stores an
2026
+ application lists, each entry a name and what builds the store as the application binds it:
2027
+ `hosting(contexts)` keeps the entries of the contexts an application hosts and `contexts` names
2028
+ those the list holds; `states()` and `notReady()` list, `require()` refuses with
2029
+ `ReadModelTablesNotReadyError`,
2030
+ `atStart(logger)` is what an application calls when it starts (`atStart(logger, 'reported')` logs
2031
+ the tables as one error and lets the start go on), and `report()` is what a command prints, with
2032
+ an `outcome` that tells a table that is not ready from a database that could not be read. Every
2033
+ entry is tried: one whose store cannot be built or whose table the database refuses to read is
2034
+ told under its name, in `unread` of the error, with its cause in a few words (the message of the
2035
+ driver, never the statement), and the others are still read. A database that cannot be reached is
2036
+ no refusal of a start: `atStart` logs one warning with the short cause and goes on, `report()`
2037
+ answers `unread`. The verdict is the
2038
+ store's by construction, a table nobody lists is never read, and a store without a table (memory,
2039
+ OpenSearch) has nothing to say. What the check cannot decide is a warning: a constraint that is
2040
+ not validated, a constraint of that name that is not written as the kit writes it (the form is
2041
+ read exactly, as PostgreSQL prints it), another check on a column of the row unless it is written for the live rows only (`deleted or
2042
+ ..`), a view, a store the
2043
+ application names as not listed. A refusal names the table, what keeps it from holding a trace
2044
+ and the migration to write, in `steps` (`statements` holds both in order): the change of
2045
+ definition, one statement that touches the mapped columns alone, writes the constraint `not valid`
2046
+ and never drops a constraint that is not the kit's; then the validation and the cleaning of the
2047
+ rows deleted before, which a large table runs outside the transaction of the first step. It can
2048
+ be run twice. All held to `readModelTablesContract` on the four ORM: see
2049
+ [Every table checked at the start, and before a deployment](../../docs/concepts/cqrs.md#every-table-checked-at-the-start-and-before-a-deployment).
2050
+
1989
2051
  ### Rebuild
1990
2052
 
1991
2053
  A read model fed by events that no event store keeps is rebuilt from the source of truth, the
@@ -2063,8 +2125,9 @@ throws when the file loads.
2063
2125
  ### Seen from outside
2064
2126
 
2065
2127
  Through the ports that exist. `@ddd-ts-kit/di` counts `projection_events_total` by `context`,
2066
- `projection`, `event` and `result` (`applied`, `stale`, `ignored`, `failed`) on `Metrics`, and
2128
+ `projection`, `event` and `result` (`applied`, `traced`, `stale`, `ignored`, `missing`, `failed`) on `Metrics`, and
2067
2129
  sets `projection_last_event_age_ms`, the age of the last event applied when it was: the lag.
2130
+ `missing` is a change `updateIfNewer` found no row for.
2068
2131
  A projection is subscribed as a consumer under its name, so each delivery is one `process
2069
2132
  <projection>` span, with the calls to its read model below it, and an event buried after its
2070
2133
  retries reaches the error reporter as for any consumer.
@@ -1,2 +1,2 @@
1
- export type FilterOperator = 'eq' | 'ne' | 'in' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'startsWith' | 'isNull' | 'between';
1
+ export type FilterOperator = 'eq' | 'ne' | 'in' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'startsWith' | 'containsIgnoringCase' | 'startsWithIgnoringCase' | 'isNull' | 'between';
2
2
  //# sourceMappingURL=filter-operator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-operator.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/filter-operator.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,UAAU,GACV,YAAY,GACZ,QAAQ,GACR,SAAS,CAAC"}
1
+ {"version":3,"file":"filter-operator.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/filter-operator.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,UAAU,GACV,YAAY,GACZ,sBAAsB,GACtB,wBAAwB,GACxB,QAAQ,GACR,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"filter-violations.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/filter-violations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAyB,MAAM,sBAAsB,CAAC;AAErF,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,eAAe,CAAC;AAGjE,wBAAgB,gBAAgB,CAAC,GAAG,EAClC,UAAU,EAAE,kBAAkB,CAAC,GAAG,CAAC,EACnC,OAAO,EAAE,SAAS,UAAU,EAAE,GAC7B,iBAAiB,EAAE,CASrB"}
1
+ {"version":3,"file":"filter-violations.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/filter-violations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAyB,MAAM,sBAAsB,CAAC;AAErF,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,eAAe,CAAC;AAIjE,wBAAgB,gBAAgB,CAAC,GAAG,EAClC,UAAU,EAAE,kBAAkB,CAAC,GAAG,CAAC,EACnC,OAAO,EAAE,SAAS,UAAU,EAAE,GAC7B,iBAAiB,EAAE,CASrB"}
@@ -1,3 +1,4 @@
1
+ import { isTextSearch } from './is-text-search.js';
1
2
  import { isValueOf } from './is-value-of.js';
2
3
  export function filterViolations(definition, filters) {
3
4
  const { maxFilters } = definition.limits;
@@ -43,12 +44,12 @@ function operandDefect(declared, { operator, value }, maxInList) {
43
44
  return operandFits(operator, value, fits) ? undefined : 'invalid_value';
44
45
  }
45
46
  function operandFits(operator, value, fits) {
47
+ if (isTextSearch(operator)) {
48
+ return typeof value === 'string' && value !== '';
49
+ }
46
50
  switch (operator) {
47
51
  case 'isNull':
48
52
  return typeof value === 'boolean';
49
- case 'contains':
50
- case 'startsWith':
51
- return typeof value === 'string' && value !== '';
52
53
  case 'between':
53
54
  return Array.isArray(value) && value.length === 2 && value.every(fits);
54
55
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"filter-violations.js","sourceRoot":"","sources":["../../../src/application/criteria/filter-violations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,UAAU,gBAAgB,CAC9B,UAAmC,EACnC,OAA8B;IAE9B,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;IACzC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAElF,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,UAAU,EAAE,CAAC;QACvC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,kBAAkB,EAAE,gBAAgB,MAAM,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACrH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAA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OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzE;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CACjB,KAAc,EACd,IAAmC,EACnC,SAAiB;IAEjB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC;AAED,SAAS,SAAS,CAAM,IAA2B,EAAE,UAAmC;IACtF,OAAO,IAAI,KAAK,kBAAkB;QAChC,CAAC,CAAC,gBAAgB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB;QACvE,CAAC,CAAC,gEAAgE,CAAC;AACvE,CAAC;AAED,SAAS,YAAY,CAAC,OAA8B;IAClD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,IAA2B,EAAE,OAAe;IAC3E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"filter-violations.js","sourceRoot":"","sources":["../../../src/application/criteria/filter-violations.ts"],"names":[],"mappings":"AAIA,OAAO,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AAgB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB;QACvE,CAAC,CAAC,gEAAgE,CAAC;AACvE,CAAC;AAED,SAAS,YAAY,CAAC,OAA8B;IAClD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,IAA2B,EAAE,OAAe;IAC3E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { TextSearch } from './text-search.js';
2
+ /** Whether a text search finds `part` in `text`: the reference every translator is held to. */
3
+ export declare function findsText(operator: TextSearch, text: string, part: string): boolean;
4
+ //# sourceMappingURL=finds-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finds-text.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/finds-text.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAShD,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnF"}
@@ -0,0 +1,12 @@
1
+ import { foldCase } from './fold-case.js';
2
+ const FINDS = {
3
+ contains: (text, part) => text.includes(part),
4
+ startsWith: (text, part) => text.startsWith(part),
5
+ containsIgnoringCase: (text, part) => foldCase(text).includes(foldCase(part)),
6
+ startsWithIgnoringCase: (text, part) => foldCase(text).startsWith(foldCase(part)),
7
+ };
8
+ /** Whether a text search finds `part` in `text`: the reference every translator is held to. */
9
+ export function findsText(operator, text, part) {
10
+ return FINDS[operator](text, part);
11
+ }
12
+ //# sourceMappingURL=finds-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finds-text.js","sourceRoot":"","sources":["../../../src/application/criteria/finds-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,KAAK,GAA0E;IACnF,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC7C,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IACjD,oBAAoB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7E,sBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;CAClF,CAAC;AAEF,+FAA+F;AAC/F,MAAM,UAAU,SAAS,CAAC,QAAoB,EAAE,IAAY,EAAE,IAAY;IACxE,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A text as `containsIgnoringCase` and `startsWithIgnoringCase` compare it: each letter in lower
3
+ * case, and nothing else. An accent is kept (`e` does not find `é`) and no letter is rewritten
4
+ * (`ss` does not find `ß`).
5
+ *
6
+ * Every store answers the same for the ASCII letters and for the letters that have exactly one
7
+ * upper-case and one lower-case form, each one character long (`É` and `é`, `Ñ` and `ñ`, `Ø` and
8
+ * `ø`, Greek and Cyrillic included). Outside them each store follows its own table: the dotted
9
+ * and dotless `I` of Turkish, `ß` and `ẞ`, the final sigma, the ligatures and the Kelvin sign.
10
+ * PostgreSQL folds with the locale of the database, and a database created with the `C` locale
11
+ * folds the ASCII letters alone.
12
+ */
13
+ export declare function foldCase(text: string): string;
14
+ //# sourceMappingURL=fold-case.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fold-case.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/fold-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * A text as `containsIgnoringCase` and `startsWithIgnoringCase` compare it: each letter in lower
3
+ * case, and nothing else. An accent is kept (`e` does not find `é`) and no letter is rewritten
4
+ * (`ss` does not find `ß`).
5
+ *
6
+ * Every store answers the same for the ASCII letters and for the letters that have exactly one
7
+ * upper-case and one lower-case form, each one character long (`É` and `é`, `Ñ` and `ñ`, `Ø` and
8
+ * `ø`, Greek and Cyrillic included). Outside them each store follows its own table: the dotted
9
+ * and dotless `I` of Turkish, `ß` and `ẞ`, the final sigma, the ligatures and the Kelvin sign.
10
+ * PostgreSQL folds with the locale of the database, and a database created with the `C` locale
11
+ * folds the ASCII letters alone.
12
+ */
13
+ export function foldCase(text) {
14
+ return text.toLowerCase();
15
+ }
16
+ //# sourceMappingURL=fold-case.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fold-case.js","sourceRoot":"","sources":["../../../src/application/criteria/fold-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"holds.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/holds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,aAAa,CAAC;AAE5D,KAAK,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzD,sFAAsF;AACtF,wBAAgB,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAY5F"}
1
+ {"version":3,"file":"holds.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/holds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,aAAa,CAAC;AAE5D,KAAK,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEzD,sFAAsF;AACtF,wBAAgB,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAY5F"}
@@ -1,4 +1,6 @@
1
1
  import { compareValues } from './compare-values.js';
2
+ import { findsText } from './finds-text.js';
3
+ import { isTextSearch } from './is-text-search.js';
2
4
  /** Whether a row satisfies a predicate: the reference every translator is held to. */
3
5
  export function holds(predicate, row, fields) {
4
6
  if (predicate === undefined) {
@@ -25,6 +27,9 @@ function compares({ operator, value: operand }, value, type) {
25
27
  const order = (other) => compareValues(type, value, other);
26
28
  const operands = Array.isArray(operand) ? operand : [operand];
27
29
  const [first, second] = operands;
30
+ if (isTextSearch(operator)) {
31
+ return findsText(operator, String(value), String(first));
32
+ }
28
33
  switch (operator) {
29
34
  case 'eq':
30
35
  return order(first) === 0;
@@ -34,10 +39,6 @@ function compares({ operator, value: operand }, value, type) {
34
39
  return operands.some((candidate) => order(candidate) === 0);
35
40
  case 'between':
36
41
  return order(first) >= 0 && order(second) <= 0;
37
- case 'contains':
38
- return String(value).includes(String(first));
39
- case 'startsWith':
40
- return String(value).startsWith(String(first));
41
42
  default:
42
43
  return ordered(operator, order(first));
43
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"holds.js","sourceRoot":"","sources":["../../../src/application/criteria/holds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOjD,sFAAsF;AACtF,MAAM,UAAU,KAAK,CAAC,SAAgC,EAAE,GAAW,EAAE,MAAc;IACjF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,QAAQ,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,SAAS,CAAC,IAAI,KAAK,KAAK;QAC7B,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QAC3D,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,MAAM,CAAC,IAAmB,EAAE,GAAW,EAAE,IAAe;IAC/D,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IAE5D,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,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K,CAAC,KAAK,CAAC,CAAC;QAC5B,KAAK,IAAI;YACP,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjD;YACE,OAAO,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,QAAgD,EAAE,KAAa;IAC9E,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,IAAI;YACP,OAAO,KAAK,GAAG,CAAC,CAAC;QACnB,KAAK,KAAK;YACR,OAAO,KAAK,IAAI,CAAC,CAAC;QACpB,KAAK,IAAI;YACP,OAAO,KAAK,GAAG,CAAC,CAAC;QACnB;YACE,OAAO,KAAK,IAAI,CAAC,CAAC;IACtB,CAAC;AACH,CAAC"}
@@ -1,4 +1,7 @@
1
1
  export * from './filter-operator.js';
2
+ export * from './fold-case.js';
3
+ export * from './text-search.js';
4
+ export * from './is-text-search.js';
2
5
  export * from './field-value.js';
3
6
  export * from './field-of.js';
4
7
  export * from './operator-of.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;A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AAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -1,4 +1,7 @@
1
1
  export * from './filter-operator.js';
2
+ export * from './fold-case.js';
3
+ export * from './text-search.js';
4
+ export * from './is-text-search.js';
2
5
  export * from './field-value.js';
3
6
  export * from './field-of.js';
4
7
  export * from './operator-of.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/application/criteria/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/application/criteria/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { FilterOperator } from './filter-operator.js';
2
+ import type { TextSearch } from './text-search.js';
3
+ /** Whether an operator searches a text in a string: its operand is then a text, never empty. */
4
+ export declare function isTextSearch(operator: FilterOperator): operator is TextSearch;
5
+ //# sourceMappingURL=is-text-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-text-search.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/is-text-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAShD,gGAAgG;AAChG,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,IAAI,UAAU,CAE7E"}
@@ -0,0 +1,11 @@
1
+ const TEXT_SEARCHES = [
2
+ 'contains',
3
+ 'startsWith',
4
+ 'containsIgnoringCase',
5
+ 'startsWithIgnoringCase',
6
+ ];
7
+ /** Whether an operator searches a text in a string: its operand is then a text, never empty. */
8
+ export function isTextSearch(operator) {
9
+ return TEXT_SEARCHES.includes(operator);
10
+ }
11
+ //# sourceMappingURL=is-text-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-text-search.js","sourceRoot":"","sources":["../../../src/application/criteria/is-text-search.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAA8B;IAC/C,UAAU;IACV,YAAY;IACZ,sBAAsB;IACtB,wBAAwB;CACO,CAAC;AAElC,gGAAgG;AAChG,MAAM,UAAU,YAAY,CAAC,QAAwB;IACnD,OAAO,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { FilterOperator } from './filter-operator.js';
2
+ import type { TextSearch } from './text-search.js';
2
3
  /** What an operator compares a field holding `Value` with. */
3
- export type OperandOf<Value, Operator extends FilterOperator> = Operator extends 'in' ? readonly NonNullable<Value>[] : Operator extends 'between' ? readonly [from: NonNullable<Value>, to: NonNullable<Value>] : Operator extends 'isNull' ? boolean : Operator extends 'contains' | 'startsWith' ? string : NonNullable<Value>;
4
+ export type OperandOf<Value, Operator extends FilterOperator> = Operator extends 'in' ? readonly NonNullable<Value>[] : Operator extends 'between' ? readonly [from: NonNullable<Value>, to: NonNullable<Value>] : Operator extends 'isNull' ? boolean : Operator extends TextSearch ? string : NonNullable<Value>;
4
5
  //# sourceMappingURL=operand-of.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operand-of.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/operand-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,8DAA8D;AAC9D,MAAM,MAAM,SAAS,CAAC,KAAK,EAAE,QAAQ,SAAS,cAAc,IAAI,QAAQ,SAAS,IAAI,GACjF,SAAS,WAAW,CAAC,KAAK,CAAC,EAAE,GAC7B,QAAQ,SAAS,SAAS,GACxB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,GAC3D,QAAQ,SAAS,QAAQ,GACvB,OAAO,GACP,QAAQ,SAAS,UAAU,GAAG,YAAY,GACxC,MAAM,GACN,WAAW,CAAC,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"operand-of.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/operand-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,MAAM,SAAS,CAAC,KAAK,EAAE,QAAQ,SAAS,cAAc,IAAI,QAAQ,SAAS,IAAI,GACjF,SAAS,WAAW,CAAC,KAAK,CAAC,EAAE,GAC7B,QAAQ,SAAS,SAAS,GACxB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,GAC3D,QAAQ,SAAS,QAAQ,GACvB,OAAO,GACP,QAAQ,SAAS,UAAU,GACzB,MAAM,GACN,WAAW,CAAC,KAAK,CAAC,CAAC"}