ddd-ts-kit 0.92.0 → 0.94.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 +90 -0
- package/README.fr.md +13 -8
- package/README.md +10 -6
- package/dist/acceptance/check-locked-files.d.ts +25 -0
- package/dist/acceptance/check-locked-files.d.ts.map +1 -0
- package/dist/acceptance/check-locked-files.js +84 -0
- package/dist/acceptance/check-locked-files.js.map +1 -0
- package/dist/acceptance/scenarios-in.d.ts +4 -0
- package/dist/acceptance/scenarios-in.d.ts.map +1 -1
- package/dist/acceptance/scenarios-in.js +2 -2
- package/dist/acceptance/scenarios-in.js.map +1 -1
- package/dist/check/authz/modelled-permissions.d.ts +32 -0
- package/dist/check/authz/modelled-permissions.d.ts.map +1 -0
- package/dist/check/authz/modelled-permissions.js +169 -0
- package/dist/check/authz/modelled-permissions.js.map +1 -0
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +4 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/explain/authz-docs.d.ts.map +1 -1
- package/dist/check/explain/authz-docs.js +17 -0
- package/dist/check/explain/authz-docs.js.map +1 -1
- package/dist/check/explain/scheduling-docs.d.ts.map +1 -1
- package/dist/check/explain/scheduling-docs.js +7 -0
- package/dist/check/explain/scheduling-docs.js.map +1 -1
- package/dist/check/fixtures/authz-resource-modelled-fixtures.d.ts +3 -0
- package/dist/check/fixtures/authz-resource-modelled-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/authz-resource-modelled-fixtures.js +194 -0
- package/dist/check/fixtures/authz-resource-modelled-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/scheduling-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/scheduling-fixtures.js +69 -1
- package/dist/check/fixtures/scheduling-fixtures.js.map +1 -1
- package/dist/check/rules/authz-resource-modelled.d.ts +13 -0
- package/dist/check/rules/authz-resource-modelled.d.ts.map +1 -0
- package/dist/check/rules/authz-resource-modelled.js +128 -0
- package/dist/check/rules/authz-resource-modelled.js.map +1 -0
- package/dist/check/rules/scheduling-tenancy-declared.d.ts +3 -0
- package/dist/check/rules/scheduling-tenancy-declared.d.ts.map +1 -0
- package/dist/check/rules/scheduling-tenancy-declared.js +45 -0
- package/dist/check/rules/scheduling-tenancy-declared.js.map +1 -0
- package/dist/check/scheduling/job-names.d.ts +1 -1
- package/dist/check/scheduling/job-names.d.ts.map +1 -1
- package/dist/check/scheduling/job-names.js +3 -21
- package/dist/check/scheduling/job-names.js.map +1 -1
- package/dist/check/scheduling/jobs-declared.d.ts +11 -0
- package/dist/check/scheduling/jobs-declared.d.ts.map +1 -0
- package/dist/check/scheduling/jobs-declared.js +24 -0
- package/dist/check/scheduling/jobs-declared.js.map +1 -0
- package/dist/commands/acceptance.d.ts.map +1 -1
- package/dist/commands/acceptance.js +14 -0
- package/dist/commands/acceptance.js.map +1 -1
- package/dist/commands/generate.js +2 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commit/run-git.d.ts +5 -1
- package/dist/commit/run-git.d.ts.map +1 -1
- package/dist/commit/run-git.js +19 -2
- package/dist/commit/run-git.js.map +1 -1
- package/dist/controllers/finish-migration.js +4 -2
- package/dist/controllers/finish-migration.js.map +1 -1
- package/dist/docs/behaviour-page.d.ts.map +1 -1
- package/dist/docs/behaviour-page.js +9 -1
- package/dist/docs/behaviour-page.js.map +1 -1
- package/dist/generate/access-vars.js +18 -0
- package/dist/generate/access-vars.js.map +1 -1
- package/dist/generate/kind.d.ts +2 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/job/grant-system-actor.js +2 -2
- package/dist/generate/kinds/job/grant-system-actor.js.map +1 -1
- package/dist/generate/kinds/job/job-vars.d.ts +4 -1
- package/dist/generate/kinds/job/job-vars.d.ts.map +1 -1
- package/dist/generate/kinds/job/job-vars.js +11 -1
- package/dist/generate/kinds/job/job-vars.js.map +1 -1
- package/dist/generate/kinds/job-kind.js +20 -3
- package/dist/generate/kinds/job-kind.js.map +1 -1
- package/dist/generate/kinds/service-kind.d.ts.map +1 -1
- package/dist/generate/kinds/service-kind.js +30 -3
- package/dist/generate/kinds/service-kind.js.map +1 -1
- package/dist/init/files/inert-persistence-file.d.ts +5 -0
- package/dist/init/files/inert-persistence-file.d.ts.map +1 -0
- package/dist/init/files/inert-persistence-file.js +16 -0
- package/dist/init/files/inert-persistence-file.js.map +1 -0
- package/dist/init/files/platform-files.js +7 -1
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/measures/branch-commits.d.ts +4 -2
- package/dist/measures/branch-commits.d.ts.map +1 -1
- package/dist/measures/branch-commits.js +32 -8
- package/dist/measures/branch-commits.js.map +1 -1
- package/dist/measures/timeline-of.d.ts +3 -2
- package/dist/measures/timeline-of.d.ts.map +1 -1
- package/dist/measures/timeline-of.js +37 -8
- package/dist/measures/timeline-of.js.map +1 -1
- package/dist/platform-layout/platform-layout.d.ts +3 -0
- package/dist/platform-layout/platform-layout.d.ts.map +1 -1
- package/dist/platform-layout/platform-layout.js +3 -0
- package/dist/platform-layout/platform-layout.js.map +1 -1
- package/dist/presets/apply-preset.d.ts.map +1 -1
- package/dist/presets/apply-preset.js +4 -0
- package/dist/presets/apply-preset.js.map +1 -1
- package/dist/presets/no-flags.d.ts.map +1 -1
- package/dist/presets/no-flags.js +1 -0
- package/dist/presets/no-flags.js.map +1 -1
- package/dist/presets/organisations-as-tenant-directory.d.ts +10 -0
- package/dist/presets/organisations-as-tenant-directory.d.ts.map +1 -0
- package/dist/presets/organisations-as-tenant-directory.js +16 -0
- package/dist/presets/organisations-as-tenant-directory.js.map +1 -0
- package/dist/progress/build-next-of.d.ts +9 -0
- package/dist/progress/build-next-of.d.ts.map +1 -0
- package/dist/progress/build-next-of.js +22 -0
- package/dist/progress/build-next-of.js.map +1 -0
- package/dist/progress/format-progress.d.ts.map +1 -1
- package/dist/progress/format-progress.js +3 -0
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/progress/progress.d.ts +3 -1
- package/dist/progress/progress.d.ts.map +1 -1
- package/dist/progress/read-progress.d.ts.map +1 -1
- package/dist/progress/read-progress.js +7 -2
- package/dist/progress/read-progress.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/templates/architecture/extractable.declared.spec.ts.tpl +2 -2
- package/templates/architecture/extractable.manual.spec.ts.tpl +2 -2
- package/templates/architecture/extractable.tsyringe.spec.ts.tpl +2 -2
- package/templates/architecture/hosting.declared.spec.ts.tpl +69 -0
- package/templates/architecture/hosting.manual.spec.ts.tpl +57 -0
- package/templates/architecture/hosting.tsyringe.spec.ts.tpl +69 -0
- package/templates/command/command.ts.tpl +3 -0
- package/templates/file-upload/command.ts.tpl +3 -0
- package/templates/init/docker/env.example.tpl +9 -0
- package/templates/init/gitignore.tpl +3 -0
- package/templates/init/main.ts.tpl +27 -20
- package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +11 -3
- package/templates/init/platform/auth/relationships/relationship-schema.ts.tpl +24 -9
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +25 -4
- package/templates/init/platform/composition/compose-application.tsyringe.ts.tpl +47 -65
- package/templates/init/platform/composition/context-selection.tsyringe.ts.tpl +17 -0
- package/templates/init/platform/composition/lay-foundations.manual.ts.tpl +13 -2
- package/templates/init/platform/composition/platform-options.manual.ts.tpl +9 -0
- package/templates/init/platform/composition/routes-of.tsyringe.ts.tpl +51 -0
- package/templates/init/platform/composition/tenant-directory.ts.tpl +14 -0
- package/templates/init/platform/config/app-config.ts.tpl +7 -0
- package/templates/init/platform/config/load-config.ts.tpl +25 -0
- package/templates/init/platform/files/files.module.tsyringe.ts.tpl +6 -2
- package/templates/init/platform/jobs/job-settings.ts.tpl +13 -3
- package/templates/init/platform/privacy/privacy.module.tsyringe.ts.tpl +9 -6
- package/templates/init/platform/redis/open-redis.ts.tpl +13 -8
- package/templates/init/scripts/privacy-erase.manual.ts.tpl +18 -8
- package/templates/init/scripts/privacy-erase.tsyringe.ts.tpl +18 -8
- package/templates/init/scripts/privacy-export.manual.ts.tpl +17 -7
- package/templates/init/scripts/privacy-export.tsyringe.ts.tpl +17 -7
- package/templates/job/job.declared.ts.tpl +1 -1
- package/templates/job/job.spec.buses.ts.tpl +3 -0
- package/templates/job/job.spec.tsyringe.ts.tpl +29 -1
- package/templates/job/wiring.manual.tpl +3 -0
- package/templates/job/wiring.tsyringe.tpl +1 -1
- package/templates/pipeline/biome.json.tpl +7 -0
- package/templates/pipeline/github/workflows/ci.yml.tpl +2 -0
- package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +2 -0
- package/templates/pipeline/knip.json.tpl +1 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation-tenant-directory.reader.drizzle.ts.tpl +26 -0
- package/templates/presets/identity/context/infrastructure/persistence/knex-organisation-tenant-directory.reader.knex.ts.tpl +30 -0
- package/templates/presets/identity/context/infrastructure/persistence/prisma-organisation-tenant-directory.reader.prisma.ts.tpl +25 -0
- package/templates/presets/identity/context/test/integration/organisation-tenant-directory.spec.ts.tpl +107 -0
- package/templates/presets/identity/platform/tenant-directory.ts.tpl +13 -0
- package/templates/query/query.ts.tpl +3 -0
- package/templates/service/compose.tpl +1 -1
- package/templates/service/extracted-name.tpl +2 -0
- package/templates/service/extracted.declared.tpl +6 -0
- package/templates/service/extracted.manual.tpl +2 -0
- package/templates/service/extracted.tsyringe.tpl +6 -0
- package/templates/service/main.ts.tpl +5 -1
- package/templates/worker/main.ts.tpl +20 -13
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,96 @@ 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.94.0
|
|
8
|
+
|
|
9
|
+
**The rules of `@ddd-ts-kit/eslint-plugin` run whole when Oxlint loads the plugin as a JS plugin.** Oxlint hands a rule no type information and a parser that parses nothing. `naming-business-name` threw there, which stopped every rule of the kit on the file (303 of 985 files of a generated application); it now reads the names of the code when the linter offers no parser services, as it already did without a program. `clean-no-commented-out-code`, `language-declared-vocabulary`, `authz-declared` and `ports-implements-never-extends`, which parse a text of their own, reported nothing under Oxlint; they now parse with the parser of typescript-eslint when the run configured none (or only the stand-in of Oxlint). The findings under ESLint do not change. On the copy of the example with every rule of the catalogue broken once, Oxlint reports the 77 injections ESLint reports, each at the same place.
|
|
10
|
+
|
|
11
|
+
**Under relationships, a permission modelled on an element is no longer held by the operators of the context, and a use case on the context says so.** `generate command` and `generate query` write, next to the `{ type: 'context', id: '<context>' }` resource, a `TODO(domain)` naming the element the permission is checked on (`{ type: '<aggregate>', id: <message>.<aggregate>Id }`), so `ddd-ts-kit todo` and `status` list it until the resource names it; a search keeps the context. The schema written by `init` derives on `context` only the permissions no element derives: the elements go in `elements` of `relationships/relationship-schema.ts`, and a permission derived there leaves the operators of the context, where it used to be granted to all of them whatever the element. The access-control skill and the guide on choosing access control say when the context is the right resource.
|
|
12
|
+
|
|
13
|
+
`authz/resource-modelled` (an error under relationships, from the first day) reports a requirement whose resource is the context for a permission the relationship schema derives on an element type, and a search whose gate is on the context while its scope asks the same permission derived on the element; it reads the types written in `elements` or in place in `defineSchema`, and reports a schema or a resource it cannot read.
|
|
14
|
+
|
|
15
|
+
To move: in a project generated earlier, open `relationships/relationship-schema.ts`: move the types of the elements out of `defineSchema` into an `elements` object and derive on `context` only `permissions.all()` minus the ids those elements derive (the template of `init` shows it), then replace each context resource by the element the use case is about. A search whose requirement and scope use the same permission needs two: one on the context, one on the element. Then run `ddd-ts-kit check`: name the element in each reported requirement, give a search two permissions (one on the context to run it, one on the element for the scope), or make the schema readable (an object literal given to `defineSchema`, derived keys as `[<context>Permissions['<permission>'].id]`).
|
|
16
|
+
|
|
17
|
+
**`generate job` under relationships relates the system actor of the job as `system:<job>`, not `system:system:<job>`.**
|
|
18
|
+
|
|
19
|
+
The tuple written in `platform/auth/relationships/relate-system-actors.ts` carried the prefix
|
|
20
|
+
twice, so the actor of the job (`system:<context>.<job>`) held no right and every run was refused
|
|
21
|
+
`FORBIDDEN` before its handler ran.
|
|
22
|
+
|
|
23
|
+
To move: a job generated before this version has `system:system:` in its line of
|
|
24
|
+
`relate-system-actors.ts`: remove one `system:`.
|
|
25
|
+
|
|
26
|
+
**With the identity preset, a per-tenant job runs for every organisation, including one opened after the process started.**
|
|
27
|
+
|
|
28
|
+
Until now `init` gave the scheduler the tenants of `TENANTS`, read once when the process
|
|
29
|
+
started: an organisation created later (a sign-up, an operator) never got the run of a per-tenant
|
|
30
|
+
job (a reminder, a purge, a deadline), with no error and no log. `init` under tenancy now writes
|
|
31
|
+
`src/platform/composition/tenant-directory.ts`, the one place the scheduler's `TenantDirectory`
|
|
32
|
+
is made; `--preset identity` (and `generate context --preset identity`) replaces it by a
|
|
33
|
+
directory that reads the organisations of the identity context from the database at each
|
|
34
|
+
occurrence, on Drizzle, Knex and Prisma (the preset refuses TypeORM). A project with tenancy and
|
|
35
|
+
no source of tenants keeps `TENANTS`, and the documentation says plainly that a fixed list misses
|
|
36
|
+
a tenant created later. The adapter is integration-tested on PostgreSQL, including an
|
|
37
|
+
organisation opened after the first read and, on tsyringe, its run of a per-tenant job.
|
|
38
|
+
|
|
39
|
+
`privacy:erase` and `privacy:export` go through the same directory: with the identity preset they
|
|
40
|
+
reach the organisations of the database, not only the tenants of `TENANTS`, and they refuse to
|
|
41
|
+
run when the directory lists none.
|
|
42
|
+
|
|
43
|
+
A per-tenant run reading its own tenant only is now proven end to end on the real tenant-scoped
|
|
44
|
+
repository of a generated multi-tenant project, and the generated job spec points to that
|
|
45
|
+
pattern where it kept an `it.todo`.
|
|
46
|
+
|
|
47
|
+
To move: a project with tenancy regenerates its platform; a project that already holds the
|
|
48
|
+
identity preset and tenancy replaces `src/platform/composition/tenant-directory.ts` (or, before
|
|
49
|
+
this version, the `InMemoryTenantDirectory` bound in `compose-application.ts` or
|
|
50
|
+
`lay-foundations.ts`) by a directory over `<Orm>OrganisationTenantDirectory`. `TENANTS` is no
|
|
51
|
+
longer read once the organisations are the tenants.
|
|
52
|
+
|
|
53
|
+
**`scheduling/tenancy-declared` reports a job that does not say whether it runs per tenant or globally.** In a project whose `stack.tenancy` is not `none`, the options of every `@Scheduled(..)` and `builder.job(..)` must carry `tenancy: 'per-tenant'` or `tenancy: 'global'`. A job that leaves it out runs globally, in no tenant, as a system actor that names none, and a tenant-scoped repository refuses it at run time (`NoCurrentTenantError`) while the specs on fakes stay green. An error from the first day, with the fix in the message; what the checker cannot read (options that are not an object literal, a spread, a `tenancy` that is not a literal) is reported, never passed. The jobs `init` registers in the platform (`files.purge-staged`, `privacy.purge-expired`, `audit.archive`) now write `tenancy: 'global'`, which is what they already did by default.
|
|
54
|
+
|
|
55
|
+
To move: run `ddd-ts-kit check` in a project under tenancy and add `tenancy: 'per-tenant'` to each reported job that reads or writes tenant data (the `TenantDirectory` must be bound so the scheduler can list the tenants), or `tenancy: 'global'` to a job that works across tenants and reaches no tenant-scoped repository.
|
|
56
|
+
|
|
57
|
+
**The mutation job of a merge request or pull request in a generated project reuses the report of the night.** The night runs Stryker without a base, so it writes `reports/mutation/mutation.json` and no incremental file, and the job of a change that downloaded that report found nothing to reuse: it logged "No incremental result file found" and ran every mutant. The job now copies the json report to `reports/mutation/incremental.json` before it runs, the same object Stryker reads back, and mutates what the change touches only. On the example of the kit this takes the job from 1,133 s to about 140 s.
|
|
58
|
+
|
|
59
|
+
To move: in a project generated before this version, add one step after the download of the report of the night, in the `mutation-changed` job of `.github/workflows/ci.yml` or the `mutation_changed` job of `.gitlab-ci.yml`: `if [ -f reports/mutation/mutation.json ]; then cp reports/mutation/mutation.json reports/mutation/incremental.json; fi`. Or run `ddd-ts-kit init` in a scratch copy and take the job from there.
|
|
60
|
+
|
|
61
|
+
## 0.93.0
|
|
62
|
+
|
|
63
|
+
**The behaviour pages of `ddd-ts-kit docs` no longer open a rule with the row ids and criteria of its title.** A regression spec named `#FIX1 escalates ...` or an acceptance scenario named `#US1.04 AC1 a member declares ...` is written in `docs/behaviour/` as `escalates ...` and `a member declares ...`, read with the patterns `acceptance` uses for rows and criteria; the rest of the title is kept as it is.
|
|
64
|
+
|
|
65
|
+
To move: run `ddd-ts-kit docs` once to rewrite the pages.
|
|
66
|
+
|
|
67
|
+
**`todo` and `status` no longer count an `it.todo` in `test/architecture/extractable.spec.ts`.** The spec kept one in the branch for a project with no context, which never runs once a context exists, so a gate that wants nothing left had to explain it away. The branch is now a passing case, `has no context to wire alone yet`, in the three variants of the template (tsyringe, declared, manual); Jest still gets no table without rows.
|
|
68
|
+
|
|
69
|
+
To move: a project already generated keeps its `it.todo` until the spec is regenerated, or replace that line by `it('has no context to wire alone yet', () => expect(contexts).toHaveLength(0));`.
|
|
70
|
+
|
|
71
|
+
**`measures` reads a history of any size and finds the merge that closes a story, whatever its subject.** `runGit` no longer stops at the 1 MB of output `spawnSync` allows by default (a git that cannot answer is now an error that says so, not an empty answer that made every story read "not committed"), and `branchCommits` asks the files only of `docs/architecture` and `test/acceptance`, so a store versioned once in the history does not weigh on it. The lead time ends at the close of the story: the first commit of the first-parent history that contains the last commit of the story, whether a merge commit with any subject or a squash; the merge of the trunk into the story branch (`merge-trunk`) is never taken for it, and a story with no report is not closed.
|
|
72
|
+
|
|
73
|
+
**`status` no longer repeats the `Next:` line of the plan after the build has moved on.** At step 7 (the build) no skill rewrites that line row by row, so it kept naming the first row after all of them were done. `status` now derives the next step from `docs/architecture/slices.md`: the next row ready on the trunk, or `7 build done: close step 7 in docs/architecture/plan.md (Next: done)` once every row is done. The line of the plan is printed beside it when the two disagree, and `planNext` carries it in `--json` (`next` is the derived one). The `start` skill says that at step 7 the line is derived.
|
|
74
|
+
|
|
75
|
+
**The `biome.json`, `knip.json` and `.gitignore` of `init` ignore what is not the project.** The Claude Code sandbox leaves empty files in the project (`.mcp.json`, `.claude/launch.json`, `.claude/settings.local.json`, dotfiles), and installs under it may write a pnpm store there: `biome format` failed on the empty JSON files and warned on the broken links of `.pnpm-store/`, and Knip failed loading the empty `.mcp.json`. `biome.json` now reads the git ignore file and skips `.claude` and `.mcp.json`, `knip.json` sets `"mcp": false`, and `.gitignore` lists `.pnpm-store/` with pnpm. The guide on sandboxing agents says which files the sandbox leaves, and the read-only `.git/config.lock` to delete outside it.
|
|
76
|
+
|
|
77
|
+
To move: in a project written before this change, add `"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }` and the entries `"!**/.claude"` and `"!.mcp.json"` to `biome.json`, `"mcp": false` to `knip.json`, and `.pnpm-store/` to `.gitignore` with pnpm (or run `init --force`, which rewrites the files).
|
|
78
|
+
|
|
79
|
+
**`generate service` writes a docker-compose.yml that Docker reads.** The compose service took `"${{service.portVariable}}:3000"` literally, because the templates keep every `${{ ... }}` for the expressions of a GitHub workflow, and `docker compose config` refused it. The port is now `"${PAGING_PORT:-3001}:3000"`: the service listens on the variable of its context, 3001 by default.
|
|
80
|
+
|
|
81
|
+
To move: a compose file written by an earlier `generate service` holds `${{service.portVariable}}`; replace it with `${<CONTEXT>_PORT:-3001}` (the context in upper snake case).
|
|
82
|
+
|
|
83
|
+
**A locked regression spec of a fix can be amended by the session, and `acceptance --lock` refuses a spec that fails the formatter or the linter.** The guard used to refuse every write to a locked regression spec, by the session and by sub-agents alike, so the `acceptance-judge` agent never had a new version to rule on and a spec that failed the lint could never be corrected. Now the main session of the fix may write a new version (with the editor tools or a formatter or `eslint --fix` in the shell), a sub-agent still may not; `npx ddd-ts-kit acceptance <code>` reports the change since the lock, and `--lock` takes it only with an `amend` verdict of the judge (a change of layout alone needs none, the fingerprint ignores white space). `acceptance <code> --lock` also runs the formatter (the `format` script, in check mode) and the linter (the `lint` script) of the project on the files it locks, the regression specs of a fix or the acceptance spec of a story, and refuses to lock while they fail, naming the file and what the tool reports. A project without those scripts or tools is locked as before. The `fix`, `story` and `testing` skills say to format and lint the spec before locking, and what the session does when a locked spec turns out wrong.
|
|
84
|
+
|
|
85
|
+
**`generate job` writes a job that runs once per tenant in a project with tenancy, and `init` gives the scheduler the tenants.** A job without `tenancy` is global: it runs in no tenant, its command carries a system actor that names none, and a tenant-scoped repository threw `NoCurrentTenantError` on every real run, while the generated spec (fakes, a recorded command) stayed green. Under `stack.tenancy`, `generate job` now writes `tenancy: 'per-tenant'` (`--global` writes `tenancy: 'global'` for work across tenants, refused in a project without tenancy), says which it wrote, and its spec runs the occurrence for two tenants. `init` reads `TENANTS` (comma separated tenant ids, validated at start) into `config.tenants`, passes it as `tenants` to `composeApplication` and binds an `InMemoryTenantDirectory` on the scheduler, so a hand-written `tenancy: 'per-tenant'` no longer throws `InvalidJobScheduleError` at boot. `src/main.ts`, the worker and the services pass `tenants: config.tenants`. On tsyringe, `compose-application.ts` was at the size limit of the checker: `ContextSelection` now lives in `composition/context-selection.ts` and, with an HTTP framework, `routesOf` in `composition/routes-of.ts`.
|
|
86
|
+
|
|
87
|
+
To move: in a project under tenancy, add `tenancy: 'per-tenant'` to each `@Scheduled` (or the `tenancy` key of `platform.jobs.register` on a hand-wired platform) whose use case reads a tenant-scoped repository, list the tenants in `TENANTS` of the environment, and run `ddd-ts-kit init --force` to receive `config.tenants`, the `tenants` option and the binding (or add them by hand: `tenants: new InMemoryTenantDirectory(options.tenants ?? [])` in `kernelModule`, `tenants: config.tenants` in the entry points).
|
|
88
|
+
|
|
89
|
+
**`generate service` takes the context out of the application of `src/main.ts` and the worker.** The entry point of the service composed the context, but `everyContext` still listed it and `src/main.ts` composed `everyContext`, so the API and the service both subscribed its durable consumers, drove its process store and scheduled its jobs. The root now exports `everyContext` (the full list: the tools, the generated contracts, the end-to-end tests) and `hostedContexts` (every context but those run as services, read from the `extracted` regions `generate service` fills with the module and the routes of the context); `src/main.ts` and the worker compose `hostedContexts`, and `jobSettings(env)` leaves out the jobs of the extracted contexts. `generate service` also writes `test/architecture/hosting.spec.ts`, which composes both roots and fails when a module, a consumer, a process or a job of a service is registered in the whole application, when a consumer is registered twice, or when the entry point of a service does not leave the jobs of the platform to the whole application.
|
|
90
|
+
|
|
91
|
+
To move: run `ddd-ts-kit init --force` (the new root, `main.ts`, the worker), pass `hostedContexts` as the third argument of `composeApplication` in `src/main.ts` and `src/apps/worker/main.ts`, and for each context already run as a service add its module (its name on tsyringe, its `<context>Module` on a hand-wired platform) and its routes to the `extracted` regions of `compose-application.ts`, its name to the `extracted` region of `src/platform/jobs/job-settings.ts`; copy `test/architecture/hosting.spec.ts` from a fresh project, whose `extracted` region lists the services.
|
|
92
|
+
|
|
93
|
+
**A service no longer runs the jobs of the platform, and the processes of one deployment share the namespace of their Redis keys.** `composeApplication` always added the audit and privacy modules, so a service written by `generate service` scheduled `audit.archive` and `privacy.purge-expired` (and `files.purge-staged`) with the defaults of the kernel, `enabled: true`, since `jobSettings(env, '<context>')` kept only `<context>.*`: `JOB_AUDIT_ARCHIVE_ENABLED=false` did not reach it, and an archive that removes entries from the database ran onto the disk of the service. The platform jobs now belong to the whole application: `ApplicationOptions.platformJobs` (default `true`) is `false` in the entry point of a service, and `auditModule`, `privacyModule` and `filesModule` (or `registerPlatformJobs` on a hand-wired platform) register their job only when it is on. The lock, the cache, the rate limiter, the relay signal and the Redis job store took `OTEL_SERVICE_NAME`, which a deployment sets per container, so the API and a service held different locks and ran the same occurrence on one database: they now take `DEPLOYMENT_NAME` (`config.deploymentName`, the project name when left out), while `OTEL_SERVICE_NAME` keeps naming the container in the traces. `test/architecture/hosting.spec.ts` composes the root of a service and fails when it registers a job of the platform or of another context.
|
|
94
|
+
|
|
95
|
+
To move: set the same `DEPLOYMENT_NAME` in every container of a deployment (the cache, the lock and the job store keep their old keys only if it equals the old `OTEL_SERVICE_NAME` of the API); in each `src/apps/<context>/main.ts` add `platformJobs: false` beside `jobs`; run `ddd-ts-kit init --force` for the modules and the configuration, and `openRedis(config)` now reads `config.deploymentName`.
|
|
96
|
+
|
|
7
97
|
## 0.92.0
|
|
8
98
|
|
|
9
99
|
**What a method of a Nest controller takes is its signature too: `@Body() body: IssueInvoiceBody` is read into the generated `<context>.controllers.ts`, and `@KitRoute` no longer gives `request`.**
|
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:1a299156421ce74c -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit
|
|
5
5
|
|
|
@@ -809,7 +809,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
809
809
|
donne à chaque acteur système (`systemRole`) ; `--authz abac`, une règle
|
|
810
810
|
`permit('system-<job>', [permission], ({ actor }) => actor.id === 'system:<job>')` dans
|
|
811
811
|
`platform/auth/attributes/attribute-policies.ts` ; `--authz rebac`, le tuple
|
|
812
|
-
`context:<context>#operator@system
|
|
812
|
+
`context:<context>#operator@system:<job>` dans `platform/auth/relationships/relate-system-actors.ts`,
|
|
813
813
|
écrit dans le magasin de tuples au démarrage de l'application, tant que le schéma laisse encore
|
|
814
814
|
un sujet `system` opérer un contexte. Avec `--authz custom`, une région supprimée, un schéma de
|
|
815
815
|
relations remodelé ou une permission que le générateur ne sait pas lire, rien n'est écrit et le
|
|
@@ -962,7 +962,7 @@ Régénère ce qui dérive de la configuration et du code, et rien d'autre :
|
|
|
962
962
|
par l'équipe garde ses lignes, le bloc ajouté à leur suite ; sans aucun propriétaire, rien
|
|
963
963
|
n'est écrit.
|
|
964
964
|
|
|
965
|
-
`--behaviour` n'écrit que les pages de `docs/behaviour/`, tout autre document généré laissé tel quel : c'est ce que lance le *hook* de pre-commit quand une *spec* est indexée ; avec `--check`, seules ces pages sont comparées.
|
|
965
|
+
`--behaviour` n'écrit que les pages de `docs/behaviour/`, tout autre document généré laissé tel quel : c'est ce que lance le *hook* de pre-commit quand une *spec* est indexée ; avec `--check`, seules ces pages sont comparées. Une règle est écrite comme son titre sans les identifiants de ligne et les critères qui l'ouvrent (`#FIX1 `, `#US1.04 AC1 `), qui la datent du changement qui l'a apportée et ne disent rien à un lecteur métier.
|
|
966
966
|
|
|
967
967
|
`--stored-events` enregistre aussi dans `stored-events.lock.json` la forme de chaque version d'un
|
|
968
968
|
événement stocké déclarée dans les codecs de `infrastructure/persistence/`, sans jamais réécrire
|
|
@@ -1232,7 +1232,7 @@ ddd-ts-kit todo [<context>]
|
|
|
1232
1232
|
`status` affiche la ligne `Next:` de `docs/architecture/plan.md`, les lignes de
|
|
1233
1233
|
`docs/architecture/slices.md` par statut et par responsable, et par contexte les `TODO(domain)`,
|
|
1234
1234
|
`TODO(platform)` et `it.todo` restants, puis ceux hors des contextes. Un fichier manquant n'est
|
|
1235
|
-
pas une erreur. Chaque ligne qui n'est pas faite dit si elle peut commencer : prête sur le tronc
|
|
1235
|
+
pas une erreur. Quand le plan est à l'étape 7 (la construction), la ligne `Next:` est déduite des lignes (la prochaine ligne prête sur le tronc, ou `7 build done` quand toutes sont faites) et la ligne du plan est affichée à côté, `planNext` dans `--json`. Chaque ligne qui n'est pas faite dit si elle peut commencer : prête sur le tronc
|
|
1236
1236
|
quand toutes ses dépendances sont faites, prête sur une branche quand chaque dépendance non faite
|
|
1237
1237
|
est une ligne confiée à un *worker* dont le *worktree* a des *commits* d'avance sur sa base (les
|
|
1238
1238
|
`rows` de son `.ddd-ts-kit/worker.json`, tels que `status --workers` les lit), et en attente
|
|
@@ -1240,7 +1240,7 @@ sinon, avec les identifiants qu'elle attend. Une story ou un jalon dont toutes l
|
|
|
1240
1240
|
faites mais que des marqueurs qui lui appartiennent gardent ouvert a sa propre ligne (seuls les
|
|
1241
1241
|
marqueurs qui peuvent garder une telle story ouverte passent par git blame, un appel par fichier), avec la commande qui les liste :
|
|
1242
1242
|
`story M1: every row done, 3 markers left: npx ddd-ts-kit story-check M1` (voir
|
|
1243
|
-
[story-check](#story-check)). `--json` affiche `{ next, slices, remaining }` :
|
|
1243
|
+
[story-check](#story-check)). `--json` affiche `{ next, planNext, slices, remaining }` :
|
|
1244
1244
|
`next` et `slices` valent `null` quand leur fichier manque, `slices` contient
|
|
1245
1245
|
`{ file, rows, byStatus, byOwner, duplicates, unscoped, unclosed }`, `unclosed` valant
|
|
1246
1246
|
`[{ story, markers, command }]`, une ligne non faite portant
|
|
@@ -1377,11 +1377,16 @@ chacun) et refuse tant qu'une spec listée manque ou ne contient aucun test. Un
|
|
|
1377
1377
|
changé ou supprimé est signalé comme l'est un scénario changé, sous le sujet
|
|
1378
1378
|
`test "<title>" of <file>` avec son empreinte, jusqu'à ce que l'agent `acceptance-judge` laisse
|
|
1379
1379
|
passer cette version, le `## Statement` du correctif étant le critère ; un nouveau test n'a
|
|
1380
|
-
besoin que d'un nouveau verrou. `--
|
|
1380
|
+
besoin que d'un nouveau verrou. `--lock` lance aussi le formateur (le script `format`, en mode
|
|
1381
|
+
vérification) et le *linter* (le script `lint`) du projet sur les fichiers qu'il verrouille, les
|
|
1382
|
+
*specs* de régression d'un correctif ou la *spec* d'acceptation d'une *story*, et sur eux seuls : il
|
|
1383
|
+
refuse, en nommant le fichier et ce que l'outil signale, tant qu'ils échouent, puisqu'un fichier
|
|
1384
|
+
verrouillé ne se touche plus. Un projet sans ces scripts ni ces outils est verrouillé comme avant.
|
|
1385
|
+
`--gate passing` tient que chaque test verrouillé est là,
|
|
1381
1386
|
inchangé et plus enveloppé dans `pending(...)` ; c'est le lanceur de tests, pas cette commande,
|
|
1382
1387
|
qui prouve qu'il passe. La garde du plugin lit le même verrou dans le *worktree* d'un correctif
|
|
1383
1388
|
(`"kind": "fix"` dans `.ddd-ts-kit/story.json`) : elle ouvre le code dès que le verrou existe
|
|
1384
|
-
et refuse toute modification d'une spec verrouillée (skill `fix`,
|
|
1389
|
+
et refuse toute modification d'une spec verrouillée par un sous-agent, la session en écrivant une nouvelle version sur laquelle le juge se prononce (skill `fix`,
|
|
1385
1390
|
[parcours d'une story](../../docs/guides/story-workflow.fr.md)).
|
|
1386
1391
|
|
|
1387
1392
|
```
|
|
@@ -1549,7 +1554,7 @@ n'écrit rien et ne demande rien à la plateforme.
|
|
|
1549
1554
|
|---|---|
|
|
1550
1555
|
| temps de conception | du premier *commit* de `docs/architecture/stories/<code>.md` au *commit* de `test/acceptance/<code>.acceptance.lock.json` |
|
|
1551
1556
|
| temps de construction | du *commit* du verrou au premier *commit* dont le `## Report` contient du texte |
|
|
1552
|
-
| délai de livraison | du premier *commit* du fichier de la *story*
|
|
1557
|
+
| délai de livraison | du premier *commit* du fichier de la *story* à la clôture : le premier *commit* de l'historique en premier parent de la branche courante qui contient le dernier *commit* de la *story*, quel que soit son sujet (une fusion, un *squash* ; la fusion du tronc dans la branche de la *story* n'est jamais la clôture) ; `open` sans rapport ou sans clôture |
|
|
1553
1558
|
| retravail des exigences | les *commits* qui ont changé `## Acceptance criteria` après le premier *commit* portant un *trailer* `Slice: <code>.<n>` ; les amendements du verrou (chacun un verdict `amend`) ; les verdicts `refuse` de `test/acceptance/verdicts/` |
|
|
1554
1559
|
| décisions provisoires | les lignes `D<n>` du fichier de la *story* |
|
|
1555
1560
|
| compromis | les éléments sous `### Compromises` du rapport |
|
package/README.md
CHANGED
|
@@ -780,7 +780,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
780
780
|
the role `createAuthorizer` gives every system actor (`systemRole`); `--authz abac`, a
|
|
781
781
|
`permit('system-<job>', [permission], ({ actor }) => actor.id === 'system:<job>')` rule in
|
|
782
782
|
`platform/auth/attributes/attribute-policies.ts`; `--authz rebac`, the tuple
|
|
783
|
-
`context:<context>#operator@system
|
|
783
|
+
`context:<context>#operator@system:<job>` in `platform/auth/relationships/relate-system-actors.ts`,
|
|
784
784
|
written to the tuple store when the application starts, as long as the schema still lets a
|
|
785
785
|
`system` subject operate a context. With `--authz custom`, a removed region, a remodelled
|
|
786
786
|
relationship schema or a permission the generator cannot read, nothing is written and the job
|
|
@@ -917,7 +917,7 @@ Regenerates what is derived from the config and the code, and nothing else:
|
|
|
917
917
|
platform owners. A file the team wrote keeps its lines, the block appended after them; without
|
|
918
918
|
any owner nothing is written.
|
|
919
919
|
|
|
920
|
-
`--behaviour` writes the pages of `docs/behaviour/` alone, every other generated document left as it is: what the pre-commit hook runs when a spec is staged; with `--check`, those pages alone are compared.
|
|
920
|
+
`--behaviour` writes the pages of `docs/behaviour/` alone, every other generated document left as it is: what the pre-commit hook runs when a spec is staged; with `--check`, those pages alone are compared. A rule is written as its title without the row ids and criteria it opens with (`#FIX1 `, `#US1.04 AC1 `), which date it to the change that brought it and mean nothing to a reader of the business.
|
|
921
921
|
|
|
922
922
|
`--stored-events` also records in `stored-events.lock.json` the shape of each version of a stored
|
|
923
923
|
event declared in the codecs of `infrastructure/persistence/`, never rewriting a recorded version:
|
|
@@ -1172,7 +1172,7 @@ ddd-ts-kit todo [<context>]
|
|
|
1172
1172
|
`status` prints the `Next:` line of `docs/architecture/plan.md`, the rows of
|
|
1173
1173
|
`docs/architecture/slices.md` by status and by owner, and per context the `TODO(domain)`,
|
|
1174
1174
|
`TODO(platform)` and `it.todo` left, then those outside the contexts. A missing file is not an
|
|
1175
|
-
error. Each row not done says whether it can start: ready on the trunk when every dependency is
|
|
1175
|
+
error. When the plan sits at step 7 (the build) the `Next:` line is derived from the rows (the next row ready on the trunk, or `7 build done` once every row is done) and the line of the plan is printed beside it, `planNext` in `--json`. Each row not done says whether it can start: ready on the trunk when every dependency is
|
|
1176
1176
|
done, ready on a branch when each dependency not done is a row briefed to a worker whose worktree
|
|
1177
1177
|
has commits ahead of its base (the `rows` of its `.ddd-ts-kit/worker.json`, as `status --workers`
|
|
1178
1178
|
reads them), and waiting otherwise, with the ids it waits for. A story or a milestone whose rows
|
|
@@ -1306,10 +1306,14 @@ write; a test the runner puts aside is reported whatever the gate), and that the
|
|
|
1306
1306
|
A locked test changed or removed is reported as a changed scenario is, as the subject
|
|
1307
1307
|
`test "<title>" of <file>` with its fingerprint, until the `acceptance-judge` agent lets that
|
|
1308
1308
|
version through, the `## Statement` of the fix being the criterion; a new test only needs locking
|
|
1309
|
-
again. `--
|
|
1309
|
+
again. `--lock` also runs the formatter (the `format` script, in check mode) and the linter (the
|
|
1310
|
+
`lint` script) of the project on the files it locks, a fix's regression specs or a story's
|
|
1311
|
+
acceptance spec, and only on those: it refuses, naming the file and what the tool reports, while they
|
|
1312
|
+
fail, since a locked file can no longer be touched. A project without those scripts or tools is locked
|
|
1313
|
+
as before. `--gate passing` holds that each locked test is there, unchanged and no longer wrapped in
|
|
1310
1314
|
`pending(...)`; the test runner, not this command, proves it passes. The guard of the plugin reads
|
|
1311
1315
|
the same lock in the worktree of a fix (`"kind": "fix"` in `.ddd-ts-kit/story.json`): it opens the
|
|
1312
|
-
code once the lock exists and refuses every edit of a locked spec (skill `fix`,
|
|
1316
|
+
code once the lock exists and refuses every edit of a locked spec by a sub-agent, the session writing a new version for the judge to rule on (skill `fix`,
|
|
1313
1317
|
[story workflow](../../docs/guides/story-workflow.md)).
|
|
1314
1318
|
|
|
1315
1319
|
```
|
|
@@ -1467,7 +1471,7 @@ nothing and asks nothing of the platform.
|
|
|
1467
1471
|
|---|---|
|
|
1468
1472
|
| design time | the first commit of `docs/architecture/stories/<code>.md` to the commit of `test/acceptance/<code>.acceptance.lock.json` |
|
|
1469
1473
|
| build time | the lock commit to the first commit whose `## Report` holds text |
|
|
1470
|
-
| lead time | the first commit of the story file to the commit of the current branch
|
|
1474
|
+
| lead time | the first commit of the story file to the close: the first commit of the first-parent history of the current branch that contains the last commit of the story, whatever its subject (a merge, a squash; the merge of the trunk into the story branch is never it); `open` without a report or without a close |
|
|
1471
1475
|
| requirements rework | the commits that changed `## Acceptance criteria` after the first commit carrying a `Slice: <code>.<n>` trailer; the amendments of the lock (each an `amend` verdict); the `refuse` verdicts of `test/acceptance/verdicts/` |
|
|
1472
1476
|
| provisional decisions | the `D<n>` lines of the story file |
|
|
1473
1477
|
| compromises | the items under `### Compromises` of the report |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** What a tool answered: its exit code and everything it printed. */
|
|
2
|
+
interface ToolRun {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly output: string;
|
|
5
|
+
}
|
|
6
|
+
/** Runs a program with node's arguments in a directory; the seam that keeps the checks testable without real tools. */
|
|
7
|
+
export type RunTool = (program: string, args: readonly string[], cwd: string) => ToolRun;
|
|
8
|
+
/** What the project's own tools found on the files about to be locked, and what was left unchecked and why. */
|
|
9
|
+
export interface LockedFilesCheck {
|
|
10
|
+
readonly findings: readonly string[];
|
|
11
|
+
readonly unchecked: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
/** What runs the programs, and the command line of the kit that `lint` is run through; both replaced by a test. */
|
|
14
|
+
export interface Tools {
|
|
15
|
+
readonly run?: RunTool;
|
|
16
|
+
readonly cli?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Runs the formatter and the linter of the project, as its `format` and `lint` scripts name them, on
|
|
20
|
+
* the files a lock is about to make untouchable, and only on those. A tool the project has no script
|
|
21
|
+
* for, or has not installed, checks nothing and is listed as unchecked: the lock goes as it did.
|
|
22
|
+
*/
|
|
23
|
+
export declare function checkLockedFiles(root: string, files: readonly string[], tools?: Tools): LockedFilesCheck;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=check-locked-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-locked-files.d.ts","sourceRoot":"","sources":["../../src/acceptance/check-locked-files.ts"],"names":[],"mappings":"AAMA,qEAAqE;AACrE,UAAU,OAAO;IACf,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,uHAAuH;AACvH,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;AAEzF,+GAA+G;AAC/G,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,mHAAmH;AACnH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAKD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,GAAE,KAAU,GAAG,gBAAgB,CAY5G"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { isRecord } from '../check/support/is-record.js';
|
|
5
|
+
import { findProjectFormatter } from '../migration/find-project-formatter.js';
|
|
6
|
+
/** Enough of a failing tool to read the cause. */
|
|
7
|
+
const TAIL_LINES = 40;
|
|
8
|
+
/**
|
|
9
|
+
* Runs the formatter and the linter of the project, as its `format` and `lint` scripts name them, on
|
|
10
|
+
* the files a lock is about to make untouchable, and only on those. A tool the project has no script
|
|
11
|
+
* for, or has not installed, checks nothing and is listed as unchecked: the lock goes as it did.
|
|
12
|
+
*/
|
|
13
|
+
export function checkLockedFiles(root, files, tools = {}) {
|
|
14
|
+
if (files.length === 0) {
|
|
15
|
+
return { findings: [], unchecked: [] };
|
|
16
|
+
}
|
|
17
|
+
const { run = runWithNode, cli = process.argv[1] } = tools;
|
|
18
|
+
const checks = [formatCheck(root, files, run), lintCheck({ root, files, run, cli })];
|
|
19
|
+
return {
|
|
20
|
+
findings: checks.flatMap((check) => (check.finding === undefined ? [] : [check.finding])),
|
|
21
|
+
unchecked: checks.flatMap((check) => (check.unchecked === undefined ? [] : [check.unchecked])),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function formatCheck(root, files, run) {
|
|
25
|
+
const formatter = findProjectFormatter(root);
|
|
26
|
+
if (typeof formatter === 'string') {
|
|
27
|
+
return { unchecked: `format: ${formatter}` };
|
|
28
|
+
}
|
|
29
|
+
const checking = formatter.args.map((arg) => (arg === '--write' && formatter.name === 'Prettier' ? '--check' : arg));
|
|
30
|
+
const args = formatter.name === 'Biome' ? checking.filter((arg) => arg !== '--write') : checking;
|
|
31
|
+
const result = run(process.execPath, [formatter.bin, ...args, ...files], root);
|
|
32
|
+
return result.status === 0
|
|
33
|
+
? {}
|
|
34
|
+
: { finding: `${formatter.name} wants these files formatted (\`npm run format\`):\n${tail(result.output)}` };
|
|
35
|
+
}
|
|
36
|
+
function lintCheck({ root, files, run, cli }) {
|
|
37
|
+
const script = scriptOf(root, 'lint');
|
|
38
|
+
if (script === undefined) {
|
|
39
|
+
return { unchecked: 'lint: package.json has no `lint` script' };
|
|
40
|
+
}
|
|
41
|
+
const program = lintProgram(root, script, cli);
|
|
42
|
+
if (typeof program === 'string') {
|
|
43
|
+
return { unchecked: `lint: ${program}` };
|
|
44
|
+
}
|
|
45
|
+
const result = run(process.execPath, [...program, ...files], root);
|
|
46
|
+
return result.status === 0
|
|
47
|
+
? {}
|
|
48
|
+
: { finding: `The linter reports these files (\`npm run lint\`):\n${tail(result.output)}` };
|
|
49
|
+
}
|
|
50
|
+
/** The node arguments that lint the given files as the `lint` script does, or why they cannot be found. */
|
|
51
|
+
function lintProgram(root, script, cli) {
|
|
52
|
+
if (!resolves(root, 'eslint')) {
|
|
53
|
+
return 'ESLint is not installed (run `npm install`)';
|
|
54
|
+
}
|
|
55
|
+
if (/\bddd-ts-kit\s+lint\b/.test(script)) {
|
|
56
|
+
return cli === undefined ? 'the ddd-ts-kit command line is not known' : [cli, 'lint', '--no-cache'];
|
|
57
|
+
}
|
|
58
|
+
const bin = path.join(root, 'node_modules', 'eslint', 'bin', 'eslint.js');
|
|
59
|
+
return /\beslint\b/.test(script) && fs.existsSync(bin)
|
|
60
|
+
? [bin, '--max-warnings', '0']
|
|
61
|
+
: 'the `lint` script does not run ESLint';
|
|
62
|
+
}
|
|
63
|
+
function resolves(root, name) {
|
|
64
|
+
return fs.existsSync(path.join(root, 'node_modules', name, 'package.json'));
|
|
65
|
+
}
|
|
66
|
+
function scriptOf(root, name) {
|
|
67
|
+
try {
|
|
68
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
|
|
69
|
+
const scripts = isRecord(manifest) ? manifest['scripts'] : undefined;
|
|
70
|
+
const script = isRecord(scripts) ? scripts[name] : undefined;
|
|
71
|
+
return typeof script === 'string' ? script : undefined;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function tail(output) {
|
|
78
|
+
return output.trimEnd().split('\n').slice(-TAIL_LINES).join('\n');
|
|
79
|
+
}
|
|
80
|
+
function runWithNode(program, args, cwd) {
|
|
81
|
+
const run = spawnSync(program, [...args], { cwd, encoding: 'utf8', maxBuffer: 1024 * 1024 * 64 });
|
|
82
|
+
return { status: run.status ?? 1, output: `${run.stdout}${run.stderr}${run.error?.message ?? ''}` };
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=check-locked-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-locked-files.js","sourceRoot":"","sources":["../../src/acceptance/check-locked-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,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
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { Scenario } from './scenario.js';
|
|
2
|
+
/** A row id as a title names it: `#US5.02`, `#M2.07`, `#4.15`. */
|
|
3
|
+
export declare const ROW: RegExp;
|
|
4
|
+
/** An acceptance criterion of the story as a title names it: `AC1`. */
|
|
5
|
+
export declare const CRITERION: RegExp;
|
|
2
6
|
/** The scenarios of an acceptance spec, in the order of the file. */
|
|
3
7
|
export declare function scenariosIn(source: string): Scenario[];
|
|
4
8
|
//# sourceMappingURL=scenarios-in.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenarios-in.d.ts","sourceRoot":"","sources":["../../src/acceptance/scenarios-in.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"scenarios-in.d.ts","sourceRoot":"","sources":["../../src/acceptance/scenarios-in.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAQ1D,kEAAkE;AAClE,eAAO,MAAM,GAAG,QAA6B,CAAC;AAE9C,uEAAuE;AACvE,eAAO,MAAM,SAAS,QAAe,CAAC;AAItC,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CA4BtD"}
|
|
@@ -6,9 +6,9 @@ const CALL = /\b(?:it|test)(?:\.(todo|skip|only|fails|failing|concurrent))?\(\s*
|
|
|
6
6
|
/** `pending(` right after the title: the body waits for its code. */
|
|
7
7
|
const WRAPPER = /^\s*,\s*pending\s*\(/;
|
|
8
8
|
/** A row id as a title names it: `#US5.02`, `#M2.07`, `#4.15`. */
|
|
9
|
-
const ROW = /#([A-Za-z0-9][\w.-]*\w)/g;
|
|
9
|
+
export const ROW = /#([A-Za-z0-9][\w.-]*\w)/g;
|
|
10
10
|
/** An acceptance criterion of the story as a title names it: `AC1`. */
|
|
11
|
-
const CRITERION = /\bAC\d+\b/g;
|
|
11
|
+
export const CRITERION = /\bAC\d+\b/g;
|
|
12
12
|
const SKIPPED = new Set(['skip', 'fails', 'failing']);
|
|
13
13
|
/** The scenarios of an acceptance spec, in the order of the file. */
|
|
14
14
|
export function scenariosIn(source) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenarios-in.js","sourceRoot":"","sources":["../../src/acceptance/scenarios-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,sHAAsH;AACtH,MAAM,IAAI,GAAG,0EAA0E,CAAC;AAExF,qEAAqE;AACrE,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAEvC,kEAAkE;AAClE,MAAM,GAAG,GAAG,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"scenarios-in.js","sourceRoot":"","sources":["../../src/acceptance/scenarios-in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,sHAAsH;AACtH,MAAM,IAAI,GAAG,0EAA0E,CAAC;AAExF,qEAAqE;AACrE,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAEvC,kEAAkE;AAClE,MAAM,CAAC,MAAM,GAAG,GAAG,0BAA0B,CAAC;AAE9C,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC;AAEtC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AAEtD,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,MA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'../model/source-file.js';
|
|
2
|
+
import type { PermissionSet } from './permission-sets.js';
|
|
3
|
+
/** A permission a type of the relationship schema derives: the right is decided on that type. */
|
|
4
|
+
export interface ModelledPermission {
|
|
5
|
+
/** The id of the permission, `billing:invoice.view`. */
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly type: string;
|
|
8
|
+
}
|
|
9
|
+
/** A part of the schema the checker cannot read, and where it stands. */
|
|
10
|
+
interface UnreadSchema {
|
|
11
|
+
readonly line: number;
|
|
12
|
+
readonly what: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ModelledSchema {
|
|
15
|
+
readonly file: SourceFile;
|
|
16
|
+
readonly modelled: readonly ModelledPermission[];
|
|
17
|
+
readonly unread: readonly UnreadSchema[];
|
|
18
|
+
/** Whether the operators of the context hold this permission: the context derives it, or every permission no element derives. */
|
|
19
|
+
contextHolds(id: string): boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The permissions the types other than `context` derive in the relationship schema, read from
|
|
23
|
+
* the object given to `defineSchema`: the types written in place, and those of an `elements`
|
|
24
|
+
* object the schema spreads. A derived relation named after a permission is a string key
|
|
25
|
+
* (`'billing:invoice.view'`) or a computed one (`[billingPermissions['invoice.view'].id]`, or a
|
|
26
|
+
* constant of the file holding it). A relation named otherwise (`edit`) grants no permission.
|
|
27
|
+
* Anything else (a schema built by a call, another spread, a type held elsewhere, a key computed
|
|
28
|
+
* in another way) is unread, and said so.
|
|
29
|
+
*/
|
|
30
|
+
export declare function modelledPermissions(file: SourceFile, sets: readonly PermissionSet[]): ModelledSchema;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=modelled-permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelled-permissions.d.ts","sourceRoot":"","sources":["../../../src/check/authz/modelled-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAUvD,iGAAiG;AACjG,MAAM,WAAW,kBAAkB;IACjC,wDAAwD;IACxD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,yEAAyE;AACzE,UAAU,YAAY;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACjD,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC,iIAAiI;IACjI,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,aAAa,EAAE,GAAG,cAAc,CAcpG"}
|