From b9e2dfbb670e2ed08247045fb84528ebd867e442 Mon Sep 17 00:00:00 2001 From: Jack Stevenson Date: Tue, 1 Oct 2024 09:51:29 +1000 Subject: [PATCH] feat(type-safe-api): replace openapi-generator for typescript rest api code generation (#831) This change replaces the java openapi-generator CLI tool with our own code generation tool, which produces equivalent code. This removes the dependency on Java for the TypeScript REST API projects, as well as improving the speed of code generation by avoiding package installation steps and the multiple passes of openapi codegen used to work around limitations of the tool. Note that this change fixes #789, which means that those hitting the edge case described in the issue may experience a breaking change. Generated code packages now covered by the new codegen: - typescript runtime - typescript infrastructure - typescript handlers - typescript hooks --- .projen/deps.json | 4 + .projen/tasks.json | 3 + .../smithy/SmithyAsyncTransformerTest.java | 6 +- package.json | 1 + packages/pdk/.projen/deps.json | 19 + packages/pdk/package.json | 6 + packages/type-safe-api/.gitignore | 1 + packages/type-safe-api/.projen/deps.json | 19 + packages/type-safe-api/.projen/tasks.json | 3 + packages/type-safe-api/package.json | 6 + .../type-safe-api/generators/generate.ts | 597 +++++ .../typescript-cdk-infrastructure/config.yaml | 13 - .../templates/{api.mustache => api.ejs} | 14 +- .../templates/functions.ejs | 63 + .../templates/functions.handlebars | 67 - .../templates/index.ejs | 11 + .../templates/index.mustache | 3 - .../templates/mockIntegrations.ejs | 75 + .../templates/mockIntegrations.mustache | 91 - .../typescript-lambda-handlers/config.yaml | 7 - .../templates/handlers.ejs | 42 + .../templates/handlers.handlebars | 50 - .../templates/tests.ejs | 54 + .../templates/tests.handlebars | 62 - .../{README.md.mustache => README.md.ejs} | 22 +- .../templates/apis.index.ejs | 14 + .../templates/apis.index.mustache | 11 - .../templates/clientProvider.ejs | 54 + .../templates/clientProvider.mustache | 45 - .../templates/hooks.ejs | 115 + .../templates/hooks.handlebars | 99 - .../templates/index.ejs | 12 + .../templates/index.mustache | 5 - .../templates/modelEnumInterfaces.mustache | 11 - .../templates/modelGenericInterfaces.mustache | 32 - .../typescript/templates/client/apis/apis.ejs | 157 ++ .../templates/client/apis/index.ejs | 13 + .../{index.mustache => client/index.ejs} | 10 +- .../templates/client/models/index.ejs | 15 + .../templates/client/models/models.ejs | 152 ++ .../typescript/templates/client/runtime.ejs | 413 ++++ .../templates/modelEnumInterfaces.mustache | 11 - .../templates/modelGenericInterfaces.mustache | 32 - .../interceptors.ejs} | 13 +- .../operationConfig.ejs} | 193 +- .../response.ejs} | 10 +- .../type-safe-api-command-environment.ts | 6 + .../src/project/codegen/components/utils.ts | 18 + ...rated-typescript-async-handlers-project.ts | 69 +- ...erated-typescript-handlers-base-project.ts | 49 +- .../generated-typescript-handlers-project.ts | 18 +- ...script-async-cdk-infrastructure-project.ts | 65 + ...escript-cdk-infrastructure-base-project.ts | 50 +- ...d-typescript-cdk-infrastructure-project.ts | 20 +- .../generated-typescript-library-project.ts | 48 +- .../typescript-react-query-hooks-library.ts | 33 +- .../typescript-websocket-client-library.ts | 60 +- .../typescript-websocket-hooks-library.ts | 59 +- ...erated-typescript-async-runtime-project.ts | 71 +- ...nerated-typescript-runtime-base-project.ts | 59 +- .../generated-typescript-runtime-project.ts | 18 +- .../type-safe-api-project.test.ts.snap | 2200 +++-------------- ...pe-safe-websocket-api-project.test.ts.snap | 419 +++- ...script-async-handlers-project.test.ts.snap | 11 +- ...d-typescript-handlers-project.test.ts.snap | 58 +- ...nc-cdk-infrastructure-project.test.ts.snap | 12 +- ...pt-cdk-infrastructure-project.test.ts.snap | 57 +- ...escript-async-runtime-project.test.ts.snap | 15 +- ...ed-typescript-runtime-project.test.ts.snap | 49 +- .../project/type-safe-api-project.test.ts | 39 +- ...typescript-cdk-infrastructure.test.ts.snap | 28 +- .../typescript-lambda-handlers.test.ts.snap | 8 +- .../typescript-react-query-hooks.test.ts.snap | 1572 +----------- .../__snapshots__/typescript.test.ts.snap | 491 ++-- .../typescript-cdk-infrastructure.test.ts | 21 +- .../typescript-lambda-handlers.test.ts | 5 +- .../typescript-react-query-hooks.test.ts | 14 +- .../scripts/generators/typescript.test.ts | 14 +- pnpm-lock.yaml | 329 ++- projenrc/projects/pdk-monorepo-project.ts | 1 + projenrc/projects/type-safe-api-project.ts | 14 + 81 files changed, 3685 insertions(+), 4971 deletions(-) create mode 100755 packages/type-safe-api/scripts/type-safe-api/generators/generate.ts delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/config.yaml rename packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/{api.mustache => api.ejs} (61%) create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/functions.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/functions.handlebars create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/index.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/index.mustache create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/mockIntegrations.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/mockIntegrations.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/config.yaml create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/handlers.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/handlers.handlebars create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/tests.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/tests.handlebars rename packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/{README.md.mustache => README.md.ejs} (76%) create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/apis.index.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/apis.index.mustache create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/clientProvider.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/clientProvider.mustache create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/hooks.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/hooks.handlebars create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/index.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/index.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/modelEnumInterfaces.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/modelGenericInterfaces.mustache create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/apis/apis.ejs create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/apis/index.ejs rename packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/{index.mustache => client/index.ejs} (53%) create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/models/index.ejs create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/models/models.ejs create mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/runtime.ejs delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/modelEnumInterfaces.mustache delete mode 100644 packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/modelGenericInterfaces.mustache rename packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/{interceptors.mustache => server/interceptors.ejs} (96%) rename packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/{operationConfig.mustache => server/operationConfig.ejs} (64%) rename packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/{response.mustache => server/response.ejs} (82%) diff --git a/.projen/deps.json b/.projen/deps.json index 4f2947986..aaa69cc43 100644 --- a/.projen/deps.json +++ b/.projen/deps.json @@ -127,6 +127,10 @@ "name": "ts-node", "type": "build" }, + { + "name": "tsx", + "type": "build" + }, { "name": "typescript", "type": "build" diff --git a/.projen/tasks.json b/.projen/tasks.json index 41160ca3c..efe60a7c6 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -264,6 +264,9 @@ { "exec": "ln -s $PWD/packages/type-safe-api/scripts/type-safe-api/custom/mock-data/generate-mock-data $(pnpm bin)/type-safe-api.generate-mock-data &>/dev/null; exit 0;" }, + { + "exec": "ln -s $PWD/packages/type-safe-api/scripts/type-safe-api/generators/generate.js $(pnpm bin)/type-safe-api.generate-next &>/dev/null; exit 0;" + }, { "exec": "ln -s $PWD/packages/type-safe-api/scripts/type-safe-api/parser/parse-openapi-spec $(pnpm bin)/type-safe-api.parse-openapi-spec &>/dev/null; exit 0;" } diff --git a/internal/smithy-async-transformer/src/test/java/software/aws/pdk/smithy/SmithyAsyncTransformerTest.java b/internal/smithy-async-transformer/src/test/java/software/aws/pdk/smithy/SmithyAsyncTransformerTest.java index e64af35db..f12019950 100644 --- a/internal/smithy-async-transformer/src/test/java/software/aws/pdk/smithy/SmithyAsyncTransformerTest.java +++ b/internal/smithy-async-transformer/src/test/java/software/aws/pdk/smithy/SmithyAsyncTransformerTest.java @@ -27,7 +27,8 @@ public void testSmithyAsyncTransformerAddsHttpTrait() { .settings(Node.objectNode()) .build()); - OperationShape operation = result.getShape(ShapeId.from("com.aws#SayHello")).orElseThrow().asOperationShape().orElseThrow(); + OperationShape operation = result.getShape(ShapeId.from("com.aws#SayHello")) + .orElseThrow(() -> new RuntimeException()).asOperationShape().orElseThrow(() -> new RuntimeException()); assertTrue(operation.hasTrait(HttpTrait.ID)); assertTrue(operation.hasTrait("com.aws#async")); @@ -45,7 +46,8 @@ public void testSmithyAsyncTransformerAddsRestJson1Trait() { .settings(Node.objectNode()) .build()); - ServiceShape service = result.getShape(ShapeId.from("com.aws#MyService")).orElseThrow().asServiceShape().orElseThrow(); + ServiceShape service = result.getShape(ShapeId.from("com.aws#MyService")) + .orElseThrow(() -> new RuntimeException()).asServiceShape().orElseThrow(() -> new RuntimeException()); assertTrue(service.hasTrait(RestJson1Trait.ID)); assertTrue(service.hasTrait("com.aws#websocketJson")); diff --git a/package.json b/package.json index 94cc09910..a80c24405 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "projen": "^0.82.8", "syncpack": "^13", "ts-node": "10.9.2", + "tsx": "^4.19.1", "typescript": "5.5.2" }, "peerDependencies": { diff --git a/packages/pdk/.projen/deps.json b/packages/pdk/.projen/deps.json index 023dbc294..e017ad234 100644 --- a/packages/pdk/.projen/deps.json +++ b/packages/pdk/.projen/deps.json @@ -38,6 +38,11 @@ "name": "@nx/devkit", "type": "build" }, + { + "name": "@types/ejs", + "version": "3.1.5", + "type": "build" + }, { "name": "@types/fs-extra", "type": "build" @@ -158,6 +163,15 @@ "name": "downlevel-dts", "type": "build" }, + { + "name": "ejs", + "version": "3.1.10", + "type": "build" + }, + { + "name": "esbuild", + "type": "build" + }, { "name": "eslint-config-prettier", "type": "build" @@ -229,6 +243,11 @@ "name": "nx", "type": "build" }, + { + "name": "parse-openapi", + "version": "0.0.1", + "type": "build" + }, { "name": "prettier", "type": "build" diff --git a/packages/pdk/package.json b/packages/pdk/package.json index 577ceff2b..c13003194 100644 --- a/packages/pdk/package.json +++ b/packages/pdk/package.json @@ -16,6 +16,7 @@ "type-safe-api.generate-asyncapi-spec": "./scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec", "type-safe-api.generate-html-redoc-docs": "./scripts/type-safe-api/custom/docs/html-redoc", "type-safe-api.generate-mock-data": "./scripts/type-safe-api/custom/mock-data/generate-mock-data", + "type-safe-api.generate-next": "./scripts/type-safe-api/generators/generate.js", "type-safe-api.parse-openapi-spec": "./scripts/type-safe-api/parser/parse-openapi-spec" }, "scripts": { @@ -51,6 +52,7 @@ "@aws-sdk/client-wafv2": "3.600.0", "@faker-js/faker": "8.1.0", "@nx/devkit": "16", + "@types/ejs": "3.1.5", "@types/fs-extra": "11.0.4", "@types/he": "1.2.3", "@types/jest": "29.5.12", @@ -80,6 +82,8 @@ "cdk-nag": "2.28.150", "constructs": "10.3.0", "downlevel-dts": "0.11.0", + "ejs": "3.1.10", + "esbuild": "^0.23.1", "eslint": "^8", "eslint-config-prettier": "8.10.0", "eslint-import-resolver-typescript": "3.6.1", @@ -97,6 +101,7 @@ "license-checker": "25.0.1", "node-fetch": "^2.6.7", "nx": "16", + "parse-openapi": "0.0.1", "prettier": "2.8.8", "projen": "0.82.8", "reregexp": "1.6.1", @@ -195,6 +200,7 @@ "./scripts/type-safe-api/custom/docs/asyncapi-html", "./scripts/type-safe-api/custom/docs/asyncapi-markdown", "./scripts/type-safe-api/generators/generate", + "./scripts/type-safe-api/generators/generate.js", "./scripts/type-safe-api/parser/parse-openapi-spec", "./scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", "./scripts/type-safe-api/custom/mock-data/generate-mock-data", diff --git a/packages/type-safe-api/.gitignore b/packages/type-safe-api/.gitignore index f5a633edb..969afb89f 100644 --- a/packages/type-safe-api/.gitignore +++ b/packages/type-safe-api/.gitignore @@ -48,6 +48,7 @@ tsconfig.json !/README.md tmp/.* scripts/type-safe-api/custom/smithy-async-transformer/aws-pdk-smithy-async-transformer.jar +scripts/type-safe-api/generators/generate.js !/LICENSE !/src/construct/waf/generated-types.ts !/src/construct/websocket/websocket-api-props.ts diff --git a/packages/type-safe-api/.projen/deps.json b/packages/type-safe-api/.projen/deps.json index 4d0aa38fd..93036eec1 100644 --- a/packages/type-safe-api/.projen/deps.json +++ b/packages/type-safe-api/.projen/deps.json @@ -23,6 +23,11 @@ "version": "8.1.0", "type": "build" }, + { + "name": "@types/ejs", + "version": "3.1.5", + "type": "build" + }, { "name": "@types/fs-extra", "type": "build" @@ -62,6 +67,15 @@ "name": "constructs", "type": "build" }, + { + "name": "ejs", + "version": "3.1.10", + "type": "build" + }, + { + "name": "esbuild", + "type": "build" + }, { "name": "eslint-config-prettier", "type": "build" @@ -116,6 +130,11 @@ "name": "jsii-rosetta", "type": "build" }, + { + "name": "parse-openapi", + "version": "0.0.1", + "type": "build" + }, { "name": "prettier", "type": "build" diff --git a/packages/type-safe-api/.projen/tasks.json b/packages/type-safe-api/.projen/tasks.json index 7588959b8..aa850b41b 100644 --- a/packages/type-safe-api/.projen/tasks.json +++ b/packages/type-safe-api/.projen/tasks.json @@ -156,6 +156,9 @@ }, { "exec": "cp ../../internal/smithy-async-transformer/dist/java/software/aws/pdk/smithy-async-transformer/0.0.1/smithy-async-transformer-0.0.1.jar scripts/type-safe-api/custom/smithy-async-transformer/aws-pdk-smithy-async-transformer.jar" + }, + { + "exec": "esbuild --bundle scripts/type-safe-api/generators/generate.ts --platform=node --outfile=scripts/type-safe-api/generators/generate.js" } ] }, diff --git a/packages/type-safe-api/package.json b/packages/type-safe-api/package.json index e5f4e8df8..1ac818d5a 100644 --- a/packages/type-safe-api/package.json +++ b/packages/type-safe-api/package.json @@ -14,6 +14,7 @@ "type-safe-api.generate-asyncapi-spec": "scripts/type-safe-api/custom/generate-asyncapi-spec/generate-asyncapi-spec", "type-safe-api.generate-html-redoc-docs": "scripts/type-safe-api/custom/docs/html-redoc", "type-safe-api.generate-mock-data": "scripts/type-safe-api/custom/mock-data/generate-mock-data", + "type-safe-api.generate-next": "scripts/type-safe-api/generators/generate.js", "type-safe-api.parse-openapi-spec": "scripts/type-safe-api/parser/parse-openapi-spec" }, "scripts": { @@ -46,6 +47,7 @@ "@aws-sdk/client-s3": "3.600.0", "@aws/monorepo": "^0.x", "@faker-js/faker": "8.1.0", + "@types/ejs": "3.1.5", "@types/fs-extra": "11.0.4", "@types/jest": "29.5.12", "@types/lodash": "4.17.5", @@ -55,6 +57,8 @@ "aws-cdk-lib": "2.147.1", "cdk-nag": "2.28.150", "constructs": "10.3.0", + "ejs": "3.1.10", + "esbuild": "^0.23.1", "eslint": "^8", "eslint-config-prettier": "8.10.0", "eslint-import-resolver-typescript": "3.6.1", @@ -68,6 +72,7 @@ "jsii-docgen": "8.0.56", "jsii-pacmak": "1.101.0", "jsii-rosetta": "1.101.0", + "parse-openapi": "0.0.1", "prettier": "2.8.8", "projen": "0.82.8", "reregexp": "1.6.1", @@ -114,6 +119,7 @@ "scripts/type-safe-api/custom/docs/asyncapi-html", "scripts/type-safe-api/custom/docs/asyncapi-markdown", "scripts/type-safe-api/generators/generate", + "scripts/type-safe-api/generators/generate.js", "scripts/type-safe-api/parser/parse-openapi-spec", "scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", "scripts/type-safe-api/custom/mock-data/generate-mock-data", diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/generate.ts b/packages/type-safe-api/scripts/type-safe-api/generators/generate.ts new file mode 100755 index 000000000..22e77e855 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/generate.ts @@ -0,0 +1,597 @@ +#!/usr/bin/env node +/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 */ +import * as fs from "fs"; +import SwaggerParser from "@apidevtools/swagger-parser"; +import { parse } from "ts-command-line-args"; +import * as ejs from "ejs"; +import * as path from "path"; +import * as _ from "lodash"; +import { OpenAPIV3 } from "openapi-types"; +import * as parseOpenapi from "parse-openapi"; +import { getOperationResponses } from "parse-openapi/dist/parser/getOperationResponses"; + +const TSAPI_WRITE_FILE_START = "###TSAPI_WRITE_FILE###"; +const TSAPI_WRITE_FILE_END = "###/TSAPI_WRITE_FILE###"; + +const MANIFEST_FILE_PATH = ".tsapi-manifest"; +const LEGACY_MANIFEST_FILE_PATH = ".openapi-generator/FILES"; + +interface Arguments { + /** + * Path to the OpenAPI spec + */ + readonly specPath: string; + + /** + * Directories for templates - names relative to the location of this script + */ + readonly templateDirs: string[]; + + /** + * JSON string containing metadata + */ + readonly metadata?: string; + /** + * Location to write the generated code to + */ + readonly outputPath: string; +} + +interface WriteFileConfig { + readonly id?: string; + readonly dir: string; + readonly name: string; + readonly ext: string; + readonly overwrite?: boolean; + readonly kebabCaseFileName?: boolean; + /** + * Generate conditionally based on whether we generated the file with the given id + */ + readonly generateConditionallyId?: string; +} + +interface SplitFile { + readonly contents: string; + readonly pathRelativeToOutputPath: string; + readonly config: WriteFileConfig; + readonly shouldWrite?: boolean; +} + +/** + * Return whether or not the given OpenAPI object is a reference + */ +const isRef = (obj: unknown): obj is OpenAPIV3.ReferenceObject => + !!obj && typeof obj === "object" && "$ref" in obj; + +/** + * Split a reference into its component parts + * eg: #/components/schemas/Foo -> ["components", "schemas", "Foo"] + */ +const splitRef = (ref: string): string[] => + ref + .slice(2) + .split("/") + .map((p) => p.replace(/~0/g, "~").replace(/~1/g, "/")); + +/** + * Resolve the given reference in the spec + */ +const resolveRef = (spec: OpenAPIV3.Document, ref: string): any => { + const refParts = splitRef(ref); + const resolved = _.get(spec, refParts); + if (!resolved) { + throw new Error(`Unable to resolve ref ${ref} in spec`); + } + return resolved; +}; + +/** + * Resolve the given object in an openapi spec if it's a ref + */ +const resolveIfRef = (spec: OpenAPIV3.Document, possibleRef: T | OpenAPIV3.ReferenceObject): T => { + let resolved = possibleRef; + if (isRef(possibleRef)) { + resolved = resolveRef(spec, possibleRef.$ref); + } + return resolved as T; +}; + +/** + * Clean up any generated code that already exists + */ +const cleanGeneratedCode = (outputPath: string) => { + let manifestPath = path.resolve(outputPath, MANIFEST_FILE_PATH); + const legacyManifestPath = path.resolve(outputPath, LEGACY_MANIFEST_FILE_PATH); + + // If upgrading from a previous version of PDK which uses openapi-generator, honour that manifest + // to clean up old generated code + if (!fs.existsSync(manifestPath) && fs.existsSync(legacyManifestPath)) { + manifestPath = legacyManifestPath; + } + + // If the manifest exists, delete the files it lists + if (fs.existsSync(manifestPath)) { + const previouslyGeneratedFiles = new Set( + fs + .readFileSync(manifestPath, { encoding: "utf-8" }) + .split("\n") + .filter((x) => x) + ); + previouslyGeneratedFiles.forEach((previouslyGeneratedFile) => { + const filePath = path.resolve(outputPath, previouslyGeneratedFile); + if (fs.existsSync(filePath)) { + fs.unlinkSync(filePath); + } + }); + } +}; + +const splitAndWriteFiles = (renderedFileContents: string[], outputPath: string) => { + const splitFiles: SplitFile[] = []; + + renderedFileContents.forEach(contents => contents.split(TSAPI_WRITE_FILE_START) + .filter((t) => t.includes(TSAPI_WRITE_FILE_END)) + .forEach((destinationFileTemplate) => { + // Split by the end template to receive the file path, and contents + const [configString, newFileContents] = + destinationFileTemplate.split(TSAPI_WRITE_FILE_END); + const config = JSON.parse(configString) as WriteFileConfig; + + const newFileName = `${config.name}${config.ext}`; + + const newFilePath = path.join( + config.dir, + newFileName + ); + + splitFiles.push({ + contents: newFileContents, + pathRelativeToOutputPath: newFilePath, + shouldWrite: !fs.existsSync(newFilePath) || config.overwrite, + config, + }); + })); + + const splitFilesById: { [id: string]: SplitFile } = Object.fromEntries(splitFiles.filter((s) => s.config.id).map((s) => [s.config.id, s])); + + const generatedFilePaths: string[] = []; + + // Write the split files + splitFiles.forEach(({ pathRelativeToOutputPath, config, contents, shouldWrite }) => { + const newFilePath = path.join(outputPath, pathRelativeToOutputPath); + + const conditionalShouldWrite = splitFilesById[config.generateConditionallyId ?? '']?.shouldWrite ?? true; + + // Write to the instructed file path (relative to the src dir) + if (shouldWrite && conditionalShouldWrite) { + // Create it's containing directory if needed + fs.mkdirSync(path.dirname(newFilePath), { + recursive: true, + }); + fs.writeFileSync(newFilePath, contents); + + // Overwritten files are added to the manifest so that they can be cleaned up + // by clean-openapi-generated-code + if (config.overwrite) { + generatedFilePaths.push(pathRelativeToOutputPath); + } + } + }); + + // Write the manifest file + fs.writeFileSync(path.resolve(outputPath, MANIFEST_FILE_PATH), generatedFilePaths.join('\n')); +}; + +// Model types which indicate it is composed (ie inherits/mixin's another schema) +const COMPOSED_SCHEMA_TYPES = new Set(["one-of", "any-of", "all-of"]); +const PRIMITIVE_TYPES = new Set(["string", "integer", "number", "boolean", "null", "any", "binary", "void"]); + +const resolveComposedProperties = (data: parseOpenapi.ParsedSpecification, model: parseOpenapi.Model): parseOpenapi.Model[] => { + if (COMPOSED_SCHEMA_TYPES.has(model.export)) { + // Find the composed model, if any + const parentModelProperty = model.properties.find(p => !p.name && p.export === "reference"); + const composedModel = data.models.find(m => m.name === parentModelProperty?.type); + + // The actual properties for a composed model are nested under a special property called "properties" + return [ + ...(model.properties.find(p => p.name === "properties")?.properties ?? []), + ...(composedModel ? resolveComposedProperties(data, composedModel).map((p => { + (p as any)._composedFrom = composedModel.name; + return p; + })) : []), + ]; + } + + return model.properties ?? []; +}; + +const toTypescriptPrimitive = (property: parseOpenapi.Model): string => { + if (property.type === "string" && ["date", "date-time"].includes(property.format ?? '')) { + return "Date"; + } else if (property.type === "binary") { + return "Blob"; + } + return property.type; +}; + +/** + * Return the typescript type for the given model + */ +const toTypeScriptType = (property: parseOpenapi.Model): string => { + switch (property.export) { + case "generic": + case "reference": + return toTypescriptPrimitive(property); + case "array": + return `Array<${property.link ? toTypeScriptType(property.link) : property.type}>`; + case "dictionary": + return `{ [key: string]: ${property.link ? toTypeScriptType(property.link) : property.type}; }`; + default: + return property.type; + } +}; + +/** + * Mutates the given model to add language specific types and names + */ +const mutateModelWithAdditionalTypes = (model: parseOpenapi.Model) => { + (model as any).typescriptName = _.camelCase(model.name); + (model as any).typescriptType = toTypeScriptType(model); + (model as any).isPrimitive = PRIMITIVE_TYPES.has(model.type); + + // Trim any surrounding quotes from name + model.name = _.trim(model.name, `"'`); +}; + +const mutateWithOpenapiSchemaProperties = (spec: OpenAPIV3.Document, model: parseOpenapi.Model, schema: OpenAPIV3.SchemaObject, visited: Set = new Set()) => { + (model as any).format = schema.format; + (model as any).oapiType = schema.type; + (model as any).isInteger = schema.type === "integer"; + (model as any).isShort = schema.format === "int32"; + (model as any).isLong = schema.format === "int64"; + (model as any).deprecated = !!schema.deprecated; + + visited.add(model); + + // Also apply to array items recursively + if (model.export === "array" && model.link && 'items' in schema && schema.items && !visited.has(model.link)) { + const subSchema = resolveIfRef(spec, schema.items); + mutateWithOpenapiSchemaProperties(spec, model.link, subSchema, visited); + } +}; + +interface SubSchema { + readonly nameParts: string[]; + readonly schema: OpenAPIV3.SchemaObject; + readonly prop: string; +} + +interface SubSchemaRef { + readonly $ref: string; + readonly name: string; + readonly schema: OpenAPIV3.SchemaObject; +} + +const isInlineObjectOrArraySubSchema = (schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject): schema is OpenAPIV3.SchemaObject => !!schema && !isRef(schema) && ["object", "array"].includes(schema.type as any); + +const hoistInlineObjectSubSchemas = (nameParts: string[], schema: OpenAPIV3.SchemaObject): SubSchemaRef[] => { + // Find all the inline subschemas + const inlineSubSchemas: SubSchema[] = [ + ...(isInlineObjectOrArraySubSchema(schema.not) ? [{ nameParts: [...nameParts, 'Not'], schema: schema.not, prop: 'not' }] : []), + ...(schema.anyOf ? schema.anyOf.filter(isInlineObjectOrArraySubSchema).map((s, i) => ({ nameParts: [...nameParts, `${i}`], schema: s, prop: `anyOf.[${i}]` })) : []), + ...(schema.allOf ? schema.allOf.filter(isInlineObjectOrArraySubSchema).map((s, i) => ({ nameParts: [...nameParts, `${i}`], schema: s, prop: `allOf.[${i}]` })) : []), + ...(schema.oneOf ? schema.oneOf.filter(isInlineObjectOrArraySubSchema).map((s, i) => ({ nameParts: [...nameParts, `${i}`], schema: s, prop: `oneOf.[${i}]` })) : []), + ...('items' in schema && isInlineObjectOrArraySubSchema(schema.items) ? [{ nameParts: [...nameParts, 'Inner'], schema: schema.items, prop: 'items' }] : []), + ...(Object.entries(schema.properties ?? {}).filter(([, s]) => isInlineObjectOrArraySubSchema(s)).map(([name, s]) => ({ nameParts: [...nameParts, name], schema: s as OpenAPIV3.SchemaObject, prop: `properties.${name}` }))), + ...((typeof schema.additionalProperties !== "boolean" && isInlineObjectOrArraySubSchema(schema.additionalProperties)) ? [{ nameParts: [...nameParts, 'Value'], schema: schema.additionalProperties, prop: `additionalProperties` }] : []), + ]; + + // Hoist these recursively first (ie depth first search) so that we don't miss refs + const recursiveRefs = inlineSubSchemas.flatMap((s) => hoistInlineObjectSubSchemas(s.nameParts, s.schema)); + + // Clone the object subschemas to build the refs + const refs = inlineSubSchemas.filter(s => s.schema.type === "object" && ["items", "additionalProperties"].includes(s.prop)).map(s => { + const name = s.nameParts.map(_.upperFirst).join(''); + const $ref = `#/components/schemas/${name}`; + const ref = { + $ref, + name, + schema: structuredClone(s.schema), + }; + + // Replace each subschema with a ref in the spec + _.set(schema, s.prop, { $ref }); + + return ref; + }); + + return [...refs, ...recursiveRefs]; +}; + +const buildData = (inSpec: OpenAPIV3.Document, metadata: any) => { + // Using openapi generator, we passed "KEEP_ONLY_FIRST_TAG_IN_OPERATION" to ensure we don't generate duplicate + // handler wrappers where multiple tags are used. + // In order for the new generator not to be breaking, we apply the same logic here, however this can be removed + // in future since we have control to avoid the duplicate handlers while allowing an operation to be part of + // multiple "services". + const spec = JSON.parse(JSON.stringify(inSpec, (key, value) => { + // Keep only the first tag where we find a tag + if (key === "tags" && value && value.length > 0 && typeof value[0] === "string") { + return [value[0]]; + } + return value; + })) as OpenAPIV3.Document; + + // Ensure spec has schemas set + if (!spec?.components?.schemas) { + spec.components = { + ...spec.components, + }; + spec.components.schemas = { + ...spec.components.schemas, + }; + } + + // "Hoist" inline response schemas + Object.entries(spec.paths ?? {}).forEach(([path, pathOps]) => Object.entries(pathOps ?? {}).forEach(([method, op]) => { + const operation = resolveIfRef(spec, op); + if (operation && typeof operation === "object" && "responses" in operation) { + Object.entries(operation.responses ?? {}).forEach(([code, res]) => { + const response = resolveIfRef(spec, res); + const jsonResponseSchema = response?.content?.['application/json']?.schema; + if (jsonResponseSchema && !isRef(jsonResponseSchema) && ["object", "array"].includes(jsonResponseSchema.type!)) { + const schemaName = `${_.upperFirst(_.camelCase(operation.operationId ?? `${path}-${method}`))}${code}Response`; + spec.components!.schemas![schemaName] = jsonResponseSchema; + response!.content!['application/json'].schema = { + $ref: `#/components/schemas/${schemaName}`, + }; + } + }); + } + })); + + // "Hoist" any nested object definitions in arrays/maps that aren't already refs, as parseOpenapi will treat the + // type as "any" if they're defined inline (and not a ref) + Object.entries(spec.components?.schemas ?? {}).forEach(([name, schema]) => { + if (!isRef(schema)) { + const refs = hoistInlineObjectSubSchemas([name], schema); + refs.forEach(ref => { + spec.components!.schemas![ref.name] = ref.schema; + }); + } + }); + + // Start with the data from https://github.com/webpro/parse-openapi which extracts most of what we need + const data = { ...parseOpenapi.parse(spec), metadata }; + + // Augment operations with additional data + data.services.forEach((service) => { + + // Keep track of the response models we need the service (ie api client) to import + const responseModelImports: string[] = []; + + service.operations.forEach((op) => { + // Extract the operation back from the openapi spec + const specOp = (spec as any)?.paths?.[op.path]?.[op.method.toLowerCase()] as OpenAPIV3.OperationObject | undefined; + + // Add vendor extensions + Object.entries(specOp ?? {}).forEach(([key, value]) => { + if (key.startsWith('x-')) { + (op as any).vendorExtensions = (op as any).vendorExtensions ?? {}; + (op as any).vendorExtensions[key] = value; + } + }); + + if (specOp) { + // parseOpenapi has a method to retrieve the operation responses, but later filters to only + // return information about successful (2XX) responses. We call the method directly to retrieve + // all responses + const responses = getOperationResponses(spec, specOp.responses); + (op as any).responses = responses; + + // Add all response models to the response model imports + responseModelImports.push(...responses.filter(r => r.export === "reference").map(r => r.type)); + + // parseOpenapi does not distinguish between returning an "any" or returning "void" + // We distinguish this by looking back each response in the spec, and checking whether it + // has content + [...responses, ...op.results].forEach((response) => { + const matchingSpecResponse = specOp.responses[`${response.code}`]; + + if (matchingSpecResponse) { + // Resolve the ref if necessary + const specResponse = resolveIfRef(spec, matchingSpecResponse); + + // When there's no content, we set the type to 'void' + if (!specResponse.content) { + response.type = 'void'; + } + } + }); + + // If the operation didn't specify an operationId, we need to generate one in a backwards compatible way + // which matches openapi generator + if (!specOp.operationId) { + (op as any).name = _.camelCase(`${op.path.replace(/{(.*?)}/g, 'by-$1').replace(/[/:]/g, '-')}-${op.method}`); + } + } + + const specParametersByName = Object.fromEntries((specOp?.parameters ?? []).map((p) => { + const param = resolveIfRef(spec, p); + return [param.name, param]; + })); + + // Loop through the parameters + op.parameters.forEach((parameter) => { + const specParameter = specParametersByName[parameter.prop]; + + const specParameterSchema = resolveIfRef(spec, specParameter?.schema); + + if (specParameterSchema) { + mutateWithOpenapiSchemaProperties(spec, parameter, specParameterSchema); + } + + if (parameter.in === "body") { + // Parameter name for the body is it's type in camelCase + parameter.name = parameter.export === "reference" ? _.camelCase(parameter.type) : "body"; + + // The request body is not in the "parameters" section of the openapi spec so we won't have added the schema + // properties above. Find it here. + const specBody = resolveIfRef(spec, specOp?.requestBody); + if (specBody) { + if (parameter.mediaType) { + const bodySchema = resolveIfRef(spec, specBody.content?.[parameter.mediaType]?.schema); + if (bodySchema) { + mutateWithOpenapiSchemaProperties(spec, parameter, bodySchema); + } + } + // Track all the media types that can be accepted in the request body + (parameter as any).mediaTypes = Object.keys(specBody.content); + } + } else if (["query", "header"].includes(parameter.in) && specParameter) { + // Translate style/explode to OpenAPI v2 style collectionFormat + // https://spec.openapis.org/oas/v3.0.3.html#style-values + const style = specParameter.style ?? (parameter.in === "query" ? "form" : "simple"); + const explode = specParameter.explode ?? style === "form"; + + if (parameter.in === "query") { + (parameter as any).collectionFormat = explode ? "multi" : ({ spaceDelimited: "ssv", pipeDelimited: "tsv", simple: "csv", form: "csv" }[style] ?? "multi"); + } else { // parameter.in === "header" + (parameter as any).collectionFormat = explode ? "multi" : "csv"; + } + } + + mutateModelWithAdditionalTypes(parameter); + }); + + // Add language types to response models + [...((op as any).responses ?? []), ...op.results].forEach(mutateModelWithAdditionalTypes); + + // Add variants of operation name + (op as any).operationIdPascalCase = _.upperFirst(op.name); + (op as any).operationIdKebabCase = _.kebabCase(op.name); + (op as any).operationIdSnakeCase = _.snakeCase(op.name); + }); + + // Lexicographical ordering of operations to match openapi generator + service.operations = _.orderBy(service.operations, (op) => op.name); + + // Add the models to import + (service as any).modelImports = _.orderBy(_.uniq([...service.imports, ...responseModelImports])); + + // Add the service class name + (service as any).className = `${service.name}Api`; + }); + + // Augment models with additional data + data.models.forEach((model) => { + const matchingSpecModel = spec?.components?.schemas?.[model.name] + + if (matchingSpecModel) { + const specModel = isRef(matchingSpecModel) ? resolveRef(spec, matchingSpecModel.$ref) as OpenAPIV3.SchemaObject : matchingSpecModel; + + // Add unique imports + (model as any).uniqueImports = _.orderBy(_.uniq(model.imports)); + + // Add deprecated flag if present + (model as any).deprecated = specModel.deprecated || false; + + // Resolve properties inherited from composed schemas + (model as any).resolvedProperties = resolveComposedProperties(data, model); + + // If the model has "additionalProperties" there should be a "dictionary" property + if (specModel.additionalProperties) { + (model as any).additionalPropertiesProperty = model.properties.find(p => !p.name && p.export === "dictionary"); + } + + // Augment properties with additional data + [...model.properties, ...((model as any).resolvedProperties as parseOpenapi.Model[])].forEach((property) => { + const matchingSpecProperty = specModel.properties?.[property.name]; + + if (matchingSpecProperty) { + const specProperty = resolveIfRef(spec, matchingSpecProperty); + mutateWithOpenapiSchemaProperties(spec, property, specProperty); + } + + // Add language-specific names/types + mutateModelWithAdditionalTypes(property); + }); + } + }); + + // Order models lexicographically by name + data.models = _.orderBy(data.models, d => d.name); + + // Order services so default appears first, then otherwise by name + data.services = _.orderBy(data.services, (s => s.name === "Default" ? "" : s.name)); + + // All operations across all services + const allOperations = _.uniqBy(data.services.flatMap(s => s.operations), o => o.name); + + return { + ...data, + allOperations, + info: spec.info, + }; +}; + +const resolveTemplateDir = (templateDir: string) => { + // Prefer built in template, eg "typescript-lambda-handlers" + const builtinTemplateDir = path.resolve(__dirname, templateDir); + if (fs.existsSync(builtinTemplateDir)) { + return builtinTemplateDir; + } + + // Otherwise use as-is, as a directory relative to cwd + if (fs.existsSync(templateDir)) { + return templateDir; + } + + throw new Error(`Template directory ${templateDir} does not exist!`); +}; + +void (async () => { + const args = parse({ + specPath: { type: String }, + metadata: { type: String, optional: true }, + templateDirs: { type: String, multiple: true }, + outputPath: { type: 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 ?? '{}')); + + // Read all .ejs files in each template directory + const templates = args.templateDirs.flatMap(t => fs.readdirSync(resolveTemplateDir(t), { + recursive: true, + withFileTypes: true + }).filter(f => f.isFile() && f.name.endsWith('.ejs')).map(f => path.join(f.parentPath, f.name))); + + // Render the templates with the data from the spec + const renderedFiles = templates.map((template) => { + const templateContents = fs.readFileSync(template, 'utf-8'); + return ejs.render(templateContents, data); + }); + + // Prior to writing the new files, clean up + cleanGeneratedCode(args.outputPath); + + // Write the rendered files + splitAndWriteFiles(renderedFiles, args.outputPath); +})(); diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/config.yaml b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/config.yaml deleted file mode 100644 index 5adf18283..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-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 - mockIntegrations.mustache: - destinationFilename: {{src}}/mock-integrations.ts - templateType: SupportingFiles - functions.handlebars: - destinationFilename: {{src}}/__functions.ts - templateType: SupportingFiles diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/api.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/api.ejs similarity index 61% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/api.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/api.ejs index 5d17881ff..40d9e1ce3 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/api.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/api.ejs @@ -1,6 +1,14 @@ -import { TypeSafeRestApi, TypeSafeRestApiProps, TypeSafeApiIntegration } 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 { TypeSafeRestApi, TypeSafeRestApiProps, TypeSafeApiIntegration } from "@aws/pdk/type-safe-api"; import { Construct } from "constructs"; -import { OperationLookup, OperationConfig } from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-runtime-package-name}}{{/apis.0}}{{/apiInfo}}"; +import { OperationLookup, OperationConfig } from "<%- metadata.runtimePackageName %>"; import * as path from "path"; export type ApiIntegrations = OperationConfig; @@ -18,7 +26,7 @@ export class Api extends TypeSafeRestApi { super(scope, id, { ...props, integrations: props.integrations as any, - specPath: path.resolve(__dirname, "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-relative-spec-path}}{{/apis.0}}{{/apiInfo}}"), + specPath: path.resolve(__dirname, "<%- metadata.relativeSpecPath %>"), operationLookup: OperationLookup as any, }); } diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/functions.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/functions.ejs new file mode 100644 index 000000000..dcf346291 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/functions.ejs @@ -0,0 +1,63 @@ +###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"; + +<%_ 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-cdk-infrastructure/templates/functions.handlebars b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/functions.handlebars deleted file mode 100644 index fae334cca..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/functions.handlebars +++ /dev/null @@ -1,67 +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 ~}} -{{#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-cdk-infrastructure/templates/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/index.ejs new file mode 100644 index 000000000..55d853ffa --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-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 "./mock-integrations"; +export * from "./functions"; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/index.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/index.mustache deleted file mode 100644 index 3fb556d0b..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/index.mustache +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./api"; -export * from "./mock-integrations"; -export * from "./functions"; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/mockIntegrations.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/mockIntegrations.ejs new file mode 100644 index 000000000..60a171999 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/mockIntegrations.ejs @@ -0,0 +1,75 @@ +###TSAPI_WRITE_FILE### +{ + "dir": "<%- metadata.srcDir || 'src' %>", + "name": "mock-integrations", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###import { +<%_ models.forEach((model) => { _%> + <%- model.name %>, + <%- model.name %>ToJSON, +<%_ }); _%> +} from "<%- metadata.runtimePackageName %>"; +import { Integrations, MockIntegration } from "@aws/pdk/type-safe-api"; +import * as fs from "fs"; +import * as path from "path"; + +/** + * Type-safe mock integrations for API operations + */ +export class MockIntegrations { + /** + * Read a mock data file for the given operation + */ + private static readMockDataFile(method: string, urlPath: string, statusCode: number): string { + return fs.readFileSync(path.join(__dirname, "..", "mocks", `${method.toLowerCase()}${urlPath.replace(/\//g, "-")}-${statusCode}.json`), "utf-8"); + } + + <%_ if (metadata.enableMockIntegrations) { _%> + <%_ allOperations.forEach((operation) => { _%> + <%_ operation.responses.forEach((response) => { _%> + /** + * Mock integration to return a <%- response.code %> response from the <%- operation.name %> operation + <%_ if (!response.isPrimitive) { _%> + * Call this with no arguments to use a generated mock response + <%_ } _%> + */ + public static <%- operation.name %><%- response.code %>(<% if (response.type !== 'void') { %>body<% if (response.isPrimitive) { %>: string<% } else { %>?: <%- response.typescriptType %><% } %><% } %>): MockIntegration { + return Integrations.mock({ + statusCode: <%- response.code %>, + <%_ if (response.type !== 'void') { _%> + <%_ if (response.isPrimitive) { _%> + body, + <%_ } else { _%> + body: body === undefined + ? MockIntegrations.readMockDataFile("<%- operation.method %>", "<%- operation.path %>", <%- response.code %>) + : JSON.stringify(<%- response.typescriptType %>ToJSON(body)), + <%_ } _%> + <%_ } _%> + }); + } + + <%_ }); _%> + <%_ }); _%> + + /** + * Mock all operations for which generated JSON data can be returned. + * The first available response is used for each operation. In most cases this is the successful 200 response. + */ + public static mockAll() { + return { + <%_ allOperations.forEach((operation) => { _%> + <%_ const firstResponse = operation.results[0] || operation.responses[0]; _%> + <%_ if (firstResponse && !firstResponse.isPrimitive) { _%> + <%- operation.name %>: { + integration: MockIntegrations.<%- operation.name %><%- firstResponse.code %>(), + }, + <%_ } _%> + <%_ }); _%> + }; + } + <%_ } else { _%> + // No mock integrations have been generated, since mock data generation is disabled. + <%_ } %> +} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/mockIntegrations.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/mockIntegrations.mustache deleted file mode 100644 index 2f787f7f2..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-cdk-infrastructure/templates/mockIntegrations.mustache +++ /dev/null @@ -1,91 +0,0 @@ -import { - {{#apiInfo}} - {{#models}} - {{#model}} - {{classname}}, - {{classname}}ToJSON, - {{/model}} - {{/models}} - {{/apiInfo}} -} from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-runtime-package-name}}{{/apis.0}}{{/apiInfo}}"; -import { Integrations, MockIntegration } from "@aws/pdk/type-safe-api"; -import * as fs from "fs"; -import * as path from "path"; - -/** - * Type-safe mock integrations for API operations - */ -export class MockIntegrations { - /** - * Read a mock data file for the given operation - */ - private static readMockDataFile(method: string, urlPath: string, statusCode: number): string { - return fs.readFileSync(path.join(__dirname, "..", "mocks", `${method.toLowerCase()}${urlPath.replace(/\//g, "-")}-${statusCode}.json`), "utf-8"); - } - - {{#apiInfo}}{{#apis.0}}{{#vendorExtensions.x-enable-mock-integrations}} - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#responses}} - /** - * Mock integration to return a {{code}} response from the {{nickname}} operation - {{#dataType}} - {{^isPrimitiveType}} - * Call this with no arguments to use a generated mock response - {{/isPrimitiveType}} - {{/dataType}} - */ - public static {{nickname}}{{code}}({{#dataType}}body{{#isPrimitiveType}}: string{{/isPrimitiveType}}{{^isPrimitiveType}}?: {{.}}{{/isPrimitiveType}}{{/dataType}}): MockIntegration { - return Integrations.mock({ - statusCode: {{code}}, - {{#dataType}} - {{#isPrimitiveType}} - body, - {{/isPrimitiveType}} - {{^isPrimitiveType}} - body: body === undefined - ? MockIntegrations.readMockDataFile("{{httpMethod}}", "{{path}}", {{code}}) - : JSON.stringify({{dataType}}ToJSON(body)), - {{/isPrimitiveType}} - {{/dataType}} - }); - } - - {{/responses}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} - - /** - * Mock all operations for which generated JSON data can be returned. - * The first available response is used for each operation. In most cases this is the successful 200 response. - */ - public static mockAll() { - return { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#responses.0}} - {{#dataType}} - {{^isPrimitiveType}} - {{nickname}}: { - integration: MockIntegrations.{{nickname}}{{code}}(), - }, - {{/isPrimitiveType}} - {{/dataType}} - {{/responses.0}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} - }; - } - {{/vendorExtensions.x-enable-mock-integrations}}{{/apis.0}}{{/apiInfo}} - {{#apiInfo}}{{#apis.0}}{{^vendorExtensions.x-enable-mock-integrations}} - // No mock integrations have been generated, since mock data generation is disabled. - {{/vendorExtensions.x-enable-mock-integrations}}{{/apis.0}}{{/apiInfo}} -} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/config.yaml b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/config.yaml deleted file mode 100644 index b293d79c1..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-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-lambda-handlers/templates/handlers.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/handlers.ejs new file mode 100644 index 000000000..87a1b1283 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/handlers.ejs @@ -0,0 +1,42 @@ + +<%_ services.forEach((service) => { _%> +<%_ service.operations.forEach((operation) => { _%> +<%_ if (operation.vendorExtensions && operation.vendorExtensions['x-handler'] && operation.vendorExtensions['x-handler'].language === 'typescript') { _%> +###TSAPI_WRITE_FILE### +{ + "id": "<%= operation.name %>", + "dir": "<%= metadata.srcDir || 'src' %>", + "name": "<%= operation.operationIdKebabCase %>", + "ext": ".ts", + "overwrite": false +} +###/TSAPI_WRITE_FILE###import { + <%= operation.name %>Handler, + <%= operation.operationIdPascalCase %>ChainedHandlerFunction, + INTERCEPTORS, + Response, + LoggingInterceptor, +} from "<%= metadata.runtimePackageName %>"; + +/** + * Type-safe handler for the <%= operation.operationIdPascalCase %> operation + */ +export const <%= operation.name %>: <%= operation.operationIdPascalCase %>ChainedHandlerFunction = async (request) => { + LoggingInterceptor.getLogger(request).info("Start <%= operation.operationIdPascalCase %> Operation"); + + // TODO: Implement <%= operation.operationIdPascalCase %> Operation. `input` contains the request input. + const { input } = request; + + return Response.internalFailure({ + message: "Not Implemented!", + }); +}; + +/** + * 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 and outputs + */ +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-lambda-handlers/templates/handlers.handlebars b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/handlers.handlebars deleted file mode 100644 index 2ef379dc3..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/handlers.handlebars +++ /dev/null @@ -1,50 +0,0 @@ -###TSAPI_SPLIT_FILE### -{{#apiInfo ~}} -{{#apis ~}} -{{#operations ~}} -{{#operation ~}} -{{#if vendorExtensions.x-handler}} -{{#startsWith vendorExtensions.x-handler.language 'typescript'}} -###TSAPI_WRITE_FILE### -{ - "id": "{{nickname}}", - "dir": ".", - "name": "{{nickname}}", - "ext": ".ts", - "overwrite": false, - "kebabCaseFileName": true -} -###/TSAPI_WRITE_FILE###import { - {{nickname}}Handler, - {{operationIdCamelCase}}ChainedHandlerFunction, - INTERCEPTORS, - Response, - LoggingInterceptor, -} from "{{#apiInfo}}{{#apis.0}}{{vendorExtensions.x-runtime-package-name}}{{/apis.0}}{{/apiInfo}}"; - -/** - * Type-safe handler for the {{operationIdCamelCase}} operation - */ -export const {{nickname}}: {{operationIdCamelCase}}ChainedHandlerFunction = async (request) => { - LoggingInterceptor.getLogger(request).info("Start {{operationIdCamelCase}} Operation"); - - // TODO: Implement {{operationIdCamelCase}} Operation. `input` contains the request input. - const { input } = request; - - return Response.internalFailure({ - message: "Not Implemented!", - }); -}; - -/** - * Entry point for the AWS Lambda handler for the {{operationIdCamelCase}} operation. - * The {{nickname}}Handler method wraps the type-safe handler and manages marshalling inputs and outputs - */ -export const handler = {{nickname}}Handler(...INTERCEPTORS, {{nickname}}); - -{{~/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-lambda-handlers/templates/tests.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/tests.ejs new file mode 100644 index 000000000..a2d54c9a7 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/tests.ejs @@ -0,0 +1,54 @@ +<%_ services.forEach((service) => { _%> +<%_ service.operations.forEach((operation) => { _%> +<%_ if (operation.vendorExtensions && operation.vendorExtensions['x-handler'] && operation.vendorExtensions['x-handler'].language === 'typescript') { _%> +###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 { + InternalFailureErrorResponseContent, + <%= operation.operationIdPascalCase %>ChainedRequestInput, +} from "<%= metadata.runtimePackageName %>"; +import { + <%= operation.name %> +} from "../<%= metadata.srcDir || 'src' %>/<%= operation.operationIdKebabCase %>"; + +// Common request arguments +const requestArguments = { + chain: undefined as never, + event: {} as any, + context: {} as any, + interceptorContext: { + logger: { + info: jest.fn(), + }, + }, +} satisfies Omit<<%= operation.operationIdPascalCase %>ChainedRequestInput, 'input'>; + +describe('<%= operation.operationIdPascalCase %>', () => { + + it('should return not implemented error', async () => { + // TODO: Update the test as appropriate when you implement your handler + const response = await <%= operation.name %>({ + ...requestArguments, + input: { + // TODO: remove the "as any" below and fill in test values for the requestParameters<%= operation.parametersBody ? ' and body' : '' %> + requestParameters: {} as any, + body: {} as <%= operation.parametersBody ? 'any' : 'never' %>, + }, + }); + + expect(response.statusCode).toBe(500); + expect((response.body as InternalFailureErrorResponseContent).message).toEqual('Not Implemented!'); + }); + +}); + +<%_ } _%> +<%_ }); _%> +<%_ }); _%> \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/tests.handlebars b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/tests.handlebars deleted file mode 100644 index eea5b47bb..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-lambda-handlers/templates/tests.handlebars +++ /dev/null @@ -1,62 +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 { - InternalFailureErrorResponseContent, - {{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, - event: {} as any, - context: {} as any, - interceptorContext: { - logger: { - info: jest.fn(), - }, - }, -} satisfies Omit<{{operationIdCamelCase}}ChainedRequestInput, 'input'>; - -describe('{{operationIdCamelCase}}', () => { - - it('should return not implemented error', async () => { - // TODO: Update the test as appropriate when you implement your handler - const response = await {{nickname}}({ - ...requestArguments, - input: { - // TODO: remove the "as any" below and fill in test values for the requestParameters{{#if bodyParam}} and body{{/if}} - requestParameters: {} as any, - body: {} as {{#if bodyParam}}any{{else}}never{{/if}}, - }, - }); - - expect(response.statusCode).toBe(500); - expect((response.body as InternalFailureErrorResponseContent).message).toEqual('Not Implemented!'); - }); - -}); - -{{~/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-react-query-hooks/templates/README.md.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/README.md.ejs similarity index 76% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/README.md.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/README.md.ejs index a54a0b40e..38cc2da9a 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/README.md.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/README.md.ejs @@ -1,4 +1,12 @@ -# TypeScript React Query Hooks +###TSAPI_WRITE_FILE### +{ + "dir": ".", + "name": "README", + "ext": ".md", + "overwrite": true +} +###/TSAPI_WRITE_FILE#### TypeScript React Query Hooks +<%_ const serviceClassName = services[0] ? services[0].className : 'DefaultApi' _%> This project contains [react-query](https://tanstack.com/query/latest) hooks for interacting with your API. @@ -21,7 +29,7 @@ new CloudscapeReactTsWebsite({ Next, create an instance of the API client (making sure to set the base URL and fetch instance). For example: ```ts -export const use{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}Client = () => useMemo(() => new {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}(new Configuration({ +export const use<%- serviceClassName %>Client = () => useMemo(() => new <%- serviceClassName %>(new Configuration({ basePath: 'https://example123.execute-api.ap-southeast-2.amazonaws.com/prod', fetchApi: window.fetch.bind(window), })), []); @@ -31,9 +39,9 @@ Note that if you are using the [Cloudscape React Website](https://github.com/aws an instance of `fetch` which will sign requests with the logged in user's credentials. For example: ```ts -export const use{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}Client = () => { +export const use<%- serviceClassName %>Client = () => { const client = useSigv4Client(); - return useMemo(() => new {{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}(new Configuration({ + return useMemo(() => new <%- serviceClassName %>(new Configuration({ basePath: 'https://example123.execute-api.ap-southeast-2.amazonaws.com/prod', fetchApi: client, })), [client]); @@ -43,12 +51,12 @@ export const use{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}Clien Next, instantiate the client provider above where you would like to use the hooks in your component hierarchy (such as above your router). For example: ```tsx -const api = use{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}Client(); +const api = use<%- serviceClassName %>Client(); return ( - <{{#apiInfo}}{{#apis.0}}{{classname}}{{/apis.0}}{{/apiInfo}}ClientProvider apiClient={api}> + <<%- serviceClassName %>ClientProvider apiClient={api}> { /* Components within the provider may make use of the hooks */ } - + ClientProvider> ); ``` diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/apis.index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/apis.index.ejs new file mode 100644 index 000000000..862c57706 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/apis.index.ejs @@ -0,0 +1,14 @@ +###TSAPI_WRITE_FILE### +{ + "dir": "<%- metadata.srcDir || 'src' %>/apis", + "name": "index", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +<%_ services.forEach((service) => { _%> +export * from './<%- service.className %>'; +export * from './<%- service.className %>Hooks'; +export * from './<%- service.className %>ClientProvider'; +<%_ }); _%> diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/apis.index.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/apis.index.mustache deleted file mode 100644 index 5d931c4e2..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/apis.index.mustache +++ /dev/null @@ -1,11 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -{{#apiInfo}} -{{#apis}} -{{#operations}} -export * from './{{classFilename}}'; -export * from './{{classFilename}}Hooks'; -export * from './{{classFilename}}ClientProvider'; -{{/operations}} -{{/apis}} -{{/apiInfo}} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/clientProvider.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/clientProvider.ejs new file mode 100644 index 000000000..df7327764 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/clientProvider.ejs @@ -0,0 +1,54 @@ +<%_ services.forEach((service) => { _%> +###TSAPI_WRITE_FILE### +{ + "dir": "<%- metadata.srcDir || 'src' %>/apis", + "name": "<%- service.className %>ClientProvider", + "ext": ".tsx", + "overwrite": true +} +###/TSAPI_WRITE_FILE###import * as React from "react"; +import { + QueryClient, + QueryClientProvider, +} from "@tanstack/react-query"; +import { <%- service.className %> } from "./<%- service.className %>"; +import { <%- service.className %>ClientContext } from "./<%- service.className %>Hooks"; + +const queryClient = new QueryClient(); + +/** + * Default QueryClient context for <%- service.className %> + */ +export const <%- service.className %>DefaultContext = React.createContext( + undefined +); + +/** + * Properties for the <%- service.className %>ClientProvider + */ +export interface <%- service.className %>ClientProviderProps { + readonly apiClient: <%- service.className %>; + readonly client?: QueryClient; + readonly context?: React.Context; + readonly children?: React.ReactNode; +} + +/** + * Provider for the API Client and Query Client used by the hooks. + * This must parent any components which make use of the hooks. + */ +export const <%- service.className %>ClientProvider = ({ + apiClient, + client = queryClient, + context = <%- service.className %>DefaultContext, + children, +}: <%- service.className %>ClientProviderProps): JSX.Element => { + return ( + + <<%- service.className %>ClientContext.Provider value={apiClient}> + {children} + ClientContext.Provider> + + ); +}; +<%_ }); _%> \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/clientProvider.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/clientProvider.mustache deleted file mode 100644 index 75b0deb7e..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/clientProvider.mustache +++ /dev/null @@ -1,45 +0,0 @@ -import * as React from "react"; -import { - QueryClient, - QueryClientProvider, -} from "@tanstack/react-query"; -import { {{ classname }} } from "./{{ classFilename }}"; -import { {{ classname }}ClientContext } from "./{{ classFilename }}Hooks"; - -const queryClient = new QueryClient(); - -/** - * Default QueryClient context for {{classname}} - */ -export const {{classname}}DefaultContext = React.createContext( - undefined -); - -/** - * Properties for the {{ classname }}ClientProvider - */ -export interface {{ classname }}ClientProviderProps { - readonly apiClient: {{ classname }}; - readonly client?: QueryClient; - readonly context?: React.Context; - readonly children?: React.ReactNode; -} - -/** - * Provider for the API Client and Query Client used by the hooks. - * This must parent any components which make use of the hooks. - */ -export const {{ classname }}ClientProvider = ({ - apiClient, - client = queryClient, - context = {{classname}}DefaultContext, - children, -}: {{ classname }}ClientProviderProps): JSX.Element => { - return ( - - <{{ classname }}ClientContext.Provider value={apiClient}> - {children} - - - ); -}; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/hooks.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/hooks.ejs new file mode 100644 index 000000000..e2ca7234d --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/hooks.ejs @@ -0,0 +1,115 @@ +<%_ services.forEach((service) => { _%> +###TSAPI_WRITE_FILE### +{ + "dir": "<%- metadata.srcDir || 'src' %>/apis", + "name": "<%- service.className %>Hooks", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###// Import models +<%_ if (service.modelImports.length > 0) { _%> +import type { +<%_ service.modelImports.forEach((modelImport) => { _%> + <%- modelImport %>, +<%_ }); _%> +} from '../models'; +<%_ } _%> +// Import request parameter interfaces +import { +<%_ service.operations.forEach((operation) => { _%> + <%_ if (operation.parameters.length > 0) { _%> + <%- operation.operationIdPascalCase %>Request, + <%_ } _%> +<%_ }); _%> +} from '..'; + +import { ResponseError } from '../runtime'; +import { <%- service.className %> } from './<%- service.className %>'; +import { <%- service.className %>DefaultContext } from "./<%- service.className %>ClientProvider"; + +import { + useQuery, + UseQueryResult, + UseQueryOptions, + useInfiniteQuery, + UseInfiniteQueryResult, + UseInfiniteQueryOptions, + useMutation, + UseMutationOptions, + UseMutationResult +} from "@tanstack/react-query"; +import { createContext, useContext } from "react"; + +/** + * Context for the API client used by the hooks. + */ +export const <%- service.className %>ClientContext = createContext<<%- service.className %> | undefined>(undefined); + +const NO_API_ERROR = new Error(`<%- service.className %> client missing. Please ensure you have instantiated the <%- service.className %>ClientProvider with a client instance.`); + +<%_ service.operations.forEach((operation) => { _%> +<%_ const result = operation.results[0]; _%> +<%_ const resultType = result ? result.typescriptType : 'void'; _%> +<%_ if (operation.method === 'GET') { _%> +<%_ if (operation.vendorExtensions && operation.vendorExtensions['x-paginated']) { _%> +<%_ const pagination = operation.vendorExtensions['x-paginated']; _%> +<%_ const paginationInputParam = operation.parameters.find(p => p.prop === pagination.inputToken); _%> +/** + * useInfiniteQuery hook for the <%- operation.operationIdPascalCase %> operation + */ +export const use<%- operation.operationIdPascalCase %> = ( + <%_ if (operation.parameters.length > 0) { _%> + params: <%- operation.operationIdPascalCase %>Request, + <%_ } _%> + options?: Omit, TError>, 'queryKey' | 'queryFn' | 'getNextPageParam'> +): UseInfiniteQueryResult<<%- resultType %>, TError> => { + const api = useContext(<%- service.className %>ClientContext); + if (!api) { + throw NO_API_ERROR; + } + return useInfiniteQuery(["<%- operation.name %>"<% if (operation.parameters.length > 0) { %>, params<% } %>], ({ pageParam }) => api.<%- operation.name %>({ <% if (operation.parameters.length > 0) { %>...params, <% } %><%- paginationInputParam.typescriptName %>: pageParam }), { + getNextPageParam: (response) => response.<%- pagination.outputToken %>, + context: <%- service.className %>DefaultContext, + ...options as any, + }); +}; +<%_ } else { _%> +/** + * useQuery hook for the <%- operation.operationIdPascalCase %> operation + */ +export const use<%- operation.operationIdPascalCase %> = ( + <%_ if (operation.parameters.length > 0) { _%> + params: <%- operation.operationIdPascalCase %>Request, + <%_ } _%> + options?: Omit, TError>, 'queryKey' | 'queryFn'> +): UseQueryResult<<%- resultType %>, TError> => { + const api = useContext(<%- service.className %>ClientContext); + if (!api) { + throw NO_API_ERROR; + } + return useQuery(["<%- operation.name %>"<% if (operation.parameters.length > 0) { %>, params<% } %>], () => api.<%- operation.name %>(<% if (operation.parameters.length > 0) { %>params<% } %>), { + context: <%- service.className %>DefaultContext, + ...options, + }); +}; +<%_ } _%> +<%_ } else { _%> +/** + * useMutation hook for the <%- operation.operationIdPascalCase %> operation + */ +export const use<%- operation.operationIdPascalCase %> = ( + options?: Omit, TError, <% if (operation.parameters.length > 0) { %><%- operation.operationIdPascalCase %>Request<% } %><% if (operation.parameters.length === 0 ) { %>void<% } %>>, 'mutationFn'> +): UseMutationResult<<%- resultType %>, TError, <% if (operation.parameters.length > 0) { %><%- operation.operationIdPascalCase %>Request<% } %><% if (operation.parameters.length === 0 ) { %>void<% } %>> => { + const api = useContext(<%- service.className %>ClientContext); + if (!api) { + throw NO_API_ERROR; + } + return useMutation((<% if (operation.parameters.length > 0) { %>params: <%- operation.operationIdPascalCase %>Request<% } %>) => api.<%- operation.name %>(<% if (operation.parameters.length > 0) { %>params<% } %>), { + context: <%- service.className %>DefaultContext, + ...options, + }); +}; +<%_ } _%> + +<%_ }); _%> +<%_ }); _%> \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/hooks.handlebars b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/hooks.handlebars deleted file mode 100644 index 357e06b29..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/hooks.handlebars +++ /dev/null @@ -1,99 +0,0 @@ -// Import models -{{#imports.0 ~}} -import type { - {{#imports ~}} - {{className}}, - {{/imports}} -} from '../models'; -{{/imports.0}} -// Import request parameter interfaces -import { - {{#operations ~}} - {{#operation ~}} - {{#allParams.0 ~}}{{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request,{{/allParams.0}} - {{/operation}} - {{/operations}} -} from '..'; - -import { ResponseError } from '../runtime'; -import { {{classname}} } from './{{ classFilename }}'; -import { {{classname}}DefaultContext } from "./{{ classFilename }}ClientProvider"; - -import { - useQuery, - UseQueryResult, - UseQueryOptions, - useInfiniteQuery, - UseInfiniteQueryResult, - UseInfiniteQueryOptions, - useMutation, - UseMutationOptions, - UseMutationResult -} from "@tanstack/react-query"; -import { createContext, useContext } from "react"; - -/** - * Context for the API client used by the hooks. - */ -export const {{classname}}ClientContext = createContext<{{classname}} | undefined>(undefined); - -const NO_API_ERROR = new Error(`{{classname}} client missing. Please ensure you have instantiated the {{classname}}ClientProvider with a client instance.`); - -{{#operations ~}} -{{#operation ~}} -{{#startsWith httpMethod 'GET' ~}} -{{#if vendorExtensions.x-paginated}} -/** - * useInfiniteQuery hook for the {{operationIdCamelCase}} operation - */ -export const use{{operationIdCamelCase}} = ( -{{#allParams.0}} params: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request,{{/allParams.0}} - options?: Omit, 'queryKey' | 'queryFn' | 'getNextPageParam'> -): UseInfiniteQueryResult<{{#if returnType}}{{returnType}}{{else}}void{{/if}}, TError> => { - const api = useContext({{classname}}ClientContext); - if (!api) { - throw NO_API_ERROR; - } - return useInfiniteQuery(["{{nickname}}"{{#allParams.0}}, params{{/allParams.0}}], ({ pageParam }) => api.{{nickname}}({ {{#allParams.0}}...params, {{/allParams.0}}###TSAPI_FN###{"function": "camelCase", "args": ["{{vendorExtensions.x-paginated.inputToken}}"]}###/TSAPI_FN###: pageParam }), { - getNextPageParam: (response) => response.{{vendorExtensions.x-paginated.outputToken}}, - context: {{classname}}DefaultContext, - ...options as any, - }); -}; -{{~else}} -/** - * useQuery hook for the {{operationIdCamelCase}} operation - */ -export const use{{operationIdCamelCase}} = ( -{{#allParams.0}} params: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request,{{/allParams.0}} - options?: Omit, 'queryKey' | 'queryFn'> -): UseQueryResult<{{#if returnType}}{{returnType}}{{else}}void{{/if}}, TError> => { - const api = useContext({{classname}}ClientContext); - if (!api) { - throw NO_API_ERROR; - } - return useQuery(["{{nickname}}"{{#allParams.0}}, params{{/allParams.0}}], () => api.{{nickname}}({{#allParams.0}}params{{/allParams.0}}), { - context: {{classname}}DefaultContext, - ...options, - }); -}; -{{/if}} -{{~else}} -/** - * useMutation hook for the {{operationIdCamelCase}} operation - */ -export const use{{operationIdCamelCase}} = ( - options?: Omit, 'mutationFn'> -): UseMutationResult<{{#if returnType}}{{returnType}}{{else}}void{{/if}}, TError, {{#allParams.0}}{{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}{{#unless allParams.0}}void{{/unless}}> => { - const api = useContext({{classname}}ClientContext); - if (!api) { - throw NO_API_ERROR; - } - return useMutation(({{#allParams.0}}params: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}) => api.{{nickname}}({{#allParams.0}}params{{/allParams.0}}), { - context: {{classname}}DefaultContext, - ...options, - }); -}; -{{~/startsWith}} -{{/operation}} -{{/operations}} \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/index.ejs new file mode 100644 index 000000000..c4a653a34 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/index.ejs @@ -0,0 +1,12 @@ +###TSAPI_WRITE_FILE### +{ + "dir": "<%- metadata.srcDir || 'src' %>", + "name": "index", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +export * from './runtime'; +export * from './apis'; +export * from './models'; \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/index.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/index.mustache deleted file mode 100644 index edf8aa4bf..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/index.mustache +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './runtime'; -export * from './apis'; -export * from './models'; \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/modelEnumInterfaces.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/modelEnumInterfaces.mustache deleted file mode 100644 index 63ca3906e..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/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-react-query-hooks/templates/modelGenericInterfaces.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/templates/modelGenericInterfaces.mustache deleted file mode 100644 index e628f5ff0..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript-react-query-hooks/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/templates/client/apis/apis.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/apis/apis.ejs new file mode 100644 index 000000000..4bbbda902 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/apis/apis.ejs @@ -0,0 +1,157 @@ +<%_ services.forEach((service) => { _%> +###TSAPI_WRITE_FILE### +{ + "id": "<%- service.name %>Api", + "dir": "<%= metadata.srcDir || 'src' %>/apis", + "name": "<%- service.name %>Api", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +/** + * <%- info.title %> + * <%- info.description %> + * + * The version of the OpenAPI document: <%- info.version %> + * + * + * NOTE: This class is auto generated. + * Do not edit the class manually. + */ + +import * as runtime from '../runtime'; +<%_ if (service.modelImports.length > 0) { _%> +import type { +<%_ service.modelImports.forEach((modelImport) => { _%> + <%- modelImport %>, +<%_ }); _%> +} from '../models'; +import { +<%_ service.modelImports.forEach((modelImport) => { _%> + <%- modelImport %>FromJSON, + <%- modelImport %>ToJSON, +<%_ }); _%> +} from '../models'; +<%_ } _%> + +<%_ service.operations.forEach((operation) => { _%> +<%_ if (operation.parameters.length > 0) { _%> +export interface <%- operation.operationIdPascalCase %>Request { + <%_ operation.parameters.forEach((parameter) => { _%> + <%- parameter.name %><%- parameter.isRequired ? '' : '?' %>: <%- parameter.typescriptType %><%= (parameter.isNullable || parameter.type === "any") ? ' | null' : '' %>; + <%_ }); _%> +} +<%_ } _%> + +<%_ }); _%> +/** + * <%- service.description || '' %> + */ +export class <%- service.name %>Api extends runtime.BaseAPI { +<%_ service.operations.forEach((operation) => { _%> +<%_ const result = operation.results[0] _%> + /** + * <%- operation.description || '' %> + */ + async <%- operation.name %>Raw(<% if (operation.parameters.length > 0) { %>requestParameters: <%- operation.operationIdPascalCase %>Request, <% } %>initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + <%_ operation.parameters.filter(p => p.isRequired).forEach((parameter) => { _%> + if (requestParameters.<%- parameter.typescriptName %> === null || requestParameters.<%- parameter.typescriptName %> === undefined) { + throw new runtime.RequiredError('<%- parameter.typescriptName %>','Required parameter requestParameters.<%- parameter.typescriptName %> was null or undefined when calling <%- operation.name %>.'); + } + + <%_ }); _%> + const queryParameters: any = {}; + + <%_ operation.parameters.filter(p => p.in === "query").forEach((parameter) => { _%> + if (requestParameters.<%- parameter.typescriptName %><% if (parameter.export !== "array") { %> !== undefined<% } %>) { + <%_ if (parameter.export === "array") { _%> + <%_ if (parameter.collectionFormat === "multi") { _%> + queryParameters['<%- parameter.prop %>'] = requestParameters.<%- parameter.typescriptName %>; + <%_ } else { _%> + queryParameters['<%- parameter.prop %>'] = <% if (parameter.uniqueItems) { %>Array.from(<% } %>requestParameters.<%- parameter.typescriptName %><% if (parameter.uniqueItems) { %>)<% } %>.join(runtime.COLLECTION_FORMATS["<%- parameter.collectionFormat %>"]); + <%_ } _%> + <%_ } else { _%> + <%_ if (parameter.isPrimitive && ["date", "date-time"].includes(parameter.format)) { _%> + queryParameters['<%- parameter.prop %>'] = (requestParameters.<%- parameter.typescriptName %> as any).toISOString()<%- parameter.format === "date" ? ".substr(0,10)" : "" %>; + <%_ } else { _%> + queryParameters['<%- parameter.prop %>'] = requestParameters.<%- parameter.typescriptName %>; + <%_ } _%> + <%_ } _%> + } + + <%_ }); _%> + + const headerParameters: runtime.HTTPHeaders = {}; + + <%_ if (operation.parametersBody) { _%> + headerParameters['Content-Type'] = '<%- operation.parametersBody.mediaType || 'application/json' %>'; + <%_ } _%> + + <%_ operation.parameters.filter(p => p.in === "header").forEach((parameter) => { _%> + if (requestParameters.<%- parameter.typescriptName %><% if (parameter.export !== "array") { %> !== undefined && requestParameters.<%- parameter.typescriptName %> !== null<% } %>) { + <%_ if (parameter.export === "array") { _%> + <%_ if (parameter.collectionFormat === "multi") { _%> + headerParameters['<%- parameter.prop %>'] = requestParameters.<%- parameter.typescriptName %>; + <%_ } else { _%> + headerParameters['<%- parameter.prop %>'] = <% if (parameter.uniqueItems) { %>Array.from(<% } %>requestParameters.<%- parameter.typescriptName %><% if (parameter.uniqueItems) { %>)<% } %>.join(runtime.COLLECTION_FORMATS["<%- parameter.collectionFormat %>"]); + <%_ } _%> + <%_ } else { _%> + headerParameters['<%- parameter.prop %>'] = String(requestParameters.<%- parameter.typescriptName %>); + <%_ } _%> + } + <%_ }); _%> + + const response = await this.request({ + path: `<%- operation.path %>`<% operation.parameters.filter(p => p.in === "path").forEach((parameter) => { %>.replace(`{${"<%- parameter.prop %>"}}`, encodeURIComponent(String(requestParameters.<%- parameter.typescriptName %>)))<% }); %>, + method: '<%- operation.method %>', + headers: headerParameters, + query: queryParameters, + <%_ if (operation.parametersBody) { _%> + <%_ if (operation.parametersBody.export === "array") { _%> + body: requestParameters.<%- operation.parametersBody.typescriptName %><% if (!operation.parametersBody.isPrimitive) { %>.map(<%- operation.parametersBody.type %>ToJSON)<% } %>, + <%_ } else if (operation.parametersBody.export === "dictionary") { _%> + body: requestParameters.<%- operation.parametersBody.typescriptName %>, + <%_ } else if (operation.parametersBody.isPrimitive || operation.parametersBody.type === "binary") { _%> + body: requestParameters.<%- operation.parametersBody.typescriptName %> as any, + <%_ } else { _%> + body: <%- operation.parametersBody.type %>ToJSON(requestParameters.<%- operation.parametersBody.typescriptName %>), + <%_ } _%> + <%_ } _%> + }, initOverrides); + + <%_ if(result && result.type !== 'void') { _%> + <%_ if(result.isPrimitive) { _%> + <%_ if (["array", "dictionary"].includes(result.export)) { _%> + return new runtime.JSONApiResponse(response); + <%_ } else { _%> + return new runtime.TextApiResponse(response) as any; + <%_ } _%> + <%_ } else { _%> + <%_ if (result.export === "array") { _%> + return new runtime.JSONApiResponse(response, (jsonValue) => <% if (result.uniqueItems) { %>new Set(<% } %>jsonValue.map(<%- result.type %>FromJSON)<% if (result.uniqueItems) { %>)<% } %>); + <%_ } else if (result.export === "dictionary") { _%> + return new runtime.JSONApiResponse(response, (jsonValue) => runtime.mapValues(jsonValue, <%- result.type %>FromJSON)); + <%_ } else { _%> + return new runtime.JSONApiResponse(response, (jsonValue) => <%- result.type %>FromJSON(jsonValue)); + <%_ } _%> + <%_ } _%> + <%_ } else { _%> + return new runtime.VoidApiResponse(response); + <%_ } _%> + } + + /** + * <%- operation.description || '' %> + */ + async <%- operation.name %>(<% if (operation.parameters.length > 0) { %>requestParameters: <%- operation.operationIdPascalCase %>Request<% if (!operation.parameters.some(p => p.isRequired)) { %> = {}<% } %>, <% } %>initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<<%- result ? result.typescriptType : 'void' %>> { + <% if(result && result.type !== 'void') { %>const response = <% } %>await this.<%- operation.name %>Raw(<% if (operation.parameters.length > 0) { %>requestParameters, <% } %>initOverrides); + <%_ if(result && result.type !== 'void') { _%> + return await response.value(); + <%_ } _%> + } + +<%_ }); _%> +} + +<%_ }); _%> diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/apis/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/apis/index.ejs new file mode 100644 index 000000000..26c88f45c --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/apis/index.ejs @@ -0,0 +1,13 @@ +###TSAPI_WRITE_FILE### +{ + "id": "api-index", + "dir": "<%= metadata.srcDir || 'src' %>/apis", + "name": "index", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +<%_ services.forEach((service) => { _%> +export * from './<%- service.name %>Api'; +<%_ }); _%> diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/index.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/index.ejs similarity index 53% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/index.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/index.ejs index 2d0bf67b6..e9ca8de3a 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/index.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/index.ejs @@ -1,4 +1,12 @@ -/* tslint:disable */ +###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 './apis'; diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/models/index.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/models/index.ejs new file mode 100644 index 000000000..cbc388a17 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/models/index.ejs @@ -0,0 +1,15 @@ +<%_ if (models.length > 0) { _%> +###TSAPI_WRITE_FILE### +{ + "id": "models-index", + "dir": "<%= metadata.srcDir || 'src' %>/models", + "name": "index", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +<%_ models.forEach((model) => { _%> +export * from './<%= model.name %>'; +<%_ }); _%> +<%_ } _%> \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/models/models.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/models/models.ejs new file mode 100644 index 000000000..f70576306 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/models/models.ejs @@ -0,0 +1,152 @@ +<%_ models.forEach((model) => { _%> +###TSAPI_WRITE_FILE### +{ + "id": "<%= model.name %>", + "dir": "<%= metadata.srcDir || 'src' %>/models", + "name": "<%= model.name %>", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +/** + * <%- info.title %> + * <%- info.description %> + * + * The version of the OpenAPI document: <%- info.version %> + * + * + * NOTE: This class is auto generated. + * Do not edit the class manually. + */ +import { exists, mapValues } from '../runtime'; +<%_ model.uniqueImports.forEach((importName) => { _%> +import type { <%= importName %> } from './<%= importName %>'; +import { + <%= importName %>FromJSON, + <%= importName %>FromJSONTyped, + <%= importName %>ToJSON, +} from './<%= importName %>'; +<%_ }); _%> + +<%_ if (model.export === "enum") { _%> +/** + * <%- model.description || '' %> + * @export + * @enum {string} + */ +export type <%= model.name %> = +<%_ model.enum.forEach((enumMember, i) => { _%> + <%- enumMember.value %><% if (i < model.enum.length - 1) { %> | <% } %> +<%_ }); _%> + +<%_ } else { _%> +/** + * <%- model.description || '' %> + * @export + * @interface <%= model.name %> + <%_ if (model.deprecated) { _%> + * @deprecated + <%_ } _%> + */ +export interface <%= model.name %> { +<%_ if (model.additionalProperties) { _%> + [key: string]: <%- model.additionalProperties.typescriptType %>; +<%_ } _%> +<%_ model.resolvedProperties.forEach((property) => { _%> + /** + * <%= property.description || '' %> + * @type {<%- property.typescriptType %>} + * @memberof <%= model.name %> + <%_ if (property.deprecated) { _%> + * @deprecated + <%_ } _%> + */ + <%= property.isReadOnly ? 'readonly ' : '' %><%= property.typescriptName %><%= property.isRequired ? '' : '?' %>: <%- property.typescriptType %><%= (property.isNullable || property.type === "any") ? ' | null' : '' %>; +<%_ }); _%> +} + + +/** + * Check if a given object implements the <%= model.name %> interface. + */ +export function instanceOf<%= model.name %>(value: object): boolean { + let isInstance = true; +<%_ model.resolvedProperties.forEach((property) => { _%> +<%_ if (property.isRequired) { _%> + isInstance = isInstance && "<%= property.name %>" in value; +<%_ } _%> +<%_ }); _%> + + return isInstance; +} +<%_ } _%> + +export function <%= model.name %>FromJSON(json: any): <%= model.name %> { + return <%= model.name %>FromJSONTyped(json, false); +} + +export function <%= model.name %>FromJSONTyped(json: any, ignoreDiscriminator: boolean): <%= model.name %> { +<%_ if (model.resolvedProperties.length > 0) { _%> + if ((json === undefined) || (json === null)) { + return json; + } + return { + +<%_ if (model.additionalProperties) { _%> + ...json, +<%_ } _%> +<%_ model.resolvedProperties.forEach((property) => { _%> + <%_ if (property.isPrimitive) { _%> + '<%= property.typescriptName %>': <% if (!property.isRequired) { %>!exists(json, '<%- property.name %>') ? undefined : <% } %><% if (["date", "date-time"].includes(property.format) && property.isNullable) { %>json['<%- property.name %>'] === null ? null : <% } %><% if (["date", "date-time"].includes(property.format)) { %>(new Date(json['<%= property.name %>']))<% } else { %>json['<%= property.name %>']<% } %>, + <%_ } else if (property.export === 'array') { _%> + '<%= property.typescriptName %>': <% if (!property.isRequired) { %>!exists(json, '<%- property.name %>') ? undefined : <% } %><% if (property.isNullable) { %>json['<%- property.name %>'] === null ? null : <% } %><%= property.uniqueItems ? 'new Set(' : '' %>((json['<%= property.name %>'] as Array).map(<%= property.type %>FromJSON))<%= property.uniqueItems ? ')' : '' %>, + <%_ } else if (property.export === 'dictionary') { _%> + '<%= property.typescriptName %>': <% if (!property.isRequired) { %>!exists(json, '<%- property.name %>') ? undefined : <% } %><% if (property.isNullable) { %>json['<%- property.name %>'] === null ? null : <% } %>(mapValues(json['<%= property.name %>'], <%= property.type %>FromJSON)), + <%_ } else { _%> + '<%= property.typescriptName %>': <% if (!property.isRequired) { %>!exists(json, '<%- property.name %>') ? undefined : <% } %><% if (property.isNullable) { %>json['<%- property.name %>'] === null ? null : <% } %><%= property.type %>FromJSON(json['<%= property.name %>']), + <%_ } _%> +<%_ }); _%> + }; +<%_ } else { _%> + return json; +<%_ } _%> +} + +export function <%= model.name %>ToJSON(value?: <%= model.name %> | null): any { +<%_ if (model.resolvedProperties.length > 0) { _%> + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + +<%_ if (model.additionalProperties) { _%> + ...value, +<%_ } _%> +<%_ model.resolvedProperties.forEach((property) => { _%> +<%_ if (!property.isReadOnly) { _%> + <%_ if (property.isPrimitive && ["date", "date-time"].includes(property.format)) { _%> + '<%= property.name %>': <% if (!property.isRequired) { %>value.<%- property.typescriptName %> === undefined : undefined : <% } %>(<% if (property.isNullable) { %>value.<%- property.typescriptName %> === null ? null : <% } %>value.<%- property.typescriptName %>.toISOString()<% if (property.format === 'date') { %>.substr(0,10)<% } %>), + <%_ } else if (property.isPrimitive) { _%> + '<%= property.name %>': value.<%- property.typescriptName %>, + <%_ } else if (property.export === 'array') { _%> + '<%= property.name %>': <% if (!property.isRequired) { %>value.<%- property.typescriptName %> === undefined : undefined : <% } %>(<% if (property.isNullable) { %>value.<%- property.typescriptName %> === null ? null : <% } %><% if (property.uniqueItems) { %>Array.from(value.<%- property.typescriptName %> as Set)<% } else { %>(value.<%- property.typescriptName %> as Array)<% } %>.map(<%- property.type %>ToJSON)), + <%_ } else if (property.export === 'dictionary') { _%> + '<%= property.name %>': <% if (!property.isRequired) { %>value.<%- property.typescriptName %> === undefined : undefined : <% } %>(<% if (property.isNullable) { %>value.<%- property.typescriptName %> === null ? null : <% } %>mapValues(value.<%- property.typescriptName %>, <%- property.type %>ToJSON)), + <%_ } else if (property.type !== 'any') { _%> + '<%= property.name %>': <%- property.type %>ToJSON(value.<%- property.typescriptName %>), + <%_ } else { _%> + '<%= property.name %>': value.<%- property.typescriptName %>, + <%_ } _%> +<%_ } _%> +<%_ }); _%> + }; +<%_ } else { _%> + return value; +<%_ } _%> +} + +<%_ }); _%> \ No newline at end of file diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/runtime.ejs b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/runtime.ejs new file mode 100644 index 000000000..7e2528b44 --- /dev/null +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/client/runtime.ejs @@ -0,0 +1,413 @@ +###TSAPI_WRITE_FILE### +{ + "id": "runtime", + "dir": "<%= metadata.srcDir || 'src' %>", + "name": "runtime", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###/* tslint:disable */ +/* eslint-disable */ +/** + * <%- info.title %> + * <%- info.description %> + * + * The version of the OpenAPI document: <%- info.version %> + * + * + * NOTE: This class is auto generated. + * Do not edit the class manually. + */ + +export const BASE_PATH = "<%= server || '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(); + }; +} diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/modelEnumInterfaces.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/modelEnumInterfaces.mustache deleted file mode 100644 index 63ca3906e..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/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/templates/modelGenericInterfaces.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/modelGenericInterfaces.mustache deleted file mode 100644 index e628f5ff0..000000000 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/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/templates/interceptors.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/server/interceptors.ejs similarity index 96% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/interceptors.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/server/interceptors.ejs index c7528c6f8..a1da0d89c 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/interceptors.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/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 @@ -58,7 +57,7 @@ export const buildTryCatchInterceptor = /interceptors", "name": "cors", "ext": ".ts", "overwrite": true @@ -106,7 +105,7 @@ export const buildResponseHeaderInterceptor = (additionalHeaders: { [key: string export const corsInterceptor = buildResponseHeaderInterceptor(DEFAULT_CORS_HEADERS); ###TSAPI_WRITE_FILE### { - "dir": "interceptors/powertools", + "dir": "<%= metadata.srcDir || 'src' %>/interceptors/powertools", "name": "logger", "ext": ".ts", "overwrite": true @@ -155,7 +154,7 @@ export class LoggingInterceptor { } ###TSAPI_WRITE_FILE### { - "dir": "interceptors/powertools", + "dir": "<%= metadata.srcDir || 'src' %>/interceptors/powertools", "name": "tracer", "ext": ".ts", "overwrite": true @@ -246,7 +245,7 @@ export class TracingInterceptor { } ###TSAPI_WRITE_FILE### { - "dir": "interceptors/powertools", + "dir": "<%= metadata.srcDir || 'src' %>/interceptors/powertools", "name": "metrics", "ext": ".ts", "overwrite": true @@ -299,7 +298,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/templates/operationConfig.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/server/operationConfig.ejs similarity index 64% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/operationConfig.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/server/operationConfig.ejs index b9e6ff992..e649bd06b 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/operationConfig.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/server/operationConfig.ejs @@ -1,26 +1,26 @@ -// Import models +###TSAPI_WRITE_FILE### +{ + "id": "operation-config", + "dir": "<%= metadata.srcDir || 'src' %>/apis/DefaultApi", + "name": "OperationConfig", + "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 request parameter interfaces import { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#allParams.0}}{{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request,{{/allParams.0}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} +<%_ allOperations.forEach((operation) => { _%> +<%_ if (operation.parameters.length > 0) { _%> + <%- operation.operationIdPascalCase %>Request, +<%_ } _%> +<%_ }); _%> } from '..'; // API Gateway Types @@ -28,32 +28,20 @@ import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from "aws-lambda // Generic type for object keyed by operation names export interface OperationConfig { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{nickname}}: T; - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} +<%_ allOperations.forEach((operation) => { _%> + <%- operation.name %>: T; +<%_ }); _%> } // Look up path and http method for a given operation name export const OperationLookup = { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{nickname}}: { - path: '{{path}}', - method: '{{httpMethod}}', - contentTypes: [{{^consumes}}'application/json'{{/consumes}}{{#consumes}}{{#mediaType}}'{{{.}}}',{{/mediaType}}{{/consumes}}], +<%_ allOperations.forEach((operation) => { _%> + <%- operation.name %>: { + path: '<%- operation.path %>', + method: '<%- operation.method %>', + contentTypes: [<%- operation.parametersBody ? operation.parametersBody.mediaTypes.map(m => `'${m}'`).join(',') : "'application/json'"%>], }, - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} +<%_ }); _%> }; export class Operations { @@ -170,7 +158,7 @@ const extractResponseHeadersFromInterceptors = (interceptors: any[]): { [key: st }), {} as { [key: string]: string }); }; -export type OperationIds ={{#apiInfo}}{{#apis}}{{#operations}}{{#operation}} | '{{nickname}}'{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}; +export type OperationIds =<% allOperations.forEach((operation) => { %> | '<%- operation.name %>'<% }); %>; export type OperationApiGatewayProxyResult = APIGatewayProxyResult & { __operationId?: T }; // Api gateway lambda handler type @@ -246,43 +234,38 @@ const buildHandlerChain = ( }; }; -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#operation}} +<%_ allOperations.forEach((operation) => { _%> /** - * Path, Query and Header parameters for {{operationIdCamelCase}} + * Path, Query and Header parameters for <%- operation.operationIdPascalCase %> */ -export interface {{operationIdCamelCase}}RequestParameters { -{{#allParams}} -{{^isBodyParam}} - readonly {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; -{{/isBodyParam}} -{{/allParams}} +export interface <%- operation.operationIdPascalCase %>RequestParameters { +<%_ operation.parameters.filter(p => p.in !== "body").forEach((parameter) => { _%> + readonly <%- parameter.typescriptName %><% if (!parameter.isRequired) { %>?<% } %>: <%- parameter.typescriptType %>; +<%_ }); _%> } /** - * 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<% } %>; -{{#responses}} -export type {{operationIdCamelCase}}{{code}}OperationResponse = OperationResponse<{{code}}, {{#dataType}}{{#isPrimitiveType}}string{{/isPrimitiveType}}{{^isPrimitiveType}}{{.}}{{/isPrimitiveType}}{{/dataType}}{{^dataType}}undefined{{/dataType}}>; -{{/responses}} -export type {{operationIdCamelCase}}OperationResponses = {{#responses}}| {{operationIdCamelCase}}{{code}}OperationResponse {{/responses}}; +<%_ operation.responses.forEach((response) => { _%> +export type <%- operation.operationIdPascalCase %><%- response.code %>OperationResponse = OperationResponse<<%- response.code %>, <% if (response.typescriptType && response.typescriptType !== 'void') { %><%- response.isPrimitive ? 'string' : response.typescriptType %><% } else { %>undefined<% } %>>; +<%_ }); %> +export type <%- operation.operationIdPascalCase %>OperationResponses = <% operation.responses.forEach((response) => { %>| <%- operation.operationIdPascalCase %><%- response.code %>OperationResponse <% }); %>; // Type that the handler function provided to the wrapper must conform to -export type {{operationIdCamelCase}}HandlerFunction = LambdaHandlerFunction<{{operationIdCamelCase}}RequestParameters, {{operationIdCamelCase}}RequestBody, {{operationIdCamelCase}}OperationResponses>; -export type {{operationIdCamelCase}}ChainedHandlerFunction = ChainedLambdaHandlerFunction<{{operationIdCamelCase}}RequestParameters, {{operationIdCamelCase}}RequestBody, {{operationIdCamelCase}}OperationResponses>; -export type {{operationIdCamelCase}}ChainedRequestInput = ChainedRequestInput<{{operationIdCamelCase}}RequestParameters, {{operationIdCamelCase}}RequestBody, {{operationIdCamelCase}}OperationResponses>; +export type <%- operation.operationIdPascalCase %>HandlerFunction = LambdaHandlerFunction<<%- operation.operationIdPascalCase %>RequestParameters, <%- operation.operationIdPascalCase %>RequestBody, <%- operation.operationIdPascalCase %>OperationResponses>; +export type <%- operation.operationIdPascalCase %>ChainedHandlerFunction = ChainedLambdaHandlerFunction<<%- operation.operationIdPascalCase %>RequestParameters, <%- operation.operationIdPascalCase %>RequestBody, <%- operation.operationIdPascalCase %>OperationResponses>; +export type <%- operation.operationIdPascalCase %>ChainedRequestInput = ChainedRequestInput<<%- operation.operationIdPascalCase %>RequestParameters, <%- operation.operationIdPascalCase %>RequestBody, <%- operation.operationIdPascalCase %>OperationResponses>; /** - * 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: [{{operationIdCamelCase}}ChainedHandlerFunction, ...{{operationIdCamelCase}}ChainedHandlerFunction[]] -): OperationApiGatewayLambdaHandler<'{{nickname}}'> => async (event: any, context: any, _callback?: any, additionalInterceptors: {{operationIdCamelCase}}ChainedHandlerFunction[] = []): Promise => { - const operationId = "{{nickname}}"; +export const <%- operation.name %>Handler = ( + ...handlers: [<%- operation.operationIdPascalCase %>ChainedHandlerFunction, ...<%- operation.operationIdPascalCase %>ChainedHandlerFunction[]] +): OperationApiGatewayLambdaHandler<'<%- operation.name %>'> => async (event: any, context: any, _callback?: any, additionalInterceptors: <%- operation.operationIdPascalCase %>ChainedHandlerFunction[] = []): Promise => { + const operationId = "<%- operation.name %>"; const rawSingleValueParameters = decodeRequestParameters({ ...(event.pathParameters || {}), @@ -297,13 +280,13 @@ export const {{nickname}}Handler = ( const marshal = (statusCode: number, responseBody: any): string => { let marshalledBody = responseBody; switch(statusCode) { - {{#responses}} - case {{code}}: - {{^isPrimitiveType}} - marshalledBody = JSON.stringify({{dataType}}ToJSON(marshalledBody)); - {{/isPrimitiveType}} + <%_ operation.responses.forEach((response) => { _%> + case <%- response.code %>: + <%_ if (!response.isPrimitive) { _%> + marshalledBody = JSON.stringify(<%- response.typescriptType %>ToJSON(marshalledBody)); + <%_ } _%> break; - {{/responses}} + <%_ }); _%> default: break; } @@ -315,16 +298,14 @@ export const {{nickname}}Handler = ( let headers = {}; switch(statusCode) { - {{#responses}} - {{^is2xx}} - case {{code}}: { - if ("{{dataType}}".endsWith("ResponseContent")) { - headers["x-amzn-errortype"] = "{{dataType}}".slice(0, -"ResponseContent".length); + <%_ operation.responses.filter(r => r.code < 200 || r.code >= 300).forEach((response) => { _%> + case <%- response.code %>: { + if ("<%- response.typescriptType %>".endsWith("ResponseContent")) { + headers["x-amzn-errortype"] = "<%- response.typescriptType %>".slice(0, -"ResponseContent".length); } break; } - {{/is2xx}} - {{/responses}} + <%_ }); _%> default: break; } @@ -332,15 +313,16 @@ export const {{nickname}}Handler = ( return headers; }; - let requestParameters: {{operationIdCamelCase}}RequestParameters | undefined = undefined; + let requestParameters: <%- operation.operationIdPascalCase %>RequestParameters | undefined = undefined; try { requestParameters = { - {{#allParams}} - {{^isBodyParam}} - {{paramName}}: coerceParameter("{{baseName}}", "{{{dataType}}}", {{#isArray}}{{#items}}{{isInteger}} || {{isLong}} || {{isShort}}{{/items}}{{/isArray}}{{^isArray}}{{isInteger}} || {{isLong}} || {{isShort}}{{/isArray}}, rawSingleValueParameters, rawMultiValueParameters, {{required}}) as {{{dataType}}}{{^required}} | undefined{{/required}}, - {{/isBodyParam}} - {{/allParams}} + <%_ operation.parameters.filter(p => p.in !== "body").forEach((parameter) => { _%> + <%_ let isInteger = parameter.isInteger || (parameter.export === "array" && parameter.link && parameter.link.isInteger); _%> + <%_ let isShort = parameter.isShort || (parameter.export === "array" && parameter.link && parameter.link.isShort); _%> + <%_ let isLong = parameter.isLong || (parameter.export === "array" && parameter.link && parameter.link.isLong); _%> + <%- parameter.typescriptName %>: coerceParameter("<%- parameter.prop %>", "<%- parameter.typescriptType %>", <%- isInteger %> || <%- isLong %> || <%- isShort %>, rawSingleValueParameters, rawMultiValueParameters, <%- parameter.isRequired %>) as <%- parameter.typescriptType %><% if (!parameter.isRequired) { %> | undefined<% } %>, + <%_ }); %> }; } catch (e: any) { const res = { @@ -359,19 +341,17 @@ export const {{nickname}}Handler = ( } const demarshal = (bodyString: string): any => { - {{#bodyParam}} - {{^isPrimitiveType}} - return {{dataType}}FromJSON(JSON.parse(bodyString)); - {{/isPrimitiveType}} - {{#isPrimitiveType}} + <%_ if (operation.parametersBody) { _%> + <%_ if (!operation.parametersBody.isPrimitive) { _%> + return <%- operation.parametersBody.typescriptType %>FromJSON(JSON.parse(bodyString)); + <%_ } 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); const response = await chain.next({ @@ -393,26 +373,17 @@ export const {{nickname}}Handler = ( body: response.body ? marshal(response.statusCode, response.body) : '', }; }; -{{/operation}} -{{/operations}} -{{/apis}} -{{/apiInfo}} +<%_ }); _%> export interface HandlerRouterHandlers { -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#operation}} - readonly {{nickname}}: OperationApiGatewayLambdaHandler<'{{nickname}}'>; -{{/operation}} -{{/operations}} -{{/apis}} -{{/apiInfo}} +<%_ allOperations.forEach((operation) => { _%> + readonly <%- operation.name %>: OperationApiGatewayLambdaHandler<'<%- operation.name %>'>; +<%_ }); _%> } -export type AnyOperationRequestParameters = {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| {{operationIdCamelCase}}RequestParameters{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}; -export type AnyOperationRequestBodies = {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| {{operationIdCamelCase}}RequestBody{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}; -export type AnyOperationResponses = {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| {{operationIdCamelCase}}OperationResponses{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}; +export type AnyOperationRequestParameters = <% allOperations.forEach((operation) => { %>| <%- operation.operationIdPascalCase %>RequestParameters<% }); %>; +export type AnyOperationRequestBodies = <% allOperations.forEach((operation) => { %>| <%- operation.operationIdPascalCase %>RequestBody<% }); %>; +export type AnyOperationResponses = <% allOperations.forEach((operation) => { %>| <%- operation.operationIdPascalCase %>OperationResponses<% }); %>; export interface HandlerRouterProps< RequestParameters, diff --git a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/response.mustache b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/server/response.ejs similarity index 82% rename from packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/response.mustache rename to packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/server/response.ejs index b9133c25c..184cc9305 100644 --- a/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/response.mustache +++ b/packages/type-safe-api/scripts/type-safe-api/generators/typescript/templates/server/response.ejs @@ -1,4 +1,12 @@ -import { OperationResponse } from '..'; +###TSAPI_WRITE_FILE### +{ + "id": "response", + "dir": "<%= metadata.srcDir || 'src' %>/response", + "name": "response", + "ext": ".ts", + "overwrite": true +} +###/TSAPI_WRITE_FILE###import { OperationResponse } from '..'; /** diff --git a/packages/type-safe-api/src/project/codegen/components/type-safe-api-command-environment.ts b/packages/type-safe-api/src/project/codegen/components/type-safe-api-command-environment.ts index 3ef2e825b..4edf6e3df 100644 --- a/packages/type-safe-api/src/project/codegen/components/type-safe-api-command-environment.ts +++ b/packages/type-safe-api/src/project/codegen/components/type-safe-api-command-environment.ts @@ -2,6 +2,7 @@ SPDX-License-Identifier: Apache-2.0 */ import { ProjectUtils } from "@aws/monorepo"; import { Component, Project } from "projen"; +import { TypeScriptProject } from "projen/lib/typescript"; import { getTypeSafeApiTaskEnvironment } from "./utils"; /** @@ -39,5 +40,10 @@ export class TypeSafeApiCommandEnvironment extends Component { Object.entries(getTypeSafeApiTaskEnvironment()).forEach(([key, value]) => project.tasks.addEnvironment(key, value) ); + + // TypeScript projects need a dev dependency on PDK to ensure npx resolves to the correct pdk + if (ProjectUtils.isNamedInstanceOf(project, TypeScriptProject)) { + project.addDevDeps("@aws/pdk@^0"); + } } } diff --git a/packages/type-safe-api/src/project/codegen/components/utils.ts b/packages/type-safe-api/src/project/codegen/components/utils.ts index 3147cc3b1..ef118791a 100644 --- a/packages/type-safe-api/src/project/codegen/components/utils.ts +++ b/packages/type-safe-api/src/project/codegen/components/utils.ts @@ -40,6 +40,7 @@ export enum OtherGenerators { export enum TypeSafeApiScript { PARSE_OPENAPI_SPEC = "type-safe-api.parse-openapi-spec", GENERATE = "type-safe-api.generate", + GENERATE_NEXT = "type-safe-api.generate-next", GENERATE_MOCK_DATA = "type-safe-api.generate-mock-data", GENERATE_HTML_REDOC_DOCS = "type-safe-api.generate-html-redoc-docs", GENERATE_ASYNCAPI_HTML_DOCS = "type-safe-api.generate-asyncapi-html-docs", @@ -65,6 +66,12 @@ export type GeneratorDirectory = */ export type OpenApiNormalizer = "KEEP_ONLY_FIRST_TAG_IN_OPERATION"; +export interface CodegenOptions { + readonly specPath: string; + readonly templateDirs: string[]; + readonly metadata?: object; +} + /** * Options for generating code or docs using OpenAPI Generator CLI */ @@ -140,6 +147,17 @@ const serializeProperties = (properties: { [key: string]: string }) => .map(([key, value]) => `${key}=${value}`) .join(","); +export const buildCodegenCommandArgs = (options: CodegenOptions): string => { + const metadata = options.metadata + ? ` --metadata '${JSON.stringify(options.metadata)}'` + : ""; + return `--specPath ${ + options.specPath + } --outputPath . --templateDirs ${options.templateDirs + .map((t) => `"${t}"`) + .join(" ")}${metadata}`; +}; + /** * Generate code or docs by invoking the root generate script */ 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 64d936c21..2c4a25805 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,16 +4,83 @@ import { GeneratedTypescriptHandlersBaseProject, GeneratedTypescriptHandlersBaseProjectOptions, } from "./generated-typescript-handlers-base-project"; -import { GenerationOptions, OtherGenerators } from "../components/utils"; +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"; 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], + metadata: { + srcDir: this.srcdir, + tstDir: this.testdir, + runtimePackageName: + this.options.generatedTypescriptTypes.package.packageName, + }, + }; + } + + public buildGenerateCommandArgs = (): string => { + return buildInvokeOpenApiGeneratorCommandArgs( + this.buildOpenApiGeneratorOptions() + ); + }; + public buildOpenApiGeneratorOptions(): GenerationOptions { return { generator: "typescript-fetch", diff --git a/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-handlers-base-project.ts b/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-handlers-base-project.ts index dafda41aa..88ebe7fa1 100644 --- a/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-handlers-base-project.ts +++ b/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-handlers-base-project.ts @@ -1,7 +1,7 @@ /*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import * as path from "path"; -import { DependencyType, IgnoreFile, SampleDir } from "projen"; +import { DependencyType, IgnoreFile, SampleDir, Task } from "projen"; import { NodePackageManager } from "projen/lib/javascript"; import { TypeScriptProject } from "projen/lib/typescript"; import { NodeVersion } from "../../languages"; @@ -9,15 +9,11 @@ import { CodeGenerationSourceOptions, GeneratedTypeScriptHandlersOptions, } from "../../types"; -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 { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment"; import { - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, + buildCodegenCommandArgs, buildTypeSafeApiExecCommand, - GenerationOptions, + CodegenOptions, TypeSafeApiScript, } from "../components/utils"; import { GeneratedTypescriptRuntimeBaseProject } from "../runtime/generated-typescript-runtime-base-project"; @@ -48,6 +44,8 @@ export abstract class GeneratedTypescriptHandlersBaseProject extends TypeScriptP */ public readonly runtimeVersion: NodeVersion; + protected readonly generateTask: Task; + constructor(options: GeneratedTypescriptHandlersBaseProjectOptions) { super({ ...(options as any), @@ -91,39 +89,18 @@ export abstract class GeneratedTypescriptHandlersBaseProject extends TypeScriptP const npmignore = new IgnoreFile(this, ".npmignore"); npmignore.addPatterns("/.projen/", "/src", "/dist"); - // Ignore everything for the regular open api generator pass - const openapiGeneratorIgnore = new OpenApiGeneratorIgnoreFile(this); - 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 - ); - - const generateTask = this.addTask("generate"); - generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); - generateTask.exec( + this.generateTask = this.addTask("generate"); + this.generateTask.exec( buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, + TypeSafeApiScript.GENERATE_NEXT, this.buildGenerateCommandArgs() ) ); - this.preCompileTask.spawn(generateTask); + this.preCompileTask.spawn(this.generateTask); // Ignore the openapi generator metadata - this.gitignore.addPatterns(".openapi-generator"); + this.gitignore.addPatterns(".openapi-generator", ".tsapi-metadata"); // Create a separate lambda bundle for each handler as part of the package task. // Note that every typescript file directly in src is bundled by default, but users may specify their own @@ -177,10 +154,8 @@ export abstract class GeneratedTypescriptHandlersBaseProject extends TypeScriptP } public buildGenerateCommandArgs = () => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); + return buildCodegenCommandArgs(this.buildCodegenOptions()); }; - protected abstract buildOpenApiGeneratorOptions(): GenerationOptions; + protected abstract buildCodegenOptions(): CodegenOptions; } diff --git a/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-handlers-project.ts b/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-handlers-project.ts index 2d4f1fdfc..0f38fddd2 100644 --- a/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-handlers-project.ts +++ b/packages/type-safe-api/src/project/codegen/handlers/generated-typescript-handlers-project.ts @@ -4,7 +4,7 @@ import { GeneratedTypescriptHandlersBaseProject, GeneratedTypescriptHandlersBaseProjectOptions, } from "./generated-typescript-handlers-base-project"; -import { GenerationOptions, OtherGenerators } from "../components/utils"; +import { CodegenOptions, OtherGenerators } from "../components/utils"; export interface GeneratedTypescriptHandlersProjectOptions extends GeneratedTypescriptHandlersBaseProjectOptions {} @@ -14,18 +14,14 @@ export class GeneratedTypescriptHandlersProject extends GeneratedTypescriptHandl super(options); } - public buildOpenApiGeneratorOptions(): GenerationOptions { + public buildCodegenOptions(): CodegenOptions { return { - generator: "typescript-fetch", specPath: this.options.specPath, - generatorDirectory: OtherGenerators.TYPESCRIPT_LAMBDA_HANDLERS, - srcDir: this.srcdir, - tstDir: this.testdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, - }, - extraVendorExtensions: { - "x-runtime-package-name": + templateDirs: [OtherGenerators.TYPESCRIPT_LAMBDA_HANDLERS], + metadata: { + srcDir: this.srcdir, + tstDir: this.testdir, + runtimePackageName: 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 e7d8ed58e..36d69d01a 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,9 +5,17 @@ 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, } from "../../components/utils"; @@ -15,10 +23,67 @@ 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 { diff --git a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-base-project.ts b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-base-project.ts index 2d523e490..c9a351409 100644 --- a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-base-project.ts +++ b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-base-project.ts @@ -11,15 +11,11 @@ import { CodeGenerationSourceOptions, GeneratedWithOpenApiGeneratorOptions, } from "../../../types"; -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 { TypeSafeApiCommandEnvironment } from "../../components/type-safe-api-command-environment"; import { - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, + buildCodegenCommandArgs, buildTypeSafeApiExecCommand, - GenerationOptions, + CodegenOptions, TypeSafeApiScript, } from "../../components/utils"; import { GeneratedHandlersProjects } from "../../generate"; @@ -60,7 +56,6 @@ export abstract class GeneratedTypescriptCdkInfrastructureBaseProject extends Ty protected readonly packagedSpecPath = "assets/api.json"; protected readonly generateTask: Task; - protected readonly openapiGeneratorIgnore: OpenApiGeneratorIgnoreFile; constructor(options: GeneratedTypescriptCdkInfrastructureBaseProjectOptions) { super({ @@ -118,38 +113,11 @@ export abstract class GeneratedTypescriptCdkInfrastructureBaseProject extends Ty const npmignore = new IgnoreFile(this, ".npmignore"); npmignore.addPatterns("/.projen/", "/src", "/dist"); - // 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 - ); - const generateTask = this.addTask("generate"); this.generateTask = generateTask; - generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); generateTask.exec( buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, + TypeSafeApiScript.GENERATE_NEXT, this.buildGenerateCommandArgs() ) ); @@ -167,11 +135,11 @@ export abstract class GeneratedTypescriptCdkInfrastructureBaseProject extends Ty if (!options.commitGeneratedCode) { // Ignore the generated code - this.gitignore.addPatterns(this.srcdir, ".openapi-generator", "mocks"); - } else { - this.gitignore.addPatterns(".openapi-generator"); + this.gitignore.addPatterns(this.srcdir, "mocks"); } + this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest"); + // If we're not in a monorepo, we need to link the generated types such that the local dependency can be resolved if (!options.isWithinMonorepo) { switch (this.package.packageManager) { @@ -197,10 +165,8 @@ export abstract class GeneratedTypescriptCdkInfrastructureBaseProject extends Ty } public buildGenerateCommandArgs = () => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); + return buildCodegenCommandArgs(this.buildCodegenOptions()); }; - protected abstract buildOpenApiGeneratorOptions(): GenerationOptions; + protected abstract buildCodegenOptions(): CodegenOptions; } diff --git a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project.ts b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project.ts index 4ee2f5af2..291d85309 100644 --- a/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project.ts +++ b/packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project.ts @@ -8,7 +8,7 @@ import { import { MockResponseGenerationOptions } from "../../../types"; import { buildInvokeMockDataGeneratorCommand, - GenerationOptions, + CodegenOptions, getHandlersProjectVendorExtensions, OtherGenerators, } from "../../components/utils"; @@ -33,22 +33,18 @@ export class GeneratedTypescriptCdkInfrastructureProject extends GeneratedTypesc } } - public buildOpenApiGeneratorOptions(): GenerationOptions { + protected buildCodegenOptions(): CodegenOptions { return { - generator: "typescript-fetch", specPath: this.options.specPath, - generatorDirectory: OtherGenerators.TYPESCRIPT_CDK_INFRASTRUCTURE, - srcDir: this.srcdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, - }, - extraVendorExtensions: { - "x-runtime-package-name": + templateDirs: [OtherGenerators.TYPESCRIPT_CDK_INFRASTRUCTURE], + 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), // Enable mock integration generation by default - "x-enable-mock-integrations": !this.options.mockDataOptions?.disable, + enableMockIntegrations: !this.options.mockDataOptions?.disable, ...getHandlersProjectVendorExtensions( this, this.options.generatedHandlers diff --git a/packages/type-safe-api/src/project/codegen/library/generated-typescript-library-project.ts b/packages/type-safe-api/src/project/codegen/library/generated-typescript-library-project.ts index 87ae9cb4c..b67ae3f15 100644 --- a/packages/type-safe-api/src/project/codegen/library/generated-typescript-library-project.ts +++ b/packages/type-safe-api/src/project/codegen/library/generated-typescript-library-project.ts @@ -1,6 +1,7 @@ /*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { NodePackageUtils } from "@aws/monorepo"; +import { Task } from "projen"; import { NodePackageManager } from "projen/lib/javascript"; import { TypeScriptProject, @@ -10,14 +11,11 @@ import { CodeGenerationSourceOptions, GeneratedWithOpenApiGeneratorOptions, } from "../../types"; -import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; -import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment"; import { - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, + buildCodegenCommandArgs, buildTypeSafeApiExecCommand, - GenerationOptions, + CodegenOptions, TypeSafeApiScript, } from "../components/utils"; @@ -38,22 +36,12 @@ export interface GeneratedTypescriptLibraryProjectOptions * Typescript generated library project */ export abstract class GeneratedTypescriptLibraryProject extends TypeScriptProject { - /** - * Patterns that are excluded from code generation - */ - public static openApiIgnorePatterns: string[] = [ - "package.json", - "tsconfig.json", - "tsconfig.esm.json", - ".npmignore", - ]; - /** * Options configured for the project */ protected readonly options: GeneratedTypescriptLibraryProjectOptions; - protected readonly openapiGeneratorIgnore: OpenApiGeneratorIgnoreFile; + protected readonly generateTask: Task; constructor(options: GeneratedTypescriptLibraryProjectOptions) { super({ @@ -92,27 +80,15 @@ export abstract class GeneratedTypescriptLibraryProject extends TypeScriptProjec this.npmrc.addConfig("strict-peer-dependencies", "false"); } - // Tell OpenAPI Generator CLI not to generate files that we will generate via this project, or don't need. - this.openapiGeneratorIgnore = new OpenApiGeneratorIgnoreFile(this); - this.openapiGeneratorIgnore.addPatterns( - ...GeneratedTypescriptLibraryProject.openApiIgnorePatterns - ); - - // Add OpenAPI Generator cli configuration - OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig( - options.openApiGeneratorCliConfig - ); - - const generateTask = this.addTask("generate"); - generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); - generateTask.exec( + this.generateTask = this.addTask("generate"); + this.generateTask.exec( buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, + TypeSafeApiScript.GENERATE_NEXT, this.buildGenerateCommandArgs() ) ); - this.preCompileTask.spawn(generateTask); + this.preCompileTask.spawn(this.generateTask); if (!options.commitGeneratedCode) { // Ignore all the generated code @@ -124,6 +100,8 @@ export abstract class GeneratedTypescriptLibraryProject extends TypeScriptProjec ); } + this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest"); + // If we're not in a monorepo, we need to link the generated client such that any local dependency on it can be // resolved if (!options.isWithinMonorepo) { @@ -143,10 +121,8 @@ export abstract class GeneratedTypescriptLibraryProject extends TypeScriptProjec } public buildGenerateCommandArgs = () => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); + return buildCodegenCommandArgs(this.buildCodegenOptions()); }; - protected abstract buildOpenApiGeneratorOptions(): GenerationOptions; + protected abstract buildCodegenOptions(): CodegenOptions; } diff --git a/packages/type-safe-api/src/project/codegen/library/typescript-react-query-hooks-library.ts b/packages/type-safe-api/src/project/codegen/library/typescript-react-query-hooks-library.ts index 3bd816c61..fdd51df2c 100644 --- a/packages/type-safe-api/src/project/codegen/library/typescript-react-query-hooks-library.ts +++ b/packages/type-safe-api/src/project/codegen/library/typescript-react-query-hooks-library.ts @@ -5,9 +5,8 @@ import { GeneratedTypescriptLibraryProject, GeneratedTypescriptLibraryProjectOptions, } from "./generated-typescript-library-project"; -import { Library } from "../../languages"; -import { OpenApiGeneratorHandlebarsIgnoreFile } from "../components/open-api-generator-handlebars-ignore-file"; -import { GenerationOptions } from "../components/utils"; +import { Language, Library } from "../../languages"; +import { CodegenOptions } from "../components/utils"; /** * Configuration for the generated typescript client project @@ -33,30 +32,18 @@ export class TypescriptReactQueryHooksLibrary extends GeneratedTypescriptLibrary this.addDeps("@tanstack/react-query@^4"); // Pin at 4 for now - requires generated code updates to upgrade to 5 this.addDevDeps("react", "@types/react"); this.addPeerDeps("react"); - - // Ignore the hooks, since they're generated with the handlebars templating engine - const hooksPattern = "**/*Hooks.ts"; - this.openapiGeneratorIgnore.addPatterns(hooksPattern); - - // The hooks are generated using the handlebars templating engine, so we include a handlebars ignore file - const handlebarsIgnore = new OpenApiGeneratorHandlebarsIgnoreFile(this); - handlebarsIgnore.addPatterns(`!${hooksPattern}`); } - public buildOpenApiGeneratorOptions(): GenerationOptions { + public buildCodegenOptions(): CodegenOptions { return { - generator: "typescript-fetch", specPath: this.options.specPath, - generatorDirectory: Library.TYPESCRIPT_REACT_QUERY_HOOKS, - additionalProperties: { - npmName: this.package.packageName, - typescriptThreePlus: "true", - useSingleParameter: "true", - supportsES6: "true", - }, - srcDir: this.srcdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, + // Include the typescript client code in the hooks library + templateDirs: [ + `${Language.TYPESCRIPT}/templates/client`, + Library.TYPESCRIPT_REACT_QUERY_HOOKS, + ], + metadata: { + srcDir: this.srcdir, }, }; } 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 91a552eab..0103a8f6f 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,7 +5,16 @@ import { GeneratedTypescriptLibraryProjectOptions, } from "./generated-typescript-library-project"; import { WebSocketLibrary } from "../../languages"; -import { GenerationOptions } from "../components/utils"; +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"; /** * Configuration for the generated typescript websocket client project @@ -17,6 +26,18 @@ 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); @@ -33,13 +54,48 @@ export class TypescriptWebsocketClientLibrary extends GeneratedTypescriptLibrary ); this.addDeps("@types/ws@^8", "@types/uuid@^9"); - this.openapiGeneratorIgnore.addPatterns( + // 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", 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 f34d03748..70d2780c5 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 @@ -7,7 +7,15 @@ import { } from "./generated-typescript-library-project"; import { WebSocketLibrary } from "../../languages"; import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; -import { GenerationOptions } from "../components/utils"; +import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; +import { + buildCleanOpenApiGeneratedCodeCommand, + buildInvokeOpenApiGeneratorCommandArgs, + buildTypeSafeApiExecCommand, + CodegenOptions, + GenerationOptions, + TypeSafeApiScript, +} from "../components/utils"; /** * Configuration for the generated typescript websocket hooks project @@ -21,8 +29,20 @@ 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, @@ -37,7 +57,28 @@ export class TypescriptWebsocketHooksLibrary extends GeneratedTypescriptLibraryP this.addDevDeps("react", "@types/react"); this.addPeerDeps("react"); - this.openapiGeneratorIgnore.addPatterns( + // 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`, @@ -46,6 +87,20 @@ export class TypescriptWebsocketHooksLibrary extends GeneratedTypescriptLibraryP ); } + 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", 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 36e463426..50752ec12 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 @@ -4,7 +4,18 @@ import { GeneratedTypescriptRuntimeBaseProject, GeneratedTypescriptRuntimeBaseProjectOptions, } from "./generated-typescript-runtime-base-project"; -import { GenerationOptions, OtherGenerators } from "../components/utils"; +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"; /** * Configuration for the generated typescript client project @@ -16,18 +27,74 @@ 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"); - this.openapiGeneratorIgnore.addPatterns( + // 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: [ + OtherGenerators.TYPESCRIPT_ASYNC_RUNTIME, + `${Language.TYPESCRIPT}/templates/client/models`, + ], + metadata: { + srcDir: this.srcdir, + }, + }; + } + + public buildGenerateCommandArgs = (): string => { + return buildInvokeOpenApiGeneratorCommandArgs( + this.buildOpenApiGeneratorOptions() + ); + }; + protected buildOpenApiGeneratorOptions(): GenerationOptions { return { generator: "typescript-fetch", diff --git a/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-base-project.ts b/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-base-project.ts index 249f435f0..d076e18e9 100644 --- a/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-base-project.ts +++ b/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-base-project.ts @@ -1,7 +1,7 @@ /*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { NodePackageUtils } from "@aws/monorepo"; -import { IgnoreFile } from "projen"; +import { IgnoreFile, Task } from "projen"; import { NodePackageManager } from "projen/lib/javascript"; import { TypeScriptProject, @@ -11,14 +11,11 @@ import { CodeGenerationSourceOptions, GeneratedWithOpenApiGeneratorOptions, } from "../../types"; -import { OpenApiGeneratorIgnoreFile } from "../components/open-api-generator-ignore-file"; -import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file"; import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment"; import { - buildCleanOpenApiGeneratedCodeCommand, - buildInvokeOpenApiGeneratorCommandArgs, + buildCodegenCommandArgs, buildTypeSafeApiExecCommand, - GenerationOptions, + CodegenOptions, TypeSafeApiScript, } from "../components/utils"; @@ -39,22 +36,12 @@ export interface GeneratedTypescriptRuntimeBaseProjectOptions * Typescript project containing types generated using OpenAPI Generator CLI */ export abstract class GeneratedTypescriptRuntimeBaseProject extends TypeScriptProject { - /** - * Patterns that are excluded from code generation - */ - public static openApiIgnorePatterns: string[] = [ - "package.json", - "tsconfig.json", - "tsconfig.esm.json", - ".npmignore", - ]; - /** * Options configured for the project */ protected readonly options: GeneratedTypescriptRuntimeBaseProjectOptions; - protected readonly openapiGeneratorIgnore: OpenApiGeneratorIgnoreFile; + protected readonly generateTask: Task; constructor(options: GeneratedTypescriptRuntimeBaseProjectOptions) { super({ @@ -104,41 +91,23 @@ export abstract class GeneratedTypescriptRuntimeBaseProject extends TypeScriptPr const npmignore = new IgnoreFile(this, ".npmignore"); npmignore.addPatterns("/.projen/", `/${this.srcdir}`, "/dist"); - // 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( - ...GeneratedTypescriptRuntimeBaseProject.openApiIgnorePatterns - ); - - // Add OpenAPI Generator cli configuration - OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig( - options.openApiGeneratorCliConfig - ); - - const generateTask = this.addTask("generate"); - generateTask.exec(buildCleanOpenApiGeneratedCodeCommand()); - generateTask.exec( + this.generateTask = this.addTask("generate"); + this.generateTask.exec( buildTypeSafeApiExecCommand( - TypeSafeApiScript.GENERATE, + TypeSafeApiScript.GENERATE_NEXT, this.buildGenerateCommandArgs() ) ); - this.preCompileTask.spawn(generateTask); + this.preCompileTask.spawn(this.generateTask); if (!options.commitGeneratedCode) { // Ignore all the generated code - this.gitignore.addPatterns( - this.srcdir, - ".npmignore", - "README.md", - ".openapi-generator" - ); - } else { - this.gitignore.addPatterns(".openapi-generator"); + this.gitignore.addPatterns(this.srcdir, ".npmignore", "README.md"); } + this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest"); + // If we're not in a monorepo, we need to link the generated client such that any local dependency on it can be // resolved if (!options.isWithinMonorepo) { @@ -158,10 +127,8 @@ export abstract class GeneratedTypescriptRuntimeBaseProject extends TypeScriptPr } public buildGenerateCommandArgs = () => { - return buildInvokeOpenApiGeneratorCommandArgs( - this.buildOpenApiGeneratorOptions() - ); + return buildCodegenCommandArgs(this.buildCodegenOptions()); }; - protected abstract buildOpenApiGeneratorOptions(): GenerationOptions; + protected abstract buildCodegenOptions(): CodegenOptions; } diff --git a/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-project.ts b/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-project.ts index 1dccbae2d..00cdbeb45 100644 --- a/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-project.ts +++ b/packages/type-safe-api/src/project/codegen/runtime/generated-typescript-runtime-project.ts @@ -5,7 +5,7 @@ import { GeneratedTypescriptRuntimeBaseProjectOptions, } from "./generated-typescript-runtime-base-project"; import { Language } from "../../languages"; -import { GenerationOptions } from "../components/utils"; +import { CodegenOptions } from "../components/utils"; /** * Configuration for the generated typescript client project @@ -21,20 +21,12 @@ export class GeneratedTypescriptRuntimeProject extends GeneratedTypescriptRuntim super(options); } - protected buildOpenApiGeneratorOptions(): GenerationOptions { + protected buildCodegenOptions(): CodegenOptions { return { - generator: "typescript-fetch", specPath: this.options.specPath, - generatorDirectory: Language.TYPESCRIPT, - additionalProperties: { - npmName: this.package.packageName, - typescriptThreePlus: "true", - useSingleParameter: "true", - supportsES6: "true", - }, - srcDir: this.srcdir, - normalizers: { - KEEP_ONLY_FIRST_TAG_IN_OPERATION: true, + templateDirs: [Language.TYPESCRIPT], + metadata: { + srcDir: this.srcdir, }, }; } diff --git a/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap b/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap index 66b19e7f1..037aa89be 100644 --- a/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap +++ b/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap @@ -5,12 +5,8 @@ exports[`Type Safe Api Project Unit Tests Custom OpenAPI Generator CLI Configura "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "generator-cli": { - "repository": { - "downloadUrl": "https://my.custom.maven.repo/maven2/\${groupId}/\${artifactId}/\${versionName}/\${artifactId}-\${versionName}.jar", - }, - "storageDir": "~/.my-storage-dir", - "useDocker": true, - "version": "6.2.0", + "storageDir": "~/.open-api-generator-cli", + "version": "6.6.0", }, "spaces": 2, } @@ -21,12 +17,8 @@ exports[`Type Safe Api Project Unit Tests Custom OpenAPI Generator CLI Configura "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "generator-cli": { - "repository": { - "downloadUrl": "https://my.custom.maven.repo/maven2/\${groupId}/\${artifactId}/\${versionName}/\${artifactId}-\${versionName}.jar", - }, - "storageDir": "~/.my-storage-dir", - "useDocker": true, - "version": "6.2.0", + "storageDir": "~/.open-api-generator-cli", + "version": "7.1.0", }, "spaces": 2, } @@ -48,22 +40,6 @@ exports[`Type Safe Api Project Unit Tests Custom OpenAPI Generator CLI Configura } `; -exports[`Type Safe Api Project Unit Tests Custom OpenAPI Generator CLI Configuration 4`] = ` -{ - "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", - "generator-cli": { - "repository": { - "downloadUrl": "https://my.custom.maven.repo/maven2/\${groupId}/\${artifactId}/\${versionName}/\${artifactId}-\${versionName}.jar", - }, - "storageDir": "~/.my-storage-dir", - "useDocker": true, - "version": "6.2.0", - }, - "spaces": 2, -} -`; - exports[`Type Safe Api Project Unit Tests OpenApi With java Infra 1`] = ` { ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -2148,8 +2124,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -2197,13 +2171,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -2215,25 +2187,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -2268,8 +2229,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -2315,14 +2274,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", @@ -2337,13 +2288,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 --src-dir src --tst-dir test --additional-properties "npmName=openapi-java-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -2412,7 +2357,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -2646,6 +2591,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -2658,7 +2604,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", @@ -8188,8 +8133,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -8236,13 +8179,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -8251,25 +8192,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -8303,8 +8233,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -8351,14 +8279,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", @@ -8367,13 +8287,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 --src-dir src --tst-dir test --additional-properties "npmName=openapi-java-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -8442,7 +8356,7 @@ tsconfig.esm.json "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -8676,6 +8590,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -8688,7 +8603,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", @@ -8724,13 +8638,6 @@ tsconfig.esm.json "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": { @@ -11575,8 +11482,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -11624,13 +11529,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -11642,25 +11545,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -11695,8 +11587,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -11742,14 +11632,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", @@ -11764,13 +11646,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 --src-dir src --tst-dir test --additional-properties "npmName=openapi-python-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -11839,7 +11715,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -12073,6 +11949,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -12085,7 +11962,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", @@ -17547,8 +17423,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -17595,13 +17469,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -17610,25 +17482,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -17662,8 +17523,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -17710,14 +17569,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", @@ -17726,13 +17577,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 --src-dir src --tst-dir test --additional-properties "npmName=openapi-python-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -17801,7 +17646,7 @@ tsconfig.esm.json "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -18035,6 +17880,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -18047,7 +17893,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", @@ -18083,13 +17928,6 @@ tsconfig.esm.json "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": { @@ -19534,9 +19372,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 @@ -19585,14 +19420,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -19604,36 +19436,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -19690,9 +19499,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", @@ -19739,14 +19545,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", @@ -19761,13 +19559,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"openapi-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -19842,7 +19634,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -20102,7 +19894,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", @@ -20140,13 +19931,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": { @@ -21229,8 +21013,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -21278,13 +21060,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -21296,25 +21076,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -21349,8 +21118,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -21396,14 +21163,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", @@ -21418,13 +21177,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -21493,7 +21246,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -21727,6 +21480,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -21739,7 +21493,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", @@ -24972,9 +24725,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 @@ -25021,14 +24771,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -25037,36 +24784,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -25122,9 +24846,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", @@ -25171,14 +24892,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", @@ -25187,13 +24900,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"openapi-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -25265,7 +24972,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install --check-files", @@ -25525,7 +25232,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", @@ -25562,13 +25268,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": { @@ -27259,8 +26958,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -27307,13 +27004,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -27322,25 +27017,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -27374,8 +27058,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -27422,14 +27104,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", @@ -27438,13 +27112,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -27513,7 +27181,7 @@ tsconfig.esm.json "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -27747,6 +27415,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -27759,7 +27428,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", @@ -27795,13 +27463,6 @@ tsconfig.esm.json "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": { @@ -28770,9 +28431,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 @@ -28821,14 +28479,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -28840,36 +28495,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -28926,9 +28558,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", @@ -28975,14 +28604,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", @@ -28997,13 +28618,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-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-enable-mock-integrations":true,"x-handlers-python-module":"smithy_handlers_python_handlers","x-handlers-java-package":"com.generated.api.smithyhandlersjavahandlers.handlers","x-handlers-typescript-asset-path":"../../../handlers/typescript/dist/lambda","x-handlers-python-asset-path":"../../../handlers/python/dist/lambda","x-handlers-java-asset-path":"../../../handlers/java/dist/java/com/generated/api/smithy-handlers-java-handlers/0.0.0/smithy-handlers-java-handlers-0.0.0.jar","x-handlers-node-lambda-runtime-version":"NODEJS_18_X","x-handlers-python-lambda-runtime-version":"PYTHON_3_11","x-handlers-java-lambda-runtime-version":"JAVA_17"}' --generate-alias-as-model", + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api.generate-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-handlers-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"x-handlers-python-module":"smithy_handlers_python_handlers","x-handlers-java-package":"com.generated.api.smithyhandlersjavahandlers.handlers","x-handlers-typescript-asset-path":"../../../handlers/typescript/dist/lambda","x-handlers-python-asset-path":"../../../handlers/python/dist/lambda","x-handlers-java-asset-path":"../../../handlers/java/dist/java/com/generated/api/smithy-handlers-java-handlers/0.0.0/smithy-handlers-java-handlers-0.0.0.jar","x-handlers-node-lambda-runtime-version":"NODEJS_18_X","x-handlers-python-lambda-runtime-version":"PYTHON_3_11","x-handlers-java-lambda-runtime-version":"JAVA_17"}'", }, { "exec": "mkdir -p assets", @@ -29078,7 +28693,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -29338,7 +28953,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", @@ -29376,13 +28990,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": { @@ -30465,8 +30072,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -30514,13 +30119,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -30532,25 +30135,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -30585,8 +30177,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -30632,14 +30222,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", @@ -30654,13 +30236,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -30729,7 +30305,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -30963,6 +30539,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -30975,7 +30552,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", @@ -32308,9 +31884,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -32363,11 +31936,8 @@ junit.xml /dist/ !/.eslintrc.json !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json .openapi-generator +.tsapi-metadata !/project.json ", "handlers/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -32379,31 +31949,14 @@ 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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/aws-lambda", "type": "build", @@ -32476,9 +32029,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", @@ -32525,14 +32075,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", @@ -32557,13 +32099,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-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-next --specPath ../../model/.api.json --outputPath . --templateDirs "typescript-lambda-handlers" --metadata '{"srcDir":"src","tstDir":"test","runtimePackageName":"smithy-handlers-typescript-runtime"}'", }, ], }, @@ -32662,7 +32198,7 @@ resolution-mode=highest "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/aws-lambda @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser esbuild eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit ts-jest typescript smithy-handlers-typescript-runtime", + "exec": "pnpm update @aws/pdk @types/aws-lambda @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser esbuild eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit ts-jest typescript smithy-handlers-typescript-runtime", }, { "exec": "npx projen", @@ -32893,6 +32429,7 @@ resolution-mode=highest "smithy-handlers-typescript-runtime": "file:../../generated/runtime/typescript", }, "devDependencies": { + "@aws/pdk": "^0", "@types/aws-lambda": "*", "@types/jest": "*", "@types/node": "^18", @@ -32959,7 +32496,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", @@ -32998,13 +32534,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": { @@ -33689,9 +33218,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 @@ -33740,14 +33266,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -33759,36 +33282,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -33845,9 +33345,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", @@ -33894,14 +33391,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", @@ -33916,13 +33405,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-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-react-query-hooks-typescript-runtime","x-relative-spec-path":"../assets/api.json","x-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-typescript-react-query-hooks-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -33997,7 +33480,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -34257,7 +33740,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", @@ -34295,13 +33777,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": { @@ -34446,9 +33921,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 -/.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 @@ -34495,46 +33967,25 @@ jspm_packages/ !/src/ /lib /dist/ -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator -!/.openapi-generator-ignore-handlebars +.tsapi-manifest ", "generated/libraries/typescript-react-query-hooks/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". resolution-mode=highest strict-peer-dependencies=false ", - "generated/libraries/typescript-react-query-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 -**/*Hooks.ts -", - "generated/libraries/typescript-react-query-hooks/.openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!**/*Hooks.ts -", - "generated/libraries/typescript-react-query-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-react-query-hooks/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -34569,9 +34020,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmrc", - ".openapi-generator-ignore", - ".openapi-generator-ignore-handlebars", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -34617,14 +34065,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", @@ -34639,13 +34079,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-react-query-hooks --src-dir src --tst-dir test --additional-properties "npmName=smithy-typescript-react-query-hooks-typescript-react-query-hooks,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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript/templates/client" "typescript-react-query-hooks" --metadata '{"srcDir":"src"}'", }, ], }, @@ -34714,7 +34148,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node @types/react react typescript @tanstack/react-query", + "exec": "pnpm update @aws/pdk @types/node @types/react react typescript @tanstack/react-query", }, { "exec": "npx projen", @@ -34945,6 +34379,7 @@ tsconfig.esm.json "@tanstack/react-query": "^4", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "@types/react": "*", "react": "*", @@ -34962,7 +34397,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", @@ -35061,8 +34495,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 @@ -35110,13 +34542,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -35128,25 +34558,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -35181,8 +34600,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -35228,14 +34645,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", @@ -35250,13 +34659,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 --src-dir src --tst-dir test --additional-properties "npmName=smithy-typescript-react-query-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -35325,7 +34728,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -35559,6 +34962,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -35571,7 +34975,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", @@ -38147,8 +37550,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -38196,13 +37597,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -38214,25 +37613,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -38267,8 +37655,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -38314,14 +37700,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", @@ -38336,13 +37714,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 --src-dir src --tst-dir test --additional-properties "npmName=smithy-java-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -38411,7 +37783,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -38645,6 +38017,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -38657,7 +38030,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", @@ -44281,8 +43653,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -44329,13 +43699,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -44344,25 +43712,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -44396,8 +43753,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -44444,14 +43799,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", @@ -44460,13 +43807,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 --src-dir src --tst-dir test --additional-properties "npmName=smithy-java-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -44535,7 +43876,7 @@ tsconfig.esm.json "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -44769,6 +44110,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -44781,7 +44123,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", @@ -44817,13 +44158,6 @@ tsconfig.esm.json "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": { @@ -46353,9 +45687,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 @@ -46403,14 +45734,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -46418,36 +45746,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -46503,9 +45808,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", @@ -46552,14 +45854,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", @@ -46574,13 +45868,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-npm-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -46655,7 +45943,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "npm install", @@ -46915,7 +46203,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", @@ -46953,13 +46240,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": { @@ -47107,8 +46387,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 @@ -47156,13 +46434,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -47174,25 +46450,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -47227,8 +46492,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -47274,14 +46537,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", @@ -47296,13 +46551,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -47371,7 +46620,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -47605,6 +46854,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -47617,7 +46867,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", @@ -50930,9 +50179,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 @@ -50979,14 +50225,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -50995,36 +50238,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -51080,9 +50300,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", @@ -51129,14 +50346,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", @@ -51145,13 +50354,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-npm-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -51223,7 +50426,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "npm install", @@ -51483,7 +50686,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", @@ -51520,13 +50722,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": { @@ -51673,8 +50868,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 @@ -51721,13 +50914,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -51736,25 +50927,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -51788,8 +50968,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -51836,14 +51014,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", @@ -51852,13 +51022,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -51927,7 +51091,7 @@ tsconfig.esm.json "exec": "npm install", }, { - "exec": "npm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "npm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -52161,6 +51325,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -52173,7 +51338,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", @@ -52209,13 +51373,6 @@ tsconfig.esm.json "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": { @@ -53746,9 +52903,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 @@ -53797,14 +52951,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -53816,36 +52967,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -53902,9 +53030,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", @@ -53951,14 +53076,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", @@ -53973,13 +53090,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-pnpm-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -54054,7 +53165,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -54314,7 +53425,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", @@ -54352,13 +53462,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": { @@ -54506,8 +53609,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 @@ -54555,13 +53656,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -54573,25 +53672,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -54626,8 +53714,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -54673,14 +53759,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", @@ -54695,13 +53773,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -54770,7 +53842,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -55004,6 +54076,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -55016,7 +54089,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", @@ -58346,9 +57418,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 @@ -58396,14 +57465,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -58412,36 +57478,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -58497,9 +57540,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", @@ -58546,14 +57586,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", @@ -58562,13 +57594,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-pnpm-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -58640,7 +57666,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -58900,7 +57926,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", @@ -58937,13 +57962,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": { @@ -59091,8 +58109,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 @@ -59140,13 +58156,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -59155,25 +58169,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -59207,8 +58210,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -59255,14 +58256,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", @@ -59271,13 +58264,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -59346,7 +58333,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -59580,6 +58567,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -59592,7 +58580,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", @@ -59628,13 +58615,6 @@ tsconfig.esm.json "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": { @@ -62579,8 +61559,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -62628,13 +61606,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -62646,25 +61622,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -62699,8 +61664,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -62746,14 +61709,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", @@ -62768,13 +61723,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 --src-dir src --tst-dir test --additional-properties "npmName=smithy-python-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -62843,7 +61792,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -63077,6 +62026,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -63089,7 +62039,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", @@ -68645,8 +67594,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -68693,13 +67640,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -68708,25 +67653,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -68760,8 +67694,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -68808,14 +67740,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", @@ -68824,13 +67748,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 --src-dir src --tst-dir test --additional-properties "npmName=smithy-python-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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -68899,7 +67817,7 @@ tsconfig.esm.json "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -69133,6 +68051,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -69145,7 +68064,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", @@ -69181,13 +68099,6 @@ tsconfig.esm.json "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": { @@ -70726,9 +69637,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 @@ -70777,14 +69685,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -70796,36 +69701,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -70882,9 +69764,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", @@ -70931,14 +69810,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", @@ -70953,13 +69824,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -71034,7 +69899,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -71294,7 +70159,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", @@ -71332,13 +70196,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": { @@ -72421,8 +71278,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -72470,13 +71325,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -72488,25 +71341,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -72541,8 +71383,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -72588,14 +71428,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", @@ -72610,13 +71442,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -72685,7 +71511,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -72919,6 +71745,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -72931,7 +71758,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", @@ -76258,9 +75084,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 @@ -76307,14 +75130,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -76323,36 +75143,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -76408,9 +75205,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", @@ -76457,14 +75251,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", @@ -76473,13 +75259,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -76551,7 +75331,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install --check-files", @@ -76811,7 +75591,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", @@ -76848,13 +75627,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": { @@ -78545,8 +77317,6 @@ build-backend = "poetry.core.masonry.api" /.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 @@ -78593,13 +77363,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -78608,25 +77376,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -78660,8 +77417,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -78708,14 +77463,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", @@ -78724,13 +77471,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -78799,7 +77540,7 @@ tsconfig.esm.json "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -79033,6 +77774,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -79045,7 +77787,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", @@ -79081,13 +77822,6 @@ tsconfig.esm.json "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": { @@ -80617,9 +79351,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 @@ -80680,14 +79411,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -80695,36 +79423,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -80780,9 +79485,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", @@ -80830,14 +79532,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", @@ -80852,13 +79546,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-yarn-berry-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -80933,7 +79621,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "yarn dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "yarn dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install", @@ -81198,7 +79886,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", @@ -81236,13 +79923,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": { @@ -81390,8 +80070,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 @@ -81439,13 +80117,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -81457,25 +80133,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -81510,8 +80175,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -81557,14 +80220,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", @@ -81579,13 +80234,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -81654,7 +80303,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -81888,6 +80537,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -81900,7 +80550,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", @@ -85235,9 +83884,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 @@ -85297,14 +83943,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -85313,36 +83956,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -85398,9 +84018,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", @@ -85448,14 +84065,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", @@ -85464,13 +84073,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-yarn-berry-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -85542,7 +84145,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "yarn dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "yarn dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install", @@ -85807,7 +84410,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", @@ -85844,13 +84446,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": { @@ -85997,8 +84592,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 @@ -86058,13 +84651,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -86073,25 +84664,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -86125,8 +84705,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -86174,14 +84752,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", @@ -86190,13 +84760,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -86265,7 +84829,7 @@ tsconfig.esm.json "exec": "yarn install", }, { - "exec": "yarn up @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn up @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -86503,6 +85067,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -86516,7 +85081,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", @@ -86552,13 +85116,6 @@ tsconfig.esm.json "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": { @@ -88088,9 +86645,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 @@ -88138,14 +86692,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -88153,36 +86704,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -88238,9 +86766,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", @@ -88287,14 +86812,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", @@ -88309,13 +86826,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-yarn-classic-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -88390,7 +86901,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install --check-files", @@ -88650,7 +87161,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", @@ -88688,13 +87198,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": { @@ -88842,8 +87345,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 @@ -88891,13 +87392,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest ", "generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ @@ -88909,25 +87408,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -88962,8 +87450,6 @@ tsconfig.esm.json ".gitignore", ".npmignore", ".npmrc", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -89009,14 +87495,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", @@ -89031,13 +87509,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -89106,7 +87578,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -89340,6 +87812,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -89352,7 +87825,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", @@ -92666,9 +91138,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 @@ -92715,14 +91184,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -92731,36 +91197,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -92816,9 +91259,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", @@ -92865,14 +91305,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", @@ -92881,13 +91313,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-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-enable-mock-integrations":true,"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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"smithy-yarn-classic-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -92959,7 +91385,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install --check-files", @@ -93219,7 +91645,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", @@ -93256,13 +91681,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": { @@ -93409,8 +91827,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 @@ -93457,13 +91873,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/project.json !/LICENSE ", @@ -93472,25 +91886,14 @@ 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 -", - "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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -93524,8 +91927,6 @@ tsconfig.esm.json ".gitattributes", ".gitignore", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -93572,14 +91973,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", @@ -93588,13 +91981,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 --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-next --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -93663,7 +92050,7 @@ tsconfig.esm.json "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -93897,6 +92284,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -93909,7 +92297,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", @@ -93945,13 +92332,6 @@ tsconfig.esm.json "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/__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 cf2be33a1..2708b66db 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 @@ -429,14 +429,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -478,6 +479,7 @@ resolution-mode=highest { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -683,7 +685,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -1184,13 +1186,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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/ @@ -1223,6 +1226,11 @@ src/apis/* "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -1405,7 +1413,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -1640,6 +1648,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -4046,14 +4055,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json !/LICENSE ", @@ -4092,6 +4102,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -4287,7 +4298,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install --check-files", @@ -4785,13 +4796,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest +!/.openapi-generator-ignore +!/.pdk/dynamic-files/openapitools.json +/openapitools.json !/project.json !/LICENSE ", @@ -4821,6 +4833,11 @@ src/apis/* "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -4997,7 +5014,7 @@ src/apis/* "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -5232,6 +5249,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -6261,14 +6279,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -6310,6 +6329,7 @@ resolution-mode=highest { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -6515,7 +6535,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -7016,13 +7036,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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,6 +7076,11 @@ src/apis/* "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -7237,7 +7263,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -7472,6 +7498,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -7857,11 +7884,12 @@ junit.xml /dist/ !/.eslintrc.json !/.npmignore +.openapi-generator +.tsapi-metadata !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -.openapi-generator !/project.json ", "handlers/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -7898,6 +7926,11 @@ resolution-mode=highest "handlers/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/aws-lambda", "type": "build", @@ -8156,7 +8189,7 @@ resolution-mode=highest "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/aws-lambda @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser esbuild eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit ts-jest typescript smithy-handlers-typescript-runtime", + "exec": "pnpm update @aws/pdk @types/aws-lambda @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser esbuild eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit ts-jest typescript smithy-handlers-typescript-runtime", }, { "exec": "npx projen", @@ -8387,6 +8420,7 @@ resolution-mode=highest "smithy-handlers-typescript-runtime": "file:../../generated/runtime/typescript", }, "devDependencies": { + "@aws/pdk": "^0", "@types/aws-lambda": "*", "@types/jest": "*", "@types/node": "^18", @@ -9342,14 +9376,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -9391,6 +9426,7 @@ resolution-mode=highest { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -9596,7 +9632,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -10093,13 +10129,14 @@ jspm_packages/ !/src/ /lib /dist/ -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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". @@ -10127,6 +10164,11 @@ src/apis/**/* "generated/libraries/typescript-websocket-client/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -10329,7 +10371,7 @@ src/apis/**/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-crypto/sha256-js @aws-sdk/protocol-http @aws-sdk/signature-v4 @aws-sdk/types @types/uuid @types/ws isomorphic-ws uuid ws", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-crypto/sha256-js @aws-sdk/protocol-http @aws-sdk/signature-v4 @aws-sdk/types @types/uuid @types/ws isomorphic-ws uuid ws", }, { "exec": "npx projen", @@ -10568,6 +10610,7 @@ src/apis/**/* "ws": "^8", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -10719,13 +10762,14 @@ jspm_packages/ !/src/ /lib /dist/ -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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". @@ -10757,6 +10801,11 @@ tsconfig.esm.json "generated/libraries/typescript-websocket-hooks/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -10934,7 +10983,7 @@ tsconfig.esm.json "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node @types/react react typescript smithy-typescript-websocket-hooks-typescript-websocket-client", + "exec": "pnpm update @aws/pdk @types/node @types/react react typescript smithy-typescript-websocket-hooks-typescript-websocket-client", }, { "exec": "npx projen", @@ -11165,6 +11214,7 @@ tsconfig.esm.json "smithy-typescript-websocket-hooks-typescript-websocket-client": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "@types/react": "*", "react": "*", @@ -11330,13 +11380,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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/ @@ -11369,6 +11420,11 @@ src/apis/* "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -11551,7 +11607,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -11786,6 +11842,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -12813,14 +12870,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -12858,6 +12916,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -13062,7 +13121,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "npm install", @@ -13563,13 +13622,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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/ @@ -13602,6 +13662,11 @@ src/apis/* "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -13784,7 +13849,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -14019,6 +14084,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -16651,14 +16717,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json !/LICENSE ", @@ -16697,6 +16764,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -16892,7 +16960,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "npm install", @@ -17390,13 +17458,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest +!/.openapi-generator-ignore +!/.pdk/dynamic-files/openapitools.json +/openapitools.json !/project.json !/LICENSE ", @@ -17426,6 +17495,11 @@ src/apis/* "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -17602,7 +17676,7 @@ src/apis/* "exec": "npm install", }, { - "exec": "npm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "npm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -17837,6 +17911,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -19352,14 +19427,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -19401,6 +19477,7 @@ resolution-mode=highest { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -19606,7 +19683,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -20107,13 +20184,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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/ @@ -20146,6 +20224,11 @@ src/apis/* "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -20328,7 +20411,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -20563,6 +20646,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -23213,14 +23297,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json !/LICENSE ", @@ -23259,6 +23344,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -23454,7 +23540,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -23954,13 +24040,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest +!/.openapi-generator-ignore +!/.pdk/dynamic-files/openapitools.json +/openapitools.json !/project.json !/LICENSE ", @@ -23990,6 +24077,11 @@ src/apis/* "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -24166,7 +24258,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -24401,6 +24493,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -25922,14 +26015,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -25971,6 +26065,7 @@ resolution-mode=highest { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -26176,7 +26271,7 @@ resolution-mode=highest "name": "upgrade", "steps": [ { - "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "pnpm i --no-frozen-lockfile", @@ -26677,13 +26772,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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/ @@ -26716,6 +26812,11 @@ src/apis/* "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -26898,7 +26999,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -27133,6 +27234,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -29766,14 +29868,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json !/LICENSE ", @@ -29812,6 +29915,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -30007,7 +30111,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install --check-files", @@ -30505,13 +30609,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest +!/.openapi-generator-ignore +!/.pdk/dynamic-files/openapitools.json +/openapitools.json !/project.json !/LICENSE ", @@ -30541,6 +30646,11 @@ src/apis/* "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -30717,7 +30827,7 @@ src/apis/* "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -30952,6 +31062,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -32478,14 +32589,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -32523,6 +32635,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -32728,7 +32841,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "yarn dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "yarn dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install", @@ -33234,13 +33347,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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/ @@ -33273,6 +33387,11 @@ src/apis/* "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -33455,7 +33574,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -33690,6 +33809,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -36357,14 +36477,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json !/LICENSE ", @@ -36403,6 +36524,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -36599,7 +36721,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "yarn dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "yarn dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install", @@ -37115,13 +37237,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest +!/.openapi-generator-ignore +!/.pdk/dynamic-files/openapitools.json +/openapitools.json !/project.json !/LICENSE ", @@ -37151,6 +37274,11 @@ src/apis/* "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -37328,7 +37456,7 @@ src/apis/* "exec": "yarn install", }, { - "exec": "yarn up @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "yarn up @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -37567,6 +37695,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -39081,14 +39210,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json ", "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -39126,6 +39256,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -39330,7 +39461,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install --check-files", @@ -39831,13 +39962,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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/ @@ -39870,6 +40002,11 @@ src/apis/* "generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -40052,7 +40189,7 @@ src/apis/* "exec": "pnpm i --no-frozen-lockfile", }, { - "exec": "pnpm update @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "pnpm update @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -40287,6 +40424,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, @@ -42920,14 +43058,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/project.json !/LICENSE ", @@ -42966,6 +43105,7 @@ mocks { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -43161,7 +43301,7 @@ mocks "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,constructs,typescript,@aws/pdk", }, { "exec": "yarn install --check-files", @@ -43659,13 +43799,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest +!/.openapi-generator-ignore +!/.pdk/dynamic-files/openapitools.json +/openapitools.json !/project.json !/LICENSE ", @@ -43695,6 +43836,11 @@ src/apis/* "packages/api/generated/runtime/typescript/.projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -43871,7 +44017,7 @@ src/apis/* "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -44106,6 +44252,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "typescript": "*", }, 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 467fd07f8..5e09fea47 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 @@ -581,11 +581,12 @@ junit.xml /dist/ !/.eslintrc.json !/.npmignore +.openapi-generator +.tsapi-metadata !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -.openapi-generator !/.projenrc.js ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -643,6 +644,11 @@ pull_request_rules: ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/aws-lambda", "type": "build", @@ -1022,7 +1028,7 @@ pull_request_rules: "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/aws-lambda @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser constructs esbuild eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit projen standard-version ts-jest typescript test-ts-client", + "exec": "yarn upgrade @aws/pdk @types/aws-lambda @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser constructs esbuild eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit projen standard-version ts-jest typescript test-ts-client", }, { "exec": "npx projen", @@ -1253,6 +1259,7 @@ pull_request_rules: "test-ts-client": "file:../ts-async-client", }, "devDependencies": { + "@aws/pdk": "^0", "@types/aws-lambda": "*", "@types/jest": "*", "@types/node": "^18", diff --git a/packages/type-safe-api/test/project/codegen/handlers/__snapshots__/generated-typescript-handlers-project.test.ts.snap b/packages/type-safe-api/test/project/codegen/handlers/__snapshots__/generated-typescript-handlers-project.test.ts.snap index fe8d5bef5..9efc1e160 100644 --- a/packages/type-safe-api/test/project/codegen/handlers/__snapshots__/generated-typescript-handlers-project.test.ts.snap +++ b/packages/type-safe-api/test/project/codegen/handlers/__snapshots__/generated-typescript-handlers-project.test.ts.snap @@ -246,9 +246,6 @@ exports[`Generated Typescript 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 @@ -581,11 +578,8 @@ junit.xml /dist/ !/.eslintrc.json !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json .openapi-generator +.tsapi-metadata !/.projenrc.js ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -618,31 +612,14 @@ 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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/aws-lambda", "type": "build", @@ -734,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", @@ -834,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", @@ -877,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-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-next --specPath my-spec.json --outputPath . --templateDirs "typescript-lambda-handlers" --metadata '{"srcDir":"src","tstDir":"test","runtimePackageName":"test-ts-client"}'", }, ], }, @@ -1022,7 +982,7 @@ pull_request_rules: "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/aws-lambda @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser constructs esbuild eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit projen standard-version ts-jest typescript test-ts-client", + "exec": "yarn upgrade @aws/pdk @types/aws-lambda @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser constructs esbuild eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit projen standard-version ts-jest typescript test-ts-client", }, { "exec": "npx projen", @@ -1253,6 +1213,7 @@ pull_request_rules: "test-ts-client": "file:../ts-client", }, "devDependencies": { + "@aws/pdk": "^0", "@types/aws-lambda": "*", "@types/jest": "*", "@types/node": "^18", @@ -1324,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 a0379f633..b64a89ba5 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 @@ -344,14 +344,15 @@ jspm_packages/ /lib /dist/ !/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest !/.openapi-generator-ignore !/.openapi-generator-ignore-handlebars !/.pdk/dynamic-files/openapitools.json /openapitools.json -/assets/api.json -src -.openapi-generator -mocks !/.projenrc.js ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -414,6 +415,7 @@ pull_request_rules: { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -736,7 +738,7 @@ pull_request_rules: "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,projen,typescript,constructs", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,projen,typescript,@aws/pdk,constructs", }, { "exec": "yarn install --check-files", diff --git a/packages/type-safe-api/test/project/codegen/infrastructure/cdk/__snapshots__/generated-typescript-cdk-infrastructure-project.test.ts.snap b/packages/type-safe-api/test/project/codegen/infrastructure/cdk/__snapshots__/generated-typescript-cdk-infrastructure-project.test.ts.snap index 96c48b35a..445223339 100644 --- a/packages/type-safe-api/test/project/codegen/infrastructure/cdk/__snapshots__/generated-typescript-cdk-infrastructure-project.test.ts.snap +++ b/packages/type-safe-api/test/project/codegen/infrastructure/cdk/__snapshots__/generated-typescript-cdk-infrastructure-project.test.ts.snap @@ -13,9 +13,6 @@ exports[`Generated Typescript 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 @@ -344,14 +341,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.openapi-generator-ignore-handlebars -!/.pdk/dynamic-files/openapitools.json -/openapitools.json /assets/api.json src -.openapi-generator mocks +.openapi-generator +.tsapi-manifest !/.projenrc.js ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -384,36 +378,13 @@ 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": [ { "name": "@aws/pdk", "type": "build", + "version": "^0", }, { "name": "@types/aws-lambda", @@ -485,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", @@ -585,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", @@ -618,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-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-enable-mock-integrations":true,"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-next --specPath my-spec.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"test-ts-client","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"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", @@ -739,7 +693,7 @@ pull_request_rules: "name": "upgrade", "steps": [ { - "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@aws/pdk,@types/aws-lambda,aws-cdk-lib,cdk-nag,projen,typescript,constructs", + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,aws-cdk-lib,cdk-nag,projen,typescript,@aws/pdk,constructs", }, { "exec": "yarn install --check-files", @@ -1003,7 +957,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 ca05558bf..a8d424ff8 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 @@ -343,13 +343,14 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore 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". @@ -403,6 +404,11 @@ src/apis/* ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -710,7 +716,7 @@ src/apis/* "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node constructs projen standard-version typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node constructs projen standard-version typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @aws-sdk/client-apigatewaymanagementapi @types/aws-lambda", }, { "exec": "npx projen", @@ -945,6 +951,7 @@ src/apis/* "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "constructs": "^10.0.0", "projen": "*", diff --git a/packages/type-safe-api/test/project/codegen/types/__snapshots__/generated-typescript-runtime-project.test.ts.snap b/packages/type-safe-api/test/project/codegen/types/__snapshots__/generated-typescript-runtime-project.test.ts.snap index b1efcd1b6..b96ed6d50 100644 --- a/packages/type-safe-api/test/project/codegen/types/__snapshots__/generated-typescript-runtime-project.test.ts.snap +++ b/packages/type-safe-api/test/project/codegen/types/__snapshots__/generated-typescript-runtime-project.test.ts.snap @@ -13,8 +13,6 @@ exports[`Generated Typescript 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 @@ -343,13 +341,11 @@ jspm_packages/ /lib /dist/ !/.npmignore -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json src .npmignore README.md .openapi-generator +.tsapi-manifest !/.projenrc.js ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". @@ -382,25 +378,14 @@ 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 -", - ".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": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, { "name": "@types/node", "type": "build", @@ -454,8 +439,6 @@ tsconfig.esm.json ".gitignore", ".mergify.yml", ".npmignore", - ".openapi-generator-ignore", - ".pdk/dynamic-files/openapitools.json", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", @@ -553,14 +536,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", @@ -586,13 +561,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 my-spec.json --output-path . --generator-dir typescript --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-next --specPath my-spec.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", }, ], }, @@ -704,7 +673,7 @@ tsconfig.esm.json "exec": "yarn install --check-files", }, { - "exec": "yarn upgrade @types/node constructs projen standard-version typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", + "exec": "yarn upgrade @aws/pdk @types/node constructs projen standard-version typescript @aws-lambda-powertools/logger @aws-lambda-powertools/metrics @aws-lambda-powertools/tracer @types/aws-lambda", }, { "exec": "npx projen", @@ -938,6 +907,7 @@ tsconfig.esm.json "@types/aws-lambda": "*", }, "devDependencies": { + "@aws/pdk": "^0", "@types/node": "^18", "constructs": "^10.0.0", "projen": "*", @@ -955,7 +925,6 @@ tsconfig.esm.json "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/type-safe-api-project.test.ts b/packages/type-safe-api/test/project/type-safe-api-project.test.ts index a4b434e6b..92b1de959 100644 --- a/packages/type-safe-api/test/project/type-safe-api-project.test.ts +++ b/packages/type-safe-api/test/project/type-safe-api-project.test.ts @@ -6,9 +6,8 @@ import { NodePackageManager } from "projen/lib/javascript"; import { synthProject, synthSmithyProject } from "./snapshot-utils"; import { DocumentationFormat, - GeneratedTypeScriptInfrastructureOptions, - GeneratedTypeScriptReactQueryHooksOptions, - GeneratedTypeScriptRuntimeOptions, + GeneratedPythonInfrastructureOptions, + GeneratedPythonRuntimeOptions, Language, Library, ModelLanguage, @@ -382,19 +381,19 @@ describe("Type Safe Api Project Unit Tests", () => { `custom-openapi-generator-cli-configuration` ), infrastructure: { - language: Language.TYPESCRIPT, + language: Language.PYTHON, options: { typescript: { openApiGeneratorCliConfig, - } satisfies Partial as any, + } satisfies Partial as any, }, }, runtime: { - languages: [Language.TYPESCRIPT], + languages: [Language.PYTHON], options: { typescript: { openApiGeneratorCliConfig, - } satisfies Partial as any, + } satisfies Partial as any, }, }, model: { @@ -408,14 +407,6 @@ describe("Type Safe Api Project Unit Tests", () => { }, }, }, - library: { - libraries: [Library.TYPESCRIPT_REACT_QUERY_HOOKS], - options: { - typescriptReactQueryHooks: { - openApiGeneratorCliConfig, - } satisfies Partial as any, - }, - }, documentation: { formats: [DocumentationFormat.HTML2], options: { @@ -426,11 +417,11 @@ describe("Type Safe Api Project Unit Tests", () => { }, }); - expect(project.runtime.typescript).toBeDefined(); + expect(project.runtime.typescript).not.toBeDefined(); expect(project.runtime.java).not.toBeDefined(); - expect(project.runtime.python).not.toBeDefined(); + expect(project.runtime.python).toBeDefined(); - expect(project.library.typescriptReactQueryHooks).toBeDefined(); + expect(project.library.typescriptReactQueryHooks).not.toBeDefined(); expect(project.documentation.html2).toBeDefined(); @@ -440,15 +431,7 @@ describe("Type Safe Api Project Unit Tests", () => { snapshot[ `${path.relative( project.outdir, - project.infrastructure.typescript!.outdir - )}/.pdk/dynamic-files/openapitools.json` - ] - ).toMatchSnapshot(); - expect( - snapshot[ - `${path.relative( - project.outdir, - project.runtime.typescript!.outdir + project.infrastructure.python!.outdir )}/.pdk/dynamic-files/openapitools.json` ] ).toMatchSnapshot(); @@ -456,7 +439,7 @@ describe("Type Safe Api Project Unit Tests", () => { snapshot[ `${path.relative( project.outdir, - project.library.typescriptReactQueryHooks!.outdir + project.runtime.python!.outdir )}/.pdk/dynamic-files/openapitools.json` ] ).toMatchSnapshot(); diff --git a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-cdk-infrastructure.test.ts.snap b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-cdk-infrastructure.test.ts.snap index 309ee743b..f9917788c 100644 --- a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-cdk-infrastructure.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-cdk-infrastructure.test.ts.snap @@ -7,7 +7,6 @@ import { SnapStartFunction, SnapStartFunctionProps } from "@aws/pdk/type-safe-ap import { Code, Function, Runtime, Tracing, FunctionProps } from "aws-cdk-lib/aws-lambda"; import * as path from "path"; - /** * Options for the JavaOneFunction construct */ @@ -146,7 +145,9 @@ export class TypescriptTwoFunction extends Function { ...props, }); } -}" +} + +" `; exports[`Typescript Infrastructure Code Generation Script Unit Tests Generates Functions for inline-body.yaml 1`] = ` @@ -156,7 +157,6 @@ import { SnapStartFunction, SnapStartFunctionProps } from "@aws/pdk/type-safe-ap import { Code, Function, Runtime, Tracing, FunctionProps } from "aws-cdk-lib/aws-lambda"; import * as path from "path"; - /** * Options for the JavaTestFunction construct */ @@ -204,15 +204,15 @@ export class PythonTestFunction extends Function { } /** - * Options for the TypescriptTestOperationFunction construct + * Options for the TypescriptTestFunction construct */ -export interface TypescriptTestOperationFunctionProps extends Omit {} +export interface TypescriptTestFunctionProps extends Omit {} /** - * Lambda function construct which points to the typescript implementation of TypescriptTestOperation + * Lambda function construct which points to the typescript implementation of TypescriptTest */ -export class TypescriptTestOperationFunction extends Function { - constructor(scope: Construct, id: string, props?: TypescriptTestOperationFunctionProps) { +export class TypescriptTestFunction extends Function { + constructor(scope: Construct, id: string, props?: TypescriptTestFunctionProps) { super(scope, id, { runtime: Runtime.NODEJS_18_X, handler: "index.handler", @@ -225,7 +225,9 @@ export class TypescriptTestOperationFunction extends Function { ...props, }); } -}" +} + +" `; exports[`Typescript Infrastructure Code Generation Script Unit Tests Generates With Mocks Disabled 1`] = ` @@ -258,10 +260,8 @@ export class MockIntegrations { return fs.readFileSync(path.join(__dirname, "..", "mocks", \`\${method.toLowerCase()}\${urlPath.replace(/\\//g, "-")}-\${statusCode}.json\`), "utf-8"); } - - // No mock integrations have been generated, since mock data generation is disabled. - + } " `; @@ -325,7 +325,6 @@ export class MockIntegrations { return fs.readFileSync(path.join(__dirname, "..", "mocks", \`\${method.toLowerCase()}\${urlPath.replace(/\\//g, "-")}-\${statusCode}.json\`), "utf-8"); } - /** * Mock integration to return a 200 response from the anyRequestResponse operation */ @@ -435,8 +434,7 @@ export class MockIntegrations { }, }; } - - + } " `; diff --git a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-lambda-handlers.test.ts.snap b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-lambda-handlers.test.ts.snap index 778c0dd3c..6dcabfa45 100644 --- a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-lambda-handlers.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript-lambda-handlers.test.ts.snap @@ -28,7 +28,6 @@ export const typescriptOne: TypescriptOneChainedHandlerFunction = async (request * The typescriptOneHandler method wraps the type-safe handler and manages marshalling inputs and outputs */ export const handler = typescriptOneHandler(...INTERCEPTORS, typescriptOne); - " `; @@ -59,7 +58,8 @@ 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 and outputs */ -export const handler = typescriptTwoHandler(...INTERCEPTORS, typescriptTwo);" +export const handler = typescriptTwoHandler(...INTERCEPTORS, typescriptTwo); +" `; exports[`Typescript Handlers Code Generation Script Unit Tests Generates With handlers.yaml 3`] = ` @@ -143,5 +143,7 @@ describe('TypescriptTwo', () => { expect((response.body as InternalFailureErrorResponseContent).message).toEqual('Not Implemented!'); }); -});" +}); + +" `; 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 e2415d5a2..0605f1348 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,623 +2,21 @@ exports[`Typescript React Query Hooks Code Generation Script Unit Tests Generates With multiple-tags.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 -/.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 -/.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 -", - ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -!/.gitattributes -!/.projen/tasks.json -!/.projen/deps.json -!/.projen/files.json -!/.github/workflows/pull-request-lint.yml -!/package.json -!/LICENSE -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json -pids -*.pid -*.seed -*.pid.lock -lib-cov -coverage -*.lcov -.nyc_output -build/Release -node_modules/ -jspm_packages/ -*.tsbuildinfo -.eslintcache -*.tgz -.yarn-integrity -.cache -!/.github/workflows/build.yml -/dist/changelog.md -/dist/version.txt -!/.github/workflows/release.yml -!/.mergify.yml -!/.github/workflows/upgrade-main.yml -!/.github/pull_request_template.md -!/test/ -!/tsconfig.json -!/tsconfig.dev.json -!/src/ -/lib -/dist/ -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json -src -.npmignore -README.md -.openapi-generator -!/.openapi-generator-ignore-handlebars -!/.projenrc.js -", - ".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 -**/*Hooks.ts -", - ".openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!**/*Hooks.ts -", - ".openapi-generator/FILES": "src/apis/DefaultApiHooks.ts -src/apis/Tag1ApiHooks.ts -src/apis/Tag2ApiHooks.ts -README.md -README.md + ".tsapi-manifest": "src/index.ts +src/runtime.ts src/apis/DefaultApi.ts -src/apis/DefaultApiClientProvider.tsx src/apis/Tag1Api.ts -src/apis/Tag1ApiClientProvider.tsx src/apis/Tag2Api.ts -src/apis/Tag2ApiClientProvider.tsx src/apis/index.ts +README.md src/apis/index.ts -src/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. -", +src/apis/DefaultApiClientProvider.tsx +src/apis/Tag1ApiClientProvider.tsx +src/apis/Tag2ApiClientProvider.tsx +src/apis/DefaultApiHooks.ts +src/apis/Tag1ApiHooks.ts +src/apis/Tag2ApiHooks.ts +src/index.ts", "README.md": "# TypeScript React Query Hooks This project contains [react-query](https://tanstack.com/query/latest) hooks for interacting with your API. @@ -698,44 +96,37 @@ when you use a hook, for example: const sayHello = useSayHello({ name: 'World' }); \`\`\` ", - "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/apis/DefaultApi.ts": "/* tslint:disable */ /* eslint-disable */ /** * Multiple Tags Test - * 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 * as runtime from '../runtime'; + /** * */ export class DefaultApi extends runtime.BaseAPI { - /** + * */ async neitherRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/neither\`, method: 'GET', @@ -747,12 +138,14 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async neither(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.neitherRaw(initOverrides); } } + ", "src/apis/DefaultApiClientProvider.tsx": "import * as React from "react"; import { @@ -801,12 +194,8 @@ export const DefaultApiClientProvider = ({ }; ", "src/apis/DefaultApiHooks.ts": "// Import models - // Import request parameter interfaces import { - - - } from '..'; import { ResponseError } from '../runtime'; @@ -833,12 +222,10 @@ export const DefaultApiClientContext = createContext(und const NO_API_ERROR = new Error(\`DefaultApi client missing. Please ensure you have instantiated the DefaultApiClientProvider with a client instance.\`); - /** * useQuery hook for the Neither operation */ export const useNeither = ( - options?: Omit, 'queryKey' | 'queryFn'> ): UseQueryResult => { const api = useContext(DefaultApiClientContext); @@ -851,37 +238,39 @@ export const useNeither = ( }); }; - ", "src/apis/Tag1Api.ts": "/* tslint:disable */ /* eslint-disable */ /** * Multiple Tags Test - * 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 * as runtime from '../runtime'; + + /** * */ export class Tag1Api extends runtime.BaseAPI { - /** + * */ async bothRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/both\`, method: 'GET', @@ -893,18 +282,23 @@ export class Tag1Api extends runtime.BaseAPI { } /** + * */ async both(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.bothRaw(initOverrides); } /** + * */ async tag1Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/tag1\`, method: 'GET', @@ -916,12 +310,14 @@ export class Tag1Api extends runtime.BaseAPI { } /** + * */ async tag1(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.tag1Raw(initOverrides); } } + ", "src/apis/Tag1ApiClientProvider.tsx": "import * as React from "react"; import { @@ -970,13 +366,8 @@ export const Tag1ApiClientProvider = ({ }; ", "src/apis/Tag1ApiHooks.ts": "// Import models - // Import request parameter interfaces import { - - - - } from '..'; import { ResponseError } from '../runtime'; @@ -1003,12 +394,10 @@ export const Tag1ApiClientContext = createContext(undefined const NO_API_ERROR = new Error(\`Tag1Api client missing. Please ensure you have instantiated the Tag1ApiClientProvider with a client instance.\`); - /** * useQuery hook for the Both operation */ export const useBoth = ( - options?: Omit, 'queryKey' | 'queryFn'> ): UseQueryResult => { const api = useContext(Tag1ApiClientContext); @@ -1021,12 +410,10 @@ export const useBoth = ( }); }; - /** * useQuery hook for the Tag1 operation */ export const useTag1 = ( - options?: Omit, 'queryKey' | 'queryFn'> ): UseQueryResult => { const api = useContext(Tag1ApiClientContext); @@ -1039,37 +426,38 @@ export const useTag1 = ( }); }; - ", "src/apis/Tag2Api.ts": "/* tslint:disable */ /* eslint-disable */ /** * Multiple Tags Test - * 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 * as runtime from '../runtime'; + /** * */ export class Tag2Api extends runtime.BaseAPI { - /** + * */ async tag2Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/tag2\`, method: 'GET', @@ -1081,12 +469,14 @@ export class Tag2Api extends runtime.BaseAPI { } /** + * */ async tag2(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.tag2Raw(initOverrides); } } + ", "src/apis/Tag2ApiClientProvider.tsx": "import * as React from "react"; import { @@ -1135,12 +525,8 @@ export const Tag2ApiClientProvider = ({ }; ", "src/apis/Tag2ApiHooks.ts": "// Import models - // Import request parameter interfaces import { - - - } from '..'; import { ResponseError } from '../runtime'; @@ -1167,12 +553,10 @@ export const Tag2ApiClientContext = createContext(undefined const NO_API_ERROR = new Error(\`Tag2Api client missing. Please ensure you have instantiated the Tag2ApiClientProvider with a client instance.\`); - /** * useQuery hook for the Tag2 operation */ export const useTag2 = ( - options?: Omit, 'queryKey' | 'queryFn'> ): UseQueryResult => { const api = useContext(Tag2ApiClientContext); @@ -1185,7 +569,6 @@ export const useTag2 = ( }); }; - ", "src/apis/index.ts": "/* tslint:disable */ /* eslint-disable */ @@ -1208,17 +591,15 @@ export * from './models';", /* eslint-disable */ /** * Multiple Tags Test - * 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. */ - export const BASE_PATH = "http://localhost".replace(/\\/+$/, ""); export interface ConfigurationParameters { @@ -1612,679 +993,27 @@ export class TextApiResponse { }; } ", - "tsconfig.dev.json": { - "compilerOptions": { - "alwaysStrict": false, - "declaration": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "inlineSources": true, - "jsx": "react", - "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", - ], - }, } `; exports[`Typescript React Query Hooks Code Generation Script Unit Tests Generates With single-pagination.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 -/.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 -/.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 -", - ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -!/.gitattributes -!/.projen/tasks.json -!/.projen/deps.json -!/.projen/files.json -!/.github/workflows/pull-request-lint.yml -!/package.json -!/LICENSE -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json -pids -*.pid -*.seed -*.pid.lock -lib-cov -coverage -*.lcov -.nyc_output -build/Release -node_modules/ -jspm_packages/ -*.tsbuildinfo -.eslintcache -*.tgz -.yarn-integrity -.cache -!/.github/workflows/build.yml -/dist/changelog.md -/dist/version.txt -!/.github/workflows/release.yml -!/.mergify.yml -!/.github/workflows/upgrade-main.yml -!/.github/pull_request_template.md -!/test/ -!/tsconfig.json -!/tsconfig.dev.json -!/src/ -/lib -/dist/ -!/.openapi-generator-ignore -!/.pdk/dynamic-files/openapitools.json -/openapitools.json -src -.npmignore -README.md -.openapi-generator -!/.openapi-generator-ignore-handlebars -!/.projenrc.js -", - ".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 -**/*Hooks.ts -", - ".openapi-generator-ignore-handlebars": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -/* -**/* -* -!**/*Hooks.ts -", - ".openapi-generator/FILES": "src/apis/DefaultApiHooks.ts -README.md -README.md + ".tsapi-manifest": "src/index.ts +src/runtime.ts src/apis/DefaultApi.ts -src/apis/DefaultApiClientProvider.tsx -src/apis/index.ts src/apis/index.ts -src/index.ts -src/models/ApiError.ts -src/models/ApiError.ts +src/models/index.ts src/models/ApiError.ts src/models/PaginatedGet200Response.ts -src/models/PaginatedGet200Response.ts -src/models/PaginatedGet200Response.ts -src/models/RegularGet200Response.ts src/models/RegularGet200Response.ts -src/models/RegularGet200Response.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 +src/apis/index.ts +src/apis/DefaultApiClientProvider.tsx +src/apis/DefaultApiHooks.ts +src/index.ts", "README.md": "# TypeScript React Query Hooks This project contains [react-query](https://tanstack.com/query/latest) hooks for interacting with your API. @@ -2364,30 +1093,19 @@ when you use a hook, for example: const sayHello = useSayHello({ name: 'World' }); \`\`\` ", - "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/apis/DefaultApi.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 + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import * as runtime from '../runtime'; import type { ApiError, @@ -2413,6 +1131,7 @@ export interface AnyRequestResponseRequest { body?: any | null; } + export interface MediaTypesRequest { body: Blob; } @@ -2430,20 +1149,24 @@ export interface PaginatedGetRequest { inputNextToken: string; } + + /** * */ export class DefaultApi extends runtime.BaseAPI { - /** + * */ async anyRequestResponseRaw(requestParameters: AnyRequestResponseRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; + const response = await this.request({ path: \`/any-request-response\`, method: 'PUT', @@ -2456,6 +1179,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async anyRequestResponse(requestParameters: AnyRequestResponseRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.anyRequestResponseRaw(requestParameters, initOverrides); @@ -2463,12 +1187,16 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async emptyRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/empty-response\`, method: 'PUT', @@ -2480,12 +1208,14 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async empty(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.emptyRaw(initOverrides); } /** + * */ async mediaTypesRaw(requestParameters: MediaTypesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.body === null || requestParameters.body === undefined) { @@ -2494,10 +1224,12 @@ export class DefaultApi extends runtime.BaseAPI { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/pdf'; + const response = await this.request({ path: \`/different-media-type\`, method: 'POST', @@ -2510,6 +1242,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async mediaTypes(requestParameters: MediaTypesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.mediaTypesRaw(requestParameters, initOverrides); @@ -2517,6 +1250,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async operationOneRaw(requestParameters: OperationOneRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.param1 === null || requestParameters.param1 === undefined) { @@ -2557,10 +1291,12 @@ export class DefaultApi extends runtime.BaseAPI { queryParameters['param4'] = requestParameters.param4; } + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; + const response = await this.request({ path: \`/path/{pathParam}\`.replace(\`{\${"pathParam"}}\`, encodeURIComponent(String(requestParameters.pathParam))), method: 'POST', @@ -2573,6 +1309,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async operationOne(requestParameters: OperationOneRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.operationOneRaw(requestParameters, initOverrides); @@ -2580,6 +1317,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async paginatedGetRaw(requestParameters: PaginatedGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.inputNextToken === null || requestParameters.inputNextToken === undefined) { @@ -2592,8 +1330,11 @@ export class DefaultApi extends runtime.BaseAPI { queryParameters['inputNextToken'] = requestParameters.inputNextToken; } + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/paginated-get\`, method: 'GET', @@ -2605,6 +1346,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async paginatedGet(requestParameters: PaginatedGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.paginatedGetRaw(requestParameters, initOverrides); @@ -2612,12 +1354,16 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async regularGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/regular-get\`, method: 'GET', @@ -2629,6 +1375,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async regularGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.regularGetRaw(initOverrides); @@ -2636,12 +1383,16 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async withoutOperationIdDeleteRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/without-operation-id\`, method: 'DELETE', @@ -2653,6 +1404,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async withoutOperationIdDelete(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.withoutOperationIdDeleteRaw(initOverrides); @@ -2660,6 +1412,7 @@ export class DefaultApi extends runtime.BaseAPI { } } + ", "src/apis/DefaultApiClientProvider.tsx": "import * as React from "react"; import { @@ -2714,20 +1467,13 @@ import type { RegularGet200Response, TestRequest, TestResponse, - } from '../models'; - // Import request parameter interfaces import { AnyRequestResponseRequest, - MediaTypesRequest, OperationOneRequest, PaginatedGetRequest, - - - - } from '..'; import { ResponseError } from '../runtime'; @@ -2754,7 +1500,6 @@ export const DefaultApiClientContext = createContext(und const NO_API_ERROR = new Error(\`DefaultApi client missing. Please ensure you have instantiated the DefaultApiClientProvider with a client instance.\`); - /** * useMutation hook for the AnyRequestResponse operation */ @@ -2841,7 +1586,6 @@ export const usePaginatedGet = ( * useQuery hook for the RegularGet operation */ export const useRegularGet = ( - options?: Omit, 'queryKey' | 'queryFn'> ): UseQueryResult => { const api = useContext(DefaultApiClientContext); @@ -2854,7 +1598,6 @@ export const useRegularGet = ( }); }; - /** * useMutation hook for the WithoutOperationIdDelete operation */ @@ -2887,17 +1630,16 @@ export * from './models';", /* 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 @@ -2932,7 +1674,7 @@ export function ApiErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): return json; } return { - + 'errorMessage': json['errorMessage'], }; } @@ -2945,7 +1687,7 @@ export function ApiErrorToJSON(value?: ApiError | null): any { return null; } return { - + 'errorMessage': value.errorMessage, }; } @@ -2955,17 +1697,16 @@ 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'; + /** * * @export @@ -3005,7 +1746,7 @@ export function PaginatedGet200ResponseFromJSONTyped(json: any, ignoreDiscrimina return json; } return { - + 'outputNextToken': !exists(json, 'outputNextToken') ? undefined : json['outputNextToken'], 'results': !exists(json, 'results') ? undefined : json['results'], }; @@ -3019,7 +1760,7 @@ export function PaginatedGet200ResponseToJSON(value?: PaginatedGet200Response | return null; } return { - + 'outputNextToken': value.outputNextToken, 'results': value.results, }; @@ -3030,17 +1771,16 @@ export function PaginatedGet200ResponseToJSON(value?: PaginatedGet200Response | /* 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 @@ -3074,7 +1814,7 @@ export function RegularGet200ResponseFromJSONTyped(json: any, ignoreDiscriminato return json; } return { - + 'foo': !exists(json, 'foo') ? undefined : json['foo'], }; } @@ -3087,7 +1827,7 @@ export function RegularGet200ResponseToJSON(value?: RegularGet200Response | null return null; } return { - + 'foo': value.foo, }; } @@ -3097,17 +1837,16 @@ export function RegularGet200ResponseToJSON(value?: RegularGet200Response | null /* 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 @@ -3141,7 +1880,7 @@ export function TestRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean return json; } return { - + 'myInput': !exists(json, 'myInput') ? undefined : json['myInput'], }; } @@ -3154,7 +1893,7 @@ export function TestRequestToJSON(value?: TestRequest | null): any { return null; } return { - + 'myInput': value.myInput, }; } @@ -3164,16 +1903,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 { @@ -3216,7 +1953,7 @@ export function TestResponseFromJSONTyped(json: any, ignoreDiscriminator: boolea return json; } return { - + 'messages': ((json['messages'] as Array).map(TestResponseMessagesInnerFromJSON)), }; } @@ -3229,7 +1966,7 @@ export function TestResponseToJSON(value?: TestResponse | null): any { return null; } return { - + 'messages': ((value.messages as Array).map(TestResponseMessagesInnerToJSON)), }; } @@ -3239,17 +1976,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 @@ -3290,7 +2026,7 @@ export function TestResponseMessagesInnerFromJSONTyped(json: any, ignoreDiscrimi return json; } return { - + 'message': !exists(json, 'message') ? undefined : json['message'], 'id': json['id'], }; @@ -3304,7 +2040,7 @@ export function TestResponseMessagesInnerToJSON(value?: TestResponseMessagesInne return null; } return { - + 'message': value.message, 'id': value.id, }; @@ -3324,17 +2060,15 @@ export * from './TestResponseMessagesInner'; /* 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. */ - export const BASE_PATH = "http://localhost".replace(/\\/+$/, ""); export interface ConfigurationParameters { @@ -3728,43 +2462,5 @@ export class TextApiResponse { }; } ", - "tsconfig.dev.json": { - "compilerOptions": { - "alwaysStrict": false, - "declaration": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "inlineSources": true, - "jsx": "react", - "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/__snapshots__/typescript.test.ts.snap b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript.test.ts.snap index f13dc8167..e2473ee31 100644 --- a/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript.test.ts.snap +++ b/packages/type-safe-api/test/scripts/generators/__snapshots__/typescript.test.ts.snap @@ -2,151 +2,51 @@ exports[`Typescript Client Code Generation Script Unit Tests Generates With multiple-tags.yaml 1`] = ` { - ".gitignore": "wwwroot/*.js -node_modules -typings -dist -", - ".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/DefaultApi/OperationConfig.ts -src/apis/Tag1Api.ts -src/apis/Tag2Api.ts -src/apis/index.ts -src/index.ts -src/response/response.ts + ".tsapi-manifest": "src/index.ts src/runtime.ts -tsconfig.esm.json -tsconfig.json src/interceptors/try-catch.ts src/interceptors/cors.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/interceptors/index.ts +src/apis/DefaultApi/OperationConfig.ts +src/response/response.ts +src/apis/DefaultApi.ts +src/apis/Tag1Api.ts +src/apis/Tag2Api.ts +src/apis/index.ts", "src/apis/DefaultApi.ts": "/* tslint:disable */ /* eslint-disable */ /** * Multiple Tags Test - * 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 * as runtime from '../runtime'; + /** * */ export class DefaultApi extends runtime.BaseAPI { - /** + * */ async neitherRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/neither\`, method: 'GET', @@ -158,22 +58,20 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async neither(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.neitherRaw(initOverrides); } } + ", "src/apis/DefaultApi/OperationConfig.ts": "// Import models import { } from '../../models'; // Import request parameter interfaces import { - - - - } from '..'; // API Gateway Types @@ -413,6 +311,7 @@ export interface NeitherRequestParameters { export type NeitherRequestBody = never; export type Neither200OperationResponse = OperationResponse<200, undefined>; + export type NeitherOperationResponses = | Neither200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -465,6 +364,7 @@ export const neitherHandler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -519,6 +419,7 @@ export interface BothRequestParameters { export type BothRequestBody = never; export type Both200OperationResponse = OperationResponse<200, undefined>; + export type BothOperationResponses = | Both200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -571,6 +472,7 @@ export const bothHandler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -625,6 +527,7 @@ export interface Tag1RequestParameters { export type Tag1RequestBody = never; export type Tag1200OperationResponse = OperationResponse<200, undefined>; + export type Tag1OperationResponses = | Tag1200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -677,6 +580,7 @@ export const tag1Handler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -731,6 +635,7 @@ export interface Tag2RequestParameters { export type Tag2RequestBody = never; export type Tag2200OperationResponse = OperationResponse<200, undefined>; + export type Tag2OperationResponses = | Tag2200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -783,6 +688,7 @@ export const tag2Handler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -880,31 +786,34 @@ export const handlerRouter = (props: HandlerRouterProps< /* eslint-disable */ /** * Multiple Tags Test - * 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 * as runtime from '../runtime'; + + /** * */ export class Tag1Api extends runtime.BaseAPI { - /** + * */ async bothRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/both\`, method: 'GET', @@ -916,18 +825,23 @@ export class Tag1Api extends runtime.BaseAPI { } /** + * */ async both(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.bothRaw(initOverrides); } /** + * */ async tag1Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/tag1\`, method: 'GET', @@ -939,42 +853,46 @@ export class Tag1Api extends runtime.BaseAPI { } /** + * */ async tag1(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.tag1Raw(initOverrides); } } + ", "src/apis/Tag2Api.ts": "/* tslint:disable */ /* eslint-disable */ /** * Multiple Tags Test - * 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 * as runtime from '../runtime'; + /** * */ export class Tag2Api extends runtime.BaseAPI { - /** + * */ async tag2Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/tag2\`, method: 'GET', @@ -986,12 +904,14 @@ export class Tag2Api extends runtime.BaseAPI { } /** + * */ async tag2(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.tag2Raw(initOverrides); } } + ", "src/apis/index.ts": "/* tslint:disable */ /* eslint-disable */ @@ -1361,17 +1281,15 @@ export class Response { /* eslint-disable */ /** * Multiple Tags Test - * 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. */ - export const BASE_PATH = "http://localhost".replace(/\\/+$/, ""); export interface ConfigurationParameters { @@ -1770,154 +1688,38 @@ export class TextApiResponse { exports[`Typescript Client Code Generation Script Unit Tests Generates With single.yaml 1`] = ` { - ".gitignore": "wwwroot/*.js -node_modules -typings -dist -", - ".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 + ".tsapi-manifest": "src/index.ts +src/runtime.ts +src/interceptors/try-catch.ts +src/interceptors/cors.ts +src/interceptors/powertools/logger.ts +src/interceptors/powertools/tracer.ts +src/interceptors/powertools/metrics.ts +src/interceptors/index.ts src/apis/DefaultApi/OperationConfig.ts +src/response/response.ts +src/apis/DefaultApi.ts src/apis/index.ts -src/index.ts -src/models/ApiError.ts -src/models/ApiError.ts +src/models/index.ts src/models/ApiError.ts src/models/MapResponse.ts -src/models/MapResponse.ts -src/models/MapResponse.ts src/models/MapResponseMapPropertyValue.ts -src/models/MapResponseMapPropertyValue.ts -src/models/MapResponseMapPropertyValue.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/response/response.ts -src/runtime.ts -tsconfig.esm.json -tsconfig.json -src/interceptors/try-catch.ts -src/interceptors/cors.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/models/TestResponseMessagesInner.ts", "src/apis/DefaultApi.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 + * + * NOTE: This class is auto generated. * Do not edit the class manually. */ - import * as runtime from '../runtime'; import type { ApiError, @@ -1940,6 +1742,8 @@ export interface AnyRequestResponseRequest { body?: any | null; } + + export interface MediaTypesRequest { body: Blob; } @@ -1959,20 +1763,23 @@ export interface OperationOneRequest { xMultiValueHeaderParam?: Array; } + /** * */ export class DefaultApi extends runtime.BaseAPI { - /** + * */ async anyRequestResponseRaw(requestParameters: AnyRequestResponseRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; + const response = await this.request({ path: \`/any-request-response\`, method: 'PUT', @@ -1985,6 +1792,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async anyRequestResponse(requestParameters: AnyRequestResponseRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.anyRequestResponseRaw(requestParameters, initOverrides); @@ -1992,12 +1800,16 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async emptyRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/empty-response\`, method: 'PUT', @@ -2009,18 +1821,23 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async empty(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.emptyRaw(initOverrides); } /** + * */ async mapResponseRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/map-response\`, method: 'GET', @@ -2032,6 +1849,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async mapResponse(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.mapResponseRaw(initOverrides); @@ -2039,6 +1857,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async mediaTypesRaw(requestParameters: MediaTypesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.body === null || requestParameters.body === undefined) { @@ -2047,10 +1866,12 @@ export class DefaultApi extends runtime.BaseAPI { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/pdf'; + const response = await this.request({ path: \`/different-media-type\`, method: 'POST', @@ -2063,6 +1884,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async mediaTypes(requestParameters: MediaTypesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.mediaTypesRaw(requestParameters, initOverrides); @@ -2070,6 +1892,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async multipleContentTypesRaw(requestParameters: MultipleContentTypesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.testRequest === null || requestParameters.testRequest === undefined) { @@ -2078,10 +1901,12 @@ export class DefaultApi extends runtime.BaseAPI { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; + const response = await this.request({ path: \`/multiple-content-types\`, method: 'POST', @@ -2094,6 +1919,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async multipleContentTypes(requestParameters: MultipleContentTypesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.multipleContentTypesRaw(requestParameters, initOverrides); @@ -2101,6 +1927,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async operationOneRaw(requestParameters: OperationOneRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.param1 === null || requestParameters.param1 === undefined) { @@ -2145,6 +1972,7 @@ export class DefaultApi extends runtime.BaseAPI { queryParameters['param4'] = requestParameters.param4; } + const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; @@ -2152,7 +1980,6 @@ export class DefaultApi extends runtime.BaseAPI { if (requestParameters.xHeaderParam !== undefined && requestParameters.xHeaderParam !== null) { headerParameters['x-header-param'] = String(requestParameters.xHeaderParam); } - if (requestParameters.xMultiValueHeaderParam) { headerParameters['x-multi-value-header-param'] = requestParameters.xMultiValueHeaderParam.join(runtime.COLLECTION_FORMATS["csv"]); } @@ -2169,6 +1996,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async operationOne(requestParameters: OperationOneRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.operationOneRaw(requestParameters, initOverrides); @@ -2176,12 +2004,16 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async withoutOperationIdDeleteRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ path: \`/without-operation-id\`, method: 'DELETE', @@ -2193,6 +2025,7 @@ export class DefaultApi extends runtime.BaseAPI { } /** + * */ async withoutOperationIdDelete(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.withoutOperationIdDeleteRaw(initOverrides); @@ -2200,6 +2033,7 @@ export class DefaultApi extends runtime.BaseAPI { } } + ", "src/apis/DefaultApi/OperationConfig.ts": "// Import models import { @@ -2225,12 +2059,9 @@ import { // Import request parameter interfaces import { AnyRequestResponseRequest, - - MediaTypesRequest, MultipleContentTypesRequest, OperationOneRequest, - } from '..'; // API Gateway Types @@ -2252,7 +2083,7 @@ export const OperationLookup = { anyRequestResponse: { path: '/any-request-response', method: 'PUT', - contentTypes: ['application/json',], + contentTypes: ['application/json'], }, empty: { path: '/empty-response', @@ -2267,17 +2098,17 @@ export const OperationLookup = { 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'], }, operationOne: { path: '/path/{pathParam}', method: 'POST', - contentTypes: ['application/json',], + contentTypes: ['application/json'], }, withoutOperationIdDelete: { path: '/without-operation-id', @@ -2488,6 +2319,7 @@ export interface AnyRequestResponseRequestParameters { export type AnyRequestResponseRequestBody = string; export type AnyRequestResponse200OperationResponse = OperationResponse<200, string>; + export type AnyRequestResponseOperationResponses = | AnyRequestResponse200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -2540,6 +2372,7 @@ export const anyRequestResponseHandler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -2560,7 +2393,7 @@ export const anyRequestResponseHandler = ( const demarshal = (bodyString: string): any => { return bodyString; }; - const body = parseBody(event.body, demarshal, ['application/json',]) as AnyRequestResponseRequestBody; + const body = parseBody(event.body, demarshal, ['application/json']) as AnyRequestResponseRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); const response = await chain.next({ @@ -2594,6 +2427,7 @@ export interface EmptyRequestParameters { export type EmptyRequestBody = never; export type Empty204OperationResponse = OperationResponse<204, undefined>; + export type EmptyOperationResponses = | Empty204OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -2646,6 +2480,7 @@ export const emptyHandler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -2700,6 +2535,7 @@ export interface MapResponseRequestParameters { export type MapResponseRequestBody = never; export type MapResponse200OperationResponse = OperationResponse<200, MapResponse>; + export type MapResponseOperationResponses = | MapResponse200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -2753,6 +2589,7 @@ export const mapResponseHandler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -2807,6 +2644,7 @@ export interface MediaTypesRequestParameters { export type MediaTypesRequestBody = string; export type MediaTypes200OperationResponse = OperationResponse<200, string>; + export type MediaTypesOperationResponses = | MediaTypes200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -2859,6 +2697,7 @@ export const mediaTypesHandler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -2879,7 +2718,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); const response = await chain.next({ @@ -2913,6 +2752,7 @@ export interface MultipleContentTypesRequestParameters { export type MultipleContentTypesRequestBody = TestRequest; export type MultipleContentTypes200OperationResponse = OperationResponse<200, string>; + export type MultipleContentTypesOperationResponses = | MultipleContentTypes200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -2965,6 +2805,7 @@ export const multipleContentTypesHandler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -2985,7 +2826,7 @@ export const multipleContentTypesHandler = ( const demarshal = (bodyString: string): any => { return TestRequestFromJSON(JSON.parse(bodyString)); }; - 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); const response = await chain.next({ @@ -3027,6 +2868,7 @@ export type OperationOneRequestBody = TestRequest; export type OperationOne200OperationResponse = OperationResponse<200, TestResponse>; export type OperationOne400OperationResponse = OperationResponse<400, ApiError>; + export type OperationOneOperationResponses = | OperationOne200OperationResponse | OperationOne400OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -3096,6 +2938,7 @@ export const operationOneHandler = ( xHeaderParam: coerceParameter("x-header-param", "string", false || false || false, rawSingleValueParameters, rawMultiValueParameters, true) as string, param4: coerceParameter("param4", "string", false || false || false, rawSingleValueParameters, rawMultiValueParameters, false) as string | undefined, xMultiValueHeaderParam: coerceParameter("x-multi-value-header-param", "Array", false || false || false, rawSingleValueParameters, rawMultiValueParameters, false) as Array | undefined, + }; } catch (e: any) { const res = { @@ -3116,7 +2959,7 @@ export const operationOneHandler = ( const demarshal = (bodyString: string): any => { return TestRequestFromJSON(JSON.parse(bodyString)); }; - const body = parseBody(event.body, demarshal, ['application/json',]) as OperationOneRequestBody; + const body = parseBody(event.body, demarshal, ['application/json']) as OperationOneRequestBody; const chain = buildHandlerChain(...additionalInterceptors, ...handlers); const response = await chain.next({ @@ -3150,6 +2993,7 @@ export interface WithoutOperationIdDeleteRequestParameters { export type WithoutOperationIdDeleteRequestBody = never; export type WithoutOperationIdDelete200OperationResponse = OperationResponse<200, TestResponse>; + export type WithoutOperationIdDeleteOperationResponses = | WithoutOperationIdDelete200OperationResponse ; // Type that the handler function provided to the wrapper must conform to @@ -3203,6 +3047,7 @@ export const withoutOperationIdDeleteHandler = ( try { requestParameters = { + }; } catch (e: any) { const res = { @@ -3607,17 +3452,16 @@ export const tryCatchInterceptor = buildTryCatchInterceptor(500, { message: 'Int /* 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 @@ -3652,7 +3496,7 @@ export function ApiErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): return json; } return { - + 'errorMessage': json['errorMessage'], }; } @@ -3665,7 +3509,7 @@ export function ApiErrorToJSON(value?: ApiError | null): any { return null; } return { - + 'errorMessage': value.errorMessage, }; } @@ -3675,16 +3519,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 { MapResponseMapPropertyValue } from './MapResponseMapPropertyValue'; import { @@ -3727,7 +3569,7 @@ export function MapResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean return json; } return { - + 'mapProperty': (mapValues(json['mapProperty'], MapResponseMapPropertyValueFromJSON)), }; } @@ -3740,7 +3582,7 @@ export function MapResponseToJSON(value?: MapResponse | null): any { return null; } return { - + 'mapProperty': (mapValues(value.mapProperty, MapResponseMapPropertyValueToJSON)), }; } @@ -3750,17 +3592,16 @@ export function MapResponseToJSON(value?: MapResponse | 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 @@ -3801,7 +3642,7 @@ export function MapResponseMapPropertyValueFromJSONTyped(json: any, ignoreDiscri return json; } return { - + 'a': json['a'], 'b': !exists(json, 'b') ? undefined : json['b'], }; @@ -3815,7 +3656,7 @@ export function MapResponseMapPropertyValueToJSON(value?: MapResponseMapProperty return null; } return { - + 'a': value.a, 'b': value.b, }; @@ -3826,17 +3667,16 @@ export function MapResponseMapPropertyValueToJSON(value?: MapResponseMapProperty /* 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 @@ -3870,7 +3710,7 @@ export function TestRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean return json; } return { - + 'myInput': !exists(json, 'myInput') ? undefined : json['myInput'], }; } @@ -3883,7 +3723,7 @@ export function TestRequestToJSON(value?: TestRequest | null): any { return null; } return { - + 'myInput': value.myInput, }; } @@ -3893,16 +3733,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 { @@ -3945,7 +3783,7 @@ export function TestResponseFromJSONTyped(json: any, ignoreDiscriminator: boolea return json; } return { - + 'messages': ((json['messages'] as Array).map(TestResponseMessagesInnerFromJSON)), }; } @@ -3958,7 +3796,7 @@ export function TestResponseToJSON(value?: TestResponse | null): any { return null; } return { - + 'messages': ((value.messages as Array).map(TestResponseMessagesInnerToJSON)), }; } @@ -3968,17 +3806,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 @@ -4019,7 +3856,7 @@ export function TestResponseMessagesInnerFromJSONTyped(json: any, ignoreDiscrimi return json; } return { - + 'message': !exists(json, 'message') ? undefined : json['message'], 'id': json['id'], }; @@ -4033,7 +3870,7 @@ export function TestResponseMessagesInnerToJSON(value?: TestResponseMessagesInne return null; } return { - + 'message': value.message, 'id': value.id, }; @@ -4111,17 +3948,15 @@ export class Response { /* 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. */ - export const BASE_PATH = "http://localhost".replace(/\\/+$/, ""); export interface ConfigurationParameters { diff --git a/packages/type-safe-api/test/scripts/generators/typescript-cdk-infrastructure.test.ts b/packages/type-safe-api/test/scripts/generators/typescript-cdk-infrastructure.test.ts index db9797151..e47aff585 100644 --- a/packages/type-safe-api/test/scripts/generators/typescript-cdk-infrastructure.test.ts +++ b/packages/type-safe-api/test/scripts/generators/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 { GeneratedTypescriptCdkInfrastructureProject } from "../../../src/project/codegen/infrastructure/cdk/generated-typescript-cdk-infrastructure-project"; import { GeneratedTypescriptRuntimeProject } from "../../../src/project/codegen/runtime/generated-typescript-runtime-project"; import { withTmpDirSnapshot } from "../../project/snapshot-utils"; @@ -33,16 +32,11 @@ describe("Typescript 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/generators/generate.js" )} ${project.buildGenerateCommandArgs()}`, { cwd: infraOutdir, @@ -84,16 +78,11 @@ describe("Typescript Infrastructure Code Generation Script Unit Tests", () => { }, 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/generators/generate.js" )} ${project.buildGenerateCommandArgs()}`, { cwd: infraOutdir, @@ -127,14 +116,10 @@ describe("Typescript Infrastructure Code Generation Script Unit Tests", () => { generatedHandlers: handlers, }); project.synth(); - 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/generators/generate.js" )} ${project.buildGenerateCommandArgs()}`, { cwd: infraOutdir, diff --git a/packages/type-safe-api/test/scripts/generators/typescript-lambda-handlers.test.ts b/packages/type-safe-api/test/scripts/generators/typescript-lambda-handlers.test.ts index 4732a5160..d93c5cfcb 100644 --- a/packages/type-safe-api/test/scripts/generators/typescript-lambda-handlers.test.ts +++ b/packages/type-safe-api/test/scripts/generators/typescript-lambda-handlers.test.ts @@ -31,13 +31,10 @@ describe("Typescript 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/generators/generate.js" )} ${project.buildGenerateCommandArgs()}`, { cwd: handlersOutdir, diff --git a/packages/type-safe-api/test/scripts/generators/typescript-react-query-hooks.test.ts b/packages/type-safe-api/test/scripts/generators/typescript-react-query-hooks.test.ts index b82cb391e..c7a8a88b0 100644 --- a/packages/type-safe-api/test/scripts/generators/typescript-react-query-hooks.test.ts +++ b/packages/type-safe-api/test/scripts/generators/typescript-react-query-hooks.test.ts @@ -25,16 +25,10 @@ describe("Typescript React Query Hooks 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/generators/generate.js" )} ${project.buildGenerateCommandArgs()}`, { cwd: outdir, @@ -42,11 +36,7 @@ describe("Typescript React Query Hooks Code Generation Script Unit Tests", () => ); }, { - excludeGlobs: [ - ...TypescriptReactQueryHooksLibrary.openApiIgnorePatterns, - ".projen/*", - "spec.yaml", - ], + excludeGlobs: [".projen/*", "spec.yaml"], } ) ).toMatchSnapshot(); diff --git a/packages/type-safe-api/test/scripts/generators/typescript.test.ts b/packages/type-safe-api/test/scripts/generators/typescript.test.ts index 5a99a9cca..eadf1f460 100644 --- a/packages/type-safe-api/test/scripts/generators/typescript.test.ts +++ b/packages/type-safe-api/test/scripts/generators/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 { GeneratedTypescriptRuntimeProject } from "../../../src/project/codegen/runtime/generated-typescript-runtime-project"; import { withTmpDirSnapshot } from "../../project/snapshot-utils"; @@ -26,16 +25,10 @@ describe("Typescript Client Code Generation Script Unit Tests", () => { outdir, 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/generators/generate.js" )} ${project.buildGenerateCommandArgs()}`, { cwd: outdir, @@ -43,10 +36,7 @@ describe("Typescript Client Code Generation Script Unit Tests", () => { ); }, { - excludeGlobs: [ - ...GeneratedTypescriptRuntimeProject.openApiIgnorePatterns, - "spec.yaml", - ], + excludeGlobs: ["spec.yaml"], } ) ).toMatchSnapshot(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9ba837653..0da0ce70e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -121,6 +121,9 @@ importers: ts-node: specifier: 10.9.2 version: 10.9.2(@types/node@18.19.39)(typescript@5.5.2) + tsx: + specifier: ^4.19.1 + version: 4.19.1 typescript: specifier: 5.5.2 version: 5.5.2 @@ -259,7 +262,7 @@ importers: version: 0.6.7 ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -413,7 +416,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -570,7 +573,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -664,7 +667,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -746,7 +749,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -828,7 +831,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -913,7 +916,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -1007,7 +1010,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -1129,6 +1132,9 @@ importers: '@nx/devkit': specifier: '16' version: 16.10.0(nx@16.10.0) + '@types/ejs': + specifier: 3.1.5 + version: 3.1.5 '@types/fs-extra': specifier: 11.0.4 version: 11.0.4 @@ -1216,6 +1222,12 @@ importers: downlevel-dts: specifier: 0.11.0 version: 0.11.0 + ejs: + specifier: 3.1.10 + version: 3.1.10 + esbuild: + specifier: ^0.23.1 + version: 0.23.1 eslint: specifier: ^8 version: 8.57.0 @@ -1267,6 +1279,9 @@ importers: nx: specifier: '16' version: 16.10.0 + parse-openapi: + specifier: 0.0.1 + version: 0.0.1 prettier: specifier: 2.8.8 version: 2.8.8 @@ -1287,7 +1302,7 @@ importers: version: 2.4.2(jest@29.7.0)(typescript@5.5.2) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -1380,7 +1395,7 @@ importers: version: 2.8.8 ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) ts-node: specifier: 10.9.2 version: 10.9.2(@types/node@18.19.39)(typescript@5.5.2) @@ -1462,7 +1477,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -1544,7 +1559,7 @@ importers: version: 0.82.8(constructs@10.3.0) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -1582,6 +1597,9 @@ importers: '@faker-js/faker': specifier: 8.1.0 version: 8.1.0 + '@types/ejs': + specifier: 3.1.5 + version: 3.1.5 '@types/fs-extra': specifier: 11.0.4 version: 11.0.4 @@ -1609,6 +1627,12 @@ importers: constructs: specifier: 10.3.0 version: 10.3.0 + ejs: + specifier: 3.1.10 + version: 3.1.10 + esbuild: + specifier: ^0.23.1 + version: 0.23.1 eslint: specifier: ^8 version: 8.57.0 @@ -1648,6 +1672,9 @@ importers: jsii-rosetta: specifier: 1.101.0 version: 1.101.0 + parse-openapi: + specifier: 0.0.1 + version: 0.0.1 prettier: specifier: 2.8.8 version: 2.8.8 @@ -1662,7 +1689,7 @@ importers: version: 2.4.2(jest@29.7.0)(typescript@5.5.2) ts-jest: specifier: 29.1.5 - version: 29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2) + version: 29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2) typescript: specifier: 5.5.2 version: 5.5.2 @@ -3081,6 +3108,222 @@ packages: dev: true optional: true + /@esbuild/aix-ppc64@0.23.1: + resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64@0.23.1: + resolution: {integrity: sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.23.1: + resolution: {integrity: sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.23.1: + resolution: {integrity: sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.23.1: + resolution: {integrity: sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.23.1: + resolution: {integrity: sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.23.1: + resolution: {integrity: sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.23.1: + resolution: {integrity: sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.23.1: + resolution: {integrity: sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.23.1: + resolution: {integrity: sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.23.1: + resolution: {integrity: sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.23.1: + resolution: {integrity: sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.23.1: + resolution: {integrity: sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.23.1: + resolution: {integrity: sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.23.1: + resolution: {integrity: sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.23.1: + resolution: {integrity: sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.23.1: + resolution: {integrity: sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.23.1: + resolution: {integrity: sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-arm64@0.23.1: + resolution: {integrity: sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.23.1: + resolution: {integrity: sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.23.1: + resolution: {integrity: sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.23.1: + resolution: {integrity: sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.23.1: + resolution: {integrity: sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.23.1: + resolution: {integrity: sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@eslint-community/eslint-utils@4.4.0(eslint@8.57.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -5367,6 +5610,10 @@ packages: dev: true optional: true + /@types/ejs@3.1.5: + resolution: {integrity: sha512-nv+GSx77ZtXiJzwKdsASqi+YQ5Z7vwHsTP0JY2SiQgjGckkBRKZnk8nIM+7oUZ1VCtuTz0+By4qVR7fqzp/Dfg==} + dev: true + /@types/fs-extra@11.0.4: resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} dependencies: @@ -7415,7 +7662,7 @@ packages: dependencies: semver: 7.6.2 shelljs: 0.8.5 - typescript: 5.7.0-dev.20240904 + typescript: 5.7.0-dev.20240930 dev: true /duplexer2@0.1.4: @@ -7623,6 +7870,38 @@ packages: is-date-object: 1.0.5 is-symbol: 1.0.4 + /esbuild@0.23.1: + resolution: {integrity: sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==} + engines: {node: '>=18'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.23.1 + '@esbuild/android-arm': 0.23.1 + '@esbuild/android-arm64': 0.23.1 + '@esbuild/android-x64': 0.23.1 + '@esbuild/darwin-arm64': 0.23.1 + '@esbuild/darwin-x64': 0.23.1 + '@esbuild/freebsd-arm64': 0.23.1 + '@esbuild/freebsd-x64': 0.23.1 + '@esbuild/linux-arm': 0.23.1 + '@esbuild/linux-arm64': 0.23.1 + '@esbuild/linux-ia32': 0.23.1 + '@esbuild/linux-loong64': 0.23.1 + '@esbuild/linux-mips64el': 0.23.1 + '@esbuild/linux-ppc64': 0.23.1 + '@esbuild/linux-riscv64': 0.23.1 + '@esbuild/linux-s390x': 0.23.1 + '@esbuild/linux-x64': 0.23.1 + '@esbuild/netbsd-x64': 0.23.1 + '@esbuild/openbsd-arm64': 0.23.1 + '@esbuild/openbsd-x64': 0.23.1 + '@esbuild/sunos-x64': 0.23.1 + '@esbuild/win32-arm64': 0.23.1 + '@esbuild/win32-ia32': 0.23.1 + '@esbuild/win32-x64': 0.23.1 + dev: true + /escalade@3.1.2: resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} engines: {node: '>=6'} @@ -11892,6 +12171,10 @@ packages: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + /parse-openapi@0.0.1: + resolution: {integrity: sha512-71W68G40YVvcgDyWInktzQ36V40aRfQR2sm3zu6vZS8Bx4I/FD9T5+wn8NVN5AEE+51hS150guIC+orvb8i4aA==} + dev: true + /parse-passwd@1.0.0: resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==} engines: {node: '>=0.10.0'} @@ -13477,7 +13760,7 @@ packages: engines: {node: '>=14.16'} dev: false - /ts-jest@29.1.5(@babel/core@7.24.7)(jest@29.7.0)(typescript@5.5.2): + /ts-jest@29.1.5(@babel/core@7.24.7)(esbuild@0.23.1)(jest@29.7.0)(typescript@5.5.2): resolution: {integrity: sha512-UuClSYxM7byvvYfyWdFI+/2UxMmwNyJb0NPkZPQE2hew3RurV7l7zURgOHAd/1I1ZdPpe3GUsXNXAcN8TFKSIg==} engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} hasBin: true @@ -13503,6 +13786,7 @@ packages: dependencies: '@babel/core': 7.24.7 bs-logger: 0.2.6 + esbuild: 0.23.1 fast-json-stable-stringify: 2.1.0 jest: 29.7.0(@types/node@18.19.39)(ts-node@10.9.2) jest-util: 29.7.0 @@ -13601,6 +13885,17 @@ packages: resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} dev: true + /tsx@4.19.1: + resolution: {integrity: sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA==} + engines: {node: '>=18.0.0'} + hasBin: true + dependencies: + esbuild: 0.23.1 + get-tsconfig: 4.7.5 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /tuf-js@1.1.7: resolution: {integrity: sha512-i3P9Kgw3ytjELUfpuKVDNBJvk4u5bXL6gskv572mcevPbSKCV3zt3djhmlEQ65yERjIbOSncy7U4cQJaB1CBCg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -13757,8 +14052,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.7.0-dev.20240904: - resolution: {integrity: sha512-iGi6VWFGOuxPvDfwfK1/8C172NWzC5gtC4G2dxqCQehrr86WTfFkc9aWucynaxZdwQNMqG1Iu83bmXD7CNHCmg==} + /typescript@5.7.0-dev.20240930: + resolution: {integrity: sha512-mGW96cpbwcYuc264UPqGpKBLNebFFtVEXRLPwSwxVEub9tSyMI+XGFGxsznop7pU8E1ntx4OC4cN1n5MnzO0+Q==} engines: {node: '>=14.17'} hasBin: true dev: true diff --git a/projenrc/projects/pdk-monorepo-project.ts b/projenrc/projects/pdk-monorepo-project.ts index 23c8fcafb..9d46fde1b 100644 --- a/projenrc/projects/pdk-monorepo-project.ts +++ b/projenrc/projects/pdk-monorepo-project.ts @@ -44,6 +44,7 @@ export class PDKMonorepoProject extends MonorepoTsProject { "husky", "got@^11.8.5", "@jsii/spec", + "tsx", ], monorepoUpgradeDepsOptions: { syncpackConfig: { diff --git a/projenrc/projects/type-safe-api-project.ts b/projenrc/projects/type-safe-api-project.ts index b37b473c1..f8bfaaf74 100644 --- a/projenrc/projects/type-safe-api-project.ts +++ b/projenrc/projects/type-safe-api-project.ts @@ -44,6 +44,10 @@ export class TypeSafeApiProject extends PDKProject { "ts-command-line-args@2.4.2", // Used by scripts "@faker-js/faker@8.1.0", // Used by scripts "reregexp@1.6.1", // Used by scripts + "ejs@3.1.10", // Used by scripts + "@types/ejs@3.1.5", // Used by scripts + "parse-openapi@0.0.1", // Used by scripts + "esbuild", ], deps: [ `${PDK_NAMESPACE}pdk-nag@^0.x`, @@ -68,6 +72,7 @@ export class TypeSafeApiProject extends PDKProject { "scripts/type-safe-api/custom/docs/asyncapi-html", "scripts/type-safe-api/custom/docs/asyncapi-markdown", "scripts/type-safe-api/generators/generate", + "scripts/type-safe-api/generators/generate.js", "scripts/type-safe-api/parser/parse-openapi-spec", "scripts/type-safe-api/custom/clean-openapi-generated-code/clean-openapi-generated-code", "scripts/type-safe-api/custom/mock-data/generate-mock-data", @@ -82,6 +87,8 @@ export class TypeSafeApiProject extends PDKProject { "type-safe-api.parse-openapi-spec": "scripts/type-safe-api/parser/parse-openapi-spec", "type-safe-api.generate": "scripts/type-safe-api/generators/generate", + "type-safe-api.generate-next": + "scripts/type-safe-api/generators/generate.js", "type-safe-api.generate-mock-data": "scripts/type-safe-api/custom/mock-data/generate-mock-data", "type-safe-api.generate-html-redoc-docs": @@ -132,6 +139,13 @@ export class TypeSafeApiProject extends PDKProject { ); this.gitignore.addPatterns(smithyAsyncTransformerJar); + // Build the generate script + const generateScript = "scripts/type-safe-api/generators/generate.js"; + this.preCompileTask.exec( + `esbuild --bundle scripts/type-safe-api/generators/generate.ts --platform=node --outfile=${generateScript}` + ); + this.gitignore.addPatterns(generateScript); + this.generateInterfaces(); }