From e098d97e0c29e73f52f622466e14f78a8942cbe2 Mon Sep 17 00:00:00 2001 From: Jack Stevenson Date: Tue, 8 Oct 2024 14:09:34 +1100 Subject: [PATCH] feat(type-safe-api): faster code generation for typescript websocket projects (#846) * feat(type-safe-api): faster codegen for typescript async infra Move typescript async infrastructure to the new codegen * feat(type-safe-api): faster codegen for typescript async handlers Move typescript async handlers to the new codegen * feat(type-safe-api): faster codegen for typescript async runtime Move typescript async runtime to the new codegen * feat(type-safe-api): faster codegen for typescript websocket client library Move typescript websocket client library to new codegen * feat(type-safe-api): faster codegen for typescript async websocket hooks Move typescript async websocket hooks to the new codegen --- .../type-safe-api/generators/generate-next.ts | 22 +- .../config.yaml | 13 - .../templates/{api.mustache => api.ejs} | 14 +- .../templates/functions.ejs | 159 ++ .../templates/functions.handlebars | 153 -- .../templates/index.ejs | 11 + .../templates/index.mustache | 3 - .../templates/mockIntegrations.ejs | 31 + .../templates/mockIntegrations.mustache | 31 - .../config.yaml | 7 - .../{handlers.handlebars => handlers.ejs} | 65 +- .../templates/tests.ejs | 45 + .../templates/tests.handlebars | 57 - .../typescript-async-runtime/config.yaml | 19 - .../templates/index.ejs | 11 + .../templates/index.mustache | 7 - .../templates/modelEnumInterfaces.mustache | 11 - .../templates/modelGenericInterfaces.mustache | 32 - .../interceptors.ejs} | 11 +- .../operationConfig.ejs} | 138 +- .../templates/server/serverSdk.ejs | 65 + .../templates/serverSdk.mustache | 67 - .../typescript-websocket-client/config.yaml | 13 - .../templates/{client.mustache => client.ejs} | 67 +- .../templates/index.ejs | 13 + .../templates/index.mustache | 5 - .../templates/modelEnumInterfaces.mustache | 11 - .../templates/modelGenericInterfaces.mustache | 32 - .../typescript-websocket-hooks/config.yaml | 10 - .../templates/hooks.ejs | 48 + .../templates/hooks.mustache | 50 - .../templates/index.ejs | 12 + .../templates/index.mustache | 4 - .../templates/provider.ejs | 28 + .../templates/provider.mustache | 19 - .../templates/{client => }/index.ejs | 0 ...rated-typescript-async-handlers-project.ts | 73 +- ...script-async-cdk-infrastructure-project.ts | 79 +- .../typescript-websocket-client-library.ts | 81 +- .../typescript-websocket-hooks-library.ts | 82 +- ...erated-typescript-async-runtime-project.ts | 79 +- ...pe-safe-websocket-api-project.test.ts.snap | 1586 +---------------- ...script-async-handlers-project.test.ts.snap | 49 +- ...nc-cdk-infrastructure-project.test.ts.snap | 51 +- ...escript-async-runtime-project.test.ts.snap | 42 +- .../typescript-react-query-hooks.test.ts.snap | 6 +- ...typescript-cdk-infrastructure.test.ts.snap | 27 +- .../typescript-lambda-handlers.test.ts.snap | 8 +- .../typescript-websocket-client.test.ts.snap | 1138 +----------- .../typescript-websocket-hooks.test.ts.snap | 157 +- .../__snapshots__/typescript.test.ts.snap | 651 +------ .../typescript-cdk-infrastructure.test.ts | 18 +- .../async/typescript-lambda-handlers.test.ts | 5 +- .../async/typescript-websocket-client.test.ts | 14 +- .../async/typescript-websocket-hooks.test.ts | 14 +- .../generators/async/typescript.test.ts | 14 +- 56 files changed, 902 insertions(+), 4556 deletions(-) delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/config.yaml rename packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/{api.mustache => api.ejs} (62%) create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/functions.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/functions.handlebars create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/index.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/index.mustache create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/mockIntegrations.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/mockIntegrations.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/config.yaml rename packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/{handlers.handlebars => handlers.ejs} (62%) create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/tests.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/tests.handlebars delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/config.yaml create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/index.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/index.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/modelEnumInterfaces.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/modelGenericInterfaces.mustache rename packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/{interceptors.mustache => server/interceptors.ejs} (95%) rename packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/{operationConfig.mustache => server/operationConfig.ejs} (68%) create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/serverSdk.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/serverSdk.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/config.yaml rename packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/{client.mustache => client.ejs} (83%) create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/index.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/index.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/modelEnumInterfaces.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/modelGenericInterfaces.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/config.yaml create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/hooks.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/hooks.mustache create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/index.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/index.mustache create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/provider.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/provider.mustache rename packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/{client => }/index.ejs (100%) diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/generate-next.ts b/packages/type-safe-api/scripts/type-safe-api/generators/generate-next.ts index 5ea6214e5..3525d9b94 100755 --- a/packages/type-safe-api/scripts/type-safe-api/generators/generate-next.ts +++ b/packages/type-safe-api/scripts/type-safe-api/generators/generate-next.ts @@ -616,10 +616,19 @@ const buildData = (inSpec: OpenAPIV3.Document, metadata: any) => { // All operations across all services const allOperations = _uniqBy(data.services.flatMap(s => s.operations), o => o.name); + // Add top level vendor extensions + const vendorExtensions: { [key: string]: any } = {}; + Object.entries(spec ?? {}).forEach(([key, value]) => { + if (key.startsWith('x-')) { + vendorExtensions[key] = value; + } + }); + return { ...data, allOperations, info: spec.info, + vendorExtensions, }; }; @@ -649,19 +658,6 @@ export default async (argv: string[], rootScriptDir: string) => { const spec = (await SwaggerParser.bundle(args.specPath)) as any; - // TODO: consider ripping out?? - Object.entries(spec?.paths ?? {}).forEach(([_path, methods]) => Object.entries(methods ?? {}).forEach(([_method, operation]) => { - // Add helper vendor extensions to make code generation easier for async operations - if (operation?.["x-async"]) { - if (["client_to_server", "bidirectional"].includes(operation?.['x-async']?.direction)) { - operation["x-async-to-server"] = true; - } - if (["server_to_client", "bidirectional"].includes(operation?.['x-async']?.direction)) { - operation["x-async-to-client"] = true; - } - } - })); - // Build data const data = buildData(spec, JSON.parse(args.metadata ?? '{}')); diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/config.yaml b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/config.yaml deleted file mode 100644 index 06603b093..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/config.yaml +++ /dev/null @@ -1,13 +0,0 @@ -files: - api.mustache: - destinationFilename: {{src}}/api.ts - templateType: SupportingFiles - index.mustache: - destinationFilename: {{src}}/index.ts - templateType: SupportingFiles - functions.handlebars: - destinationFilename: {{src}}/__functions.ts - templateType: SupportingFiles - mockIntegrations.mustache: - destinationFilename: {{src}}/mock-integrations.ts - templateType: SupportingFiles diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/api.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/api.ejs similarity index 62% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/api.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/api.ejs index 84d49315c..e0769978d 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/api.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/api.ejs @@ -1,6 +1,14 @@ -import { TypeSafeWebsocketApi, TypeSafeWebsocketApiProps, TypeSafeWebsocketApiIntegration } from "@aws/pdk/type-safe-api"; +###TSAPI_WRITE_FILE### +{ + "id": "api", + "dir": "<%= metadata.srcDir || 'src' %>", + "name": "api", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###import { TypeSafeWebsocketApi, TypeSafeWebsocketApiProps, TypeSafeWebsocketApiIntegration } from "@aws/pdk/type-safe-api"; import { Construct } from "constructs"; -import { OperationConfig, OperationLookup } from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-runtime-package-name}}{{/apis.0}}{{/apiInfo}}"; +import { OperationConfig, OperationLookup } from "<%- metadata.runtimePackageName %>"; import * as path from "path"; export type WebSocketApiIntegrations = OperationConfig; @@ -19,7 +27,7 @@ export class WebSocketApi extends TypeSafeWebsocketApi { ...props, integrations: props.integrations as any, operationLookup: OperationLookup, - specPath: path.resolve(__dirname, "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-relative-spec-path}}{{/apis.0}}{{/apiInfo}}"), + specPath: path.resolve(__dirname, "<%- metadata.relativeSpecPath %>"), }); } } diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/functions.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/functions.ejs new file mode 100644 index 000000000..f6957cd74 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/functions.ejs @@ -0,0 +1,159 @@ +###TSAPI_WRITE_FILE### +{ + "dir": "<%- metadata.srcDir || 'src' %>", + "name": "functions", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###import { Construct } from "constructs"; +import { Duration } from "aws-cdk-lib"; +import { SnapStartFunction, SnapStartFunctionProps } from "@aws/pdk/type-safe-api"; +import { Code, Function, Runtime, Tracing, FunctionProps } from "aws-cdk-lib/aws-lambda"; +import * as path from "path"; + +<%_ if (vendorExtensions['x-connect-handler']) { _%> +<%_ const language = vendorExtensions['x-connect-handler'].language; _%> +<%_ const isTypeScript = language === 'typescript'; _%> +<%_ const isJava = language === 'java'; _%> +<%_ const isPython = language === 'python'; _%> +/** + * Options for the $ConnectFunction construct + */ +export interface $ConnectFunctionProps extends Omit<<% if (isJava) { %>SnapStart<% } %>FunctionProps, 'code' | 'handler' | 'runtime'> {} + +/** + * Lambda function construct which points to the <%- language %> implementation for the websocket connect event + */ +export class $ConnectFunction extends <% if (isJava) { %>SnapStart<% } %>Function { + constructor(scope: Construct, id: string, props?: $ConnectFunctionProps) { + super(scope, id, { + <%_ if (isTypeScript) { _%> + runtime: Runtime.<%- metadata['x-handlers-node-lambda-runtime-version'] %>, + <%_ } else if (isPython) { _%> + runtime: Runtime.<%- metadata['x-handlers-python-lambda-runtime-version'] %>, + <%_ } else if (isJava) { _%> + runtime: Runtime.<%- metadata['x-handlers-java-lambda-runtime-version'] %>, + <%_ } _%> + <%_ if (isTypeScript) { _%> + handler: "index.handler", + <%_ } else if (isPython) { _%> + handler: "<%- metadata['x-handlers-python-module'] %>.__connect.handler", + <%_ } else if (isJava) { _%> + handler: "<%- metadata['x-handlers-java-package'] %>.$ConnectHandler", + <%_ } _%> + code: Code.fromAsset(path.resolve(__dirname, "..", + <%_ if (isTypeScript) { _%> + "<%- metadata['x-handlers-typescript-asset-path'] %>", + "$connect", + <%_ } else if (isPython) { _%> + "<%- metadata['x-handlers-python-asset-path'] %>", + <%_ } else if (isJava) { _%> + "<%- metadata['x-handlers-java-asset-path'] %>", + <%_ } _%> + )), + tracing: Tracing.ACTIVE, + timeout: Duration.seconds(30), + ...props, + }); + } +} +<%_ } _%> + +<%_ if (vendorExtensions['x-disconnect-handler']) { _%> +<%_ const language = vendorExtensions['x-disconnect-handler'].language; _%> +<%_ const isTypeScript = language === 'typescript'; _%> +<%_ const isJava = language === 'java'; _%> +<%_ const isPython = language === 'python'; _%> +/** + * Options for the $DisconnectFunction construct + */ +export interface $DisconnectFunctionProps extends Omit<<% if (isJava) { %>SnapStart<% } %>FunctionProps, 'code' | 'handler' | 'runtime'> {} + +/** + * Lambda function construct which points to the <%- language %> implementation for the websocket disconnect event + */ +export class $DisconnectFunction extends <% if (isJava) { %>SnapStart<% } %>Function { + constructor(scope: Construct, id: string, props?: $DisconnectFunctionProps) { + super(scope, id, { + <%_ if (isTypeScript) { _%> + runtime: Runtime.<%- metadata['x-handlers-node-lambda-runtime-version'] %>, + <%_ } else if (isPython) { _%> + runtime: Runtime.<%- metadata['x-handlers-python-lambda-runtime-version'] %>, + <%_ } else if (isJava) { _%> + runtime: Runtime.<%- metadata['x-handlers-java-lambda-runtime-version'] %>, + <%_ } _%> + <%_ if (isTypeScript) { _%> + handler: "index.handler", + <%_ } else if (isPython) { _%> + handler: "<%- metadata['x-handlers-python-module'] %>.__disconnect.handler", + <%_ } else if (isJava) { _%> + handler: "<%- metadata['x-handlers-java-package'] %>.$DisconnectHandler", + <%_ } _%> + code: Code.fromAsset(path.resolve(__dirname, "..", + <%_ if (isTypeScript) { _%> + "<%- metadata['x-handlers-typescript-asset-path'] %>", + "$disconnect", + <%_ } else if (isPython) { _%> + "<%- metadata['x-handlers-python-asset-path'] %>", + <%_ } else if (isJava) { _%> + "<%- metadata['x-handlers-java-asset-path'] %>", + <%_ } _%> + )), + tracing: Tracing.ACTIVE, + timeout: Duration.seconds(30), + ...props, + }); + } +} +<%_ } _%> +<%_ allOperations.forEach((operation) => { _%> +<%_ if (operation.vendorExtensions && operation.vendorExtensions['x-handler']) { _%> +<%_ const language = operation.vendorExtensions['x-handler'].language; _%> +<%_ const isTypeScript = language === 'typescript'; _%> +<%_ const isJava = language === 'java'; _%> +<%_ const isPython = language === 'python'; _%> + +/** + * Options for the <%- operation.operationIdPascalCase %>Function construct + */ +export interface <%- operation.operationIdPascalCase %>FunctionProps extends Omit<<% if (isJava) { %>SnapStart<% } %>FunctionProps, 'code' | 'handler' | 'runtime'> {} + +/** + * Lambda function construct which points to the <%- language %> implementation of <%- operation.operationIdPascalCase %> + */ +export class <%- operation.operationIdPascalCase %>Function extends <% if (isJava) { %>SnapStart<% } %>Function { + constructor(scope: Construct, id: string, props?: <%- operation.operationIdPascalCase %>FunctionProps) { + super(scope, id, { + <%_ if (isTypeScript) { _%> + runtime: Runtime.<%- metadata['x-handlers-node-lambda-runtime-version'] %>, + <%_ } else if (isPython) { _%> + runtime: Runtime.<%- metadata['x-handlers-python-lambda-runtime-version'] %>, + <%_ } else if (isJava) { _%> + runtime: Runtime.<%- metadata['x-handlers-java-lambda-runtime-version'] %>, + <%_ } _%> + <%_ if (isTypeScript) { _%> + handler: "index.handler", + <%_ } else if (isPython) { _%> + handler: "<%- metadata['x-handlers-python-module'] %>.<%- operation.operationIdSnakeCase %>.handler", + <%_ } else if (isJava) { _%> + handler: "<%- metadata['x-handlers-java-package'] %>.<%- operation.operationIdPascalCase %>Handler", + <%_ } _%> + code: Code.fromAsset(path.resolve(__dirname, "..", + <%_ if (isTypeScript) { _%> + "<%- metadata['x-handlers-typescript-asset-path'] %>", + "<%- operation.operationIdKebabCase %>", + <%_ } else if (isPython) { _%> + "<%- metadata['x-handlers-python-asset-path'] %>", + <%_ } else if (isJava) { _%> + "<%- metadata['x-handlers-java-asset-path'] %>", + <%_ } _%> + )), + tracing: Tracing.ACTIVE, + timeout: Duration.seconds(30), + ...props, + }); + } +} + +<%_ } _%> +<%_ }); _%> \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/functions.handlebars b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/functions.handlebars deleted file mode 100644 index fbbc02dff..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/functions.handlebars +++ /dev/null @@ -1,153 +0,0 @@ -###TSAPI_SPLIT_FILE### -###TSAPI_WRITE_FILE### -{ - "dir": ".", - "name": "functions", - "ext": ".ts", - "overwrite": true, - "kebabCaseFileName": true -} -###/TSAPI_WRITE_FILE###import { Construct } from "constructs"; -import { Duration } from "aws-cdk-lib"; -import { SnapStartFunction, SnapStartFunctionProps } from "@aws/pdk/type-safe-api"; -import { Code, Function, Runtime, Tracing, FunctionProps } from "aws-cdk-lib/aws-lambda"; -import * as path from "path"; -{{#apiInfo ~}} -{{#apis ~}} -{{#if vendorExtensions.x-connect-handler}} -/** - * Options for the $ConnectFunction construct - */ -export interface $ConnectFunctionProps extends Omit<{{#startsWith vendorExtensions.x-connect-handler.language 'java' ~}}SnapStart{{~/startsWith}}FunctionProps, 'code' | 'handler' | 'runtime'> {} - -/** - * Lambda function construct which points to the {{vendorExtensions.x-connect-handler.language}} implementation for the websocket connect event - */ -export class $ConnectFunction extends {{#startsWith vendorExtensions.x-connect-handler.language 'java' ~}}SnapStart{{~/startsWith}}Function { - constructor(scope: Construct, id: string, props?: $ConnectFunctionProps) { - super(scope, id, { - {{#startsWith vendorExtensions.x-connect-handler.language 'typescript' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-node-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}}{{#startsWith vendorExtensions.x-connect-handler.language 'python' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}}{{#startsWith vendorExtensions.x-connect-handler.language 'java' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}} - {{#startsWith vendorExtensions.x-connect-handler.language 'typescript' ~}} - handler: "index.handler", - {{~/startsWith}}{{#startsWith vendorExtensions.x-connect-handler.language 'python' ~}} - handler: "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-module}}{{/apis.0}}{{/apiInfo}}.__connect.handler", - {{~/startsWith}}{{#startsWith vendorExtensions.x-connect-handler.language 'java' ~}} - handler: "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-package}}{{/apis.0}}{{/apiInfo}}.$ConnectHandler", - {{~/startsWith}} - code: Code.fromAsset(path.resolve(__dirname, "..", - {{#startsWith vendorExtensions.x-connect-handler.language 'typescript' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-typescript-asset-path}}{{/apis.0}}{{/apiInfo}}", - "$connect", - {{~/startsWith}}{{#startsWith vendorExtensions.x-connect-handler.language 'python' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-asset-path}}{{/apis.0}}{{/apiInfo}}", - {{~/startsWith}}{{#startsWith vendorExtensions.x-connect-handler.language 'java' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-asset-path}}{{/apis.0}}{{/apiInfo}}", - {{~/startsWith}} - )), - tracing: Tracing.ACTIVE, - timeout: Duration.seconds(30), - ...props, - }); - } -} -{{~/if}} -{{#if vendorExtensions.x-disconnect-handler}} -/** - * Options for the $DisconnectFunction construct - */ -export interface $DisconnectFunctionProps extends Omit<{{#startsWith vendorExtensions.x-disconnect-handler.language 'java' ~}}SnapStart{{~/startsWith}}FunctionProps, 'code' | 'handler' | 'runtime'> {} - -/** - * Lambda function construct which points to the {{vendorExtensions.x-disconnect-handler.language}} implementation for the websocket disconnect event - */ -export class $DisconnectFunction extends {{#startsWith vendorExtensions.x-disconnect-handler.language 'java' ~}}SnapStart{{~/startsWith}}Function { - constructor(scope: Construct, id: string, props?: $DisconnectFunctionProps) { - super(scope, id, { - {{#startsWith vendorExtensions.x-disconnect-handler.language 'typescript' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-node-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}}{{#startsWith vendorExtensions.x-disconnect-handler.language 'python' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}}{{#startsWith vendorExtensions.x-disconnect-handler.language 'java' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}} - {{#startsWith vendorExtensions.x-disconnect-handler.language 'typescript' ~}} - handler: "index.handler", - {{~/startsWith}}{{#startsWith vendorExtensions.x-disconnect-handler.language 'python' ~}} - handler: "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-module}}{{/apis.0}}{{/apiInfo}}.__disconnect.handler", - {{~/startsWith}}{{#startsWith vendorExtensions.x-disconnect-handler.language 'java' ~}} - handler: "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-package}}{{/apis.0}}{{/apiInfo}}.$DisconnectHandler", - {{~/startsWith}} - code: Code.fromAsset(path.resolve(__dirname, "..", - {{#startsWith vendorExtensions.x-disconnect-handler.language 'typescript' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-typescript-asset-path}}{{/apis.0}}{{/apiInfo}}", - "$disconnect", - {{~/startsWith}}{{#startsWith vendorExtensions.x-disconnect-handler.language 'python' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-asset-path}}{{/apis.0}}{{/apiInfo}}", - {{~/startsWith}}{{#startsWith vendorExtensions.x-disconnect-handler.language 'java' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-asset-path}}{{/apis.0}}{{/apiInfo}}", - {{~/startsWith}} - )), - tracing: Tracing.ACTIVE, - timeout: Duration.seconds(30), - ...props, - }); - } -} -{{~/if}} -{{#operations ~}} -{{#operation ~}} -{{#if vendorExtensions.x-handler}} - -/** - * Options for the {{operationIdCamelCase}}Function construct - */ -export interface {{operationIdCamelCase}}FunctionProps extends Omit<{{#startsWith vendorExtensions.x-handler.language 'java' ~}}SnapStart{{~/startsWith}}FunctionProps, 'code' | 'handler' | 'runtime'> {} - -/** - * Lambda function construct which points to the {{vendorExtensions.x-handler.language}} implementation of {{operationIdCamelCase}} - */ -export class {{operationIdCamelCase}}Function extends {{#startsWith vendorExtensions.x-handler.language 'java' ~}}SnapStart{{~/startsWith}}Function { - constructor(scope: Construct, id: string, props?: {{operationIdCamelCase}}FunctionProps) { - super(scope, id, { - {{#startsWith vendorExtensions.x-handler.language 'typescript' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-node-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}}{{#startsWith vendorExtensions.x-handler.language 'python' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}}{{#startsWith vendorExtensions.x-handler.language 'java' ~}} - runtime: Runtime.{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-lambda-runtime-version}}{{/apis.0}}{{/apiInfo}}, - {{~/startsWith}} - {{#startsWith vendorExtensions.x-handler.language 'typescript' ~}} - handler: "index.handler", - {{~/startsWith}}{{#startsWith vendorExtensions.x-handler.language 'python' ~}} - handler: "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-module}}{{/apis.0}}{{/apiInfo}}.{{operationIdSnakeCase}}.handler", - {{~/startsWith}}{{#startsWith vendorExtensions.x-handler.language 'java' ~}} - handler: "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-package}}{{/apis.0}}{{/apiInfo}}.{{operationIdCamelCase}}Handler", - {{~/startsWith}} - code: Code.fromAsset(path.resolve(__dirname, "..", - {{#startsWith vendorExtensions.x-handler.language 'typescript' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-typescript-asset-path}}{{/apis.0}}{{/apiInfo}}", - "###TSAPI_FN###{ "function": "kebabCase", "args": ["{{nickname}}"] }###/TSAPI_FN###", - {{~/startsWith}}{{#startsWith vendorExtensions.x-handler.language 'python' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-python-asset-path}}{{/apis.0}}{{/apiInfo}}", - {{~/startsWith}}{{#startsWith vendorExtensions.x-handler.language 'java' ~}} - "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-handlers-java-asset-path}}{{/apis.0}}{{/apiInfo}}", - {{~/startsWith}} - )), - tracing: Tracing.ACTIVE, - timeout: Duration.seconds(30), - ...props, - }); - } -} - -{{~/if}} -{{~/operation}} -{{~/operations}} -{{~/apis}} -{{~/apiInfo}} \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/index.ejs new file mode 100644 index 000000000..94d055e7c --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/index.ejs @@ -0,0 +1,11 @@ +###TSAPI_WRITE_FILE### +{ + "id": "index", + "dir": "<%= metadata.srcDir || 'src' %>", + "name": "index", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###export * from "./api"; +export * from "./functions"; +export * from "./mock-integrations"; \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/index.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/index.mustache deleted file mode 100644 index 1f85d6d0b..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/index.mustache +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./api"; -export * from "./functions"; -export * from "./mock-integrations"; \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/mockIntegrations.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/mockIntegrations.ejs new file mode 100644 index 000000000..f362b88cb --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/mockIntegrations.ejs @@ -0,0 +1,31 @@ +###TSAPI_WRITE_FILE### +{ + "dir": "<%- metadata.srcDir || 'src' %>", + "name": "mock-integrations", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###import { + WebSocketMockIntegration, +} from "aws-cdk-lib/aws-apigatewayv2-integrations"; + +<%_ const toServerOperations = allOperations.filter(op => op.vendorExtensions && op.vendorExtensions['x-async'] && ['client_to_server', 'bidirectional'].includes(op.vendorExtensions['x-async'].direction)); _%> + +/** + * Type-safe mock integrations for WebSocket API operations + */ +export class MockIntegrations { + + /** + * Mock all operations + */ + public static mockAll() { + return { + <%_ toServerOperations.forEach((operation) => { _%> + <%- operation.name %>: { + integration: new WebSocketMockIntegration("Mock<%- operation.operationIdPascalCase %>Integration"), + }, + <%_ }); _%> + }; + } +} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/mockIntegrations.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/mockIntegrations.mustache deleted file mode 100644 index 4b80cc830..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-cdk-infrastructure/templates/mockIntegrations.mustache +++ /dev/null @@ -1,31 +0,0 @@ -import { - WebSocketMockIntegration, -} from "aws-cdk-lib/aws-apigatewayv2-integrations"; - - -/** - * Type-safe mock integrations for WebSocket API operations - */ -export class MockIntegrations { - - /** - * Mock all operations - */ - public static mockAll() { - return { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#vendorExtensions.x-async-to-server}} - {{nickname}}: { - integration: new WebSocketMockIntegration("Mock{{operationIdCamelCase}}Integration"), - }, - {{/vendorExtensions.x-async-to-server}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} - }; - } -} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/config.yaml b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/config.yaml deleted file mode 100644 index b293d79c1..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/config.yaml +++ /dev/null @@ -1,7 +0,0 @@ -files: - handlers.handlebars: - destinationFilename: {{src}}/__all_handlers.ts - templateType: SupportingFiles - tests.handlebars: - destinationFilename: {{tst}}/__all_tests.ts - templateType: SupportingFiles diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/handlers.handlebars b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/handlers.ejs similarity index 62% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/handlers.handlebars rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/handlers.ejs index 908f9921c..6ef20b3ee 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/handlers.handlebars +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/handlers.ejs @@ -1,12 +1,9 @@ -###TSAPI_SPLIT_FILE### -{{#apiInfo ~}} -{{#apis ~}} -{{#if vendorExtensions.x-connect-handler}} +<%_ if (vendorExtensions['x-connect-handler'] && vendorExtensions['x-connect-handler'].language === 'typescript') { _%> {{#startsWith vendorExtensions.x-connect-handler.language 'typescript'}} ###TSAPI_WRITE_FILE### { "id": "$connect", - "dir": ".", + "dir": "<%= metadata.srcDir || 'src' %>", "name": "$connect", "ext": ".ts", "overwrite": false @@ -17,7 +14,7 @@ INTERCEPTORS, LoggingInterceptor, $PendingConnection, -} from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-runtime-package-name}}{{/apis.0}}{{/apiInfo}}"; +} from "<%= metadata.runtimePackageName %>"; /** * Type-safe handler for the $connect event, invoked when a new client connects to the websocket @@ -43,14 +40,12 @@ export const $connect: $ConnectChainedLambdaHandlerFunction = async (request) => */ export const handler = $connectHandler(...INTERCEPTORS, $connect); -{{~/startsWith}} -{{~/if}} -{{#if vendorExtensions.x-disconnect-handler}} -{{#startsWith vendorExtensions.x-disconnect-handler.language 'typescript'}} +<%_ } _%> +<%_ if (vendorExtensions['x-disconnect-handler'] && vendorExtensions['x-disconnect-handler'].language === 'typescript') { _%> ###TSAPI_WRITE_FILE### { "id": "$disconnect", - "dir": ".", + "dir": "<%= metadata.srcDir || 'src' %>", "name": "$disconnect", "ext": ".ts", "overwrite": false @@ -60,7 +55,7 @@ export const handler = $connectHandler(...INTERCEPTORS, $connect); $DisconnectChainedLambdaHandlerFunction, INTERCEPTORS, LoggingInterceptor, -} from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-runtime-package-name}}{{/apis.0}}{{/apiInfo}}"; +} from "<%= metadata.runtimePackageName %>"; /** * Type-safe handler for the $disconnect event, invoked when a client disconnects from the websocket @@ -81,51 +76,41 @@ export const $disconnect: $DisconnectChainedLambdaHandlerFunction = async (reque */ export const handler = $disconnectHandler(...INTERCEPTORS, $disconnect); -{{~/startsWith}} -{{~/if}} -{{#operations ~}} -{{#operation ~}} -{{#if vendorExtensions.x-handler}} -{{#startsWith vendorExtensions.x-handler.language 'typescript'}} +<%_ } _%> +<%_ allOperations.filter(op => op.vendorExtensions['x-handler'] && op.vendorExtensions['x-handler'].language === 'typescript').forEach((operation) => { _%> ###TSAPI_WRITE_FILE### { - "id": "{{nickname}}", - "dir": ".", - "name": "{{nickname}}", + "id": "<%- operation.name %>", + "dir": "<%= metadata.srcDir || 'src' %>", + "name": "<%- operation.operationIdKebabCase %>", "ext": ".ts", - "overwrite": false, - "kebabCaseFileName": true + "overwrite": false } ###/TSAPI_WRITE_FILE###import { - {{nickname}}Handler, - {{operationIdCamelCase}}ChainedHandlerFunction, + <%- operation.name %>Handler, + <%- operation.operationIdPascalCase %>ChainedHandlerFunction, INTERCEPTORS, LoggingInterceptor, -} from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-runtime-package-name}}{{/apis.0}}{{/apiInfo}}"; +} from "<%= metadata.runtimePackageName %>"; /** - * Type-safe handler for the {{operationIdCamelCase}} operation + * Type-safe handler for the <%- operation.operationIdPascalCase %> operation */ -export const {{nickname}}: {{operationIdCamelCase}}ChainedHandlerFunction = async (request) => { - LoggingInterceptor.getLogger(request).info("Start {{operationIdCamelCase}} Operation"); +export const <%- operation.name %>: <%- operation.operationIdPascalCase %>ChainedHandlerFunction = async (request) => { + LoggingInterceptor.getLogger(request).info("Start <%- operation.operationIdPascalCase %> Operation"); // `input` contains the request input // `connectionId` is the ID of the connection which sent this request to the server. // `sdk` is used to send messages to connected clients const { input, connectionId, sdk } = request; - // TODO: Implement {{operationIdCamelCase}} Operation. + // TODO: Implement <%- operation.operationIdPascalCase %> Operation. }; /** - * Entry point for the AWS Lambda handler for the {{operationIdCamelCase}} operation. - * The {{nickname}}Handler method wraps the type-safe handler and manages marshalling inputs + * Entry point for the AWS Lambda handler for the <%- operation.operationIdPascalCase %> operation. + * The <%- operation.name %>Handler method wraps the type-safe handler and manages marshalling inputs */ -export const handler = {{nickname}}Handler(...INTERCEPTORS, {{nickname}}); - -{{~/startsWith}} -{{~/if}} -{{~/operation}} -{{~/operations}} -{{~/apis}} -{{~/apiInfo}} \ No newline at end of file +export const handler = <%- operation.name %>Handler(...INTERCEPTORS, <%- operation.name %>); + +<%_ }); _%> \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/tests.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/tests.ejs new file mode 100644 index 000000000..4c388ea6c --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/tests.ejs @@ -0,0 +1,45 @@ +<%_ allOperations.filter(op => op.vendorExtensions['x-handler'] && op.vendorExtensions['x-handler'].language === 'typescript').forEach((operation) => { _%> +###TSAPI_WRITE_FILE### +{ + "id": "<%- operation.name %>Test", + "dir": "<%= metadata.tstDir || 'tst' %>", + "name": "<%- operation.operationIdKebabCase %>", + "ext": ".test.ts", + "overwrite": false, + "generateConditionallyId": "<%- operation.name %>" +} +###/TSAPI_WRITE_FILE###import { + <%- operation.operationIdPascalCase %>ChainedRequestInput, +} from "<%= metadata.runtimePackageName %>"; +import { + <%- operation.name %> +} from "../src/<%- operation.operationIdKebabCase %>"; + +// Common request arguments +const requestArguments = { + chain: undefined as never, + connectionId: 'test', + sdk: {} as any, + event: {} as any, + context: {} as any, + interceptorContext: { + logger: { + info: jest.fn(), + }, + }, +} satisfies Omit<<%- operation.operationIdPascalCase %>ChainedRequestInput, 'input'>; + +describe('<%- operation.operationIdPascalCase %>', () => { + + it('should not throw', async () => { + // TODO: Update the test as appropriate when you implement your handler + await <%- operation.name %>({ + ...requestArguments, + // TODO: remove the "as any" below and fill in test values for the input + input: {} as any, + }); + }); + +}); + +<%_ }); _%> \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/tests.handlebars b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/tests.handlebars deleted file mode 100644 index 06b9214c8..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-lambda-handlers/templates/tests.handlebars +++ /dev/null @@ -1,57 +0,0 @@ -###TSAPI_SPLIT_FILE### -{{#apiInfo ~}} -{{#apis ~}} -{{#operations ~}} -{{#operation ~}} -{{#if vendorExtensions.x-handler}} -{{#startsWith vendorExtensions.x-handler.language 'typescript'}} -###TSAPI_WRITE_FILE### -{ - "id": "{{nickname}}Test", - "dir": ".", - "name": "{{nickname}}", - "ext": ".test.ts", - "overwrite": false, - "kebabCaseFileName": true, - "generateConditionallyId": "{{nickname}}" -} -###/TSAPI_WRITE_FILE###import { - {{operationIdCamelCase}}ChainedRequestInput, -} from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-runtime-package-name}}{{/apis.0}}{{/apiInfo}}"; -import { - {{nickname}} -} from "../src/###TSAPI_FN###{ "function": "kebabCase", "args": ["{{nickname}}"] }###/TSAPI_FN###"; - -// Common request arguments -const requestArguments = { - chain: undefined as never, - connectionId: 'test', - sdk: {} as any, - event: {} as any, - context: {} as any, - interceptorContext: { - logger: { - info: jest.fn(), - }, - }, -} satisfies Omit<{{operationIdCamelCase}}ChainedRequestInput, 'input'>; - -describe('{{operationIdCamelCase}}', () => { - - it('should not throw', async () => { - // TODO: Update the test as appropriate when you implement your handler - await {{nickname}}({ - ...requestArguments, - // TODO: remove the "as any" below and fill in test values for the input - input: {} as any, - }); - }); - -}); - -{{~/startsWith}} -{{~/if}} -{{~/operation}} -{{~/operations}} -{{~/apis}} -{{~/apiInfo}} \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/config.yaml b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/config.yaml deleted file mode 100644 index f27a31cec..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/config.yaml +++ /dev/null @@ -1,19 +0,0 @@ -files: - modelGenericInterfaces.mustache: - destinationFilename: .ts - templateType: Model - modelEnum.mustache: - destinationFilename: .ts - templateType: Model - operationConfig.mustache: - destinationFilename: {{src}}/server/operation-config.ts - templateType: SupportingFiles - serverSdk.mustache: - destinationFilename: {{src}}/server/server-sdk.ts - templateType: SupportingFiles - index.mustache: - destinationFilename: {{src}}/index.ts - templateType: SupportingFiles - interceptors.mustache: - destinationFilename: {{src}}/__interceptors.ts - templateType: SupportingFiles diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/index.ejs new file mode 100644 index 000000000..dfcded83b --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/index.ejs @@ -0,0 +1,11 @@ +###TSAPI_WRITE_FILE### +{ + "dir": "<%= metadata.srcDir || 'src' %>", + "name": "index", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###export * from './models'; +export * from './server/operation-config'; +export * from './server/server-sdk'; +export * from './interceptors' diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/index.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/index.mustache deleted file mode 100644 index 39ea6718d..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/index.mustache +++ /dev/null @@ -1,7 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './runtime'; -export * from './models'; -export * from './server/operation-config'; -export * from './server/server-sdk'; -export * from './interceptors' diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/modelEnumInterfaces.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/modelEnumInterfaces.mustache deleted file mode 100644 index 63ca3906e..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/modelEnumInterfaces.mustache +++ /dev/null @@ -1,11 +0,0 @@ -/** - * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} - * @export - * @enum {string} - */ -export type {{classname}} = -{{#allowableValues}} -{{#enumVars}} - {{{value}}}{{^-last}} | {{/-last}} -{{/enumVars}} -{{/allowableValues}} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/modelGenericInterfaces.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/modelGenericInterfaces.mustache deleted file mode 100644 index e628f5ff0..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/modelGenericInterfaces.mustache +++ /dev/null @@ -1,32 +0,0 @@ -/** - * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} - * @export - * @interface {{classname}} - */ -export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ -{{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; -{{/additionalPropertiesType}} -{{#vars}} - /** - * {{#lambda.indented_star_4}}{{{unescapedDescription}}}{{/lambda.indented_star_4}} - * @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%> - * @memberof {{classname}} - */ - {{#isReadOnly}}readonly {{/isReadOnly}}{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; -{{/vars}} -}{{#hasEnums}} - -{{#vars}} -{{#isEnum}} -/** -* @export -* @enum {string} -*/ -export type {{classname}}{{enumName}} = -{{#allowableValues}} - {{#enumVars}} - {{{value}}}{{^-last}} | {{/-last}} - {{/enumVars}} -{{/allowableValues}} -{{/isEnum}}{{/vars}}{{/hasEnums}} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/interceptors.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/interceptors.ejs similarity index 95% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/interceptors.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/interceptors.ejs index 30849bbd6..5678c8f9e 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/interceptors.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/interceptors.ejs @@ -1,7 +1,6 @@ -###TSAPI_SPLIT_FILE### ###TSAPI_WRITE_FILE### { - "dir": "interceptors", + "dir": "<%= metadata.srcDir || 'src' %>/interceptors", "name": "try-catch", "ext": ".ts", "overwrite": true @@ -34,7 +33,7 @@ export const buildTryCatchInterceptor = () => async ( export const tryCatchInterceptor = buildTryCatchInterceptor(); ###TSAPI_WRITE_FILE### { - "dir": "interceptors/powertools", + "dir": "<%= metadata.srcDir || 'src' %>/interceptors/powertools", "name": "logger", "ext": ".ts", "overwrite": true @@ -73,7 +72,7 @@ export class LoggingInterceptor { } ###TSAPI_WRITE_FILE### { - "dir": "interceptors/powertools", + "dir": "<%= metadata.srcDir || 'src' %>/interceptors/powertools", "name": "tracer", "ext": ".ts", "overwrite": true @@ -144,7 +143,7 @@ export class TracingInterceptor { } ###TSAPI_WRITE_FILE### { - "dir": "interceptors/powertools", + "dir": "<%= metadata.srcDir || 'src' %>/interceptors/powertools", "name": "metrics", "ext": ".ts", "overwrite": true @@ -187,7 +186,7 @@ export class MetricsInterceptor { } ###TSAPI_WRITE_FILE### { - "dir": "interceptors", + "dir": "<%= metadata.srcDir || 'src' %>/interceptors", "name": "index", "ext": ".ts", "overwrite": true diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/operationConfig.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/operationConfig.ejs similarity index 68% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/operationConfig.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/operationConfig.ejs index bfed89450..3acb4c029 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/operationConfig.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/operationConfig.ejs @@ -1,52 +1,42 @@ -// Import models +###TSAPI_WRITE_FILE### +{ + "id": "operation-config", + "dir": "<%= metadata.srcDir || 'src' %>/server", + "name": "operation-config", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###// Import models import { - {{#apiInfo}} - {{#models}} - {{#model}} - {{classname}}, - {{classname}}FromJSON, - {{classname}}ToJSON, - {{/model}} - {{/models}} - {{/apiInfo}} +<%_ models.forEach((model) => { _%> + <%- model.name %>, + <%- model.name %>FromJSON, + <%- model.name %>ToJSON, +<%_ }); _%> } from '../models'; +<%_ const serviceClassName = services[0] ? services[0].className : "DefaultApi"; _%> // API Gateway Types import { APIGatewayProxyWebsocketEventV2, APIGatewayProxyResultV2, Context } from "aws-lambda"; -import { {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ServerSdk } from "./server-sdk"; +import { <%- serviceClassName %>ServerSdk } from "./server-sdk"; +<%_ const toServerOperations = allOperations.filter(op => op.vendorExtensions && op.vendorExtensions['x-async'] && ['client_to_server', 'bidirectional'].includes(op.vendorExtensions['x-async'].direction)); _%> // Generic type for object keyed by operation names export interface OperationConfig { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#vendorExtensions.x-async-to-server}} - {{nickname}}: T; - {{/vendorExtensions.x-async-to-server}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} +<%_ toServerOperations.forEach((operation) => { _%> + <%- operation.name %>: T; +<%_ }); _%> } // Look up path and http method for a given operation name export const OperationLookup = { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#vendorExtensions.x-async-to-server}} - {{nickname}}: { - path: '{{path}}', - method: '{{httpMethod}}', - contentTypes: [{{^consumes}}'application/json'{{/consumes}}{{#consumes}}{{#mediaType}}'{{{.}}}',{{/mediaType}}{{/consumes}}], +<%_ toServerOperations.forEach((operation) => { _%> + <%- operation.name %>: { + path: '<%- operation.path %>', + method: '<%- operation.method %>', + contentTypes: [<%- operation.parametersBody ? operation.parametersBody.mediaTypes.map(m => `'${m}'`).join(',') : "'application/json'"%>], }, - {{/vendorExtensions.x-async-to-server}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} +<%_ }); _%> }; export class Operations { @@ -90,7 +80,7 @@ export class $PendingConnection { }; } -export type OperationIds = "$connect" | "$disconnect"{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{#vendorExtensions.x-async-to-server}} | '{{nickname}}'{{/vendorExtensions.x-async-to-server}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}; +export type OperationIds = "$connect" | "$disconnect"<% toServerOperations.forEach((operation) => { %> | '<%- operation.name %>'<% }); %>; export type OperationApiGatewayProxyResult = APIGatewayProxyResultV2 & { __operationId?: T }; // Api gateway lambda handler type @@ -100,7 +90,7 @@ export type InterceptorContext = { [key: string]: any }; export interface PayloadlessRequestInput { connectionId: string; - sdk: {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ServerSdk; + sdk: <%- serviceClassName %>ServerSdk; event: APIGatewayProxyWebsocketEventV2; context: Context; interceptorContext: InterceptorContext; @@ -173,50 +163,44 @@ const buildHandlerChain = ( }; }; -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#operation}} -{{#vendorExtensions.x-async-to-server}} +<%_ toServerOperations.forEach((operation) => { _%> /** - * Request body parameter for {{operationIdCamelCase}} + * Request body parameter for <%- operation.operationIdPascalCase %> */ -export type {{operationIdCamelCase}}RequestBody = {{#bodyParam}}{{#isPrimitiveType}}string{{/isPrimitiveType}}{{^isPrimitiveType}}{{dataType}}{{/isPrimitiveType}}{{/bodyParam}}{{^bodyParam}}never{{/bodyParam}}; +export type <%- operation.operationIdPascalCase %>RequestBody = <% if (operation.parametersBody) { %><%- operation.parametersBody.isPrimitive ? 'string' : operation.parametersBody.typescriptType %><% } else { %>never<% } %>; // Type that the handler function provided to the wrapper must conform to -export type {{operationIdCamelCase}}HandlerFunction = LambdaHandlerFunction<{{operationIdCamelCase}}RequestBody>; -export type {{operationIdCamelCase}}ChainedHandlerFunction = ChainedLambdaHandlerFunction<{{operationIdCamelCase}}RequestBody>; -export type {{operationIdCamelCase}}ChainedRequestInput = ChainedRequestInput<{{operationIdCamelCase}}RequestBody>; +export type <%- operation.operationIdPascalCase %>HandlerFunction = LambdaHandlerFunction<<%- operation.operationIdPascalCase %>RequestBody>; +export type <%- operation.operationIdPascalCase %>ChainedHandlerFunction = ChainedLambdaHandlerFunction<<%- operation.operationIdPascalCase %>RequestBody>; +export type <%- operation.operationIdPascalCase %>ChainedRequestInput = ChainedRequestInput<<%- operation.operationIdPascalCase %>RequestBody>; /** - * Lambda handler wrapper to provide typed interface for the implementation of {{nickname}} + * Lambda handler wrapper to provide typed interface for the implementation of <%- operation.name %> */ -export const {{nickname}}Handler = ( - ...handlers: [...(PayloadlessChainedLambdaHandlerFunction | {{operationIdCamelCase}}ChainedHandlerFunction)[], {{operationIdCamelCase}}ChainedHandlerFunction] -): OperationApiGatewayLambdaHandler<'{{nickname}}'> => async (event: APIGatewayProxyWebsocketEventV2, context: any, _callback?: any, additionalInterceptors: (PayloadlessChainedLambdaHandlerFunction | {{operationIdCamelCase}}ChainedHandlerFunction)[] = []): Promise => { - const operationId = "{{nickname}}"; +export const <%- operation.name %>Handler = ( + ...handlers: [...(PayloadlessChainedLambdaHandlerFunction | <%- operation.operationIdPascalCase %>ChainedHandlerFunction)[], <%- operation.operationIdPascalCase %>ChainedHandlerFunction] +): OperationApiGatewayLambdaHandler<'<%- operation.name %>'> => async (event: APIGatewayProxyWebsocketEventV2, context: any, _callback?: any, additionalInterceptors: (PayloadlessChainedLambdaHandlerFunction | <%- operation.operationIdPascalCase %>ChainedHandlerFunction)[] = []): Promise => { + const operationId = "<%- operation.name %>"; const demarshal = (bodyString: string): any => { - {{#bodyParam}} - {{^isPrimitiveType}} - return {{dataType}}FromJSON(JSON.parse(bodyString)?.payload ?? {}); - {{/isPrimitiveType}} - {{#isPrimitiveType}} + <%_ if (operation.parametersBody) { _%> + <%_ if (!operation.parametersBody.isPrimitive) { _%> + return <%- operation.parametersBody.typescriptType %>FromJSON(JSON.parse(bodyString)?.payload ?? {}); + <%_ } else { _%> return bodyString; - {{/isPrimitiveType}} - {{/bodyParam}} - {{^bodyParam}} + <%_ } _%> + <%_ } else { _%> return {}; - {{/bodyParam}} + <%_ } _%> }; - const body = parseBody(event.body, demarshal, [{{^consumes}}'application/json'{{/consumes}}{{#consumes}}{{#mediaType}}'{{{.}}}',{{/mediaType}}{{/consumes}}]) as {{operationIdCamelCase}}RequestBody; + const body = parseBody(event.body, demarshal, [<%- operation.parametersBody ? operation.parametersBody.mediaTypes.map(m => `'${m}'`).join(',') : "'application/json'" %>]) as <%- operation.operationIdPascalCase %>RequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); await chain.next({ input: body, connectionId: event.requestContext.connectionId, - sdk: new {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ServerSdk({ + sdk: new <%- serviceClassName %>ServerSdk({ callbackUrl: `https://${event.requestContext.domainName}/${event.requestContext.stage}`, }), event, @@ -230,11 +214,7 @@ export const {{nickname}}Handler = ( statusCode: 200, }; }; -{{/vendorExtensions.x-async-to-server}} -{{/operation}} -{{/operations}} -{{/apis}} -{{/apiInfo}} +<%_ }); _%> export type $ConnectChainedLambdaHandlerFunction = PayloadlessChainedLambdaHandlerFunction; @@ -246,7 +226,7 @@ export const $connectHandler = ( const interceptorContext = { operationId }; await chain.next({ connectionId: event.requestContext.connectionId, - sdk: new {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ServerSdk({ + sdk: new <%- serviceClassName %>ServerSdk({ callbackUrl: `https://${event.requestContext.domainName}/${event.requestContext.stage}`, }), event, @@ -269,7 +249,7 @@ export const $disconnectHandler = ( const chain = buildHandlerChain(...additionalInterceptors, ...handlers) as PayloadlessLambdaHandlerChain; await chain.next({ connectionId: event.requestContext.connectionId, - sdk: new {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ServerSdk({ + sdk: new <%- serviceClassName %>ServerSdk({ callbackUrl: `https://${event.requestContext.domainName}/${event.requestContext.stage}`, }), event, @@ -285,22 +265,14 @@ export const $disconnectHandler = ( }; export interface HandlerRouterHandlers { -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#operation}} -{{#vendorExtensions.x-async-to-server}} - readonly {{nickname}}: OperationApiGatewayLambdaHandler<'{{nickname}}'>; -{{/vendorExtensions.x-async-to-server}} -{{/operation}} -{{/operations}} -{{/apis}} -{{/apiInfo}} +<%_ toServerOperations.forEach((operation) => { _%> + readonly <%- operation.name %>: OperationApiGatewayLambdaHandler<'<%- operation.name %>'>; +<%_ }); _%> readonly $connect?: OperationApiGatewayLambdaHandler<'$connect'>; readonly $disconnect?: OperationApiGatewayLambdaHandler<'$disconnect'>; } -export type AnyOperationRequestBodies = {{#apiInfo}}{{#apis}}{{^operations.0}}never{{/operations.0}}{{#operations}}{{#operation}}{{#vendorExtensions.x-async-to-server}}| {{operationIdCamelCase}}RequestBody{{/vendorExtensions.x-async-to-server}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}; +export type AnyOperationRequestBodies = <% toServerOperations.forEach((operation) => { %>| <%- operation.operationIdPascalCase %>RequestBody<% }); %>; export interface HandlerRouterProps< RequestBody, diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/serverSdk.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/serverSdk.ejs new file mode 100644 index 000000000..7647e8b8a --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/server/serverSdk.ejs @@ -0,0 +1,65 @@ +###TSAPI_WRITE_FILE### +{ + "id": "operation-config", + "dir": "<%= metadata.srcDir || 'src' %>/server", + "name": "server-sdk", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###// Import models +import { +<%_ models.forEach((model) => { _%> + <%- model.name %>, + <%- model.name %>FromJSON, + <%- model.name %>ToJSON, +<%_ }); _%> +} from "../models"; +import { + ApiGatewayManagementApiClient, + PostToConnectionCommand, + DeleteConnectionCommand, +} from "@aws-sdk/client-apigatewaymanagementapi"; + +<%_ const serviceClassName = services[0] ? services[0].className : "DefaultApi"; _%> +/** + * Options for the server SDK + */ +export interface <%- serviceClassName %>ServerSdkProps { + /** + * API Gateway management API callback url + */ + readonly callbackUrl: string; +} + +<%_ const toClientOperations = allOperations.filter(op => op.vendorExtensions && op.vendorExtensions['x-async'] && ['server_to_client', 'bidirectional'].includes(op.vendorExtensions['x-async'].direction)) _%> +/** + * SDK for sending messages from the server to connected clients + */ +export class <%- serviceClassName %>ServerSdk { + private readonly client: ApiGatewayManagementApiClient; + + constructor(props: <%- serviceClassName %>ServerSdkProps) { + this.client = new ApiGatewayManagementApiClient({ endpoint: props.callbackUrl }); + } + +<%_ toClientOperations.forEach((operation) => { _%> + public async <%- operation.name %>(connectionId: string<% if (operation.parametersBody) { %>, input: <%- operation.parametersBody.isPrimitive ? 'string' : operation.parametersBody.typescriptType %><% } %>): Promise { + await this.client.send(new PostToConnectionCommand({ + ConnectionId: connectionId, + Data: JSON.stringify({ + route: "<%- operation.operationIdPascalCase %>", + payload: input, + }), + })); + } +<%_ }); _%> + + /** + * Disconnect a connected client + */ + public async $disconnect(connectionId: string): Promise { + await this.client.send(new DeleteConnectionCommand({ + ConnectionId: connectionId, + })); + } +} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/serverSdk.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/serverSdk.mustache deleted file mode 100644 index ae09f8558..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates/serverSdk.mustache +++ /dev/null @@ -1,67 +0,0 @@ -// Import models -import { - {{#apiInfo}} - {{#models}} - {{#model}} - {{classname}}, - {{classname}}FromJSON, - {{classname}}ToJSON, - {{/model}} - {{/models}} - {{/apiInfo}} -} from "../models"; -import { - ApiGatewayManagementApiClient, - PostToConnectionCommand, - DeleteConnectionCommand, -} from "@aws-sdk/client-apigatewaymanagementapi"; - -/** - * Options for the server SDK - */ -export interface {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ServerSdkProps { - /** - * API Gateway management API callback url - */ - readonly callbackUrl: string; -} - -/** - * SDK for sending messages from the server to connected clients - */ -export class {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ServerSdk { - private readonly client: ApiGatewayManagementApiClient; - - constructor(props: {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ServerSdkProps) { - this.client = new ApiGatewayManagementApiClient({ endpoint: props.callbackUrl }); - } - -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#operation}} -{{#vendorExtensions.x-async-to-client}} - public async {{nickname}}(connectionId: string{{#bodyParam}}{{#isPrimitiveType}}, input: string{{/isPrimitiveType}}{{^isPrimitiveType}}, input: {{dataType}}{{/isPrimitiveType}}{{/bodyParam}}): Promise { - await this.client.send(new PostToConnectionCommand({ - ConnectionId: connectionId, - Data: JSON.stringify({ - route: "{{operationIdCamelCase}}", - payload: input, - }), - })); - } -{{/vendorExtensions.x-async-to-client}} -{{/operation}} -{{/operations}} -{{/apis}} -{{/apiInfo}} - - /** - * Disconnect a connected client - */ - public async $disconnect(connectionId: string): Promise { - await this.client.send(new DeleteConnectionCommand({ - ConnectionId: connectionId, - })); - } -} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/config.yaml b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/config.yaml deleted file mode 100644 index ce1659ce2..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/config.yaml +++ /dev/null @@ -1,13 +0,0 @@ -files: - modelGenericInterfaces.mustache: - destinationFilename: .ts - templateType: Model - modelEnum.mustache: - destinationFilename: .ts - templateType: Model - client.mustache: - destinationFilename: {{src}}/client/client.ts - templateType: SupportingFiles - index.mustache: - destinationFilename: {{src}}/index.ts - templateType: SupportingFiles diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/client.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/client.ejs similarity index 83% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/client.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/client.ejs index 4a2705599..9c61e9244 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/client.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/client.ejs @@ -1,14 +1,18 @@ -// Import models +###TSAPI_WRITE_FILE### +{ + "id": "client", + "dir": "<%= metadata.srcDir || 'src' %>/client", + "name": "client", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###// Import models import { - {{#apiInfo}} - {{#models}} - {{#model}} - {{classname}}, - {{classname}}FromJSON, - {{classname}}ToJSON, - {{/model}} - {{/models}} - {{/apiInfo}} +<%_ models.forEach((model) => { _%> + <%- model.name %>, + <%- model.name %>FromJSON, + <%- model.name %>ToJSON, +<%_ }); _%> } from "../models"; import { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@aws-sdk/types'; import { HttpRequest } from "@aws-sdk/protocol-http"; @@ -18,6 +22,7 @@ import { v4 as uuid } from "uuid"; import WebSocket from "isomorphic-ws"; +<%_ const serviceClassName = services[0] ? services[0].className : "DefaultApi"; _%> export interface IamAuthenticationStrategy { readonly region: string; readonly credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider; @@ -42,7 +47,7 @@ export type AuthenticationStrategy = { iam: IamAuthenticationStrategy } | { none /** * Options for the client */ -export interface {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientOptions { +export interface <%- serviceClassName %>WebSocketClientOptions { /** * Websocket url to connect to (wss://xxxx) */ @@ -107,17 +112,17 @@ interface ErrorListener { /** * Client for sending messages from clients to the server */ -export class {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient { +export class <%- serviceClassName %>WebSocketClient { /** * Create a new WebSocket connection to the server */ - public static connect = async (options: {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientOptions) => { - const client = new {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient(options); + public static connect = async (options: <%- serviceClassName %>WebSocketClientOptions) => { + const client = new <%- serviceClassName %>WebSocketClient(options); await client.$connect(); return client; }; - private readonly options: {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientOptions; + private readonly options: <%- serviceClassName %>WebSocketClientOptions; private socket: WebSocket | undefined; private status: SocketStatus = SocketStatus.CONNECTING; @@ -129,7 +134,7 @@ export class {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocke private connectionAttempt: number = 0; private lastConnected: number = Date.now(); - private constructor(options: {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientOptions) { + private constructor(options: <%- serviceClassName %>WebSocketClientOptions) { this.options = options; } @@ -376,31 +381,25 @@ export class {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocke }; }; -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#operation}} -{{#vendorExtensions.x-async-to-server}} +<%_ allOperations.forEach((operation) => { _%> +<%_ if (operation.vendorExtensions && operation.vendorExtensions['x-async'] && ['client_to_server', 'bidirectional'].includes(operation.vendorExtensions['x-async'].direction)) { _%> /** - * Send a "{{operationIdCamelCase}}" message to the server + * Send a "<%- operation.operationIdPascalCase %>" message to the server */ - public {{nickname}} = async ({{#bodyParam}}{{#isPrimitiveType}}input: string{{/isPrimitiveType}}{{^isPrimitiveType}}input: {{dataType}}{{/isPrimitiveType}}{{/bodyParam}}): Promise => { - await this._sendOrQueueMessage("{{operationIdCamelCase}}"{{#bodyParam}}, input{{/bodyParam}}); + public <%- operation.name %> = async (<% if (operation.parametersBody) { %>input: <%- operation.parametersBody.isPrimitive ? 'string' : operation.parametersBody.typescriptType %><% } %>): Promise => { + await this._sendOrQueueMessage("<%- operation.operationIdPascalCase %>"<% if (operation.parametersBody) { %>, input<% } %>); }; -{{/vendorExtensions.x-async-to-server}} +<%_ } _%> -{{#vendorExtensions.x-async-to-client}} +<%_ if (operation.vendorExtensions && operation.vendorExtensions['x-async'] && ['server_to_client', 'bidirectional'].includes(operation.vendorExtensions['x-async'].direction)) { _%> /** - * Register a listener to be called whenever a "{{operationIdCamelCase}}" message is received from the server + * Register a listener to be called whenever a "<%- operation.operationIdPascalCase %>" message is received from the server * @returns a function which will remove the listener when called. */ - public on{{operationIdCamelCase}} = (callback: ({{#bodyParam}}{{#isPrimitiveType}}input: string{{/isPrimitiveType}}{{^isPrimitiveType}}input: {{dataType}}{{/isPrimitiveType}}{{/bodyParam}}) => void): () => void => { - return this._listen("{{operationIdCamelCase}}", callback); + public on<%- operation.operationIdPascalCase %> = (callback: (<% if (operation.parametersBody) { %>input: <%- operation.parametersBody.isPrimitive ? 'string' : operation.parametersBody.typescriptType %><% } %>) => void): () => void => { + return this._listen("<%- operation.operationIdPascalCase %>", callback); }; -{{/vendorExtensions.x-async-to-client}} +<%_ } _%> -{{/operation}} -{{/operations}} -{{/apis}} -{{/apiInfo}} +<%_ }); _%> } diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/index.ejs new file mode 100644 index 000000000..c53ee3e8c --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/index.ejs @@ -0,0 +1,13 @@ +###TSAPI_WRITE_FILE### +{ + "id": "index", + "dir": "<%= metadata.srcDir || 'src' %>", + "name": "index", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +export * from './runtime'; +export * from './models'; +export * from './client/client'; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/index.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/index.mustache deleted file mode 100644 index 8c38cfed4..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/index.mustache +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './runtime'; -export * from './models'; -export * from './client/client'; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/modelEnumInterfaces.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/modelEnumInterfaces.mustache deleted file mode 100644 index 63ca3906e..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/modelEnumInterfaces.mustache +++ /dev/null @@ -1,11 +0,0 @@ -/** - * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} - * @export - * @enum {string} - */ -export type {{classname}} = -{{#allowableValues}} -{{#enumVars}} - {{{value}}}{{^-last}} | {{/-last}} -{{/enumVars}} -{{/allowableValues}} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/modelGenericInterfaces.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/modelGenericInterfaces.mustache deleted file mode 100644 index e628f5ff0..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/modelGenericInterfaces.mustache +++ /dev/null @@ -1,32 +0,0 @@ -/** - * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} - * @export - * @interface {{classname}} - */ -export interface {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ -{{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; -{{/additionalPropertiesType}} -{{#vars}} - /** - * {{#lambda.indented_star_4}}{{{unescapedDescription}}}{{/lambda.indented_star_4}} - * @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%> - * @memberof {{classname}} - */ - {{#isReadOnly}}readonly {{/isReadOnly}}{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; -{{/vars}} -}{{#hasEnums}} - -{{#vars}} -{{#isEnum}} -/** -* @export -* @enum {string} -*/ -export type {{classname}}{{enumName}} = -{{#allowableValues}} - {{#enumVars}} - {{{value}}}{{^-last}} | {{/-last}} - {{/enumVars}} -{{/allowableValues}} -{{/isEnum}}{{/vars}}{{/hasEnums}} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/config.yaml b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/config.yaml deleted file mode 100644 index 5735925b3..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/config.yaml +++ /dev/null @@ -1,10 +0,0 @@ -files: - hooks.mustache: - destinationFilename: {{src}}/hooks/hooks.tsx - templateType: SupportingFiles - provider.mustache: - destinationFilename: {{src}}/hooks/provider.tsx - templateType: SupportingFiles - index.mustache: - destinationFilename: {{src}}/index.ts - templateType: SupportingFiles diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/hooks.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/hooks.ejs new file mode 100644 index 000000000..eea8b15c0 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/hooks.ejs @@ -0,0 +1,48 @@ +###TSAPI_WRITE_FILE### +{ + "id": "hooks", + "dir": "<%= metadata.srcDir || 'src' %>/hooks", + "name": "hooks", + "ext": ".tsx", + "overwrite": true +} +###/TSAPI_WRITE_FILE###import { +<%_ models.forEach((model) => { _%> + <%- model.name %>, +<%_ }); _%> +<%_ const serviceClassName = services[0] ? services[0].className : "DefaultApi"; _%> + <%- serviceClassName %>WebSocketClient, +} from "<%- metadata.websocketClientPackageName %>"; +import { + <%- serviceClassName %>WebSocketClientContext, +} from "./provider"; +import { useContext, useEffect, useCallback, DependencyList } from "react"; + +const NO_CLIENT_ERROR = new Error(`<%- serviceClassName %>WebSocketClient is missing. Please ensure you have instantiated the <%- serviceClassName %>WebSocketClientProvider with a client instance.`); + +/** + * Hook to retrieve the websocket client from the context + */ +export const use<%- serviceClassName %>WebSocketClient = () => { + const client = useContext(<%- serviceClassName %>WebSocketClientContext); + if (!client) { + throw NO_CLIENT_ERROR; + } + return client; +}; + +<%_ const toClientOperations = allOperations.filter(op => op.vendorExtensions && op.vendorExtensions['x-async'] && ['server_to_client', 'bidirectional'].includes(op.vendorExtensions['x-async'].direction)) _%> +<%_ toClientOperations.forEach((operation) => { _%> +/** + * Listen to <%- operation.operationIdPascalCase %> messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOn<%- operation.operationIdPascalCase %> = (callback: (<% if (operation.parametersBody) { %>input: <%- operation.parametersBody.isPrimitive ? 'string' : operation.parametersBody.typescriptType %><% } %>) => void, deps: DependencyList) => { + const client = use<%- serviceClassName %>WebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.on<%- operation.operationIdPascalCase %>(cb); + }, [client, cb]); +}; + +<%_ }); _%> diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/hooks.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/hooks.mustache deleted file mode 100644 index 9d570e439..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/hooks.mustache +++ /dev/null @@ -1,50 +0,0 @@ -import { - {{#apiInfo}} - {{#models}} - {{#model}} - {{classname}}, - {{/model}} - {{/models}} - {{/apiInfo}} - {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient, -} from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-websocket-client-package-name}}{{/apis.0}}{{/apiInfo}}"; -import { - {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientContext, -} from "./provider"; -import { useContext, useEffect, useCallback, DependencyList } from "react"; - -const NO_CLIENT_ERROR = new Error(`{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient is missing. Please ensure you have instantiated the {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientProvider with a client instance.`); - -/** - * Hook to retrieve the websocket client from the context - */ -export const use{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient = () => { - const client = useContext({{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientContext); - if (!client) { - throw NO_CLIENT_ERROR; - } - return client; -}; - -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#operation}} -{{#vendorExtensions.x-async-to-client}} -/** - * Listen to {{operationIdCamelCase}} messages from the server - * Provided callback should use the useCallback hook to memoise the function - */ -export const useOn{{operationIdCamelCase}} = (callback: ({{#bodyParam}}{{#isPrimitiveType}}input: string{{/isPrimitiveType}}{{^isPrimitiveType}}input: {{dataType}}{{/isPrimitiveType}}{{/bodyParam}}) => void, deps: DependencyList) => { - const client = use{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient(); - const cb = useCallback(callback, deps); - useEffect(() => { - return client.on{{operationIdCamelCase}}(cb); - }, [client, cb]); -}; - -{{/vendorExtensions.x-async-to-client}} -{{/operation}} -{{/operations}} -{{/apis}} -{{/apiInfo}} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/index.ejs new file mode 100644 index 000000000..0cb890330 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/index.ejs @@ -0,0 +1,12 @@ +###TSAPI_WRITE_FILE### +{ + "id": "index", + "dir": "<%= metadata.srcDir || 'src' %>", + "name": "index", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +export * from './hooks/hooks'; +export * from './hooks/provider'; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/index.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/index.mustache deleted file mode 100644 index 8fec4c962..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/index.mustache +++ /dev/null @@ -1,4 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './hooks/hooks'; -export * from './hooks/provider'; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/provider.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/provider.ejs new file mode 100644 index 000000000..3e9e3cdee --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/provider.ejs @@ -0,0 +1,28 @@ +###TSAPI_WRITE_FILE### +{ + "id": "hooks", + "dir": "<%= metadata.srcDir || 'src' %>/hooks", + "name": "provider", + "ext": ".tsx", + "overwrite": true +} +###/TSAPI_WRITE_FILE###import { +<%_ const serviceClassName = services[0] ? services[0].className : "DefaultApi"; _%> + <%- serviceClassName %>WebSocketClient, +} from "<%- metadata.websocketClientPackageName %>"; +import React, { createContext, ReactNode, FC } from "react"; + +export const <%- serviceClassName %>WebSocketClientContext = createContext<<%- serviceClassName %>WebSocketClient | undefined>(undefined); + +export interface <%- serviceClassName %>WebSocketClientProviderProps { + readonly client: <%- serviceClassName %>WebSocketClient; + readonly children?: ReactNode; +} + +export const <%- serviceClassName %>WebSocketClientProvider: FC<<%- serviceClassName %>WebSocketClientProviderProps> = (props) => { + return ( + <<%- serviceClassName %>WebSocketClientContext.Provider value={props.client}> + {props.children} + WebSocketClientContext.Provider> + ); +}; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/provider.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/provider.mustache deleted file mode 100644 index 0a72b7978..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-hooks/templates/provider.mustache +++ /dev/null @@ -1,19 +0,0 @@ -import { - {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient, -} from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-websocket-client-package-name}}{{/apis.0}}{{/apiInfo}}"; -import React, { createContext, ReactNode, FC } from "react"; - -export const {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientContext = createContext<{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient | undefined>(undefined); - -export interface {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientProviderProps { - readonly client: {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClient; - readonly children?: ReactNode; -} - -export const {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientProvider: FC<{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientProviderProps> = (props) => { - return ( - <{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}WebSocketClientContext.Provider value={props.client}> - {props.children} - - ); -}; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/index.ejs similarity index 100% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/index.ejs rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/index.ejs diff --git a/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-async-handlers-project.ts b/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-async-handlers-project.ts index 2c4a25805..6c1935fbb 100644 --- a/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-async-handlers-project.ts +++ b/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-async-handlers-project.ts @@ -4,65 +4,17 @@ import { GeneratedTypescriptHandlersBaseProject, GeneratedTypescriptHandlersBaseProjectOptions, } from "./generated-typescript-handlers-base-project"; -import { OpenApiGeneratorHandlebarsIgnoreFile } from "../components/open-api-generator-handlebars-ignore-file"; -import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; -import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; -import { - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, - buildTypeSafeApiExecCommand, - CodegenOptions, - GenerationOptions, - OtherGenerators, - TypeSafeApiScript, -} from "../components/utils"; +import { CodegenOptions, OtherGenerators } from "../components/utils"; export interface GeneratedTypescriptAsyncHandlersProjectOptions extends GeneratedTypescriptHandlersBaseProjectOptions {} export class GeneratedTypescriptAsyncHandlersProject extends GeneratedTypescriptHandlersBaseProject { - protected readonly openapiGeneratorIgnore: OpenApiGeneratorIgnoreFile; - constructor(options: GeneratedTypescriptAsyncHandlersProjectOptions) { super(options); - - // TODO: remove the below and use new codegen instead - // Ignore everything for the regular open api generator pass - const openapiGeneratorIgnore = new OpenApiGeneratorIgnoreFile(this); - this.openapiGeneratorIgnore = openapiGeneratorIgnore; - openapiGeneratorIgnore.addPatterns("/*", "**/*", "*"); - // Ignore everything but the handler files for the handlebars pass - const openapiGeneratorHandlebarsIgnore = - new OpenApiGeneratorHandlebarsIgnoreFile(this); - openapiGeneratorHandlebarsIgnore.addPatterns( - "/*", - "**/*", - "*", - // This will be split into a file per targeted handler - `!${this.srcdir}/__all_handlers.ts`, - `!${this.testdir}/__all_tests.ts` - ); - - // Add OpenAPI Generator cli configuration - OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig( - options.openApiGeneratorCliConfig - ); - - // TODO: remove in favour of parent task using new codegen - this.generateTask.reset(); - this.generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); - this.generateTask.exec( - buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, - this.buildGenerateCommandArgs() - ) - ); } public buildCodegenOptions(): CodegenOptions { - /** - * TODO: not currently used - adjust for new codegen - */ return { specPath: this.options.specPath, templateDirs: [OtherGenerators.TYPESCRIPT_ASYNC_LAMBDA_HANDLERS], @@ -74,27 +26,4 @@ export class GeneratedTypescriptAsyncHandlersProject extends GeneratedTypescript }, }; } - - public buildGenerateCommandArgs = (): string => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); - }; - - public buildOpenApiGeneratorOptions(): GenerationOptions { - return { - generator: "typescript-fetch", - specPath: this.options.specPath, - generatorDirectory: OtherGenerators.TYPESCRIPT_ASYNC_LAMBDA_HANDLERS, - srcDir: this.srcdir, - tstDir: this.testdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, - }, - extraVendorExtensions: { - "x-runtime-package-name": - this.options.generatedTypescriptTypes.package.packageName, - }, - }; - } } diff --git a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-async-cdk-infrastructure-project.ts b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-async-cdk-infrastructure-project.ts index 36d69d01a..2836bb41f 100644 --- a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-async-cdk-infrastructure-project.ts +++ b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-async-cdk-infrastructure-project.ts @@ -5,101 +5,32 @@ import { GeneratedTypescriptCdkInfrastructureBaseProject, GeneratedTypescriptCdkInfrastructureBaseProjectOptions, } from "./generated-typescript-cdk-infrastructure-base-project"; -import { OpenApiGeneratorHandlebarsIgnoreFile } from "../../components/open-api-generator-handlebars-ignore-file"; -import { OpenApiGeneratorIgnoreFile } from "../../components/open-api-generator-ignore-file"; -import { OpenApiToolsJsonFile } from "../../components/open-api-tools-json-file"; import { CodegenOptions, - GenerationOptions, - OtherGenerators, - TypeSafeApiScript, - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, - buildTypeSafeApiExecCommand, getHandlersProjectVendorExtensions, + OtherGenerators, } from "../../components/utils"; export interface GeneratedTypescriptAsyncCdkInfrastructureProjectOptions extends GeneratedTypescriptCdkInfrastructureBaseProjectOptions {} export class GeneratedTypescriptAsyncCdkInfrastructureProject extends GeneratedTypescriptCdkInfrastructureBaseProject { - protected readonly openapiGeneratorIgnore: OpenApiGeneratorIgnoreFile; - constructor( options: GeneratedTypescriptAsyncCdkInfrastructureProjectOptions ) { super(options); - - // Ignore everything but the target files - const openapiGeneratorIgnore = new OpenApiGeneratorIgnoreFile(this); - this.openapiGeneratorIgnore = openapiGeneratorIgnore; - openapiGeneratorIgnore.addPatterns( - "/*", - "**/*", - "*", - `!${this.srcdir}/index.ts`, - `!${this.srcdir}/api.ts`, - `!${this.srcdir}/mock-integrations.ts` - ); - - const openapiGeneratorHandlebarsIgnore = - new OpenApiGeneratorHandlebarsIgnoreFile(this); - openapiGeneratorHandlebarsIgnore.addPatterns( - "/*", - "**/*", - "*", - `!${this.srcdir}/__functions.ts` - ); - - // Add OpenAPI Generator cli configuration - OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig( - options.openApiGeneratorCliConfig - ); - - // TODO: remove when switching to new codegen - this.generateTask.reset(); - this.generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); - this.generateTask.exec( - buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, - this.buildGenerateCommandArgs() - ) - ); - // Copy the api spec to within the package - this.generateTask.exec(`mkdir -p ${path.dirname(this.packagedSpecPath)}`); - this.generateTask.exec( - `cp -f ${this.options.specPath} ${this.packagedSpecPath}` - ); } - public buildGenerateCommandArgs = (): string => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); - }; - public buildCodegenOptions(): CodegenOptions { - // TODO: unused, update for new codegen return { specPath: this.options.specPath, templateDirs: [OtherGenerators.TYPESCRIPT_ASYNC_CDK_INFRASTRUCTURE], - }; - } - - public buildOpenApiGeneratorOptions(): GenerationOptions { - return { - generator: "typescript-fetch", - specPath: this.options.specPath, - generatorDirectory: OtherGenerators.TYPESCRIPT_ASYNC_CDK_INFRASTRUCTURE, - srcDir: this.srcdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, - }, - extraVendorExtensions: { - "x-runtime-package-name": + metadata: { + srcDir: this.srcdir, + runtimePackageName: this.options.generatedTypescriptTypes.package.packageName, // Spec path relative to the source directory - "x-relative-spec-path": path.join("..", this.packagedSpecPath), + relativeSpecPath: path.join("..", this.packagedSpecPath), ...getHandlersProjectVendorExtensions( this, this.options.generatedHandlers diff --git a/packages/type-safe-api/src/project/codegen/library/typescript-websocket-client-library.ts b/packages/type-safe-api/src/project/codegen/library/typescript-websocket-client-library.ts index 0103a8f6f..8715bf914 100644 --- a/packages/type-safe-api/src/project/codegen/library/typescript-websocket-client-library.ts +++ b/packages/type-safe-api/src/project/codegen/library/typescript-websocket-client-library.ts @@ -5,16 +5,7 @@ import { GeneratedTypescriptLibraryProjectOptions, } from "./generated-typescript-library-project"; import { WebSocketLibrary } from "../../languages"; -import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; -import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; -import { - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, - buildTypeSafeApiExecCommand, - CodegenOptions, - GenerationOptions, - TypeSafeApiScript, -} from "../components/utils"; +import { CodegenOptions } from "../components/utils"; /** * Configuration for the generated typescript websocket client project @@ -26,18 +17,6 @@ export interface TypescriptWebsocketClientLibraryOptions * Typescript project containing a generated websocket client */ export class TypescriptWebsocketClientLibrary extends GeneratedTypescriptLibraryProject { - /** - * Patterns that are excluded from code generation - */ - public static openApiIgnorePatterns: string[] = [ - "package.json", - "tsconfig.json", - "tsconfig.esm.json", - ".npmignore", - ]; - - protected readonly openapiGeneratorIgnore: OpenApiGeneratorIgnoreFile; - constructor(options: TypescriptWebsocketClientLibraryOptions) { super(options); @@ -53,63 +32,17 @@ export class TypescriptWebsocketClientLibrary extends GeneratedTypescriptLibrary "uuid@^9" ); this.addDeps("@types/ws@^8", "@types/uuid@^9"); - - // Tell OpenAPI Generator CLI not to generate files that we will generate via this project, or don't need. - const openapiGeneratorIgnore = new OpenApiGeneratorIgnoreFile(this); - this.openapiGeneratorIgnore = openapiGeneratorIgnore; - openapiGeneratorIgnore.addPatterns( - ...TypescriptWebsocketClientLibrary.openApiIgnorePatterns - ); - - // Add OpenAPI Generator cli configuration - OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig( - options.openApiGeneratorCliConfig - ); - - this.generateTask.reset(); - this.generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); - this.generateTask.exec( - buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, - this.buildGenerateCommandArgs() - ) - ); - - openapiGeneratorIgnore.addPatterns( - // Skip generating http clients - `${this.srcdir}/apis/*`, - `${this.srcdir}/apis/**/*` - ); } protected buildCodegenOptions(): CodegenOptions { - // TODO: update when switch to new codegen return { specPath: this.options.specPath, - templateDirs: [WebSocketLibrary.TYPESCRIPT_WEBSOCKET_CLIENT], - }; - } - - public buildGenerateCommandArgs = (): string => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); - }; - - public buildOpenApiGeneratorOptions(): GenerationOptions { - return { - generator: "typescript-fetch", - specPath: this.options.specPath, - generatorDirectory: WebSocketLibrary.TYPESCRIPT_WEBSOCKET_CLIENT, - additionalProperties: { - npmName: this.package.packageName, - typescriptThreePlus: "true", - useSingleParameter: "true", - supportsES6: "true", - }, - srcDir: this.srcdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, + templateDirs: [ + WebSocketLibrary.TYPESCRIPT_WEBSOCKET_CLIENT, + "typescript/templates/client/models", + ], + metadata: { + srcDir: this.srcdir, }, }; } diff --git a/packages/type-safe-api/src/project/codegen/library/typescript-websocket-hooks-library.ts b/packages/type-safe-api/src/project/codegen/library/typescript-websocket-hooks-library.ts index 70d2780c5..adcfbaa88 100644 --- a/packages/type-safe-api/src/project/codegen/library/typescript-websocket-hooks-library.ts +++ b/packages/type-safe-api/src/project/codegen/library/typescript-websocket-hooks-library.ts @@ -6,16 +6,7 @@ import { GeneratedTypescriptLibraryProjectOptions, } from "./generated-typescript-library-project"; import { WebSocketLibrary } from "../../languages"; -import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; -import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; -import { - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, - buildTypeSafeApiExecCommand, - CodegenOptions, - GenerationOptions, - TypeSafeApiScript, -} from "../components/utils"; +import { CodegenOptions } from "../components/utils"; /** * Configuration for the generated typescript websocket hooks project @@ -29,20 +20,8 @@ export interface TypescriptWebsocketHooksLibraryOptions * Typescript project containing generated websocket hooks */ export class TypescriptWebsocketHooksLibrary extends GeneratedTypescriptLibraryProject { - /** - * Patterns that are excluded from code generation - */ - public static openApiIgnorePatterns: string[] = [ - "package.json", - "tsconfig.json", - "tsconfig.esm.json", - ".npmignore", - ]; - protected readonly options: TypescriptWebsocketHooksLibraryOptions; - protected readonly openapiGeneratorIgnore: OpenApiGeneratorIgnoreFile; - constructor(options: TypescriptWebsocketHooksLibraryOptions) { super({ ...options, @@ -56,68 +35,15 @@ export class TypescriptWebsocketHooksLibrary extends GeneratedTypescriptLibraryP this.addDevDeps("react", "@types/react"); this.addPeerDeps("react"); - - // Tell OpenAPI Generator CLI not to generate files that we will generate via this project, or don't need. - const openapiGeneratorIgnore = new OpenApiGeneratorIgnoreFile(this); - this.openapiGeneratorIgnore = openapiGeneratorIgnore; - openapiGeneratorIgnore.addPatterns( - ...TypescriptWebsocketHooksLibrary.openApiIgnorePatterns - ); - - // Add OpenAPI Generator cli configuration - OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig( - options.openApiGeneratorCliConfig - ); - - this.generateTask.reset(); - this.generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); - this.generateTask.exec( - buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, - this.buildGenerateCommandArgs() - ) - ); - - openapiGeneratorIgnore.addPatterns( - // Ignore all but relevant hooks files - ...OpenApiGeneratorIgnoreFile.ALL_FILES_PATTERNS, - `!${this.srcdir}/index.ts`, - `!${this.srcdir}/hooks/*`, - `!${this.srcdir}/hooks/**/*` - ); } protected buildCodegenOptions(): CodegenOptions { - // TODO: update when switch to new codegen return { specPath: this.options.specPath, templateDirs: [WebSocketLibrary.TYPESCRIPT_WEBSOCKET_HOOKS], - }; - } - - public buildGenerateCommandArgs = (): string => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); - }; - - public buildOpenApiGeneratorOptions(): GenerationOptions { - return { - generator: "typescript-fetch", - specPath: this.options.specPath, - generatorDirectory: WebSocketLibrary.TYPESCRIPT_WEBSOCKET_HOOKS, - additionalProperties: { - npmName: this.package.packageName, - typescriptThreePlus: "true", - useSingleParameter: "true", - supportsES6: "true", - }, - srcDir: this.srcdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, - }, - extraVendorExtensions: { - "x-websocket-client-package-name": this.options.clientPackageName, + metadata: { + srcDir: this.srcdir, + websocketClientPackageName: this.options.clientPackageName, }, }; } diff --git a/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-async-runtime-project.ts b/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-async-runtime-project.ts index 50752ec12..632284e4c 100644 --- a/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-async-runtime-project.ts +++ b/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-async-runtime-project.ts @@ -5,17 +5,7 @@ import { GeneratedTypescriptRuntimeBaseProjectOptions, } from "./generated-typescript-runtime-base-project"; import { Language } from "../../languages"; -import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; -import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; -import { - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, - buildTypeSafeApiExecCommand, - CodegenOptions, - GenerationOptions, - OtherGenerators, - TypeSafeApiScript, -} from "../components/utils"; +import { CodegenOptions, OtherGenerators } from "../components/utils"; /** * Configuration for the generated typescript client project @@ -27,56 +17,13 @@ export interface GeneratedTypescriptAsyncRuntimeProjectOptions * Typescript project containing types generated using OpenAPI Generator CLI */ export class GeneratedTypescriptAsyncRuntimeProject extends GeneratedTypescriptRuntimeBaseProject { - // TODO: remove - /** - * Patterns that are excluded from code generation - */ - public static openApiIgnorePatterns: string[] = [ - "package.json", - "tsconfig.json", - "tsconfig.esm.json", - ".npmignore", - ]; - - protected readonly openapiGeneratorIgnore: OpenApiGeneratorIgnoreFile; - constructor(options: GeneratedTypescriptAsyncRuntimeProjectOptions) { super(options); this.addDeps("@aws-sdk/client-apigatewaymanagementapi"); - - // TODO: remove this in favour of new codegen - // Tell OpenAPI Generator CLI not to generate files that we will generate via this project, or don't need. - const openapiGeneratorIgnore = new OpenApiGeneratorIgnoreFile(this); - this.openapiGeneratorIgnore = openapiGeneratorIgnore; - openapiGeneratorIgnore.addPatterns( - ...GeneratedTypescriptAsyncRuntimeProject.openApiIgnorePatterns - ); - - // Add OpenAPI Generator cli configuration - OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig( - options.openApiGeneratorCliConfig - ); - - openapiGeneratorIgnore.addPatterns( - // Skip generating http clients - `${this.srcdir}/apis/**/*`, - `${this.srcdir}/apis/*` - ); - - // TODO: remove this in favour of new codegen - this.generateTask.reset(); - this.generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); - this.generateTask.exec( - buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, - this.buildGenerateCommandArgs() - ) - ); } protected buildCodegenOptions(): CodegenOptions { - // TODO: not currently used, adjust these when removing openapi generator for websocket apis return { specPath: this.options.specPath, templateDirs: [ @@ -88,28 +35,4 @@ export class GeneratedTypescriptAsyncRuntimeProject extends GeneratedTypescriptR }, }; } - - public buildGenerateCommandArgs = (): string => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); - }; - - protected buildOpenApiGeneratorOptions(): GenerationOptions { - return { - generator: "typescript-fetch", - specPath: this.options.specPath, - generatorDirectory: OtherGenerators.TYPESCRIPT_ASYNC_RUNTIME, - additionalProperties: { - npmName: this.package.packageName, - typescriptThreePlus: "true", - useSingleParameter: "true", - supportsES6: "true", - }, - srcDir: this.srcdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, - }, - }; - } } diff --git a/packages/type-safe-api/test/project/__snapshots__/type-safe-websocket-api-project.test.ts.snap b/packages/type-safe-api/test/project/__snapshots__/type-safe-websocket-api-project.test.ts.snap index dc21ed57f..25a5209dd 100644 --- a/packages/type-safe-api/test/project/__snapshots__/type-safe-websocket-api-project.test.ts.snap +++ b/packages/type-safe-api/test/project/__snapshots__/type-safe-websocket-api-project.test.ts.snap @@ -378,9 +378,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -434,10 +431,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -449,30 +442,6 @@ mocks resolution-mode=highest ", - "generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -536,9 +505,6 @@ resolution-mode=highest ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -585,14 +551,6 @@ resolution-mode=highest }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -607,13 +565,7 @@ resolution-mode=highest "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"openapi-typescript-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"openapi-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -945,7 +897,6 @@ resolution-mode=highest "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -983,13 +934,6 @@ resolution-mode=highest "cwd": "generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm exec projen create-openapitools.json", - "cwd": "generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -1137,8 +1081,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -1191,9 +1133,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -1205,24 +1144,6 @@ README.md resolution-mode=highest strict-peer-dependencies=false ", - "generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -1269,8 +1190,6 @@ src/apis/* ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -1316,14 +1235,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -1338,13 +1249,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=openapi-typescript-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -1661,7 +1566,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -4006,9 +3910,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -4060,10 +3961,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -4072,30 +3969,6 @@ mocks /src /dist ", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "packages/api/generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -4158,9 +4031,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -4207,14 +4077,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -4223,13 +4085,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"openapi-typescript-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"openapi-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -4558,7 +4414,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -4595,13 +4450,6 @@ mocks "cwd": "packages/api/generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn projen create-openapitools.json", - "cwd": "packages/api/generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -4748,8 +4596,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -4801,9 +4647,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -4812,24 +4655,6 @@ README.md /src /dist ", - "packages/api/generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "packages/api/generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -4875,8 +4700,6 @@ src/apis/* ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -4923,14 +4746,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -4939,13 +4754,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=openapi-typescript-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -5262,7 +5071,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -5298,13 +5106,6 @@ src/apis/* "cwd": "packages/api/generated/runtime/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn projen create-openapitools.json", - "cwd": "packages/api/generated/runtime/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -6228,9 +6029,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -6284,10 +6082,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -6299,30 +6093,6 @@ mocks resolution-mode=highest ", - "generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -6386,9 +6156,6 @@ resolution-mode=highest ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -6435,14 +6202,6 @@ resolution-mode=highest }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -6457,13 +6216,7 @@ resolution-mode=highest "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-handlers-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"../../../handlers/typescript/dist/lambda","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"NODEJS_18_X","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-handlers-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"../../../handlers/typescript/dist/lambda","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"NODEJS_18_X","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -6795,7 +6548,6 @@ resolution-mode=highest "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -6833,13 +6585,6 @@ resolution-mode=highest "cwd": "generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm exec projen create-openapitools.json", - "cwd": "generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -6987,8 +6732,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -7041,9 +6784,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -7055,24 +6795,6 @@ README.md resolution-mode=highest strict-peer-dependencies=false ", - "generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -7119,8 +6841,6 @@ src/apis/* ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -7166,14 +6886,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -7188,13 +6900,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-handlers-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -7511,7 +7217,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -7829,9 +7534,6 @@ Whenever an operation is annotated with the \`@handler\` trait in Smithy (or the /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -7886,10 +7588,6 @@ junit.xml !/.npmignore .openapi-generator .tsapi-metadata -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "handlers/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -7901,28 +7599,6 @@ junit.xml resolution-mode=highest ", - "handlers/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -", - "handlers/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__all_handlers.ts -!test/__all_tests.ts -", - "handlers/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "handlers/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -8003,9 +7679,6 @@ resolution-mode=highest ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -8052,14 +7725,6 @@ resolution-mode=highest }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -8084,13 +7749,7 @@ resolution-mode=highest "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../model/.api.json --output-path . --generator-dir typescript-async-lambda-handlers --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-handlers-typescript-runtime"}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "typescript-async-lambda-handlers" --metadata '{"srcDir":"src","tstDir":"test","runtimePackageName":"smithy-handlers-typescript-runtime"}'", }, ], }, @@ -8487,7 +8146,6 @@ resolution-mode=highest "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "eslint": "npx projen eslint", "generate": "npx projen generate", @@ -8526,13 +8184,6 @@ resolution-mode=highest "cwd": "handlers/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm exec projen create-openapitools.json", - "cwd": "handlers/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -9325,9 +8976,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -9381,10 +9029,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -9396,30 +9040,6 @@ mocks resolution-mode=highest ", - "generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -9483,9 +9103,6 @@ resolution-mode=highest ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -9532,14 +9149,6 @@ resolution-mode=highest }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -9554,13 +9163,7 @@ resolution-mode=highest "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-websocket-hooks-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-typescript-websocket-hooks-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -9892,7 +9495,6 @@ resolution-mode=highest "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -9930,13 +9532,6 @@ resolution-mode=highest "cwd": "generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm exec projen create-openapitools.json", - "cwd": "generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -10081,8 +9676,6 @@ This directory contains generated libraries based on your API model.", /.gitattributes linguist-generated /.gitignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -10134,33 +9727,12 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/libraries/typescript-websocket-client/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". resolution-mode=highest strict-peer-dependencies=false ", - "generated/libraries/typescript-websocket-client/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/* -src/apis/**/* -", - "generated/libraries/typescript-websocket-client/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/libraries/typescript-websocket-client/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -10227,8 +9799,6 @@ src/apis/**/* ".gitattributes", ".gitignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -10274,14 +9844,6 @@ src/apis/**/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -10296,13 +9858,7 @@ src/apis/**/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-websocket-client --src-dir src --tst-dir test --additional-properties "npmName=smithy-typescript-websocket-hooks-typescript-websocket-client,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-websocket-client" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -10623,7 +10179,6 @@ src/apis/**/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -10714,8 +10269,6 @@ src/apis/**/* /.gitattributes linguist-generated /.gitignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -10767,37 +10320,12 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/libraries/typescript-websocket-hooks/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". resolution-mode=highest strict-peer-dependencies=false ", - "generated/libraries/typescript-websocket-hooks/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -/* -**/* -* -!src/index.ts -!src/hooks/* -!src/hooks/**/* -", - "generated/libraries/typescript-websocket-hooks/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/libraries/typescript-websocket-hooks/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -10839,8 +10367,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -10886,14 +10412,6 @@ tsconfig.esm.json }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -10908,13 +10426,7 @@ tsconfig.esm.json "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-websocket-hooks --src-dir src --tst-dir test --additional-properties "npmName=smithy-typescript-websocket-hooks-typescript-websocket-hooks,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-websocket-client-package-name":"smithy-typescript-websocket-hooks-typescript-websocket-client"}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-websocket-hooks" --metadata '{"srcDir":"src","websocketClientPackageName":"smithy-typescript-websocket-hooks-typescript-websocket-client"}'", }, ], }, @@ -11232,7 +10744,6 @@ tsconfig.esm.json "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -11331,8 +10842,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -11385,9 +10894,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -11399,24 +10905,6 @@ README.md resolution-mode=highest strict-peer-dependencies=false ", - "generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -11463,8 +10951,6 @@ src/apis/* ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -11510,14 +10996,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -11532,13 +11010,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-typescript-websocket-hooks-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -11855,7 +11327,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -12820,9 +12291,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -12875,10 +12343,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -12886,30 +12350,6 @@ mocks /src /dist ", - "generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -12972,9 +12412,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -13021,14 +12458,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -13043,13 +12472,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-npm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-npm-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -13381,7 +12804,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -13419,13 +12841,6 @@ mocks "cwd": "generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "npx projen create-openapitools.json", - "cwd": "generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -13573,8 +12988,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -13627,9 +13040,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -13641,24 +13051,6 @@ README.md resolution-mode=highest strict-peer-dependencies=false ", - "generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -13705,8 +13097,6 @@ src/apis/* ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -13752,14 +13142,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -13774,13 +13156,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-npm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -14097,7 +13473,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -16668,9 +16043,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -16722,10 +16094,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -16734,30 +16102,6 @@ mocks /src /dist ", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "packages/api/generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -16820,9 +16164,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -16869,14 +16210,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -16885,13 +16218,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-npm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-npm-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -17220,7 +16547,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -17257,13 +16583,6 @@ mocks "cwd": "packages/api/generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "npx projen create-openapitools.json", - "cwd": "packages/api/generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -17410,8 +16729,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -17463,9 +16780,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -17474,24 +16788,6 @@ README.md /src /dist ", - "packages/api/generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "packages/api/generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -17537,8 +16833,6 @@ src/apis/* ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -17585,14 +16879,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -17601,13 +16887,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-npm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -17924,7 +17204,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -17960,13 +17239,6 @@ src/apis/* "cwd": "packages/api/generated/runtime/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "npx projen create-openapitools.json", - "cwd": "packages/api/generated/runtime/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -19376,9 +18648,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -19432,10 +18701,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -19447,30 +18712,6 @@ mocks resolution-mode=highest ", - "generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -19534,9 +18775,6 @@ resolution-mode=highest ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -19583,14 +18821,6 @@ resolution-mode=highest }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -19605,13 +18835,7 @@ resolution-mode=highest "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-pnpm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-pnpm-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -19943,7 +19167,6 @@ resolution-mode=highest "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -19981,13 +19204,6 @@ resolution-mode=highest "cwd": "generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm exec projen create-openapitools.json", - "cwd": "generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -20135,8 +19351,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -20189,9 +19403,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -20203,24 +19414,6 @@ README.md resolution-mode=highest strict-peer-dependencies=false ", - "generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -20267,8 +19460,6 @@ src/apis/* ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -20314,14 +19505,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -20336,13 +19519,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-pnpm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -20659,7 +19836,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -23247,9 +22423,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -23302,10 +22475,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -23314,30 +22483,6 @@ mocks /src /dist ", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "packages/api/generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -23400,9 +22545,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -23449,14 +22591,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -23465,13 +22599,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-pnpm-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-pnpm-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -23800,7 +22928,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -23837,13 +22964,6 @@ mocks "cwd": "packages/api/generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm exec projen create-openapitools.json", - "cwd": "packages/api/generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -23991,8 +23111,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -24045,9 +23163,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -24056,24 +23171,6 @@ README.md /src /dist ", - "packages/api/generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "packages/api/generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -24119,8 +23216,6 @@ src/apis/* ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -24167,14 +23262,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -24183,13 +23270,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-pnpm-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -24506,7 +23587,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -24542,13 +23622,6 @@ src/apis/* "cwd": "packages/api/generated/runtime/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm exec projen create-openapitools.json", - "cwd": "packages/api/generated/runtime/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -25964,9 +25037,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -26020,10 +25090,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -26035,30 +25101,6 @@ mocks resolution-mode=highest ", - "generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -26122,9 +25164,6 @@ resolution-mode=highest ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -26171,14 +25210,6 @@ resolution-mode=highest }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -26193,13 +25224,7 @@ resolution-mode=highest "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -26531,7 +25556,6 @@ resolution-mode=highest "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -26569,13 +25593,6 @@ resolution-mode=highest "cwd": "generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm exec projen create-openapitools.json", - "cwd": "generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -26723,8 +25740,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -26777,9 +25792,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -26791,24 +25803,6 @@ README.md resolution-mode=highest strict-peer-dependencies=false ", - "generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -26855,8 +25849,6 @@ src/apis/* ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -26902,14 +25894,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -26924,13 +25908,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-typescript-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -27247,7 +26225,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -29819,9 +28796,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -29873,10 +28847,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -29885,30 +28855,6 @@ mocks /src /dist ", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "packages/api/generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -29971,9 +28917,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -30020,14 +28963,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -30036,13 +28971,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-typescript-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -30371,7 +29300,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -30408,13 +29336,6 @@ mocks "cwd": "packages/api/generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn projen create-openapitools.json", - "cwd": "packages/api/generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -30561,8 +29482,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -30614,9 +29533,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -30625,24 +29541,6 @@ README.md /src /dist ", - "packages/api/generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "packages/api/generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -30688,8 +29586,6 @@ src/apis/* ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -30736,14 +29632,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -30752,13 +29640,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-typescript-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -31075,7 +29957,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -31111,13 +29992,6 @@ src/apis/* "cwd": "packages/api/generated/runtime/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn projen create-openapitools.json", - "cwd": "packages/api/generated/runtime/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -32526,9 +31400,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.pnp.* binary linguist-vendored /.projen/** linguist-generated /.projen/deps.json linguist-generated @@ -32594,10 +31465,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -32605,30 +31472,6 @@ mocks /src /dist ", - "generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -32691,9 +31534,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -32741,14 +31581,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -32763,13 +31595,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn-berry-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-yarn-berry-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -33106,7 +31932,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -33144,13 +31969,6 @@ mocks "cwd": "generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn exec projen create-openapitools.json", - "cwd": "generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -33298,8 +32116,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -33352,9 +32168,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -33366,24 +32179,6 @@ README.md resolution-mode=highest strict-peer-dependencies=false ", - "generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -33430,8 +32225,6 @@ src/apis/* ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -33477,14 +32270,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -33499,13 +32284,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-yarn-berry-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -33822,7 +32601,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -36415,9 +35193,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.pnp.* binary linguist-vendored /.projen/** linguist-generated /.projen/deps.json linguist-generated @@ -36482,10 +35257,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -36494,30 +35265,6 @@ mocks /src /dist ", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "packages/api/generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -36580,9 +35327,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -36630,14 +35374,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -36646,13 +35382,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn-berry-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-yarn-berry-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -36986,7 +35716,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -37023,13 +35752,6 @@ mocks "cwd": "packages/api/generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn exec projen create-openapitools.json", - "cwd": "packages/api/generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -37176,8 +35898,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.pnp.* binary linguist-vendored /.projen/** linguist-generated /.projen/deps.json linguist-generated @@ -37242,9 +35962,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -37253,24 +35970,6 @@ README.md /src /dist ", - "packages/api/generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "packages/api/generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -37316,8 +36015,6 @@ src/apis/* ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -37365,14 +36062,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -37381,13 +36070,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-yarn-berry-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -37709,7 +36392,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -37745,13 +36427,6 @@ src/apis/* "cwd": "packages/api/generated/runtime/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn exec projen create-openapitools.json", - "cwd": "packages/api/generated/runtime/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -39160,9 +37835,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -39215,10 +37887,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -39226,30 +37894,6 @@ mocks /src /dist ", - "generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -39312,9 +37956,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -39361,14 +38002,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -39383,13 +38016,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn-classic-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-yarn-classic-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -39721,7 +38348,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -39759,13 +38385,6 @@ mocks "cwd": "generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn projen create-openapitools.json", - "cwd": "generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -39913,8 +38532,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -39967,9 +38584,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -39981,24 +38595,6 @@ README.md resolution-mode=highest strict-peer-dependencies=false ", - "generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -40045,8 +38641,6 @@ src/apis/* ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -40092,14 +38686,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -40114,13 +38700,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-yarn-classic-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -40437,7 +39017,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -43009,9 +41588,6 @@ This directory contains a generated type-safe CDK construct which can provision /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -43063,10 +41639,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -43075,30 +41647,6 @@ mocks /src /dist ", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - "packages/api/generated/infrastructure/typescript/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - "packages/api/generated/infrastructure/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/infrastructure/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -43161,9 +41709,6 @@ mocks ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -43210,14 +41755,6 @@ mocks }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -43226,13 +41763,7 @@ mocks "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"smithy-yarn-classic-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-yarn-classic-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -43561,7 +42092,6 @@ mocks "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -43598,13 +42128,6 @@ mocks "cwd": "packages/api/generated/infrastructure/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn projen create-openapitools.json", - "cwd": "packages/api/generated/infrastructure/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { @@ -43751,8 +42274,6 @@ Each runtime project includes types from your API model, as well as type-safe cl /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -43804,9 +42325,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/project.json !/LICENSE ", @@ -43815,24 +42333,6 @@ README.md /src /dist ", - "packages/api/generated/runtime/typescript/.openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - "packages/api/generated/runtime/typescript/.pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -43878,8 +42378,6 @@ src/apis/* ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -43926,14 +42424,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -43942,13 +42432,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path ../../../model/.api.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=smithy-yarn-classic-typescript-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -44265,7 +42749,6 @@ src/apis/* "scripts": { "build": "npx projen build", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "generate": "npx projen generate", "package": "npx projen package", @@ -44301,13 +42784,6 @@ src/apis/* "cwd": "packages/api/generated/runtime/typescript", }, }, - "create-openapitools.json": { - "executor": "nx:run-commands", - "options": { - "command": "yarn projen create-openapitools.json", - "cwd": "packages/api/generated/runtime/typescript", - }, - }, "default": { "executor": "nx:run-commands", "options": { diff --git a/packages/type-safe-api/test/project/codegen/handlers/__snapshots__/generated-typescript-async-handlers-project.test.ts.snap b/packages/type-safe-api/test/project/codegen/handlers/__snapshots__/generated-typescript-async-handlers-project.test.ts.snap index 5e09fea47..3b39b104a 100644 --- a/packages/type-safe-api/test/project/codegen/handlers/__snapshots__/generated-typescript-async-handlers-project.test.ts.snap +++ b/packages/type-safe-api/test/project/codegen/handlers/__snapshots__/generated-typescript-async-handlers-project.test.ts.snap @@ -246,9 +246,6 @@ exports[`Generated Typescript Async Handlers Code Unit Tests Synth 1`] = ` /.gitignore linguist-generated /.mergify.yml linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -583,10 +580,6 @@ junit.xml !/.npmignore .openapi-generator .tsapi-metadata -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/.projenrc.js ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -619,28 +612,6 @@ pull_request_rules: /src /dist ", - ".openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -", - ".openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__all_handlers.ts -!test/__all_tests.ts -", - ".pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -740,9 +711,6 @@ pull_request_rules: ".gitignore", ".mergify.yml", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -840,14 +808,6 @@ pull_request_rules: }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -883,13 +843,7 @@ pull_request_rules: "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path my-spec.json --output-path . --generator-dir typescript-async-lambda-handlers --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"test-ts-client"}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath my-spec.json --outputPath . --templateDirs "typescript-async-lambda-handlers" --metadata '{"srcDir":"src","tstDir":"test","runtimePackageName":"test-ts-client"}'", }, ], }, @@ -1331,7 +1285,6 @@ pull_request_rules: "bump": "npx projen bump", "clobber": "npx projen clobber", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "eject": "npx projen eject", "eslint": "npx projen eslint", diff --git a/packages/type-safe-api/test/project/codegen/infrastructure/cdk/__snapshots__/generated-typescript-async-cdk-infrastructure-project.test.ts.snap b/packages/type-safe-api/test/project/codegen/infrastructure/cdk/__snapshots__/generated-typescript-async-cdk-infrastructure-project.test.ts.snap index b64a89ba5..9555829e5 100644 --- a/packages/type-safe-api/test/project/codegen/infrastructure/cdk/__snapshots__/generated-typescript-async-cdk-infrastructure-project.test.ts.snap +++ b/packages/type-safe-api/test/project/codegen/infrastructure/cdk/__snapshots__/generated-typescript-async-cdk-infrastructure-project.test.ts.snap @@ -13,9 +13,6 @@ exports[`Generated Typescript Async Infra Code Unit Tests Synth 1`] = ` /.gitignore linguist-generated /.mergify.yml linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.openapi-generator-ignore-handlebars linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -349,10 +346,6 @@ src mocks .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/.projenrc.js ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -385,30 +378,6 @@ pull_request_rules: /src /dist ", - ".openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -/* -**/* -* -!src/index.ts -!src/api.ts -!src/mock-integrations.ts -", - ".openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!src/__functions.ts -", - ".pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -487,9 +456,6 @@ pull_request_rules: ".gitignore", ".mergify.yml", ".npmignore", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -587,14 +553,6 @@ pull_request_rules: }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -620,13 +578,7 @@ pull_request_rules: "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path my-spec.json --output-path . --generator-dir typescript-async-cdk-infrastructure --src-dir src --tst-dir test --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --extra-vendor-extensions '{"x-runtime-package-name":"test-ts-client","x-relative-spec-path":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath my-spec.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"test-ts-client","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", }, { "exec": "mkdir -p assets", @@ -1002,7 +954,6 @@ pull_request_rules: "bump": "npx projen bump", "clobber": "npx projen clobber", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "eject": "npx projen eject", "generate": "npx projen generate", diff --git a/packages/type-safe-api/test/project/codegen/types/__snapshots__/generated-typescript-async-runtime-project.test.ts.snap b/packages/type-safe-api/test/project/codegen/types/__snapshots__/generated-typescript-async-runtime-project.test.ts.snap index a8d424ff8..d6bf5dccf 100644 --- a/packages/type-safe-api/test/project/codegen/types/__snapshots__/generated-typescript-async-runtime-project.test.ts.snap +++ b/packages/type-safe-api/test/project/codegen/types/__snapshots__/generated-typescript-async-runtime-project.test.ts.snap @@ -13,8 +13,6 @@ exports[`Generated Typescript Async Runtime Unit Tests Synth 1`] = ` /.gitignore linguist-generated /.mergify.yml linguist-generated /.npmignore linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated @@ -348,9 +346,6 @@ src README.md .openapi-generator .tsapi-manifest -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json !/.projenrc.js ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -383,24 +378,6 @@ pull_request_rules: /src /dist ", - ".openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/**/* -src/apis/* -", - ".pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ @@ -466,8 +443,6 @@ src/apis/* ".gitignore", ".mergify.yml", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -565,14 +540,6 @@ src/apis/* }, ], }, - "create-openapitools.json": { - "name": "create-openapitools.json", - "steps": [ - { - "exec": "cp -f .pdk/dynamic-files/openapitools.json openapitools.json", - }, - ], - }, "default": { "description": "Synthesize project files", "name": "default", @@ -598,13 +565,7 @@ src/apis/* "name": "generate", "steps": [ { - "spawn": "create-openapitools.json", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.clean-openapi-generated-code --code-path .", - }, - { - "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate --generator typescript-fetch --spec-path my-spec.json --output-path . --generator-dir typescript-async-runtime --src-dir src --tst-dir test --additional-properties "npmName=test-ts-runtime,typescriptThreePlus=true,useSingleParameter=true,supportsES6=true" --openapi-normalizer "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true" --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath my-spec.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", }, ], }, @@ -969,7 +930,6 @@ src/apis/* "bump": "npx projen bump", "clobber": "npx projen clobber", "compile": "npx projen compile", - "create-openapitools.json": "npx projen create-openapitools.json", "default": "npx projen default", "eject": "npx projen eject", "generate": "npx projen generate", diff --git a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap index 0605f1348..bd8587885 100644 --- a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-react-query-hooks.test.ts.snap @@ -2,8 +2,7 @@ exports[`Typescript React Query Hooks Code Generation Script Unit Tests Generates With multiple-tags.yaml 1`] = ` { - ".tsapi-manifest": "src/index.ts -src/runtime.ts + ".tsapi-manifest": "src/runtime.ts src/apis/DefaultApi.ts src/apis/Tag1Api.ts src/apis/Tag2Api.ts @@ -998,8 +997,7 @@ export class TextApiResponse { exports[`Typescript React Query Hooks Code Generation Script Unit Tests Generates With single-pagination.yaml 1`] = ` { - ".tsapi-manifest": "src/index.ts -src/runtime.ts + ".tsapi-manifest": "src/runtime.ts src/apis/DefaultApi.ts src/apis/index.ts src/models/index.ts diff --git a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-cdk-infrastructure.test.ts.snap b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-cdk-infrastructure.test.ts.snap index b98348c31..37ca82f32 100644 --- a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-cdk-infrastructure.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-cdk-infrastructure.test.ts.snap @@ -54,7 +54,6 @@ export class $DisconnectFunction extends SnapStartFunction { } } - /** * Options for the JavaOneFunction construct */ @@ -78,6 +77,7 @@ export class JavaOneFunction extends SnapStartFunction { } } + /** * Options for the JavaTwoFunction construct */ @@ -101,6 +101,7 @@ export class JavaTwoFunction extends SnapStartFunction { } } + /** * Options for the PythonOneFunction construct */ @@ -124,6 +125,7 @@ export class PythonOneFunction extends Function { } } + /** * Options for the PythonTwoFunction construct */ @@ -147,6 +149,7 @@ export class PythonTwoFunction extends Function { } } + /** * Options for the TypescriptOneFunction construct */ @@ -171,6 +174,7 @@ export class TypescriptOneFunction extends Function { } } + /** * Options for the TypescriptTwoFunction construct */ @@ -193,7 +197,9 @@ export class TypescriptTwoFunction extends Function { ...props, }); } -}" +} + +" `; exports[`Typescript Async Infrastructure Code Generation Script Unit Tests Generates Functions for inline-body.yaml 1`] = ` @@ -205,7 +211,6 @@ import * as path from "path"; - /** * Options for the JavaFunction construct */ @@ -229,6 +234,7 @@ export class JavaFunction extends SnapStartFunction { } } + /** * Options for the PythonFunction construct */ @@ -252,16 +258,17 @@ export class PythonFunction extends Function { } } + /** - * Options for the TypeScriptOperationFunction construct + * Options for the TypeScriptFunction construct */ -export interface TypeScriptOperationFunctionProps extends Omit {} +export interface TypeScriptFunctionProps extends Omit {} /** - * Lambda function construct which points to the typescript implementation of TypeScriptOperation + * Lambda function construct which points to the typescript implementation of TypeScript */ -export class TypeScriptOperationFunction extends Function { - constructor(scope: Construct, id: string, props?: TypeScriptOperationFunctionProps) { +export class TypeScriptFunction extends Function { + constructor(scope: Construct, id: string, props?: TypeScriptFunctionProps) { super(scope, id, { runtime: Runtime.NODEJS_18_X, handler: "index.handler", @@ -274,7 +281,9 @@ export class TypeScriptOperationFunction extends Function { ...props, }); } -}" +} + +" `; exports[`Typescript Async Infrastructure Code Generation Script Unit Tests Generates With single.yaml 1`] = ` diff --git a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-lambda-handlers.test.ts.snap b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-lambda-handlers.test.ts.snap index e759e625e..75cda3fc8 100644 --- a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-lambda-handlers.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-lambda-handlers.test.ts.snap @@ -57,7 +57,9 @@ export const typescriptTwo: TypescriptTwoChainedHandlerFunction = async (request * Entry point for the AWS Lambda handler for the TypescriptTwo operation. * The typescriptTwoHandler method wraps the type-safe handler and manages marshalling inputs */ -export const handler = typescriptTwoHandler(...INTERCEPTORS, typescriptTwo);" +export const handler = typescriptTwoHandler(...INTERCEPTORS, typescriptTwo); + +" `; exports[`Typescript Async Handlers Code Generation Script Unit Tests Generates With handlers.yaml 3`] = ` @@ -131,5 +133,7 @@ describe('TypescriptTwo', () => { }); }); -});" +}); + +" `; diff --git a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-websocket-client.test.ts.snap b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-websocket-client.test.ts.snap index 41ba0bd12..f77c06592 100644 --- a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-websocket-client.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-websocket-client.test.ts.snap @@ -2,626 +2,15 @@ exports[`Typescript Async Client Code Generation Script Unit Tests Generates With single.yaml 1`] = ` { - ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". - -/.gitattributes linguist-generated -/.github/pull_request_template.md linguist-generated -/.github/workflows/build.yml linguist-generated -/.github/workflows/pull-request-lint.yml linguist-generated -/.github/workflows/release.yml linguist-generated -/.github/workflows/upgrade-main.yml linguist-generated -/.gitignore linguist-generated -/.mergify.yml linguist-generated -/.openapi-generator-ignore linguist-generated -/.pdk/dynamic-files/openapitools.json linguist-generated -/.projen/** linguist-generated -/.projen/deps.json linguist-generated -/.projen/files.json linguist-generated -/.projen/tasks.json linguist-generated -/LICENSE linguist-generated -/package.json linguist-generated -/tsconfig.dev.json linguist-generated -/tsconfig.json linguist-generated -/yarn.lock linguist-generated", - ".github/pull_request_template.md": "Fixes #", - ".github/workflows/build.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". - -name: build -on: - pull_request: {} - workflow_dispatch: {} -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: write - outputs: - self_mutation_happened: \${{ steps.self_mutation.outputs.self_mutation_happened }} - env: - CI: "true" - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: \${{ github.event.pull_request.head.ref }} - repository: \${{ github.event.pull_request.head.repo.full_name }} - - name: Install dependencies - run: yarn install --check-files - - name: build - run: npx projen build - - name: Find mutations - id: self_mutation - run: |- - git add . - git diff --staged --patch --exit-code > .repo.patch || echo "self_mutation_happened=true" >> $GITHUB_OUTPUT - working-directory: ./ - - name: Upload patch - if: steps.self_mutation.outputs.self_mutation_happened - uses: actions/upload-artifact@v4 - with: - name: .repo.patch - path: .repo.patch - overwrite: true - - name: Fail build on mutation - if: steps.self_mutation.outputs.self_mutation_happened - run: |- - echo "::error::Files were changed during build (see build log). If this was triggered from a fork, you will need to update your branch." - cat .repo.patch - exit 1 - self-mutation: - needs: build - runs-on: ubuntu-latest - permissions: - contents: write - if: always() && needs.build.outputs.self_mutation_happened && !(github.event.pull_request.head.repo.full_name != github.repository) - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - token: \${{ secrets.PROJEN_GITHUB_TOKEN }} - ref: \${{ github.event.pull_request.head.ref }} - repository: \${{ github.event.pull_request.head.repo.full_name }} - - name: Download patch - uses: actions/download-artifact@v4 - with: - name: .repo.patch - path: \${{ runner.temp }} - - name: Apply patch - run: '[ -s \${{ runner.temp }}/.repo.patch ] && git apply \${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' - - name: Set git identity - run: |- - git config user.name "github-actions" - git config user.email "github-actions@github.com" - - name: Push changes - env: - PULL_REQUEST_REF: \${{ github.event.pull_request.head.ref }} - run: |- - git add . - git commit -s -m "chore: self mutation" - git push origin HEAD:$PULL_REQUEST_REF -", - ".github/workflows/pull-request-lint.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". - -name: pull-request-lint -on: - pull_request_target: - types: - - labeled - - opened - - synchronize - - reopened - - ready_for_review - - edited -jobs: - validate: - name: Validate PR title - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: amannn/action-semantic-pull-request@v5.4.0 - env: - GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} - with: - types: |- - feat - fix - chore - requireScope: false -", - ".github/workflows/release.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". - -name: release -on: - push: - branches: - - main - workflow_dispatch: {} -jobs: - release: - runs-on: ubuntu-latest - permissions: - contents: write - outputs: - latest_commit: \${{ steps.git_remote.outputs.latest_commit }} - tag_exists: \${{ steps.check_tag_exists.outputs.exists }} - env: - CI: "true" - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set git identity - run: |- - git config user.name "github-actions" - git config user.email "github-actions@github.com" - - name: Install dependencies - run: yarn install --check-files --frozen-lockfile - - name: release - run: npx projen release - - name: Check if version has already been tagged - id: check_tag_exists - run: |- - TAG=$(cat dist/releasetag.txt) - ([ ! -z "$TAG" ] && git ls-remote -q --exit-code --tags origin $TAG && (echo "exists=true" >> $GITHUB_OUTPUT)) || (echo "exists=false" >> $GITHUB_OUTPUT) - cat $GITHUB_OUTPUT - - name: Check for new commits - id: git_remote - run: |- - echo "latest_commit=$(git ls-remote origin -h \${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT - cat $GITHUB_OUTPUT - - name: Backup artifact permissions - if: \${{ steps.git_remote.outputs.latest_commit == github.sha }} - run: cd dist && getfacl -R . > permissions-backup.acl - continue-on-error: true - - name: Upload artifact - if: \${{ steps.git_remote.outputs.latest_commit == github.sha }} - uses: actions/upload-artifact@v4 - with: - name: build-artifact - path: dist - overwrite: true - release_github: - name: Publish to GitHub Releases - needs: release - runs-on: ubuntu-latest - permissions: - contents: write - if: needs.release.outputs.tag_exists != 'true' && needs.release.outputs.latest_commit == github.sha - steps: - - uses: actions/setup-node@v4 - with: - node-version: 18.x - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: build-artifact - path: dist - - name: Restore build artifact permissions - run: cd dist && setfacl --restore=permissions-backup.acl - continue-on-error: true - - name: Release - env: - GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} - GITHUB_REPOSITORY: \${{ github.repository }} - GITHUB_REF: \${{ github.sha }} - run: errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi -", - ".github/workflows/upgrade-main.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". - -name: upgrade-main -on: - workflow_dispatch: {} - schedule: - - cron: 0 0 * * * -jobs: - upgrade: - name: Upgrade - runs-on: ubuntu-latest - permissions: - contents: read - outputs: - patch_created: \${{ steps.create_patch.outputs.patch_created }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: main - - name: Install dependencies - run: yarn install --check-files --frozen-lockfile - - name: Upgrade dependencies - run: npx projen upgrade - - name: Find mutations - id: create_patch - run: |- - git add . - git diff --staged --patch --exit-code > .repo.patch || echo "patch_created=true" >> $GITHUB_OUTPUT - working-directory: ./ - - name: Upload patch - if: steps.create_patch.outputs.patch_created - uses: actions/upload-artifact@v4 - with: - name: .repo.patch - path: .repo.patch - overwrite: true - pr: - name: Create Pull Request - needs: upgrade - runs-on: ubuntu-latest - permissions: - contents: read - if: \${{ needs.upgrade.outputs.patch_created }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: main - - name: Download patch - uses: actions/download-artifact@v4 - with: - name: .repo.patch - path: \${{ runner.temp }} - - name: Apply patch - run: '[ -s \${{ runner.temp }}/.repo.patch ] && git apply \${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' - - name: Set git identity - run: |- - git config user.name "github-actions" - git config user.email "github-actions@github.com" - - name: Create Pull Request - id: create-pr - uses: peter-evans/create-pull-request@v6 - with: - token: \${{ secrets.PROJEN_GITHUB_TOKEN }} - commit-message: |- - chore(deps): upgrade dependencies - - Upgrades project dependencies. See details in [workflow run]. - - [Workflow Run]: \${{ github.server_url }}/\${{ github.repository }}/actions/runs/\${{ github.run_id }} - - ------ - - *Automatically created by projen via the "upgrade-main" workflow* - branch: github-actions/upgrade-main - title: "chore(deps): upgrade dependencies" - body: |- - Upgrades project dependencies. See details in [workflow run]. - - [Workflow Run]: \${{ github.server_url }}/\${{ github.repository }}/actions/runs/\${{ github.run_id }} - - ------ - - *Automatically created by projen via the "upgrade-main" workflow* - author: github-actions - committer: github-actions - signoff: true -", - ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". - -queue_rules: - - name: default - update_method: merge - conditions: - - "#approved-reviews-by>=1" - - -label~=(do-not-merge) - - status-success=build -pull_request_rules: - - name: Automatic merge on approval and successful build - actions: - delete_head_branch: {} - queue: - method: squash - name: default - commit_message_template: |- - {{ title }} (#{{ number }}) - - {{ body }} - conditions: - - "#approved-reviews-by>=1" - - -label~=(do-not-merge) - - status-success=build -", - ".openapi-generator-ignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -.gitignore -package.json -tsconfig.json -tsconfig.esm.json -.npmignore -src/apis/* -src/apis/**/* -", - ".openapi-generator/FILES": "README.md -src/client/client.ts + ".tsapi-manifest": "src/client/client.ts src/index.ts +src/models/index.ts src/models/ApiError.ts -src/models/ApiError.ts -src/models/ApiError.ts -src/models/MapRequest.ts -src/models/MapRequest.ts src/models/MapRequest.ts src/models/MapRequestMapPropertyValue.ts -src/models/MapRequestMapPropertyValue.ts -src/models/MapRequestMapPropertyValue.ts -src/models/TestRequest.ts src/models/TestRequest.ts -src/models/TestRequest.ts -src/models/TestResponse.ts src/models/TestResponse.ts -src/models/TestResponse.ts -src/models/TestResponseMessagesInner.ts -src/models/TestResponseMessagesInner.ts -src/models/TestResponseMessagesInner.ts -src/models/index.ts -src/runtime.ts", - ".openapi-generator/VERSION": "6.3.0", - ".pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, - "LICENSE": " - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -", - "README.md": "## test@1.0.0 - -This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: - -Environment -* Node.js -* Webpack -* Browserify - -Language level -* ES5 - you must have a Promises/A+ library installed -* ES6 - -Module system -* CommonJS -* ES6 module system - -It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via \`package.json\`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) - -### Building - -To build and compile the typescript sources to javascript use: -\`\`\` -npm install -npm run build -\`\`\` - -### Publishing - -First build the package then run \`\`\`npm publish\`\`\` - -### Consuming - -navigate to the folder of your consuming project and run one of the following commands. - -_published:_ - -\`\`\` -npm install test@1.0.0 --save -\`\`\` - -_unPublished (not recommended):_ - -\`\`\` -npm install PATH_TO_GENERATED_PACKAGE --save -", - "openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, +src/models/TestResponseMessagesInner.ts", "src/client/client.ts": "// Import models import { ApiError, @@ -1143,17 +532,16 @@ export * from './client/client'; /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; + /** * * @export @@ -1188,7 +576,7 @@ export function ApiErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): return json; } return { - + 'errorMessage': json['errorMessage'], }; } @@ -1201,7 +589,7 @@ export function ApiErrorToJSON(value?: ApiError | null): any { return null; } return { - + 'errorMessage': value.errorMessage, }; } @@ -1211,16 +599,14 @@ export function ApiErrorToJSON(value?: ApiError | null): any { /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; import type { MapRequestMapPropertyValue } from './MapRequestMapPropertyValue'; import { @@ -1263,7 +649,7 @@ export function MapRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean) return json; } return { - + 'mapProperty': (mapValues(json['mapProperty'], MapRequestMapPropertyValueFromJSON)), }; } @@ -1276,7 +662,7 @@ export function MapRequestToJSON(value?: MapRequest | null): any { return null; } return { - + 'mapProperty': (mapValues(value.mapProperty, MapRequestMapPropertyValueToJSON)), }; } @@ -1286,17 +672,16 @@ export function MapRequestToJSON(value?: MapRequest | null): any { /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; + /** * * @export @@ -1337,7 +722,7 @@ export function MapRequestMapPropertyValueFromJSONTyped(json: any, ignoreDiscrim return json; } return { - + 'a': json['a'], 'b': !exists(json, 'b') ? undefined : json['b'], }; @@ -1351,7 +736,7 @@ export function MapRequestMapPropertyValueToJSON(value?: MapRequestMapPropertyVa return null; } return { - + 'a': value.a, 'b': value.b, }; @@ -1362,17 +747,16 @@ export function MapRequestMapPropertyValueToJSON(value?: MapRequestMapPropertyVa /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; + /** * This is a test request * @export @@ -1406,7 +790,7 @@ export function TestRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean return json; } return { - + 'myInput': !exists(json, 'myInput') ? undefined : json['myInput'], }; } @@ -1419,7 +803,7 @@ export function TestRequestToJSON(value?: TestRequest | null): any { return null; } return { - + 'myInput': value.myInput, }; } @@ -1429,16 +813,14 @@ export function TestRequestToJSON(value?: TestRequest | null): any { /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; import type { TestResponseMessagesInner } from './TestResponseMessagesInner'; import { @@ -1481,7 +863,7 @@ export function TestResponseFromJSONTyped(json: any, ignoreDiscriminator: boolea return json; } return { - + 'messages': ((json['messages'] as Array).map(TestResponseMessagesInnerFromJSON)), }; } @@ -1494,7 +876,7 @@ export function TestResponseToJSON(value?: TestResponse | null): any { return null; } return { - + 'messages': ((value.messages as Array).map(TestResponseMessagesInnerToJSON)), }; } @@ -1504,17 +886,16 @@ export function TestResponseToJSON(value?: TestResponse | null): any { /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; + /** * * @export @@ -1555,7 +936,7 @@ export function TestResponseMessagesInnerFromJSONTyped(json: any, ignoreDiscrimi return json; } return { - + 'message': !exists(json, 'message') ? undefined : json['message'], 'id': json['id'], }; @@ -1569,7 +950,7 @@ export function TestResponseMessagesInnerToJSON(value?: TestResponseMessagesInne return null; } return { - + 'message': value.message, 'id': value.id, }; @@ -1585,450 +966,5 @@ export * from './TestRequest'; export * from './TestResponse'; export * from './TestResponseMessagesInner'; ", - "src/runtime.ts": "/* tslint:disable */ -/* eslint-disable */ -/** - * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export const BASE_PATH = "http://localhost".replace(/\\/+$/, ""); - -export interface ConfigurationParameters { - basePath?: string; // override base path - fetchApi?: FetchAPI; // override for fetch implementation - middleware?: Middleware[]; // middleware to apply before/after fetch requests - queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings - username?: string; // parameter for basic security - password?: string; // parameter for basic security - apiKey?: string | ((name: string) => string); // parameter for apiKey security - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security - headers?: HTTPHeaders; //header params we want to use on every request - credentials?: RequestCredentials; //value for the credentials param we want to use on each request -} - -export class Configuration { - constructor(private configuration: ConfigurationParameters = {}) {} - - set config(configuration: Configuration) { - this.configuration = configuration; - } - - get basePath(): string { - return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; - } - - get fetchApi(): FetchAPI | undefined { - return this.configuration.fetchApi; - } - - get middleware(): Middleware[] { - return this.configuration.middleware || []; - } - - get queryParamsStringify(): (params: HTTPQuery) => string { - return this.configuration.queryParamsStringify || querystring; - } - - get username(): string | undefined { - return this.configuration.username; - } - - get password(): string | undefined { - return this.configuration.password; - } - - get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; - if (apiKey) { - return typeof apiKey === 'function' ? apiKey : () => apiKey; - } - return undefined; - } - - get accessToken(): ((name?: string, scopes?: string[]) => string | Promise) | undefined { - const accessToken = this.configuration.accessToken; - if (accessToken) { - return typeof accessToken === 'function' ? accessToken : async () => accessToken; - } - return undefined; - } - - get headers(): HTTPHeaders | undefined { - return this.configuration.headers; - } - - get credentials(): RequestCredentials | undefined { - return this.configuration.credentials; - } -} - -export const DefaultConfig = new Configuration(); - -/** - * This is the base class for all generated API classes. - */ -export class BaseAPI { - - private middleware: Middleware[]; - - constructor(protected configuration = DefaultConfig) { - this.middleware = configuration.middleware; - } - - withMiddleware(this: T, ...middlewares: Middleware[]) { - const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); - return next; - } - - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } - - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } - - protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise { - const { url, init } = await this.createFetchParams(context, initOverrides); - const response = await this.fetchApi(url, init); - if (response && (response.status >= 200 && response.status < 300)) { - return response; - } - throw new ResponseError(response, 'Response returned an error code'); - } - - private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) { - let url = this.configuration.basePath + context.path; - if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. - // this is done to avoid urls ending with a "?" character which buggy webservers - // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); - } - - const headers = Object.assign({}, this.configuration.headers, context.headers); - Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); - - const initOverrideFn = - typeof initOverrides === "function" - ? initOverrides - : async () => initOverrides; - - const initParams = { - method: context.method, - headers, - body: context.body, - credentials: this.configuration.credentials, - }; - - const overriddenInit: RequestInit = { - ...initParams, - ...(await initOverrideFn({ - init: initParams, - context, - })) - }; - - const init: RequestInit = { - ...overriddenInit, - body: - isFormData(overriddenInit.body) || - overriddenInit.body instanceof URLSearchParams || - isBlob(overriddenInit.body) - ? overriddenInit.body - : JSON.stringify(overriddenInit.body), - }; - - return { url, init }; - } - - private fetchApi = async (url: string, init: RequestInit) => { - let fetchParams = { url, init }; - for (const middleware of this.middleware) { - if (middleware.pre) { - fetchParams = await middleware.pre({ - fetch: this.fetchApi, - ...fetchParams, - }) || fetchParams; - } - } - let response: Response | undefined = undefined; - try { - response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); - } catch (e) { - for (const middleware of this.middleware) { - if (middleware.onError) { - response = await middleware.onError({ - fetch: this.fetchApi, - url: fetchParams.url, - init: fetchParams.init, - error: e, - response: response ? response.clone() : undefined, - }) || response; - } - } - if (response === undefined) { - if (e instanceof Error) { - throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response'); - } else { - throw e; - } - } - } - for (const middleware of this.middleware) { - if (middleware.post) { - response = await middleware.post({ - fetch: this.fetchApi, - url: fetchParams.url, - init: fetchParams.init, - response: response.clone(), - }) || response; - } - } - return response; - } - - /** - * Create a shallow clone of \`this\` by constructing a new instance - * and then shallow cloning data members. - */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } -}; - -function isBlob(value: any): value is Blob { - return typeof Blob !== 'undefined' && value instanceof Blob; -} - -function isFormData(value: any): value is FormData { - return typeof FormData !== "undefined" && value instanceof FormData; -} - -export class ResponseError extends Error { - override name: "ResponseError" = "ResponseError"; - constructor(public response: Response, msg?: string) { - super(msg); - } -} - -export class FetchError extends Error { - override name: "FetchError" = "FetchError"; - constructor(public cause: Error, msg?: string) { - super(msg); - } -} - -export class RequiredError extends Error { - override name: "RequiredError" = "RequiredError"; - constructor(public field: string, msg?: string) { - super(msg); - } -} - -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\\t", - pipes: "|", -}; - -export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; - -export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; -export type HTTPHeaders = { [key: string]: string }; -export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; -export type HTTPBody = Json | FormData | URLSearchParams; -export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody }; -export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; - -export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise - -export interface FetchParams { - url: string; - init: RequestInit; -} - -export interface RequestOpts { - path: string; - method: HTTPMethod; - headers: HTTPHeaders; - query?: HTTPQuery; - body?: HTTPBody; -} - -export function exists(json: any, key: string) { - const value = json[key]; - return value !== null && value !== undefined; -} - -export function querystring(params: HTTPQuery, prefix: string = ''): string { - return Object.keys(params) - .map(key => querystringSingleKey(key, params[key], prefix)) - .filter(part => part.length > 0) - .join('&'); -} - -function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { - const fullKey = keyPrefix + (keyPrefix.length ? \`[\${key}]\` : key); - if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) - .join(\`&\${encodeURIComponent(fullKey)}=\`); - return \`\${encodeURIComponent(fullKey)}=\${multiValue}\`; - } - if (value instanceof Set) { - const valueAsArray = Array.from(value); - return querystringSingleKey(key, valueAsArray, keyPrefix); - } - if (value instanceof Date) { - return \`\${encodeURIComponent(fullKey)}=\${encodeURIComponent(value.toISOString())}\`; - } - if (value instanceof Object) { - return querystring(value as HTTPQuery, fullKey); - } - return \`\${encodeURIComponent(fullKey)}=\${encodeURIComponent(String(value))}\`; -} - -export function mapValues(data: any, fn: (item: any) => any) { - return Object.keys(data).reduce( - (acc, key) => ({ ...acc, [key]: fn(data[key]) }), - {} - ); -} - -export function canConsumeForm(consumes: Consume[]): boolean { - for (const consume of consumes) { - if ('multipart/form-data' === consume.contentType) { - return true; - } - } - return false; -} - -export interface Consume { - contentType: string; -} - -export interface RequestContext { - fetch: FetchAPI; - url: string; - init: RequestInit; -} - -export interface ResponseContext { - fetch: FetchAPI; - url: string; - init: RequestInit; - response: Response; -} - -export interface ErrorContext { - fetch: FetchAPI; - url: string; - init: RequestInit; - error: unknown; - response?: Response; -} - -export interface Middleware { - pre?(context: RequestContext): Promise; - post?(context: ResponseContext): Promise; - onError?(context: ErrorContext): Promise; -} - -export interface ApiResponse { - raw: Response; - value(): Promise; -} - -export interface ResponseTransformer { - (json: any): T; -} - -export class JSONApiResponse { - constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - - async value(): Promise { - return this.transformer(await this.raw.json()); - } -} - -export class VoidApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return undefined; - } -} - -export class BlobApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return await this.raw.blob(); - }; -} - -export class TextApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return await this.raw.text(); - }; -} -", - "tsconfig.dev.json": { - "compilerOptions": { - "alwaysStrict": false, - "declaration": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "inlineSources": true, - "lib": [ - "dom", - "es2019", - ], - "module": "CommonJS", - "noEmitOnError": false, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": false, - "noImplicitReturns": false, - "noImplicitThis": false, - "noUnusedLocals": false, - "noUnusedParameters": false, - "resolveJsonModule": true, - "skipLibCheck": true, - "strict": false, - "strictNullChecks": false, - "strictPropertyInitialization": false, - "stripInternal": true, - "target": "ES2019", - }, - "exclude": [ - "node_modules", - ], - "include": [ - "src/**/*.ts", - "test/**/*.ts", - ".projenrc.js", - ], - }, } `; diff --git a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-websocket-hooks.test.ts.snap b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-websocket-hooks.test.ts.snap index b68c64557..2842872b4 100644 --- a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-websocket-hooks.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript-websocket-hooks.test.ts.snap @@ -1,3 +1,158 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Typescript Async Hooks Code Generation Script Unit Tests Generates With single.yaml 1`] = `{}`; +exports[`Typescript Async Hooks Code Generation Script Unit Tests Generates With single.yaml 1`] = ` +{ + ".tsapi-manifest": "src/hooks/hooks.tsx +src/index.ts +src/hooks/provider.tsx", + "src/hooks/hooks.tsx": "import { + ApiError, + MapRequest, + MapRequestMapPropertyValue, + TestRequest, + TestResponse, + TestResponseMessagesInner, + DefaultApiWebSocketClient, +} from "ts-ws-client"; +import { + DefaultApiWebSocketClientContext, +} from "./provider"; +import { useContext, useEffect, useCallback, DependencyList } from "react"; + +const NO_CLIENT_ERROR = new Error(\`DefaultApiWebSocketClient is missing. Please ensure you have instantiated the DefaultApiWebSocketClientProvider with a client instance.\`); + +/** + * Hook to retrieve the websocket client from the context + */ +export const useDefaultApiWebSocketClient = () => { + const client = useContext(DefaultApiWebSocketClientContext); + if (!client) { + throw NO_CLIENT_ERROR; + } + return client; +}; + +/** + * Listen to AnyRequest messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOnAnyRequest = (callback: (input: string) => void, deps: DependencyList) => { + const client = useDefaultApiWebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.onAnyRequest(cb); + }, [client, cb]); +}; + +/** + * Listen to Bidirectional messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOnBidirectional = (callback: (input: TestRequest) => void, deps: DependencyList) => { + const client = useDefaultApiWebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.onBidirectional(cb); + }, [client, cb]); +}; + +/** + * Listen to Empty messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOnEmpty = (callback: () => void, deps: DependencyList) => { + const client = useDefaultApiWebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.onEmpty(cb); + }, [client, cb]); +}; + +/** + * Listen to MapRequest messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOnMapRequest = (callback: (input: MapRequest) => void, deps: DependencyList) => { + const client = useDefaultApiWebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.onMapRequest(cb); + }, [client, cb]); +}; + +/** + * Listen to MediaTypes messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOnMediaTypes = (callback: (input: string) => void, deps: DependencyList) => { + const client = useDefaultApiWebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.onMediaTypes(cb); + }, [client, cb]); +}; + +/** + * Listen to MultipleContentTypes messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOnMultipleContentTypes = (callback: (input: TestRequest) => void, deps: DependencyList) => { + const client = useDefaultApiWebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.onMultipleContentTypes(cb); + }, [client, cb]); +}; + +/** + * Listen to ServerToClient messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOnServerToClient = (callback: (input: TestRequest) => void, deps: DependencyList) => { + const client = useDefaultApiWebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.onServerToClient(cb); + }, [client, cb]); +}; + +/** + * Listen to WithoutOperationIdPost messages from the server + * Provided callback should use the useCallback hook to memoise the function + */ +export const useOnWithoutOperationIdPost = (callback: (input: TestRequest) => void, deps: DependencyList) => { + const client = useDefaultApiWebSocketClient(); + const cb = useCallback(callback, deps); + useEffect(() => { + return client.onWithoutOperationIdPost(cb); + }, [client, cb]); +}; + +", + "src/hooks/provider.tsx": "import { + DefaultApiWebSocketClient, +} from "ts-ws-client"; +import React, { createContext, ReactNode, FC } from "react"; + +export const DefaultApiWebSocketClientContext = createContext(undefined); + +export interface DefaultApiWebSocketClientProviderProps { + readonly client: DefaultApiWebSocketClient; + readonly children?: ReactNode; +} + +export const DefaultApiWebSocketClientProvider: FC = (props) => { + return ( + + {props.children} + + ); +}; +", + "src/index.ts": "/* tslint:disable */ +/* eslint-disable */ +export * from './hooks/hooks'; +export * from './hooks/provider'; +", +} +`; diff --git a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript.test.ts.snap b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript.test.ts.snap index 533884fc9..14a856a19 100644 --- a/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/async/__snapshots__/typescript.test.ts.snap @@ -2,137 +2,22 @@ exports[`Typescript Async Runtime Code Generation Script Unit Tests Generates With single.yaml 1`] = ` { - ".openapi-generator-ignore": "# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md -", - ".openapi-generator/FILES": ".gitignore -.npmignore -.openapi-generator-ignore -README.md -package.json -src/__interceptors.ts -src/apis/DefaultApi.ts -src/apis/index.ts -src/index.ts -src/models/ApiError.ts -src/models/ApiError.ts + ".tsapi-manifest": "src/index.ts +src/interceptors/try-catch.ts +src/interceptors/powertools/logger.ts +src/interceptors/powertools/tracer.ts +src/interceptors/powertools/metrics.ts +src/interceptors/index.ts +src/server/operation-config.ts +src/server/server-sdk.ts +src/models/index.ts src/models/ApiError.ts src/models/MapRequest.ts -src/models/MapRequest.ts -src/models/MapRequest.ts -src/models/MapRequestMapPropertyValue.ts -src/models/MapRequestMapPropertyValue.ts src/models/MapRequestMapPropertyValue.ts src/models/TestRequest.ts -src/models/TestRequest.ts -src/models/TestRequest.ts -src/models/TestResponse.ts src/models/TestResponse.ts -src/models/TestResponse.ts -src/models/TestResponseMessagesInner.ts -src/models/TestResponseMessagesInner.ts -src/models/TestResponseMessagesInner.ts -src/models/index.ts -src/runtime.ts -src/server/operation-config.ts -src/server/server-sdk.ts -tsconfig.esm.json -tsconfig.json -src/interceptors/try-catch.ts -src/interceptors/powertools/logger.ts -src/interceptors/powertools/tracer.ts -src/interceptors/powertools/metrics.ts -src/interceptors/index.ts", - ".openapi-generator/VERSION": "6.3.0", - ".pdk/dynamic-files/openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, - "README.md": "## test@1.0.0 - -This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: - -Environment -* Node.js -* Webpack -* Browserify - -Language level -* ES5 - you must have a Promises/A+ library installed -* ES6 - -Module system -* CommonJS -* ES6 module system - -It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via \`package.json\`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) - -### Building - -To build and compile the typescript sources to javascript use: -\`\`\` -npm install -npm run build -\`\`\` - -### Publishing - -First build the package then run \`\`\`npm publish\`\`\` - -### Consuming - -navigate to the folder of your consuming project and run one of the following commands. - -_published:_ - -\`\`\` -npm install test@1.0.0 --save -\`\`\` - -_unPublished (not recommended):_ - -\`\`\` -npm install PATH_TO_GENERATED_PACKAGE --save -", - "openapitools.json": { - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "storageDir": "~/.open-api-generator-cli", - "version": "6.3.0", - }, - "spaces": 2, - }, - "src/index.ts": "/* tslint:disable */ -/* eslint-disable */ -export * from './runtime'; -export * from './models'; +src/models/TestResponseMessagesInner.ts", + "src/index.ts": "export * from './models'; export * from './server/operation-config'; export * from './server/server-sdk'; export * from './interceptors' @@ -323,17 +208,16 @@ export const tryCatchInterceptor = buildTryCatchInterceptor(); /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; + /** * * @export @@ -368,7 +252,7 @@ export function ApiErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): return json; } return { - + 'errorMessage': json['errorMessage'], }; } @@ -381,7 +265,7 @@ export function ApiErrorToJSON(value?: ApiError | null): any { return null; } return { - + 'errorMessage': value.errorMessage, }; } @@ -391,16 +275,14 @@ export function ApiErrorToJSON(value?: ApiError | null): any { /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; import type { MapRequestMapPropertyValue } from './MapRequestMapPropertyValue'; import { @@ -443,7 +325,7 @@ export function MapRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean) return json; } return { - + 'mapProperty': (mapValues(json['mapProperty'], MapRequestMapPropertyValueFromJSON)), }; } @@ -456,7 +338,7 @@ export function MapRequestToJSON(value?: MapRequest | null): any { return null; } return { - + 'mapProperty': (mapValues(value.mapProperty, MapRequestMapPropertyValueToJSON)), }; } @@ -466,17 +348,16 @@ export function MapRequestToJSON(value?: MapRequest | null): any { /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; + /** * * @export @@ -517,7 +398,7 @@ export function MapRequestMapPropertyValueFromJSONTyped(json: any, ignoreDiscrim return json; } return { - + 'a': json['a'], 'b': !exists(json, 'b') ? undefined : json['b'], }; @@ -531,7 +412,7 @@ export function MapRequestMapPropertyValueToJSON(value?: MapRequestMapPropertyVa return null; } return { - + 'a': value.a, 'b': value.b, }; @@ -542,17 +423,16 @@ export function MapRequestMapPropertyValueToJSON(value?: MapRequestMapPropertyVa /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; + /** * This is a test request * @export @@ -586,7 +466,7 @@ export function TestRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean return json; } return { - + 'myInput': !exists(json, 'myInput') ? undefined : json['myInput'], }; } @@ -599,7 +479,7 @@ export function TestRequestToJSON(value?: TestRequest | null): any { return null; } return { - + 'myInput': value.myInput, }; } @@ -609,16 +489,14 @@ export function TestRequestToJSON(value?: TestRequest | null): any { /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; import type { TestResponseMessagesInner } from './TestResponseMessagesInner'; import { @@ -661,7 +539,7 @@ export function TestResponseFromJSONTyped(json: any, ignoreDiscriminator: boolea return json; } return { - + 'messages': ((json['messages'] as Array).map(TestResponseMessagesInnerFromJSON)), }; } @@ -674,7 +552,7 @@ export function TestResponseToJSON(value?: TestResponse | null): any { return null; } return { - + 'messages': ((value.messages as Array).map(TestResponseMessagesInnerToJSON)), }; } @@ -684,17 +562,16 @@ export function TestResponseToJSON(value?: TestResponse | null): any { /* eslint-disable */ /** * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * * * The version of the OpenAPI document: 1.0.0 - * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import { exists, mapValues } from '../runtime'; + /** * * @export @@ -735,7 +612,7 @@ export function TestResponseMessagesInnerFromJSONTyped(json: any, ignoreDiscrimi return json; } return { - + 'message': !exists(json, 'message') ? undefined : json['message'], 'id': json['id'], }; @@ -749,7 +626,7 @@ export function TestResponseMessagesInnerToJSON(value?: TestResponseMessagesInne return null; } return { - + 'message': value.message, 'id': value.id, }; @@ -764,414 +641,6 @@ export * from './MapRequestMapPropertyValue'; export * from './TestRequest'; export * from './TestResponse'; export * from './TestResponseMessagesInner'; -", - "src/runtime.ts": "/* tslint:disable */ -/* eslint-disable */ -/** - * Example API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export const BASE_PATH = "http://localhost".replace(/\\/+$/, ""); - -export interface ConfigurationParameters { - basePath?: string; // override base path - fetchApi?: FetchAPI; // override for fetch implementation - middleware?: Middleware[]; // middleware to apply before/after fetch requests - queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings - username?: string; // parameter for basic security - password?: string; // parameter for basic security - apiKey?: string | ((name: string) => string); // parameter for apiKey security - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security - headers?: HTTPHeaders; //header params we want to use on every request - credentials?: RequestCredentials; //value for the credentials param we want to use on each request -} - -export class Configuration { - constructor(private configuration: ConfigurationParameters = {}) {} - - set config(configuration: Configuration) { - this.configuration = configuration; - } - - get basePath(): string { - return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; - } - - get fetchApi(): FetchAPI | undefined { - return this.configuration.fetchApi; - } - - get middleware(): Middleware[] { - return this.configuration.middleware || []; - } - - get queryParamsStringify(): (params: HTTPQuery) => string { - return this.configuration.queryParamsStringify || querystring; - } - - get username(): string | undefined { - return this.configuration.username; - } - - get password(): string | undefined { - return this.configuration.password; - } - - get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; - if (apiKey) { - return typeof apiKey === 'function' ? apiKey : () => apiKey; - } - return undefined; - } - - get accessToken(): ((name?: string, scopes?: string[]) => string | Promise) | undefined { - const accessToken = this.configuration.accessToken; - if (accessToken) { - return typeof accessToken === 'function' ? accessToken : async () => accessToken; - } - return undefined; - } - - get headers(): HTTPHeaders | undefined { - return this.configuration.headers; - } - - get credentials(): RequestCredentials | undefined { - return this.configuration.credentials; - } -} - -export const DefaultConfig = new Configuration(); - -/** - * This is the base class for all generated API classes. - */ -export class BaseAPI { - - private middleware: Middleware[]; - - constructor(protected configuration = DefaultConfig) { - this.middleware = configuration.middleware; - } - - withMiddleware(this: T, ...middlewares: Middleware[]) { - const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); - return next; - } - - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } - - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } - - protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise { - const { url, init } = await this.createFetchParams(context, initOverrides); - const response = await this.fetchApi(url, init); - if (response && (response.status >= 200 && response.status < 300)) { - return response; - } - throw new ResponseError(response, 'Response returned an error code'); - } - - private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) { - let url = this.configuration.basePath + context.path; - if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. - // this is done to avoid urls ending with a "?" character which buggy webservers - // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); - } - - const headers = Object.assign({}, this.configuration.headers, context.headers); - Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); - - const initOverrideFn = - typeof initOverrides === "function" - ? initOverrides - : async () => initOverrides; - - const initParams = { - method: context.method, - headers, - body: context.body, - credentials: this.configuration.credentials, - }; - - const overriddenInit: RequestInit = { - ...initParams, - ...(await initOverrideFn({ - init: initParams, - context, - })) - }; - - const init: RequestInit = { - ...overriddenInit, - body: - isFormData(overriddenInit.body) || - overriddenInit.body instanceof URLSearchParams || - isBlob(overriddenInit.body) - ? overriddenInit.body - : JSON.stringify(overriddenInit.body), - }; - - return { url, init }; - } - - private fetchApi = async (url: string, init: RequestInit) => { - let fetchParams = { url, init }; - for (const middleware of this.middleware) { - if (middleware.pre) { - fetchParams = await middleware.pre({ - fetch: this.fetchApi, - ...fetchParams, - }) || fetchParams; - } - } - let response: Response | undefined = undefined; - try { - response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); - } catch (e) { - for (const middleware of this.middleware) { - if (middleware.onError) { - response = await middleware.onError({ - fetch: this.fetchApi, - url: fetchParams.url, - init: fetchParams.init, - error: e, - response: response ? response.clone() : undefined, - }) || response; - } - } - if (response === undefined) { - if (e instanceof Error) { - throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response'); - } else { - throw e; - } - } - } - for (const middleware of this.middleware) { - if (middleware.post) { - response = await middleware.post({ - fetch: this.fetchApi, - url: fetchParams.url, - init: fetchParams.init, - response: response.clone(), - }) || response; - } - } - return response; - } - - /** - * Create a shallow clone of \`this\` by constructing a new instance - * and then shallow cloning data members. - */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } -}; - -function isBlob(value: any): value is Blob { - return typeof Blob !== 'undefined' && value instanceof Blob; -} - -function isFormData(value: any): value is FormData { - return typeof FormData !== "undefined" && value instanceof FormData; -} - -export class ResponseError extends Error { - override name: "ResponseError" = "ResponseError"; - constructor(public response: Response, msg?: string) { - super(msg); - } -} - -export class FetchError extends Error { - override name: "FetchError" = "FetchError"; - constructor(public cause: Error, msg?: string) { - super(msg); - } -} - -export class RequiredError extends Error { - override name: "RequiredError" = "RequiredError"; - constructor(public field: string, msg?: string) { - super(msg); - } -} - -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\\t", - pipes: "|", -}; - -export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; - -export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; -export type HTTPHeaders = { [key: string]: string }; -export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; -export type HTTPBody = Json | FormData | URLSearchParams; -export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody }; -export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; - -export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise - -export interface FetchParams { - url: string; - init: RequestInit; -} - -export interface RequestOpts { - path: string; - method: HTTPMethod; - headers: HTTPHeaders; - query?: HTTPQuery; - body?: HTTPBody; -} - -export function exists(json: any, key: string) { - const value = json[key]; - return value !== null && value !== undefined; -} - -export function querystring(params: HTTPQuery, prefix: string = ''): string { - return Object.keys(params) - .map(key => querystringSingleKey(key, params[key], prefix)) - .filter(part => part.length > 0) - .join('&'); -} - -function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { - const fullKey = keyPrefix + (keyPrefix.length ? \`[\${key}]\` : key); - if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) - .join(\`&\${encodeURIComponent(fullKey)}=\`); - return \`\${encodeURIComponent(fullKey)}=\${multiValue}\`; - } - if (value instanceof Set) { - const valueAsArray = Array.from(value); - return querystringSingleKey(key, valueAsArray, keyPrefix); - } - if (value instanceof Date) { - return \`\${encodeURIComponent(fullKey)}=\${encodeURIComponent(value.toISOString())}\`; - } - if (value instanceof Object) { - return querystring(value as HTTPQuery, fullKey); - } - return \`\${encodeURIComponent(fullKey)}=\${encodeURIComponent(String(value))}\`; -} - -export function mapValues(data: any, fn: (item: any) => any) { - return Object.keys(data).reduce( - (acc, key) => ({ ...acc, [key]: fn(data[key]) }), - {} - ); -} - -export function canConsumeForm(consumes: Consume[]): boolean { - for (const consume of consumes) { - if ('multipart/form-data' === consume.contentType) { - return true; - } - } - return false; -} - -export interface Consume { - contentType: string; -} - -export interface RequestContext { - fetch: FetchAPI; - url: string; - init: RequestInit; -} - -export interface ResponseContext { - fetch: FetchAPI; - url: string; - init: RequestInit; - response: Response; -} - -export interface ErrorContext { - fetch: FetchAPI; - url: string; - init: RequestInit; - error: unknown; - response?: Response; -} - -export interface Middleware { - pre?(context: RequestContext): Promise; - post?(context: ResponseContext): Promise; - onError?(context: ErrorContext): Promise; -} - -export interface ApiResponse { - raw: Response; - value(): Promise; -} - -export interface ResponseTransformer { - (json: any): T; -} - -export class JSONApiResponse { - constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - - async value(): Promise { - return this.transformer(await this.raw.json()); - } -} - -export class VoidApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return undefined; - } -} - -export class BlobApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return await this.raw.blob(); - }; -} - -export class TextApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return await this.raw.text(); - }; -} ", "src/server/operation-config.ts": "// Import models import { @@ -1216,17 +685,17 @@ export const OperationLookup = { anyRequest: { path: '/any-request', method: 'PUT', - contentTypes: ['application/json',], + contentTypes: ['application/json'], }, bidirectional: { path: '/bidirectional', method: 'POST', - contentTypes: ['application/json',], + contentTypes: ['application/json'], }, clientToServer: { path: '/client-to-server', method: 'POST', - contentTypes: ['application/json',], + contentTypes: ['application/json'], }, empty: { path: '/empty-request', @@ -1236,22 +705,22 @@ export const OperationLookup = { mapRequest: { path: '/map-request', method: 'POST', - contentTypes: ['application/json',], + contentTypes: ['application/json'], }, mediaTypes: { path: '/different-media-type', method: 'POST', - contentTypes: ['application/pdf',], + contentTypes: ['application/pdf'], }, multipleContentTypes: { path: '/multiple-content-types', method: 'POST', - contentTypes: ['application/json','application/pdf',], + contentTypes: ['application/json','application/pdf'], }, withoutOperationIdPost: { path: '/without-operation-id', method: 'POST', - contentTypes: ['application/json',], + contentTypes: ['application/json'], }, }; @@ -1401,7 +870,7 @@ export const anyRequestHandler = ( const demarshal = (bodyString: string): any => { return bodyString; }; - const body = parseBody(event.body, demarshal, ['application/json',]) as AnyRequestRequestBody; + const body = parseBody(event.body, demarshal, ['application/json']) as AnyRequestRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); await chain.next({ @@ -1443,7 +912,7 @@ export const bidirectionalHandler = ( const demarshal = (bodyString: string): any => { return TestRequestFromJSON(JSON.parse(bodyString)?.payload ?? {}); }; - const body = parseBody(event.body, demarshal, ['application/json',]) as BidirectionalRequestBody; + const body = parseBody(event.body, demarshal, ['application/json']) as BidirectionalRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); await chain.next({ @@ -1485,7 +954,7 @@ export const clientToServerHandler = ( const demarshal = (bodyString: string): any => { return TestRequestFromJSON(JSON.parse(bodyString)?.payload ?? {}); }; - const body = parseBody(event.body, demarshal, ['application/json',]) as ClientToServerRequestBody; + const body = parseBody(event.body, demarshal, ['application/json']) as ClientToServerRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); await chain.next({ @@ -1569,7 +1038,7 @@ export const mapRequestHandler = ( const demarshal = (bodyString: string): any => { return MapRequestFromJSON(JSON.parse(bodyString)?.payload ?? {}); }; - const body = parseBody(event.body, demarshal, ['application/json',]) as MapRequestRequestBody; + const body = parseBody(event.body, demarshal, ['application/json']) as MapRequestRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); await chain.next({ @@ -1611,7 +1080,7 @@ export const mediaTypesHandler = ( const demarshal = (bodyString: string): any => { return bodyString; }; - const body = parseBody(event.body, demarshal, ['application/pdf',]) as MediaTypesRequestBody; + const body = parseBody(event.body, demarshal, ['application/pdf']) as MediaTypesRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); await chain.next({ @@ -1653,7 +1122,7 @@ export const multipleContentTypesHandler = ( const demarshal = (bodyString: string): any => { return TestRequestFromJSON(JSON.parse(bodyString)?.payload ?? {}); }; - const body = parseBody(event.body, demarshal, ['application/json','application/pdf',]) as MultipleContentTypesRequestBody; + const body = parseBody(event.body, demarshal, ['application/json','application/pdf']) as MultipleContentTypesRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); await chain.next({ @@ -1695,7 +1164,7 @@ export const withoutOperationIdPostHandler = ( const demarshal = (bodyString: string): any => { return TestRequestFromJSON(JSON.parse(bodyString)?.payload ?? {}); }; - const body = parseBody(event.body, demarshal, ['application/json',]) as WithoutOperationIdPostRequestBody; + const body = parseBody(event.body, demarshal, ['application/json']) as WithoutOperationIdPostRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); await chain.next({ @@ -1777,7 +1246,7 @@ export interface HandlerRouterHandlers { readonly $disconnect?: OperationApiGatewayLambdaHandler<'$disconnect'>; } -export type AnyOperationRequestBodies = never| AnyRequestRequestBody| BidirectionalRequestBody| ClientToServerRequestBody| EmptyRequestBody| MapRequestRequestBody| MediaTypesRequestBody| MultipleContentTypesRequestBody| WithoutOperationIdPostRequestBody; +export type AnyOperationRequestBodies = | AnyRequestRequestBody| BidirectionalRequestBody| ClientToServerRequestBody| EmptyRequestBody| MapRequestRequestBody| MediaTypesRequestBody| MultipleContentTypesRequestBody| WithoutOperationIdPostRequestBody; export interface HandlerRouterProps< RequestBody, diff --git a/packages/type-safe-api/test/scripts/generators/async/typescript-cdk-infrastructure.test.ts b/packages/type-safe-api/test/scripts/generators/async/typescript-cdk-infrastructure.test.ts index d4e28859d..a81ff2731 100644 --- a/packages/type-safe-api/test/scripts/generators/async/typescript-cdk-infrastructure.test.ts +++ b/packages/type-safe-api/test/scripts/generators/async/typescript-cdk-infrastructure.test.ts @@ -4,7 +4,6 @@ import os from "os"; import * as path from "path"; import { exec } from "projen/lib/util"; import { getTestHandlerProjects } from "./utils"; -import { OpenApiToolsJsonFile } from "../../../../src/project/codegen/components/open-api-tools-json-file"; import { GeneratedTypescriptAsyncCdkInfrastructureProject } from "../../../../src/project/codegen/infrastructure/cdk/generated-typescript-async-cdk-infrastructure-project"; import { GeneratedTypescriptAsyncRuntimeProject } from "../../../../src/project/codegen/runtime/generated-typescript-async-runtime-project"; import { withTmpDirSnapshot } from "../../../project/snapshot-utils"; @@ -36,16 +35,11 @@ describe("Typescript Async Infrastructure Code Generation Script Unit Tests", () generatedTypescriptTypes: client, generatedHandlers: {}, }); - // Synth the openapitools.json since it's used by the generate command - OpenApiToolsJsonFile.of(project)!.synthesize(); exec(`mkdir -p ${infraOutdir}`, { cwd: outdir }); - exec(project.tasks.tryFind("create-openapitools.json")!.steps[0].exec!, { - cwd: infraOutdir, - }); exec( `${path.resolve( __dirname, - "../../../../scripts/type-safe-api/generators/generate" + "../../../../scripts/type-safe-api/run.js generate" )} ${project.buildGenerateCommandArgs()}`, { cwd: infraOutdir, @@ -80,17 +74,11 @@ describe("Typescript Async Infrastructure Code Generation Script Unit Tests", () generatedTypescriptTypes: runtimes.typescript, generatedHandlers: handlers, }); - project.synth(); - exec( - project.tasks.tryFind("create-openapitools.json")!.steps[0].exec!, - { - cwd: infraOutdir, - } - ); + exec(`mkdir -p ${infraOutdir}`, { cwd: outdir }); exec( `${path.resolve( __dirname, - "../../../../scripts/type-safe-api/generators/generate" + "../../../../scripts/type-safe-api/run.js generate" )} ${project.buildGenerateCommandArgs()}`, { cwd: infraOutdir, diff --git a/packages/type-safe-api/test/scripts/generators/async/typescript-lambda-handlers.test.ts b/packages/type-safe-api/test/scripts/generators/async/typescript-lambda-handlers.test.ts index 969d6e772..d988acea3 100644 --- a/packages/type-safe-api/test/scripts/generators/async/typescript-lambda-handlers.test.ts +++ b/packages/type-safe-api/test/scripts/generators/async/typescript-lambda-handlers.test.ts @@ -34,13 +34,10 @@ describe("Typescript Async Handlers Code Generation Script Unit Tests", () => { generatedTypescriptTypes: client, }); project.synth(); - exec(project.tasks.tryFind("create-openapitools.json")!.steps[0].exec!, { - cwd: handlersOutdir, - }); exec( `${path.resolve( __dirname, - "../../../../scripts/type-safe-api/generators/generate" + "../../../../scripts/type-safe-api/run.js generate" )} ${project.buildGenerateCommandArgs()}`, { cwd: handlersOutdir, diff --git a/packages/type-safe-api/test/scripts/generators/async/typescript-websocket-client.test.ts b/packages/type-safe-api/test/scripts/generators/async/typescript-websocket-client.test.ts index 290970423..94e4f695e 100644 --- a/packages/type-safe-api/test/scripts/generators/async/typescript-websocket-client.test.ts +++ b/packages/type-safe-api/test/scripts/generators/async/typescript-websocket-client.test.ts @@ -24,27 +24,17 @@ describe("Typescript Async Client Code Generation Script Unit Tests", () => { outdir, specPath: "spec.yaml", }); - // Synth the project so that the generate command honours the .openapi-generator-ignore-handlebars file - project.synth(); - exec( - project.tasks.tryFind("create-openapitools.json")!.steps[0].exec!, - { cwd: outdir } - ); exec( `${path.resolve( __dirname, - "../../../../scripts/type-safe-api/generators/generate" + "../../../../scripts/type-safe-api/run.js generate" )} ${project.buildGenerateCommandArgs()}`, { cwd: outdir, } ); return { - excludeGlobs: [ - ...(project as any).openapiGeneratorIgnore._patterns, - ".projen/*", - "spec.yaml", - ], + excludeGlobs: ["spec.yaml"], }; }) ).toMatchSnapshot(); diff --git a/packages/type-safe-api/test/scripts/generators/async/typescript-websocket-hooks.test.ts b/packages/type-safe-api/test/scripts/generators/async/typescript-websocket-hooks.test.ts index 966790733..732a68fb8 100644 --- a/packages/type-safe-api/test/scripts/generators/async/typescript-websocket-hooks.test.ts +++ b/packages/type-safe-api/test/scripts/generators/async/typescript-websocket-hooks.test.ts @@ -25,27 +25,17 @@ describe("Typescript Async Hooks Code Generation Script Unit Tests", () => { specPath: "spec.yaml", clientPackageName: "ts-ws-client", }); - // Synth the project so that the generate command honours the .openapi-generator-ignore-handlebars file - project.synth(); - exec( - project.tasks.tryFind("create-openapitools.json")!.steps[0].exec!, - { cwd: outdir } - ); exec( `${path.resolve( __dirname, - "../../../../scripts/type-safe-api/generators/generate" + "../../../../scripts/type-safe-api/run.js generate" )} ${project.buildGenerateCommandArgs()}`, { cwd: outdir, } ); return { - excludeGlobs: [ - ...(project as any).openapiGeneratorIgnore._patterns, - ".projen/*", - "spec.yaml", - ], + excludeGlobs: ["spec.yaml"], }; }) ).toMatchSnapshot(); diff --git a/packages/type-safe-api/test/scripts/generators/async/typescript.test.ts b/packages/type-safe-api/test/scripts/generators/async/typescript.test.ts index 40fe74299..5c09c0357 100644 --- a/packages/type-safe-api/test/scripts/generators/async/typescript.test.ts +++ b/packages/type-safe-api/test/scripts/generators/async/typescript.test.ts @@ -3,7 +3,6 @@ SPDX-License-Identifier: Apache-2.0 */ import os from "os"; import * as path from "path"; import { exec } from "projen/lib/util"; -import { OpenApiToolsJsonFile } from "../../../../src/project/codegen/components/open-api-tools-json-file"; import { GeneratedTypescriptAsyncRuntimeProject } from "../../../../src/project/codegen/runtime/generated-typescript-async-runtime-project"; import { withTmpDirSnapshot } from "../../../project/snapshot-utils"; @@ -26,26 +25,17 @@ describe("Typescript Async Runtime Code Generation Script Unit Tests", () => { specPath: "spec.yaml", }); - // Synth the openapitools.json since it's used by the generate command - OpenApiToolsJsonFile.of(project)!.synthesize(); - exec( - project.tasks.tryFind("create-openapitools.json")!.steps[0].exec!, - { cwd: outdir } - ); exec( `${path.resolve( __dirname, - "../../../../scripts/type-safe-api/generators/generate" + "../../../../scripts/type-safe-api/run.js generate" )} ${project.buildGenerateCommandArgs()}`, { cwd: outdir, } ); return { - excludeGlobs: [ - ...(project as any).openapiGeneratorIgnore._patterns, - "spec.yaml", - ], + excludeGlobs: ["spec.yaml"], }; }) ).toMatchSnapshot();