ddd-ts-kit 0.86.0 → 0.87.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/CHANGELOG.md +20 -0
- package/README.fr.md +26 -27
- package/README.md +26 -25
- package/dist/check/explain/layout-docs.js +1 -1
- package/dist/check/explain/layout-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.js +2 -2
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/explain/wiring-docs.d.ts.map +1 -1
- package/dist/check/explain/wiring-docs.js +8 -7
- package/dist/check/explain/wiring-docs.js.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.js +3 -3
- package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
- package/dist/check/fixtures/constructor-injection-fixtures.js +6 -6
- package/dist/check/fixtures/constructor-injection-fixtures.js.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.js +15 -36
- package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
- package/dist/check/fixtures/declared-declarations.d.ts +4 -2
- package/dist/check/fixtures/declared-declarations.d.ts.map +1 -1
- package/dist/check/fixtures/declared-declarations.js +9 -3
- package/dist/check/fixtures/declared-declarations.js.map +1 -1
- package/dist/check/fixtures/earlier-declarations-fixtures.d.ts +4 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.js +48 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.js.map +1 -0
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +2 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/paths.d.ts +1 -1
- package/dist/check/fixtures/paths.js +1 -1
- package/dist/check/fixtures/paths.js.map +1 -1
- package/dist/check/rules/declarations-barrel-current.js +16 -11
- package/dist/check/rules/declarations-barrel-current.js.map +1 -1
- package/dist/check/rules/naming-suffix.js +1 -1
- package/dist/check/rules/naming-suffix.js.map +1 -1
- package/dist/check/support/is-generated-context-file.d.ts +1 -1
- package/dist/check/support/is-generated-context-file.js +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +14 -9
- package/dist/commands/docs.js.map +1 -1
- package/dist/declared/barrel-file.d.ts +1 -1
- package/dist/declared/barrel-file.js +1 -1
- package/dist/declared/context-declarations.d.ts +4 -2
- package/dist/declared/context-declarations.d.ts.map +1 -1
- package/dist/declared/context-declarations.js +4 -2
- package/dist/declared/context-declarations.js.map +1 -1
- package/dist/declared/declarations-folder-of.d.ts +12 -7
- package/dist/declared/declarations-folder-of.d.ts.map +1 -1
- package/dist/declared/declarations-folder-of.js +15 -11
- package/dist/declared/declarations-folder-of.js.map +1 -1
- package/dist/declared/earlier-layout-notice.d.ts +10 -0
- package/dist/declared/earlier-layout-notice.d.ts.map +1 -0
- package/dist/declared/earlier-layout-notice.js +12 -0
- package/dist/declared/earlier-layout-notice.js.map +1 -0
- package/dist/declared/earlier-layout-of.d.ts +10 -0
- package/dist/declared/earlier-layout-of.d.ts.map +1 -0
- package/dist/declared/earlier-layout-of.js +16 -0
- package/dist/declared/earlier-layout-of.js.map +1 -0
- package/dist/declared/earlier-shape-of.d.ts +13 -0
- package/dist/declared/earlier-shape-of.d.ts.map +1 -0
- package/dist/declared/earlier-shape-of.js +35 -0
- package/dist/declared/earlier-shape-of.js.map +1 -0
- package/dist/declared/folder-declarations-file.d.ts +6 -4
- package/dist/declared/folder-declarations-file.d.ts.map +1 -1
- package/dist/declared/folder-declarations-file.js +7 -5
- package/dist/declared/folder-declarations-file.js.map +1 -1
- package/dist/declared/index.d.ts +3 -2
- package/dist/declared/index.d.ts.map +1 -1
- package/dist/declared/index.js +3 -2
- package/dist/declared/index.js.map +1 -1
- package/dist/declared/is-declarations-file.d.ts +3 -2
- package/dist/declared/is-declarations-file.d.ts.map +1 -1
- package/dist/declared/is-declarations-file.js +9 -9
- package/dist/declared/is-declarations-file.js.map +1 -1
- package/dist/declared/keeps-role-folder-files.d.ts +12 -0
- package/dist/declared/keeps-role-folder-files.d.ts.map +1 -0
- package/dist/declared/keeps-role-folder-files.js +25 -0
- package/dist/declared/keeps-role-folder-files.js.map +1 -0
- package/dist/declared/keeps-single-file.d.ts +1 -1
- package/dist/declared/keeps-single-file.js +1 -1
- package/dist/declared/render-declarations.d.ts +7 -3
- package/dist/declared/render-declarations.d.ts.map +1 -1
- package/dist/declared/render-declarations.js +5 -3
- package/dist/declared/render-declarations.js.map +1 -1
- package/dist/declared/render-folder-declarations.d.ts +2 -2
- package/dist/declared/same-files.d.ts +3 -0
- package/dist/declared/same-files.d.ts.map +1 -0
- package/dist/declared/same-files.js +5 -0
- package/dist/declared/same-files.js.map +1 -0
- package/dist/dev/refresh-declarations.d.ts.map +1 -1
- package/dist/dev/refresh-declarations.js +1 -1
- package/dist/dev/refresh-declarations.js.map +1 -1
- package/dist/docs/write-docs.d.ts +3 -3
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +3 -3
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/generate/refresh-barrels.d.ts +17 -11
- package/dist/generate/refresh-barrels.d.ts.map +1 -1
- package/dist/generate/refresh-barrels.js +32 -26
- package/dist/generate/refresh-barrels.js.map +1 -1
- package/dist/generate/refresh-docs.d.ts +2 -2
- package/dist/generate/refresh-docs.d.ts.map +1 -1
- package/dist/generate/refresh-docs.js +3 -3
- package/dist/generate/refresh-docs.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/templates/init/AGENTS.md.tpl +1 -1
- package/templates/init/README.md.tpl +2 -2
- package/templates/pipeline/package-scripts.json +1 -1
- package/dist/declared/single-file-notice.d.ts +0 -8
- package/dist/declared/single-file-notice.d.ts.map +0 -1
- package/dist/declared/single-file-notice.js +0 -9
- package/dist/declared/single-file-notice.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@ What each version changes for someone who uses the kit. The packages of `package
|
|
|
4
4
|
together, under one version; the notes of each [GitHub release](https://github.com/gbourgeat/ddd-ts-kit/releases)
|
|
5
5
|
list the pull requests behind it.
|
|
6
6
|
|
|
7
|
+
## 0.87.0
|
|
8
|
+
|
|
9
|
+
**`S3FileStorage.put` stores a file larger than one part.** The SDK read the `size` of the
|
|
10
|
+
inspection the content streams through, the bytes counted so far, as the length of the whole
|
|
11
|
+
content: once every part was sent, a file larger than `partSize` (8 MiB by default) was refused
|
|
12
|
+
with `Expected 0 part(s) but uploaded 3 part(s)` and its upload aborted. A smaller file, sent in
|
|
13
|
+
one request, was not affected.
|
|
14
|
+
|
|
15
|
+
**The flush of `PinoLogger` resolves with the pretty format, in a process with nothing else pending.**
|
|
16
|
+
Pino does not let the worker thread of a transport (`pino-pretty`) keep a process alive, so its
|
|
17
|
+
answer to a flush did not either: at shutdown, once everything else had closed, the process exited
|
|
18
|
+
before `flush()` resolved, and what came after it never ran. `app.stop()` flushes the logger last,
|
|
19
|
+
so it never resolved, and a program that awaited it at the top level ended with exit code 13. A
|
|
20
|
+
flush now keeps the process alive while it runs, ten seconds at most. The JSON format was not
|
|
21
|
+
affected.
|
|
22
|
+
|
|
23
|
+
**In the declared style, the declarations of a context are written per layer: a role folder holds its role files and nothing else.** With `"stack.assembly": "barrel"`, `generate`, `docs` and `npm run dev` write one `<layer>.declarations.ts` directly in each layer of a context that holds a declared role file, `application/application.declarations.ts`, `infrastructure/infrastructure.declarations.ts` and `presentation/presentation.declarations.ts`, and the same in each module of the model (`application/<module>/application.declarations.ts`), instead of one `<folder>.declarations.ts` in every role folder. A folder that held one job, one adapter or two use cases no longer holds a generated file beside them, and a context reads as its role files. `<context>.declarations.ts` still re-exports these files, so the composition root, `contextModule(...)` and the worlds of the tests import it as before. Each file keeps the same content, for its whole layer: the imports, one `export *` per role file sorted by path, then the `injected(Class, [Tokens])` of the classes that take something. `declarations/barrel-current` compares the files of the layers and reports the `<folder>.declarations.ts` of a role folder left next to them; the guard of the plugin, `tree/closed`, `clean/one-export-per-file`, `clean/file-size` (of `ddd-ts-kit check` and of the ESLint plugin, which now leaves out every generated declarations file of a context), the commit size and `merge-trunk` treat the layer files as generated, like the others. Under `"stack.assembly": "discovery"` nothing changes.
|
|
24
|
+
|
|
25
|
+
To move: run `npx ddd-ts-kit docs` (or any `generate` without `--local-only`, or `npm run dev`), which writes the declarations of each layer, deletes the files of the role folders and rewrites `<context>.declarations.ts` as their summary, and commit the result. Upgrading alone fails nothing: for one minor version, a context still declared in one file per role folder, exactly as 0.85 and 0.86 would write them for the current role files and constructors, is accepted. `ddd-ts-kit check` reports it as a warning of `declarations/barrel-current` (exit 0) that says how to move, `docs --check` passes and prints the same warning, and `generate --local-only` keeps it in that layout, declaring there a role file it writes as 0.86 would, and says so in a note. The single `<context>.declarations.ts` of 0.84 is still accepted in the same way, and `generate --local-only` now keeps it as well when it writes a role file in its context, where it moved the context before. A later minor version reports both as errors.
|
|
26
|
+
|
|
7
27
|
## 0.86.0
|
|
8
28
|
|
|
9
29
|
**An erasure of a data subject leaves a dated entry in the audit trail.** `auditedSubjectKeys(keys, trail, { scope, clock, ids })` of `@ddd-ts-kit/audit` wraps a `SubjectKeyStore`: every `erase`, from a script, a command or a job, writes an entry with category `data-access`, action `personal-data:erase` (`SUBJECT_ERASURE_ACTION`), the subject as a `data-subject` resource, `keyDestroyed: true` or `false` in `changes`, and the actor and date of the execution scope; `keyFor` and `find` pass through. The key is destroyed first and the entry written after: an entry never states an erasure that did not happen, and when it cannot be written the erasure fails and is run again, which records that no key was left at a later date. An erasure outside an execution context is refused before any key is touched; a failure of the store is recorded as `failed`, with the `code` of a `DomainError` or `UNEXPECTED_ERROR`, and `onLostRecord` is told when that entry is lost too. The example binds the wrapped store and `npm run erase:patient -- <patientId> <operatorId>` writes the entry, with the operator as actor and the origin `cli`; the operator is required, so that the proof names a person, and an id that destroys no key and that no person of any network has is a mistyped one, refused before the rebuilds after a lookup under an elevation the trail records; the key comes first, the record after; a value that is not an opaque identifier (a name, an email) is refused before any key is touched or any entry written.
|
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:1943e91157120782 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit
|
|
5
5
|
|
|
@@ -151,7 +151,7 @@ la racine de composition l'assemble en une ligne. Dans le style `explicit`, chaq
|
|
|
151
151
|
métadonnées, et seul `@ddd-ts-kit/di` (sur tsyringe) les transforme en liaisons.
|
|
152
152
|
`--assembly` dit comment un contexte déclaré rejoint la racine de composition : `barrel` (par
|
|
153
153
|
défaut) est fait de fichiers générés, `<context>.declarations.ts` à la racine du contexte qui
|
|
154
|
-
réexporte les déclarations de chaque
|
|
154
|
+
réexporte les déclarations de chaque couche, statiques, que suivent un bundler, knip et
|
|
155
155
|
dependency-cruiser ; `discovery` écrit à la place `await discoverContext(...)`,
|
|
156
156
|
avec l'entrée knip et l'exception dependency-cruiser dont les fichiers découverts ont besoin
|
|
157
157
|
(*publishers* et *jobs* compris : ils sont découverts comme le reste), et intègre
|
|
@@ -318,8 +318,8 @@ rien dans son décorateur (`@CommandHandler(IssueInvoiceCommand)`) : chaque para
|
|
|
318
318
|
constructeur est typé par une classe, son jeton (`declarations/constructor-injection`).
|
|
319
319
|
`generate`, `docs` et le script `dev` lisent les signatures, avec le scanner sans dépendance du
|
|
320
320
|
*checker* et sans compilateur, et écrivent des instructions `injected(Class, [Tokens])` dans le
|
|
321
|
-
fichiers générés de chaque contexte : le `<
|
|
322
|
-
|
|
321
|
+
fichiers générés de chaque contexte : le `<layer>.declarations.ts` de chaque couche, au-dessus
|
|
322
|
+
des dossiers de rôle dont il enregistre les classes, que réexporte `<context>.declarations.ts`, ou
|
|
323
323
|
`<context>.dependencies.ts` sous discovery. `@ddd-ts-kit/di` injecte à partir de là. Rien ne
|
|
324
324
|
repose sur `emitDecoratorMetadata` : il est absent avec les décorateurs standard et sous `tsx`.
|
|
325
325
|
`init` écrit `"stack.dependencies": "signature"` ; une configuration sans la clé vaut `listed`,
|
|
@@ -328,14 +328,14 @@ la forme de 0.1 (`@CommandHandler(M, [Ports])`), qui continue de fonctionner san
|
|
|
328
328
|
liste ce que reçoit chaque classe. Chaque fichier généré exporte une classe, une interface ou une
|
|
329
329
|
fonction, et porte son nom.
|
|
330
330
|
|
|
331
|
-

