@ddd-ts-kit/kernel 0.110.0 → 0.111.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.
- package/README.fr.md +30 -15
- package/README.md +28 -12
- package/dist/application/criteria/filter-operator.d.ts +1 -1
- package/dist/application/criteria/filter-operator.d.ts.map +1 -1
- package/dist/application/criteria/filter-violations.d.ts.map +1 -1
- package/dist/application/criteria/filter-violations.js +4 -3
- package/dist/application/criteria/filter-violations.js.map +1 -1
- package/dist/application/criteria/finds-text.d.ts +4 -0
- package/dist/application/criteria/finds-text.d.ts.map +1 -0
- package/dist/application/criteria/finds-text.js +12 -0
- package/dist/application/criteria/finds-text.js.map +1 -0
- package/dist/application/criteria/fold-case.d.ts +14 -0
- package/dist/application/criteria/fold-case.d.ts.map +1 -0
- package/dist/application/criteria/fold-case.js +16 -0
- package/dist/application/criteria/fold-case.js.map +1 -0
- package/dist/application/criteria/holds.d.ts.map +1 -1
- package/dist/application/criteria/holds.js +5 -4
- package/dist/application/criteria/holds.js.map +1 -1
- package/dist/application/criteria/index.d.ts +3 -0
- package/dist/application/criteria/index.d.ts.map +1 -1
- package/dist/application/criteria/index.js +3 -0
- package/dist/application/criteria/index.js.map +1 -1
- package/dist/application/criteria/is-text-search.d.ts +5 -0
- package/dist/application/criteria/is-text-search.d.ts.map +1 -0
- package/dist/application/criteria/is-text-search.js +11 -0
- package/dist/application/criteria/is-text-search.js.map +1 -0
- package/dist/application/criteria/operand-of.d.ts +2 -1
- package/dist/application/criteria/operand-of.d.ts.map +1 -1
- package/dist/application/criteria/operator-of.d.ts +2 -1
- package/dist/application/criteria/operator-of.d.ts.map +1 -1
- package/dist/application/criteria/operators-of-type.js +1 -1
- package/dist/application/criteria/operators-of-type.js.map +1 -1
- package/dist/application/criteria/text-search.d.ts +3 -0
- package/dist/application/criteria/text-search.d.ts.map +1 -0
- package/dist/application/criteria/text-search.js +2 -0
- package/dist/application/criteria/text-search.js.map +1 -0
- package/dist/application/persistence/advisory-lock-options.d.ts +10 -0
- package/dist/application/persistence/advisory-lock-options.d.ts.map +1 -0
- package/dist/application/persistence/advisory-lock-options.js +2 -0
- package/dist/application/persistence/advisory-lock-options.js.map +1 -0
- package/dist/application/ports/read-model-rows.d.ts +8 -2
- package/dist/application/ports/read-model-rows.d.ts.map +1 -1
- package/dist/application/ports/read-model-rows.js.map +1 -1
- package/dist/application/ports/read-model-store.d.ts +29 -3
- package/dist/application/ports/read-model-store.d.ts.map +1 -1
- package/dist/application/ports/read-model-store.js +8 -1
- package/dist/application/ports/read-model-store.js.map +1 -1
- package/dist/application/read-model/event-stamp.d.ts +4 -2
- package/dist/application/read-model/event-stamp.d.ts.map +1 -1
- package/dist/application/read-model/is-newer.d.ts +8 -1
- package/dist/application/read-model/is-newer.d.ts.map +1 -1
- package/dist/application/read-model/is-newer.js +8 -1
- package/dist/application/read-model/is-newer.js.map +1 -1
- package/dist/application/read-model/read-model-write.d.ts +9 -4
- package/dist/application/read-model/read-model-write.d.ts.map +1 -1
- package/dist/application/read-model/same-stamp.d.ts +8 -0
- package/dist/application/read-model/same-stamp.d.ts.map +1 -0
- package/dist/application/read-model/same-stamp.js +11 -0
- package/dist/application/read-model/same-stamp.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts +2 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts.map +1 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.js +2 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-read-model-table.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-read-model-table.js +2 -6
- package/dist/infrastructure/in-memory/in-memory-read-model-table.js.map +1 -1
- package/dist/infrastructure/persistence/advisory-lock-key.d.ts +16 -0
- package/dist/infrastructure/persistence/advisory-lock-key.d.ts.map +1 -0
- package/dist/infrastructure/persistence/advisory-lock-key.js +18 -0
- package/dist/infrastructure/persistence/advisory-lock-key.js.map +1 -0
- package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.d.ts +9 -0
- package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.d.ts.map +1 -0
- package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.js +12 -0
- package/dist/infrastructure/persistence/advisory-lock-outside-unit-of-work-error.js.map +1 -0
- package/dist/infrastructure/read-model/postgres-trace-columns.d.ts +24 -0
- package/dist/infrastructure/read-model/postgres-trace-columns.d.ts.map +1 -0
- package/dist/infrastructure/read-model/postgres-trace-columns.js +37 -0
- package/dist/infrastructure/read-model/postgres-trace-columns.js.map +1 -0
- package/dist/infrastructure/read-model/projection-rebuild.d.ts +4 -1
- package/dist/infrastructure/read-model/projection-rebuild.d.ts.map +1 -1
- package/dist/infrastructure/read-model/projection-rebuild.js +4 -1
- package/dist/infrastructure/read-model/projection-rebuild.js.map +1 -1
- package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.d.ts +12 -0
- package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.js +16 -0
- package/dist/infrastructure/read-model/read-model-key-held-elsewhere-error.js.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-not-ready-error.d.ts +12 -0
- package/dist/infrastructure/read-model/read-model-table-not-ready-error.d.ts.map +1 -0
- package/dist/infrastructure/read-model/read-model-table-not-ready-error.js +19 -0
- package/dist/infrastructure/read-model/read-model-table-not-ready-error.js.map +1 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.d.ts +1 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.d.ts.map +1 -1
- package/dist/infrastructure/read-model/shadow-read-model-store.js +3 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.js.map +1 -1
- package/dist/infrastructure/read-model/table-read-model-store.d.ts +1 -0
- package/dist/infrastructure/read-model/table-read-model-store.d.ts.map +1 -1
- package/dist/infrastructure/read-model/table-read-model-store.js +3 -0
- package/dist/infrastructure/read-model/table-read-model-store.js.map +1 -1
- package/dist/infrastructure/read-model/write-if-newer.d.ts +14 -2
- package/dist/infrastructure/read-model/write-if-newer.d.ts.map +1 -1
- package/dist/infrastructure/read-model/write-if-newer.js +35 -5
- package/dist/infrastructure/read-model/write-if-newer.js.map +1 -1
- 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:
|
|
2
|
+
<!-- translation-of: README.md sha256:849d095a5138f5c4 -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/kernel
|
|
5
5
|
|
|
@@ -1853,7 +1853,8 @@ store est tenu au même tableau par `criteriaContract` de `@ddd-ts-kit/testing/c
|
|
|
1853
1853
|
| `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
1854
|
| `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
1855
|
| `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
|
|
1856
|
+
| `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é |
|
|
1857
|
+
| `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
1858
|
| `isNull` | `true` garde les lignes sans valeur, `false` celles qui en ont une ; seulement sur un champ déclaré `nullable` |
|
|
1858
1859
|
| Un nul | ne satisfait jamais une comparaison, `ne` compris ; seul `isNull` le voit |
|
|
1859
1860
|
| Conditions | jointes par ET |
|
|
@@ -1866,6 +1867,17 @@ store est tenu au même tableau par `criteriaContract` de `@ddd-ts-kit/testing/c
|
|
|
1866
1867
|
| 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
1868
|
| Pas de page | la première page de la taille par défaut |
|
|
1868
1869
|
|
|
1870
|
+
**Une recherche qui ignore la casse.** `foldCase(text)` est la règle en mémoire : le
|
|
1871
|
+
`toLowerCase()` de JavaScript des deux côtés. Les *packages* d'ORM écrivent un `ILIKE` (le mode
|
|
1872
|
+
`insensitive` de Prisma), que PostgreSQL replie avec la locale de la base : une base créée avec
|
|
1873
|
+
la locale `C` ne replie que les lettres ASCII. OpenSearch reçoit une expression régulière qui
|
|
1874
|
+
nomme les deux formes de chaque lettre. Hors des lettres que le tableau garantit, chaque
|
|
1875
|
+
stockage suit sa propre table : le `I` avec et sans point du turc, `ß` et `ẞ`, le sigma final,
|
|
1876
|
+
les ligatures et le signe Kelvin peuvent être trouvés par un stockage et pas par un autre. Un
|
|
1877
|
+
index b-tree ne sert ni `LIKE '%x%'` ni aucun `ILIKE` : sur PostgreSQL, un index GIN de
|
|
1878
|
+
l'extension `pg_trgm` sur la colonne (`gin_trgm_ops`) sert les deux, pour un texte de trois
|
|
1879
|
+
caractères ou plus. Le kit ne le crée pas : il va dans une migration du projet.
|
|
1880
|
+
|
|
1869
1881
|
Deux conséquences découlent de l'endroit où un store garde ses données, et sont écrites dans le
|
|
1870
1882
|
README de chaque adaptateur. **Les chaînes sont ordonnées par la collation de leur colonne** : la
|
|
1871
1883
|
référence est la collation `"C"` de PostgreSQL, si bien qu'une colonne de texte triée ou comparée
|
|
@@ -2013,9 +2025,10 @@ export class AppointmentListProjection {
|
|
|
2013
2025
|
|
|
2014
2026
|
@On(PaymentCaptured)
|
|
2015
2027
|
paid(event: IntegrationEvent<PaymentCapturedPayload>) {
|
|
2016
|
-
return this.appointments.
|
|
2017
|
-
|
|
2018
|
-
|
|
2028
|
+
return this.appointments.updateIfNewer(event.payload.appointmentId, stampOf(event), (row) => ({
|
|
2029
|
+
...row,
|
|
2030
|
+
paid: true,
|
|
2031
|
+
}));
|
|
2019
2032
|
}
|
|
2020
2033
|
|
|
2021
2034
|
@On(AppointmentCancelled)
|
|
@@ -2042,27 +2055,29 @@ constructeur, et `ddd-ts-kit describe` et la référence de `CONTEXT.md` le list
|
|
|
2042
2055
|
|
|
2043
2056
|
### Idempotentes et ordonnées par construction
|
|
2044
2057
|
|
|
2045
|
-
`ReadModelStore<Row>` est le port d'un modèle de lecture : `get`, `upsertIfNewer`, `delete` et
|
|
2058
|
+
`ReadModelStore<Row>` est le port d'un modèle de lecture : `get`, `upsertIfNewer`, `updateIfNewer`, `delete` et
|
|
2046
2059
|
`search(scopedCriteria)`. Chaque ligne porte le tampon de l'événement qui l'a modifiée en dernier,
|
|
2047
2060
|
et une écriture n'a lieu que si son événement est plus récent :
|
|
2048
2061
|
|
|
2049
2062
|
| Règle | |
|
|
2050
2063
|
|---|---|
|
|
2051
2064
|
| 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
|
|
2054
|
-
| `
|
|
2055
|
-
|
|
|
2065
|
+
| 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)) |
|
|
2066
|
+
| `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 |
|
|
2067
|
+
| `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)) |
|
|
2068
|
+
| `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)) |
|
|
2069
|
+
| 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
2070
|
| 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
2071
|
|
|
2058
2072
|
Ainsi une nouvelle livraison, un doublon et deux événements d'une même clé livrés dans le
|
|
2059
2073
|
désordre aboutissent tous à la même ligne. **Ce que cela ne donne pas** : un événement plus
|
|
2060
2074
|
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é) ;
|
|
2062
|
-
|
|
2075
|
+
l'état des champs qu'il pose, ou arriver dans l'ordre par clé (l'outbox ordonne par clé) ; un
|
|
2076
|
+
changement pour lequel `updateIfNewer` a répondu `missing` ou `stale` n'est pas appliqué plus tard
|
|
2077
|
+
non plus ; avec des instants et sans
|
|
2063
2078
|
version, l'ordre de deux événements d'une même clé est l'ordre des horloges qui les ont
|
|
2064
2079
|
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
|
|
2080
|
+
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
2081
|
qui concerne de nombreuses lignes les liste avec des critères et écrit chacune.
|
|
2067
2082
|
|
|
2068
2083
|
`TableReadModelStore` est l'unique implémentation du port, sur une `ReadModelTable` que donne un
|
|
@@ -2151,9 +2166,9 @@ une telle projection lève au chargement du fichier.
|
|
|
2151
2166
|
### Vue de l'extérieur
|
|
2152
2167
|
|
|
2153
2168
|
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
|
|
2169
|
+
`projection`, `event` et `result` (`applied`, `traced`, `stale`, `ignored`, `missing`, `failed`) sur `Metrics`, et
|
|
2155
2170
|
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
|
|
2171
|
+
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
2172
|
livraison est un *span* `process <projection>`, avec les appels à son modèle de lecture en
|
|
2158
2173
|
dessous, et qu'un événement enterré après ses nouvelles tentatives atteint le rapporteur
|
|
2159
2174
|
d'erreurs comme pour tout consommateur.
|
package/README.md
CHANGED
|
@@ -1777,7 +1777,8 @@ held to the same table by `criteriaContract` of `@ddd-ts-kit/testing/contracts`.
|
|
|
1777
1777
|
| `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
1778
|
| `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
1779
|
| `between` | both bounds included |
|
|
1780
|
-
| `contains`, `startsWith` | on a string only, case sensitive, the text taken literally: `%`, `_` and `\` are characters
|
|
1780
|
+
| `contains`, `startsWith` | on a string only, case sensitive, the text taken literally: `%`, `_` and `\` are characters; an empty text is refused |
|
|
1781
|
+
| `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
1782
|
| `isNull` | `true` keeps the rows without a value, `false` those with one; only on a field declared `nullable` |
|
|
1782
1783
|
| A null | never satisfies a comparison, `ne` included; only `isNull` sees it |
|
|
1783
1784
|
| Conditions | joined by AND |
|
|
@@ -1790,6 +1791,17 @@ held to the same table by `criteriaContract` of `@ddd-ts-kit/testing/contracts`.
|
|
|
1790
1791
|
| 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
1792
|
| No page | the first page of the default size |
|
|
1792
1793
|
|
|
1794
|
+
**A search that ignores case.** `foldCase(text)` is the rule in memory: `toLowerCase()` of
|
|
1795
|
+
JavaScript on both sides. The ORM packages write an `ILIKE` (the `insensitive` mode of Prisma),
|
|
1796
|
+
which PostgreSQL folds with the locale of the database: a database created with the `C` locale
|
|
1797
|
+
folds the ASCII letters alone. OpenSearch gets a regular expression that names both forms of
|
|
1798
|
+
each letter. Outside the letters the table above guarantees, each store follows its own table:
|
|
1799
|
+
the dotted and dotless `I` of Turkish, `ß` and `ẞ`, the final sigma, the ligatures and the
|
|
1800
|
+
Kelvin sign may be found by one store and not by another. A b-tree index serves neither
|
|
1801
|
+
`LIKE '%x%'` nor any `ILIKE`: on PostgreSQL, a GIN index of the `pg_trgm` extension on the
|
|
1802
|
+
column (`gin_trgm_ops`) serves both, for a text of three characters or more. The kit does not
|
|
1803
|
+
create it: it goes in a migration of the project.
|
|
1804
|
+
|
|
1793
1805
|
Two things follow from where a store keeps its data, and are written in each adapter README.
|
|
1794
1806
|
**Strings are ordered by the collation of their column**: the reference is the `"C"` collation
|
|
1795
1807
|
of PostgreSQL, so a text column that is sorted or compared by range is declared `COLLATE "C"`.
|
|
@@ -1930,9 +1942,10 @@ export class AppointmentListProjection {
|
|
|
1930
1942
|
|
|
1931
1943
|
@On(PaymentCaptured)
|
|
1932
1944
|
paid(event: IntegrationEvent<PaymentCapturedPayload>) {
|
|
1933
|
-
return this.appointments.
|
|
1934
|
-
|
|
1935
|
-
|
|
1945
|
+
return this.appointments.updateIfNewer(event.payload.appointmentId, stampOf(event), (row) => ({
|
|
1946
|
+
...row,
|
|
1947
|
+
paid: true,
|
|
1948
|
+
}));
|
|
1936
1949
|
}
|
|
1937
1950
|
|
|
1938
1951
|
@On(AppointmentCancelled)
|
|
@@ -1959,26 +1972,28 @@ the events it applies.
|
|
|
1959
1972
|
|
|
1960
1973
|
### Idempotent and ordered by construction
|
|
1961
1974
|
|
|
1962
|
-
`ReadModelStore<Row>` is the port of a read model: `get`, `upsertIfNewer`, `delete` and
|
|
1975
|
+
`ReadModelStore<Row>` is the port of a read model: `get`, `upsertIfNewer`, `updateIfNewer`, `delete` and
|
|
1963
1976
|
`search(scopedCriteria)`. Every row carries the stamp of the event that last changed it, and a
|
|
1964
1977
|
write happens only if its event is newer:
|
|
1965
1978
|
|
|
1966
1979
|
| Rule | |
|
|
1967
1980
|
|---|---|
|
|
1968
1981
|
| 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)
|
|
1971
|
-
| `
|
|
1972
|
-
|
|
|
1982
|
+
| 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)) |
|
|
1983
|
+
| `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 |
|
|
1984
|
+
| `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)) |
|
|
1985
|
+
| `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)) |
|
|
1986
|
+
| 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
1987
|
| 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
1988
|
|
|
1975
1989
|
So a redelivery, a duplicate and two events of one key delivered out of order all end on the
|
|
1976
1990
|
same row. **What this does not give**: an older event skipped as stale is not applied later, so
|
|
1977
1991
|
an event should carry the state of the fields it sets, or come in order per key (the outbox
|
|
1978
|
-
orders per key); a
|
|
1992
|
+
orders per key); a change `updateIfNewer` answered `missing` or `stale` for is not applied later
|
|
1993
|
+
either; with instants and
|
|
1979
1994
|
no version, the order of two events of one key is the order of the clocks that stamped them;
|
|
1980
1995
|
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
|
|
1996
|
+
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
1997
|
them with a criteria and writes each.
|
|
1983
1998
|
|
|
1984
1999
|
`TableReadModelStore` is the one implementation of the port, over a `ReadModelTable` an
|
|
@@ -2063,8 +2078,9 @@ throws when the file loads.
|
|
|
2063
2078
|
### Seen from outside
|
|
2064
2079
|
|
|
2065
2080
|
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
|
|
2081
|
+
`projection`, `event` and `result` (`applied`, `traced`, `stale`, `ignored`, `missing`, `failed`) on `Metrics`, and
|
|
2067
2082
|
sets `projection_last_event_age_ms`, the age of the last event applied when it was: the lag.
|
|
2083
|
+
`missing` is a change `updateIfNewer` found no row for.
|
|
2068
2084
|
A projection is subscribed as a consumer under its name, so each delivery is one `process
|
|
2069
2085
|
<projection>` span, with the calls to its read model below it, and an event buried after its
|
|
2070
2086
|
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;
|
|
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,SAAS,cAAc,CACrB,UAAmC,EACnC,IAAgB,EAChB,KAAa;IAEb,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;IAEvC,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC9B,OAAO,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;QACrB,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,eAAe,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC5F,CA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@
|
|
|
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;
|
|
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":[],"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;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","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"}
|
|
@@ -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;AAC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AAqB,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
|
|
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;
|
|
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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { TextSearch } from './text-search.js';
|
|
1
2
|
/**
|
|
2
3
|
* The operators the compiler accepts on a field holding `Value`: no order on a boolean, no
|
|
3
4
|
* text search off a string, no `isNull` on a field that is never null.
|
|
4
5
|
*/
|
|
5
|
-
export type OperatorOf<Value> = 'eq' | 'ne' | 'in' | ([Extract<Value, null | undefined>] extends [never] ? never : 'isNull') | ([NonNullable<Value>] extends [boolean] ? never : 'gt' | 'gte' | 'lt' | 'lte' | 'between') | ([NonNullable<Value>] extends [string] ?
|
|
6
|
+
export type OperatorOf<Value> = 'eq' | 'ne' | 'in' | ([Extract<Value, null | undefined>] extends [never] ? never : 'isNull') | ([NonNullable<Value>] extends [boolean] ? never : 'gt' | 'gte' | 'lt' | 'lte' | 'between') | ([NonNullable<Value>] extends [string] ? TextSearch : never);
|
|
6
7
|
//# sourceMappingURL=operator-of.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-of.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/operator-of.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,KAAK,IACxB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,QAAQ,CAAC,GACvE,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,CAAC,GAC1F,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"operator-of.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/operator-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,KAAK,IACxB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,QAAQ,CAAC,GACvE,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,CAAC,GAC1F,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,UAAU,GAAG,KAAK,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const ANY = ['eq', 'ne', 'in', 'isNull'];
|
|
2
2
|
const ORDERED = [...ANY, 'gt', 'gte', 'lt', 'lte', 'between'];
|
|
3
3
|
const BY_TYPE = {
|
|
4
|
-
string: [...ORDERED, 'contains', 'startsWith'],
|
|
4
|
+
string: [...ORDERED, 'contains', 'startsWith', 'containsIgnoringCase', 'startsWithIgnoringCase'],
|
|
5
5
|
number: ORDERED,
|
|
6
6
|
instant: ORDERED,
|
|
7
7
|
decimal: ORDERED,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators-of-type.js","sourceRoot":"","sources":["../../../src/application/criteria/operators-of-type.ts"],"names":[],"mappings":"AAGA,MAAM,GAAG,GAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AACpE,MAAM,OAAO,GAA8B,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAEzF,MAAM,OAAO,GAA2D;IACtE,MAAM,EAAE,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"operators-of-type.js","sourceRoot":"","sources":["../../../src/application/criteria/operators-of-type.ts"],"names":[],"mappings":"AAGA,MAAM,GAAG,GAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AACpE,MAAM,OAAO,GAA8B,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAEzF,MAAM,OAAO,GAA2D;IACtE,MAAM,EAAE,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,CAAC;IAChG,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,GAAG;CACb,CAAC;AAEF,8DAA8D;AAC9D,MAAM,UAAU,eAAe,CAAC,IAAe;IAC7C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-search.d.ts","sourceRoot":"","sources":["../../../src/application/criteria/text-search.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,sBAAsB,GAAG,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-search.js","sourceRoot":"","sources":["../../../src/application/criteria/text-search.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ExecutionScope } from '../ports/execution-scope.js';
|
|
2
|
+
export interface AdvisoryLockOptions {
|
|
3
|
+
/**
|
|
4
|
+
* For a key of tenant data: the lock is taken on `tenantKey(tenant, key)`, so two tenants never
|
|
5
|
+
* wait for each other, and work that names no tenant is refused (`NoCurrentTenantError`).
|
|
6
|
+
* Absent: one key for every tenant.
|
|
7
|
+
*/
|
|
8
|
+
readonly tenant?: ExecutionScope;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=advisory-lock-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advisory-lock-options.d.ts","sourceRoot":"","sources":["../../../src/application/persistence/advisory-lock-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advisory-lock-options.js","sourceRoot":"","sources":["../../../src/application/persistence/advisory-lock-options.ts"],"names":[],"mappings":""}
|
|
@@ -7,9 +7,15 @@ import type { StampedRow } from '../read-model/stamped-row.js';
|
|
|
7
7
|
export declare abstract class ReadModelRows<Row> {
|
|
8
8
|
/** The row of the key with its stamp, a deleted one included (without `row`). */
|
|
9
9
|
abstract find(key: string): Promise<StampedRow<Row> | undefined>;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Inserts unless the key exists, and says whether it did. An entry without `row` is the trace
|
|
12
|
+
* of a deletion delivered before the row it removes: the key, the stamp, and no data.
|
|
13
|
+
*/
|
|
11
14
|
abstract insert(entry: StampedRow<Row>): Promise<boolean>;
|
|
12
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Replaces the row of the key if it still holds the stamp `held`, and says whether it did. An
|
|
17
|
+
* entry without `row` leaves the trace alone: nothing of the row that was deleted is kept.
|
|
18
|
+
*/
|
|
13
19
|
abstract replace(entry: StampedRow<Row>, held: EventStamp): Promise<boolean>;
|
|
14
20
|
}
|
|
15
21
|
//# sourceMappingURL=read-model-rows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-model-rows.d.ts","sourceRoot":"","sources":["../../../src/application/ports/read-model-rows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,8BAAsB,aAAa,CAAC,GAAG;IACrC,iFAAiF;IACjF,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC;IAEjE
|
|
1
|
+
{"version":3,"file":"read-model-rows.d.ts","sourceRoot":"","sources":["../../../src/application/ports/read-model-rows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,8BAAsB,aAAa,CAAC,GAAG;IACrC,iFAAiF;IACjF,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC;IAEjE;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1D;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-model-rows.js","sourceRoot":"","sources":["../../../src/application/ports/read-model-rows.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAgB,aAAa;
|
|
1
|
+
{"version":3,"file":"read-model-rows.js","sourceRoot":"","sources":["../../../src/application/ports/read-model-rows.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAgB,aAAa;CAelC"}
|