ddd-ts-kit 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -2
- 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/catalogue/eslint-only-rules.d.ts.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.js +12 -0
- package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
- package/dist/check/errors/builds-through-factories.d.ts +4 -0
- package/dist/check/errors/builds-through-factories.d.ts.map +1 -0
- package/dist/check/errors/builds-through-factories.js +5 -0
- package/dist/check/errors/builds-through-factories.js.map +1 -0
- package/dist/check/errors/error-code.d.ts +6 -0
- package/dist/check/errors/error-code.d.ts.map +1 -0
- package/dist/check/errors/error-code.js +2 -0
- package/dist/check/errors/error-code.js.map +1 -0
- package/dist/check/errors/error-codes.d.ts +8 -0
- package/dist/check/errors/error-codes.d.ts.map +1 -0
- package/dist/check/errors/error-codes.js +21 -0
- package/dist/check/errors/error-codes.js.map +1 -0
- package/dist/check/errors/kit-error-codes.d.ts +3 -0
- package/dist/check/errors/kit-error-codes.d.ts.map +1 -0
- package/dist/check/errors/kit-error-codes.js +17 -0
- package/dist/check/errors/kit-error-codes.js.map +1 -0
- package/dist/check/explain/errors-docs.d.ts +3 -0
- package/dist/check/explain/errors-docs.d.ts.map +1 -0
- package/dist/check/explain/errors-docs.js +30 -0
- package/dist/check/explain/errors-docs.js.map +1 -0
- package/dist/check/explain/rule-docs.d.ts.map +1 -1
- package/dist/check/explain/rule-docs.js +2 -0
- package/dist/check/explain/rule-docs.js.map +1 -1
- package/dist/check/fixtures/errors-fixtures.d.ts +3 -0
- package/dist/check/fixtures/errors-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/errors-fixtures.js +126 -0
- package/dist/check/fixtures/errors-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/rules/errors-code-unique.d.ts +3 -0
- package/dist/check/rules/errors-code-unique.d.ts.map +1 -0
- package/dist/check/rules/errors-code-unique.js +34 -0
- package/dist/check/rules/errors-code-unique.js.map +1 -0
- package/dist/check/rules/errors-known-code.d.ts +3 -0
- package/dist/check/rules/errors-known-code.d.ts.map +1 -0
- package/dist/check/rules/errors-known-code.js +51 -0
- package/dist/check/rules/errors-known-code.js.map +1 -0
- package/dist/check/rules/language-glossary-term.d.ts.map +1 -1
- package/dist/check/rules/language-glossary-term.js +7 -5
- package/dist/check/rules/language-glossary-term.js.map +1 -1
- package/dist/commands/error-factories.d.ts +7 -0
- package/dist/commands/error-factories.d.ts.map +1 -0
- package/dist/commands/error-factories.js +65 -0
- package/dist/commands/error-factories.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +1 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/parse-stack.d.ts.map +1 -1
- package/dist/config/parse-stack.js +2 -1
- package/dist/config/parse-stack.js.map +1 -1
- package/dist/config/stack.d.ts +9 -0
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -0
- package/dist/config/stack.js.map +1 -1
- package/dist/describe/context-description.d.ts +12 -0
- package/dist/describe/context-description.d.ts.map +1 -1
- package/dist/describe/describe-context.d.ts.map +1 -1
- package/dist/describe/describe-context.js +2 -0
- package/dist/describe/describe-context.js.map +1 -1
- package/dist/describe/format-description.d.ts.map +1 -1
- package/dist/describe/format-description.js +5 -0
- package/dist/describe/format-description.js.map +1 -1
- package/dist/describe/read-errors.d.ts +8 -0
- package/dist/describe/read-errors.d.ts.map +1 -0
- package/dist/describe/read-errors.js +52 -0
- package/dist/describe/read-errors.js.map +1 -0
- package/dist/describe/reference-lines.js +14 -1
- package/dist/describe/reference-lines.js.map +1 -1
- package/dist/generate/errors/add-factory.d.ts +13 -0
- package/dist/generate/errors/add-factory.d.ts.map +1 -0
- package/dist/generate/errors/add-factory.js +30 -0
- package/dist/generate/errors/add-factory.js.map +1 -0
- package/dist/generate/errors/add-spec-case.d.ts +6 -0
- package/dist/generate/errors/add-spec-case.d.ts.map +1 -0
- package/dist/generate/errors/add-spec-case.js +26 -0
- package/dist/generate/errors/add-spec-case.js.map +1 -0
- package/dist/generate/errors/class-body.d.ts +8 -0
- package/dist/generate/errors/class-body.d.ts.map +1 -0
- package/dist/generate/errors/class-body.js +11 -0
- package/dist/generate/errors/class-body.js.map +1 -0
- package/dist/generate/errors/codes-of-context.d.ts +4 -0
- package/dist/generate/errors/codes-of-context.d.ts.map +1 -0
- package/dist/generate/errors/codes-of-context.js +17 -0
- package/dist/generate/errors/codes-of-context.js.map +1 -0
- package/dist/generate/errors/refusal-code.d.ts +13 -0
- package/dist/generate/errors/refusal-code.d.ts.map +1 -0
- package/dist/generate/errors/refusal-code.js +19 -0
- package/dist/generate/errors/refusal-code.js.map +1 -0
- package/dist/generate/errors/refusal-name.d.ts +4 -0
- package/dist/generate/errors/refusal-name.d.ts.map +1 -0
- package/dist/generate/errors/refusal-name.js +15 -0
- package/dist/generate/errors/refusal-name.js.map +1 -0
- package/dist/generate/errors/static-methods.d.ts +10 -0
- package/dist/generate/errors/static-methods.d.ts.map +1 -0
- package/dist/generate/errors/static-methods.js +13 -0
- package/dist/generate/errors/static-methods.js.map +1 -0
- package/dist/generate/errors/vague-refusal-names.d.ts +3 -0
- package/dist/generate/errors/vague-refusal-names.d.ts.map +1 -0
- package/dist/generate/errors/vague-refusal-names.js +15 -0
- package/dist/generate/errors/vague-refusal-names.js.map +1 -0
- package/dist/generate/kinds/domain-error-kind.d.ts.map +1 -1
- package/dist/generate/kinds/domain-error-kind.js +4 -1
- package/dist/generate/kinds/domain-error-kind.js.map +1 -1
- package/dist/generate/kinds/error-kind.d.ts +3 -0
- package/dist/generate/kinds/error-kind.d.ts.map +1 -0
- package/dist/generate/kinds/error-kind.js +75 -0
- package/dist/generate/kinds/error-kind.js.map +1 -0
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +2 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/init/manifest/versions.js +23 -23
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +3 -1
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +1 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/refusals/apply-plan.d.ts +17 -0
- package/dist/refusals/apply-plan.d.ts.map +1 -0
- package/dist/refusals/apply-plan.js +118 -0
- package/dist/refusals/apply-plan.js.map +1 -0
- package/dist/refusals/factory-name-for.d.ts +7 -0
- package/dist/refusals/factory-name-for.d.ts.map +1 -0
- package/dist/refusals/factory-name-for.js +16 -0
- package/dist/refusals/factory-name-for.js.map +1 -0
- package/dist/refusals/legacy-error.d.ts +21 -0
- package/dist/refusals/legacy-error.d.ts.map +1 -0
- package/dist/refusals/legacy-error.js +2 -0
- package/dist/refusals/legacy-error.js.map +1 -0
- package/dist/refusals/legacy-errors.d.ts +6 -0
- package/dist/refusals/legacy-errors.d.ts.map +1 -0
- package/dist/refusals/legacy-errors.js +16 -0
- package/dist/refusals/legacy-errors.js.map +1 -0
- package/dist/refusals/migration-draft.d.ts +15 -0
- package/dist/refusals/migration-draft.d.ts.map +1 -0
- package/dist/refusals/migration-draft.js +41 -0
- package/dist/refusals/migration-draft.js.map +1 -0
- package/dist/refusals/migration-plan.d.ts +6 -0
- package/dist/refusals/migration-plan.d.ts.map +1 -0
- package/dist/refusals/migration-plan.js +2 -0
- package/dist/refusals/migration-plan.js.map +1 -0
- package/dist/refusals/move.d.ts +15 -0
- package/dist/refusals/move.d.ts.map +1 -0
- package/dist/refusals/move.js +2 -0
- package/dist/refusals/move.js.map +1 -0
- package/dist/refusals/nested-cases.d.ts +3 -0
- package/dist/refusals/nested-cases.d.ts.map +1 -0
- package/dist/refusals/nested-cases.js +9 -0
- package/dist/refusals/nested-cases.js.map +1 -0
- package/dist/refusals/plan-file.d.ts +3 -0
- package/dist/refusals/plan-file.d.ts.map +1 -0
- package/dist/refusals/plan-file.js +3 -0
- package/dist/refusals/plan-file.js.map +1 -0
- package/dist/refusals/planned-factory.d.ts +11 -0
- package/dist/refusals/planned-factory.d.ts.map +1 -0
- package/dist/refusals/planned-factory.js +2 -0
- package/dist/refusals/planned-factory.js.map +1 -0
- package/dist/refusals/planned-move.d.ts +8 -0
- package/dist/refusals/planned-move.d.ts.map +1 -0
- package/dist/refusals/planned-move.js +2 -0
- package/dist/refusals/planned-move.js.map +1 -0
- package/dist/refusals/project-sources.d.ts +5 -0
- package/dist/refusals/project-sources.d.ts.map +1 -0
- package/dist/refusals/project-sources.js +13 -0
- package/dist/refusals/project-sources.js.map +1 -0
- package/dist/refusals/propose-plan.d.ts +16 -0
- package/dist/refusals/propose-plan.d.ts.map +1 -0
- package/dist/refusals/propose-plan.js +39 -0
- package/dist/refusals/propose-plan.js.map +1 -0
- package/dist/refusals/read-legacy-error.d.ts +9 -0
- package/dist/refusals/read-legacy-error.d.ts.map +1 -0
- package/dist/refusals/read-legacy-error.js +75 -0
- package/dist/refusals/read-legacy-error.js.map +1 -0
- package/dist/refusals/read-plan.d.ts +4 -0
- package/dist/refusals/read-plan.d.ts.map +1 -0
- package/dist/refusals/read-plan.js +43 -0
- package/dist/refusals/read-plan.js.map +1 -0
- package/dist/refusals/render-factory.d.ts +5 -0
- package/dist/refusals/render-factory.d.ts.map +1 -0
- package/dist/refusals/render-factory.js +14 -0
- package/dist/refusals/render-factory.js.map +1 -0
- package/dist/refusals/replace-in-code.d.ts +16 -0
- package/dist/refusals/replace-in-code.d.ts.map +1 -0
- package/dist/refusals/replace-in-code.js +20 -0
- package/dist/refusals/replace-in-code.js.map +1 -0
- package/dist/refusals/rewrite-usages.d.ts +6 -0
- package/dist/refusals/rewrite-usages.d.ts.map +1 -0
- package/dist/refusals/rewrite-usages.js +80 -0
- package/dist/refusals/rewrite-usages.js.map +1 -0
- package/dist/refusals/spec-parts.d.ts +8 -0
- package/dist/refusals/spec-parts.d.ts.map +1 -0
- package/dist/refusals/spec-parts.js +14 -0
- package/dist/refusals/spec-parts.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +7 -1
- package/dist/run.js.map +1 -1
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +2 -1
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/templates/aggregate/aggregate.ts.tpl +5 -0
- package/templates/command/handler.declared.ts.tpl +5 -0
- package/templates/command/handler.ts.tpl +5 -0
- package/templates/docs/openapi.json.tpl +5 -0
- package/templates/entity/entity.ts.tpl +5 -0
- package/templates/error/case.spec.ts.tpl +8 -0
- package/templates/error/concept-error.spec.ts.tpl +7 -0
- package/templates/error/concept-error.ts.tpl +5 -0
- package/templates/error/factory.ts.tpl +4 -0
- package/templates/init/jest.config.js.tpl +7 -0
- package/templates/init/rules/domain.md.tpl +11 -0
- package/templates/init/rules/presentation.md.tpl +5 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/route/route.class-validator.ts.tpl +1 -1
- package/templates/route/route.none.ts.tpl +1 -1
- package/templates/route/route.search.ts.tpl +1 -1
- package/templates/route/route.standard-schema.ts.tpl +1 -1
- package/templates/route/route.zod.ts.tpl +1 -1
- package/templates/value-object/value-object.ts.tpl +5 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { AUDIT_MODES, AUTHN_STACKS, AUTHZ_STACKS, BROKER_STACKS, CACHE_STACKS, CI_PLATFORMS, CONFIG_FILE, DEFAULT_IMPORT_ALIAS, DEFAULT_IMPORT_EXTENSION, DI_STACKS, DOCS_UIS, ERROR_REPORTERS, HTTP_STACKS, IMPORT_EXTENSIONS, LOGGERS, PACKAGE_MANAGERS, parseConfig, readConfig, TEST_STACKS, VALIDATION_STACKS, } from '../../config/index.js';
|
|
3
|
+
import { AUDIT_MODES, AUTHN_STACKS, AUTHZ_STACKS, BROKER_STACKS, CACHE_STACKS, CI_PLATFORMS, CONFIG_FILE, DEFAULT_IMPORT_ALIAS, DEFAULT_IMPORT_EXTENSION, DI_STACKS, DOCS_UIS, ERROR_REPORTERS, HTTP_STACKS, IMPORT_EXTENSIONS, LOGGERS, REFUSAL_FORMS, PACKAGE_MANAGERS, parseConfig, readConfig, TEST_STACKS, VALIDATION_STACKS, } from '../../config/index.js';
|
|
4
4
|
import { aliasProblem } from '../../alias/index.js';
|
|
5
5
|
import { DEFAULT_PACKAGE_MANAGER } from '../../package-manager/default-package-manager.js';
|
|
6
6
|
import { CliError } from '../../cli-error.js';
|
|
@@ -95,6 +95,8 @@ function resolveOperations(options, orm) {
|
|
|
95
95
|
audit: choose(AUDIT_MODES, options.audit, 'audit') ?? (orm === 'none' ? 'off' : 'on'),
|
|
96
96
|
errors: choose(ERROR_REPORTERS, options.errors, 'errors') ?? 'none',
|
|
97
97
|
logger: choose(LOGGERS, options.logger, 'logger') ?? 'stdout',
|
|
98
|
+
// A new project builds its domain errors through factories; a recorded one keeps the form it says, or the one of 0.2.
|
|
99
|
+
refusals: choose(REFUSAL_FORMS, options.refusals, 'refusals') ?? 'factories',
|
|
98
100
|
};
|
|
99
101
|
}
|
|
100
102
|
function resolveSecurity(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-stack.js","sourceRoot":"","sources":["../../../src/init/stack/resolve-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;A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,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC;IAEzE,IAAI,MAAM,KAAK,MAAM,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,YAAY,MAAM,sCAAsC,EACxD,mHAAmH,CACpH,CAAC;AACJ,CAAC;AAID,SAAS,cAAc,CAAC,OAAqB;IAC3C,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,iBAAiB,EAAE,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,KAAK;QAChF,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,QAAQ;QAC9D,EAAE,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,QAAQ;QACtD,cAAc,EAAE,MAAM,CAAC,gBAAgB,EAAE,OAAO,CAAC,cAAc,EAAE,iBAAiB,CAAC,IAAI,uBAAuB;KAC/G,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAY,EAAE,EAAU;IACtD,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC;QAC1C,OAAO;IACT,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,UAAU,IAAI,iCAAiC,EAAE,GAAG,EACpD,uIAAuI,CACxI,CAAC;AACJ,CAAC"}
|
|
@@ -19,6 +19,7 @@ export interface StackOptions {
|
|
|
19
19
|
readonly style?: string;
|
|
20
20
|
readonly assembly?: string;
|
|
21
21
|
readonly dependencies?: string;
|
|
22
|
+
readonly refusals?: string;
|
|
22
23
|
readonly packageManager?: string;
|
|
23
24
|
/** The prefix of the source root in imports, when it is not the default. */
|
|
24
25
|
readonly importAlias?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
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EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,8GAA8G;IAC9G,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Config } from '../config/index.js';
|
|
2
|
+
import type { Workspace } from '../workspace/index.js';
|
|
3
|
+
import type { MigrationDraft } from './migration-draft.js';
|
|
4
|
+
import type { MigrationPlan } from './migration-plan.js';
|
|
5
|
+
import type { PlannedMove } from './planned-move.js';
|
|
6
|
+
interface Tree {
|
|
7
|
+
readonly ws: Workspace;
|
|
8
|
+
readonly config: Config;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Follows the plan: each class per error becomes a factory of the error class of its concept,
|
|
12
|
+
* its spec becomes cases of the spec of that class, every file that named it follows, and the
|
|
13
|
+
* config says the project builds its refusals through factories. Answers the moves it made.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyPlan(tree: Tree, plan: MigrationPlan, draft: MigrationDraft): PlannedMove[];
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=apply-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-plan.d.ts","sourceRoot":"","sources":["../../src/refusals/apply-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAM9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD,UAAU,IAAI;IACZ,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,GAAG,WAAW,EAAE,CAgC/F"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { CONFIG_FILE, editConfigText } from '../config/index.js';
|
|
2
|
+
import { isRecord } from '../check/support/is-record.js';
|
|
3
|
+
import { addFactory } from '../generate/errors/add-factory.js';
|
|
4
|
+
import { addSpecCase } from '../generate/errors/add-spec-case.js';
|
|
5
|
+
import { fitSource } from '../layout/index.js';
|
|
6
|
+
import { toName } from '../naming/index.js';
|
|
7
|
+
import { legacyErrors } from './legacy-errors.js';
|
|
8
|
+
import { nestedCases } from './nested-cases.js';
|
|
9
|
+
import { projectSources } from './project-sources.js';
|
|
10
|
+
import { renderFactory } from './render-factory.js';
|
|
11
|
+
import { rewriteUsages } from './rewrite-usages.js';
|
|
12
|
+
import { specParts } from './spec-parts.js';
|
|
13
|
+
/**
|
|
14
|
+
* Follows the plan: each class per error becomes a factory of the error class of its concept,
|
|
15
|
+
* its spec becomes cases of the spec of that class, every file that named it follows, and the
|
|
16
|
+
* config says the project builds its refusals through factories. Answers the moves it made.
|
|
17
|
+
*/
|
|
18
|
+
export function applyPlan(tree, plan, draft) {
|
|
19
|
+
const moves = plannedMoves(tree, plan, draft);
|
|
20
|
+
for (const planned of moves) {
|
|
21
|
+
moveClass(tree, planned, draft);
|
|
22
|
+
}
|
|
23
|
+
const all = moves.map(({ move }) => move);
|
|
24
|
+
const gone = new Set(draft.removed);
|
|
25
|
+
for (const file of projectSources(tree.ws, tree.config).filter((candidate) => !gone.has(candidate))) {
|
|
26
|
+
const told = (className, conceptClass) => {
|
|
27
|
+
draft.manual.push(`${file}: ${conceptClass} stands where ${className} stood as a value: assert the code of the refusal there.`);
|
|
28
|
+
};
|
|
29
|
+
const source = draft.read(file) ?? '';
|
|
30
|
+
draft.write(file, rewriteUsages(source, all.filter((move) => concerns(move, { file, source }, tree.config)), told));
|
|
31
|
+
}
|
|
32
|
+
draft.write(CONFIG_FILE, editConfigText(draft.read(CONFIG_FILE) ?? '{}', sayFactories));
|
|
33
|
+
return moves;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Two contexts may name a class the same way: a move concerns the files of its own context, and
|
|
37
|
+
* elsewhere the files that import the class from that context.
|
|
38
|
+
*/
|
|
39
|
+
function concerns(move, { file, source }, config) {
|
|
40
|
+
const contexts = `${config.contextsDir}/`;
|
|
41
|
+
return file.startsWith(contexts)
|
|
42
|
+
? file.startsWith(`${contexts}${move.context}/`)
|
|
43
|
+
: source.includes(`/${move.legacyPath}`);
|
|
44
|
+
}
|
|
45
|
+
function sayFactories(raw) {
|
|
46
|
+
raw['stack'] = { ...(isRecord(raw['stack']) ? raw['stack'] : {}), refusals: 'factories' };
|
|
47
|
+
}
|
|
48
|
+
/** The classes still there whose plan entry says where they go; one that cannot move mechanically is said, and left. */
|
|
49
|
+
function plannedMoves({ ws, config }, plan, draft) {
|
|
50
|
+
return legacyErrors(ws, config).flatMap((error) => {
|
|
51
|
+
const entry = (plan.contexts[error.context] ?? []).find((candidate) => candidate.class === error.className && candidate.file === error.file);
|
|
52
|
+
if (entry === undefined || `${entry.concept}Error` === error.className) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
if (error.manual !== undefined) {
|
|
56
|
+
draft.manual.push(`${error.file}: ${error.className} is left as it is, ${error.manual}.`);
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const move = {
|
|
60
|
+
className: error.className,
|
|
61
|
+
conceptClass: `${entry.concept}Error`,
|
|
62
|
+
conceptFile: `${toName(entry.concept).kebab}.error`,
|
|
63
|
+
factory: entry.factory,
|
|
64
|
+
code: error.code,
|
|
65
|
+
context: error.context,
|
|
66
|
+
legacyPath: `${error.context}/domain/errors/${baseName(error.file).replace(/\.ts$/, '')}`,
|
|
67
|
+
};
|
|
68
|
+
return [{ error, move }];
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function moveClass({ config }, { error, move }, draft) {
|
|
72
|
+
const context = `${config.contextsDir}/${error.context}`;
|
|
73
|
+
const target = `${context}/domain/errors/${move.conceptFile}.ts`;
|
|
74
|
+
const factory = renderFactory(error, move);
|
|
75
|
+
const empty = `import { ConceptError } from '@ddd-ts-kit/kernel';\n\nexport class ${move.conceptClass} extends ConceptError {}\n`;
|
|
76
|
+
const next = addFactory(draft.read(target) ?? empty, {
|
|
77
|
+
className: move.conceptClass,
|
|
78
|
+
name: move.factory,
|
|
79
|
+
text: factory,
|
|
80
|
+
});
|
|
81
|
+
if (error.parameters.length > 3) {
|
|
82
|
+
draft.manual.push(`${target}: ${move.conceptClass}.${move.factory} takes more than three parameters, give it one typed object.`);
|
|
83
|
+
}
|
|
84
|
+
for (const property of error.properties) {
|
|
85
|
+
draft.manual.push(`${error.className}.${property} was a property of the error: read \`error.facts.${property}\` where it was read.`);
|
|
86
|
+
}
|
|
87
|
+
draft.remove(error.file);
|
|
88
|
+
draft.write(target, fitSource(next ?? empty));
|
|
89
|
+
moveSpec(context, { error, move }, draft);
|
|
90
|
+
}
|
|
91
|
+
/** The spec of the class, rewritten as any other file, becomes the cases of its factory in the spec of the concept class. */
|
|
92
|
+
function moveSpec(context, { error, move }, draft) {
|
|
93
|
+
const old = `${context}/test/unit/${baseName(error.file).replace(/\.ts$/, '.spec.ts')}`;
|
|
94
|
+
const source = draft.read(old);
|
|
95
|
+
if (source === undefined) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const { imports, cases } = specParts(rewriteUsages(source, [move]));
|
|
99
|
+
const target = `${context}/test/unit/${move.conceptFile}.spec.ts`;
|
|
100
|
+
if (cases === undefined) {
|
|
101
|
+
draft.manual.push(`${old}: no describe block was found, move its cases to ${target} by hand.`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const existing = draft.read(target) ?? `${imports.join('')}\ndescribe('${move.conceptClass}', () => {\n});\n`;
|
|
105
|
+
const merged = addSpecCase(withImports(existing, imports), `describe('${move.factory}'`, nestedCases(move.factory, cases));
|
|
106
|
+
draft.remove(old);
|
|
107
|
+
draft.write(target, merged ?? existing);
|
|
108
|
+
}
|
|
109
|
+
function withImports(spec, imports) {
|
|
110
|
+
const missing = imports.filter((line) => !spec.includes(line));
|
|
111
|
+
const last = [...spec.matchAll(/^import [^;]+;\n/gm)].at(-1);
|
|
112
|
+
const at = last === undefined ? 0 : last.index + last[0].length;
|
|
113
|
+
return spec.slice(0, at) + missing.join('') + spec.slice(at);
|
|
114
|
+
}
|
|
115
|
+
function baseName(file) {
|
|
116
|
+
return file.slice(file.lastIndexOf('/') + 1);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=apply-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-plan.js","sourceRoot":"","sources":["../../src/refusals/apply-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,EAAE,cAAc,EAAE,MAAM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AC,CAAC,CAAC,CAAC;IAC7D,MAAM,EAAE,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The factory name whose code is `code` on the error class of `concept`: the code without the
|
|
3
|
+
* name of the concept at either end (`APPOINTMENT_NOT_FOUND` gives `notFound`), or the whole
|
|
4
|
+
* code when what is left would say nothing.
|
|
5
|
+
*/
|
|
6
|
+
export declare function factoryNameFor(code: string, concept: string): string;
|
|
7
|
+
//# sourceMappingURL=factory-name-for.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-name-for.d.ts","sourceRoot":"","sources":["../../src/refusals/factory-name-for.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CASpE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VAGUE_REFUSAL_NAMES } from '../generate/errors/vague-refusal-names.js';
|
|
2
|
+
import { toName } from '../naming/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The factory name whose code is `code` on the error class of `concept`: the code without the
|
|
5
|
+
* name of the concept at either end (`APPOINTMENT_NOT_FOUND` gives `notFound`), or the whole
|
|
6
|
+
* code when what is left would say nothing.
|
|
7
|
+
*/
|
|
8
|
+
export function factoryNameFor(code, concept) {
|
|
9
|
+
const subject = toName(concept).constant;
|
|
10
|
+
const whole = toName(code).camel;
|
|
11
|
+
const rest = [new RegExp(`^${subject}_`), new RegExp(`_${subject}$`)]
|
|
12
|
+
.filter((edge) => subject !== '' && edge.test(code))
|
|
13
|
+
.map((edge) => toName(code.replace(edge, '')).camel)[0];
|
|
14
|
+
return rest === undefined || rest === '' || VAGUE_REFUSAL_NAMES.includes(rest.toLowerCase()) ? whole : rest;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=factory-name-for.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-name-for.js","sourceRoot":"","sources":["../../src/refusals/factory-name-for.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,OAAe;IAC1D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;IAEjC,MAAM,IAAI,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC;SAClE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACnD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1D,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,IAAI,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** One parameter of the constructor of a class per error, modifiers removed. */
|
|
2
|
+
export interface LegacyParameter {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
/** As written after the colon, or `unknown` when the parameter has no type. */
|
|
5
|
+
readonly type: string;
|
|
6
|
+
}
|
|
7
|
+
/** A class per error of 0.2, as much of it as a factory needs. */
|
|
8
|
+
export interface LegacyError {
|
|
9
|
+
readonly file: string;
|
|
10
|
+
readonly context: string;
|
|
11
|
+
readonly className: string;
|
|
12
|
+
readonly code: string;
|
|
13
|
+
readonly parameters: readonly LegacyParameter[];
|
|
14
|
+
/** The parameters that were also properties of the error (`readonly personId: string`): the facts carry them now. */
|
|
15
|
+
readonly properties: readonly string[];
|
|
16
|
+
/** The expression given to `super(..)`, as written. */
|
|
17
|
+
readonly message: string;
|
|
18
|
+
/** Why the class cannot be turned into a factory mechanically, when it cannot. */
|
|
19
|
+
readonly manual?: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=legacy-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-error.d.ts","sourceRoot":"","sources":["../../src/refusals/legacy-error.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,CAAC;IAChD,qHAAqH;IACrH,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-error.js","sourceRoot":"","sources":["../../src/refusals/legacy-error.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { Workspace } from '../workspace/index.js';
|
|
3
|
+
import type { LegacyError } from './legacy-error.js';
|
|
4
|
+
/** Every class per error of the `domain/errors/` of every context, in the order of their files. */
|
|
5
|
+
export declare function legacyErrors(ws: Workspace, config: Config): LegacyError[];
|
|
6
|
+
//# sourceMappingURL=legacy-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-errors.d.ts","sourceRoot":"","sources":["../../src/refusals/legacy-errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAczE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { readLegacyError } from './read-legacy-error.js';
|
|
2
|
+
/** Every class per error of the `domain/errors/` of every context, in the order of their files. */
|
|
3
|
+
export function legacyErrors(ws, config) {
|
|
4
|
+
return Object.keys(config.contexts).flatMap((context) => {
|
|
5
|
+
const directory = `${config.contextsDir}/${context}/domain/errors`;
|
|
6
|
+
return ws
|
|
7
|
+
.list(directory)
|
|
8
|
+
.filter((name) => name.endsWith('.error.ts'))
|
|
9
|
+
.flatMap((name) => {
|
|
10
|
+
const file = `${directory}/${name}`;
|
|
11
|
+
const read = readLegacyError(ws.read(file) ?? '', { file, context });
|
|
12
|
+
return read === undefined ? [] : [read];
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=legacy-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-errors.js","sourceRoot":"","sources":["../../src/refusals/legacy-errors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,mGAAmG;AACnG,MAAM,UAAU,YAAY,CAAC,EAAa,EAAE,MAAc;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACtD,MAAM,SAAS,GAAG,GAAG,MAAM,CAAC,WAAW,IAAI,OAAO,gBAAgB,CAAC;QAEnE,OAAO,EAAE;aACN,IAAI,CAAC,SAAS,CAAC;aACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;aAC5C,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,IAAI,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAErE,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Workspace } from '../workspace/index.js';
|
|
2
|
+
/** The files a migration writes and removes, kept in memory until it is committed: a dry run commits nothing. */
|
|
3
|
+
export declare class MigrationDraft {
|
|
4
|
+
private readonly ws;
|
|
5
|
+
readonly manual: string[];
|
|
6
|
+
private readonly files;
|
|
7
|
+
constructor(ws: Workspace);
|
|
8
|
+
read(file: string): string | undefined;
|
|
9
|
+
write(file: string, content: string): void;
|
|
10
|
+
remove(file: string): void;
|
|
11
|
+
get written(): string[];
|
|
12
|
+
get removed(): string[];
|
|
13
|
+
commit(): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=migration-draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-draft.d.ts","sourceRoot":"","sources":["../../src/refusals/migration-draft.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,iHAAiH;AACjH,qBAAa,cAAc;IAKb,OAAO,CAAC,QAAQ,CAAC,EAAE;IAJ/B,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAM;IAE/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyC;IAE/D,YAA6B,EAAE,EAAE,SAAS,EAAI;IAE9C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAErC;IAED,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIzC;IAED,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEzB;IAED,IAAI,OAAO,IAAI,MAAM,EAAE,CAEtB;IAED,IAAI,OAAO,IAAI,MAAM,EAAE,CAEtB;IAED,MAAM,IAAI,IAAI,CAWb;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/** The files a migration writes and removes, kept in memory until it is committed: a dry run commits nothing. */
|
|
4
|
+
export class MigrationDraft {
|
|
5
|
+
ws;
|
|
6
|
+
manual = [];
|
|
7
|
+
files = new Map();
|
|
8
|
+
constructor(ws) {
|
|
9
|
+
this.ws = ws;
|
|
10
|
+
}
|
|
11
|
+
read(file) {
|
|
12
|
+
return this.files.has(file) ? this.files.get(file) : this.ws.read(file);
|
|
13
|
+
}
|
|
14
|
+
write(file, content) {
|
|
15
|
+
if (this.read(file) !== content) {
|
|
16
|
+
this.files.set(file, content);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
remove(file) {
|
|
20
|
+
this.files.set(file, undefined);
|
|
21
|
+
}
|
|
22
|
+
get written() {
|
|
23
|
+
return [...this.files].filter(([, content]) => content !== undefined).map(([file]) => file);
|
|
24
|
+
}
|
|
25
|
+
get removed() {
|
|
26
|
+
return [...this.files].filter(([, content]) => content === undefined).map(([file]) => file);
|
|
27
|
+
}
|
|
28
|
+
commit() {
|
|
29
|
+
for (const [file, content] of this.files) {
|
|
30
|
+
const target = path.join(this.ws.root, file);
|
|
31
|
+
if (content === undefined) {
|
|
32
|
+
fs.rmSync(target, { force: true });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
36
|
+
fs.writeFileSync(target, content);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=migration-draft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-draft.js","sourceRoot":"","sources":["../../src/refusals/migration-draft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,iHAAiH;AACjH,MAAM,OAAO,cAAc;IAKI,EAAE;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,KAAK,EAAE,CAAC;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAE7C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACxD,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PlannedFactory } from './planned-factory.js';
|
|
2
|
+
/** What `error-factories --plan` proposes and `--apply` follows: per context, where each class per error goes. */
|
|
3
|
+
export interface MigrationPlan {
|
|
4
|
+
readonly contexts: Readonly<Record<string, readonly PlannedFactory[]>>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=migration-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-plan.d.ts","sourceRoot":"","sources":["../../src/refusals/migration-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,kHAAkH;AAClH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC,CAAC,CAAC;CACxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-plan.js","sourceRoot":"","sources":["../../src/refusals/migration-plan.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** One class per error on its way to a factory: what replaces it wherever it is named. */
|
|
2
|
+
export interface Move {
|
|
3
|
+
/** The class that disappears, for example `SlotTakenError`. */
|
|
4
|
+
readonly className: string;
|
|
5
|
+
/** The error class of the concept, for example `AppointmentError`. */
|
|
6
|
+
readonly conceptClass: string;
|
|
7
|
+
/** The file name of that class without its extension, for example `appointment.error`. */
|
|
8
|
+
readonly conceptFile: string;
|
|
9
|
+
readonly factory: string;
|
|
10
|
+
/** The context the class belongs to, and the path of its file from the contexts directory, without extension. */
|
|
11
|
+
readonly context: string;
|
|
12
|
+
readonly legacyPath: string;
|
|
13
|
+
readonly code: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=move.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../src/refusals/move.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,MAAM,WAAW,IAAI;IACnB,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,0FAA0F;IAC1F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,iHAAiH;IACjH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move.js","sourceRoot":"","sources":["../../src/refusals/move.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-cases.d.ts","sourceRoot":"","sources":["../../src/refusals/nested-cases.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The cases of one factory, under a `describe` of its name, one level deeper. */
|
|
2
|
+
export function nestedCases(factory, cases) {
|
|
3
|
+
const deeper = cases
|
|
4
|
+
.split('\n')
|
|
5
|
+
.map((line) => (line === '' ? line : ` ${line}`))
|
|
6
|
+
.join('\n');
|
|
7
|
+
return ` describe('${factory}', () => {\n${deeper}\n });`;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=nested-cases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-cases.js","sourceRoot":"","sources":["../../src/refusals/nested-cases.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,KAAa;IACxD,MAAM,MAAM,GAAG,KAAK;SACjB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;SACjD,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,eAAe,OAAO,eAAe,MAAM,SAAS,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-file.d.ts","sourceRoot":"","sources":["../../src/refusals/plan-file.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,eAAO,MAAM,SAAS,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-file.js","sourceRoot":"","sources":["../../src/refusals/plan-file.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,MAAM,CAAC,MAAM,SAAS,GAAG,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The decision about one class per error: the concept whose error class takes it, and the name of its factory. */
|
|
2
|
+
export interface PlannedFactory {
|
|
3
|
+
/** The class to replace, for example `SlotTakenError`. */
|
|
4
|
+
readonly class: string;
|
|
5
|
+
readonly file: string;
|
|
6
|
+
readonly code: string;
|
|
7
|
+
/** The concept of the glossary, without `Error`: empty until somebody decides. */
|
|
8
|
+
readonly concept: string;
|
|
9
|
+
readonly factory: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=planned-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planned-factory.d.ts","sourceRoot":"","sources":["../../src/refusals/planned-factory.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planned-factory.js","sourceRoot":"","sources":["../../src/refusals/planned-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LegacyError } from './legacy-error.js';
|
|
2
|
+
import type { Move } from './move.js';
|
|
3
|
+
/** A class per error with the decision taken about it. */
|
|
4
|
+
export interface PlannedMove {
|
|
5
|
+
readonly error: LegacyError;
|
|
6
|
+
readonly move: Move;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=planned-move.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planned-move.d.ts","sourceRoot":"","sources":["../../src/refusals/planned-move.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planned-move.js","sourceRoot":"","sources":["../../src/refusals/planned-move.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { Workspace } from '../workspace/index.js';
|
|
3
|
+
/** Every TypeScript file under the source root and under `test/` at the root of the project. */
|
|
4
|
+
export declare function projectSources(ws: Workspace, config: Config): string[];
|
|
5
|
+
//# sourceMappingURL=project-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-sources.d.ts","sourceRoot":"","sources":["../../src/refusals/project-sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,gGAAgG;AAChG,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAEtE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Every TypeScript file under the source root and under `test/` at the root of the project. */
|
|
2
|
+
export function projectSources(ws, config) {
|
|
3
|
+
return [config.sourceRoot, 'test'].flatMap((directory) => sourcesUnder(ws, directory));
|
|
4
|
+
}
|
|
5
|
+
function sourcesUnder(ws, directory) {
|
|
6
|
+
const here = ws.list(directory).filter((name) => /\.(?:ts|tsx|mts)$/.test(name) && !name.endsWith('.d.ts'));
|
|
7
|
+
const below = ws
|
|
8
|
+
.directories(directory)
|
|
9
|
+
.filter((name) => name !== 'node_modules' && name !== 'dist' && name !== 'generated')
|
|
10
|
+
.flatMap((name) => sourcesUnder(ws, `${directory}/${name}`));
|
|
11
|
+
return [...here.map((name) => `${directory}/${name}`), ...below];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=project-sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-sources.js","sourceRoot":"","sources":["../../src/refusals/project-sources.ts"],"names":[],"mappings":"AAGA,gGAAgG;AAChG,MAAM,UAAU,cAAc,CAAC,EAAa,EAAE,MAAc;IAC1D,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,YAAY,CAAC,EAAa,EAAE,SAAiB;IACpD,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5G,MAAM,KAAK,GAAG,EAAE;SACb,WAAW,CAAC,SAAS,CAAC;SACtB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,WAAW,CAAC;SACpF,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IAE/D,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { Workspace } from '../workspace/index.js';
|
|
3
|
+
import type { LegacyError } from './legacy-error.js';
|
|
4
|
+
import type { MigrationPlan } from './migration-plan.js';
|
|
5
|
+
interface Tree {
|
|
6
|
+
readonly ws: Workspace;
|
|
7
|
+
readonly config: Config;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A proposal: each class per error goes to the aggregate its name or its code starts or ends
|
|
11
|
+
* with, and to nothing when none does. Which concept a refusal is about is a decision of the
|
|
12
|
+
* model: the proposal is edited before it is applied.
|
|
13
|
+
*/
|
|
14
|
+
export declare function proposePlan(errors: readonly LegacyError[], tree: Tree): MigrationPlan;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=propose-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propose-plan.d.ts","sourceRoot":"","sources":["../../src/refusals/propose-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,UAAU,IAAI;IACZ,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,aAAa,CAgBrF"}
|