|
|
332
332
|
|
|
333
333
|
Un extrait des déclarations du contexte `notification` de l'application d'exemple, telles que
|
|
334
|
-
la CLI les écrit (jamais à la main) : un fichier par
|
|
335
|
-
enregistre, et un récapitulatif à la racine du contexte qui ne fait que les réexporter.
|
|
334
|
+
la CLI les écrit (jamais à la main) : un fichier par couche, au-dessus des dossiers de rôle dont
|
|
335
|
+
il enregistre les classes, et un récapitulatif à la racine du contexte qui ne fait que les réexporter.
|
|
336
336
|
|
|
337
337
|
```ts
|
|
338
|
-
// src/contexts/notification/application/
|
|
338
|
+
// src/contexts/notification/application/application.declarations.ts
|
|
339
339
|
import { injected } from '@ddd-ts-kit/kernel/declarations';
|
|
340
340
|
import { WithdrawReminderHandler } from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
|
|
341
341
|
import { ReminderRepository } from '@/contexts/notification/domain/repositories/reminder.repository';
|
|
@@ -345,7 +345,7 @@ export * from '@/contexts/notification/application/commands/withdraw-reminder/wi
|
|
|
345
345
|
|
|
346
346
|
injected(WithdrawReminderHandler, [ReminderRepository]);
|
|
347
347
|
|
|
348
|
-
// src/contexts/notification/infrastructure/
|
|
348
|
+
// src/contexts/notification/infrastructure/infrastructure.declarations.ts
|
|
349
349
|
import { KnexReminderRepository } from '@/contexts/notification/infrastructure/persistence/knex-reminder.repository';
|
|
350
350
|
import { Clock, ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
351
351
|
import { KnexContext } from '@ddd-ts-kit/knex';
|
|
@@ -355,8 +355,9 @@ export * from '@/contexts/notification/infrastructure/persistence/knex-reminder.
|
|
|
355
355
|
injected(KnexReminderRepository, [KnexContext, ExecutionScope, Clock]);
|
|
356
356
|
|
|
357
357
|
// src/contexts/notification/notification.declarations.ts
|
|
358
|
-
export * from '@/contexts/notification/application/
|
|
359
|
-
export * from '@/contexts/notification/infrastructure/
|
|
358
|
+
export * from '@/contexts/notification/application/application.declarations';
|
|
359
|
+
export * from '@/contexts/notification/infrastructure/infrastructure.declarations';
|
|
360
|
+
export * from '@/contexts/notification/presentation/presentation.declarations';
|
|
360
361
|
```
|
|
361
362
|
|
|
362
363
|
et l'unique ligne de la racine de composition qui ajoute tout le contexte :
|
|
@@ -691,7 +692,7 @@ would create src/contexts/notification/application/commands/archive-notification
|
|
|
691
692
|
would create src/contexts/notification/test/unit/archive-notification.handler.spec.ts
|
|
692
693
|
would update src/contexts/notification/CONTEXT.md
|
|
693
694
|
would update src/contexts/notification/application/authorization/notification.permissions.ts
|
|
694
|
-
would update src/contexts/notification/application/
|
|
695
|
+
would update src/contexts/notification/application/application.declarations.ts
|
|
695
696
|
|
|
696
697
|
Next, in this order: the language of the context first, then the business decisions only you can make
|
|
697
698
|
src/contexts/notification/application/commands/archive-notification/archive-notification.command.ts:9 declare the input of "archive notification" as a constructor with the actor first, ...
|
|
@@ -795,21 +796,19 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
795
796
|
un sujet `system` opérer un contexte. Avec `--authz custom`, une région supprimée, un schéma de
|
|
796
797
|
relations remodelé ou une permission que le générateur ne sait pas lire, rien n'est écrit et le
|
|
797
798
|
fichier du *job* porte le `TODO(domain)` qui nomme l'acteur et la permission.
|
|
798
|
-
- **Les déclarations sont dérivées.** Chaque
|
|
799
|
-
|
|
800
|
-
`application/
|
|
801
|
-
`
|
|
802
|
-
|
|
803
|
-
un fichier de rôle posé directement dans sa couche va dans `<layer>/<layer>.declarations.ts`).
|
|
804
|
-
Il contient un `export *` par fichier de rôle du dossier, trié par chemin, puis un
|
|
799
|
+
- **Les déclarations sont dérivées.** Chaque couche d'un contexte qui contient un fichier de
|
|
800
|
+
rôle déclaré a son `<layer>.declarations.ts`, directement dans la couche :
|
|
801
|
+
`application/application.declarations.ts`, `infrastructure/infrastructure.declarations.ts`,
|
|
802
|
+
`presentation/presentation.declarations.ts`, et de même dans chaque module du modèle.
|
|
803
|
+
Il contient un `export *` par fichier de rôle de la couche, trié par chemin, puis un
|
|
805
804
|
`injected(Class, [Tokens])` par classe dont le constructeur reçoit quelque chose, lu depuis sa
|
|
806
805
|
signature, avec les imports dont ils ont besoin. `<context>.declarations.ts`, à la racine du
|
|
807
806
|
contexte, ne fait que réexporter ces fichiers, triés par chemin. Chaque `generate`, et `docs`,
|
|
808
|
-
les réécrivent et suppriment les déclarations d'
|
|
809
|
-
de rôle ; `docs --check` et `check` (`declarations/barrel-current`) signalent celles qu'un
|
|
807
|
+
les réécrivent et suppriment les déclarations d'une couche qui ne contient plus aucun fichier
|
|
808
|
+
de rôle, et le `<folder>.declarations.ts` de chaque dossier de rôle qu'écrivaient 0.85 et 0.86 ; `docs --check` et `check` (`declarations/barrel-current`) signalent celles qu'un
|
|
810
809
|
fichier de rôle écrit à la main a laissées en arrière ou dont un constructeur a changé depuis,
|
|
811
810
|
en nommant la classe
|
|
812
|
-
(`stale src/contexts/billing/application/
|
|
811
|
+
(`stale src/contexts/billing/application/application.declarations.ts: the dependency list of IssueInvoiceHandler is stale: ...`).
|
|
813
812
|
Le script `dev` charge `ddd-ts-kit/dist/refresh-declarations.js` avant l'application, à chaque
|
|
814
813
|
démarrage et à chaque rechargement de `tsx watch` : un port ajouté à un constructeur est injecté
|
|
815
814
|
au rechargement qui suit l'enregistrement du fichier. Le même module est le binaire
|
|
@@ -909,9 +908,9 @@ Régénère ce qui dérive de la configuration et du code, et rien d'autre :
|
|
|
909
908
|
sections écrites sont posées avec des indications.
|
|
910
909
|
- les listes générées de chaque `CONTEXT.md` (agrégats, événements publiés, permissions, *jobs*
|
|
911
910
|
planifiés en tableau de nom, planning et commande, relations) ;
|
|
912
|
-
- les déclarations générées de chaque contexte déclaré : le `<
|
|
913
|
-
|
|
914
|
-
`<context>.declarations.ts`, qui les réexporte (les déclarations d'
|
|
911
|
+
- les déclarations générées de chaque contexte déclaré : le `<layer>.declarations.ts` de chaque
|
|
912
|
+
couche, avec ce que reçoit chaque constructeur, lu depuis sa signature, et
|
|
913
|
+
`<context>.declarations.ts`, qui les réexporte (les déclarations d'une couche restée sans fichier
|
|
915
914
|
de rôle sont supprimées), ou sous discovery `<context>.dependencies.ts`, qui ne contient que
|
|
916
915
|
les listes ;
|
|
917
916
|
- la référence de chaque `CONTEXT.md` : les faits de `describe`, en tableaux sous
|
|
@@ -2106,7 +2105,7 @@ règle.
|
|
|
2106
2105
|
| `context/declared-relationship` | un import d'un langage publié dont le contexte n'est pas un amont déclaré |
|
|
2107
2106
|
| `context/published-language-is-a-contract` | `published-language/` qui importe autre chose que sa liste autorisée et d'autres langages publiés |
|
|
2108
2107
|
| `context/no-cycle` | un cycle dans les amonts déclarés, avec son chemin |
|
|
2109
|
-
| `tree/closed` | un répertoire hors de l'arbre canonique et de `extraDirectories` ; un fichier source hors d'un répertoire de rôle ; dans le style déclaré, `<context>.declarations.ts` est accepté à la racine d'un contexte, et le `<
|
|
2108
|
+
| `tree/closed` | un répertoire hors de l'arbre canonique et de `extraDirectories` ; un fichier source hors d'un répertoire de rôle ; dans le style déclaré, `<context>.declarations.ts` est accepté à la racine d'un contexte, et le `<layer>.declarations.ts` d'une couche dans cette couche |
|
|
2110
2109
|
| `tree/context-doc` | un `CONTEXT.md` manquant, une section manquante, une classification qui contredit la configuration |
|
|
2111
2110
|
| `naming/suffix` | un fichier sans le suffixe de son rôle, ou pas en kebab-case. `application/scheduling/` contient des `*.job.ts` ; un dossier de cas d'usage accepte un `*.result.ts` à côté de son message et de son gestionnaire ; `presentation/http/<context>.routes.ts`, nommé d'après son contexte au lieu d'un rôle, est accepté dans les deux styles |
|
|
2112
2111
|
| `naming/one-concept-per-file` | plusieurs classes exportées dans un fichier d'agrégat, d'entité, d'objet-valeur, d'événement, de commande, de requête, de gestionnaire, de gestionnaire d'événement, de gestionnaire d'événement d'intégration ou de *job* ; dans le style déclaré, plusieurs classes portant un décorateur de déclaration dans un même fichier de rôle |
|
|
@@ -2164,7 +2163,7 @@ règle.
|
|
|
2164
2163
|
| `context/extractable` | un fichier de module qui importe un autre contexte hors de son langage publié ; une persistance qui importe l'infrastructure d'un autre contexte ou nomme son schéma ; un gestionnaire qui importe le *repository* d'un autre contexte ; `export let` ou un `new Map`, `Set`, `WeakMap` exporté au niveau du module ; `deployable: true` sans `apps/<context>/main.ts` ; dans le style déclaré, un fichier de rôle qui importe quoi que ce soit d'un fichier de port d'un autre contexte |
|
|
2165
2164
|
| `governance/recorded-deviation` | un commentaire `ddd-ts-kit-disable` ou `eslint-disable` dont la raison ne nomme aucun `ADR-<number>` avec un fichier `docs/adr/<number>-*.md` ; une règle mise à `off` (ou à `warn` en dessous de sa valeur par défaut), un répertoire supplémentaire, un *package* autorisé supplémentaire, un `guard` autre que `enforce` ou `stack.events` hors de l'outbox, sans entrée `deviations` `{ what, adr, reason }` qui pointe vers un enregistrement existant |
|
|
2166
2165
|
| `declarations/role-declared` | style déclaré seulement : un fichier de rôle (autre que `*.command.ts` et `*.query.ts`, tenus par `authz/declared` ; `*.job.ts` sous `application/scheduling/` avec `@Scheduled` et `*.publisher.ts` avec `@DomainEventHandler` sont des rôles) qui n'exporte aucune classe portant le décorateur de son suffixe et de son dossier, ou une classe qui en porte une autre ; une classe déclarée dans un fichier qui n'est pas un fichier de rôle ; une option `consumer` ou `name` manquante, vide, une variable, une concaténation ou un template literal avec une substitution ; tout décorateur de déclaration sur une classe sous `domain/` |
|
|
2167
|
-
| `declarations/barrel-current` | style déclaré seulement : avec `stack.assembly: barrel`, un `<
|
|
2166
|
+
| `declarations/barrel-current` | style déclaré seulement : avec `stack.assembly: barrel`, un `<layer>.declarations.ts` d'une couche manquant ou qui diffère d'un `export *` par fichier de rôle de la couche trié par chemin, suivi d'un `injected(Class, [Tokens])` par classe de la couche dont le constructeur reçoit quelque chose (lu depuis les signatures, avec leurs imports), un `<context>.declarations.ts` manquant ou qui diffère d'un `export *` par tel fichier trié par chemin, et les déclarations d'une couche qui ne contient plus aucun fichier de rôle ; avec `discovery`, des déclarations générées qui existent encore, et un `<context>.dependencies.ts` qui diffère de ces instructions `injected` (son absence est acceptée tant qu'il n'en contiendrait aucune). Le message nomme le fichier de rôle manquant ou la classe dont la liste est périmée. Un contexte encore déclaré comme l'écrivait une version antérieure, exactement tel que l'écrirait cette version (le fichier unique `<context>.declarations.ts` de 0.84, ou un `<folder>.declarations.ts` par dossier de rôle comme l'écrivaient 0.85 et 0.86), est un avertissement dans cette version (`docs --check` passe et l'affiche, `docs` le déplace) et une erreur dans une version mineure ultérieure. Elle a besoin de l'arbre, c'est pourquoi `check-file` ne l'exécute pas |
|
|
2168
2167
|
| `declarations/constructor-injection` | style déclaré seulement, dans un fichier de rôle : sur une classe dont le décorateur ne liste rien, un paramètre de constructeur optionnel, qui a une valeur par défaut, est un paramètre du reste ou est déstructuré, n'a pas de type, ou est typé par autre chose qu'un nom de classe (arguments de type mis à part) : une union, une intersection, un tableau, un nom qualifié, un type du langage, une interface, un alias de type, une enum ou une classe non exportée du fichier ou du fichier du projet d'où elle est importée ; une classe qui hérite son constructeur d'une classe que le projet ne sait pas lire. Sous `stack.dependencies: signature`, un décorateur qui porte une liste alors que le constructeur peut être lu : une liste qui le répète, une qui en diffère |
|
|
2169
2168
|
| `declarations/port-adapter-wired` | une classe de `infrastructure/` qui implémente un port et que rien ne câble : ni `@Repository`, `@Gateway` ou `@Adapter` dans le style déclaré, ni fichier de la racine de composition (`<context>.module.ts`, `main.ts`, `apps/<context>/main.ts`, la plateforme) qui l'importe, une fois que le fichier ne porte plus de `TODO(domain)` ni de `TODO(platform)` ; celle gardée à dessein porte `// ddd-ts-kit-disable-next-line declarations/port-adapter-wired -- ADR-NNNN: <why>` |
|
|
2170
2169
|
| `ports/abstract-class` | dans un fichier de port (`domain/repositories/*.repository.ts`, `application/ports/*.port.ts`) : une classe qui n'est pas `abstract` ; un membre qui n'est pas une méthode ou une propriété abstraite (`static readonly tokenKey = '<text>'` mis à part) : un constructeur, un corps, un initialiseur, un membre `private`, `protected` ou `#` ; une `interface` exportée (un alias `type`, une forme de données, n'est pas signalé) |
|
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ module file of the context: `builder.bind(Port).toClass(Adapter, [Ports])`,
|
|
|
140
140
|
metadata, and only `@ddd-ts-kit/di` (on tsyringe) turns them into bindings.
|
|
141
141
|
`--assembly` says how a declared context reaches the composition root: `barrel` (the default) is
|
|
142
142
|
generated files, `<context>.declarations.ts` at the root of the context re-exporting the
|
|
143
|
-
declarations of each
|
|
143
|
+
declarations of each layer, static, followed by a bundler, by knip and by dependency-cruiser; `discovery` writes `await discoverContext(...)` instead, with the knip entry
|
|
144
144
|
and the dependency-cruiser exception the discovered files need (publishers and jobs included: they
|
|
145
145
|
are discovered like the rest), and inlines `@ddd-ts-kit/di` in the two vitest configs, so that the
|
|
146
146
|
files it imports itself are compiled by the runner. Discovery is accepted behind a broker: a
|
|
@@ -302,8 +302,8 @@ nothing in its decorator (`@CommandHandler(IssueInvoiceCommand)`): each construc
|
|
|
302
302
|
is typed by one class, its token (`declarations/constructor-injection`). `generate`, `docs` and
|
|
303
303
|
the `dev` script read the signatures, with the zero-dependency scanner of the checker and no
|
|
304
304
|
compiler, and write `injected(Class, [Tokens])` statements in the generated files of each
|
|
305
|
-
context: the `<
|
|
306
|
-
which `<context>.declarations.ts` re-exports, or `<context>.dependencies.ts` under discovery. `@ddd-ts-kit/di` injects from there. `emitDecoratorMetadata` is never relied on: it
|
|
305
|
+
context: the `<layer>.declarations.ts` of each layer, above the role folders whose classes it
|
|
306
|
+
registers, which `<context>.declarations.ts` re-exports, or `<context>.dependencies.ts` under discovery. `@ddd-ts-kit/di` injects from there. `emitDecoratorMetadata` is never relied on: it
|
|
307
307
|
is absent with standard decorators and under `tsx`. `init` writes
|
|
308
308
|
`"stack.dependencies": "signature"`; a config without the key is `listed`, the 0.1 form
|
|
309
309
|
(`@CommandHandler(M, [Ports])`), which keeps working untouched, and
|
|
@@ -311,14 +311,14 @@ is absent with standard decorators and under `tsx`. `init` writes
|
|
|
311
311
|
what each class is given. Every generated file exports one class, interface or function and is named
|
|
312
312
|
after it.
|
|
313
313
|
|
|
314
|
-

|
|
315
315
|
|
|
316
316
|
An excerpt of the declarations of the `notification` context of the example application, as
|
|
317
|
-
the CLI writes them (never by hand): one file per
|
|
318
|
-
and a summary at the root of the context that only re-exports them.
|
|
317
|
+
the CLI writes them (never by hand): one file per layer, above the role folders whose classes it
|
|
318
|
+
registers, and a summary at the root of the context that only re-exports them.
|
|
319
319
|
|
|
320
320
|
```ts
|
|
321
|
-
// src/contexts/notification/application/
|
|
321
|
+
// src/contexts/notification/application/application.declarations.ts
|
|
322
322
|
import { injected } from '@ddd-ts-kit/kernel/declarations';
|
|
323
323
|
import { WithdrawReminderHandler } from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
|
|
324
324
|
import { ReminderRepository } from '@/contexts/notification/domain/repositories/reminder.repository';
|
|
@@ -328,7 +328,7 @@ export * from '@/contexts/notification/application/commands/withdraw-reminder/wi
|
|
|
328
328
|
|
|
329
329
|
injected(WithdrawReminderHandler, [ReminderRepository]);
|
|
330
330
|
|
|
331
|
-
// src/contexts/notification/infrastructure/
|
|
331
|
+
// src/contexts/notification/infrastructure/infrastructure.declarations.ts
|
|
332
332
|
import { KnexReminderRepository } from '@/contexts/notification/infrastructure/persistence/knex-reminder.repository';
|
|
333
333
|
import { Clock, ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
334
334
|
import { KnexContext } from '@ddd-ts-kit/knex';
|
|
@@ -338,8 +338,9 @@ export * from '@/contexts/notification/infrastructure/persistence/knex-reminder.
|
|
|
338
338
|
injected(KnexReminderRepository, [KnexContext, ExecutionScope, Clock]);
|
|
339
339
|
|
|
340
340
|
// src/contexts/notification/notification.declarations.ts
|
|
341
|
-
export * from '@/contexts/notification/application/
|
|
342
|
-
export * from '@/contexts/notification/infrastructure/
|
|
341
|
+
export * from '@/contexts/notification/application/application.declarations';
|
|
342
|
+
export * from '@/contexts/notification/infrastructure/infrastructure.declarations';
|
|
343
|
+
export * from '@/contexts/notification/presentation/presentation.declarations';
|
|
343
344
|
```
|
|
344
345
|
|
|
345
346
|
and the one line of the composition root that adds the whole context:
|
|
@@ -664,7 +665,7 @@ would create src/contexts/notification/application/commands/archive-notification
|
|
|
664
665
|
would create src/contexts/notification/test/unit/archive-notification.handler.spec.ts
|
|
665
666
|
would update src/contexts/notification/CONTEXT.md
|
|
666
667
|
would update src/contexts/notification/application/authorization/notification.permissions.ts
|
|
667
|
-
would update src/contexts/notification/application/
|
|
668
|
+
would update src/contexts/notification/application/application.declarations.ts
|
|
668
669
|
|
|
669
670
|
Next, in this order: the language of the context first, then the business decisions only you can make
|
|
670
671
|
src/contexts/notification/application/commands/archive-notification/archive-notification.command.ts:9 declare the input of "archive notification" as a constructor with the actor first, ...
|
|
@@ -764,19 +765,19 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
764
765
|
`system` subject operate a context. With `--authz custom`, a removed region, a remodelled
|
|
765
766
|
relationship schema or a permission the generator cannot read, nothing is written and the job
|
|
766
767
|
file carries the `TODO(domain)` naming the actor and the permission.
|
|
767
|
-
- **The declarations are derived.** Each
|
|
768
|
-
|
|
769
|
-
`infrastructure/
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
`export *` per role file of the folder, sorted by path, then one `injected(Class, [Tokens])` per
|
|
768
|
+
- **The declarations are derived.** Each layer of a context that holds a declared role file has
|
|
769
|
+
its `<layer>.declarations.ts`, directly in the layer: `application/application.declarations.ts`,
|
|
770
|
+
`infrastructure/infrastructure.declarations.ts`, `presentation/presentation.declarations.ts`,
|
|
771
|
+
and the same in each module of the model. It holds one
|
|
772
|
+
`export *` per role file of the layer, sorted by path, then one `injected(Class, [Tokens])` per
|
|
773
773
|
class whose constructor takes something, read from its signature, with the imports they need.
|
|
774
774
|
`<context>.declarations.ts`, at the root of the context, only re-exports these files, sorted by
|
|
775
|
-
path. Every `generate`, and `docs`, rewrite them and delete the declarations of a
|
|
776
|
-
holds no role file any more
|
|
775
|
+
path. Every `generate`, and `docs`, rewrite them and delete the declarations of a layer that
|
|
776
|
+
holds no role file any more, and the `<folder>.declarations.ts` of each role folder that 0.85 and
|
|
777
|
+
0.86 wrote; `docs --check` and `check` (`declarations/barrel-current`) report
|
|
777
778
|
one that a role file written by hand left behind or whose constructor changed since, naming the
|
|
778
779
|
class
|
|
779
|
-
(`stale src/contexts/billing/application/
|
|
780
|
+
(`stale src/contexts/billing/application/application.declarations.ts: the dependency list of IssueInvoiceHandler is stale: ...`).
|
|
780
781
|
The `dev` script loads `ddd-ts-kit/dist/refresh-declarations.js` before the application, on
|
|
781
782
|
every start and reload of `tsx watch`: a port added to a constructor is injected on the
|
|
782
783
|
reload that follows the save. The same module is the binary `ddd-ts-kit-refresh-declarations`.
|
|
@@ -863,9 +864,9 @@ Regenerates what is derived from the config and the code, and nothing else:
|
|
|
863
864
|
kept; on first creation the four written sections are laid out with hints.
|
|
864
865
|
- the generated lists of every `CONTEXT.md` (aggregates, published events, permissions, scheduled
|
|
865
866
|
jobs as a table of name, schedule and command, relationships);
|
|
866
|
-
- the generated declarations of every declared context: the `<
|
|
867
|
-
|
|
868
|
-
`<context>.declarations.ts`, which re-exports them (the declarations of a
|
|
867
|
+
- the generated declarations of every declared context: the `<layer>.declarations.ts` of each
|
|
868
|
+
layer, with what each constructor is injected, read from its signature, and
|
|
869
|
+
`<context>.declarations.ts`, which re-exports them (the declarations of a layer left without a
|
|
869
870
|
role file are deleted), or under discovery `<context>.dependencies.ts`, which holds the lists
|
|
870
871
|
alone;
|
|
871
872
|
- the reference of every `CONTEXT.md`: the facts of `describe`, as tables under `## Reference`,
|
|
@@ -1979,7 +1980,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
1979
1980
|
| `context/declared-relationship` | an import of a published language whose context is not a declared upstream |
|
|
1980
1981
|
| `context/published-language-is-a-contract` | `published-language/` importing anything but its allow-list and other published languages |
|
|
1981
1982
|
| `context/no-cycle` | a cycle in the declared upstreams, with its path |
|
|
1982
|
-
| `tree/closed` | a directory outside the canonical tree and `extraDirectories`; a source file outside a role directory; in the declared style `<context>.declarations.ts` is accepted at the root of a context, and the `<
|
|
1983
|
+
| `tree/closed` | a directory outside the canonical tree and `extraDirectories`; a source file outside a role directory; in the declared style `<context>.declarations.ts` is accepted at the root of a context, and the `<layer>.declarations.ts` of a layer in that layer |
|
|
1983
1984
|
| `tree/context-doc` | a missing `CONTEXT.md`, a missing section, a classification that contradicts the config |
|
|
1984
1985
|
| `naming/suffix` | a file without the suffix of its role, or not in kebab-case. `application/scheduling/` holds `*.job.ts`; a use case folder accepts `*.result.ts` next to its message and its handler; `presentation/http/<context>.routes.ts`, named after its context instead of a role, is accepted in both styles |
|
|
1985
1986
|
| `naming/one-concept-per-file` | several exported classes in an aggregate, entity, value object, event, command, query, handler, event handler, integration event handler or job file; in the declared style, several classes carrying a declaration decorator in one role file |
|
|
@@ -2037,7 +2038,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
2037
2038
|
| `context/extractable` | a module file importing another context outside its published language; persistence importing another context's infrastructure or naming its schema; a handler importing another context's repository; `export let` or an exported `new Map`, `Set`, `WeakMap` at module level; `deployable: true` without `apps/<context>/main.ts`; in the declared style, a role file importing anything of a port file of another context |
|
|
2038
2039
|
| `governance/recorded-deviation` | a `ddd-ts-kit-disable` or `eslint-disable` comment whose reason names no `ADR-<number>` with a file `docs/adr/<number>-*.md`; a rule set to `off` (or to `warn` below its default), an extra directory, an extra allowed package, a `guard` other than `enforce` or `stack.events` off the outbox, without a `deviations` entry `{ what, adr, reason }` pointing to an existing record |
|
|
2039
2040
|
| `declarations/role-declared` | declared style only: a role file (other than `*.command.ts` and `*.query.ts`, held by `authz/declared`; `*.job.ts` under `application/scheduling/` with `@Scheduled` and `*.publisher.ts` with `@DomainEventHandler` are roles) exporting no class with the decorator of its suffix and folder, or one carrying another declaration; a declared class in a file that is not a role file; a `consumer` or `name` option that is missing, empty, a variable, a concatenation or a template with a substitution; any declaration decorator on a class under `domain/` |
|
|
2040
|
-
| `declarations/barrel-current` | declared style only: with `stack.assembly: barrel`, a missing `<
|
|
2041
|
+
| `declarations/barrel-current` | declared style only: with `stack.assembly: barrel`, a missing `<layer>.declarations.ts` of a layer or one that differs from one `export *` per role file of the layer sorted by path followed by one `injected(Class, [Tokens])` per class of the layer whose constructor takes something (read from the signatures, with their imports), a `<context>.declarations.ts` that is missing or differs from one `export *` per such file sorted by path, and the declarations of a layer that holds no role file any more; with `discovery`, generated declarations that still exist, and a `<context>.dependencies.ts` that differs from those `injected` statements (absent is accepted while it would hold none). The message names the missing role file or the class whose list is stale. A context still declared as an earlier version wrote it, exactly as that version would write it (the single `<context>.declarations.ts` of 0.84, or one `<folder>.declarations.ts` per role folder as 0.85 and 0.86 wrote them), is a warning in this version (`docs --check` passes and prints it, `docs` moves it) and an error in a later minor version. It needs the tree, so `check-file` does not run it |
|
|
2041
2042
|
| `declarations/constructor-injection` | declared style only, in a role file: on a class whose decorator lists nothing, a constructor parameter that is optional, has a default value, is a rest parameter or is destructured, has no type, or is typed by anything but one class name (type arguments aside): a union, an intersection, an array, a qualified name, a type of the language, an interface, a type alias, an enum or an unexported class of the file or of the file of the project it is imported from; a class that inherits its constructor from a class the project cannot read. Under `stack.dependencies: signature`, a decorator that carries a list although the constructor can be read: one that repeats it, one that differs |
|
|
2042
2043
|
| `declarations/port-adapter-wired` | a class of `infrastructure/` implementing a port that nothing wires: no `@Repository`, `@Gateway` or `@Adapter` in the declared style, and no file of the composition root (`<context>.module.ts`, `main.ts`, `apps/<context>/main.ts`, the platform) importing it, once the file carries no `TODO(domain)` or `TODO(platform)` left; one kept on purpose carries `// ddd-ts-kit-disable-next-line declarations/port-adapter-wired -- ADR-NNNN: <why>` |
|
|
2043
2044
|
| `ports/abstract-class` | in a port file (`domain/repositories/*.repository.ts`, `application/ports/*.port.ts`): a class that is not `abstract`; a member that is not an abstract method or property (`static readonly tokenKey = '<text>'` apart): a constructor, a body, an initializer, a `private`, `protected` or `#` member; an exported `interface` (a `type` alias, a data shape, is not reported) |
|
|
@@ -63,7 +63,7 @@ export abstract class TaxGateway {}
|
|
|
63
63
|
export interface IssueInvoiceResult { readonly invoiceId: string }`,
|
|
64
64
|
},
|
|
65
65
|
'clean/file-size': {
|
|
66
|
-
why: 'Past a few hundred lines a file holds more than one responsibility: nobody reads it whole, and every change touches something unrelated. The limit is 350 physical lines, for sources and tests alike, and is not configurable. A long test file is split by behaviour, a long source by concept. A long end-to-end spec is split into parts named after it, test/e2e/<use-case>-<behaviour>.e2e.spec.ts beside test/e2e/<use-case>.e2e.spec.ts (the one name of a new end-to-end spec the guard of the plugin lets be written by hand, with test/e2e/journey-<name>.e2e.spec.ts for a journey across use cases), and what its parts share goes to test/e2e/support/<context>/. An aggregate keeps its intention methods and moves a decision out: a domain service that takes the state and returns the new state and its events, which the aggregate applies, or a value object for fields that travel together; never a public method that sets its state from outside. Generated files (a path segment named generated, the <context>.declarations.ts and <context>.dependencies.ts at the root of a context, the <
|
|
66
|
+
why: 'Past a few hundred lines a file holds more than one responsibility: nobody reads it whole, and every change touches something unrelated. The limit is 350 physical lines, for sources and tests alike, and is not configurable. A long test file is split by behaviour, a long source by concept. A long end-to-end spec is split into parts named after it, test/e2e/<use-case>-<behaviour>.e2e.spec.ts beside test/e2e/<use-case>.e2e.spec.ts (the one name of a new end-to-end spec the guard of the plugin lets be written by hand, with test/e2e/journey-<name>.e2e.spec.ts for a journey across use cases), and what its parts share goes to test/e2e/support/<context>/. An aggregate keeps its intention methods and moves a decision out: a domain service that takes the state and returns the new state and its events, which the aggregate applies, or a value object for fields that travel together; never a public method that sets its state from outside. Generated files (a path segment named generated, the <context>.declarations.ts and <context>.dependencies.ts at the root of a context, the <layer>.declarations.ts of its layers) and declaration files are not judged.',
|
|
67
67
|
bad: `// application/commands/issue-invoice/issue-invoice.handler.ts, 600 lines:
|
|
68
68
|
// the handler, its validation, its mapping and three helpers`,
|
|
69
69
|
good: `// issue-invoice.handler.ts orchestrates, in 40 lines;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-docs.js","sourceRoot":"","sources":["../../../src/check/explain/layout-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,uBAAuB,EAAE;QACvB,GAAG,EAAE,qXAAqX;QAC1X,GAAG,EAAE;;;;;;EAMP;QACE,IAAI,EAAE;;;;;;EAMR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,qgBAAqgB;QAC1gB,GAAG,EAAE;;;;EAIP;QACE,IAAI,EAAE;;;;EAIR;KACC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,ieAAie;QACte,GAAG,EAAE;;;;0CAIiC;QACtC,IAAI,EAAE;;;;;;;;;;EAUR;KACC;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,yrBAAyrB;QAC9rB,GAAG,EAAE;;;;iCAIwB;QAC7B,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,iBAAiB,EAAE;QACjB,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"layout-docs.js","sourceRoot":"","sources":["../../../src/check/explain/layout-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,uBAAuB,EAAE;QACvB,GAAG,EAAE,qXAAqX;QAC1X,GAAG,EAAE;;;;;;EAMP;QACE,IAAI,EAAE;;;;;;EAMR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,qgBAAqgB;QAC1gB,GAAG,EAAE;;;;EAIP;QACE,IAAI,EAAE;;;;EAIR;KACC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,ieAAie;QACte,GAAG,EAAE;;;;0CAIiC;QACtC,IAAI,EAAE;;;;;;;;;;EAUR;KACC;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,yrBAAyrB;QAC9rB,GAAG,EAAE;;;;iCAIwB;QAC7B,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,iBAAiB,EAAE;QACjB,GAAG,EAAE,ooCAAooC;QACzoC,GAAG,EAAE;8DACqD;QAC1D,IAAI,EAAE;wFAC8E;KACrF;CACF,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const TREE_DOCS = {
|
|
2
2
|
'tree/closed': {
|
|
3
|
-
why: 'A fixed tree means every concept has one obvious place, so people and tools find it without reading the code. An ad hoc folder (utils, helpers, common, types, functions) is where unnamed concepts go to hide: a function that reads a value is a method of that value object, a decision over several objects a domain service, a shared shape of data a value object, an interchangeable rule an abstract class of domain/services with one service per variant (docs/ARCHITECTURE.md, a concept with no role of its own). A real new need is declared in extraDirectories with its reason. In the declared style the generated summary <context>.declarations.ts lives at the root of the context, next to CONTEXT.md, and the generated <
|
|
3
|
+
why: 'A fixed tree means every concept has one obvious place, so people and tools find it without reading the code. An ad hoc folder (utils, helpers, common, types, functions) is where unnamed concepts go to hide: a function that reads a value is a method of that value object, a decision over several objects a domain service, a shared shape of data a value object, an interchangeable rule an abstract class of domain/services with one service per variant (docs/ARCHITECTURE.md, a concept with no role of its own). A real new need is declared in extraDirectories with its reason. In the declared style the generated summary <context>.declarations.ts lives at the root of the context, next to CONTEXT.md, and the generated <layer>.declarations.ts of each layer in that layer; a module file may stay at the root when the wiring of a context is unusual.',
|
|
4
4
|
bad: `contexts/billing/domain/utils/rounding.ts`,
|
|
5
5
|
good: `contexts/billing/domain/value-objects/money.vo.ts
|
|
6
6
|
contexts/billing/billing.declarations.ts // declared style only
|
|
7
|
-
contexts/billing/application/
|
|
7
|
+
contexts/billing/application/application.declarations.ts // declared style only`,
|
|
8
8
|
},
|
|
9
9
|
'tree/context-doc': {
|
|
10
10
|
why: 'CONTEXT.md is where the vocabulary and the boundaries are agreed with the domain experts. Without it, names drift and nobody can tell whether a concept belongs here. The classification says how much design effort the context deserves.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-docs.js","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,aAAa,EAAE;QACb,GAAG,EAAE
|
|
1
|
+
{"version":3,"file":"tree-docs.js","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,aAAa,EAAE;QACb,GAAG,EAAE,+0BAA+0B;QACp1B,GAAG,EAAE,2CAA2C;QAChD,IAAI,EAAE;;yFAE+E;KACtF;IACD,kBAAkB,EAAE;QAClB,GAAG,EAAE,4OAA4O;QACjP,GAAG,EAAE,6GAA6G;QAClH,IAAI,EAAE,6GAA6G;KACpH;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,83BAA83B;QACn4B,GAAG,EAAE,iHAAiH;QACtH,IAAI,EAAE,2HAA2H;KAClI;IACD,eAAe,EAAE;QACf,GAAG,EAAE,y3BAAy3B;QAC93B,GAAG,EAAE,8BAA8B;QACnC,IAAI,EAAE;;;;qEAI2D;KAClE;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,kyBAAkyB;QACvyB,GAAG,EAAE;;;;kCAIyB;QAC9B,IAAI,EAAE;;;;;oCAK0B;KACjC;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,svCAAsvC;QAC3vC,GAAG,EAAE;;;EAGP;QACE,IAAI,EAAE;;;EAGR;KACC;IACD,6BAA6B,EAAE;QAC7B,GAAG,EAAE,kYAAkY;QACvY,GAAG,EAAE;;;;;;;2CAOkC;QACvC,IAAI,EAAE;;;4BAGkB;KACzB;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,kaAAka;QACva,GAAG,EAAE,kFAAkF;QACvF,IAAI,EAAE,qCAAqC;KAC5C;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,y9BAAy9B;QAC99B,GAAG,EAAE;;;uBAGc;QACnB,IAAI,EAAE;;;;;;uFAM6E;KACpF;IACD,eAAe,EAAE;QACf,GAAG,EAAE,4SAA4S;QACjT,GAAG,EAAE;gDACuC;QAC5C,IAAI,EAAE;qDAC2C;KAClD;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,gUAAgU;QACrU,GAAG,EAAE,iFAAiF;QACtF,IAAI,EAAE;8BACoB;KAC3B;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,uvBAAuvB;QAC5vB,GAAG,EAAE;qFAC4E;QACjF,IAAI,EAAE;;;KAGL;KACF;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,yqBAAyqB;QAC9qB,GAAG,EAAE,yEAAyE;QAC9E,IAAI,EAAE;qFAC2E;KAClF;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/wiring-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"wiring-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/wiring-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgHzD,CAAC"}
|
|
@@ -30,29 +30,30 @@ export class IssueInvoiceHandler {}
|
|
|
30
30
|
export class InvoiceIssuedEventHandler {}`,
|
|
31
31
|
},
|
|
32
32
|
'declarations/barrel-current': {
|
|
33
|
-
why: 'With stack.assembly set to barrel, the composition root assembles a context from <context>.declarations.ts and from nothing else. That file only re-exports the generated <
|
|
34
|
-
bad: `// application/
|
|
33
|
+
why: 'With stack.assembly set to barrel, the composition root assembles a context from <context>.declarations.ts and from nothing else. That file only re-exports the generated <layer>.declarations.ts of each layer of the context that holds a role file (application/application.declarations.ts, infrastructure/infrastructure.declarations.ts, presentation/presentation.declarations.ts), in each module of its model. A role file added by hand and missing from the declarations of its layer compiles, passes its unit tests and is never registered. The same file registers what each constructor of its layer is injected, read from its signature: a constructor changed without regenerating would be given the dependencies of the old one. Each file is derived from the tree, one export per role file sorted by path then one injected(Class, [Tokens]) per class that takes something, so it is compared with what the tree says, and the message names the class whose list is stale; the declarations of a layer that holds no role file any more are reported until they are deleted. A context still declared as an earlier version wrote it, exactly as that version would write it for the current tree, is a warning in this version, not an error: the single <context>.declarations.ts of 0.84, or one <folder>.declarations.ts per role folder as 0.85 and 0.86 wrote them (application/commands/commands.declarations.ts); ddd-ts-kit docs moves it to the files of its layers, and a later minor version reports it as an error. With stack.assembly set to discovery the role files are found at startup, <context>.dependencies.ts holds the lists alone and is compared the same way, and generated declarations left behind are reported.',
|
|
34
|
+
bad: `// application/application.declarations.ts, while IssueInvoiceHandler now also takes a Clock
|
|
35
35
|
export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command';
|
|
36
36
|
export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.handler';
|
|
37
37
|
|
|
38
38
|
injected(IssueInvoiceHandler, [InvoiceRepository]);
|
|
39
39
|
|
|
40
|
-
//
|
|
41
|
-
export * from '@/contexts/billing/application/commands/
|
|
42
|
-
good: `// application/
|
|
40
|
+
// application/application.declarations.ts, while application/authorization/only-issuer-voids.policy.ts exists
|
|
41
|
+
export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.handler';`,
|
|
42
|
+
good: `// application/application.declarations.ts, rewritten by \`ddd-ts-kit generate\`, \`ddd-ts-kit docs\` and \`npm run dev\`
|
|
43
43
|
import { injected } from '@ddd-ts-kit/kernel/declarations';
|
|
44
44
|
import { Clock } from '@ddd-ts-kit/kernel';
|
|
45
45
|
import { IssueInvoiceHandler } from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.handler';
|
|
46
46
|
import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
|
|
47
47
|
|
|
48
|
+
export * from '@/contexts/billing/application/authorization/only-issuer-voids.policy';
|
|
48
49
|
export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command';
|
|
49
50
|
export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.handler';
|
|
50
51
|
|
|
51
52
|
injected(IssueInvoiceHandler, [InvoiceRepository, Clock]);
|
|
52
53
|
|
|
53
54
|
// billing.declarations.ts, the summary the composition root imports
|
|
54
|
-
export * from '@/contexts/billing/application/
|
|
55
|
-
export * from '@/contexts/billing/
|
|
55
|
+
export * from '@/contexts/billing/application/application.declarations';
|
|
56
|
+
export * from '@/contexts/billing/infrastructure/infrastructure.declarations';`,
|
|
56
57
|
},
|
|
57
58
|
'declarations/constructor-injection': {
|
|
58
59
|
why: 'The constructor signature is the one statement of what a declared class depends on: `ddd-ts-kit docs` reads it and writes the list the composition root injects, so nothing is repeated in the decorator and nothing can disagree with the constructor. That only works when each parameter names exactly one injection token, and a token is a class: an interface, a type alias or a primitive is erased by the compiler, a union names two things, an optional or defaulted parameter says the container might not give a value, which it always does. A constructor inherited from a class of a package cannot be read at all. The compiler is not asked for the types at run time: `emitDecoratorMetadata` exists only with legacy decorators compiled by tsc or swc, not with standard decorators nor under tsx or esbuild. Under "stack.dependencies": "signature" a list left in a decorator is a second statement: it wins at run time, so it is removed when it repeats the constructor (ESLint fixes it) and reported when it differs. A project whose config does not say lists its dependencies in its decorators, as 0.1 did, and may keep doing so.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring-docs.js","sourceRoot":"","sources":["../../../src/check/explain/wiring-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,4BAA4B,EAAE;QAC5B,GAAG,EAAE,qnBAAqnB;QAC1nB,GAAG,EAAE;;;sCAG6B;QAClC,IAAI,EAAE;;;;;;+CAMqC;KAC5C;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,irBAAirB;QACtrB,GAAG,EAAE;;;;;;wBAMe;QACpB,IAAI,EAAE;;;;;0CAKgC;KACvC;IACD,6BAA6B,EAAE;QAC7B,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"wiring-docs.js","sourceRoot":"","sources":["../../../src/check/explain/wiring-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,4BAA4B,EAAE;QAC5B,GAAG,EAAE,qnBAAqnB;QAC1nB,GAAG,EAAE;;;sCAG6B;QAClC,IAAI,EAAE;;;;;;+CAMqC;KAC5C;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,irBAAirB;QACtrB,GAAG,EAAE;;;;;;wBAMe;QACpB,IAAI,EAAE;;;;;0CAKgC;KACvC;IACD,6BAA6B,EAAE;QAC7B,GAAG,EAAE,yqDAAyqD;QAC9qD,GAAG,EAAE;;;;;;;6FAOoF;QACzF,IAAI,EAAE;;;;;;;;;;;;;;+EAcqE;KAC5E;IACD,oCAAoC,EAAE;QACpC,GAAG,EAAE,omCAAomC;QACzmC,GAAG,EAAE;;;;;;;;;iEASwD;QAC7D,IAAI,EAAE;;;;;;;EAOR;KACC;IACD,iCAAiC,EAAE;QACjC,GAAG,EAAE,4nBAA4nB;QACjoB,GAAG,EAAE;+DACsD;QAC3D,IAAI,EAAE;;;;;;;+DAOqD;KAC5D;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,+bAA+b;QACpc,GAAG,EAAE;yIACgI;QACrI,IAAI,EAAE;yIAC+H;KACtI;IACD,cAAc,EAAE;QACd,GAAG,EAAE,kXAAkX;QACvX,GAAG,EAAE;;uEAE8D;QACnE,IAAI,EAAE;;2IAEiI;KACxI;IACD,iCAAiC,EAAE;QACjC,GAAG,EAAE,qMAAqM;QAC1M,GAAG,EAAE,qDAAqD;QAC1D,IAAI,EAAE,qGAAqG;KAC5G;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-policy-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/authz-policy-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"authz-policy-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/authz-policy-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CzC,eAAO,MAAM,qBAAqB,EAAE,SAAS,OAAO,EA+FnD,CAAC"}
|
|
@@ -3,9 +3,9 @@ import { PATHS } from './paths.js';
|
|
|
3
3
|
import { project } from './project.js';
|
|
4
4
|
import { signatureProject } from './signature-project.js';
|
|
5
5
|
import { source } from './source.js';
|
|
6
|
-
const { COMMAND,
|
|
6
|
+
const { COMMAND, APPLICATION_DECLARATIONS, HANDLER, MODULE, POLICY } = PATHS;
|
|
7
7
|
/** The declarations of application/commands/ the generator derives once the handler takes `Access` and the repository in its constructor. */
|
|
8
|
-
const
|
|
8
|
+
const APPLICATION_OF_THE_POLICY = source("import { injected } from '@ddd-ts-kit/kernel/declarations';", "import { IssueInvoiceHandler } from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.js';", "import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository.js';", "import { Access } from '@ddd-ts-kit/auth';", '', "export * from '@/contexts/billing/application/authorization/only-issuer-voids.policy.js';", "export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command.js';", "export * from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.js';", '', 'injected(IssueInvoiceHandler, [Access, InvoiceRepository]);');
|
|
9
9
|
const ISSUE_POLICY = [
|
|
10
10
|
"import { Policy } from '@ddd-ts-kit/kernel/declarations';",
|
|
11
11
|
'',
|
|
@@ -115,6 +115,6 @@ function declaredHandler(body) {
|
|
|
115
115
|
}
|
|
116
116
|
/** The declared issue-invoice use case whose permission a policy refines, its handler written with `body`. */
|
|
117
117
|
function withPolicy(body) {
|
|
118
|
-
return signatureProject(body, { [POLICY]: ISSUE_POLICY, [
|
|
118
|
+
return signatureProject(body, { [POLICY]: ISSUE_POLICY, [APPLICATION_DECLARATIONS]: APPLICATION_OF_THE_POLICY });
|
|
119
119
|
}
|
|
120
120
|
//# sourceMappingURL=authz-policy-fixtures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-policy-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/authz-policy-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"authz-policy-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/authz-policy-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EA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A8H;YAChI,GAAG,OAAO,CACR,sJAAsJ,CACvJ;SACF,CAAC;KACH;CACF,CAAC;AAEF,uEAAuE;AACvE,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO;QACL,iDAAiD;QACjD,mEAAmE;QACnE,wGAAwG;QACxG,uHAAuH;QACvH,EAAE;QACF,sCAAsC;QACtC,oCAAoC;QACpC,gBAAgB;QAChB,sCAAsC;QACtC,mDAAmD;QACnD,QAAQ;QACR,EAAE;QACF,gEAAgE;QAChE,IAAI;QACJ,KAAK;QACL,GAAG;QACH,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,8GAA8G;AAC9G,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC,wBAAwB,CAAC,EAAE,yBAAyB,EAAE,CAAC,CAAC;AACnH,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { PATHS } from './paths.js';
|
|
|
2
2
|
import { SIGNATURE } from './signature.js';
|
|
3
3
|
import { signatureProject } from './signature-project.js';
|
|
4
4
|
import { source } from './source.js';
|
|
5
|
-
const { BILLING,
|
|
5
|
+
const { BILLING, APPLICATION_DECLARATIONS, HANDLER } = PATHS;
|
|
6
6
|
const RULE = 'declarations/constructor-injection';
|
|
7
7
|
const BARE = '@CommandHandler(IssueInvoiceCommand)';
|
|
8
8
|
const SETTINGS = `${BILLING}/application/ports/invoice-settings.port.ts`;
|
|
@@ -21,14 +21,14 @@ export const CONSTRUCTOR_INJECTION_FIXTURES = [
|
|
|
21
21
|
ruleId: RULE,
|
|
22
22
|
name: 'a handler that lists nothing and types each constructor parameter by a port, its barrel registering what was read',
|
|
23
23
|
expect: 'pass',
|
|
24
|
-
files: signatureProject(SIGNATURE.handler, { [
|
|
24
|
+
files: signatureProject(SIGNATURE.handler, { [APPLICATION_DECLARATIONS]: SIGNATURE.declarations }),
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
ruleId: RULE,
|
|
28
28
|
name: 'a parameter typed by a generic class, whose raw class is the token',
|
|
29
29
|
expect: 'pass',
|
|
30
30
|
files: signatureProject(takingInstead('private readonly clock: Clock<Date>'), {
|
|
31
|
-
[
|
|
31
|
+
[APPLICATION_DECLARATIONS]: SIGNATURE.declarations,
|
|
32
32
|
}),
|
|
33
33
|
},
|
|
34
34
|
...REFUSED_PARAMETERS.map(([name, parameter]) => ({
|
|
@@ -86,15 +86,15 @@ export const CONSTRUCTOR_INJECTION_FIXTURES = [
|
|
|
86
86
|
{
|
|
87
87
|
ruleId: 'declarations/barrel-current',
|
|
88
88
|
name: 'declarations whose dependency list was read from a constructor that has changed since',
|
|
89
|
-
expect: { file:
|
|
89
|
+
expect: { file: APPLICATION_DECLARATIONS },
|
|
90
90
|
files: signatureProject(SIGNATURE.handler, {
|
|
91
|
-
[
|
|
91
|
+
[APPLICATION_DECLARATIONS]: SIGNATURE.declarations.replace('[InvoiceRepository, Clock]', '[InvoiceRepository]'),
|
|
92
92
|
}),
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
ruleId: 'declarations/barrel-current',
|
|
96
96
|
name: 'declarations that register no dependency list for a constructor that takes something',
|
|
97
|
-
expect: { file:
|
|
97
|
+
expect: { file: APPLICATION_DECLARATIONS },
|
|
98
98
|
files: signatureProject(SIGNATURE.handler),
|
|
99
99
|
},
|
|
100
100
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructor-injection-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/constructor-injection-fixtures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constructor-injection-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/constructor-injection-fixtures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,EAAE,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAC7D,MAAM,IAAI,GAAG,oCAAoC,CAAC;AAClD,MAAM,IAAI,GAAG,sCAAsC,CAAC;AACpD,MAAM,QAAQ,GAAG,GAAG,OAAO,6CAA6C,CAAC;AACzE,MAAM,YAAY,GAAG,GAAG,OAAO,0BAA0B,CAAC;AAE1D,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,OAAO,GAAsB,SAAS,CAAC,KAAK,EAAU,EAAE,CAChG,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;AAE5E,MAAM,kBAAkB,GAA2C;IACjE,CAAC,wBAAwB,EAAE,mDAAmD,CAAC;IAC/E,CAAC,uBAAuB,EAAE,gCAAgC,CAAC;IAC3D,CAAC,iBAAiB,EAAE,+CAA+C,CAAC;IACpE,CAAC,wBAAwB,EAAE,kCAAkC,CAAC;IAC9D,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;IAC1C,CAAC,0BAA0B,EAAE,gBAAgB,CAAC;CAC/C,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAuB;IAChE;QACE,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,mHAAmH;QACzH,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,gBAAg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;QAC1C,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,OAAO,EAAE;YACzC,CAAC,wBAAwB,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,4BAA4B,EAAE,qBAAqB,CAAC;SAChH,CAAC;KACH;IACD;QACE,MAAM,EAAE,6BAA6B;QACrC,IAAI,EAAE,sFAAsF;QAC5F,MAAM,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE;QAC1C,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC;KAC3C;IACD;QACE,MAAM,EAAE,6BAA6B;QACrC,IAAI,EAAE,oFAAoF;QAC1F,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,WAAW,CAAC;KACpG;IACD;QACE,MAAM,EAAE,6BAA6B;QACrC,IAAI,EAAE,4FAA4F;QAClG,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;QAC9B,KAAK,EAAE,gBAAgB,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC;KAC5D;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/declarations-fixtures.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"declarations-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/declarations-fixtures.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6CzC,eAAO,MAAM,qBAAqB,EAAE,SAAS,OAAO,EAkQnD,CAAC"}
|