ddd-ts-kit 0.5.0 → 0.6.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 +22 -1
- package/dist/check/alias/build-scripts.d.ts.map +1 -1
- package/dist/check/alias/build-scripts.js +3 -1
- package/dist/check/alias/build-scripts.js.map +1 -1
- package/dist/check/configuration/config-inspection.d.ts +2 -0
- package/dist/check/configuration/config-inspection.d.ts.map +1 -1
- package/dist/check/configuration/config-inspection.js +5 -1
- package/dist/check/configuration/config-inspection.js.map +1 -1
- package/dist/check/rules/config-valid.d.ts.map +1 -1
- package/dist/check/rules/config-valid.js +1 -0
- package/dist/check/rules/config-valid.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/sdk.d.ts +8 -0
- package/dist/commands/sdk.d.ts.map +1 -0
- package/dist/commands/sdk.js +82 -0
- package/dist/commands/sdk.js.map +1 -0
- package/dist/config/config.d.ts +9 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/default-sdk-name.d.ts +3 -0
- package/dist/config/default-sdk-name.d.ts.map +1 -0
- package/dist/config/default-sdk-name.js +3 -0
- package/dist/config/default-sdk-name.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/parse-config.d.ts.map +1 -1
- package/dist/config/parse-config.js +2 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/parse-sdk.d.ts +4 -0
- package/dist/config/parse-sdk.d.ts.map +1 -0
- package/dist/config/parse-sdk.js +12 -0
- package/dist/config/parse-sdk.js.map +1 -0
- package/dist/config/restack-config-text.d.ts +1 -1
- package/dist/config/restack-config-text.d.ts.map +1 -1
- package/dist/config/restack-config-text.js +5 -2
- package/dist/config/restack-config-text.js.map +1 -1
- package/dist/config/sdk-accesses.d.ts +3 -0
- package/dist/config/sdk-accesses.d.ts.map +1 -0
- package/dist/config/sdk-accesses.js +3 -0
- package/dist/config/sdk-accesses.js.map +1 -0
- package/dist/config/sdk-problems.d.ts +4 -0
- package/dist/config/sdk-problems.d.ts.map +1 -0
- package/dist/config/sdk-problems.js +55 -0
- package/dist/config/sdk-problems.js.map +1 -0
- package/dist/config/serialize-config.js +5 -2
- package/dist/config/serialize-config.js.map +1 -1
- package/dist/generate/kinds/declare-context-entries.d.ts.map +1 -1
- package/dist/generate/kinds/declare-context-entries.js +3 -1
- package/dist/generate/kinds/declare-context-entries.js.map +1 -1
- package/dist/generate/kinds/extraction/entry-point.d.ts.map +1 -1
- package/dist/generate/kinds/extraction/entry-point.js +3 -1
- package/dist/generate/kinds/extraction/entry-point.js.map +1 -1
- package/dist/generate/kinds/knip-project.d.ts +7 -0
- package/dist/generate/kinds/knip-project.d.ts.map +1 -0
- package/dist/generate/kinds/knip-project.js +12 -0
- package/dist/generate/kinds/knip-project.js.map +1 -0
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +6 -0
- 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 -1
- package/dist/help/usage.js.map +1 -1
- package/dist/init/manifest/versions.js +23 -23
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +2 -0
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +12 -2
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +2 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/init/template-vars.d.ts.map +1 -1
- package/dist/init/template-vars.js +2 -0
- package/dist/init/template-vars.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/sdk/agent-instruction.d.ts +3 -0
- package/dist/sdk/agent-instruction.d.ts.map +1 -0
- package/dist/sdk/agent-instruction.js +3 -0
- package/dist/sdk/agent-instruction.js.map +1 -0
- package/dist/sdk/client-document.d.ts +16 -0
- package/dist/sdk/client-document.d.ts.map +1 -0
- package/dist/sdk/client-document.js +2 -0
- package/dist/sdk/client-document.js.map +1 -0
- package/dist/sdk/client-files.d.ts +7 -0
- package/dist/sdk/client-files.d.ts.map +1 -0
- package/dist/sdk/client-files.js +25 -0
- package/dist/sdk/client-files.js.map +1 -0
- package/dist/sdk/client-manifest.d.ts +14 -0
- package/dist/sdk/client-manifest.d.ts.map +1 -0
- package/dist/sdk/client-manifest.js +45 -0
- package/dist/sdk/client-manifest.js.map +1 -0
- package/dist/sdk/client-names.d.ts +7 -0
- package/dist/sdk/client-names.d.ts.map +1 -0
- package/dist/sdk/client-names.js +30 -0
- package/dist/sdk/client-names.js.map +1 -0
- package/dist/sdk/client-operation.d.ts +21 -0
- package/dist/sdk/client-operation.d.ts.map +1 -0
- package/dist/sdk/client-operation.js +2 -0
- package/dist/sdk/client-operation.js.map +1 -0
- package/dist/sdk/client-package-name.d.ts +3 -0
- package/dist/sdk/client-package-name.d.ts.map +1 -0
- package/dist/sdk/client-package-name.js +5 -0
- package/dist/sdk/client-package-name.js.map +1 -0
- package/dist/sdk/client-parameter.d.ts +9 -0
- package/dist/sdk/client-parameter.d.ts.map +1 -0
- package/dist/sdk/client-parameter.js +2 -0
- package/dist/sdk/client-parameter.js.map +1 -0
- package/dist/sdk/client-response.d.ts +10 -0
- package/dist/sdk/client-response.d.ts.map +1 -0
- package/dist/sdk/client-response.js +2 -0
- package/dist/sdk/client-response.js.map +1 -0
- package/dist/sdk/client-tsconfig.d.ts +7 -0
- package/dist/sdk/client-tsconfig.d.ts.map +1 -0
- package/dist/sdk/client-tsconfig.js +26 -0
- package/dist/sdk/client-tsconfig.js.map +1 -0
- package/dist/sdk/clients-directory.d.ts +3 -0
- package/dist/sdk/clients-directory.d.ts.map +1 -0
- package/dist/sdk/clients-directory.js +3 -0
- package/dist/sdk/clients-directory.js.map +1 -0
- package/dist/sdk/contract-documents.d.ts +11 -0
- package/dist/sdk/contract-documents.d.ts.map +1 -0
- package/dist/sdk/contract-documents.js +46 -0
- package/dist/sdk/contract-documents.js.map +1 -0
- package/dist/sdk/doc-comment.d.ts +3 -0
- package/dist/sdk/doc-comment.d.ts.map +1 -0
- package/dist/sdk/doc-comment.js +11 -0
- package/dist/sdk/doc-comment.js.map +1 -0
- package/dist/sdk/document-source.d.ts +6 -0
- package/dist/sdk/document-source.d.ts.map +1 -0
- package/dist/sdk/document-source.js +2 -0
- package/dist/sdk/document-source.js.map +1 -0
- package/dist/sdk/edit-json-file.d.ts +9 -0
- package/dist/sdk/edit-json-file.d.ts.map +1 -0
- package/dist/sdk/edit-json-file.js +31 -0
- package/dist/sdk/edit-json-file.js.map +1 -0
- package/dist/sdk/error-codes.d.ts +4 -0
- package/dist/sdk/error-codes.d.ts.map +1 -0
- package/dist/sdk/error-codes.js +6 -0
- package/dist/sdk/error-codes.js.map +1 -0
- package/dist/sdk/generated-header.d.ts +4 -0
- package/dist/sdk/generated-header.d.ts.map +1 -0
- package/dist/sdk/generated-header.js +5 -0
- package/dist/sdk/generated-header.js.map +1 -0
- package/dist/sdk/index.d.ts +3 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +3 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/instruct-agents.d.ts +8 -0
- package/dist/sdk/instruct-agents.d.ts.map +1 -0
- package/dist/sdk/instruct-agents.js +19 -0
- package/dist/sdk/instruct-agents.js.map +1 -0
- package/dist/sdk/is-input-optional.d.ts +4 -0
- package/dist/sdk/is-input-optional.d.ts.map +1 -0
- package/dist/sdk/is-input-optional.js +5 -0
- package/dist/sdk/is-input-optional.js.map +1 -0
- package/dist/sdk/is-json.d.ts +3 -0
- package/dist/sdk/is-json.d.ts.map +1 -0
- package/dist/sdk/is-json.js +5 -0
- package/dist/sdk/is-json.js.map +1 -0
- package/dist/sdk/manifest-json.d.ts +3 -0
- package/dist/sdk/manifest-json.d.ts.map +1 -0
- package/dist/sdk/manifest-json.js +5 -0
- package/dist/sdk/manifest-json.js.map +1 -0
- package/dist/sdk/operation-description.d.ts +4 -0
- package/dist/sdk/operation-description.d.ts.map +1 -0
- package/dist/sdk/operation-description.js +11 -0
- package/dist/sdk/operation-description.js.map +1 -0
- package/dist/sdk/operation-names.d.ts +8 -0
- package/dist/sdk/operation-names.d.ts.map +1 -0
- package/dist/sdk/operation-names.js +35 -0
- package/dist/sdk/operation-names.js.map +1 -0
- package/dist/sdk/operation-place.d.ts +8 -0
- package/dist/sdk/operation-place.d.ts.map +1 -0
- package/dist/sdk/operation-place.js +2 -0
- package/dist/sdk/operation-place.js.map +1 -0
- package/dist/sdk/planned-client.d.ts +8 -0
- package/dist/sdk/planned-client.d.ts.map +1 -0
- package/dist/sdk/planned-client.js +2 -0
- package/dist/sdk/planned-client.js.map +1 -0
- package/dist/sdk/planned-clients.d.ts +6 -0
- package/dist/sdk/planned-clients.d.ts.map +1 -0
- package/dist/sdk/planned-clients.js +30 -0
- package/dist/sdk/planned-clients.js.map +1 -0
- package/dist/sdk/property-key.d.ts +3 -0
- package/dist/sdk/property-key.d.ts.map +1 -0
- package/dist/sdk/property-key.js +6 -0
- package/dist/sdk/property-key.js.map +1 -0
- package/dist/sdk/put-file.d.ts +4 -0
- package/dist/sdk/put-file.d.ts.map +1 -0
- package/dist/sdk/put-file.js +10 -0
- package/dist/sdk/put-file.js.map +1 -0
- package/dist/sdk/read-client-document.d.ts +5 -0
- package/dist/sdk/read-client-document.d.ts.map +1 -0
- package/dist/sdk/read-client-document.js +34 -0
- package/dist/sdk/read-client-document.js.map +1 -0
- package/dist/sdk/read-operation.d.ts +4 -0
- package/dist/sdk/read-operation.d.ts.map +1 -0
- package/dist/sdk/read-operation.js +64 -0
- package/dist/sdk/read-operation.js.map +1 -0
- package/dist/sdk/read-responses.d.ts +4 -0
- package/dist/sdk/read-responses.d.ts.map +1 -0
- package/dist/sdk/read-responses.js +32 -0
- package/dist/sdk/read-responses.js.map +1 -0
- package/dist/sdk/read-schemes.d.ts +8 -0
- package/dist/sdk/read-schemes.d.ts.map +1 -0
- package/dist/sdk/read-schemes.js +37 -0
- package/dist/sdk/read-schemes.js.map +1 -0
- package/dist/sdk/read-security.d.ts +3 -0
- package/dist/sdk/read-security.d.ts.map +1 -0
- package/dist/sdk/read-security.js +7 -0
- package/dist/sdk/read-security.js.map +1 -0
- package/dist/sdk/render-client.d.ts +4 -0
- package/dist/sdk/render-client.d.ts.map +1 -0
- package/dist/sdk/render-client.js +49 -0
- package/dist/sdk/render-client.js.map +1 -0
- package/dist/sdk/render-errors.d.ts +4 -0
- package/dist/sdk/render-errors.d.ts.map +1 -0
- package/dist/sdk/render-errors.js +18 -0
- package/dist/sdk/render-errors.js.map +1 -0
- package/dist/sdk/render-index.d.ts +4 -0
- package/dist/sdk/render-index.d.ts.map +1 -0
- package/dist/sdk/render-index.js +22 -0
- package/dist/sdk/render-index.js.map +1 -0
- package/dist/sdk/render-input.d.ts +4 -0
- package/dist/sdk/render-input.d.ts.map +1 -0
- package/dist/sdk/render-input.js +31 -0
- package/dist/sdk/render-input.js.map +1 -0
- package/dist/sdk/render-operation.d.ts +7 -0
- package/dist/sdk/render-operation.d.ts.map +1 -0
- package/dist/sdk/render-operation.js +46 -0
- package/dist/sdk/render-operation.js.map +1 -0
- package/dist/sdk/render-operations.d.ts +4 -0
- package/dist/sdk/render-operations.d.ts.map +1 -0
- package/dist/sdk/render-operations.js +12 -0
- package/dist/sdk/render-operations.js.map +1 -0
- package/dist/sdk/render-readme.d.ts +9 -0
- package/dist/sdk/render-readme.d.ts.map +1 -0
- package/dist/sdk/render-readme.js +53 -0
- package/dist/sdk/render-readme.js.map +1 -0
- package/dist/sdk/render-result.d.ts +4 -0
- package/dist/sdk/render-result.d.ts.map +1 -0
- package/dist/sdk/render-result.js +26 -0
- package/dist/sdk/render-result.js.map +1 -0
- package/dist/sdk/render-schemas.d.ts +4 -0
- package/dist/sdk/render-schemas.d.ts.map +1 -0
- package/dist/sdk/render-schemas.js +15 -0
- package/dist/sdk/render-schemas.js.map +1 -0
- package/dist/sdk/schema-type-name.d.ts +3 -0
- package/dist/sdk/schema-type-name.d.ts.map +1 -0
- package/dist/sdk/schema-type-name.js +9 -0
- package/dist/sdk/schema-type-name.js.map +1 -0
- package/dist/sdk/schema-types.d.ts +17 -0
- package/dist/sdk/schema-types.d.ts.map +1 -0
- package/dist/sdk/schema-types.js +120 -0
- package/dist/sdk/schema-types.js.map +1 -0
- package/dist/sdk/scheme-carrier.d.ts +7 -0
- package/dist/sdk/scheme-carrier.d.ts.map +1 -0
- package/dist/sdk/scheme-carrier.js +2 -0
- package/dist/sdk/scheme-carrier.js.map +1 -0
- package/dist/sdk/sdk-scripts.d.ts +8 -0
- package/dist/sdk/sdk-scripts.d.ts.map +1 -0
- package/dist/sdk/sdk-scripts.js +26 -0
- package/dist/sdk/sdk-scripts.js.map +1 -0
- package/dist/sdk/sdk-set-up.d.ts +8 -0
- package/dist/sdk/sdk-set-up.d.ts.map +1 -0
- package/dist/sdk/sdk-set-up.js +2 -0
- package/dist/sdk/sdk-set-up.js.map +1 -0
- package/dist/sdk/set-up-sdk.d.ts +11 -0
- package/dist/sdk/set-up-sdk.d.ts.map +1 -0
- package/dist/sdk/set-up-sdk.js +19 -0
- package/dist/sdk/set-up-sdk.js.map +1 -0
- package/dist/sdk/type-name.d.ts +3 -0
- package/dist/sdk/type-name.d.ts.map +1 -0
- package/dist/sdk/type-name.js +5 -0
- package/dist/sdk/type-name.js.map +1 -0
- package/dist/sdk/unlocked-clients.d.ts +10 -0
- package/dist/sdk/unlocked-clients.d.ts.map +1 -0
- package/dist/sdk/unlocked-clients.js +36 -0
- package/dist/sdk/unlocked-clients.js.map +1 -0
- package/dist/sdk/wire-sdk.d.ts +12 -0
- package/dist/sdk/wire-sdk.d.ts.map +1 -0
- package/dist/sdk/wire-sdk.js +58 -0
- package/dist/sdk/wire-sdk.js.map +1 -0
- package/dist/sdk/with-client-paths.d.ts +8 -0
- package/dist/sdk/with-client-paths.d.ts.map +1 -0
- package/dist/sdk/with-client-paths.js +20 -0
- package/dist/sdk/with-client-paths.js.map +1 -0
- package/dist/sdk/with-entry.d.ts +3 -0
- package/dist/sdk/with-entry.d.ts.map +1 -0
- package/dist/sdk/with-entry.js +6 -0
- package/dist/sdk/with-entry.js.map +1 -0
- package/dist/sdk/with-knip-workspaces.d.ts +7 -0
- package/dist/sdk/with-knip-workspaces.d.ts.map +1 -0
- package/dist/sdk/with-knip-workspaces.js +40 -0
- package/dist/sdk/with-knip-workspaces.js.map +1 -0
- package/dist/sdk/write-clients.d.ts +10 -0
- package/dist/sdk/write-clients.d.ts.map +1 -0
- package/dist/sdk/write-clients.js +32 -0
- package/dist/sdk/write-clients.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/yaml/from-yaml.d.ts +8 -0
- package/dist/yaml/from-yaml.d.ts.map +1 -0
- package/dist/yaml/from-yaml.js +149 -0
- package/dist/yaml/from-yaml.js.map +1 -0
- package/dist/yaml/read-scalar.d.ts +7 -0
- package/dist/yaml/read-scalar.d.ts.map +1 -0
- package/dist/yaml/read-scalar.js +50 -0
- package/dist/yaml/read-scalar.js.map +1 -0
- package/dist/yaml/yaml-shape-error.d.ts +6 -0
- package/dist/yaml/yaml-shape-error.d.ts.map +1 -0
- package/dist/yaml/yaml-shape-error.js +10 -0
- package/dist/yaml/yaml-shape-error.js.map +1 -0
- package/package.json +2 -2
- package/templates/init/CLAUDE.md.tpl +3 -0
- package/templates/init/README.md.tpl +8 -1
- package/templates/init/rules/presentation.md.tpl +4 -1
- package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +3 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/sdk/errors.ts.tpl +30 -0
- package/templates/sdk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AC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;AACnH,CAAC;AAED,iEAAiE;AACjE,SAAS,OAAO,CAAC,IAAuB,EAAE,QAAgB;IACxD,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;QACrB,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAChC,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAEvB,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QAC1B,IAAI,CAAC,GAAG,EAAE,CAAC;IACb,CAAC;IAED,OAAO,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A scalar of one line as `toYaml` writes it: single- or double-quoted text, `{}` or `[]`, and
|
|
3
|
+
* plain text, which is a string unless it reads as null, a boolean or a number (a string that
|
|
4
|
+
* would read so is always quoted).
|
|
5
|
+
*/
|
|
6
|
+
export declare function readScalar(text: string, line: number): unknown;
|
|
7
|
+
//# sourceMappingURL=read-scalar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-scalar.d.ts","sourceRoot":"","sources":["../../src/yaml/read-scalar.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAkB9D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { YamlShapeError } from './yaml-shape-error.js';
|
|
2
|
+
/** What starts a scalar the kit never writes plain: a flow collection, an anchor, an alias, a tag, a comment, a folded block. */
|
|
3
|
+
const UNWRITTEN = /^[[\]{}&*!#>%@`|]/;
|
|
4
|
+
const NUMBER = /^[-+]?\.?\d/;
|
|
5
|
+
/**
|
|
6
|
+
* A scalar of one line as `toYaml` writes it: single- or double-quoted text, `{}` or `[]`, and
|
|
7
|
+
* plain text, which is a string unless it reads as null, a boolean or a number (a string that
|
|
8
|
+
* would read so is always quoted).
|
|
9
|
+
*/
|
|
10
|
+
export function readScalar(text, line) {
|
|
11
|
+
if (text === '{}' || text === '[]') {
|
|
12
|
+
return text === '{}' ? {} : [];
|
|
13
|
+
}
|
|
14
|
+
if (text.startsWith("'") && text.endsWith("'") && text.length > 1) {
|
|
15
|
+
return text.slice(1, -1).replaceAll("''", "'");
|
|
16
|
+
}
|
|
17
|
+
if (text.startsWith('"')) {
|
|
18
|
+
return doubleQuoted(text, line);
|
|
19
|
+
}
|
|
20
|
+
if (UNWRITTEN.test(text)) {
|
|
21
|
+
throw new YamlShapeError(line, `"${text}" is not a scalar the kit writes`);
|
|
22
|
+
}
|
|
23
|
+
return plain(text, line);
|
|
24
|
+
}
|
|
25
|
+
function doubleQuoted(text, line) {
|
|
26
|
+
try {
|
|
27
|
+
const value = JSON.parse(text);
|
|
28
|
+
if (typeof value === 'string') {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Reported below, with the line.
|
|
34
|
+
}
|
|
35
|
+
throw new YamlShapeError(line, `${text} is not a double-quoted text the kit writes`);
|
|
36
|
+
}
|
|
37
|
+
function plain(text, line) {
|
|
38
|
+
if (text === 'null' || text === 'true' || text === 'false') {
|
|
39
|
+
return text === 'null' ? null : text === 'true';
|
|
40
|
+
}
|
|
41
|
+
if (!NUMBER.test(text)) {
|
|
42
|
+
return text;
|
|
43
|
+
}
|
|
44
|
+
const number = Number(text);
|
|
45
|
+
if (!Number.isFinite(number)) {
|
|
46
|
+
throw new YamlShapeError(line, `"${text}" is not a number the kit writes`);
|
|
47
|
+
}
|
|
48
|
+
return number;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=read-scalar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-scalar.js","sourceRoot":"","sources":["../../src/yaml/read-scalar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,iIAAiI;AACjI,MAAM,SAAS,GAAG,mBAAmB,CAAC;AACtC,MAAM,MAAM,GAAG,aAAa,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,IAAY;IACnD,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACnC,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjC,CAAC;IAED,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,IAAI,kCAAkC,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,IAAY;IAC9C,IAAI,CAAC;QACH,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAExC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,iCAAiC;IACnC,CAAC;IAED,MAAM,IAAI,cAAc,CAAC,IAAI,EAAE,GAAG,IAAI,6CAA6C,CAAC,CAAC;AACvF,CAAC;AAED,SAAS,KAAK,CAAC,IAAY,EAAE,IAAY;IACvC,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3D,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;IAClD,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,IAAI,kCAAkC,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** A YAML text that is not as `toYaml` writes it: the reader of the kit takes no other. */
|
|
2
|
+
export declare class YamlShapeError extends Error {
|
|
3
|
+
readonly line: number;
|
|
4
|
+
constructor(index: number, reason: string, line?: number);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=yaml-shape-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-shape-error.d.ts","sourceRoot":"","sources":["../../src/yaml/yaml-shape-error.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,qBAAa,cAAe,SAAQ,KAAK;IAIrC,QAAQ,CAAC,IAAI;IAHf,YACE,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACL,IAAI,SAAY,EAI1B;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A YAML text that is not as `toYaml` writes it: the reader of the kit takes no other. */
|
|
2
|
+
export class YamlShapeError extends Error {
|
|
3
|
+
line;
|
|
4
|
+
constructor(index, reason, line = index + 1) {
|
|
5
|
+
super(`line ${line}: ${reason}`);
|
|
6
|
+
this.line = line;
|
|
7
|
+
this.name = 'YamlShapeError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=yaml-shape-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-shape-error.js","sourceRoot":"","sources":["../../src/yaml/yaml-shape-error.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,OAAO,cAAe,SAAQ,KAAK;IAI5B,IAAI;IAHf,YACE,KAAa,EACb,MAAc,EACL,IAAI,GAAG,KAAK,GAAG,CAAC;QAEzB,KAAK,CAAC,QAAQ,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;oBAFxB,IAAI;QAGb,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ddd-ts-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Bootstrap, scaffold and verify DDD and Clean Architecture TypeScript projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"clean:packages": "node dist/bin.js check --clean-only ../kernel/src ../validation/src ../http/src ../tracing/src ../di/src ../events/src ../testing/src ../drizzle/src ../knex/src ../prisma/src ../typeorm/src ../aspects/src ../rabbitmq/src ../auth/src ../audit/src ../redis/src ../scheduling/src ../pino/src ../winston/src ../sentry/src ../kafka/src ../nats/src ../eslint-plugin/src"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ddd-ts-kit/kernel": "^0.
|
|
32
|
+
"@ddd-ts-kit/kernel": "^0.6.0"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -30,6 +30,9 @@ Never edit `<context>.declarations.ts`: `generate`, `docs` and `npm run dev` rew
|
|
|
30
30
|
Never edit `<context>.dependencies.ts`: `generate`, `docs` and `npm run dev` rewrite it from the constructor signatures (it registers what each constructor is injected). After changing a constructor by hand, `npx ddd-ts-kit docs`.
|
|
31
31
|
{{/if}}
|
|
32
32
|
Never edit the contracts under `openapi/` (`openapi/openapi.yaml`, one file per document when `openapi.documents` splits it), `docs/integration/asyncapi.yaml`, `docs/integration/event-catalog.md`, `{{config.platformDir}}/http/openapi-documents.ts`, `.dependency-cruiser.cjs` or the generated sections of a `CONTEXT.md`: change the code or the config, then `npm run docs:generate`, `npx ddd-ts-kit docs` and `npx ddd-ts-kit depcruise-config --write`.
|
|
33
|
+
{{#if sdk.on}}
|
|
34
|
+
{{sdk.instruction}}
|
|
35
|
+
{{/if}}
|
|
33
36
|
Imports: a file of the project is imported by its alias from the project root, never by a relative path, the same directory included: `{{alias.source}}/...` for `{{config.sourceRoot}}/`, `{{alias.test}}/...` for `test/`, `{{alias.scripts}}/...` for `scripts/`, {{#if alias.extensionless}}never ending in `.js` or `.ts`, and naming a file, never a directory{{/if}}{{#unless alias.extensionless}}always ending in `.js`{{/unless}} (`imports/alias-only`, `imports/extension`; `npm run lint:fix` rewrites a relative import and a wrong ending). The alias is declared once, under `paths` in `tsconfig.json`, from `importAlias` of `ddd-ts-kit.config.json`, and the ending follows `importExtension`: never add a second entry or mapping, never change `module` or `moduleResolution` in `tsconfig.json`, and never compile without `npm run build`, which rewrites the aliases of `dist/` into relative paths ending in `.js` for Node (`imports/alias-declared`).
|
|
34
37
|
Everywhere: one exported class, interface or function per file, named after it in kebab-case; at most 350 lines a file, 30 lines and 3 parameters a function; `private` members, never `#name`; a blank line before a `return` and around `if`, `for`, `try` (`npm run lint:fix`); braces around the body of every `if`, `else`, `for`, `while` and `do`, on its own lines: a branch is visible at a glance, and a statement added to it later cannot silently fall outside it. `npm run format` (Biome, line width 120) lays out every file: do not spend tokens on line breaks.
|
|
35
38
|
|
|
@@ -51,6 +51,13 @@ production unless `API_DOCS=true`; a contract split into documents (`openapi.doc
|
|
|
51
51
|
`ddd-ts-kit.config.json`) is served at `/openapi/<name>.json`, and the page offers each one.
|
|
52
52
|
`npm run docs:generate` commits it as `openapi/openapi.yaml` (or one file per document).
|
|
53
53
|
{{/if}}
|
|
54
|
+
{{#if sdk.on}}
|
|
55
|
+
|
|
56
|
+
A typed client of the contract is generated for its callers, one workspace package per document
|
|
57
|
+
under `clients/` (`npx ddd-ts-kit sdk`, run by `npm run docs:generate`): typed errors keyed by
|
|
58
|
+
the error codes of each operation, a credential per security scheme, no runtime dependency.
|
|
59
|
+
`npm run sdk:build` compiles them; publishing one is a manual step, its README says how.
|
|
60
|
+
{{/if}}
|
|
54
61
|
|
|
55
62
|
## How it is put together
|
|
56
63
|
|
|
@@ -290,5 +297,5 @@ for each moment of the project: https://github.com/gbourgeat/ddd-ts-kit/blob/mai
|
|
|
290
297
|
| `npm test` | domain, application and adapter specs |
|
|
291
298
|
| `npm run test:e2e` | the whole application through HTTP, on an in-process database unless `DATABASE_URL` is set |
|
|
292
299
|
| `npm run check:arch` | `ddd-ts-kit check` |
|
|
293
|
-
| `npm run docs:generate` | context map, OpenAPI, AsyncAPI and event catalog |
|
|
300
|
+
| `npm run docs:generate` | context map, OpenAPI, AsyncAPI and event catalog{{#if sdk.on}}, the clients under `clients/`{{/if}} |
|
|
294
301
|
| `npm run verify` | everything CI runs |
|
|
@@ -3,6 +3,9 @@ paths:
|
|
|
3
3
|
- "{{config.contextsDir}}/*/presentation/**"
|
|
4
4
|
- "openapi/**"
|
|
5
5
|
- "scripts/openapi.ts"
|
|
6
|
+
{{#if sdk.on}}
|
|
7
|
+
- "clients/**"
|
|
8
|
+
{{/if}}
|
|
6
9
|
---
|
|
7
10
|
|
|
8
11
|
# Presentation layer
|
|
@@ -28,5 +31,5 @@ paths:
|
|
|
28
31
|
- Request and response types are presentation types, one class or schema per file next to the controller (`*.body.ts`, `*.params.ts`, `*.answer.ts`...; `*.dto.ts` for function routes and under `shared/`): never an aggregate, never a row.
|
|
29
32
|
- Never put the message of an unexpected failure in a response or a log.
|
|
30
33
|
- Files: the canonical tree of `presentation/http/` (`naming/suffix`, `tree/closed`): a folder per controller, `*.routes.ts` for the groups, `guards/`, `shared/`; function routes stay flat (`*.route.ts`, `*.dto.ts`).
|
|
31
|
-
- After a change, `npm run docs:generate` regenerates the contract, `openapi/openapi.yaml` (one file per document when `openapi.documents` of `ddd-ts-kit.config.json` splits it; JSON under `openapi.format: json`), committed with the route; CI fails on a difference. Never edit it by hand.
|
|
34
|
+
- After a change, `npm run docs:generate` regenerates the contract, `openapi/openapi.yaml` (one file per document when `openapi.documents` of `ddd-ts-kit.config.json` splits it; JSON under `openapi.format: json`), committed with the route; CI fails on a difference. Never edit it by hand.{{#if sdk.on}} It regenerates the typed clients under `clients/` too (`npx ddd-ts-kit sdk`), committed with it.{{/if}}
|
|
32
35
|
- Contract with `/ddd-ts-kit:document`. Create with `npx ddd-ts-kit generate route <context> <UseCase> --method <M> --path <p> [--group <Name>] [--mapper] [--serializer] --json`, then `generate e2e <context> <UseCase>`; `generate route-group` and `generate guard` write a group and a guard.
|
|
@@ -205,6 +205,9 @@ build:
|
|
|
205
205
|
stage: test
|
|
206
206
|
needs: [install]
|
|
207
207
|
script:
|
|
208
|
+
{{#if sdk.on}}
|
|
209
|
+
# The production build, and the clients of the contract (sdk:build).
|
|
210
|
+
{{/if}}
|
|
208
211
|
- npm run ci:build
|
|
209
212
|
# The generated documents and contracts, from that build.
|
|
210
213
|
- npm run ci:docs
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@biomejs/biome": "2.5.15",
|
|
24
24
|
"@commitlint/cli": "^21.2.3",
|
|
25
25
|
"@commitlint/config-conventional": "^21.2.3",
|
|
26
|
-
"@ddd-ts-kit/eslint-plugin": "^0.
|
|
26
|
+
"@ddd-ts-kit/eslint-plugin": "^0.6.0",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@typescript/native": "npm:typescript@~7.0.2",
|
|
29
29
|
"@vitest/coverage-v8": "5.0.3",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{{header}}
|
|
2
|
+
import { type Failure, ProblemError } from './runtime.js';
|
|
3
|
+
import type * as Schemas from './schemas.js';
|
|
4
|
+
|
|
5
|
+
/** Every error code an operation of the API declares: branch on these, never on a title or a message. */
|
|
6
|
+
export const ERROR_CODES = {{codes}} as const;
|
|
7
|
+
|
|
8
|
+
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
9
|
+
|
|
10
|
+
/** A problem document of the API with one of its codes. */
|
|
11
|
+
export type ProblemOf<Code extends ErrorCode = ErrorCode> = Failure<number, Code, {{problem}}>['problem'];
|
|
12
|
+
|
|
13
|
+
export function isErrorCode(value: unknown): value is ErrorCode {
|
|
14
|
+
return ERROR_CODES.some((code) => code === value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* True when `unwrap` threw a refusal of the API with one of the codes, any of its codes when none
|
|
19
|
+
* is given: `if (isProblem(error, 'SOME_CODE')) { ... }`.
|
|
20
|
+
*/
|
|
21
|
+
export function isProblem<Code extends ErrorCode>(
|
|
22
|
+
error: unknown,
|
|
23
|
+
...codes: readonly Code[]
|
|
24
|
+
): error is ProblemError<Failure<number, Code, {{problem}}>> & { readonly code: Code } {
|
|
25
|
+
if (!(error instanceof ProblemError)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return codes.length === 0 ? isErrorCode(error.code) : codes.some((code) => code === error.code);
|
|
30
|
+
}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
// Generated by `ddd-ts-kit sdk`: never edit it. The part of the client that is the same for every
|
|
2
|
+
// contract: how a request is written, how its credential is attached, how the answer is read.
|
|
3
|
+
|
|
4
|
+
/** A credential: the value itself, or a function asked before each request (a token that expires). */
|
|
5
|
+
export type Credential = string | (() => string | undefined | Promise<string | undefined>);
|
|
6
|
+
|
|
7
|
+
export interface ClientOptions<Scheme extends string = string> {
|
|
8
|
+
/** Where the API answers: `https://api.example.com`, or `/api` in a browser on the same origin. */
|
|
9
|
+
readonly baseUrl: string;
|
|
10
|
+
/** The credential of each security scheme of the contract: an operation sends those its security names. */
|
|
11
|
+
readonly credentials?: Partial<Record<Scheme, Credential>>;
|
|
12
|
+
/** Headers sent with every request. */
|
|
13
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
14
|
+
/** What sends a request: the global `fetch` unless another one is given (a test, a runtime without it, a retry). */
|
|
15
|
+
readonly fetch?: (request: Request) => Promise<Response>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** What one call may add: headers of its own, a signal that aborts it. */
|
|
19
|
+
export interface CallOptions {
|
|
20
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
21
|
+
readonly signal?: AbortSignal;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** How a security scheme carries its credential. */
|
|
25
|
+
export interface SchemeCarrier {
|
|
26
|
+
readonly in: 'header' | 'query' | 'cookie';
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly prefix: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The options of a client, with the security schemes of its contract: what every operation is called with. */
|
|
32
|
+
export interface Connection {
|
|
33
|
+
readonly baseUrl: string;
|
|
34
|
+
readonly credentials: Readonly<Record<string, Credential | undefined>>;
|
|
35
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
36
|
+
readonly fetch: (request: Request) => Promise<Response>;
|
|
37
|
+
readonly schemes: Readonly<Record<string, SchemeCarrier>>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** An operation of the contract, as the client sends it and reads its answer. */
|
|
41
|
+
export interface Operation {
|
|
42
|
+
readonly method: string;
|
|
43
|
+
readonly path: string;
|
|
44
|
+
/** The alternatives of its security, each the schemes sent together; none, or an empty one: it may be called anonymously. */
|
|
45
|
+
readonly security: readonly (readonly string[])[];
|
|
46
|
+
/** How the body of each status the contract declares is read. */
|
|
47
|
+
readonly responses: Readonly<Record<number, 'json' | 'text' | 'none'>>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type Scalar = string | number | boolean;
|
|
51
|
+
|
|
52
|
+
/** What a call sends: the parameters and the body the contract declares, and the options of the call. */
|
|
53
|
+
export interface CallRequest extends CallOptions {
|
|
54
|
+
readonly path?: Readonly<Record<string, Scalar>>;
|
|
55
|
+
readonly query?: Readonly<Record<string, Scalar | readonly Scalar[] | undefined>>;
|
|
56
|
+
readonly header?: Readonly<Record<string, Scalar | undefined>>;
|
|
57
|
+
readonly body?: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A status the contract declares as a success, with its body. */
|
|
61
|
+
export interface Success<Status extends number, Data> {
|
|
62
|
+
readonly ok: true;
|
|
63
|
+
readonly status: Status;
|
|
64
|
+
readonly data: Data;
|
|
65
|
+
readonly response: Response;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** A problem document whose `code` is one of the codes the contract declares for its status. */
|
|
69
|
+
export type WithCode<Problem, Code extends string> = Problem extends { readonly code: unknown }
|
|
70
|
+
? Omit<Problem, 'code'> & { readonly code: Code }
|
|
71
|
+
: Problem;
|
|
72
|
+
|
|
73
|
+
/** A status the contract declares as a refusal, with its problem document. */
|
|
74
|
+
export interface Failure<Status extends number, Code extends string, Problem> {
|
|
75
|
+
readonly ok: false;
|
|
76
|
+
readonly status: Status;
|
|
77
|
+
readonly problem: WithCode<Problem, Code>;
|
|
78
|
+
readonly response: Response;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Any answer an operation declares. */
|
|
82
|
+
export type Outcome = Success<number, unknown> | Failure<number, string, unknown>;
|
|
83
|
+
|
|
84
|
+
/** The body of the successes of an outcome. */
|
|
85
|
+
export type DataOf<Result extends Outcome> = Extract<Result, { readonly ok: true }>['data'];
|
|
86
|
+
|
|
87
|
+
/** The options of a client, made ready to send: the global `fetch` unless another is given. */
|
|
88
|
+
export function openConnection(options: ClientOptions, schemes: Readonly<Record<string, SchemeCarrier>>): Connection {
|
|
89
|
+
return {
|
|
90
|
+
baseUrl: withoutTrailingSlashes(options.baseUrl),
|
|
91
|
+
credentials: options.credentials ?? {},
|
|
92
|
+
headers: options.headers ?? {},
|
|
93
|
+
fetch: options.fetch ?? ((request) => fetch(request)),
|
|
94
|
+
schemes,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** A base URL ends where its path starts: `https://api.example.com/v1/` and `.../v1` are one. A loop, not a regular expression, whose time would grow with the square of the slashes. */
|
|
99
|
+
function withoutTrailingSlashes(url: string): string {
|
|
100
|
+
let end = url.length;
|
|
101
|
+
|
|
102
|
+
while (end > 0 && url.charAt(end - 1) === '/') {
|
|
103
|
+
end -= 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return url.slice(0, end);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* A status the contract does not declare for the operation: a fault of the server (a 500, which
|
|
111
|
+
* the kit answers with a problem document, its `code` `INTERNAL_ERROR` and its `requestId` the
|
|
112
|
+
* reference of the request in the logs of the server), a proxy in between, or a server and a
|
|
113
|
+
* contract that disagree. A problem document answered with it is read: `code` and `requestId`.
|
|
114
|
+
*/
|
|
115
|
+
export class UnexpectedResponseError extends Error {
|
|
116
|
+
readonly status: number;
|
|
117
|
+
/** The problem document of the answer (`application/problem+json`), none when it answered another body. */
|
|
118
|
+
readonly problem: Readonly<Record<string, unknown>> | undefined;
|
|
119
|
+
readonly code: string | undefined;
|
|
120
|
+
/** What to quote to the team of the API: the reference of the request in its logs. */
|
|
121
|
+
readonly requestId: string | undefined;
|
|
122
|
+
|
|
123
|
+
constructor(
|
|
124
|
+
readonly response: Response,
|
|
125
|
+
readonly body: string,
|
|
126
|
+
) {
|
|
127
|
+
const problem = problemOf(response, body);
|
|
128
|
+
const code = codeOf(problem);
|
|
129
|
+
const requestId = textOf(problem?.['requestId']);
|
|
130
|
+
|
|
131
|
+
super(unexpectedMessage(response.status, code, requestId));
|
|
132
|
+
this.name = 'UnexpectedResponseError';
|
|
133
|
+
this.status = response.status;
|
|
134
|
+
this.problem = problem;
|
|
135
|
+
this.code = code;
|
|
136
|
+
this.requestId = requestId;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function problemOf(response: Response, body: string): Readonly<Record<string, unknown>> | undefined {
|
|
141
|
+
if (!(response.headers.get('content-type') ?? '').includes('json')) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
const parsed: unknown = JSON.parse(body);
|
|
147
|
+
|
|
148
|
+
return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed) ? { ...parsed } : undefined;
|
|
149
|
+
} catch {
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function unexpectedMessage(status: number, code: string | undefined, requestId: string | undefined): string {
|
|
155
|
+
const named = `${status}${code === undefined ? '' : ` ${code}`}${requestId === undefined ? '' : ` (request ${requestId})`}`;
|
|
156
|
+
|
|
157
|
+
return status >= 500
|
|
158
|
+
? `The API failed with ${named}.`
|
|
159
|
+
: `The API answered ${named}, a status its contract does not declare for this operation.`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** A refusal the contract declares, thrown by `unwrap`: its status, its problem document and its code. */
|
|
163
|
+
export class ProblemError<Refusal extends Failure<number, string, unknown> = Failure<number, string, unknown>> extends Error {
|
|
164
|
+
readonly status: Refusal['status'];
|
|
165
|
+
readonly problem: Refusal['problem'];
|
|
166
|
+
readonly code: string | undefined;
|
|
167
|
+
|
|
168
|
+
constructor(readonly failure: Refusal) {
|
|
169
|
+
const code = codeOf(failure.problem);
|
|
170
|
+
|
|
171
|
+
super(`The API refused with ${failure.status}${code === undefined ? '' : ` ${code}`}.`);
|
|
172
|
+
this.name = 'ProblemError';
|
|
173
|
+
this.status = failure.status;
|
|
174
|
+
this.problem = failure.problem;
|
|
175
|
+
this.code = code;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** The body of a success; a refusal is thrown as a `ProblemError`. */
|
|
180
|
+
export function unwrap<Result extends Outcome>(result: Promise<Result>): Promise<DataOf<Result>>;
|
|
181
|
+
export async function unwrap(result: Promise<Outcome>): Promise<unknown> {
|
|
182
|
+
const settled = await result;
|
|
183
|
+
|
|
184
|
+
if (settled.ok) {
|
|
185
|
+
return settled.data;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
throw new ProblemError(settled);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Sends a call and reads its answer as the outcome its operation declares. The body is not
|
|
193
|
+
* validated: it is the one the contract describes, which the drift check of the project keeps
|
|
194
|
+
* equal to the routes. A status it does not declare throws an `UnexpectedResponseError`.
|
|
195
|
+
*/
|
|
196
|
+
export function send<Result extends Outcome>(
|
|
197
|
+
connection: Connection,
|
|
198
|
+
operation: Operation,
|
|
199
|
+
request: CallRequest,
|
|
200
|
+
): Promise<Result>;
|
|
201
|
+
export async function send(connection: Connection, operation: Operation, request: CallRequest): Promise<Outcome> {
|
|
202
|
+
const headers = mergedHeaders([connection.headers, texts(request.header), request.headers ?? {}]);
|
|
203
|
+
const query = queryOf(request.query);
|
|
204
|
+
|
|
205
|
+
await authenticate(connection, operation.security, { headers, query });
|
|
206
|
+
|
|
207
|
+
const search = query.toString();
|
|
208
|
+
const url = `${connection.baseUrl}${pathOf(operation.path, request.path)}${search === '' ? '' : `?${search}`}`;
|
|
209
|
+
const body = request.body === undefined ? undefined : JSON.stringify(request.body);
|
|
210
|
+
|
|
211
|
+
if (body !== undefined) {
|
|
212
|
+
headers.set('content-type', 'application/json');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const init: RequestInit = { method: operation.method, headers };
|
|
216
|
+
const response = await connection.fetch(
|
|
217
|
+
new Request(url, { ...init, ...(body === undefined ? {} : { body }), ...signalOf(request) }),
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
return outcomeOf(operation, response);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function signalOf(request: CallRequest): { signal?: AbortSignal } {
|
|
224
|
+
return request.signal === undefined ? {} : { signal: request.signal };
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Each set over the one before, whatever the case of its names: a header of the call replaces the one of the client. */
|
|
228
|
+
function mergedHeaders(sets: readonly Readonly<Record<string, string>>[]): Headers {
|
|
229
|
+
const headers = new Headers();
|
|
230
|
+
|
|
231
|
+
for (const set of sets) {
|
|
232
|
+
for (const [name, value] of Object.entries(set)) {
|
|
233
|
+
headers.set(name, value);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return headers;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function texts(values: CallRequest['header']): Record<string, string> {
|
|
241
|
+
const entries = Object.entries(values ?? {}).flatMap(([name, value]) =>
|
|
242
|
+
value === undefined ? [] : [[name, String(value)] as const],
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
return Object.fromEntries(entries);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function pathOf(template: string, values: CallRequest['path']): string {
|
|
249
|
+
return template.replace(/\{([^}]+)\}/g, (_match, name: string) => encodeURIComponent(String(values?.[name] ?? '')));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** A list is sent as the parameter repeated, the form OpenAPI calls `explode`. */
|
|
253
|
+
function queryOf(values: CallRequest['query']): URLSearchParams {
|
|
254
|
+
const query = new URLSearchParams();
|
|
255
|
+
|
|
256
|
+
for (const [name, value] of Object.entries(values ?? {})) {
|
|
257
|
+
for (const one of value === undefined ? [] : Array.isArray(value) ? value : [value]) {
|
|
258
|
+
query.append(name, String(one));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return query;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
interface Carried {
|
|
266
|
+
readonly headers: Headers;
|
|
267
|
+
readonly query: URLSearchParams;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** The first alternative of the security whose every scheme has a credential; none: the call goes anonymous, and the API answers as it decides. */
|
|
271
|
+
async function authenticate(
|
|
272
|
+
connection: Connection,
|
|
273
|
+
security: Operation['security'],
|
|
274
|
+
carried: Carried,
|
|
275
|
+
): Promise<void> {
|
|
276
|
+
for (const alternative of security) {
|
|
277
|
+
const values = await Promise.all(alternative.map((scheme) => resolved(connection.credentials[scheme])));
|
|
278
|
+
|
|
279
|
+
if (values.every((value) => value !== undefined)) {
|
|
280
|
+
alternative.forEach((scheme, index) => attach(connection.schemes[scheme], values[index], carried));
|
|
281
|
+
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
async function resolved(credential: Credential | undefined): Promise<string | undefined> {
|
|
288
|
+
return typeof credential === 'function' ? await credential() : credential;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function attach(carrier: SchemeCarrier | undefined, value: string | undefined, carried: Carried): void {
|
|
292
|
+
if (carrier === undefined || value === undefined) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (carrier.in === 'query') {
|
|
297
|
+
carried.query.set(carrier.name, value);
|
|
298
|
+
} else if (carrier.in === 'cookie') {
|
|
299
|
+
// Outside a browser only: a browser drops a Cookie header and sends its own cookies (`credentials: 'include'`).
|
|
300
|
+
const cookie = carried.headers.get('cookie');
|
|
301
|
+
|
|
302
|
+
carried.headers.set('cookie', `${cookie === null ? '' : `${cookie}; `}${carrier.name}=${encodeURIComponent(value)}`);
|
|
303
|
+
} else {
|
|
304
|
+
carried.headers.set(carrier.name, `${carrier.prefix}${value}`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
async function outcomeOf(operation: Operation, response: Response): Promise<Outcome> {
|
|
309
|
+
const read = operation.responses[response.status];
|
|
310
|
+
|
|
311
|
+
if (read === undefined) {
|
|
312
|
+
throw new UnexpectedResponseError(response, await response.text());
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const body = await bodyOf(response, read);
|
|
316
|
+
|
|
317
|
+
// A status below 400 is a success, as the types of the outcome say: a 304, a 302 under `redirect: 'manual'`.
|
|
318
|
+
return response.status < 400
|
|
319
|
+
? { ok: true, status: response.status, data: body, response }
|
|
320
|
+
: { ok: false, status: response.status, problem: body, response };
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
async function bodyOf(response: Response, read: 'json' | 'text' | 'none'): Promise<unknown> {
|
|
324
|
+
if (read === 'none') {
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const text = await response.text();
|
|
329
|
+
|
|
330
|
+
if (read === 'text') {
|
|
331
|
+
return text;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return text === '' ? undefined : JSON.parse(text);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function codeOf(problem: unknown): string | undefined {
|
|
338
|
+
if (typeof problem !== 'object' || problem === null || !('code' in problem)) {
|
|
339
|
+
return undefined;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return textOf(problem.code);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function textOf(value: unknown): string | undefined {
|
|
346
|
+
return typeof value === 'string' ? value : undefined;
|
|
347
|
+
}
|