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/runtime.ts.tpl +347 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { generatedHeader } from './generated-header.js';
|
|
2
|
+
import { isInputOptional } from './is-input-optional.js';
|
|
3
|
+
import { operationDescription } from './operation-description.js';
|
|
4
|
+
import { docComment } from './doc-comment.js';
|
|
5
|
+
import { typeName } from './type-name.js';
|
|
6
|
+
const IMPORTS = [
|
|
7
|
+
"import * as operations from './operations.js';",
|
|
8
|
+
"import { type CallOptions, type ClientOptions, type Connection, openConnection, type SchemeCarrier } from './runtime.js';",
|
|
9
|
+
].join('\n');
|
|
10
|
+
/** `client.ts`: the security schemes of the contract, and `createClient`, every operation as a method. */
|
|
11
|
+
export function renderClient(document) {
|
|
12
|
+
const names = document.schemes.map(([name]) => `'${name}'`);
|
|
13
|
+
const schemes = document.schemes.map(([name, carrier]) => ` '${name}': ${JSON.stringify(carrier)},`);
|
|
14
|
+
return `${generatedHeader(document)}
|
|
15
|
+
${IMPORTS}
|
|
16
|
+
|
|
17
|
+
/** The security schemes of the contract: what \`credentials\` may hold. */
|
|
18
|
+
export type SchemeName = ${names.length === 0 ? 'never' : names.join(' | ')};
|
|
19
|
+
|
|
20
|
+
const SCHEMES: Readonly<Record<SchemeName, SchemeCarrier>> = {${schemes.length === 0 ? '' : `\n${schemes.join('\n')}\n`}};
|
|
21
|
+
|
|
22
|
+
/** What the functions of \`operations\` are called with, for a bundle that imports only the operations it calls. */
|
|
23
|
+
export function connect(options: ClientOptions<SchemeName>): Connection {
|
|
24
|
+
return openConnection(options, SCHEMES);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** ${document.title} ${document.version}, every operation of its contract as a method. */
|
|
28
|
+
export interface Client {
|
|
29
|
+
${document.operations.map(method).join('\n')}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function createClient(options: ClientOptions<SchemeName>): Client {
|
|
33
|
+
const connection = connect(options);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
${document.operations.map((operation) => ` ${operation.name}: (input, call) => operations.${operation.name}(connection, input, call),`).join('\n')}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
function method(operation) {
|
|
42
|
+
const prefix = `operations.${typeName(operation.name)}`;
|
|
43
|
+
const input = `input${isInputOptional(operation) ? '?' : ''}: ${prefix}Input`;
|
|
44
|
+
return [
|
|
45
|
+
...docComment(operationDescription(operation), ' '),
|
|
46
|
+
` ${operation.name}(${input}, options?: CallOptions): Promise<${prefix}Result>;`,
|
|
47
|
+
].join('\n');
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=render-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-client.js","sourceRoot":"","sources":["../../src/sdk/render-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,OAAO,GAAG;IACd,gDAAgD;IAChD,2HAA2H;CAC5H,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,0GAA0G;AAC1G,MAAM,UAAU,YAAY,CAAC,QAAwB;IACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,MAAM,IAAI,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEtG,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC;EACnC,OAAO;;;2BAGkB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;;gEAEX,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;;;;;;;MAOjH,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,OAAO;;EAEtC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;EAO1C,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,SAAS,CAAC,IAAI,iCAAiC,SAAS,CAAC,IAAI,4BAA4B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;CAGpJ,CAAC;AACF,CAAC;AAED,SAAS,MAAM,CAAC,SAA0B;IACxC,MAAM,MAAM,GAAG,cAAc,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IACxD,MAAM,KAAK,GAAG,QAAQ,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,OAAO,CAAC;IAE9E,OAAO;QACL,GAAG,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;QACpD,KAAK,SAAS,CAAC,IAAI,IAAI,KAAK,qCAAqC,MAAM,UAAU;KAClF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ClientDocument } from './client-document.js';
|
|
2
|
+
/** `errors.ts`: the error codes of the contract as a type, and the guards that narrow a refusal to them. */
|
|
3
|
+
export declare function renderErrors(document: ClientDocument): string;
|
|
4
|
+
//# sourceMappingURL=render-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-errors.d.ts","sourceRoot":"","sources":["../../src/sdk/render-errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAO3D,4GAA4G;AAC5G,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAY7D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { renderTemplate } from '../templating/index.js';
|
|
2
|
+
import { errorCodes } from './error-codes.js';
|
|
3
|
+
import { generatedHeader } from './generated-header.js';
|
|
4
|
+
import { schemaTypeName } from './schema-type-name.js';
|
|
5
|
+
const PROBLEM = 'Problem';
|
|
6
|
+
/** `errors.ts`: the error codes of the contract as a type, and the guards that narrow a refusal to them. */
|
|
7
|
+
export function renderErrors(document) {
|
|
8
|
+
const codes = errorCodes(document);
|
|
9
|
+
const problem = document.schemas.some(([name]) => name === PROBLEM)
|
|
10
|
+
? `Schemas.${schemaTypeName(PROBLEM)}`
|
|
11
|
+
: 'unknown';
|
|
12
|
+
return renderTemplate('sdk/errors.ts.tpl', {
|
|
13
|
+
header: generatedHeader(document),
|
|
14
|
+
codes: codes.length === 0 ? '[]' : `[\n${codes.map((code) => ` '${code}',`).join('\n')}\n]`,
|
|
15
|
+
problem,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=render-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-errors.js","sourceRoot":"","sources":["../../src/sdk/render-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,OAAO,GAAG,SAAS,CAAC;AAE1B,4GAA4G;AAC5G,MAAM,UAAU,YAAY,CAAC,QAAwB;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAEnC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC;QACjE,CAAC,CAAC,WAAW,cAAc,CAAC,OAAO,CAAC,EAAE;QACtC,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,cAAc,CAAC,mBAAmB,EAAE;QACzC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC;QACjC,KAAK,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;QAC5F,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-index.d.ts","sourceRoot":"","sources":["../../src/sdk/render-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,4CAA4C;AAC5C,wBAAgB,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAkB5D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { generatedHeader } from './generated-header.js';
|
|
2
|
+
/** `index.ts`: what the package exports. */
|
|
3
|
+
export function renderIndex(document) {
|
|
4
|
+
return `${generatedHeader(document)}
|
|
5
|
+
export { type Client, connect, createClient, type SchemeName } from './client.js';
|
|
6
|
+
export * from './errors.js';
|
|
7
|
+
export * from './operations.js';
|
|
8
|
+
export {
|
|
9
|
+
type CallOptions,
|
|
10
|
+
type ClientOptions,
|
|
11
|
+
type Credential,
|
|
12
|
+
type DataOf,
|
|
13
|
+
type Failure,
|
|
14
|
+
ProblemError,
|
|
15
|
+
type Success,
|
|
16
|
+
UnexpectedResponseError,
|
|
17
|
+
unwrap,
|
|
18
|
+
} from './runtime.js';
|
|
19
|
+
export type * from './schemas.js';
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=render-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-index.js","sourceRoot":"","sources":["../../src/sdk/render-index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,4CAA4C;AAC5C,MAAM,UAAU,WAAW,CAAC,QAAwB;IAClD,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;CAgBpC,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ClientOperation } from './client-operation.js';
|
|
2
|
+
/** The type of what a call of an operation sends: its parameters by place, and its body. */
|
|
3
|
+
export declare function renderInput(operation: ClientOperation): string;
|
|
4
|
+
//# sourceMappingURL=render-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-input.d.ts","sourceRoot":"","sources":["../../src/sdk/render-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAU7D,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAO9D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { docComment } from './doc-comment.js';
|
|
2
|
+
import { propertyKey } from './property-key.js';
|
|
3
|
+
import { SchemaTypes } from './schema-types.js';
|
|
4
|
+
import { typeName } from './type-name.js';
|
|
5
|
+
const TYPES = new SchemaTypes('Schemas.');
|
|
6
|
+
const PLACES = ['path', 'query', 'header'];
|
|
7
|
+
/** The type of what a call of an operation sends: its parameters by place, and its body. */
|
|
8
|
+
export function renderInput(operation) {
|
|
9
|
+
const name = `${typeName(operation.name)}Input`;
|
|
10
|
+
const members = [...PLACES.flatMap((place) => placeMembers(operation, place)), ...bodyMembers(operation)];
|
|
11
|
+
return members.length === 0
|
|
12
|
+
? `export type ${name} = Record<string, never>;`
|
|
13
|
+
: `export interface ${name} {\n${members.join('\n')}\n}`;
|
|
14
|
+
}
|
|
15
|
+
function placeMembers(operation, place) {
|
|
16
|
+
const parameters = operation.parameters.filter((parameter) => parameter.in === place);
|
|
17
|
+
if (parameters.length === 0) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const optional = parameters.every((parameter) => !parameter.required) ? '?' : '';
|
|
21
|
+
const lines = parameters.flatMap((parameter) => [
|
|
22
|
+
...docComment(parameter.description, ' '),
|
|
23
|
+
` readonly ${propertyKey(parameter.name)}${parameter.required ? '' : '?'}: ${TYPES.typeOf(parameter.schema, 2)};`,
|
|
24
|
+
]);
|
|
25
|
+
return [` readonly ${place}${optional}: {`, ...lines, ' };'];
|
|
26
|
+
}
|
|
27
|
+
function bodyMembers(operation) {
|
|
28
|
+
const body = operation.body;
|
|
29
|
+
return body === undefined ? [] : [` readonly body${body.required ? '' : '?'}: ${TYPES.typeOf(body.schema, 1)};`];
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=render-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-input.js","sourceRoot":"","sources":["../../src/sdk/render-input.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAA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C,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG;KACrH,CAAC,CAAC;IAEH,OAAO,CAAC,cAAc,KAAK,GAAG,QAAQ,KAAK,EAAE,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,WAAW,CAAC,SAA0B;IAC7C,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;IAE5B,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AACpH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClientOperation } from './client-operation.js';
|
|
2
|
+
/**
|
|
3
|
+
* The types of one operation and its function, which holds what the client knows of it: no name
|
|
4
|
+
* of the module but its own, so that no two operations can clash.
|
|
5
|
+
*/
|
|
6
|
+
export declare function renderOperation(operation: ClientOperation): string;
|
|
7
|
+
//# sourceMappingURL=render-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-operation.d.ts","sourceRoot":"","sources":["../../src/sdk/render-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQ7D;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAoBlE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { docComment } from './doc-comment.js';
|
|
2
|
+
import { isInputOptional } from './is-input-optional.js';
|
|
3
|
+
import { operationDescription } from './operation-description.js';
|
|
4
|
+
import { renderInput } from './render-input.js';
|
|
5
|
+
import { renderResult } from './render-result.js';
|
|
6
|
+
import { typeName } from './type-name.js';
|
|
7
|
+
/**
|
|
8
|
+
* The types of one operation and its function, which holds what the client knows of it: no name
|
|
9
|
+
* of the module but its own, so that no two operations can clash.
|
|
10
|
+
*/
|
|
11
|
+
export function renderOperation(operation) {
|
|
12
|
+
const prefix = typeName(operation.name);
|
|
13
|
+
const input = isInputOptional(operation) ? `input: ${prefix}Input = {}` : `input: ${prefix}Input`;
|
|
14
|
+
return [
|
|
15
|
+
renderInput(operation),
|
|
16
|
+
renderResult(operation),
|
|
17
|
+
[
|
|
18
|
+
...docComment(operationDescription(operation), ''),
|
|
19
|
+
`export function ${operation.name}(`,
|
|
20
|
+
' connection: Connection,',
|
|
21
|
+
` ${input},`,
|
|
22
|
+
' options: CallOptions = {},',
|
|
23
|
+
`): Promise<${prefix}Result> {`,
|
|
24
|
+
` const operation: Operation = ${operationLiteral(operation).replaceAll('\n', '\n ')};`,
|
|
25
|
+
'',
|
|
26
|
+
` return send<${prefix}Result>(connection, operation, { ...input, ...options });`,
|
|
27
|
+
'}',
|
|
28
|
+
].join('\n'),
|
|
29
|
+
].join('\n\n');
|
|
30
|
+
}
|
|
31
|
+
function operationLiteral(operation) {
|
|
32
|
+
const security = operation.security.map((alternative) => `[${alternative.map(quoted).join(', ')}]`);
|
|
33
|
+
const responses = operation.responses.map((response) => `${response.status}: '${response.read}'`);
|
|
34
|
+
return [
|
|
35
|
+
'{',
|
|
36
|
+
` method: '${operation.method}',`,
|
|
37
|
+
` path: ${quoted(operation.path)},`,
|
|
38
|
+
` security: [${security.join(', ')}],`,
|
|
39
|
+
` responses: { ${responses.join(', ')} },`,
|
|
40
|
+
'}',
|
|
41
|
+
].join('\n');
|
|
42
|
+
}
|
|
43
|
+
function quoted(text) {
|
|
44
|
+
return `'${text.replaceAll('\\', '\\\\').replaceAll("'", "\\'")}'`;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=render-operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-operation.js","sourceRoot":"","sources":["../../src/sdk/render-operation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,SAA0B;IACxD,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,MAAM,YAAY,CAAC,CAAC,CAAC,UAAU,MAAM,OAAO,CAAC;IAElG,OAAO;QACL,WAAW,CAAC,SAAS,CAAC;QACtB,YAAY,CAAC,SAAS,CAAC;QACvB;YACE,GAAG,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;YAClD,mBAAmB,SAAS,CAAC,IAAI,GAAG;YACpC,2BAA2B;YAC3B,KAAK,KAAK,GAAG;YACb,8BAA8B;YAC9B,cAAc,MAAM,WAAW;YAC/B,kCAAkC,gBAAgB,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG;YACzF,EAAE;YACF,iBAAiB,MAAM,2DAA2D;YAClF,GAAG;SACJ,CAAC,IAAI,CAAC,IAAI,CAAC;KACb,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,gBAAgB,CAAC,SAA0B;IAClD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpG,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;IAElG,OAAO;QACL,GAAG;QACH,cAAc,SAAS,CAAC,MAAM,IAAI;QAClC,WAAW,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;QACpC,gBAAgB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;QACvC,kBAAkB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;QAC3C,GAAG;KACJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ClientDocument } from './client-document.js';
|
|
2
|
+
/** `operations.ts`: the types and the function of every operation, each callable on its own (what is not imported is not bundled). */
|
|
3
|
+
export declare function renderOperations(document: ClientDocument): string;
|
|
4
|
+
//# sourceMappingURL=render-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-operations.d.ts","sourceRoot":"","sources":["../../src/sdk/render-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAS3D,sIAAsI;AACtI,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAIjE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generatedHeader } from './generated-header.js';
|
|
2
|
+
import { renderOperation } from './render-operation.js';
|
|
3
|
+
const IMPORTS = [
|
|
4
|
+
"import type * as Schemas from './schemas.js';",
|
|
5
|
+
"import { send, type CallOptions, type Connection, type Failure, type Operation, type Success } from './runtime.js';",
|
|
6
|
+
].join('\n');
|
|
7
|
+
/** `operations.ts`: the types and the function of every operation, each callable on its own (what is not imported is not bundled). */
|
|
8
|
+
export function renderOperations(document) {
|
|
9
|
+
const blocks = document.operations.map(renderOperation);
|
|
10
|
+
return `${[generatedHeader(document), IMPORTS, ...blocks].join('\n\n')}\n`;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=render-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-operations.js","sourceRoot":"","sources":["../../src/sdk/render-operations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,OAAO,GAAG;IACd,+CAA+C;IAC/C,qHAAqH;CACtH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,sIAAsI;AACtI,MAAM,UAAU,gBAAgB,CAAC,QAAwB;IACvD,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAExD,OAAO,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClientDocument } from './client-document.js';
|
|
2
|
+
/** What a README needs besides the document: the package name and where the client sits in its project. */
|
|
3
|
+
export interface ReadmePlace {
|
|
4
|
+
readonly packageName: string;
|
|
5
|
+
readonly directory: string;
|
|
6
|
+
}
|
|
7
|
+
/** `README.md` of the package: how to install it, call it, authenticate, handle its refusals; its operations and error codes. */
|
|
8
|
+
export declare function renderReadme(document: ClientDocument, place: ReadmePlace): string;
|
|
9
|
+
//# sourceMappingURL=render-readme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-readme.d.ts","sourceRoot":"","sources":["../../src/sdk/render-readme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,2GAA2G;AAC3G,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,iIAAiI;AACjI,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAUjF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { errorCodes } from './error-codes.js';
|
|
2
|
+
import { isInputOptional } from './is-input-optional.js';
|
|
3
|
+
/** `README.md` of the package: how to install it, call it, authenticate, handle its refusals; its operations and error codes. */
|
|
4
|
+
export function renderReadme(document, place) {
|
|
5
|
+
return [
|
|
6
|
+
`# ${place.packageName}`,
|
|
7
|
+
`<!-- Generated by \`ddd-ts-kit sdk\` from ${document.source}: never edit it. -->`,
|
|
8
|
+
`The typed client of ${document.title} ${document.version}, generated from its OpenAPI contract. It has no runtime dependency: it calls \`fetch\`, which Node 18 and later, Deno, Bun and every browser provide.`,
|
|
9
|
+
usage(document, place.packageName),
|
|
10
|
+
operationsTable(document.operations),
|
|
11
|
+
codesSection(document),
|
|
12
|
+
publishing(place),
|
|
13
|
+
].join('\n\n');
|
|
14
|
+
}
|
|
15
|
+
function usage(document, packageName) {
|
|
16
|
+
const first = document.operations[0];
|
|
17
|
+
const call = first === undefined
|
|
18
|
+
? ''
|
|
19
|
+
: `\nconst result = await api.${first.name}(${isInputOptional(first) ? '' : '{ ... }'});\n`;
|
|
20
|
+
const scheme = document.schemes[0]?.[0];
|
|
21
|
+
const credentials = scheme === undefined ? '' : `\n credentials: { ${scheme}: () => session.token() },`;
|
|
22
|
+
return `## Use
|
|
23
|
+
|
|
24
|
+
\`\`\`ts
|
|
25
|
+
import { createClient, unwrap, isProblem } from '${packageName}';
|
|
26
|
+
|
|
27
|
+
const api = createClient({ baseUrl: 'https://api.example.com',${credentials} });
|
|
28
|
+
${call}\`\`\`
|
|
29
|
+
|
|
30
|
+
Every method answers the outcome its contract declares, never throws for a declared status: \`result.ok\` and \`result.status\` narrow it to its body (\`result.data\`) or its problem document (\`result.problem\`, whose \`code\` is one of the codes of that status). \`unwrap(api.someOperation(...))\` answers the body of a success and throws a refusal as a \`ProblemError\`, which \`isProblem(error, 'SOME_CODE')\` narrows. A status the contract does not declare throws an \`UnexpectedResponseError\`: a fault of the server (a 500 answered as a problem document, whose \`code\` and \`requestId\`, the reference to quote to the team of the API, it reads), a proxy, or a server and a contract that disagree.
|
|
31
|
+
|
|
32
|
+
A credential is given per security scheme of the contract, as a value or as a function asked before each request; an operation sends the credentials its security names. A cookie scheme is sent as a \`Cookie\` header, which only a server-side caller can set: in a browser, the browser sends its own cookies (\`fetch\` with \`credentials: 'include'\`). \`headers\` adds headers to every request, \`fetch\` replaces the global one. \`connect(options)\` and the functions of each operation (\`${first?.name ?? 'operation'}(connection, input)\`) are the same calls for a bundle that imports only what it calls.`;
|
|
33
|
+
}
|
|
34
|
+
function operationsTable(operations) {
|
|
35
|
+
const rows = operations.map((operation) => {
|
|
36
|
+
const codes = operation.responses.flatMap((response) => response.codes);
|
|
37
|
+
return `| \`${operation.name}\` | \`${operation.method} ${operation.path}\` | ${codes.length === 0 ? '' : codes.join(', ')} |`;
|
|
38
|
+
});
|
|
39
|
+
return ['## Operations', '', '| Method | Request | Error codes |', '| --- | --- | --- |', ...rows].join('\n');
|
|
40
|
+
}
|
|
41
|
+
function codesSection(document) {
|
|
42
|
+
const codes = errorCodes(document);
|
|
43
|
+
return `## Error codes\n\n${codes.length === 0 ? 'The contract declares none.' : codes.map((code) => `- \`${code}\``).join('\n')}\n\n\`ERROR_CODES\` lists them, \`ErrorCode\` is their type.`;
|
|
44
|
+
}
|
|
45
|
+
function publishing(place) {
|
|
46
|
+
return `## Build and publish
|
|
47
|
+
|
|
48
|
+
The sources are regenerated by \`ddd-ts-kit sdk\` whenever the contract changes (\`docs:generate\` runs it); \`docs:check\` fails while they differ from the contract. \`npm run sdk:build\` at the root of the project compiles every client to \`dist/\`.
|
|
49
|
+
|
|
50
|
+
Publishing is a decision of the team, never a step of the pipeline: set \`"sdk.access"\` in ddd-ts-kit.config.json (\`restricted\` for a private scope or registry, \`public\`), regenerate, then \`npm publish --workspace ${place.directory}\` with the version of \`package.json\` raised. A registry other than npm is named in an \`.npmrc\` next to this file.
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=render-readme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-readme.js","sourceRoot":"","sources":["../../src/sdk/render-readme.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQzD,iIAAiI;AACjI,MAAM,UAAU,YAAY,CAAC,QAAwB,EAAE,KAAkB;IACvE,OAAO;QACL,KAAK,KAAK,CAAC,WAAW,EAAE;QACxB,6CAA6C,QAAQ,CAAC,MAAM,sBAAsB;QAClF,uBAAuB,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,OAAO,wJAAwJ;QACjN,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC;QAClC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC;QACpC,YAAY,CAAC,QAAQ,CAAC;QACtB,UAAU,CAAC,KAAK,CAAC;KAClB,CAAC,IAAI,CAAC,MAAM,CAAC,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IAAI,CAAC,CAAC;AAChH,CAAC;AAED,SAAS,YAAY,CAAC,QAAwB;IAC5C,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAEnC,OAAO,qBAAqB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,8DAA8D,CAAC;AACjM,CAAC;AAED,SAAS,UAAU,CAAC,KAAkB;IACpC,OAAO;;;;8NAIqN,KAAK,CAAC,SAAS;CAC5O,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ClientOperation } from './client-operation.js';
|
|
2
|
+
/** The type of what a call of an operation answers: one member per status its contract declares. */
|
|
3
|
+
export declare function renderResult(operation: ClientOperation): string;
|
|
4
|
+
//# sourceMappingURL=render-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-result.d.ts","sourceRoot":"","sources":["../../src/sdk/render-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAO7D,oGAAoG;AACpG,wBAAgB,YAAY,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAO/D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SchemaTypes } from './schema-types.js';
|
|
2
|
+
import { typeName } from './type-name.js';
|
|
3
|
+
const TYPES = new SchemaTypes('Schemas.');
|
|
4
|
+
/** The type of what a call of an operation answers: one member per status its contract declares. */
|
|
5
|
+
export function renderResult(operation) {
|
|
6
|
+
const name = `${typeName(operation.name)}Result`;
|
|
7
|
+
const members = operation.responses.map(member);
|
|
8
|
+
return members.length === 0
|
|
9
|
+
? `export type ${name} = Success<number, unknown>;`
|
|
10
|
+
: `export type ${name} =\n${members.map((line) => ` | ${line}`).join('\n')};`;
|
|
11
|
+
}
|
|
12
|
+
function member(response) {
|
|
13
|
+
const body = bodyType(response);
|
|
14
|
+
if (response.status < 400) {
|
|
15
|
+
return `Success<${response.status}, ${body}>`;
|
|
16
|
+
}
|
|
17
|
+
const codes = response.codes.length === 0 ? 'string' : response.codes.map((code) => `'${code}'`).join(' | ');
|
|
18
|
+
return `Failure<${response.status}, ${codes}, ${body}>`;
|
|
19
|
+
}
|
|
20
|
+
function bodyType(response) {
|
|
21
|
+
if (response.read === 'none') {
|
|
22
|
+
return 'undefined';
|
|
23
|
+
}
|
|
24
|
+
return response.read === 'text' ? 'string' : TYPES.typeOf(response.schema, 1);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=render-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-result.js","sourceRoot":"","sources":["../../src/sdk/render-result.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;AAE1C,oGAAoG;AACpG,MAAM,UAAU,YAAY,CAAC,SAA0B;IACrD,MAAM,IAAI,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;IACjD,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEhD,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC;QACzB,CAAC,CAAC,eAAe,IAAI,8BAA8B;QACnD,CAAC,CAAC,eAAe,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACnF,CAAC;AAED,SAAS,MAAM,CAAC,QAAwB;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEhC,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QAC1B,OAAO,WAAW,QAAQ,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC;IAChD,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE7G,OAAO,WAAW,QAAQ,CAAC,MAAM,KAAK,KAAK,KAAK,IAAI,GAAG,CAAC;AAC1D,CAAC;AAED,SAAS,QAAQ,CAAC,QAAwB;IACxC,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC7B,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-schemas.d.ts","sourceRoot":"","sources":["../../src/sdk/render-schemas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAW9D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isRecord } from '../config/values/is-record.js';
|
|
2
|
+
import { docComment } from './doc-comment.js';
|
|
3
|
+
import { generatedHeader } from './generated-header.js';
|
|
4
|
+
import { SchemaTypes } from './schema-types.js';
|
|
5
|
+
import { schemaTypeName } from './schema-type-name.js';
|
|
6
|
+
/** `schemas.ts`: one type per schema of `components.schemas`. */
|
|
7
|
+
export function renderSchemas(document) {
|
|
8
|
+
const types = new SchemaTypes('');
|
|
9
|
+
const declarations = document.schemas.map(([name, schema]) => [
|
|
10
|
+
...docComment(isRecord(schema) ? schema['description'] : undefined, ''),
|
|
11
|
+
`export type ${schemaTypeName(name)} = ${types.typeOf(schema, 0)};`,
|
|
12
|
+
].join('\n'));
|
|
13
|
+
return `${[generatedHeader(document), ...(declarations.length === 0 ? ['export {};'] : declarations)].join('\n\n')}\n`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=render-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-schemas.js","sourceRoot":"","sources":["../../src/sdk/render-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,iEAAiE;AACjE,MAAM,UAAU,aAAa,CAAC,QAAwB;IACpD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC;IAElC,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAC3D;QACE,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC;QACvE,eAAe,cAAc,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG;KACpE,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IAEF,OAAO,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACzH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-type-name.d.ts","sourceRoot":"","sources":["../../src/sdk/schema-type-name.ts"],"names":[],"mappings":"AAKA,gHAAgH;AAChH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIxD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CLIENT_NAMES } from './client-names.js';
|
|
2
|
+
/** Names the file of the schemas uses for itself, and those of the rest of the client: a component named so would hide them, or clash with them. */
|
|
3
|
+
const RESERVED = new Set(['Array', 'Record', ...CLIENT_NAMES]);
|
|
4
|
+
/** The name of the type of a component schema: its name with what an identifier cannot hold replaced by `_`. */
|
|
5
|
+
export function schemaTypeName(component) {
|
|
6
|
+
const name = component.replace(/[^\w$]/g, '_').replace(/^(\d)/, '_$1');
|
|
7
|
+
return RESERVED.has(name) ? `${name}_` : name;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=schema-type-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-type-name.js","sourceRoot":"","sources":["../../src/sdk/schema-type-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,oJAAoJ;AACpJ,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;AAEpF,gHAAgH;AAChH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAEvE,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The TypeScript type of a JSON Schema, as the client declares it: a reference names the type of
|
|
3
|
+
* its component (behind `refPrefix`, `Schemas.` outside the file of the schemas), `enum` and
|
|
4
|
+
* `const` are literal types, `oneOf` and `anyOf` unions, `allOf` an intersection, an object a type
|
|
5
|
+
* literal whose optional properties are those it does not require. A keyword it does not know of
|
|
6
|
+
* leaves the type open: `unknown`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SchemaTypes {
|
|
9
|
+
private readonly refPrefix;
|
|
10
|
+
constructor(refPrefix: string);
|
|
11
|
+
typeOf(schema: unknown, depth: number): string;
|
|
12
|
+
private baseOf;
|
|
13
|
+
private combinedOf;
|
|
14
|
+
private typedOf;
|
|
15
|
+
private objectOf;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=schema-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-types.d.ts","sourceRoot":"","sources":["../../src/sdk/schema-types.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,MAAM,EAAI;IAElD,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ7C;IAED,OAAO,CAAC,MAAM;IAoBd,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,OAAO;IAkBf,OAAO,CAAC,QAAQ;CAoBjB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { isRecord } from '../config/values/is-record.js';
|
|
2
|
+
import { propertyKey } from './property-key.js';
|
|
3
|
+
import { schemaTypeName } from './schema-type-name.js';
|
|
4
|
+
import { docComment } from './doc-comment.js';
|
|
5
|
+
const INDENT = ' ';
|
|
6
|
+
const SCHEMA_REF = /^#\/components\/schemas\/(.+)$/;
|
|
7
|
+
const PRIMITIVES = {
|
|
8
|
+
string: 'string',
|
|
9
|
+
integer: 'number',
|
|
10
|
+
number: 'number',
|
|
11
|
+
boolean: 'boolean',
|
|
12
|
+
null: 'null',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The TypeScript type of a JSON Schema, as the client declares it: a reference names the type of
|
|
16
|
+
* its component (behind `refPrefix`, `Schemas.` outside the file of the schemas), `enum` and
|
|
17
|
+
* `const` are literal types, `oneOf` and `anyOf` unions, `allOf` an intersection, an object a type
|
|
18
|
+
* literal whose optional properties are those it does not require. A keyword it does not know of
|
|
19
|
+
* leaves the type open: `unknown`.
|
|
20
|
+
*/
|
|
21
|
+
export class SchemaTypes {
|
|
22
|
+
refPrefix;
|
|
23
|
+
constructor(refPrefix) {
|
|
24
|
+
this.refPrefix = refPrefix;
|
|
25
|
+
}
|
|
26
|
+
typeOf(schema, depth) {
|
|
27
|
+
if (!isRecord(schema)) {
|
|
28
|
+
return schema === false ? 'never' : 'unknown';
|
|
29
|
+
}
|
|
30
|
+
const base = this.baseOf(schema, depth);
|
|
31
|
+
return schema['nullable'] === true && base !== 'unknown' ? `${base} | null` : base;
|
|
32
|
+
}
|
|
33
|
+
baseOf(schema, depth) {
|
|
34
|
+
const ref = schema['$ref'];
|
|
35
|
+
if (typeof ref === 'string') {
|
|
36
|
+
const local = SCHEMA_REF.exec(ref)?.[1];
|
|
37
|
+
return local === undefined ? 'unknown' : `${this.refPrefix}${schemaTypeName(local)}`;
|
|
38
|
+
}
|
|
39
|
+
if ('const' in schema) {
|
|
40
|
+
return literal(schema['const']);
|
|
41
|
+
}
|
|
42
|
+
if (Array.isArray(schema['enum'])) {
|
|
43
|
+
return union(schema['enum'].map(literal));
|
|
44
|
+
}
|
|
45
|
+
return this.combinedOf(schema, depth) ?? this.typedOf(schema, depth);
|
|
46
|
+
}
|
|
47
|
+
combinedOf(schema, depth) {
|
|
48
|
+
for (const keyword of ['oneOf', 'anyOf']) {
|
|
49
|
+
const options = schema[keyword];
|
|
50
|
+
if (Array.isArray(options)) {
|
|
51
|
+
return union(options.map((option) => this.typeOf(option, depth)));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const all = schema['allOf'];
|
|
55
|
+
return Array.isArray(all) ? all.map((part) => grouped(this.typeOf(part, depth))).join(' & ') : undefined;
|
|
56
|
+
}
|
|
57
|
+
typedOf(schema, depth) {
|
|
58
|
+
const type = schema['type'];
|
|
59
|
+
if (Array.isArray(type)) {
|
|
60
|
+
return union(type.map((one) => this.typedOf({ ...schema, type: one }, depth)));
|
|
61
|
+
}
|
|
62
|
+
if (type === 'array') {
|
|
63
|
+
return `Array<${this.typeOf(schema['items'], depth)}>`;
|
|
64
|
+
}
|
|
65
|
+
if (type === 'object' || isRecord(schema['properties'])) {
|
|
66
|
+
return this.objectOf(schema, depth);
|
|
67
|
+
}
|
|
68
|
+
return typeof type === 'string' ? (PRIMITIVES[type] ?? 'unknown') : 'unknown';
|
|
69
|
+
}
|
|
70
|
+
objectOf(schema, depth) {
|
|
71
|
+
const properties = Object.entries(isRecord(schema['properties']) ? schema['properties'] : {});
|
|
72
|
+
const extra = schema['additionalProperties'];
|
|
73
|
+
if (properties.length === 0) {
|
|
74
|
+
return extra === false ? 'Record<string, never>' : `Record<string, ${this.typeOf(extra ?? true, depth)}>`;
|
|
75
|
+
}
|
|
76
|
+
const required = Array.isArray(schema['required']) ? schema['required'] : [];
|
|
77
|
+
const inner = INDENT.repeat(depth + 1);
|
|
78
|
+
const members = properties.flatMap(([name, property]) => [
|
|
79
|
+
...docComment(isRecord(property) ? property['description'] : undefined, inner),
|
|
80
|
+
`${inner}${propertyKey(name)}${required.includes(name) ? '' : '?'}: ${this.typeOf(property, depth + 1)};`,
|
|
81
|
+
]);
|
|
82
|
+
const index = extra === undefined || extra === false ? [] : [`${inner}[key: string]: unknown;`];
|
|
83
|
+
return `{\n${[...members, ...index].join('\n')}\n${INDENT.repeat(depth)}}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function literal(value) {
|
|
87
|
+
return typeof value === 'string' ? quoted(value) : JSON.stringify(value);
|
|
88
|
+
}
|
|
89
|
+
function quoted(text) {
|
|
90
|
+
return `'${text.replaceAll('\\', '\\\\').replaceAll("'", "\\'").replaceAll('\n', '\\n')}'`;
|
|
91
|
+
}
|
|
92
|
+
function union(types) {
|
|
93
|
+
const distinct = [...new Set(types.map(grouped))];
|
|
94
|
+
return distinct.length === 0 ? 'never' : distinct.join(' | ');
|
|
95
|
+
}
|
|
96
|
+
/** A union or an intersection put inside another one keeps its meaning in parentheses. */
|
|
97
|
+
function grouped(type) {
|
|
98
|
+
return hasTopLevelOperator(type) ? `(${type})` : type;
|
|
99
|
+
}
|
|
100
|
+
const OPENING = new Set(['{', '<', '(', '[']);
|
|
101
|
+
const CLOSING = new Set(['}', '>', ')', ']']);
|
|
102
|
+
/** A `|` or `&` outside every bracket and every quoted literal. */
|
|
103
|
+
function hasTopLevelOperator(type) {
|
|
104
|
+
let depth = 0;
|
|
105
|
+
let quote = false;
|
|
106
|
+
for (let index = 0; index < type.length; index += 1) {
|
|
107
|
+
const character = type.charAt(index);
|
|
108
|
+
if (character === "'" && type.charAt(index - 1) !== '\\') {
|
|
109
|
+
quote = !quote;
|
|
110
|
+
}
|
|
111
|
+
else if (!quote) {
|
|
112
|
+
depth += OPENING.has(character) ? 1 : CLOSING.has(character) ? -1 : 0;
|
|
113
|
+
if (depth === 0 && (character === '|' || character === '&')) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return false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,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAErC,IAAI,SAAS,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACzD,KAAK,GAAG,CAAC,KAAK,CAAC;QACjB,CAAC;aAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YAClB,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAEtE,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,IAAI,SAAS,KAAK,GAAG,CAAC,EAAE,CAAC;gBAC5D,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Where a security scheme carries its credential: a header (with the prefix of an HTTP scheme), a query parameter or a cookie. */
|
|
2
|
+
export interface SchemeCarrier {
|
|
3
|
+
readonly in: 'header' | 'query' | 'cookie';
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly prefix: string;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=scheme-carrier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheme-carrier.d.ts","sourceRoot":"","sources":["../../src/sdk/scheme-carrier.ts"],"names":[],"mappings":"AAAA,mIAAmI;AACnI,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
|