ddd-ts-kit 0.83.3 → 0.84.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 +28 -0
- package/README.fr.md +28 -24
- package/README.md +27 -23
- package/dist/affected/format-selection.d.ts +2 -0
- package/dist/affected/format-selection.d.ts.map +1 -1
- package/dist/affected/format-selection.js +1 -1
- package/dist/affected/format-selection.js.map +1 -1
- package/dist/affected/run-affected.d.ts +18 -0
- package/dist/affected/run-affected.d.ts.map +1 -0
- package/dist/affected/run-affected.js +35 -0
- package/dist/affected/run-affected.js.map +1 -0
- package/dist/check/authz/is-in-project.d.ts +4 -0
- package/dist/check/authz/is-in-project.d.ts.map +1 -0
- package/dist/check/authz/is-in-project.js +5 -0
- package/dist/check/authz/is-in-project.js.map +1 -0
- package/dist/check/authz/scoped-permission.d.ts +15 -0
- package/dist/check/authz/scoped-permission.d.ts.map +1 -0
- package/dist/check/authz/scoped-permission.js +39 -0
- package/dist/check/authz/scoped-permission.js.map +1 -0
- package/dist/check/authz/signed-in-grant-sources.d.ts +22 -0
- package/dist/check/authz/signed-in-grant-sources.d.ts.map +1 -0
- package/dist/check/authz/signed-in-grant-sources.js +63 -0
- package/dist/check/authz/signed-in-grant-sources.js.map +1 -0
- package/dist/check/authz/signed-in-grants.d.ts +5 -0
- package/dist/check/authz/signed-in-grants.d.ts.map +1 -0
- package/dist/check/authz/signed-in-grants.js +8 -0
- package/dist/check/authz/signed-in-grants.js.map +1 -0
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/catalogue/default-severities.d.ts.map +1 -1
- package/dist/check/catalogue/default-severities.js +1 -0
- package/dist/check/catalogue/default-severities.js.map +1 -1
- package/dist/check/explain/authz-docs.d.ts.map +1 -1
- package/dist/check/explain/authz-docs.js +16 -3
- package/dist/check/explain/authz-docs.js.map +1 -1
- package/dist/check/explain/events-docs.js +1 -1
- package/dist/check/explain/standard-docs.js +1 -1
- package/dist/check/fixtures/authz-granted-fixtures.js +4 -4
- package/dist/check/fixtures/authz-granted-fixtures.js.map +1 -1
- package/dist/check/fixtures/authz-scope-narrows-fixtures.d.ts +3 -0
- package/dist/check/fixtures/authz-scope-narrows-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/authz-scope-narrows-fixtures.js +111 -0
- package/dist/check/fixtures/authz-scope-narrows-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.d.ts.map +1 -1
- package/dist/check/fixtures/paths.js +1 -1
- package/dist/check/fixtures/paths.js.map +1 -1
- package/dist/check/fixtures/tracing-fixtures.js +3 -3
- package/dist/check/fixtures/tracing-fixtures.js.map +1 -1
- package/dist/check/fixtures/tree-fixtures.js +1 -1
- package/dist/check/fixtures/tree-fixtures.js.map +1 -1
- package/dist/check/fixtures/vocabulary-fixtures.js +2 -2
- package/dist/check/fixtures/vocabulary-fixtures.js.map +1 -1
- package/dist/check/rules/authz-granted.d.ts.map +1 -1
- package/dist/check/rules/authz-granted.js +7 -4
- package/dist/check/rules/authz-granted.js.map +1 -1
- package/dist/check/rules/authz-scope-narrows.d.ts +12 -0
- package/dist/check/rules/authz-scope-narrows.d.ts.map +1 -0
- package/dist/check/rules/authz-scope-narrows.js +75 -0
- package/dist/check/rules/authz-scope-narrows.js.map +1 -0
- package/dist/check/rules/events-outbox-required.d.ts.map +1 -1
- package/dist/check/rules/events-outbox-required.js +4 -2
- package/dist/check/rules/events-outbox-required.js.map +1 -1
- package/dist/commands/affected.d.ts +3 -1
- package/dist/commands/affected.d.ts.map +1 -1
- package/dist/commands/affected.js +12 -2
- package/dist/commands/affected.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +3 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +2 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/platform-folders.d.ts +4 -0
- package/dist/commands/platform-folders.d.ts.map +1 -0
- package/dist/commands/platform-folders.js +43 -0
- package/dist/commands/platform-folders.js.map +1 -0
- package/dist/controllers/finish-migration.d.ts.map +1 -1
- package/dist/controllers/finish-migration.js +7 -3
- package/dist/controllers/finish-migration.js.map +1 -1
- package/dist/depcruise/hygiene-rules.js +1 -1
- package/dist/depcruise/hygiene-rules.js.map +1 -1
- package/dist/doctor/diagnose.d.ts +2 -1
- package/dist/doctor/diagnose.d.ts.map +1 -1
- package/dist/doctor/diagnose.js +10 -2
- package/dist/doctor/diagnose.js.map +1 -1
- package/dist/doctor/doctor-finding.d.ts +3 -3
- package/dist/doctor/doctor-finding.d.ts.map +1 -1
- package/dist/doctor/folder-findings.d.ts +5 -0
- package/dist/doctor/folder-findings.d.ts.map +1 -0
- package/dist/doctor/folder-findings.js +19 -0
- package/dist/doctor/folder-findings.js.map +1 -0
- package/dist/doctor/format-diagnosis.js +9 -1
- package/dist/doctor/format-diagnosis.js.map +1 -1
- package/dist/doctor/script-findings.d.ts +2 -2
- package/dist/doctor/script-findings.d.ts.map +1 -1
- package/dist/doctor/script-findings.js +3 -3
- package/dist/doctor/script-findings.js.map +1 -1
- package/dist/generate/errors/refusal-code.d.ts +1 -1
- package/dist/generate/errors/refusal-code.d.ts.map +1 -1
- package/dist/generate/errors/refusal-code.js +8 -1
- package/dist/generate/errors/refusal-code.js.map +1 -1
- package/dist/generate/grant-permission.d.ts.map +1 -1
- package/dist/generate/grant-permission.js +3 -2
- package/dist/generate/grant-permission.js.map +1 -1
- package/dist/generate/kinds/gateway-kind.d.ts.map +1 -1
- package/dist/generate/kinds/gateway-kind.js +2 -1
- package/dist/generate/kinds/gateway-kind.js.map +1 -1
- package/dist/generate/kinds/job/grant-system-actor.d.ts.map +1 -1
- package/dist/generate/kinds/job/grant-system-actor.js +5 -6
- package/dist/generate/kinds/job/grant-system-actor.js.map +1 -1
- package/dist/generate/kinds/job-kind.d.ts.map +1 -1
- package/dist/generate/kinds/job-kind.js +2 -1
- package/dist/generate/kinds/job-kind.js.map +1 -1
- package/dist/generate/kinds/plan-vars.d.ts +6 -2
- package/dist/generate/kinds/plan-vars.d.ts.map +1 -1
- package/dist/generate/kinds/plan-vars.js +7 -3
- package/dist/generate/kinds/plan-vars.js.map +1 -1
- package/dist/generate/kinds/policy-kind.d.ts.map +1 -1
- package/dist/generate/kinds/policy-kind.js +2 -1
- package/dist/generate/kinds/policy-kind.js.map +1 -1
- package/dist/generate/kinds/wire-context.d.ts.map +1 -1
- package/dist/generate/kinds/wire-context.js +6 -4
- package/dist/generate/kinds/wire-context.js.map +1 -1
- package/dist/generate/kinds/write-context-files.d.ts.map +1 -1
- package/dist/generate/kinds/write-context-files.js +2 -1
- package/dist/generate/kinds/write-context-files.js.map +1 -1
- package/dist/generate/platform-path.d.ts +5 -0
- package/dist/generate/platform-path.d.ts.map +1 -0
- package/dist/generate/platform-path.js +6 -0
- package/dist/generate/platform-path.js.map +1 -0
- package/dist/generate/shared-writes.js +8 -8
- package/dist/generate/shared-writes.js.map +1 -1
- package/dist/generate/vocabulary/declare-role.d.ts +1 -1
- package/dist/generate/vocabulary/declare-role.d.ts.map +1 -1
- package/dist/generate/vocabulary/declare-role.js +3 -2
- package/dist/generate/vocabulary/declare-role.js.map +1 -1
- package/dist/generate/wirings.d.ts.map +1 -1
- package/dist/generate/wirings.js +4 -3
- package/dist/generate/wirings.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +13 -1
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +2 -0
- package/dist/help/usage.js.map +1 -1
- package/dist/init/files/audit-files.d.ts.map +1 -1
- package/dist/init/files/audit-files.js +9 -2
- package/dist/init/files/audit-files.js.map +1 -1
- package/dist/init/files/auth-files.d.ts.map +1 -1
- package/dist/init/files/auth-files.js +31 -22
- package/dist/init/files/auth-files.js.map +1 -1
- package/dist/init/files/platform-files.js +10 -6
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/manifest/scripts-for.d.ts +2 -2
- package/dist/init/manifest/scripts-for.d.ts.map +1 -1
- package/dist/init/manifest/scripts-for.js +7 -7
- package/dist/init/manifest/scripts-for.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/manifest/write-manifest.d.ts.map +1 -1
- package/dist/init/manifest/write-manifest.js +3 -1
- package/dist/init/manifest/write-manifest.js.map +1 -1
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +13 -4
- package/dist/init/run-init.js.map +1 -1
- package/dist/platform-folders/flat-files.d.ts +3 -0
- package/dist/platform-folders/flat-files.d.ts.map +1 -0
- package/dist/platform-folders/flat-files.js +4 -0
- package/dist/platform-folders/flat-files.js.map +1 -0
- package/dist/platform-folders/flat-relocation.d.ts +10 -0
- package/dist/platform-folders/flat-relocation.d.ts.map +1 -0
- package/dist/platform-folders/flat-relocation.js +18 -0
- package/dist/platform-folders/flat-relocation.js.map +1 -0
- package/dist/platform-folders/folder-move.d.ts +6 -0
- package/dist/platform-folders/folder-move.d.ts.map +1 -0
- package/dist/platform-folders/folder-move.js +2 -0
- package/dist/platform-folders/folder-move.js.map +1 -0
- package/dist/platform-folders/index.d.ts +6 -0
- package/dist/platform-folders/index.d.ts.map +1 -0
- package/dist/platform-folders/index.js +5 -0
- package/dist/platform-folders/index.js.map +1 -0
- package/dist/platform-folders/keep-flat-platform.d.ts +9 -0
- package/dist/platform-folders/keep-flat-platform.d.ts.map +1 -0
- package/dist/platform-folders/keep-flat-platform.js +14 -0
- package/dist/platform-folders/keep-flat-platform.js.map +1 -0
- package/dist/platform-folders/moved-specifier.d.ts +14 -0
- package/dist/platform-folders/moved-specifier.d.ts.map +1 -0
- package/dist/platform-folders/moved-specifier.js +38 -0
- package/dist/platform-folders/moved-specifier.js.map +1 -0
- package/dist/platform-folders/placements.d.ts +8 -0
- package/dist/platform-folders/placements.d.ts.map +1 -0
- package/dist/platform-folders/placements.js +25 -0
- package/dist/platform-folders/placements.js.map +1 -0
- package/dist/platform-folders/platform-folder-names.d.ts +3 -0
- package/dist/platform-folders/platform-folder-names.d.ts.map +1 -0
- package/dist/platform-folders/platform-folder-names.js +7 -0
- package/dist/platform-folders/platform-folder-names.js.map +1 -0
- package/dist/platform-folders/platform-folders.d.ts +27 -0
- package/dist/platform-folders/platform-folders.d.ts.map +1 -0
- package/dist/platform-folders/platform-folders.js +53 -0
- package/dist/platform-folders/platform-folders.js.map +1 -0
- package/dist/platform-folders/platform-moves.d.ts +9 -0
- package/dist/platform-folders/platform-moves.d.ts.map +1 -0
- package/dist/platform-folders/platform-moves.js +16 -0
- package/dist/platform-folders/platform-moves.js.map +1 -0
- package/dist/platform-folders/unknown-flat-files.d.ts +5 -0
- package/dist/platform-folders/unknown-flat-files.d.ts.map +1 -0
- package/dist/platform-folders/unknown-flat-files.js +14 -0
- package/dist/platform-folders/unknown-flat-files.js.map +1 -0
- package/dist/platform-folders/with-moved-imports.d.ts +7 -0
- package/dist/platform-folders/with-moved-imports.d.ts.map +1 -0
- package/dist/platform-folders/with-moved-imports.js +14 -0
- package/dist/platform-folders/with-moved-imports.js.map +1 -0
- package/dist/platform-layout/index.d.ts +5 -0
- package/dist/platform-layout/index.d.ts.map +1 -0
- package/dist/platform-layout/index.js +4 -0
- package/dist/platform-layout/index.js.map +1 -0
- package/dist/platform-layout/platform-file-in.d.ts +9 -0
- package/dist/platform-layout/platform-file-in.d.ts.map +1 -0
- package/dist/platform-layout/platform-file-in.js +18 -0
- package/dist/platform-layout/platform-file-in.js.map +1 -0
- package/dist/platform-layout/platform-file-paths.d.ts +5 -0
- package/dist/platform-layout/platform-file-paths.d.ts.map +1 -0
- package/dist/platform-layout/platform-file-paths.js +9 -0
- package/dist/platform-layout/platform-file-paths.js.map +1 -0
- package/dist/platform-layout/platform-file.d.ts +6 -0
- package/dist/platform-layout/platform-file.d.ts.map +1 -0
- package/dist/platform-layout/platform-file.js +2 -0
- package/dist/platform-layout/platform-file.js.map +1 -0
- package/dist/platform-layout/platform-layout.d.ts +57 -0
- package/dist/platform-layout/platform-layout.d.ts.map +1 -0
- package/dist/platform-layout/platform-layout.js +61 -0
- package/dist/platform-layout/platform-layout.js.map +1 -0
- package/dist/presets/grant-to-signed-in.d.ts.map +1 -1
- package/dist/presets/grant-to-signed-in.js +3 -3
- package/dist/presets/grant-to-signed-in.js.map +1 -1
- package/dist/presets/organisations-as-tenants.d.ts.map +1 -1
- package/dist/presets/organisations-as-tenants.js +2 -1
- package/dist/presets/organisations-as-tenants.js.map +1 -1
- package/dist/refusals/project-sources.d.ts +2 -2
- package/dist/refusals/project-sources.d.ts.map +1 -1
- package/dist/refusals/project-sources.js +3 -3
- package/dist/refusals/project-sources.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/slice/format-slice-verification.js +6 -2
- package/dist/slice/format-slice-verification.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workspace/workspace.d.ts +7 -0
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/dist/workspace/workspace.js +13 -2
- package/dist/workspace/workspace.js.map +1 -1
- package/package.json +2 -2
- package/templates/architecture/extractable.declared.spec.ts.tpl +1 -1
- package/templates/architecture/extractable.manual.spec.ts.tpl +2 -2
- package/templates/architecture/extractable.tsyringe.spec.ts.tpl +1 -1
- package/templates/background-job/background-job.spec.ts.tpl +1 -1
- package/templates/command/handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/context/module.manual.ts.tpl +1 -1
- package/templates/init/README.md.tpl +9 -9
- package/templates/init/docker/env.example.tpl +1 -1
- package/templates/init/e2e/create-credentials.none.ts.tpl +2 -2
- package/templates/init/e2e/start-application.database.ts.tpl +2 -2
- package/templates/init/e2e/start-application.memory.ts.tpl +2 -2
- package/templates/init/jest.config.js.tpl +2 -0
- package/templates/init/main.ts.tpl +5 -5
- package/templates/init/platform/audit/audit.module.manual.ts.tpl +6 -6
- package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +2 -2
- package/templates/init/platform/audit/create-audit.ts.tpl +1 -1
- package/templates/init/platform/audit/{search-audit-entries.controller.ts.tpl → search-audit-entries/search-audit-entries.controller.ts.tpl} +1 -1
- package/templates/init/platform/audit/{search-audit-entries.handler.ts.tpl → search-audit-entries/search-audit-entries.handler.ts.tpl} +1 -1
- package/templates/init/platform/audit/{search-audit-entries.route.ts.tpl → search-audit-entries/search-audit-entries.route.ts.tpl} +1 -1
- package/templates/init/platform/auth/{attribute-policies.ts.tpl → attributes/attribute-policies.ts.tpl} +1 -1
- package/templates/init/platform/auth/{create-authenticator.none.ts.tpl → authentication/create-authenticator.none.ts.tpl} +1 -1
- package/templates/init/platform/auth/{http-boundary.ts.tpl → authentication/http-boundary.ts.tpl} +1 -1
- package/templates/init/platform/auth/{principal-of.none.ts.tpl → authentication/principal-of.none.ts.tpl} +1 -1
- package/templates/init/platform/auth/{security-schemes.none.ts.tpl → authentication/security-schemes.none.ts.tpl} +1 -1
- package/templates/init/platform/auth/{authorization.tsyringe.ts.tpl → authorization/authorization.tsyringe.ts.tpl} +2 -2
- package/templates/init/platform/auth/{create-authorizer.abac.ts.tpl → authorization/create-authorizer.abac.ts.tpl} +1 -1
- package/templates/init/platform/auth/{create-authorizer.custom.ts.tpl → authorization/create-authorizer.custom.ts.tpl} +2 -2
- package/templates/init/platform/auth/{create-authorizer.rbac.ts.tpl → authorization/create-authorizer.rbac.ts.tpl} +2 -2
- package/templates/init/platform/auth/{create-authorizer.rebac.ts.tpl → authorization/create-authorizer.rebac.ts.tpl} +3 -3
- package/templates/init/platform/auth/{custom-authorizer.contract.spec.ts.tpl → custom/custom-authorizer.contract.spec.ts.tpl} +1 -1
- package/templates/init/platform/auth/{create-tuple-store.contract.spec.ts.tpl → relationships/create-tuple-store.contract.spec.ts.tpl} +1 -1
- package/templates/init/platform/auth/{permission-mapping.ts.tpl → relationships/permission-mapping.ts.tpl} +1 -1
- package/templates/init/platform/auth/{relate-system-actors.ts.tpl → relationships/relate-system-actors.ts.tpl} +1 -1
- package/templates/init/platform/auth/{relation-tuples.ts.tpl → relationships/relation-tuples.ts.tpl} +2 -2
- package/templates/init/platform/auth/{roles.ts.tpl → roles/roles.ts.tpl} +1 -1
- package/templates/init/platform/buses/create-command-bus.ts.tpl +1 -1
- package/templates/init/platform/buses/create-query-bus.ts.tpl +1 -1
- package/templates/init/platform/{compose-application.manual.ts.tpl → composition/compose-application.manual.ts.tpl} +4 -4
- package/templates/init/platform/{compose-application.tsyringe.ts.tpl → composition/compose-application.tsyringe.ts.tpl} +8 -8
- package/templates/init/platform/{create-platform.manual.ts.tpl → composition/create-platform.manual.ts.tpl} +5 -5
- package/templates/init/platform/{lay-foundations.tsyringe.ts.tpl → composition/lay-foundations.tsyringe.ts.tpl} +1 -1
- package/templates/init/platform/{platform.manual.ts.tpl → composition/platform.manual.ts.tpl} +1 -1
- package/templates/init/platform/http/create-app-module.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.express.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.fastify.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.hono.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.nest.ts.tpl +1 -1
- package/templates/init/platform/http/with-documentation.ts.tpl +1 -1
- package/templates/init/rules/platform.md.tpl +7 -6
- package/templates/init/scripts/openapi.ts.tpl +3 -3
- package/templates/job/job.spec.tsyringe.ts.tpl +1 -1
- package/templates/pipeline/lefthook.yml +3 -1
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/pipeline/vitest.config.ts.tpl +3 -0
- package/templates/presets/identity/context/test/worlds/__context__.world.ts.tpl +1 -1
- package/templates/process/timeout-job.spec.ts.tpl +1 -1
- package/templates/query/handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/query/search.handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/service/main.ts.tpl +5 -5
- package/templates/test-world/world.tsyringe.ts.tpl +1 -1
- package/templates/worker/main.ts.tpl +5 -5
- /package/templates/init/platform/audit/{search-audit-entries.query.ts.tpl → search-audit-entries/search-audit-entries.query.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{create-authenticator.jwt.ts.tpl → authentication/create-authenticator.jwt.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{create-authenticator.keycloak.ts.tpl → authentication/create-authenticator.keycloak.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{development-actor-header.ts.tpl → authentication/development-actor-header.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{development-header-authenticator.ts.tpl → authentication/development-header-authenticator.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{offline-authenticator.ts.tpl → authentication/offline-authenticator.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{principal-of.tokens.ts.tpl → authentication/principal-of.tokens.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{security-schemes.tokens.ts.tpl → authentication/security-schemes.tokens.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{access-policies.ts.tpl → authorization/access-policies.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{log-decisions.ts.tpl → authorization/log-decisions.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{permissions.ts.tpl → authorization/permissions.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{role.ts.tpl → authorization/role.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{use-case-protection.ts.tpl → authorization/use-case-protection.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{custom-authorizer.ts.tpl → custom/custom-authorizer.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{create-tuple-store.ts.tpl → relationships/create-tuple-store.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{relationship-schema.ts.tpl → relationships/relationship-schema.ts.tpl} +0 -0
- /package/templates/init/platform/{platform-test.module.tsyringe.ts.tpl → composition/platform-test.module.tsyringe.ts.tpl} +0 -0
- /package/templates/init/platform/{platform.module.tsyringe.ts.tpl → composition/platform.module.tsyringe.ts.tpl} +0 -0
- /package/templates/init/platform/{job-settings.ts.tpl → jobs/job-settings.ts.tpl} +0 -0
- /package/templates/init/platform/{errors.ts.tpl → observability/errors.ts.tpl} +0 -0
- /package/templates/init/platform/{tracing.ts.tpl → observability/tracing.ts.tpl} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-selection.js","sourceRoot":"","sources":["../../src/affected/format-selection.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,WAAW,GAAG,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"format-selection.js","sourceRoot":"","sources":["../../src/affected/format-selection.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAC/C,MAAM,UAAU,GAAG,WAAW,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,SAAoB,EAAE,MAAc;IAClE,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,GAAG,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEvG,OAAO,MAAM,CAAC,O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,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Stack } from '../config/index.js';
|
|
2
|
+
import type { Io } from '../commands/io.js';
|
|
3
|
+
import type { Selection } from './selection.js';
|
|
4
|
+
/** A script of a project to run on a selection: where, with which package manager, on what. */
|
|
5
|
+
export interface AffectedRun {
|
|
6
|
+
readonly root: string;
|
|
7
|
+
readonly manager: Stack['packageManager'];
|
|
8
|
+
readonly selection: Selection;
|
|
9
|
+
readonly script: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Runs a script of the project on the selection, as the pipeline does on a pull request: the
|
|
13
|
+
* contexts it names in `DDD_TS_KIT_AFFECTED`, `--passWithNoTests` on a partial run. Nothing runs
|
|
14
|
+
* when nothing that runs changed. Its output goes straight to the terminal; its exit code is
|
|
15
|
+
* the answer.
|
|
16
|
+
*/
|
|
17
|
+
export declare function runAffected({ root, manager, selection, script }: AffectedRun, io: Io): number;
|
|
18
|
+
//# sourceMappingURL=run-affected.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-affected.d.ts","sourceRoot":"","sources":["../../src/affected/run-affected.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAKhD,+FAA+F;AAC/F,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CA6B7F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { CliError } from '../cli-error.js';
|
|
3
|
+
import { inDialect } from '../package-manager/in-dialect.js';
|
|
4
|
+
import { PARTIAL_RUN } from './format-selection.js';
|
|
5
|
+
/** The variable the test runner config reads (`unaffectedContexts()` of @ddd-ts-kit/testing). */
|
|
6
|
+
const AFFECTED = 'DDD_TS_KIT_AFFECTED';
|
|
7
|
+
/**
|
|
8
|
+
* Runs a script of the project on the selection, as the pipeline does on a pull request: the
|
|
9
|
+
* contexts it names in `DDD_TS_KIT_AFFECTED`, `--passWithNoTests` on a partial run. Nothing runs
|
|
10
|
+
* when nothing that runs changed. Its output goes straight to the terminal; its exit code is
|
|
11
|
+
* the answer.
|
|
12
|
+
*/
|
|
13
|
+
export function runAffected({ root, manager, selection, script }, io) {
|
|
14
|
+
if (selection.scope === 'none') {
|
|
15
|
+
io.out(`Nothing that runs is affected (${selection.reason}): ${script} is not run.`);
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
const partial = selection.scope === 'contexts';
|
|
19
|
+
const command = inDialect(`npm run ${script}${partial ? ` -- ${PARTIAL_RUN}` : ''}`, manager);
|
|
20
|
+
const [program = 'npm', ...args] = command.split(' ');
|
|
21
|
+
io.out(partial
|
|
22
|
+
? `${script} on ${selection.contexts.join(', ')} (${selection.reason}).`
|
|
23
|
+
: `${script} on everything (${selection.reason}).`);
|
|
24
|
+
const run = spawnSync(program, args, {
|
|
25
|
+
cwd: root,
|
|
26
|
+
env: { ...process.env, [AFFECTED]: partial ? selection.contexts.join(',') : '' },
|
|
27
|
+
shell: process.platform === 'win32',
|
|
28
|
+
stdio: 'inherit',
|
|
29
|
+
});
|
|
30
|
+
if (run.error !== undefined) {
|
|
31
|
+
throw new CliError(`${program} could not run (${run.error.message}).`, `Is ${program} installed and on the PATH?`);
|
|
32
|
+
}
|
|
33
|
+
return run.status ?? 1;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=run-affected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-affected.js","sourceRoot":"","sources":["../../src/affected/run-affected.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,iGAAiG;AACjG,MAAM,QAAQ,GAAG,qBAAqB,CAAC;AAUvC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAe,EAAE,EAAM;IACnF,IAAI,SAAS,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QAC/B,EAAE,CAAC,GAAG,CAAC,kCAAkC,SAAS,CAAC,MAAM,MAAM,MAAM,cAAc,CAAC,CAAC;QAErF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,KAAK,UAAU,CAAC;IAC/C,MAAM,OAAO,GAAG,SAAS,CAAC,WAAW,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9F,MAAM,CAAC,OAAO,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtD,EAAE,CAAC,GAAG,CACJ,OAAO;QACL,CAAC,CAAC,GAAG,MAAM,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,MAAM,IAAI;QACxE,CAAC,CAAC,GAAG,MAAM,mBAAmB,SAAS,CAAC,MAAM,IAAI,CACrD,CAAC;IAEF,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE;QACnC,GAAG,EAAE,IAAI;QACT,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;QAChF,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;QACnC,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IAEH,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,QAAQ,CAAC,GAAG,OAAO,mBAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,MAAM,OAAO,6BAA6B,CAAC,CAAC;IACrH,CAAC;IAED,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-in-project.d.ts","sourceRoot":"","sources":["../../../src/check/authz/is-in-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,4DAA4D;AAC5D,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-in-project.js","sourceRoot":"","sources":["../../../src/check/authz/is-in-project.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,IAAY;IACxD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
2
|
+
import type { ListPart } from '../text/list-part.js';
|
|
3
|
+
import type { PermissionSet } from './permission-sets.js';
|
|
4
|
+
/** A permission written as the entry of a set: the set, and the key read in it. */
|
|
5
|
+
export interface ScopedPermission {
|
|
6
|
+
readonly set: PermissionSet;
|
|
7
|
+
readonly key: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The permission an argument names: the entry of a set written in place, or a constant or a field
|
|
11
|
+
* of the same file initialised with one. Undefined when the checker cannot read it: a parameter,
|
|
12
|
+
* a call, a constant of another file, an entry whose key is not a literal.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scopedPermission(file: SourceFile, argument: ListPart, sets: readonly PermissionSet[]): ScopedPermission | undefined;
|
|
15
|
+
//# sourceMappingURL=scoped-permission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoped-permission.d.ts","sourceRoot":"","sources":["../../../src/check/authz/scoped-permission.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAO1D,mFAAmF;AACnF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,SAAS,aAAa,EAAE,GAC7B,gBAAgB,GAAG,SAAS,CA4B9B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { escapeRegExp } from '../text/escape-reg-exp.js';
|
|
2
|
+
/** The entry of a set, `billingPermissions[`, up to its key. */
|
|
3
|
+
const SET_ENTRY = /^([A-Za-z_$][\w$]*)\s*\[\s*/;
|
|
4
|
+
/** A name the permission may be held in: `permission`, `this.permission`. */
|
|
5
|
+
const HELD = /^(?:this\.)?([A-Za-z_$][\w$]*)$/;
|
|
6
|
+
/**
|
|
7
|
+
* The permission an argument names: the entry of a set written in place, or a constant or a field
|
|
8
|
+
* of the same file initialised with one. Undefined when the checker cannot read it: a parameter,
|
|
9
|
+
* a call, a constant of another file, an entry whose key is not a literal.
|
|
10
|
+
*/
|
|
11
|
+
export function scopedPermission(file, argument, sets) {
|
|
12
|
+
const inPlace = entryAt(file, argument, sets);
|
|
13
|
+
if (inPlace !== undefined) {
|
|
14
|
+
return inPlace;
|
|
15
|
+
}
|
|
16
|
+
const held = HELD.exec(argument.code)?.[1];
|
|
17
|
+
if (held === undefined) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const declaration = new RegExp(`\\b(?:const|let|var|readonly|private|protected|public|static)\\s+${escapeRegExp(held)}\\b[^=;(){}]*=\\s*`, 'g');
|
|
21
|
+
for (const found of file.scan.code.matchAll(declaration)) {
|
|
22
|
+
const start = found.index + found[0].length;
|
|
23
|
+
const entry = entryAt(file, { code: file.scan.code.slice(start, start + 200), start }, sets);
|
|
24
|
+
if (entry !== undefined) {
|
|
25
|
+
return entry;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
function entryAt(file, at, sets) {
|
|
31
|
+
const entry = SET_ENTRY.exec(at.code);
|
|
32
|
+
const set = sets.find(({ set: name }) => name === entry?.[1]);
|
|
33
|
+
if (entry === null || set === undefined) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const key = file.scan.strings.find(({ start }) => start === at.start + entry[0].length)?.value;
|
|
37
|
+
return key === undefined ? undefined : { set, key };
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=scoped-permission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoped-permission.js","sourceRoot":"","sources":["../../../src/check/authz/scoped-permission.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,gEAAgE;AAChE,MAAM,SAAS,GAAG,6BAA6B,CAAC;AAChD,6EAA6E;AAC7E,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAQ/C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAgB,EAChB,QAAkB,EAClB,IAA8B;IAE9B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAE9C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAE3C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,MAAM,CAC5B,oEAAoE,YAAY,CAAC,IAAI,CAAC,oBAAoB,EAC1G,GAAG,CACJ,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACzD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;QAE7F,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,OAAO,CAAC,IAAgB,EAAE,EAAY,EAAE,IAA8B;IAC7E,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,IAAI,KAAK,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IAE/F,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Project } from '../model/project.js';
|
|
2
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
3
|
+
import { type Scan } from '../scan/scan.js';
|
|
4
|
+
/** A construction of `SignedInGrantsAuthorizer` whose grants the checker cannot read. */
|
|
5
|
+
interface UnreadGrants {
|
|
6
|
+
readonly file: SourceFile;
|
|
7
|
+
readonly line: number;
|
|
8
|
+
}
|
|
9
|
+
/** What every signed-in person holds, wherever the project writes it, and the grants the checker cannot read. */
|
|
10
|
+
export interface SignedInGrantSources {
|
|
11
|
+
/** Each list of grants, scanned alone: the grants file of the platform, an array given to the authorizer. */
|
|
12
|
+
readonly lists: readonly Scan[];
|
|
13
|
+
readonly unread: readonly UnreadGrants[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The grants file of the platform, and the `grants` of every `new SignedInGrantsAuthorizer(...)`
|
|
17
|
+
* outside the tests: an array literal, or a constant declared as one in a source of the project.
|
|
18
|
+
* Any other form (a call, a spread, a parameter) is unread: the rules say they cannot judge it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function signedInGrantSources(project: Project): SignedInGrantSources;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=signed-in-grant-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-in-grant-sources.d.ts","sourceRoot":"","sources":["../../../src/check/authz/signed-in-grant-sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,iBAAiB,CAAC;AAWlD,yFAAyF;AACzF,UAAU,YAAY;IACpB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,iHAAiH;AACjH,MAAM,WAAW,oBAAoB;IACnC,6GAA6G;IAC7G,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,oBAAoB,CAmB3E"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { scan } from '../scan/scan.js';
|
|
2
|
+
import { escapeRegExp } from '../text/escape-reg-exp.js';
|
|
3
|
+
import { callArguments } from '../text/call-arguments.js';
|
|
4
|
+
import { matchingBracket } from '../text/matching-bracket.js';
|
|
5
|
+
import { signedInGrants } from './signed-in-grants.js';
|
|
6
|
+
const CONSTRUCTION = /\bnew\s+SignedInGrantsAuthorizer\s*\(/g;
|
|
7
|
+
const GRANTS_PROPERTY = /^grants\b\s*(?::\s*)?/;
|
|
8
|
+
const IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
9
|
+
/**
|
|
10
|
+
* The grants file of the platform, and the `grants` of every `new SignedInGrantsAuthorizer(...)`
|
|
11
|
+
* outside the tests: an array literal, or a constant declared as one in a source of the project.
|
|
12
|
+
* Any other form (a call, a spread, a parameter) is unread: the rules say they cannot judge it.
|
|
13
|
+
*/
|
|
14
|
+
export function signedInGrantSources(project) {
|
|
15
|
+
const file = signedInGrants(project);
|
|
16
|
+
const lists = file === undefined ? [] : [file.scan];
|
|
17
|
+
const unread = [];
|
|
18
|
+
for (const candidate of project.files.filter(({ isTest }) => !isTest)) {
|
|
19
|
+
for (const call of candidate.scan.code.matchAll(CONSTRUCTION)) {
|
|
20
|
+
const value = grantsValue(candidate.scan.code, call.index + call[0].length - 1);
|
|
21
|
+
const found = value === undefined ? [] : listsOf(project, candidate, value);
|
|
22
|
+
if (found.length === 0) {
|
|
23
|
+
unread.push({ file: candidate, line: candidate.scan.lineAt(call.index) });
|
|
24
|
+
}
|
|
25
|
+
lists.push(...found);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return { lists, unread };
|
|
29
|
+
}
|
|
30
|
+
/** The value of `grants` in the options object given to the constructor. */
|
|
31
|
+
function grantsValue(code, open) {
|
|
32
|
+
const options = callArguments(code, open)[0];
|
|
33
|
+
if (options === undefined || !options.code.startsWith('{')) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
for (const property of callArguments(code, options.start)) {
|
|
37
|
+
const key = GRANTS_PROPERTY.exec(property.code);
|
|
38
|
+
if (key !== null) {
|
|
39
|
+
const shorthand = key[0].trim() === 'grants';
|
|
40
|
+
return shorthand
|
|
41
|
+
? { code: 'grants', start: property.start }
|
|
42
|
+
: { code: property.code.slice(key[0].length), start: property.start + key[0].length };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
function listsOf(project, file, value) {
|
|
48
|
+
if (value.code.startsWith('[')) {
|
|
49
|
+
return [listAt(file, value.start)];
|
|
50
|
+
}
|
|
51
|
+
if (!IDENTIFIER.test(value.code)) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const declaration = new RegExp(`\\b(?:const|let|var)\\s+${escapeRegExp(value.code)}\\b[^=;]*=\\s*\\[`, 'g');
|
|
55
|
+
return project.files
|
|
56
|
+
.filter(({ isTest }) => !isTest)
|
|
57
|
+
.flatMap((candidate) => [...candidate.scan.code.matchAll(declaration)].map((found) => listAt(candidate, found.index + found[0].length - 1)));
|
|
58
|
+
}
|
|
59
|
+
/** The array literal opening at `open`, scanned alone so that only its grants are read. */
|
|
60
|
+
function listAt(file, open) {
|
|
61
|
+
return scan(file.text.slice(open, matchingBracket(file.scan.code, open) + 1));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=signed-in-grant-sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-in-grant-sources.js","sourceRoot":"","sources":["../../../src/check/authz/signed-in-grant-sources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,YAAY,GAAG,wCAAwC,CAAC;AAC9D,MAAM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AC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,2BAA2B,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;IAE5G,OAAO,OAAO,CAAC,KAAK;SACjB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC;SAC/B,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CACrB,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC3D,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CACrD,CACF,CAAC;AACN,CAAC;AAED,2FAA2F;AAC3F,SAAS,MAAM,CAAC,IAAgB,EAAE,IAAY;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Project } from '../model/project.js';
|
|
2
|
+
import type { SourceFile } from '../model/source-file.js';
|
|
3
|
+
/** What every signed-in person holds, `<platformDir>/auth/authorization/signed-in-grants.ts`, when a context preset or the team wrote it. */
|
|
4
|
+
export declare function signedInGrants(project: Project): SourceFile | undefined;
|
|
5
|
+
//# sourceMappingURL=signed-in-grants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-in-grants.d.ts","sourceRoot":"","sources":["../../../src/check/authz/signed-in-grants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D,6IAA6I;AAC7I,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAMvE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { platformFileIn } from '../../platform-layout/index.js';
|
|
2
|
+
import { isInProject } from './is-in-project.js';
|
|
3
|
+
/** What every signed-in person holds, `<platformDir>/auth/authorization/signed-in-grants.ts`, when a context preset or the team wrote it. */
|
|
4
|
+
export function signedInGrants(project) {
|
|
5
|
+
const file = platformFileIn(project.config, 'auth/authorization/signed-in-grants.ts', (path) => isInProject(project, path));
|
|
6
|
+
return project.files.find((candidate) => candidate.path === file);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=signed-in-grants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-in-grants.js","sourceRoot":"","sources":["../../../src/check/authz/signed-in-grants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,6IAA6I;AAC7I,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,wCAAwC,EAAE,CAAC,IAAI,EAAE,EAAE,CAC7F,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAC3B,CAAC;IAEF,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA6F7C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA4F7C,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { authzActorExplicit } from '../rules/authz-actor-explicit.js';
|
|
|
3
3
|
import { authzFieldsBySchema } from '../rules/authz-fields-by-schema.js';
|
|
4
4
|
import { authzDeclared } from '../rules/authz-declared.js';
|
|
5
5
|
import { authzGranted } from '../rules/authz-granted.js';
|
|
6
|
+
import { authzScopeNarrows } from '../rules/authz-scope-narrows.js';
|
|
6
7
|
import { authzInApplication } from '../rules/authz-in-application.js';
|
|
7
8
|
import { authzPolicyAsked } from '../rules/authz-policy-asked.js';
|
|
8
9
|
import { cleanBlankLines } from '../rules/clean-blank-lines.js';
|
|
@@ -150,6 +151,7 @@ export const ARCHITECTURE_RULES = [
|
|
|
150
151
|
authzFieldsBySchema,
|
|
151
152
|
authzPolicyAsked,
|
|
152
153
|
authzGranted,
|
|
154
|
+
authzScopeNarrows,
|
|
153
155
|
aspectsOutsideIn,
|
|
154
156
|
tracingPlatformOnly,
|
|
155
157
|
tenancyScopedStatement,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,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gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,0BAA0B;IAC1B,mBAAmB;IACnB,yBAAyB;IACzB,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,qBAAqB;IACrB,aAAa;IACb,sBAAsB;IACtB,oBAAoB;IACpB,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;IACzB,sBAAsB;IACtB,kCAAkC;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,4BAA4B;IAC5B,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,0BAA0B;IAC1B,qBAAqB;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MA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BAAgB;IAChB,gBAAgB;IAChB,sBAAsB;IACtB,gCAAgC;IAChC,WAAW;IACX,mBAAmB;IACnB,sBAAsB;IACtB,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,uBAAuB;IACvB,0BAA0B;IAC1B,mBAAmB;IACnB,yBAAyB;IACzB,mBAAmB;IACnB,aAAa;IACb,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,eAAe;IACf,WAAW;IACX,qBAAqB;IACrB,aAAa;IACb,sBAAsB;IACtB,oBAAoB;IACpB,wBAAwB;IACxB,4BAA4B;IAC5B,qCAAqC;IACrC,yBAAyB;IACzB,sBAAsB;IACtB,kCAAkC;IAClC,mCAAmC;IACnC,6BAA6B;IAC7B,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,YAAY;IACZ,iBAAiB;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,2BAA2B;IAC3B,2BAA2B;IAC3B,uBAAuB;IACvB,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,gCAAgC;IAChC,4BAA4B;IAC5B,kBAAkB;IAClB,2BAA2B;IAC3B,oBAAoB;IACpB,yBAAyB;IACzB,gBAAgB;IAChB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;IACxB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;IACpB,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,wBAAwB;IACxB,0BAA0B;IAC1B,qBAAqB;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-severities.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/default-severities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,0GAA0G;AAC1G,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"default-severities.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/default-severities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,0GAA0G;AAC1G,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAgBjE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Rules that advise instead of blocking unless the config says otherwise (ARCHITECTURE.md section 3). */
|
|
2
2
|
export const DEFAULT_SEVERITIES = {
|
|
3
3
|
'authz/granted': 'warn',
|
|
4
|
+
'authz/scope-narrows': 'warn',
|
|
4
5
|
'test/no-mocks': 'warn',
|
|
5
6
|
'test/builder-required': 'warn',
|
|
6
7
|
'clean/function-size': 'warn',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-severities.js","sourceRoot":"","sources":["../../../src/check/catalogue/default-severities.ts"],"names":[],"mappings":"AAEA,0GAA0G;AAC1G,MAAM,CAAC,MAAM,kBAAkB,GAAuC;IACpE,eAAe,EAAE,MAAM;IACvB,eAAe,EAAE,MAAM;IACvB,uBAAuB,EAAE,MAAM;IAC/B,qBAAqB,EAAE,MAAM;IAC7B,wBAAwB,EAAE,MAAM;IAChC,wBAAwB,EAAE,MAAM;IAChC,sCAAsC,EAAE,MAAM;IAC9C,gCAAgC,EAAE,MAAM;IACxC,4BAA4B,EAAE,MAAM;IACpC,uBAAuB,EAAE,MAAM;IAC/B,oBAAoB,EAAE,MAAM;IAC5B,2BAA2B,EAAE,MAAM;IACnC,+BAA+B,EAAE,MAAM;IACvC,iCAAiC,EAAE,MAAM;CAC1C,CAAC"}
|
|
1
|
+
{"version":3,"file":"default-severities.js","sourceRoot":"","sources":["../../../src/check/catalogue/default-severities.ts"],"names":[],"mappings":"AAEA,0GAA0G;AAC1G,MAAM,CAAC,MAAM,kBAAkB,GAAuC;IACpE,eAAe,EAAE,MAAM;IACvB,qBAAqB,EAAE,MAAM;IAC7B,eAAe,EAAE,MAAM;IACvB,uBAAuB,EAAE,MAAM;IAC/B,qBAAqB,EAAE,MAAM;IAC7B,wBAAwB,EAAE,MAAM;IAChC,wBAAwB,EAAE,MAAM;IAChC,sCAAsC,EAAE,MAAM;IAC9C,gCAAgC,EAAE,MAAM;IACxC,4BAA4B,EAAE,MAAM;IACpC,uBAAuB,EAAE,MAAM;IAC/B,oBAAoB,EAAE,MAAM;IAC5B,2BAA2B,EAAE,MAAM;IACnC,+BAA+B,EAAE,MAAM;IACvC,iCAAiC,EAAE,MAAM;CAC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"authz-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiGxD,CAAC"}
|
|
@@ -29,19 +29,32 @@ await this.access.authorize(command.actor, billingPermissions['invoice.void'], i
|
|
|
29
29
|
export class OnlyIssuerVoidsPolicy {}`,
|
|
30
30
|
},
|
|
31
31
|
'authz/granted': {
|
|
32
|
-
why: "In a project whose rights are roles (stack.authz rbac), a permission does two things: a use case requires it, and a role holds it. The generator declares the first; the grant lives in the roles of the platform. The super-admin holds the wildcard `*`, so a permission no role names is reachable by administrators only, the checks stay green and the people the use case was written for are refused at run time. It fails closed, which is safe, but silently. Judged: every key of every `definePermissions` set of a context is named in `<platformDir>/auth/roles.ts` or in what every signed-in person holds (`signed-in-grants.ts`, which a context preset writes), by the entry of its set (`billingPermissions['invoice.issue']`), by its id (`'billing:invoice.issue'`) or by the wildcard of its context (`'billing:*'`); the bare `*` does not count, and a grant to `Role.System` does. A permission meant for administrators only is granted to `Role.Admin` by name, so that the intent is read in review. Silent when the rights are attributes, relationships or an authorizer of the project, and when the platform has no roles file. A warning: it fails closed.",
|
|
32
|
+
why: "In a project whose rights are roles (stack.authz rbac), a permission does two things: a use case requires it, and a role holds it. The generator declares the first; the grant lives in the roles of the platform. The super-admin holds the wildcard `*`, so a permission no role names is reachable by administrators only, the checks stay green and the people the use case was written for are refused at run time. It fails closed, which is safe, but silently. Judged: every key of every `definePermissions` set of a context is named in `<platformDir>/auth/roles/roles.ts` or in what every signed-in person holds (`signed-in-grants.ts`, which a context preset writes), by the entry of its set (`billingPermissions['invoice.issue']`), by its id (`'billing:invoice.issue'`) or by the wildcard of its context (`'billing:*'`); the bare `*` does not count, and a grant to `Role.System` does. A permission meant for administrators only is granted to `Role.Admin` by name, so that the intent is read in review. Silent when the rights are attributes, relationships or an authorizer of the project, and when the platform has no roles file. A warning: it fails closed.",
|
|
33
33
|
bad: `// contexts/billing/application/authorization/billing.permissions.ts
|
|
34
34
|
export const billingPermissions = definePermissions('billing', {
|
|
35
35
|
'invoice.void': { description: 'Void invoice' },
|
|
36
36
|
});
|
|
37
|
-
// platform/auth/roles.ts
|
|
37
|
+
// platform/auth/roles/roles.ts
|
|
38
38
|
export const roles = { [Role.Admin]: ['*'] };`,
|
|
39
|
-
good: `// platform/auth/roles.ts
|
|
39
|
+
good: `// platform/auth/roles/roles.ts
|
|
40
40
|
export const roles = {
|
|
41
41
|
[Role.Admin]: ['*'],
|
|
42
42
|
[Role.Accountant]: [billingPermissions['invoice.void']],
|
|
43
43
|
};
|
|
44
44
|
// or, when generating the use case: --permission invoice.void --grant accountant`,
|
|
45
|
+
},
|
|
46
|
+
'authz/scope-narrows': {
|
|
47
|
+
why: "Every signed-in person holds the grants of SignedInGrantsAuthorizer, whatever the model of the project: it answers them before it asks the model, for a check and for a listing alike, and the listing is `all`. A handler that narrows a search by the scope of such a permission reads every element for every person who signed in, and the tests of the handler stay green. It is the shortcut taken when the model refuses a search with no element to check (relationships answer RESOURCE_REQUIRED): the grant lets the query past the bus, and the scope no longer narrows anything. The model decides instead: under relationships, the requirement names an enclosing resource (`{ type: 'context', id: '<context>' }` as the generator writes it, or the tenant of the actor) and Access.scope answers the ids of the elements. Judged: the second argument of a `.scope(` call in a context, the entry of a permission set written in place or held in a constant or a field of the same file, against the grants of `<platformDir>/auth/authorization/signed-in-grants.ts` and those given to every `new SignedInGrantsAuthorizer({ grants })` as an array literal or a constant declared as one (an entry, an id, the wildcard of a context, the bare `*`). What it cannot read is reported, never taken as safe: grants built by a call or a spread, a permission handed in to a `.scope(` call on `access`. What it cannot see at all: a permission every person holds through the model itself (a role every account has, a relation every member of a tenant has), and a search that does not ask Access.scope. Those are decisions of the model: the specs of the search prove them, with the real authorizer, an element of another owner absent. A warning: a search every signed-in person may run on every element is legitimate, its scope then says nothing.",
|
|
48
|
+
bad: `// platform/auth/authorization/signed-in-grants.ts
|
|
49
|
+
export const signedInGrants: readonly Grant[] = [docsPermissions['document.search']];
|
|
50
|
+
// contexts/docs/application/queries/search-documents/search-documents.handler.ts
|
|
51
|
+
const scope = await this.access.scope(query.actor, docsPermissions['document.search'], 'document');`,
|
|
52
|
+
good: `// contexts/docs/application/queries/search-documents/search-documents.query.ts
|
|
53
|
+
@Requires(docsPermissions['document.search'], { resource: () => ({ type: 'context', id: 'docs' }) })
|
|
54
|
+
export class SearchDocumentsQuery extends AuthorizedQuery<SearchDocumentsResult> {}
|
|
55
|
+
// contexts/docs/application/queries/search-documents/search-documents.handler.ts
|
|
56
|
+
const scope = await this.access.scope(query.actor, docsPermissions['document.search'], 'document');
|
|
57
|
+
// { kind: 'ids', ids: [...] }: the documents the actor reaches, an empty page for one who reaches none`,
|
|
45
58
|
},
|
|
46
59
|
'authz/policy-asked': {
|
|
47
60
|
why: 'The bus checks the permission of a use case before its handler runs, with the identifier of the element at most: it cannot read the element. A policy is the part of the right that needs the element (only the issuer, not after closing), and it is evaluated only when the handler asks Access once the element is loaded. A handler that forgets to ask leaves the policy declared, tested and never applied, and nothing at run time says so. Judged: for every permission refined by a policy (@Policy or definePolicy in application/authorization/), the handlers in the folder of each command or query that requires it (@Requires, .requires(...) or requires(X, ...)) call authorize, decide or decideOn and name that permission in their code. The TODO(domain) the generator leaves in such a handler, naming the permission, is accepted, and so is a TODO(review) that names it: `ddd-ts-kit todo` lists both, and until it is done the authorization module refuses the result of the handler at run time (PolicyNotAskedError).',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-docs.js","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,gBAAgB,EAAE;QAChB,GAAG,EAAE,mvBAAmvB;QACxvB,GAAG,EAAE;;;mEAG0D;QAC/D,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,q0BAAq0B;QAC10B,GAAG,EAAE;;;;;4DAKmD;QACxD,IAAI,EAAE;;;;;;sCAM4B;KACnC;IACD,eAAe,EAAE;QACf,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"authz-docs.js","sourceRoot":"","sources":["../../../src/check/explain/authz-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAsC;IAC3D,gBAAgB,EAAE;QAChB,GAAG,EAAE,mvBAAmvB;QACxvB,GAAG,EAAE;;;mEAG0D;QAC/D,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,q0BAAq0B;QAC10B,GAAG,EAAE;;;;;4DAKmD;QACxD,IAAI,EAAE;;;;;;sCAM4B;KACnC;IACD,eAAe,EAAE;QACf,GAAG,EAAE,koCAAkoC;QACvoC,GAAG,EAAE;;;;;8CAKqC;QAC1C,IAAI,EAAE;;;;;kFAKwE;KAC/E;IACD,qBAAqB,EAAE;QACrB,GAAG,EAAE,uxDAAuxD;QAC5xD,GAAG,EAAE;;;oGAG2F;QAChG,IAAI,EAAE;;;;;wGAK8F;KACrG;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,o/BAAo/B;QACz/B,GAAG,EAAE;;;;;gCAKuB;QAC5B,IAAI,EAAE;;;gCAGsB;KAC7B;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,ykBAAykB;QAC9kB,GAAG,EAAE;;;;qDAI4C;QACjD,IAAI,EAAE;;;;;2GAKiG;KACxG;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,i1BAAi1B;QACt1B,GAAG,EAAE;;+FAEsF;QAC3F,IAAI,EAAE;;;;;IAKN;KACD;CACF,CAAC"}
|
|
@@ -29,7 +29,7 @@ import { connect } from 'amqplib';
|
|
|
29
29
|
"stack": { "orm": "drizzle", "events": "in-memory" }`,
|
|
30
30
|
good: `// application/commands/issue-invoice/issue-invoice.handler.ts
|
|
31
31
|
constructor(private readonly publisher: IntegrationEventPublisher) {}
|
|
32
|
-
// platform/platform.module.ts
|
|
32
|
+
// platform/composition/platform.module.ts
|
|
33
33
|
eventPublisher: new OutboxPublisher(persistence.outbox),`,
|
|
34
34
|
},
|
|
35
35
|
'events/consumer-idempotent': {
|
|
@@ -12,7 +12,7 @@ import { Retry } from '@ddd-ts-kit/aspects/decorators';`,
|
|
|
12
12
|
why: 'Tracing is non-invasive and wired once. One action is one trace because every span is opened by the same few places: the request boundary, the bus middleware, the instrumentation around adapters and handlers, the outbox relay. A context that imports @ddd-ts-kit/tracing or an @opentelemetry package opens spans of its own, with names and attributes nobody reviews, and can no longer be traced differently by changing the composition root alone. Judged: every source under the source root, tests included, but the platform directory, main.ts and apps/.',
|
|
13
13
|
bad: `// infrastructure/external/stripe-payment.gateway.ts
|
|
14
14
|
import { trace } from '@opentelemetry/api';`,
|
|
15
|
-
good: `// src/platform/tracing.ts
|
|
15
|
+
good: `// src/platform/observability/tracing.ts
|
|
16
16
|
import { traceApplication, tracedPublisher } from '@ddd-ts-kit/tracing';
|
|
17
17
|
import { initTracing } from '@ddd-ts-kit/tracing/node';`,
|
|
18
18
|
},
|
|
@@ -5,9 +5,9 @@ import { project } from './project.js';
|
|
|
5
5
|
import { source } from './source.js';
|
|
6
6
|
const { BILLING } = PATHS;
|
|
7
7
|
const PERMISSIONS = `${BILLING}/application/authorization/billing.permissions.ts`;
|
|
8
|
-
const ROLES = 'src/platform/auth/roles.ts';
|
|
9
|
-
const ROLE = 'src/platform/auth/role.ts';
|
|
10
|
-
const SIGNED_IN = 'src/platform/auth/signed-in-grants.ts';
|
|
8
|
+
const ROLES = 'src/platform/auth/roles/roles.ts';
|
|
9
|
+
const ROLE = 'src/platform/auth/authorization/role.ts';
|
|
10
|
+
const SIGNED_IN = 'src/platform/auth/authorization/signed-in-grants.ts';
|
|
11
11
|
const DECLARED = source("import { definePermissions } from '@ddd-ts-kit/auth';", '', "export const billingPermissions = definePermissions('billing', {", " 'invoice.issue': { description: 'Issue invoice' },", '});');
|
|
12
12
|
const ROLE_VOCABULARY = source('export const Role = {', " Admin: 'admin',", " Accountant: 'accountant',", '} as const;', '', 'export type Role = (typeof Role)[keyof typeof Role];');
|
|
13
13
|
const rule = 'authz/granted';
|
|
@@ -66,6 +66,6 @@ function granting(...grants) {
|
|
|
66
66
|
}
|
|
67
67
|
/** A roles file of the platform whose grants are the lines given, after the super-admin. */
|
|
68
68
|
function roles(...grants) {
|
|
69
|
-
return source("import type { Grant } from '@ddd-ts-kit/auth';", "import { billingPermissions } from '@/contexts/billing/application/authorization/billing.permissions.js';", "import { Role } from '@/platform/auth/role.js';", '', 'export const roles: Readonly<Record<string, readonly Grant[]>> = {', " [Role.Admin]: ['*'],", ...grants.map((grant) => ` ${grant}`), '};', '', 'export const issuing = billingPermissions;');
|
|
69
|
+
return source("import type { Grant } from '@ddd-ts-kit/auth';", "import { billingPermissions } from '@/contexts/billing/application/authorization/billing.permissions.js';", "import { Role } from '@/platform/auth/authorization/role.js';", '', 'export const roles: Readonly<Record<string, readonly Grant[]>> = {', " [Role.Admin]: ['*'],", ...grants.map((grant) => ` ${grant}`), '};', '', 'export const issuing = billingPermissions;');
|
|
70
70
|
}
|
|
71
71
|
//# sourceMappingURL=authz-granted-fixtures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz-granted-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/authz-granted-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAC1B,MAAM,WAAW,GAAG,GAAG,OAAO,mDAAmD,CAAC;AAClF,MAAM,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"authz-granted-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/authz-granted-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC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,OAAO,EA+E1D,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { PATHS } from './paths.js';
|
|
2
|
+
import { project } from './project.js';
|
|
3
|
+
import { SAMPLES } from './samples.js';
|
|
4
|
+
import { source } from './source.js';
|
|
5
|
+
const { BILLING, QUERY_HANDLER, QUERY_HANDLER_SPEC } = PATHS;
|
|
6
|
+
const PERMISSIONS = `${BILLING}/application/authorization/billing.permissions.ts`;
|
|
7
|
+
const SIGNED_IN = 'src/platform/auth/authorization/signed-in-grants.ts';
|
|
8
|
+
const AUTHORIZER = 'src/platform/auth/authorization/create-authorizer.ts';
|
|
9
|
+
const DECLARED = source("import { definePermissions } from '@ddd-ts-kit/auth';", '', "export const billingPermissions = definePermissions('billing', {", " 'invoice.search': { description: 'Search invoice' },", " 'invoice.issue': { description: 'Issue invoice' },", '});');
|
|
10
|
+
const rule = 'authz/scope-narrows';
|
|
11
|
+
export const AUTHZ_SCOPE_NARROWS_FIXTURES = [
|
|
12
|
+
{
|
|
13
|
+
ruleId: rule,
|
|
14
|
+
name: 'a search narrowed by a permission the model decides',
|
|
15
|
+
expect: 'pass',
|
|
16
|
+
files: searching("[billingPermissions['invoice.issue']]"),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
ruleId: rule,
|
|
20
|
+
name: 'a search narrowed by a permission, in a project without signed-in grants',
|
|
21
|
+
expect: 'pass',
|
|
22
|
+
files: project({ [PERMISSIONS]: DECLARED, [QUERY_HANDLER]: handler(), [QUERY_HANDLER_SPEC]: SAMPLES.SPEC }),
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
ruleId: rule,
|
|
26
|
+
name: 'a signed-in grant named in a comment only',
|
|
27
|
+
expect: 'pass',
|
|
28
|
+
files: searching("[\n // billingPermissions['invoice.search'],\n]"),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
ruleId: rule,
|
|
32
|
+
name: 'a search narrowed by a permission every signed-in person holds by its entry',
|
|
33
|
+
expect: { file: QUERY_HANDLER },
|
|
34
|
+
files: searching("[billingPermissions['invoice.search']]"),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
ruleId: rule,
|
|
38
|
+
name: 'a search narrowed by a permission every signed-in person holds through the wildcard of its context',
|
|
39
|
+
expect: { file: QUERY_HANDLER },
|
|
40
|
+
files: searching("['billing:*']"),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
ruleId: rule,
|
|
44
|
+
name: 'a search narrowed by a permission every signed-in person holds through the bare wildcard',
|
|
45
|
+
expect: { file: QUERY_HANDLER },
|
|
46
|
+
files: searching("['*']"),
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
ruleId: rule,
|
|
50
|
+
name: 'a search narrowed by a permission held in a constant of the handler, which every signed-in person holds',
|
|
51
|
+
expect: { file: QUERY_HANDLER },
|
|
52
|
+
files: searching("[billingPermissions['invoice.search']]", {
|
|
53
|
+
before: "const searched = billingPermissions['invoice.search'];",
|
|
54
|
+
permission: 'searched',
|
|
55
|
+
}),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
ruleId: rule,
|
|
59
|
+
name: 'a search narrowed by a permission held in a field of the handler, which every signed-in person holds',
|
|
60
|
+
expect: { file: QUERY_HANDLER },
|
|
61
|
+
files: searching("[billingPermissions['invoice.search']]", {
|
|
62
|
+
field: "private readonly searched = billingPermissions['invoice.search'];",
|
|
63
|
+
permission: 'this.searched',
|
|
64
|
+
}),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
ruleId: rule,
|
|
68
|
+
name: 'a search narrowed by a permission handed in, which the checker cannot read',
|
|
69
|
+
expect: { file: QUERY_HANDLER },
|
|
70
|
+
files: searching("[billingPermissions['invoice.issue']]", { permission: 'query.permission' }),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
ruleId: rule,
|
|
74
|
+
name: 'a search narrowed by a permission the grants given in place to the authorizer hold',
|
|
75
|
+
expect: { file: QUERY_HANDLER },
|
|
76
|
+
files: authorizing("grants: [billingPermissions['invoice.search']]"),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
ruleId: rule,
|
|
80
|
+
name: 'a search narrowed by a permission the model decides, the grants given in place to the authorizer',
|
|
81
|
+
expect: 'pass',
|
|
82
|
+
files: authorizing("grants: ['billing:invoice.issue']"),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
ruleId: rule,
|
|
86
|
+
name: 'grants given to the authorizer by a call, which the checker cannot read',
|
|
87
|
+
expect: { file: AUTHORIZER },
|
|
88
|
+
files: authorizing('grants: grantsOf(billingPermissions)'),
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
function searching(grants, narrowing = {}) {
|
|
92
|
+
return project({
|
|
93
|
+
[PERMISSIONS]: DECLARED,
|
|
94
|
+
[QUERY_HANDLER]: handler(narrowing),
|
|
95
|
+
[QUERY_HANDLER_SPEC]: SAMPLES.SPEC,
|
|
96
|
+
[SIGNED_IN]: source("import type { Grant } from '@ddd-ts-kit/auth';", "import { billingPermissions } from '@/contexts/billing/application/authorization/billing.permissions.js';", '', `export const signedInGrants: readonly Grant[] = ${grants};`, '', 'export const searching = billingPermissions;'),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/** A project whose authorizer is given its grants in place: `grants` is the property as written. */
|
|
100
|
+
function authorizing(grants) {
|
|
101
|
+
return project({
|
|
102
|
+
[PERMISSIONS]: DECLARED,
|
|
103
|
+
[QUERY_HANDLER]: handler(),
|
|
104
|
+
[QUERY_HANDLER_SPEC]: SAMPLES.SPEC,
|
|
105
|
+
[AUTHORIZER]: source("import { type Authorizer, SignedInGrantsAuthorizer } from '@ddd-ts-kit/auth';", "import { billingPermissions } from '@/contexts/billing/application/authorization/billing.permissions.js';", '', 'declare const model: Authorizer;', 'declare function grantsOf(set: unknown): readonly string[];', '', 'export function createAuthorizer(): Authorizer {', ` return new SignedInGrantsAuthorizer({ ${grants}, otherwise: model });`, '}', '', 'export const searching = [billingPermissions, grantsOf];'),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function handler({ before, field, permission = "billingPermissions['invoice.search']" } = {}) {
|
|
109
|
+
return source("import type { Access } from '@ddd-ts-kit/auth';", "import { billingPermissions } from '@/contexts/billing/application/authorization/billing.permissions.js';", "import type { InvoicesIssuedQuery } from '@/contexts/billing/application/queries/invoices-issued/invoices-issued.query.js';", '', ...(before === undefined ? [] : [before, '']), 'export class InvoicesIssuedHandler {', ...(field === undefined ? [] : [` ${field}`, '']), ' constructor(private readonly access: Access) {}', '', ' async execute(query: InvoicesIssuedQuery): Promise<unknown> {', ` return this.access.scope(query.actor, ${permission}, 'invoice');`, ' }', '}');
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=authz-scope-narrows-fixtures.js.map
|