diff --git a/docs/content/getting_started/index.md b/docs/content/getting_started/index.md index 3564a181a..366ca32ba 100644 --- a/docs/content/getting_started/index.md +++ b/docs/content/getting_started/index.md @@ -192,7 +192,7 @@ To install these, follow the below links: !!!note - If you are using another modelling language (for example OpenAPI), these are not required. + If you are using another modelling language (for example TypeSpec or OpenAPI), these are not required. ### Language specific diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/.pages.yml b/packages/type-safe-api/docs/developer_guides/type-safe-api/.pages.yml index 5aeb390e1..1b37315dc 100644 --- a/packages/type-safe-api/docs/developer_guides/type-safe-api/.pages.yml +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/.pages.yml @@ -4,6 +4,7 @@ nav: - "REST APIs": - "Getting Started": getting_started.md - "Using Smithy": using_smithy.md + - "Using TypeSpec": using_typespec.md - "Using OpenAPI": using_openapi.md - "Lambda Handlers": lambda_handlers.md - "Interceptors": interceptors.md @@ -16,6 +17,7 @@ nav: - "WebSocket APIs": - "Getting Started": websocket_getting_started.md - "Using Smithy": websocket_using_smithy.md + - "Using TypeSpec": websocket_using_typespec.md - "Using OpenAPI": websocket_using_openapi.md - "Lambda Handlers": websocket_lambda_handlers.md - "Server SDKs": websocket_server_sdk.md diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/getting_started.md b/packages/type-safe-api/docs/developer_guides/type-safe-api/getting_started.md index 0bdc3e8eb..c51457c8f 100644 --- a/packages/type-safe-api/docs/developer_guides/type-safe-api/getting_started.md +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/getting_started.md @@ -10,7 +10,7 @@ This section describes how to get started with the Type Safe API. For more infor The `TypeSafeApiProject` projen project sets up the project structure for you. Consider the following parameters when creating the project: -- `model` - Configure the API model. Select a `language` for the model from either [Smithy](https://smithy.io/2.0/) or [OpenAPI v3](https://swagger.io/specification/), and provide `options.smithy` or `options.openapi` depending on your choice. +- `model` - Configure the API model. Select a `language` for the model from either [Smithy](https://smithy.io/2.0/), [TypeSpec](https://typespec.io/) or [OpenAPI v3](https://swagger.io/specification/), and provide `options.smithy`, `options.typeSpec` or `options.openapi` depending on your choice. - `infrastructure` - Select the `language` you are writing your CDK infrastructure in. A construct will be generated in this language which can be used to deploy the API. - `handlers` - Optionally select the `languages` in which you wish to write lambda handlers for operations in. - `runtime` - Optionally configure additional generated runtime projects. Include one or more `languages` you want to write your client and/or server-side code in. These projects contain generated types defined in your model, as well as type-safe lambda handler wrappers for implementing each operation. You'll notice runtime packages are automatically generated for languages you picked for `infrastructure` and `handlers`. @@ -63,7 +63,7 @@ npx projen new --from @aws/pdk monorepo-ts --package-manager=pnpm name: "myapi", parent: monorepo, outdir: "packages/api", - // Smithy as the model language. You can also use ModelLanguage.OPENAPI + // Smithy as the model language. You can also use ModelLanguage.TYPESPEC or ModelLanguage.OPENAPI model: { language: ModelLanguage.SMITHY, options: { @@ -240,6 +240,19 @@ The generated runtime projects include lambda handler wrappers which provide typ } ``` +=== "TYPESPEC" + + Use the `@handler` decorator, and specify the language you wish to implement the operation in. + + ```tsp hl_lines="3" + @get + @route("/hello") + @handler({ language: "typescript" }) + op SayHello(@query name: string): { + message: string; + }; + ``` + === "OPENAPI" Use the `x-handler` vendor extension, specifying the language you wish to implement this operation in. @@ -735,6 +748,32 @@ Add the new operation in the `model` project, for example: } ``` +=== "TYPESPEC" + + In `model/src/main.tsp` or another `.tsp` file somewhere in the `model/src` directory, define the operation: + + ```tsp + namespace MyApi; // <- ensure the namespace is the same as in main.tsp if defining in another file + + /** + * Documentation about the operation can go here + */ + @post + @route("/goodbye") + @handler({ language: "typescript" }) // <- you can also choose "python" or "java" + op SayGoodbye( + name: string, + ): { + message: string; + }; + ``` + + If you defined your operation in a different file, you must import it in `model/src/main.tsp`: + + ```tsp + import "./operations/say-goodbye.tsp"; + ``` + === "OPENAPI" In `model/src/main/openapi/main.yaml`, add the new operation under `paths`, and any new schemas under `components.schemas`. diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/index.md b/packages/type-safe-api/docs/developer_guides/type-safe-api/index.md index 2ae2cb00f..6098066da 100644 --- a/packages/type-safe-api/docs/developer_guides/type-safe-api/index.md +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/index.md @@ -6,9 +6,9 @@ > Define your REST or WebSocket API's declaratively in a type-safe manner to reduce preventable issues and increase overall productivity. -The _type-safe-api_ package provides projen projects which allow you to define a REST or WebSocket API using either [Smithy](https://smithy.io/2.0/) or [OpenAPI v3](https://swagger.io/specification/), and constructs which manage deploying these APIs on API Gateway. +The _type-safe-api_ package provides projen projects which allow you to define a REST or WebSocket API using [Smithy](https://smithy.io/2.0/), [TypeSpec](https://typespec.io/) or [OpenAPI v3](https://swagger.io/specification/), and constructs which manage deploying these APIs on API Gateway. -You can define your APIs using [Smithy](https://smithy.io/2.0/) or [OpenAPI v3](https://swagger.io/specification/), and leverage the power of generated client and server types, infrastructure, documentation, and automatic input validation. +You can define your APIs using [Smithy](https://smithy.io/2.0/), [TypeSpec](https://typespec.io/) or [OpenAPI v3](https://swagger.io/specification/), and leverage the power of generated client and server types, infrastructure, documentation, and automatic input validation. !!! note @@ -16,7 +16,7 @@ You can define your APIs using [Smithy](https://smithy.io/2.0/) or [OpenAPI v3]( ## How does it work? -Use the projen projects vended by Type Safe API to create REST APIs and WebSocket APIs. Model your API in either Smithy or OpenAPI. The project will generate type-safe clients, server-side bindings and CDK constructs in your desired languages so you can focus on implementing the business logic for your application. +Use the projen projects vended by Type Safe API to create REST APIs and WebSocket APIs. Model your API in either Smithy, TypeSpec or OpenAPI. The project will generate type-safe clients, server-side bindings and CDK constructs in your desired languages so you can focus on implementing the business logic for your application. !!! note @@ -26,10 +26,7 @@ The `TypeSafeApiProject` projen project creates a REST API, and produces the fol ``` |_ model/ - |_ src/ - |_ main/ - |_ smithy - your API definition if you chose ModelLanguage.SMITHY - |_ openapi - your API definition if you chose ModelLanguage.OPENAPI + |_ src - your model source, in Smithy, TypeSpec or OpenAPI depending on your selected model language |_ handlers/ |_ typescript - lambda handlers for operations you choose to implement in TypeScript |_ python - lambda handlers for operations you choose to implement in Python diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/using_openapi.md b/packages/type-safe-api/docs/developer_guides/type-safe-api/using_openapi.md index 3a450c540..fe8247e41 100644 --- a/packages/type-safe-api/docs/developer_guides/type-safe-api/using_openapi.md +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/using_openapi.md @@ -1,6 +1,6 @@ # Using OpenAPI -As an alternative to [Smithy](./using_smithy.md), you can use [OpenAPI Version 3.0.3](https://swagger.io/specification/) to define your API. +As an alternative to [Smithy](./using_smithy.md) or [TypeSpec](./using_typespec.md), you can use [OpenAPI Version 3.0.3](https://swagger.io/specification/) to define your API. To use OpenAPI, in `TypeSafeApiProject`, specify it as the `model.language`. diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/using_typespec.md b/packages/type-safe-api/docs/developer_guides/type-safe-api/using_typespec.md new file mode 100644 index 000000000..b29ed95ae --- /dev/null +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/using_typespec.md @@ -0,0 +1,136 @@ +# Using TypeSpec + +You can use [TypeSpec](https://typespec.io/), an interface definition language (IDL) to model your APIs. To use TypeSpec, in `TypeSafeApiProject`, specify it as your `model.language`. + +Use the `namespace` to name your API. The convention is to use `PascalCase` to define your namespace. + +=== "TS" + + ```ts + new TypeSafeApiProject({ + model: { + language: ModelLanguage.TYPESPEC, + options: { + typeSpec: { + namespace: "MyApi" + }, + }, + }, + ... + }); + ``` + +=== "JAVA" + + ```java + TypeSafeApiProject.Builder.create() + .model(ModelConfiguration.builder() + .language(ModelLanguage.SMITHY) + .options(ModelOptions.builder() + .typeSpec(TypeSpecModelOptions.builder() + .namespace("MyApi") + .build()) + .build()) + .build()) + ... + .build(); + ``` + +=== "PYTHON" + + ```python + TypeSafeApiProject( + model=ModelConfiguration( + language=ModelLanguage.SMITHY, + options=ModelOptions( + type_spec=TypeSpecModelOptions( + namespace="MyApi" + ) + ) + ), + ... + ) + ``` + +!!!tip + + Use the same namespace in all of your `.tsp` files to ensure they are included in your API. + +## Using the TypeSpec IDL + +For more information on how use TypeSpec for writing models, refer to the [TypeSpec documentation](https://typespec.io/docs/getting-started/getting-started-rest/01-setup-basic-syntax/). + +You will find your API model in `model/src/main.tsp`: + +```tsp +import "@typespec/http"; +import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; + +import "./types/errors.tsp"; + +using Http; +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyApi", +}) +@info({ + version: "1.0", +}) +namespace MyApi; + +@get +@route("/hello") +@handler({ language: "typescript" }) +op SayHello(@query name: string): + | { + message: string; + } + | BadRequestError + | NotAuthorizedError + | NotFoundError + | InternalFailureError; +``` + +### Splitting your model definition + +You can split your model definition into multiple `.tsp` files in the `model/src` folder. For example, you can structure your model as follows: + +``` +model/src + |_ operations/ + |_ say-hello.tsp + |_ models/ + |_ say-hello-input.tsp + |_ say-hello-output.tsp + |_ main.tsp +``` + +### Defining models + +In TypeSpec, you can define and reuse structures called `models`. For example, one might define a model named `Foo` in `models/foo.tsp`: + +```tsp +namespace MyApi; + +model Foo { + member: string; +} +``` + +You can reference this model in other `.tsp` files so long as you import it, for example: + +```tsp +import "./foo.tsp"; + +namespace MyApi; + +model Bar { + foo: Foo; +} +``` diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_getting_started.md b/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_getting_started.md index 6d3a45bf4..5f29e0839 100644 --- a/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_getting_started.md +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_getting_started.md @@ -10,7 +10,7 @@ This section describes how to get started with the Type Safe WebSocket API. For The `TypeSafeWebSocketApiProject` projen project sets up the project structure for you. Consider the following parameters when creating the project: -- `model` - Configure the API model. Select a `language` for the model from either [Smithy](https://smithy.io/2.0/) or [OpenAPI v3](https://swagger.io/specification/), and provide `options.smithy` or `options.openapi` depending on your choice. +- `model` - Configure the API model. Select a `language` for the model from either [Smithy](https://smithy.io/2.0/), [TypeSpec](https://typespec.io/) or [OpenAPI v3](https://swagger.io/specification/), and provide `options.smithy`, `options.typeSpec` or `options.openapi` depending on your choice. - `infrastructure` - Select the `language` you are writing your CDK infrastructure in. A construct will be generated in this language which can be used to deploy the API. - `handlers` - Optionally select the `languages` in which you wish to write lambda handlers for operations in. - `runtime` - Optionally configure additional generated runtime projects. Include one or more `languages` you want to write your server-side code in. These projects contain generated types defined in your model, as well as type-safe lambda handler wrappers for implementing each operation, and server SDKs for sending messages to connected clients. You'll notice runtime packages are automatically generated for languages you picked for `infrastructure` and `handlers`. @@ -60,7 +60,7 @@ npx projen new --from @aws/pdk monorepo-ts --package-manager=pnpm name: "myapi", parent: monorepo, outdir: "packages/api", - // Smithy as the model language. You can also use ModelLanguage.OPENAPI + // Smithy as the model language. You can also use ModelLanguage.TYPESPEC or ModelLanguage.OPENAPI model: { language: ModelLanguage.SMITHY, options: { @@ -126,15 +126,15 @@ npx projen new --from @aws/pdk monorepo-ts --package-manager=pnpm 3.) Given we have modified our `projenrc` file we need to run the `npx projen` command to synthesize our new API and infrastructure onto the filesystem. We can then run a first build with `npx projen build`. -A sample API definition is generated for you in `packages/api/model`, which you are free to modify. Modelling WebSocket APIs is slightly different to REST APIs, namely each operation in a WebSocket API is one-way, sent either from a client to a server or from a server to a client. This means that WebSocket operations define only an input and do not define response types. For more details please refer to [Using Smithy](./websocket_using_smithy.md) and [Using OpenAPI](./websocket_using_smithy.md), +A sample API definition is generated for you in `packages/api/model`, which you are free to modify. Modelling WebSocket APIs is slightly different to REST APIs, namely each operation in a WebSocket API is one-way, sent either from a client to a server or from a server to a client. This means that WebSocket operations define only an input and do not define response types. For more details please refer to [Using Smithy](./websocket_using_smithy.md), [Using TypeSpec](./websocket_using_typespec.md) and [Using OpenAPI](./websocket_using_smithy.md). ## Implement a Lambda handler -The generated runtime projects include lambda handler wrappers which provide type-safety for implementing your API operations. The generated `handlers` projects include generated stubs for you to implement for every operation which has been annotated accordingly: +The generated runtime projects include lambda handler wrappers which provide type-safety for implementing your `client_to_server` or `bidirectional` operations. The generated `handlers` projects include generated stubs for you to implement for every operation which has been annotated accordingly: === "SMITHY" - Use the `@async` trait to select the operation direction. Choose between `client_to_server`, `server_to_client` or `bidirectional` + Use the `@async` trait to select the operation direction. Choose between `client_to_server`, `server_to_client` or `bidirectional`. Use the `@handler` trait, and specify the language you wish to implement this operation in. @@ -153,6 +153,25 @@ The generated runtime projects include lambda handler wrappers which provide typ The `@handler` trait may only be applied to `client_to_server` or `bidirectional` operations. + +=== "TYPESPEC" + + Use the `@async` decorator to select the operation direction. Choose between `client_to_server`, `server_to_client` or `bidirectional`. + + Use the `@handler` trait, and specify the language you wish to implement this operation in. + + ```tsp hl_lines="1-2" + @async({ direction: "client_to_server" }) + @handler({ language: "typescript" }) + op SubscribeToNotifications( + topic: string, + ): void; + ``` + + !!!tip + + The `@handler` decorator may only be applied to `client_to_server` or `bidirectional` operations. + === "OPENAPI" Use the `x-async` vendor extension to select the operation direction. Choose between `client_to_server`, `server_to_client` or `bidirectional` @@ -390,6 +409,35 @@ Add the new operation in the `model` project, for example: } ``` +=== "TYPESPEC" + + In `model/src/main.tsp`, or another `.tsp` file somewhere in `model/src`, define the operation: + + ```tsp + @async({ direction: "bidirectional" }) // <- you can also choose "client_to_server" or "server_to_client" + @handler({ language: "typescript" }) + op Ping( + message: string, + ): void; + ``` + + If you defined your operation in a separate file, make sure you import it in `model/src/main.tsp`, eg: + + ```tsp + import "./operations/ping.tsp"; + ``` + + !!!note + + If you defined your operation in a separate file, you will need to import the decorators from `model/generated/aws-pdk`, for example: + + ```tsp + import "../../generated/aws-pdk/prelude.tsp"; + import "../../generated/aws-pdk/async.tsp"; + ``` + + You will also need to ensure the `namespace` is the same as the one in your `main.tsp` file. + === "OPENAPI" In `model/src/main/openapi/main.yaml`, add the new operation under `paths`, and any new schemas under `components.schemas`. @@ -440,7 +488,7 @@ To run a build in the root of your monorepo, use the `npx projen build` command: npx projen build ``` -The build will regenerate the infrastructure, runtime, and library projects based on your updated model. It will also generate a new stub for your new operation if you specified the `@handler` trait in Smithy or `x-handler` vendor extension in OpenAPI. +The build will regenerate the infrastructure, runtime, and library projects based on your updated model. It will also generate a new stub for your new operation if you specified the `@handler` trait in Smithy/TypeSpec or `x-handler` vendor extension in OpenAPI. As you must define an integration for every `client_to_server` or `bidirectional` operation, you may see the following build error in your CDK application. diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_using_openapi.md b/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_using_openapi.md index aba8dd607..1db94d6c7 100644 --- a/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_using_openapi.md +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_using_openapi.md @@ -1,12 +1,12 @@ # Using OpenAPI -As an alternative to [Smithy](./websocket_using_smithy.md), you can use [OpenAPI Version 3.0.3](https://swagger.io/specification/) to define your API. +As an alternative to [Smithy](./websocket_using_smithy.md) or [TypeSpec](./websocket_using_typespec.md), you can use [OpenAPI Version 3.0.3](https://swagger.io/specification/) to define your API. !!!warning Note that while Type Safe WebSocket API uses the OpenAPI format to define operations, many of the features of OpenAPI are not supported by WebSockets and therefore may be ignored if you define them in your model, for example specifying `parameters` or `responses`. - [Smithy](./websocket_using_smithy.md) is the recommended model language for WebSocket APIs. + [TypeSpec](./websocket_using_typespec.md) and [Smithy](./websocket_using_smithy.md) are the recommended model languages for WebSocket APIs. To use OpenAPI, in `TypeSafeWebSocketApiProject`, specify it as the `model.language`. diff --git a/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_using_typespec.md b/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_using_typespec.md new file mode 100644 index 000000000..83223d0aa --- /dev/null +++ b/packages/type-safe-api/docs/developer_guides/type-safe-api/websocket_using_typespec.md @@ -0,0 +1,100 @@ +# Using TypeSpec + +You can use [TypeSpec](https://typespec.io/), an interface definition language (IDL) to model your APIs. To use TypeSpec, in `TypeSafeWebSocketApiProject`, specify it as your `model.language`. + +=== "TS" + + ```ts + new TypeSafeWebSocketApiProject({ + model: { + language: ModelLanguage.TYPESPEC, + options: { + typeSpec: { + namespace: "MyApi" + }, + }, + }, + ... + }); + ``` + +=== "JAVA" + + ```java + TypeSafeWebSocketApiProject.Builder.create() + .model(TypeSafeWebSocketApiModelConfiguration.builder() + .language(ModelLanguage.SMITHY) + .options(ModelOptions.builder() + .typeSpec(TypeSpecModelOptions.builder() + .namespace("MyApi") + .build()) + .build()) + .build()) + ... + .build(); + ``` + +=== "PYTHON" + + ```python + TypeSafeWebSocketApiProject( + model=TypeSafeWebSocketApiModelConfiguration( + language=ModelLanguage.SMITHY, + options=ModelOptions( + type_spec=TypeSpecModelOptions( + namespace="MyApi" + ) + ) + ), + ... + ) + ``` + +## Using the TypeSpec IDL + +For more information on how use TypeSpec for writing models, refer to the [TypeSpec documentation](https://typespec.io/docs/getting-started/getting-started-rest/01-setup-basic-syntax/). + +You will find your API model in `model/src/main.tsp`: + +```tsp +import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; +import "../generated/aws-pdk/async.tsp"; + +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyApi", +}) +@info({ + version: "1.0", +}) +@connectHandler({ language: "typescript" }) // Optional decorators for implementing lambda handlers for $connect and $disconnect WebSocket routes +@disconnectHandler({ language: "typescript" }) +namespace MyApi; + +@async({ direction: "client_to_server" }) // Choose from client_to_server, server_to_client or bidirectional +@handler({ language: "typescript" }) // The @handler decorator can be specified on client_to_server or bidirectional operations +op SayHello( + // Operations only define an input, since they are one-way messages + name: string, +): void; +``` + +## WebSocket decorators + +### Namespace Decorators + +You can optionally specify `@connectHandler` and `@disconnectHandler` on your `namespace` in `main.tsp` to generate lambda handler stubs for the `$connect` and `$disconnect` routes. + +### Operation Decorators + +The `@async` decorator must annotate every operation. You must define a `direction` of either `client_to_server`, `server_to_client` or `bidirectional`, indicating whether the client or server should send or receive the message, or both. + +The directions are used by Type Safe WebSocket API's code generators to determine what to generate. For example, the Server SDK includes a method for every `server_to_client` and `bidirectional` operation to allow it to send messages to connected clients, but will not include one for `client_to_server` operations as these are not sent from the server. + +Like REST APIs, the `@handler` decorator can be applied to operations to generate lambda handler stubs for implementing the operation. Since lambda handlers are for messages received by the server, the `@handler` decorator may only be applied to `client_to_server` and `bidirectional` operations. diff --git a/packages/type-safe-api/samples/type-safe-api/readme/model-async/TYPESPEC.md b/packages/type-safe-api/samples/type-safe-api/readme/model-async/TYPESPEC.md new file mode 100644 index 000000000..b9975a633 --- /dev/null +++ b/packages/type-safe-api/samples/type-safe-api/readme/model-async/TYPESPEC.md @@ -0,0 +1,47 @@ +# TypeSpec Model + +This project defines the API operations and their inputs and outputs, using an interface definition language called [TypeSpec](https://typespec.io/). + +The entrypoint for the API is `src/main.tsp`. You can add more TypeSpec files (and subfolders) in the `src` directory. + +Resources: + - [TypeSpec Documentation](https://typespec.io/) + - [Type Safe API Documentation](https://aws.github.io/aws-pdk/developer_guides/type-safe-api/index.html) + +## Adding Operations + +To add an operation, we can use the `op` keyword. It should be annotated with the `@async` decorator which defines the `direction` of an operation (either `server_to_client`, `client_to_server` or `bidirectional`). Each operation must define an input, and must return `void` since websocket messages are one-way. Each operation has its input defined in parentheses. + +```tsp +namespace MyApi; + +/** + * This is an example operation. + */ +@async({ direction: "server_to_client" }) +op SendNotification( + message: string, + anotherParameter?: Foo, +): void; +``` + +In the above, we've referenced a model called `Foo` in the output. Let's define that as a `model`: + +```tsp +model Foo { + /** + * Some documentation about this property + */ + myProperty: int32; +} +``` + +We can add the operation in its own separate file if we like, or just in `main.tsp`. If in a separate file, __make sure to import the operation in `main.tsp`__, for example: + +```tsp +import "./operations/send-notification.tsp"; +``` + +Note that you must use the same `namespace` for all operations defined in your API. + +For more details, see the [TypeSpec documentation](https://typespec.io/). diff --git a/packages/type-safe-api/samples/type-safe-api/readme/model-rest/TYPESPEC.md b/packages/type-safe-api/samples/type-safe-api/readme/model-rest/TYPESPEC.md new file mode 100644 index 000000000..fe3189b59 --- /dev/null +++ b/packages/type-safe-api/samples/type-safe-api/readme/model-rest/TYPESPEC.md @@ -0,0 +1,64 @@ +# TypeSpec Model + +This project defines the API operations and their inputs and outputs, using an interface definition language called [TypeSpec](https://typespec.io/). + +The entrypoint for the API is `src/main.tsp`. You can add more TypeSpec files (and subfolders) in the `src` directory. + +Resources: + - [TypeSpec Documentation](https://typespec.io/) + - [Type Safe API Documentation](https://aws.github.io/aws-pdk/developer_guides/type-safe-api/index.html) + +## Adding Operations + +To add an operation, we can use the `op` keyword. It should be annotated with the `@route` decorator to specify the url for the operation, and the appropriate decorator for the HTTP method (eg `@get` or `@post`) Each operation has its input defined in parentheses, and its output or errors defined after the colon `:`. + +```tsp +namespace MyApi; + +/** + * This is an example operation + */ +@post +@route("/foo/{myUrlParam}") +op CreateFoo( + /** + * This parameter comes from the url + */ + @path myUrlParam: string, + /** + * Since there's no @path or @query decorator, + * this parameter will be in the request body + */ + someParameter: string, + /** + * This parameter is also in the body, but is optional + */ + anotherParameter?: double, +): { + /** + * This will be a property of the response + */ + foo: Foo; +} | BadRequestError; +``` + +In the above, we've referenced a model called `Foo` in the output. Let's define that as a `model`: + +```tsp +model Foo { + /** + * Some documentation about this property + */ + myProperty: int32; +} +``` + +We can add the operation in its own separate file if we like, or just in `main.tsp`. If in a separate file, __make sure to import the operation in `main.tsp`__, for example: + +```tsp +import "./operations/create-foo.tsp"; +``` + +Note that you must use the same `namespace` for all operations defined in your API. + +For more details, see the [TypeSpec documentation](https://typespec.io/). diff --git a/packages/type-safe-api/src/project/codegen/generate.ts b/packages/type-safe-api/src/project/codegen/generate.ts index 03677fd4a..d1a6026b5 100644 --- a/packages/type-safe-api/src/project/codegen/generate.ts +++ b/packages/type-safe-api/src/project/codegen/generate.ts @@ -3,6 +3,7 @@ SPDX-License-Identifier: Apache-2.0 */ import * as path from "path"; import { getLogger } from "log4js"; import { Project, TextFile } from "projen"; +import { NodePackageManager } from "projen/lib/javascript"; import { DocumentationFormat, Language, @@ -68,6 +69,8 @@ import { TypeSafeApiAsyncModelBuildOutputOptions } from "../model/type-safe-api- import { TypeSafeApiModelBuildOutputOptions } from "../model/type-safe-api-model-build"; import { TypeSafeApiModelProjectOptions } from "../model/type-safe-api-model-project"; import { TypeSafeWebSocketApiModelProjectOptions } from "../model/type-safe-websocket-api-model-project"; +import { TypeSpecAsyncModelProject } from "../model/type-spec/type-spec-async-model-project"; +import { TypeSpecModelProject } from "../model/type-spec/type-spec-model-project"; import { GeneratedDocumentationOptions, GeneratedWebSocketDocumentationOptions, @@ -663,6 +666,8 @@ export interface CommonModelProjectOptions { readonly name: string; readonly parent?: Project; readonly outdir: string; + readonly defaultReleaseBranch: string; + readonly packageManager: NodePackageManager; } export interface GenerateModelProjectOptions @@ -709,6 +714,24 @@ export const generateModelProject = ({ apiName: openapi.apiName, outdir: openapi.outdir, }; + } else if (modelLanguage === ModelLanguage.TYPESPEC) { + if (!modelOptions.typeSpec) { + throw new Error( + `modelOptions.typeSpec is required when selected model language is ${ModelLanguage.TYPESPEC}` + ); + } + + const typeSpec = new TypeSpecModelProject({ + ...options, + name: sanitiseTypescriptPackageName(options.name), + typeSpecOptions: modelOptions.typeSpec, + }); + return { + typeSpec, + parsedSpecFile: options.parsedSpecFile, + apiName: typeSpec.apiName, + outdir: typeSpec.outdir, + }; } else { throw new Error(`Unknown model language ${modelLanguage}`); } @@ -761,6 +784,25 @@ export const generateAsyncModelProject = ({ apiName: openapi.apiName, outdir: openapi.outdir, }; + } else if (modelLanguage === ModelLanguage.TYPESPEC) { + if (!modelOptions.typeSpec) { + throw new Error( + `modelOptions.typeSpec is required when selected model language is ${ModelLanguage.TYPESPEC}` + ); + } + + const typeSpec = new TypeSpecAsyncModelProject({ + ...options, + name: sanitiseTypescriptPackageName(options.name), + typeSpecOptions: modelOptions.typeSpec, + }); + return { + typeSpec, + parsedSpecFile: options.parsedSpecFile, + asyncApiSpecFile: options.asyncApiSpecFile, + apiName: typeSpec.apiName, + outdir: typeSpec.outdir, + }; } else { throw new Error(`Unknown model language ${modelLanguage}`); } diff --git a/packages/type-safe-api/src/project/index.ts b/packages/type-safe-api/src/project/index.ts index 6f0909f2d..8b45faa5a 100644 --- a/packages/type-safe-api/src/project/index.ts +++ b/packages/type-safe-api/src/project/index.ts @@ -13,10 +13,15 @@ export * from "./model/type-safe-websocket-api-model-project"; export * from "./model/smithy/smithy-async-definition"; export * from "./model/openapi/open-api-async-definition"; export * from "./model/smithy/types"; +export * from "./model/type-spec/type-spec-project-definition"; +export * from "./model/type-spec/type-spec-definition"; +export * from "./model/type-spec/type-spec-async-definition"; export * from "./model/openapi/open-api-model-project"; export * from "./model/openapi/open-api-async-model-project"; export * from "./model/smithy/smithy-async-model-project"; export * from "./model/smithy/smithy-model-project"; +export * from "./model/type-spec/type-spec-model-project"; +export * from "./model/type-spec/type-spec-async-model-project"; export * from "./languages"; export * from "./types"; export * from "./typescript-project-options"; diff --git a/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-aws-pdk-prelude-js.ts b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-aws-pdk-prelude-js.ts new file mode 100644 index 000000000..05b52592a --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-aws-pdk-prelude-js.ts @@ -0,0 +1,54 @@ +/*! 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 { Project, FileBase, IResolver } from "projen"; + +/** + * Options for the aws-pdk/async.js file + */ +export interface TypeSpecAsyncAwsPdkPreludeJsOptions { + /** + * Path to the generated model directory in which to add the prelude + */ + readonly generatedModelDir: string; +} + +/** + * Synthesize the aws-pdk/async.js file + */ +export class TypeSpecAsyncAwsPdkPreludeJs extends FileBase { + constructor(project: Project, options: TypeSpecAsyncAwsPdkPreludeJsOptions) { + super( + project, + path.join(options.generatedModelDir, "aws-pdk", "async.js"), + { + marker: true, + readonly: true, + } + ); + } + + public synthesizeContent(_: IResolver): string | undefined { + // Define the @async, @connectHandler and @disconnectHandler decorator implementations. + // The @async decorator implementation adds the "x-async" vendor extension to the operation in + // the OpenAPI spec, as well as setting the method to POST and path to /. + return `// ${this.marker} +import { $extension } from "@typespec/openapi"; +import { $post, $route } from "@typespec/http"; + +export function $async(context, target, value) { + $post(context, target); + $route(context, target, \`/\${target.name}\`); + $extension(context, target, "x-async", value); +} + +export function $connectHandler(context, target, value) { + $extension(context, target, "x-connect-handler", value); +} + +export function $disconnectHandler(context, target, value) { + $extension(context, target, "x-disconnect-handler", value); +} +`; + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-aws-pdk-prelude.ts b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-aws-pdk-prelude.ts new file mode 100644 index 000000000..ee2868fab --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-aws-pdk-prelude.ts @@ -0,0 +1,50 @@ +/*! 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 { Project, FileBase, IResolver } from "projen"; + +/** + * Options for the aws-pdk/async.tsp file + */ +export interface TypeSpecAsyncAwsPdkPreludeOptions { + /** + * Path to the generated model directory in which to add the prelude + */ + readonly generatedModelDir: string; +} + +/** + * Synthesize the aws-pdk/async.tsp file + */ +export class TypeSpecAsyncAwsPdkPrelude extends FileBase { + constructor(project: Project, options: TypeSpecAsyncAwsPdkPreludeOptions) { + super( + project, + path.join(options.generatedModelDir, "aws-pdk", "async.tsp"), + { + marker: true, + readonly: true, + } + ); + } + + public synthesizeContent(_: IResolver): string | undefined { + // Define the @async, @connectHandler and @disconnectHandler decorators + // The implementation of these is imported from the async.js file. + return `// ${this.marker} +import "./prelude.tsp"; +import "./async.js"; + +using TypeSpec.Reflection; + +model AsyncOptions { + direction: "client_to_server" | "server_to_client" | "bidirectional"; +} + +extern dec async(target: Operation, options: AsyncOptions); + +extern dec connectHandler(target: Namespace, options: HandlerOptions); +extern dec disconnectHandler(target: Namespace, options: HandlerOptions); +`; + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-sample-code.ts b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-sample-code.ts new file mode 100644 index 000000000..9c904dabd --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-async-sample-code.ts @@ -0,0 +1,77 @@ +/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 */ +import { Project, SampleDir } from "projen"; +import { TypeSpecDefinitionOptions } from "../type-spec-definition"; + +/** + * Options for TypeSpec sample code + */ +export interface TypeSpecAsyncSampleCodeOptions + extends TypeSpecDefinitionOptions { + /** + * Location for the TypeSpec model + */ + readonly modelDir: string; +} + +/** + * Defines sample code for a TypeSpec REST API + */ +export class TypeSpecAsyncSampleCode extends SampleDir { + constructor( + project: Project, + { + modelDir, + typeSpecOptions, + handlerLanguages, + }: TypeSpecAsyncSampleCodeOptions + ) { + const firstHandlerLanguage = handlerLanguages?.[0]; + + super(project, modelDir, { + files: { + "main.tsp": `import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; +import "../generated/aws-pdk/async.tsp"; + +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "${typeSpecOptions.namespace}", +}) +@info({ + version: "1.0", +}) +${ + firstHandlerLanguage + ? `@connectHandler({ language: "${firstHandlerLanguage}" }) +@disconnectHandler({ language: "${firstHandlerLanguage}" }) +` + : "" +}namespace ${typeSpecOptions.namespace}; + +${ + firstHandlerLanguage + ? `@handler({ language: "${firstHandlerLanguage}" }) +` + : "" +}@async({ direction: "client_to_server" }) +op SubscribeToNotifications( + topic: string, +): void; + +@async({ direction: "server_to_client" }) +op SendNotification( + topic: string, + title: string, + message: string, +): void; +`, + }, + }); + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/components/type-spec-aws-pdk-prelude-js.ts b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-aws-pdk-prelude-js.ts new file mode 100644 index 000000000..ab1b22cd9 --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-aws-pdk-prelude-js.ts @@ -0,0 +1,42 @@ +/*! 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 { Project, FileBase, IResolver } from "projen"; + +/** + * Options for the aws-pdk/prelude.js file + */ +export interface TypeSpecAwsPdkPreludeJsOptions { + /** + * Path to the generated model directory in which to add the prelude + */ + readonly generatedModelDir: string; +} + +/** + * Synthesize the aws-pdk/prelude.js file + */ +export class TypeSpecAwsPdkPreludeJs extends FileBase { + constructor(project: Project, options: TypeSpecAwsPdkPreludeJsOptions) { + super( + project, + path.join(options.generatedModelDir, "aws-pdk", "prelude.js"), + { + marker: true, + readonly: true, + } + ); + } + + public synthesizeContent(_: IResolver): string | undefined { + // Define the implementation for the @handler decorator. This reuses the @extension decorator + // for adding an OpenAPI extension, but abstracts the `x-handler` key. + return `// ${this.marker} +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +`; + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/components/type-spec-aws-pdk-prelude.ts b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-aws-pdk-prelude.ts new file mode 100644 index 000000000..fd4229c7d --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-aws-pdk-prelude.ts @@ -0,0 +1,61 @@ +/*! 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 { Project, FileBase, IResolver } from "projen"; +import { Language } from "../../../languages"; + +/** + * Options for the aws-pdk/prelude.tsp file + */ +export interface TypeSpecAwsPdkPreludeOptions { + /** + * Path to the generated model directory in which to add the prelude + */ + readonly generatedModelDir: string; + /** + * Languages selected for handlers + */ + readonly handlerLanguages?: Language[]; +} + +/** + * Synthesize the aws-pdk/prelude.tsp file + */ +export class TypeSpecAwsPdkPrelude extends FileBase { + private readonly options: TypeSpecAwsPdkPreludeOptions; + + constructor(project: Project, options: TypeSpecAwsPdkPreludeOptions) { + super( + project, + path.join(options.generatedModelDir, "aws-pdk", "prelude.tsp"), + { + marker: true, + readonly: true, + } + ); + this.options = options; + } + + public synthesizeContent(_: IResolver): string | undefined { + const hasAnyHandlerProjects = + (this.options.handlerLanguages ?? []).length > 0; + + // If there are handler languages, we define the @handler decorator. + // The decorator implementation is defined in the prelude.js file. + return `// ${this.marker} +import "./prelude.js"; + +using TypeSpec.Reflection; + +${ + hasAnyHandlerProjects + ? `model HandlerOptions { + language: ${this.options.handlerLanguages!.map((l) => `"${l}"`).join(" | ")}; +} + +extern dec handler(target: Operation, options: HandlerOptions);` + : "" +} +`; + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/components/type-spec-sample-code.ts b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-sample-code.ts new file mode 100644 index 000000000..d1a0702ba --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/components/type-spec-sample-code.ts @@ -0,0 +1,151 @@ +/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 */ +import { Project, SampleDir } from "projen"; +import { TypeSpecDefinitionOptions } from "../type-spec-definition"; + +/** + * Options for TypeSpec sample code + */ +export interface TypeSpecSampleCodeOptions extends TypeSpecDefinitionOptions { + /** + * Location for the TypeSpec model + */ + readonly modelDir: string; +} + +/** + * Defines sample code for a TypeSpec REST API + */ +export class TypeSpecSampleCode extends SampleDir { + constructor( + project: Project, + { modelDir, typeSpecOptions, handlerLanguages }: TypeSpecSampleCodeOptions + ) { + const firstHandlerLanguage = handlerLanguages?.[0]; + + super(project, modelDir, { + files: { + "main.tsp": `import "@typespec/http"; +import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; + +import "./types/errors.tsp"; + +using Http; +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "${typeSpecOptions.namespace}", +}) +@info({ + version: "1.0", +}) +namespace ${typeSpecOptions.namespace}; + +${ + firstHandlerLanguage + ? `@handler({ language: "${firstHandlerLanguage}" }) +` + : "" +}@get +@route("/hello") +op SayHello(@query name: string): + | { + @statusCode statusCode: 200; + @body body: { + message: string; + }; + } + | BadRequestError + | NotAuthorizedError + | NotFoundError + | InternalFailureError; +`, + "types/errors.tsp": `import "@typespec/http"; + +using Http; + +/** + * An error at the fault of the client sending invalid input + */ +model BadRequestErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An internal failure at the fault of the server + */ +model InternalFailureErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client not being authorized to access the resource + */ +model NotAuthorizedErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client attempting to access a missing resource + */ +model NotFoundErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * BadRequestError 400 response + */ +@error +model BadRequestError { + @statusCode statusCode: 400; + @body body: BadRequestErrorResponseContent; +} + +/** + * NotAuthorizedError 403 response + */ +@error +model NotAuthorizedError { + @statusCode statusCode: 403; + @body body: NotAuthorizedErrorResponseContent; +} + +/** + * NotFoundError 404 response + */ +@error +model NotFoundError { + @statusCode statusCode: 404; + @body body: NotFoundErrorResponseContent; +} + +/** + * InternalFailureError 500 response + */ +@error +model InternalFailureError { + @statusCode statusCode: 500; + @body body: InternalFailureErrorResponseContent; +} +`, + }, + }); + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/type-spec-async-definition.ts b/packages/type-safe-api/src/project/model/type-spec/type-spec-async-definition.ts new file mode 100644 index 000000000..e49e9214e --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/type-spec-async-definition.ts @@ -0,0 +1,39 @@ +/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 */ +import { NodeProject } from "projen/lib/javascript"; +import { TypeSpecAsyncAwsPdkPrelude } from "./components/type-spec-async-aws-pdk-prelude"; +import { TypeSpecAsyncAwsPdkPreludeJs } from "./components/type-spec-async-aws-pdk-prelude-js"; +import { TypeSpecAsyncSampleCode } from "./components/type-spec-async-sample-code"; +import { + TypeSpecProjectDefinition, + TypeSpecProjectDefinitionOptions, +} from "./type-spec-project-definition"; + +/** + * Options for the TypeSpec async model definition + */ +export interface TypeSpecAsyncDefinitionOptions + extends TypeSpecProjectDefinitionOptions {} + +/** + * The TypeSpec model definition for an async api + */ +export class TypeSpecAsyncDefinition extends TypeSpecProjectDefinition { + constructor(project: NodeProject, options: TypeSpecAsyncDefinitionOptions) { + super(project, options); + + // Add the async prelude files which define the @async, @connectHandler and @disconnectHandler decorators + new TypeSpecAsyncAwsPdkPrelude(project, { + generatedModelDir: this.generatedModelDir, + }); + new TypeSpecAsyncAwsPdkPreludeJs(project, { + generatedModelDir: this.generatedModelDir, + }); + + // Add the sample code for TypeSpec websocket APIs + new TypeSpecAsyncSampleCode(project, { + ...options, + modelDir: this.modelDir, + }); + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/type-spec-async-model-project.ts b/packages/type-safe-api/src/project/model/type-spec/type-spec-async-model-project.ts new file mode 100644 index 000000000..a90fd3c50 --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/type-spec-async-model-project.ts @@ -0,0 +1,59 @@ +/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 */ +import { NodeProject, NodeProjectOptions } from "projen/lib/javascript"; +import { TypeSpecDefinitionOptions } from "./type-spec-definition"; +import { TypeSafeApiCommandEnvironment } from "../../codegen/components/type-safe-api-command-environment"; +import { ModelLanguage } from "../../types"; +import { ModelReadme } from "../model-readme"; +import { + TypeSafeApiAsyncModelBuild, + TypeSafeApiAsyncModelBuildOutputOptions, +} from "../type-safe-api-async-model-build"; +import { + TypeSafeApiModelBuild, + TypeSafeApiModelBuildOutputOptions, +} from "../type-safe-api-model-build"; +import { TypeSpecAsyncDefinition } from "./type-spec-async-definition"; + +/** + * Options for the TypeSpec WebSocket API model project + */ +export interface TypeSpecAsyncModelProjectOptions + extends NodeProjectOptions, + TypeSpecDefinitionOptions, + TypeSafeApiAsyncModelBuildOutputOptions, + TypeSafeApiModelBuildOutputOptions {} + +/** + * Model project for defining a WebSocket API in TypeSpec + */ +export class TypeSpecAsyncModelProject extends NodeProject { + public readonly apiName: string; + public readonly definition: TypeSpecAsyncDefinition; + + constructor(options: TypeSpecAsyncModelProjectOptions) { + super(options); + TypeSafeApiCommandEnvironment.ensure(this); + + // Add the TypeSpec model + this.definition = new TypeSpecAsyncDefinition(this, options); + this.apiName = options.typeSpecOptions.namespace; + + // Add the model build to parse/bundle the generated openapi spec + new TypeSafeApiModelBuild(this, { + openApiSpecificationPath: this.definition.openApiSpecificationPath, + parsedSpecFile: options.parsedSpecFile, + }); + + // Add the async model build to generate the AsyncAPI specification for docs generation + new TypeSafeApiAsyncModelBuild(this, { + parsedSpecFile: options.parsedSpecFile, + asyncApiSpecFile: options.asyncApiSpecFile, + }); + + new ModelReadme(this, { + modelLanguage: ModelLanguage.TYPESPEC, + apiType: "async", + }); + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/type-spec-definition.ts b/packages/type-safe-api/src/project/model/type-spec/type-spec-definition.ts new file mode 100644 index 000000000..afcd510b5 --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/type-spec-definition.ts @@ -0,0 +1,28 @@ +/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 */ +import { NodeProject } from "projen/lib/javascript"; +import { TypeSpecSampleCode } from "./components/type-spec-sample-code"; +import { + TypeSpecProjectDefinition, + TypeSpecProjectDefinitionOptions, +} from "./type-spec-project-definition"; + +/** + * Options for the TypeSpec model definition + */ +export interface TypeSpecDefinitionOptions + extends TypeSpecProjectDefinitionOptions {} + +/** + * The TypeSpec model definition + */ +export class TypeSpecDefinition extends TypeSpecProjectDefinition { + constructor(project: NodeProject, options: TypeSpecDefinitionOptions) { + super(project, options); + + new TypeSpecSampleCode(project, { + ...options, + modelDir: this.modelDir, + }); + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/type-spec-model-project.ts b/packages/type-safe-api/src/project/model/type-spec/type-spec-model-project.ts new file mode 100644 index 000000000..45a737ac0 --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/type-spec-model-project.ts @@ -0,0 +1,50 @@ +/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0 */ +import { NodeProject, NodeProjectOptions } from "projen/lib/javascript"; +import { + TypeSpecDefinition, + TypeSpecDefinitionOptions, +} from "./type-spec-definition"; +import { TypeSafeApiCommandEnvironment } from "../../codegen/components/type-safe-api-command-environment"; +import { ModelLanguage } from "../../types"; +import { ModelReadme } from "../model-readme"; +import { + TypeSafeApiModelBuild, + TypeSafeApiModelBuildOutputOptions, +} from "../type-safe-api-model-build"; + +/** + * Options for the TypeSpec model project + */ +export interface TypeSpecModelProjectOptions + extends NodeProjectOptions, + TypeSpecDefinitionOptions, + TypeSafeApiModelBuildOutputOptions {} + +/** + * Model project for defining a REST API in TypeSpec + */ +export class TypeSpecModelProject extends NodeProject { + public readonly apiName: string; + public readonly definition: TypeSpecDefinition; + + constructor(options: TypeSpecModelProjectOptions) { + super(options); + TypeSafeApiCommandEnvironment.ensure(this); + + // Add the TypeSpec model + this.definition = new TypeSpecDefinition(this, options); + this.apiName = options.typeSpecOptions.namespace; + + // Add the model build to parse/bundle our generated OpenAPI specification + new TypeSafeApiModelBuild(this, { + openApiSpecificationPath: this.definition.openApiSpecificationPath, + parsedSpecFile: options.parsedSpecFile, + }); + + new ModelReadme(this, { + modelLanguage: ModelLanguage.TYPESPEC, + apiType: "rest", + }); + } +} diff --git a/packages/type-safe-api/src/project/model/type-spec/type-spec-project-definition.ts b/packages/type-safe-api/src/project/model/type-spec/type-spec-project-definition.ts new file mode 100644 index 000000000..c8e01ccc0 --- /dev/null +++ b/packages/type-safe-api/src/project/model/type-spec/type-spec-project-definition.ts @@ -0,0 +1,102 @@ +/*! 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 { Component, YamlFile } from "projen"; +import { NodeProject } from "projen/lib/javascript"; +import { TypeSpecAwsPdkPrelude } from "./components/type-spec-aws-pdk-prelude"; +import { TypeSpecAwsPdkPreludeJs } from "./components/type-spec-aws-pdk-prelude-js"; +import { GenerateTask } from "../../codegen/components/generate-task"; +import { Language } from "../../languages"; +import { TypeSpecModelOptions } from "../../types"; + +/** + * Options for a TypeSpec model project + */ +export interface TypeSpecProjectDefinitionOptions { + /** + * TypeSpec model options + */ + readonly typeSpecOptions: TypeSpecModelOptions; + /** + * The languages users have specified for handler projects (if any) + */ + readonly handlerLanguages?: Language[]; +} + +/** + * Creates a project which allows APIs to be defined in TypeSpec + * @see https://typespec.io/ + */ +export class TypeSpecProjectDefinition extends Component { + /** + * Path to the generated OpenAPI specification + */ + public readonly openApiSpecificationPath: string; + + /** + * Directory in which the model source resides + */ + protected readonly modelDir: string = "src"; + + /** + * Directory in which generated model source resides + */ + protected readonly generatedModelDir = "generated"; + + constructor(project: NodeProject, options: TypeSpecProjectDefinitionOptions) { + super(project); + const { handlerLanguages } = options; + + // Add dependencies on the TypeSpec compiler and http/openapi libraries + project.addDevDeps( + "@typespec/compiler@^0.61", + "@typespec/http@^0.61", + "@typespec/openapi@^0.61", + "@typespec/openapi3@^0.61" + ); + + const outputDir = "dist"; + const outputFile = "openapi.json"; + + project.gitignore.addPatterns(outputDir); + + // Compiled output is located under a directory for the emitter we're using, in this case @typespec/openapi3 + this.openApiSpecificationPath = path.join( + outputDir, + "@typespec", + "openapi3", + outputFile + ); + + // Configuration for the typespec compiler + new YamlFile(this, "tspconfig.yaml", { + obj: { + emit: ["@typespec/openapi3"], + options: { + "@typespec/openapi3": { + "output-file": outputFile, + }, + }, + "output-dir": path.join("{cwd}", outputDir), + }, + }); + + // Add the prelude which defines our custom @handler decorator + new TypeSpecAwsPdkPrelude(project, { + generatedModelDir: this.generatedModelDir, + handlerLanguages, + }); + new TypeSpecAwsPdkPreludeJs(project, { + generatedModelDir: this.generatedModelDir, + }); + + const generateTask = GenerateTask.ensure(project); + + // In order for typespec to load our prelude javascript file(s), we need to ensure + // it's treated as a module + generateTask.env("NODE_OPTIONS", "--experimental-default-type=module"); + + // Compile typespec to openapi + generateTask.exec(`tsp compile ${this.modelDir} --config tspconfig.yaml`); + } +} diff --git a/packages/type-safe-api/src/project/type-safe-api-project.ts b/packages/type-safe-api/src/project/type-safe-api-project.ts index 41725a73d..b3c87eae4 100644 --- a/packages/type-safe-api/src/project/type-safe-api-project.ts +++ b/packages/type-safe-api/src/project/type-safe-api-project.ts @@ -237,11 +237,15 @@ export class TypeSafeApiProject extends Project { modelLanguage: options.model.language, modelOptions: options.model.options, handlerLanguages, + defaultReleaseBranch: nxWorkspace?.affected?.defaultBase ?? "mainline", + packageManager, parsedSpecFile, }); - const modelProject = [this.model.openapi, this.model.smithy].filter( - (m) => m - )[0] as Project; + const modelProject = [ + this.model.openapi, + this.model.smithy, + this.model.typeSpec, + ].filter((m) => m)[0] as Project; // Ensure we always generate a runtime project for the infrastructure language, regardless of what was specified by // the user. Likewise we generate a runtime project for any handler languages specified diff --git a/packages/type-safe-api/src/project/type-safe-websocket-api-project.ts b/packages/type-safe-api/src/project/type-safe-websocket-api-project.ts index e28a45a3d..d28d93adf 100644 --- a/packages/type-safe-api/src/project/type-safe-websocket-api-project.ts +++ b/packages/type-safe-api/src/project/type-safe-websocket-api-project.ts @@ -223,12 +223,16 @@ export class TypeSafeWebSocketApiProject extends Project { modelLanguage: options.model.language, modelOptions: options.model.options, handlerLanguages, + packageManager, + defaultReleaseBranch, parsedSpecFile, asyncApiSpecFile, }); - const modelProject = [this.model.openapi, this.model.smithy].filter( - (m) => m - )[0] as Project; + const modelProject = [ + this.model.openapi, + this.model.smithy, + this.model.typeSpec, + ].filter((m) => m)[0] as Project; // Ensure we always generate a runtime project for the infrastructure language, regardless of what was specified by // the user. Likewise we generate a runtime project for any handler languages specified diff --git a/packages/type-safe-api/src/project/types.ts b/packages/type-safe-api/src/project/types.ts index bf53ee997..c3e974424 100644 --- a/packages/type-safe-api/src/project/types.ts +++ b/packages/type-safe-api/src/project/types.ts @@ -11,6 +11,8 @@ import { OpenApiModelProject } from "./model/openapi/open-api-model-project"; import { SmithyAsyncModelProject } from "./model/smithy/smithy-async-model-project"; import { SmithyModelProject } from "./model/smithy/smithy-model-project"; import { SmithyBuildOptions } from "./model/smithy/types"; +import { TypeSpecAsyncModelProject } from "./model/type-spec/type-spec-async-model-project"; +import { TypeSpecModelProject } from "./model/type-spec/type-spec-model-project"; import { PythonProjectOptions } from "./python-project-options"; import { TypeScriptProjectOptions } from "./typescript-project-options"; @@ -28,6 +30,11 @@ export enum ModelLanguage { * @see https://www.openapis.org/ */ OPENAPI = "OPENAPI", + /** + * TypeSpec + * @see https://typespec.io/ + */ + TYPESPEC = "TYPESPEC", } /** @@ -80,6 +87,18 @@ export interface OpenApiModelOptions { readonly title: string; } +/** + * Options for the TypeSpec model + */ +export interface TypeSpecModelOptions { + /** + * The namespace for your API + * @see https://typespec.io/docs/language-basics/namespaces/ + * eg. MyApi + */ + readonly namespace: string; +} + /** * Options for models */ @@ -93,6 +112,11 @@ export interface ModelOptions { * Options for the OpenAPI model - required when model language is OPENAPI */ readonly openapi?: OpenApiModelOptions; + + /** + * Options for the TypeSpec model - required when the model language is TYPESPEC. + */ + readonly typeSpec?: TypeSpecModelOptions; } /** @@ -399,6 +423,11 @@ export interface ModelProject extends ModelProjectDetails { * Reference to the OpenAPI model project. Will be defined if the model language is OpenAPI */ readonly openapi?: OpenApiModelProject; + + /** + * Reference to the TypeSpec model project. Will be defined if the model language is TypeSpec + */ + readonly typeSpec?: TypeSpecModelProject; } /** @@ -419,6 +448,11 @@ export interface WebSocketModelProject extends ModelProjectDetails { * Reference to the OpenAPI model project. Will be defined if the model language is OpenAPI */ readonly openapi?: OpenApiAsyncModelProject; + + /** + * Reference to the TypeSpec model project. Will be defined if the model language is TypeSpec + */ + readonly typeSpec?: TypeSpecAsyncModelProject; } /** 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 e90723604..080c6566b 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 @@ -84791,3 +84791,14114 @@ structure NotAuthorizedError { }, } `; + +exports[`Type Safe Api Project Unit Tests TypeSpec With java Infra 1`] = ` +{ + ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/generated/runtime/README.md +!/handlers/README.md +!/generated/infrastructure/README.md +", + ".projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/infrastructure/README.md", + "generated/runtime/README.md", + "handlers/README.md", + ], + }, + ".projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "default", + }, + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "cwd": "model", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/java", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/python", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/typescript", + "exec": "npx projen build", + }, + { + "cwd": "generated/infrastructure/java", + "exec": "npx projen build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + }, + "eject": { + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": [ + { + "spawn": "default", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "README.md": "# Type Safe API + +This project contains an API built with Type Safe API. + +Please refer to the [Type Safe API Documentation](https://aws.github.io/aws-pdk/developer_guides/type-safe-api/index.html) for details about the project structure and how to add operations. +", + "generated/infrastructure/README.md": "## Generated Infrastructure + +This directory contains a generated type-safe CDK construct which can provision the API gateway infrastructure for an API based on your model.", + "generated/infrastructure/java/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pom.xml linguist-generated +/project.json linguist-generated", + "generated/infrastructure/java/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pom.xml +.classpath +.project +.settings +target +dist/java +.tsapi-manifest +.openapi-generator +!/project.json +", + "generated/infrastructure/java/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "metadata": { + "configuration": { + "source": "1.8", + "target": "1.8", + }, + }, + "name": "org.apache.maven.plugins/maven-compiler-plugin", + "type": "build", + "version": "3.8.1", + }, + { + "metadata": { + "configuration": { + "rules": [ + { + "requireMavenVersion": [ + { + "version": "3.6", + }, + ], + }, + ], + }, + "executions": [ + { + "goals": [ + "enforce", + ], + "id": "enforce-maven", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-enforcer-plugin", + "type": "build", + "version": "3.0.0-M3", + }, + { + "metadata": { + "configuration": { + "archive": { + "index": true, + "manifest": { + "addDefaultImplementationEntries": true, + "addDefaultSpecificationEntries": true, + }, + }, + }, + }, + "name": "org.apache.maven.plugins/maven-jar-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "additionalJOptions": { + "additionalJOption": [ + "-J-XX:+TieredCompilation", + "-J-XX:TieredStopAtLevel=1", + ], + }, + "detectJavaApiLink": false, + "failOnError": false, + "show": "protected", + }, + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-javadocs", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-javadoc-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-sources", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-source-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "com.fasterxml.jackson.core/jackson-databind", + "type": "runtime", + "version": "2.17.0", + }, + { + "name": "com.generated.api/typespec-java-java-runtime", + "type": "runtime", + "version": "0.0.0", + }, + { + "name": "io.github.cdklabs/cdknag", + "type": "runtime", + "version": "2.28.60", + }, + { + "name": "io.github.cdklabs/projen", + "type": "runtime", + "version": "0.80.10", + }, + { + "name": "org.projectlombok/lombok", + "type": "runtime", + "version": "1.18.30", + }, + { + "name": "software.amazon.awscdk/aws-cdk-lib", + "type": "runtime", + "version": "2.133.0", + }, + { + "name": "software.aws/pdk", + "type": "runtime", + "version": "0.0.0", + }, + { + "name": "software.constructs/constructs", + "type": "runtime", + "version": "10.3.0", + }, + ], + }, + "generated/infrastructure/java/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "pom.xml", + "project.json", + ], + }, + "generated/infrastructure/java/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "mvn compiler:compile", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "java-cdk-infrastructure" --metadata '{"srcDir":"src/main/java/com/generated/api/typespecjavajavainfra/infra","packageName":"com.generated.api.typespecjavajavainfra.infra","runtimePackageName":"com.generated.api.typespecjavajavaruntime.runtime","enableMockIntegrations":true,"x-handlers-python-module":"typespec_java_python_handlers","x-handlers-java-package":"com.generated.api.typespecjavajavahandlers.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/typespec-java-java-handlers/0.0.0/typespec-java-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 src/main/resources", + }, + { + "exec": "cp -f ../../../model/.api.json src/main/resources/.api.json", + }, + { + "exec": "echo $(pwd) > src/main/resources/project-absolute-path.txt", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-mock-data --specPath ../../../model/.api.json --outputPath src/main/resources", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "env": { + "MAVEN_OPTS": "-XX:+TieredCompilation -XX:TieredStopAtLevel=1", + }, + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/java", + }, + { + "exec": "mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/dist/java", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "generated/infrastructure/java/README.md": "# replace this", + "generated/infrastructure/java/pom.xml": " + + 4.0.0 + com.generated.api + typespec-java-java-infra + 0.0.0 + jar + typespecjavajavainfra + + UTF-8 + + + + file://../../runtime/java/dist/java + com.generated.api-typespec-java-java-runtime-repo + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + + 3.6 + + + + + + enforce-maven + + enforce + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + true + + true + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + false + protected + false + + -J-XX:+TieredCompilation + -J-XX:TieredStopAtLevel=1 + + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + + + + com.fasterxml.jackson.core + jackson-databind + 2.17.0 + + + com.generated.api + typespec-java-java-runtime + 0.0.0 + + + io.github.cdklabs + cdknag + 2.28.60 + + + io.github.cdklabs + projen + 0.80.10 + + + org.projectlombok + lombok + 1.18.30 + + + software.amazon.awscdk + aws-cdk-lib + 2.133.0 + + + software.aws + pdk + 0.0.0 + + + software.constructs + constructs + 10.3.0 + + + +", + "generated/infrastructure/java/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespecjavajavaruntime", + "typespec-java-model", + ], + "name": "typespecjavajavainfra", + "root": "generated/infrastructure/java", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "generated/infrastructure/java", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "generated/infrastructure/java", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "generated/infrastructure/java", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen generate", + "cwd": "generated/infrastructure/java", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "generated/infrastructure/java", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "generated/infrastructure/java", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "generated/infrastructure/java", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "generated/infrastructure/java", + }, + }, + }, + }, + "generated/runtime/README.md": "## Generated Runtimes + +This directory contains generated runtime projects based on your API model. + +Each runtime project includes types from your API model, as well as type-safe client and server code.", + "generated/runtime/java/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pom.xml linguist-generated", + "generated/runtime/java/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pom.xml +.classpath +.project +.settings +target +dist/java +src +docs +api +README.md +.openapi-generator +.tsapi-manifest +", + "generated/runtime/java/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "metadata": { + "configuration": { + "source": "1.8", + "target": "1.8", + }, + }, + "name": "org.apache.maven.plugins/maven-compiler-plugin", + "type": "build", + "version": "3.8.1", + }, + { + "metadata": { + "configuration": { + "rules": [ + { + "requireMavenVersion": [ + { + "version": "3.6", + }, + ], + }, + ], + }, + "executions": [ + { + "goals": [ + "enforce", + ], + "id": "enforce-maven", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-enforcer-plugin", + "type": "build", + "version": "3.0.0-M3", + }, + { + "metadata": { + "configuration": { + "archive": { + "index": true, + "manifest": { + "addDefaultImplementationEntries": true, + "addDefaultSpecificationEntries": true, + }, + }, + }, + }, + "name": "org.apache.maven.plugins/maven-jar-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "additionalJOptions": { + "additionalJOption": [ + "-J-XX:+TieredCompilation", + "-J-XX:TieredStopAtLevel=1", + ], + }, + "detectJavaApiLink": false, + "failOnError": false, + "show": "protected", + }, + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-javadocs", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-javadoc-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-sources", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-source-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "com.amazonaws/aws-lambda-java-core", + "type": "runtime", + "version": "1.2.1", + }, + { + "name": "com.amazonaws/aws-lambda-java-events", + "type": "runtime", + "version": "3.11.0", + }, + { + "name": "com.google.code.findbugs/jsr305", + "type": "runtime", + "version": "3.0.2", + }, + { + "name": "com.google.code.gson/gson", + "type": "runtime", + "version": "2.9.1", + }, + { + "name": "com.squareup.okhttp3/logging-interceptor", + "type": "runtime", + "version": "4.10.0", + }, + { + "name": "com.squareup.okhttp3/okhttp", + "type": "runtime", + "version": "4.10.0", + }, + { + "name": "io.github.crac/org-crac", + "type": "runtime", + "version": "0.1.3", + }, + { + "name": "io.gsonfire/gson-fire", + "type": "runtime", + "version": "1.8.5", + }, + { + "name": "io.swagger/swagger-annotations", + "type": "runtime", + "version": "1.6.8", + }, + { + "name": "jakarta.annotation/jakarta.annotation-api", + "type": "runtime", + "version": "1.3.5", + }, + { + "name": "javax.ws.rs/javax.ws.rs-api", + "type": "runtime", + "version": "2.1.1", + }, + { + "name": "javax.ws.rs/jsr311-api", + "type": "runtime", + "version": "1.1.1", + }, + { + "name": "org.apache.commons/commons-lang3", + "type": "runtime", + "version": "3.12.0", + }, + { + "name": "org.openapitools/jackson-databind-nullable", + "type": "runtime", + "version": "0.2.4", + }, + { + "name": "org.projectlombok/lombok", + "type": "runtime", + "version": "1.18.24", + }, + { + "name": "software.amazon.lambda/powertools-logging", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.amazon.lambda/powertools-metrics", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.amazon.lambda/powertools-tracing", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.constructs/constructs", + "type": "runtime", + "version": "10.3.0", + }, + { + "name": "org.junit.jupiter/junit-jupiter-api", + "type": "test", + "version": "5.9.1", + }, + { + "name": "org.mockito/mockito-core", + "type": "test", + "version": "3.12.4", + }, + ], + }, + "generated/runtime/java/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "pom.xml", + ], + }, + "generated/runtime/java/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "mvn compiler:compile", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "java" --metadata '{"groupId":"com.generated.api","artifactId":"typespec-java-java-runtime","artifactVersion":"0.0.0","packageName":"com.generated.api.typespecjavajavaruntime.runtime","srcDir":"src/main/java/com/generated/api/typespecjavajavaruntime/runtime"}'", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "env": { + "MAVEN_OPTS": "-XX:+TieredCompilation -XX:TieredStopAtLevel=1", + }, + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/java", + }, + { + "exec": "mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/dist/java", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "generated/runtime/java/README.md": "# replace this", + "generated/runtime/java/pom.xml": " + + 4.0.0 + com.generated.api + typespec-java-java-runtime + 0.0.0 + jar + typespecjavajavaruntime + + UTF-8 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + + 3.6 + + + + + + enforce-maven + + enforce + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + true + + true + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + false + protected + false + + -J-XX:+TieredCompilation + -J-XX:TieredStopAtLevel=1 + + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + + + + com.amazonaws + aws-lambda-java-core + 1.2.1 + + + com.amazonaws + aws-lambda-java-events + 3.11.0 + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.google.code.gson + gson + 2.9.1 + + + com.squareup.okhttp3 + logging-interceptor + 4.10.0 + + + com.squareup.okhttp3 + okhttp + 4.10.0 + + + io.github.crac + org-crac + 0.1.3 + + + io.gsonfire + gson-fire + 1.8.5 + + + io.swagger + swagger-annotations + 1.6.8 + + + jakarta.annotation + jakarta.annotation-api + 1.3.5 + + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + + + javax.ws.rs + jsr311-api + 1.1.1 + + + org.apache.commons + commons-lang3 + 3.12.0 + + + org.openapitools + jackson-databind-nullable + 0.2.4 + + + org.projectlombok + lombok + 1.18.24 + + + software.amazon.lambda + powertools-logging + 1.18.0 + + + software.amazon.lambda + powertools-metrics + 1.18.0 + + + software.amazon.lambda + powertools-tracing + 1.18.0 + + + software.constructs + constructs + 10.3.0 + + + org.junit.jupiter + junit-jupiter-api + 5.9.1 + test + + + org.mockito + mockito-core + 3.12.4 + test + + + +", + "generated/runtime/python/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pyproject.toml linguist-generated", + "generated/runtime/python/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pyproject.toml +/poetry.toml +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +typespec_java_python_runtime +docs +README.md +.openapi-generator +.tsapi-manifest +", + "generated/runtime/python/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "aenum", + "type": "runtime", + "version": "^3.1.11", + }, + { + "name": "aws-lambda-powertools", + "type": "runtime", + "version": "{extras=["tracer", "aws-sdk"],version="^2.28.0"}", + }, + { + "name": "pydantic", + "type": "runtime", + "version": "^2.5.2", + }, + { + "name": "python-dateutil", + "type": "runtime", + "version": "~2.8.2", + }, + { + "name": "python", + "type": "runtime", + "version": "^3.9", + }, + { + "name": "urllib3", + "type": "runtime", + "version": "~1.26.7", + }, + ], + }, + "generated/runtime/python/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "poetry.toml", + "pyproject.toml", + ], + }, + "generated/runtime/python/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(echo $(poetry env info -p)/bin:$PATH)", + "VIRTUAL_ENV": "$(poetry env info -p || poetry run poetry env info -p)", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "python" --metadata '{"srcDir":"typespec_java_python_runtime","moduleName":"typespec_java_python_runtime","projectName":"typespec-java-python-runtime"}'", + }, + ], + }, + "install": { + "description": "Install dependencies and update lockfile", + "name": "install", + "steps": [ + { + "exec": "mkdir -p typespec_java_python_runtime && touch typespec_java_python_runtime/__init__.py README.md", + }, + { + "exec": "poetry update", + }, + ], + }, + "install:ci": { + "description": "Install dependencies with frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "mkdir -p typespec_java_python_runtime && touch typespec_java_python_runtime/__init__.py README.md", + }, + { + "exec": "poetry check --lock && poetry install", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "poetry build", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "publish": { + "description": "Uploads the package to PyPI.", + "name": "publish", + "steps": [ + { + "exec": "poetry publish", + }, + ], + }, + "publish:test": { + "description": "Uploads the package against a test PyPI endpoint.", + "name": "publish:test", + "steps": [ + { + "exec": "poetry publish -r testpypi", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "generated/runtime/python/README.md": "# replace this", + "generated/runtime/python/poetry.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[repositories.testpypi] +url = "https://test.pypi.org/legacy/" +", + "generated/runtime/python/pyproject.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[tool.poetry] +name = "typespec-java-python-runtime" +version = "0.0.0" +description = "" +authors = [ "APJ Cope " ] +readme = "README.md" +include = [ + "typespec_java_python_runtime", + "typespec_java_python_runtime/**/*.py" +] + + [[tool.poetry.packages]] + include = "typespec_java_python_runtime" + + [tool.poetry.dependencies] + aenum = "^3.1.11" + pydantic = "^2.5.2" + python-dateutil = "~2.8.2" + python = "^3.9" + urllib3 = "~1.26.7" + + [tool.poetry.dependencies.aws-lambda-powertools] + extras = [ "tracer", "aws-sdk" ] + version = "^2.28.0" + +[tool.poetry.group.dev] +dependencies = { } + +[build-system] +requires = [ "poetry-core" ] +build-backend = "poetry.core.masonry.api" +", + "generated/runtime/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc 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 +/pnpm-lock.yaml linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated", + "generated/runtime/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/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 +!/.npmrc +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.npmignore +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/ +/src +/dist +", + "generated/runtime/typescript/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +resolution-mode=highest +strict-peer-dependencies=false +", + "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", + "version": "^18", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "@aws-lambda-powertools/logger", + "type": "runtime", + }, + { + "name": "@aws-lambda-powertools/metrics", + "type": "runtime", + }, + { + "name": "@aws-lambda-powertools/tracer", + "type": "runtime", + }, + { + "name": "@types/aws-lambda", + "type": "runtime", + }, + ], + }, + "generated/runtime/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "generated/runtime/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=typescript,@aws-lambda-powertools/logger,@aws-lambda-powertools/metrics,@aws-lambda-powertools/tracer,@types/aws-lambda", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "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", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "generated/runtime/typescript/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. +", + "generated/runtime/typescript/README.md": "# replace this", + "generated/runtime/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "@aws-lambda-powertools/logger": "*", + "@aws-lambda-powertools/metrics": "*", + "@aws-lambda-powertools/tracer": "*", + "@types/aws-lambda": "*", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/node": "^18", + "typescript": "*", + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-java-typescript-runtime", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "generated/runtime/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "generated/runtime/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "handlers/README.md": "## Handlers + +This directory contains lambda handlers for implementing your API. + +Whenever an operation is annotated with the \`@handler\` trait in Smithy (or the \`x-handler\` vendor extension in OpenAPI), a stub handler implementation will be generated for you, which you are free to modify.", + "handlers/java/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pom.xml linguist-generated +/project.json linguist-generated", + "handlers/java/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pom.xml +.classpath +.project +.settings +target +dist/java +.openapi-generator +.tsapi-manifest +!/project.json +", + "handlers/java/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "com.github.edwgiz/maven-shade-plugin.log4j2-cachefile-transformer", + "type": "build", + "version": "2.15.0", + }, + { + "metadata": { + "configuration": { + "source": "1.8", + "target": "1.8", + }, + }, + "name": "org.apache.maven.plugins/maven-compiler-plugin", + "type": "build", + "version": "3.8.1", + }, + { + "metadata": { + "configuration": { + "rules": [ + { + "requireMavenVersion": [ + { + "version": "3.6", + }, + ], + }, + ], + }, + "executions": [ + { + "goals": [ + "enforce", + ], + "id": "enforce-maven", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-enforcer-plugin", + "type": "build", + "version": "3.0.0-M3", + }, + { + "metadata": { + "configuration": { + "archive": { + "index": true, + "manifest": { + "addDefaultImplementationEntries": true, + "addDefaultSpecificationEntries": true, + }, + }, + }, + }, + "name": "org.apache.maven.plugins/maven-jar-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "additionalJOptions": { + "additionalJOption": [ + "-J-XX:+TieredCompilation", + "-J-XX:TieredStopAtLevel=1", + ], + }, + "detectJavaApiLink": false, + "failOnError": false, + "show": "protected", + }, + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-javadocs", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-javadoc-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "createDependencyReducedPom": false, + "transformers": [ + { + "transformer": { + "@implementation": "com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer", + }, + }, + ], + }, + "dependencies": [ + "com.github.edwgiz/maven-shade-plugin.log4j2-cachefile-transformer@2.15.0", + ], + "executions": [ + { + "goals": [ + "shade", + ], + "id": "shade-task", + "phase": "package", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-shade-plugin", + "type": "build", + "version": "3.3.0", + }, + { + "metadata": { + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-sources", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-source-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "org.apache.maven.plugins/maven-surefire-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "com.generated.api/typespec-java-java-runtime", + "type": "runtime", + "version": "0.0.0", + }, + { + "name": "software.constructs/constructs", + "type": "runtime", + "version": "10.3.0", + }, + { + "name": "org.junit.jupiter/junit-jupiter-engine", + "type": "test", + "version": "5.10.2", + }, + ], + }, + "handlers/java/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "pom.xml", + "project.json", + ], + }, + "handlers/java/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "mvn compiler:compile", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "java-lambda-handlers" --metadata '{"srcDir":"src/main/java/com/generated/api/typespecjavajavahandlers/handlers","tstDir":"src/test/java/com/generated/api/typespecjavajavahandlers/handlers","packageName":"com.generated.api.typespecjavajavahandlers.handlers","runtimePackageName":"com.generated.api.typespecjavajavaruntime.runtime"}'", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "env": { + "MAVEN_OPTS": "-XX:+TieredCompilation -XX:TieredStopAtLevel=1", + }, + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/java", + }, + { + "exec": "mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/dist/java", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "handlers/java/README.md": "# replace this", + "handlers/java/pom.xml": " + + 4.0.0 + com.generated.api + typespec-java-java-handlers + 0.0.0 + jar + typespecjavajavahandlers + + UTF-8 + + + + file://../../generated/runtime/java/dist/java + com.generated.api-typespec-java-java-runtime-repo + + + + + + com.github.edwgiz + maven-shade-plugin.log4j2-cachefile-transformer + 2.15.0 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + + 3.6 + + + + + + enforce-maven + + enforce + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + true + + true + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + false + protected + false + + -J-XX:+TieredCompilation + -J-XX:TieredStopAtLevel=1 + + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.3.0 + + false + + + + + + + com.github.edwgiz + maven-shade-plugin.log4j2-cachefile-transformer + 2.15.0 + + + + + shade-task + + shade + + package + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.1 + + + + + + com.generated.api + typespec-java-java-runtime + 0.0.0 + + + software.constructs + constructs + 10.3.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.10.2 + test + + + +", + "handlers/java/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespecjavajavaruntime", + ], + "name": "typespecjavajavahandlers", + "root": "handlers/java", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "handlers/java", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "handlers/java", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "handlers/java", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen generate", + "cwd": "handlers/java", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "handlers/java", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "handlers/java", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "handlers/java", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "handlers/java", + }, + }, + }, + }, + "handlers/java/src/main/resources/log4j2.xml": " + + + + + + + + + + + + + + +", + "handlers/python/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/project.json linguist-generated +/pyproject.toml linguist-generated", + "handlers/python/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pyproject.toml +/poetry.toml +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +.openapi-generator +.tsapi-manifest +!/project.json +", + "handlers/python/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "python", + "type": "runtime", + "version": "^3.11", + }, + { + "name": "typespec-java-python-runtime", + "type": "runtime", + "version": "{path="../../generated/runtime/python", develop=true}", + }, + { + "name": "pytest", + "type": "test", + "version": "7.4.3", + }, + ], + }, + "handlers/python/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "poetry.toml", + "project.json", + "pyproject.toml", + ], + }, + "handlers/python/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(echo $(poetry env info -p)/bin:$PATH)", + "VIRTUAL_ENV": "$(poetry env info -p || poetry run poetry env info -p)", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "python-lambda-handlers" --metadata '{"srcDir":"typespec_java_python_handlers","tstDir":"test","runtimeModuleName":"typespec_java_python_runtime","moduleName":"typespec_java_python_handlers"}'", + }, + ], + }, + "install": { + "description": "Install dependencies and update lockfile", + "name": "install", + "steps": [ + { + "exec": "poetry update", + }, + ], + }, + "install:ci": { + "description": "Install dependencies with frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "poetry check --lock && poetry install", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "poetry build", + }, + { + "exec": "mkdir -p dist/lambda && rm -rf dist/lambda/*", + }, + { + "exec": "cp -r typespec_java_python_handlers dist/lambda/typespec_java_python_handlers", + }, + { + "exec": "poetry export --without-hashes --format=requirements.txt | sed -E 's/^-e[[:space:]]+//' > dist/lambda/requirements.txt", + }, + { + "exec": "pip install -r dist/lambda/requirements.txt --target dist/lambda --upgrade --platform manylinux2014_x86_64 --only-binary :all: --python-version 3.11", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "publish": { + "description": "Uploads the package to PyPI.", + "name": "publish", + "steps": [ + { + "exec": "poetry publish", + }, + ], + }, + "publish:test": { + "description": "Uploads the package against a test PyPI endpoint.", + "name": "publish:test", + "steps": [ + { + "exec": "poetry publish -r testpypi", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "pytest test/ || ([ $? = 5 ] && exit 0 || exit $?)", + }, + ], + }, + }, + }, + "handlers/python/README.md": "# replace this", + "handlers/python/poetry.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[repositories.testpypi] +url = "https://test.pypi.org/legacy/" +", + "handlers/python/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-java-python-runtime", + ], + "name": "typespec-java-python-handlers", + "root": "handlers/python", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "handlers/python", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "handlers/python", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "handlers/python", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen generate", + "cwd": "handlers/python", + }, + }, + "install": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen install", + "cwd": "handlers/python", + }, + }, + "install:ci": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen install:ci", + "cwd": "handlers/python", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "handlers/python", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "handlers/python", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "handlers/python", + }, + }, + "publish": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen publish", + "cwd": "handlers/python", + }, + }, + "publish:test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen publish:test", + "cwd": "handlers/python", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "handlers/python", + }, + }, + }, + }, + "handlers/python/pyproject.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[tool.poetry] +name = "typespec-java-python-handlers" +version = "0.0.0" +description = "" +authors = [ "APJ Cope " ] +readme = "README.md" +include = [ + "typespec_java_python_handlers", + "typespec_java_python_handlers/**/*.py" +] + + [[tool.poetry.packages]] + include = "typespec_java_python_handlers" + + [tool.poetry.dependencies] + python = "^3.11" + + [tool.poetry.dependencies.typespec-java-python-runtime] + path = "../../generated/runtime/python" + develop = true + +[tool.poetry.group.dev.dependencies] +pytest = "7.4.3" + +[build-system] +requires = [ "poetry-core" ] +build-backend = "poetry.core.masonry.api" +", + "handlers/python/typespec_java_python_handlers/__init__.py": "#", + "handlers/typescript/.eslintrc.json": { + "env": { + "jest": true, + "node": true, + }, + "extends": [ + "plugin:import/typescript", + ], + "ignorePatterns": [ + "*.js", + "*.d.ts", + "node_modules/", + "*.generated.ts", + "coverage", + ], + "overrides": [], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "project": "./tsconfig.dev.json", + "sourceType": "module", + }, + "plugins": [ + "@typescript-eslint", + "import", + ], + "root": true, + "rules": { + "@typescript-eslint/indent": [ + "error", + 2, + ], + "@typescript-eslint/member-delimiter-style": [ + "error", + ], + "@typescript-eslint/member-ordering": [ + "error", + { + "default": [ + "public-static-field", + "public-static-method", + "protected-static-field", + "protected-static-method", + "private-static-field", + "private-static-method", + "field", + "constructor", + "method", + ], + }, + ], + "@typescript-eslint/no-floating-promises": [ + "error", + ], + "@typescript-eslint/no-require-imports": [ + "error", + ], + "@typescript-eslint/no-shadow": [ + "error", + ], + "@typescript-eslint/return-await": [ + "error", + ], + "array-bracket-newline": [ + "error", + "consistent", + ], + "array-bracket-spacing": [ + "error", + "never", + ], + "brace-style": [ + "error", + "1tbs", + { + "allowSingleLine": true, + }, + ], + "comma-dangle": [ + "error", + "always-multiline", + ], + "comma-spacing": [ + "error", + { + "after": true, + "before": false, + }, + ], + "curly": [ + "error", + "multi-line", + "consistent", + ], + "dot-notation": [ + "error", + ], + "import/no-duplicates": [ + "error", + ], + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": [ + "**/test/**", + "**/build-tools/**", + ], + "optionalDependencies": false, + "peerDependencies": true, + }, + ], + "import/no-unresolved": [ + "error", + ], + "import/order": [ + "warn", + { + "alphabetize": { + "caseInsensitive": true, + "order": "asc", + }, + "groups": [ + "builtin", + "external", + ], + }, + ], + "indent": [ + "off", + ], + "key-spacing": [ + "error", + ], + "keyword-spacing": [ + "error", + ], + "max-len": [ + "error", + { + "code": 150, + "ignoreComments": true, + "ignoreRegExpLiterals": true, + "ignoreStrings": true, + "ignoreTemplateLiterals": true, + "ignoreUrls": true, + }, + ], + "no-bitwise": [ + "error", + ], + "no-multi-spaces": [ + "error", + { + "ignoreEOLComments": false, + }, + ], + "no-multiple-empty-lines": [ + "error", + ], + "no-return-await": [ + "off", + ], + "no-shadow": [ + "off", + ], + "no-trailing-spaces": [ + "error", + ], + "object-curly-newline": [ + "error", + { + "consistent": true, + "multiline": true, + }, + ], + "object-curly-spacing": [ + "error", + "always", + ], + "object-property-newline": [ + "error", + { + "allowAllPropertiesOnSameLine": true, + }, + ], + "quote-props": [ + "error", + "consistent-as-needed", + ], + "quotes": [ + "error", + "single", + { + "avoidEscape": true, + }, + ], + "semi": [ + "error", + "always", + ], + "space-before-blocks": [ + "error", + ], + }, + "settings": { + "import/parsers": { + "@typescript-eslint/parser": [ + ".ts", + ".tsx", + ], + }, + "import/resolver": { + "node": {}, + "typescript": { + "alwaysTryTypes": true, + "project": "./tsconfig.dev.json", + }, + }, + }, + }, + "handlers/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.eslintrc.json linguist-generated +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc 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 +/pnpm-lock.yaml linguist-generated +/project.json linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated", + "handlers/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/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 +/test-reports/ +junit.xml +/coverage/ +!/.npmrc +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.eslintrc.json +!/.npmignore +.openapi-generator +.tsapi-metadata +!/project.json +", + "handlers/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/src +/dist +", + "handlers/typescript/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +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", + }, + { + "name": "@types/jest", + "type": "build", + }, + { + "name": "@types/node", + "type": "build", + "version": "^18", + }, + { + "name": "@typescript-eslint/eslint-plugin", + "type": "build", + "version": "^7", + }, + { + "name": "@typescript-eslint/parser", + "type": "build", + "version": "^7", + }, + { + "name": "esbuild", + "type": "build", + }, + { + "name": "eslint-import-resolver-typescript", + "type": "build", + }, + { + "name": "eslint-plugin-import", + "type": "build", + }, + { + "name": "eslint", + "type": "build", + "version": "^8", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + { + "name": "ts-jest", + "type": "build", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "typespec-java-typescript-runtime", + "type": "runtime", + "version": "file:../../generated/runtime/typescript", + }, + ], + }, + "handlers/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".eslintrc.json", + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "project.json", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "handlers/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "eslint": { + "description": "Runs eslint against the codebase", + "name": "eslint", + "steps": [ + { + "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern $@ src test build-tools", + "receiveArgs": true, + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "typescript-lambda-handlers" --metadata '{"srcDir":"src","tstDir":"test","runtimePackageName":"typespec-java-typescript-runtime"}'", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm link /../../generated/runtime/typescript", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + { + "exec": "mkdir -p dist/lambda && rm -rf dist/lambda/*", + }, + { + "exec": "esbuild --bundle src/*.ts --platform=node --outdir=dist/lambda --target=node18", + }, + { + "exec": "for f in $(ls dist/lambda); do mkdir dist/lambda/$(basename $f .js) && mv dist/lambda/$f dist/lambda/$(basename $f .js)/index.js; done", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + { + "spawn": "eslint", + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,@types/jest,esbuild,eslint-import-resolver-typescript,eslint-plugin-import,jest,ts-jest,typescript", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "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 typespec-java-typescript-runtime", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "handlers/typescript/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. +", + "handlers/typescript/README.md": "# replace this", + "handlers/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "typespec-java-typescript-runtime": "file:../../generated/runtime/typescript", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/aws-lambda": "*", + "@types/jest": "*", + "@types/node": "^18", + "@typescript-eslint/eslint-plugin": "^7", + "@typescript-eslint/parser": "^7", + "esbuild": "*", + "eslint": "^8", + "eslint-import-resolver-typescript": "*", + "eslint-plugin-import": "*", + "jest": "*", + "jest-junit": "^15", + "ts-jest": "*", + "typescript": "*", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "/src/**/__tests__/**/*.ts?(x)", + "/@(test|src)/**/*(*.)@(spec|test).ts?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "transform": { + "^.+\\.[t]sx?$": [ + "ts-jest", + { + "tsconfig": "tsconfig.dev.json", + }, + ], + }, + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-java-typescript-handlers", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "eslint": "npx projen eslint", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "handlers/typescript/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-java-typescript-runtime", + ], + "name": "typespec-java-typescript-handlers", + "root": "handlers/typescript", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen build", + "cwd": "handlers/typescript", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen compile", + "cwd": "handlers/typescript", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen default", + "cwd": "handlers/typescript", + }, + }, + "eslint": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen eslint", + "cwd": "handlers/typescript", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen generate", + "cwd": "handlers/typescript", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen package", + "cwd": "handlers/typescript", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-compile", + "cwd": "handlers/typescript", + }, + }, + "post-upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-upgrade", + "cwd": "handlers/typescript", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen pre-compile", + "cwd": "handlers/typescript", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test", + "cwd": "handlers/typescript", + }, + }, + "test:watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test:watch", + "cwd": "handlers/typescript", + }, + }, + "upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen upgrade", + "cwd": "handlers/typescript", + }, + }, + "watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen watch", + "cwd": "handlers/typescript", + }, + }, + }, + }, + "handlers/typescript/src/index.ts": "", + "handlers/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "handlers/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "model/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/generated/aws-pdk/prelude.js linguist-generated +/generated/aws-pdk/prelude.tsp linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/pnpm-lock.yaml linguist-generated +/tspconfig.yaml linguist-generated", + "model/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +!/LICENSE +!/.npmignore +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 +/test-reports/ +junit.xml +/coverage/ +!/.npmrc +dist +!/tspconfig.yaml +!/generated/aws-pdk/prelude.tsp +!/generated/aws-pdk/prelude.js +.api.json +", + "model/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/test-reports/ +junit.xml +/coverage/ +/.gitattributes +", + "model/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +resolution-mode=highest +", + "model/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@typespec/compiler", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/http", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi3", + "type": "build", + "version": "^0.61", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + ], + }, + "model/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/aws-pdk/prelude.js", + "generated/aws-pdk/prelude.tsp", + "LICENSE", + "tspconfig.yaml", + ], + }, + "model/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "env": { + "NODE_OPTIONS": "--experimental-default-type=module", + }, + "name": "generate", + "steps": [ + { + "exec": "tsp compile src --config tspconfig.yaml", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath dist/@typespec/openapi3/openapi.json --outputPath .api.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=jest", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "exec": "pnpm update @aws/pdk @typespec/compiler @typespec/http @typespec/openapi @typespec/openapi3 jest jest-junit", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + }, + }, + "model/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. +", + "model/README.md": "# replace this", + "model/generated/aws-pdk/prelude.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +", + "model/generated/aws-pdk/prelude.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.js"; + +using TypeSpec.Reflection; + +model HandlerOptions { + language: "java" | "python" | "typescript"; +} + +extern dec handler(target: Operation, options: HandlerOptions); +", + "model/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "devDependencies": { + "@aws/pdk": "^0", + "@typespec/compiler": "^0.61", + "@typespec/http": "^0.61", + "@typespec/openapi": "^0.61", + "@typespec/openapi3": "^0.61", + "jest": "*", + "jest-junit": "^15", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-java-model", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "upgrade": "npx projen upgrade", + }, + "version": "0.0.0", + }, + "model/src/main.tsp": "import "@typespec/http"; +import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; + +import "./types/errors.tsp"; + +using Http; +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyService", +}) +@info({ + version: "1.0", +}) +namespace MyService; + +@handler({ language: "java" }) +@get +@route("/hello") +op SayHello(@query name: string): + | { + @statusCode statusCode: 200; + @body body: { + message: string; + }; + } + | BadRequestError + | NotAuthorizedError + | NotFoundError + | InternalFailureError; +", + "model/src/types/errors.tsp": "import "@typespec/http"; + +using Http; + +/** + * An error at the fault of the client sending invalid input + */ +model BadRequestErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An internal failure at the fault of the server + */ +model InternalFailureErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client not being authorized to access the resource + */ +model NotAuthorizedErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client attempting to access a missing resource + */ +model NotFoundErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * BadRequestError 400 response + */ +@error +model BadRequestError { + @statusCode statusCode: 400; + @body body: BadRequestErrorResponseContent; +} + +/** + * NotAuthorizedError 403 response + */ +@error +model NotAuthorizedError { + @statusCode statusCode: 403; + @body body: NotAuthorizedErrorResponseContent; +} + +/** + * NotFoundError 404 response + */ +@error +model NotFoundError { + @statusCode statusCode: 404; + @body body: NotFoundErrorResponseContent; +} + +/** + * InternalFailureError 500 response + */ +@error +model InternalFailureError { + @statusCode statusCode: 500; + @body body: InternalFailureErrorResponseContent; +} +", + "model/tspconfig.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +emit: + - "@typespec/openapi3" +options: + "@typespec/openapi3": + output-file: openapi.json +output-dir: "{cwd}/dist" +", +} +`; + +exports[`Type Safe Api Project Unit Tests TypeSpec With python Infra 1`] = ` +{ + ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/generated/runtime/README.md +!/handlers/README.md +!/generated/infrastructure/README.md +", + ".projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/infrastructure/README.md", + "generated/runtime/README.md", + "handlers/README.md", + ], + }, + ".projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "default", + }, + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "cwd": "model", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/python", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/java", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/typescript", + "exec": "npx projen build", + }, + { + "cwd": "generated/infrastructure/python", + "exec": "npx projen build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + }, + "eject": { + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": [ + { + "spawn": "default", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "README.md": "# Type Safe API + +This project contains an API built with Type Safe API. + +Please refer to the [Type Safe API Documentation](https://aws.github.io/aws-pdk/developer_guides/type-safe-api/index.html) for details about the project structure and how to add operations. +", + "generated/infrastructure/README.md": "## Generated Infrastructure + +This directory contains a generated type-safe CDK construct which can provision the API gateway infrastructure for an API based on your model.", + "generated/infrastructure/python/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/project.json linguist-generated +/pyproject.toml linguist-generated", + "generated/infrastructure/python/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pyproject.toml +/poetry.toml +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +typespec_python_python_infra +mocks +.openapi-generator +.tsapi-manifest +!/project.json +", + "generated/infrastructure/python/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "aws_pdk", + "type": "runtime", + "version": "^0", + }, + { + "name": "aws-cdk-lib", + "type": "runtime", + "version": "^2", + }, + { + "name": "cdk-nag", + "type": "runtime", + "version": "^2", + }, + { + "name": "constructs", + "type": "runtime", + "version": "^10", + }, + { + "name": "python", + "type": "runtime", + "version": "^3.9", + }, + { + "name": "typespec-python-python-runtime", + "type": "runtime", + "version": "{path="../../runtime/python", develop=true}", + }, + ], + }, + "generated/infrastructure/python/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "poetry.toml", + "project.json", + "pyproject.toml", + ], + }, + "generated/infrastructure/python/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(echo $(poetry env info -p)/bin:$PATH)", + "VIRTUAL_ENV": "$(poetry env info -p || poetry run poetry env info -p)", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "python-cdk-infrastructure" --metadata '{"srcDir":"typespec_python_python_infra","runtimeModuleName":"typespec_python_python_runtime","relativeSpecPath":"../../../../model/.api.json","enableMockIntegrations":true,"x-handlers-python-module":"typespec_python_python_handlers","x-handlers-java-package":"com.generated.api.typespecpythonjavahandlers.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/typespec-python-java-handlers/0.0.0/typespec-python-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": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-mock-data --specPath ../../../model/.api.json --outputPath .", + }, + ], + }, + "install": { + "description": "Install dependencies and update lockfile", + "name": "install", + "steps": [ + { + "exec": "mkdir -p typespec_python_python_infra && touch typespec_python_python_infra/__init__.py README.md", + }, + { + "exec": "poetry update", + }, + ], + }, + "install:ci": { + "description": "Install dependencies with frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "mkdir -p typespec_python_python_infra && touch typespec_python_python_infra/__init__.py README.md", + }, + { + "exec": "poetry check --lock && poetry install", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "poetry build", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "publish": { + "description": "Uploads the package to PyPI.", + "name": "publish", + "steps": [ + { + "exec": "poetry publish", + }, + ], + }, + "publish:test": { + "description": "Uploads the package against a test PyPI endpoint.", + "name": "publish:test", + "steps": [ + { + "exec": "poetry publish -r testpypi", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "generated/infrastructure/python/README.md": "# replace this", + "generated/infrastructure/python/poetry.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[repositories.testpypi] +url = "https://test.pypi.org/legacy/" +", + "generated/infrastructure/python/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-python-python-runtime", + "typespec-python-model", + ], + "name": "typespec-python-python-infra", + "root": "generated/infrastructure/python", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "generated/infrastructure/python", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "generated/infrastructure/python", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "generated/infrastructure/python", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen generate", + "cwd": "generated/infrastructure/python", + }, + }, + "install": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen install", + "cwd": "generated/infrastructure/python", + }, + }, + "install:ci": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen install:ci", + "cwd": "generated/infrastructure/python", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "generated/infrastructure/python", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "generated/infrastructure/python", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "generated/infrastructure/python", + }, + }, + "publish": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen publish", + "cwd": "generated/infrastructure/python", + }, + }, + "publish:test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen publish:test", + "cwd": "generated/infrastructure/python", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "generated/infrastructure/python", + }, + }, + }, + }, + "generated/infrastructure/python/pyproject.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[tool.poetry] +name = "typespec-python-python-infra" +version = "0.0.0" +description = "" +authors = [ "APJ Cope " ] +readme = "README.md" +include = [ + "typespec_python_python_infra", + "typespec_python_python_infra/**/*.py" +] + + [[tool.poetry.packages]] + include = "typespec_python_python_infra" + + [tool.poetry.dependencies] + aws_pdk = "^0" + aws-cdk-lib = "^2" + cdk-nag = "^2" + constructs = "^10" + python = "^3.9" + + [tool.poetry.dependencies.typespec-python-python-runtime] + path = "../../runtime/python" + develop = true + +[tool.poetry.group.dev] +dependencies = { } + +[build-system] +requires = [ "poetry-core" ] +build-backend = "poetry.core.masonry.api" +", + "generated/runtime/README.md": "## Generated Runtimes + +This directory contains generated runtime projects based on your API model. + +Each runtime project includes types from your API model, as well as type-safe client and server code.", + "generated/runtime/java/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pom.xml linguist-generated", + "generated/runtime/java/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pom.xml +.classpath +.project +.settings +target +dist/java +src +docs +api +README.md +.openapi-generator +.tsapi-manifest +", + "generated/runtime/java/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "metadata": { + "configuration": { + "source": "1.8", + "target": "1.8", + }, + }, + "name": "org.apache.maven.plugins/maven-compiler-plugin", + "type": "build", + "version": "3.8.1", + }, + { + "metadata": { + "configuration": { + "rules": [ + { + "requireMavenVersion": [ + { + "version": "3.6", + }, + ], + }, + ], + }, + "executions": [ + { + "goals": [ + "enforce", + ], + "id": "enforce-maven", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-enforcer-plugin", + "type": "build", + "version": "3.0.0-M3", + }, + { + "metadata": { + "configuration": { + "archive": { + "index": true, + "manifest": { + "addDefaultImplementationEntries": true, + "addDefaultSpecificationEntries": true, + }, + }, + }, + }, + "name": "org.apache.maven.plugins/maven-jar-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "additionalJOptions": { + "additionalJOption": [ + "-J-XX:+TieredCompilation", + "-J-XX:TieredStopAtLevel=1", + ], + }, + "detectJavaApiLink": false, + "failOnError": false, + "show": "protected", + }, + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-javadocs", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-javadoc-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-sources", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-source-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "com.amazonaws/aws-lambda-java-core", + "type": "runtime", + "version": "1.2.1", + }, + { + "name": "com.amazonaws/aws-lambda-java-events", + "type": "runtime", + "version": "3.11.0", + }, + { + "name": "com.google.code.findbugs/jsr305", + "type": "runtime", + "version": "3.0.2", + }, + { + "name": "com.google.code.gson/gson", + "type": "runtime", + "version": "2.9.1", + }, + { + "name": "com.squareup.okhttp3/logging-interceptor", + "type": "runtime", + "version": "4.10.0", + }, + { + "name": "com.squareup.okhttp3/okhttp", + "type": "runtime", + "version": "4.10.0", + }, + { + "name": "io.github.crac/org-crac", + "type": "runtime", + "version": "0.1.3", + }, + { + "name": "io.gsonfire/gson-fire", + "type": "runtime", + "version": "1.8.5", + }, + { + "name": "io.swagger/swagger-annotations", + "type": "runtime", + "version": "1.6.8", + }, + { + "name": "jakarta.annotation/jakarta.annotation-api", + "type": "runtime", + "version": "1.3.5", + }, + { + "name": "javax.ws.rs/javax.ws.rs-api", + "type": "runtime", + "version": "2.1.1", + }, + { + "name": "javax.ws.rs/jsr311-api", + "type": "runtime", + "version": "1.1.1", + }, + { + "name": "org.apache.commons/commons-lang3", + "type": "runtime", + "version": "3.12.0", + }, + { + "name": "org.openapitools/jackson-databind-nullable", + "type": "runtime", + "version": "0.2.4", + }, + { + "name": "org.projectlombok/lombok", + "type": "runtime", + "version": "1.18.24", + }, + { + "name": "software.amazon.lambda/powertools-logging", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.amazon.lambda/powertools-metrics", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.amazon.lambda/powertools-tracing", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.constructs/constructs", + "type": "runtime", + "version": "10.3.0", + }, + { + "name": "org.junit.jupiter/junit-jupiter-api", + "type": "test", + "version": "5.9.1", + }, + { + "name": "org.mockito/mockito-core", + "type": "test", + "version": "3.12.4", + }, + ], + }, + "generated/runtime/java/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "pom.xml", + ], + }, + "generated/runtime/java/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "mvn compiler:compile", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "java" --metadata '{"groupId":"com.generated.api","artifactId":"typespec-python-java-runtime","artifactVersion":"0.0.0","packageName":"com.generated.api.typespecpythonjavaruntime.runtime","srcDir":"src/main/java/com/generated/api/typespecpythonjavaruntime/runtime"}'", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "env": { + "MAVEN_OPTS": "-XX:+TieredCompilation -XX:TieredStopAtLevel=1", + }, + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/java", + }, + { + "exec": "mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/dist/java", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "generated/runtime/java/README.md": "# replace this", + "generated/runtime/java/pom.xml": " + + 4.0.0 + com.generated.api + typespec-python-java-runtime + 0.0.0 + jar + typespecpythonjavaruntime + + UTF-8 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + + 3.6 + + + + + + enforce-maven + + enforce + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + true + + true + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + false + protected + false + + -J-XX:+TieredCompilation + -J-XX:TieredStopAtLevel=1 + + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + + + + com.amazonaws + aws-lambda-java-core + 1.2.1 + + + com.amazonaws + aws-lambda-java-events + 3.11.0 + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.google.code.gson + gson + 2.9.1 + + + com.squareup.okhttp3 + logging-interceptor + 4.10.0 + + + com.squareup.okhttp3 + okhttp + 4.10.0 + + + io.github.crac + org-crac + 0.1.3 + + + io.gsonfire + gson-fire + 1.8.5 + + + io.swagger + swagger-annotations + 1.6.8 + + + jakarta.annotation + jakarta.annotation-api + 1.3.5 + + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + + + javax.ws.rs + jsr311-api + 1.1.1 + + + org.apache.commons + commons-lang3 + 3.12.0 + + + org.openapitools + jackson-databind-nullable + 0.2.4 + + + org.projectlombok + lombok + 1.18.24 + + + software.amazon.lambda + powertools-logging + 1.18.0 + + + software.amazon.lambda + powertools-metrics + 1.18.0 + + + software.amazon.lambda + powertools-tracing + 1.18.0 + + + software.constructs + constructs + 10.3.0 + + + org.junit.jupiter + junit-jupiter-api + 5.9.1 + test + + + org.mockito + mockito-core + 3.12.4 + test + + + +", + "generated/runtime/python/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pyproject.toml linguist-generated", + "generated/runtime/python/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pyproject.toml +/poetry.toml +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +typespec_python_python_runtime +docs +README.md +.openapi-generator +.tsapi-manifest +", + "generated/runtime/python/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "aenum", + "type": "runtime", + "version": "^3.1.11", + }, + { + "name": "aws-lambda-powertools", + "type": "runtime", + "version": "{extras=["tracer", "aws-sdk"],version="^2.28.0"}", + }, + { + "name": "pydantic", + "type": "runtime", + "version": "^2.5.2", + }, + { + "name": "python-dateutil", + "type": "runtime", + "version": "~2.8.2", + }, + { + "name": "python", + "type": "runtime", + "version": "^3.9", + }, + { + "name": "urllib3", + "type": "runtime", + "version": "~1.26.7", + }, + ], + }, + "generated/runtime/python/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "poetry.toml", + "pyproject.toml", + ], + }, + "generated/runtime/python/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(echo $(poetry env info -p)/bin:$PATH)", + "VIRTUAL_ENV": "$(poetry env info -p || poetry run poetry env info -p)", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "python" --metadata '{"srcDir":"typespec_python_python_runtime","moduleName":"typespec_python_python_runtime","projectName":"typespec-python-python-runtime"}'", + }, + ], + }, + "install": { + "description": "Install dependencies and update lockfile", + "name": "install", + "steps": [ + { + "exec": "mkdir -p typespec_python_python_runtime && touch typespec_python_python_runtime/__init__.py README.md", + }, + { + "exec": "poetry update", + }, + ], + }, + "install:ci": { + "description": "Install dependencies with frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "mkdir -p typespec_python_python_runtime && touch typespec_python_python_runtime/__init__.py README.md", + }, + { + "exec": "poetry check --lock && poetry install", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "poetry build", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "publish": { + "description": "Uploads the package to PyPI.", + "name": "publish", + "steps": [ + { + "exec": "poetry publish", + }, + ], + }, + "publish:test": { + "description": "Uploads the package against a test PyPI endpoint.", + "name": "publish:test", + "steps": [ + { + "exec": "poetry publish -r testpypi", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "generated/runtime/python/README.md": "# replace this", + "generated/runtime/python/poetry.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[repositories.testpypi] +url = "https://test.pypi.org/legacy/" +", + "generated/runtime/python/pyproject.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[tool.poetry] +name = "typespec-python-python-runtime" +version = "0.0.0" +description = "" +authors = [ "APJ Cope " ] +readme = "README.md" +include = [ + "typespec_python_python_runtime", + "typespec_python_python_runtime/**/*.py" +] + + [[tool.poetry.packages]] + include = "typespec_python_python_runtime" + + [tool.poetry.dependencies] + aenum = "^3.1.11" + pydantic = "^2.5.2" + python-dateutil = "~2.8.2" + python = "^3.9" + urllib3 = "~1.26.7" + + [tool.poetry.dependencies.aws-lambda-powertools] + extras = [ "tracer", "aws-sdk" ] + version = "^2.28.0" + +[tool.poetry.group.dev] +dependencies = { } + +[build-system] +requires = [ "poetry-core" ] +build-backend = "poetry.core.masonry.api" +", + "generated/runtime/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc 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 +/pnpm-lock.yaml linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated", + "generated/runtime/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/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 +!/.npmrc +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.npmignore +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/ +/src +/dist +", + "generated/runtime/typescript/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +resolution-mode=highest +strict-peer-dependencies=false +", + "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", + "version": "^18", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "@aws-lambda-powertools/logger", + "type": "runtime", + }, + { + "name": "@aws-lambda-powertools/metrics", + "type": "runtime", + }, + { + "name": "@aws-lambda-powertools/tracer", + "type": "runtime", + }, + { + "name": "@types/aws-lambda", + "type": "runtime", + }, + ], + }, + "generated/runtime/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "generated/runtime/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=typescript,@aws-lambda-powertools/logger,@aws-lambda-powertools/metrics,@aws-lambda-powertools/tracer,@types/aws-lambda", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "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", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "generated/runtime/typescript/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. +", + "generated/runtime/typescript/README.md": "# replace this", + "generated/runtime/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "@aws-lambda-powertools/logger": "*", + "@aws-lambda-powertools/metrics": "*", + "@aws-lambda-powertools/tracer": "*", + "@types/aws-lambda": "*", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/node": "^18", + "typescript": "*", + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-python-typescript-runtime", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "generated/runtime/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "generated/runtime/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "handlers/README.md": "## Handlers + +This directory contains lambda handlers for implementing your API. + +Whenever an operation is annotated with the \`@handler\` trait in Smithy (or the \`x-handler\` vendor extension in OpenAPI), a stub handler implementation will be generated for you, which you are free to modify.", + "handlers/java/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pom.xml linguist-generated +/project.json linguist-generated", + "handlers/java/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pom.xml +.classpath +.project +.settings +target +dist/java +.openapi-generator +.tsapi-manifest +!/project.json +", + "handlers/java/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "com.github.edwgiz/maven-shade-plugin.log4j2-cachefile-transformer", + "type": "build", + "version": "2.15.0", + }, + { + "metadata": { + "configuration": { + "source": "1.8", + "target": "1.8", + }, + }, + "name": "org.apache.maven.plugins/maven-compiler-plugin", + "type": "build", + "version": "3.8.1", + }, + { + "metadata": { + "configuration": { + "rules": [ + { + "requireMavenVersion": [ + { + "version": "3.6", + }, + ], + }, + ], + }, + "executions": [ + { + "goals": [ + "enforce", + ], + "id": "enforce-maven", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-enforcer-plugin", + "type": "build", + "version": "3.0.0-M3", + }, + { + "metadata": { + "configuration": { + "archive": { + "index": true, + "manifest": { + "addDefaultImplementationEntries": true, + "addDefaultSpecificationEntries": true, + }, + }, + }, + }, + "name": "org.apache.maven.plugins/maven-jar-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "additionalJOptions": { + "additionalJOption": [ + "-J-XX:+TieredCompilation", + "-J-XX:TieredStopAtLevel=1", + ], + }, + "detectJavaApiLink": false, + "failOnError": false, + "show": "protected", + }, + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-javadocs", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-javadoc-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "createDependencyReducedPom": false, + "transformers": [ + { + "transformer": { + "@implementation": "com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer", + }, + }, + ], + }, + "dependencies": [ + "com.github.edwgiz/maven-shade-plugin.log4j2-cachefile-transformer@2.15.0", + ], + "executions": [ + { + "goals": [ + "shade", + ], + "id": "shade-task", + "phase": "package", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-shade-plugin", + "type": "build", + "version": "3.3.0", + }, + { + "metadata": { + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-sources", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-source-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "org.apache.maven.plugins/maven-surefire-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "com.generated.api/typespec-python-java-runtime", + "type": "runtime", + "version": "0.0.0", + }, + { + "name": "software.constructs/constructs", + "type": "runtime", + "version": "10.3.0", + }, + { + "name": "org.junit.jupiter/junit-jupiter-engine", + "type": "test", + "version": "5.10.2", + }, + ], + }, + "handlers/java/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "pom.xml", + "project.json", + ], + }, + "handlers/java/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "mvn compiler:compile", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "java-lambda-handlers" --metadata '{"srcDir":"src/main/java/com/generated/api/typespecpythonjavahandlers/handlers","tstDir":"src/test/java/com/generated/api/typespecpythonjavahandlers/handlers","packageName":"com.generated.api.typespecpythonjavahandlers.handlers","runtimePackageName":"com.generated.api.typespecpythonjavaruntime.runtime"}'", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "env": { + "MAVEN_OPTS": "-XX:+TieredCompilation -XX:TieredStopAtLevel=1", + }, + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/java", + }, + { + "exec": "mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/dist/java", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "handlers/java/README.md": "# replace this", + "handlers/java/pom.xml": " + + 4.0.0 + com.generated.api + typespec-python-java-handlers + 0.0.0 + jar + typespecpythonjavahandlers + + UTF-8 + + + + file://../../generated/runtime/java/dist/java + com.generated.api-typespec-python-java-runtime-repo + + + + + + com.github.edwgiz + maven-shade-plugin.log4j2-cachefile-transformer + 2.15.0 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + + 3.6 + + + + + + enforce-maven + + enforce + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + true + + true + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + false + protected + false + + -J-XX:+TieredCompilation + -J-XX:TieredStopAtLevel=1 + + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.3.0 + + false + + + + + + + com.github.edwgiz + maven-shade-plugin.log4j2-cachefile-transformer + 2.15.0 + + + + + shade-task + + shade + + package + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.1 + + + + + + com.generated.api + typespec-python-java-runtime + 0.0.0 + + + software.constructs + constructs + 10.3.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.10.2 + test + + + +", + "handlers/java/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespecpythonjavaruntime", + ], + "name": "typespecpythonjavahandlers", + "root": "handlers/java", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "handlers/java", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "handlers/java", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "handlers/java", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen generate", + "cwd": "handlers/java", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "handlers/java", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "handlers/java", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "handlers/java", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "handlers/java", + }, + }, + }, + }, + "handlers/java/src/main/resources/log4j2.xml": " + + + + + + + + + + + + + + +", + "handlers/python/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/project.json linguist-generated +/pyproject.toml linguist-generated", + "handlers/python/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pyproject.toml +/poetry.toml +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +.openapi-generator +.tsapi-manifest +!/project.json +", + "handlers/python/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "python", + "type": "runtime", + "version": "^3.11", + }, + { + "name": "typespec-python-python-runtime", + "type": "runtime", + "version": "{path="../../generated/runtime/python", develop=true}", + }, + { + "name": "pytest", + "type": "test", + "version": "7.4.3", + }, + ], + }, + "handlers/python/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "poetry.toml", + "project.json", + "pyproject.toml", + ], + }, + "handlers/python/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(echo $(poetry env info -p)/bin:$PATH)", + "VIRTUAL_ENV": "$(poetry env info -p || poetry run poetry env info -p)", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "python-lambda-handlers" --metadata '{"srcDir":"typespec_python_python_handlers","tstDir":"test","runtimeModuleName":"typespec_python_python_runtime","moduleName":"typespec_python_python_handlers"}'", + }, + ], + }, + "install": { + "description": "Install dependencies and update lockfile", + "name": "install", + "steps": [ + { + "exec": "poetry update", + }, + ], + }, + "install:ci": { + "description": "Install dependencies with frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "poetry check --lock && poetry install", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "poetry build", + }, + { + "exec": "mkdir -p dist/lambda && rm -rf dist/lambda/*", + }, + { + "exec": "cp -r typespec_python_python_handlers dist/lambda/typespec_python_python_handlers", + }, + { + "exec": "poetry export --without-hashes --format=requirements.txt | sed -E 's/^-e[[:space:]]+//' > dist/lambda/requirements.txt", + }, + { + "exec": "pip install -r dist/lambda/requirements.txt --target dist/lambda --upgrade --platform manylinux2014_x86_64 --only-binary :all: --python-version 3.11", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "publish": { + "description": "Uploads the package to PyPI.", + "name": "publish", + "steps": [ + { + "exec": "poetry publish", + }, + ], + }, + "publish:test": { + "description": "Uploads the package against a test PyPI endpoint.", + "name": "publish:test", + "steps": [ + { + "exec": "poetry publish -r testpypi", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "pytest test/ || ([ $? = 5 ] && exit 0 || exit $?)", + }, + ], + }, + }, + }, + "handlers/python/README.md": "# replace this", + "handlers/python/poetry.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[repositories.testpypi] +url = "https://test.pypi.org/legacy/" +", + "handlers/python/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-python-python-runtime", + ], + "name": "typespec-python-python-handlers", + "root": "handlers/python", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "handlers/python", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "handlers/python", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "handlers/python", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen generate", + "cwd": "handlers/python", + }, + }, + "install": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen install", + "cwd": "handlers/python", + }, + }, + "install:ci": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen install:ci", + "cwd": "handlers/python", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "handlers/python", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "handlers/python", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "handlers/python", + }, + }, + "publish": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen publish", + "cwd": "handlers/python", + }, + }, + "publish:test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen publish:test", + "cwd": "handlers/python", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "handlers/python", + }, + }, + }, + }, + "handlers/python/pyproject.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[tool.poetry] +name = "typespec-python-python-handlers" +version = "0.0.0" +description = "" +authors = [ "APJ Cope " ] +readme = "README.md" +include = [ + "typespec_python_python_handlers", + "typespec_python_python_handlers/**/*.py" +] + + [[tool.poetry.packages]] + include = "typespec_python_python_handlers" + + [tool.poetry.dependencies] + python = "^3.11" + + [tool.poetry.dependencies.typespec-python-python-runtime] + path = "../../generated/runtime/python" + develop = true + +[tool.poetry.group.dev.dependencies] +pytest = "7.4.3" + +[build-system] +requires = [ "poetry-core" ] +build-backend = "poetry.core.masonry.api" +", + "handlers/python/typespec_python_python_handlers/__init__.py": "#", + "handlers/typescript/.eslintrc.json": { + "env": { + "jest": true, + "node": true, + }, + "extends": [ + "plugin:import/typescript", + ], + "ignorePatterns": [ + "*.js", + "*.d.ts", + "node_modules/", + "*.generated.ts", + "coverage", + ], + "overrides": [], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "project": "./tsconfig.dev.json", + "sourceType": "module", + }, + "plugins": [ + "@typescript-eslint", + "import", + ], + "root": true, + "rules": { + "@typescript-eslint/indent": [ + "error", + 2, + ], + "@typescript-eslint/member-delimiter-style": [ + "error", + ], + "@typescript-eslint/member-ordering": [ + "error", + { + "default": [ + "public-static-field", + "public-static-method", + "protected-static-field", + "protected-static-method", + "private-static-field", + "private-static-method", + "field", + "constructor", + "method", + ], + }, + ], + "@typescript-eslint/no-floating-promises": [ + "error", + ], + "@typescript-eslint/no-require-imports": [ + "error", + ], + "@typescript-eslint/no-shadow": [ + "error", + ], + "@typescript-eslint/return-await": [ + "error", + ], + "array-bracket-newline": [ + "error", + "consistent", + ], + "array-bracket-spacing": [ + "error", + "never", + ], + "brace-style": [ + "error", + "1tbs", + { + "allowSingleLine": true, + }, + ], + "comma-dangle": [ + "error", + "always-multiline", + ], + "comma-spacing": [ + "error", + { + "after": true, + "before": false, + }, + ], + "curly": [ + "error", + "multi-line", + "consistent", + ], + "dot-notation": [ + "error", + ], + "import/no-duplicates": [ + "error", + ], + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": [ + "**/test/**", + "**/build-tools/**", + ], + "optionalDependencies": false, + "peerDependencies": true, + }, + ], + "import/no-unresolved": [ + "error", + ], + "import/order": [ + "warn", + { + "alphabetize": { + "caseInsensitive": true, + "order": "asc", + }, + "groups": [ + "builtin", + "external", + ], + }, + ], + "indent": [ + "off", + ], + "key-spacing": [ + "error", + ], + "keyword-spacing": [ + "error", + ], + "max-len": [ + "error", + { + "code": 150, + "ignoreComments": true, + "ignoreRegExpLiterals": true, + "ignoreStrings": true, + "ignoreTemplateLiterals": true, + "ignoreUrls": true, + }, + ], + "no-bitwise": [ + "error", + ], + "no-multi-spaces": [ + "error", + { + "ignoreEOLComments": false, + }, + ], + "no-multiple-empty-lines": [ + "error", + ], + "no-return-await": [ + "off", + ], + "no-shadow": [ + "off", + ], + "no-trailing-spaces": [ + "error", + ], + "object-curly-newline": [ + "error", + { + "consistent": true, + "multiline": true, + }, + ], + "object-curly-spacing": [ + "error", + "always", + ], + "object-property-newline": [ + "error", + { + "allowAllPropertiesOnSameLine": true, + }, + ], + "quote-props": [ + "error", + "consistent-as-needed", + ], + "quotes": [ + "error", + "single", + { + "avoidEscape": true, + }, + ], + "semi": [ + "error", + "always", + ], + "space-before-blocks": [ + "error", + ], + }, + "settings": { + "import/parsers": { + "@typescript-eslint/parser": [ + ".ts", + ".tsx", + ], + }, + "import/resolver": { + "node": {}, + "typescript": { + "alwaysTryTypes": true, + "project": "./tsconfig.dev.json", + }, + }, + }, + }, + "handlers/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.eslintrc.json linguist-generated +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc 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 +/pnpm-lock.yaml linguist-generated +/project.json linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated", + "handlers/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/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 +/test-reports/ +junit.xml +/coverage/ +!/.npmrc +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.eslintrc.json +!/.npmignore +.openapi-generator +.tsapi-metadata +!/project.json +", + "handlers/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/src +/dist +", + "handlers/typescript/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +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", + }, + { + "name": "@types/jest", + "type": "build", + }, + { + "name": "@types/node", + "type": "build", + "version": "^18", + }, + { + "name": "@typescript-eslint/eslint-plugin", + "type": "build", + "version": "^7", + }, + { + "name": "@typescript-eslint/parser", + "type": "build", + "version": "^7", + }, + { + "name": "esbuild", + "type": "build", + }, + { + "name": "eslint-import-resolver-typescript", + "type": "build", + }, + { + "name": "eslint-plugin-import", + "type": "build", + }, + { + "name": "eslint", + "type": "build", + "version": "^8", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + { + "name": "ts-jest", + "type": "build", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "typespec-python-typescript-runtime", + "type": "runtime", + "version": "file:../../generated/runtime/typescript", + }, + ], + }, + "handlers/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".eslintrc.json", + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "project.json", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "handlers/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "eslint": { + "description": "Runs eslint against the codebase", + "name": "eslint", + "steps": [ + { + "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern $@ src test build-tools", + "receiveArgs": true, + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "typescript-lambda-handlers" --metadata '{"srcDir":"src","tstDir":"test","runtimePackageName":"typespec-python-typescript-runtime"}'", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm link /../../generated/runtime/typescript", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + { + "exec": "mkdir -p dist/lambda && rm -rf dist/lambda/*", + }, + { + "exec": "esbuild --bundle src/*.ts --platform=node --outdir=dist/lambda --target=node18", + }, + { + "exec": "for f in $(ls dist/lambda); do mkdir dist/lambda/$(basename $f .js) && mv dist/lambda/$f dist/lambda/$(basename $f .js)/index.js; done", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + { + "spawn": "eslint", + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,@types/jest,esbuild,eslint-import-resolver-typescript,eslint-plugin-import,jest,ts-jest,typescript", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "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 typespec-python-typescript-runtime", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "handlers/typescript/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. +", + "handlers/typescript/README.md": "# replace this", + "handlers/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "typespec-python-typescript-runtime": "file:../../generated/runtime/typescript", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/aws-lambda": "*", + "@types/jest": "*", + "@types/node": "^18", + "@typescript-eslint/eslint-plugin": "^7", + "@typescript-eslint/parser": "^7", + "esbuild": "*", + "eslint": "^8", + "eslint-import-resolver-typescript": "*", + "eslint-plugin-import": "*", + "jest": "*", + "jest-junit": "^15", + "ts-jest": "*", + "typescript": "*", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "/src/**/__tests__/**/*.ts?(x)", + "/@(test|src)/**/*(*.)@(spec|test).ts?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "transform": { + "^.+\\.[t]sx?$": [ + "ts-jest", + { + "tsconfig": "tsconfig.dev.json", + }, + ], + }, + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-python-typescript-handlers", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "eslint": "npx projen eslint", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "handlers/typescript/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-python-typescript-runtime", + ], + "name": "typespec-python-typescript-handlers", + "root": "handlers/typescript", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen build", + "cwd": "handlers/typescript", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen compile", + "cwd": "handlers/typescript", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen default", + "cwd": "handlers/typescript", + }, + }, + "eslint": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen eslint", + "cwd": "handlers/typescript", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen generate", + "cwd": "handlers/typescript", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen package", + "cwd": "handlers/typescript", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-compile", + "cwd": "handlers/typescript", + }, + }, + "post-upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-upgrade", + "cwd": "handlers/typescript", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen pre-compile", + "cwd": "handlers/typescript", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test", + "cwd": "handlers/typescript", + }, + }, + "test:watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test:watch", + "cwd": "handlers/typescript", + }, + }, + "upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen upgrade", + "cwd": "handlers/typescript", + }, + }, + "watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen watch", + "cwd": "handlers/typescript", + }, + }, + }, + }, + "handlers/typescript/src/index.ts": "", + "handlers/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "handlers/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "model/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/generated/aws-pdk/prelude.js linguist-generated +/generated/aws-pdk/prelude.tsp linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/pnpm-lock.yaml linguist-generated +/tspconfig.yaml linguist-generated", + "model/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +!/LICENSE +!/.npmignore +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 +/test-reports/ +junit.xml +/coverage/ +!/.npmrc +dist +!/tspconfig.yaml +!/generated/aws-pdk/prelude.tsp +!/generated/aws-pdk/prelude.js +.api.json +", + "model/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/test-reports/ +junit.xml +/coverage/ +/.gitattributes +", + "model/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +resolution-mode=highest +", + "model/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@typespec/compiler", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/http", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi3", + "type": "build", + "version": "^0.61", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + ], + }, + "model/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/aws-pdk/prelude.js", + "generated/aws-pdk/prelude.tsp", + "LICENSE", + "tspconfig.yaml", + ], + }, + "model/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "env": { + "NODE_OPTIONS": "--experimental-default-type=module", + }, + "name": "generate", + "steps": [ + { + "exec": "tsp compile src --config tspconfig.yaml", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath dist/@typespec/openapi3/openapi.json --outputPath .api.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=jest", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "exec": "pnpm update @aws/pdk @typespec/compiler @typespec/http @typespec/openapi @typespec/openapi3 jest jest-junit", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + }, + }, + "model/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. +", + "model/README.md": "# replace this", + "model/generated/aws-pdk/prelude.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +", + "model/generated/aws-pdk/prelude.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.js"; + +using TypeSpec.Reflection; + +model HandlerOptions { + language: "java" | "python" | "typescript"; +} + +extern dec handler(target: Operation, options: HandlerOptions); +", + "model/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "devDependencies": { + "@aws/pdk": "^0", + "@typespec/compiler": "^0.61", + "@typespec/http": "^0.61", + "@typespec/openapi": "^0.61", + "@typespec/openapi3": "^0.61", + "jest": "*", + "jest-junit": "^15", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-python-model", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "upgrade": "npx projen upgrade", + }, + "version": "0.0.0", + }, + "model/src/main.tsp": "import "@typespec/http"; +import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; + +import "./types/errors.tsp"; + +using Http; +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyService", +}) +@info({ + version: "1.0", +}) +namespace MyService; + +@handler({ language: "java" }) +@get +@route("/hello") +op SayHello(@query name: string): + | { + @statusCode statusCode: 200; + @body body: { + message: string; + }; + } + | BadRequestError + | NotAuthorizedError + | NotFoundError + | InternalFailureError; +", + "model/src/types/errors.tsp": "import "@typespec/http"; + +using Http; + +/** + * An error at the fault of the client sending invalid input + */ +model BadRequestErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An internal failure at the fault of the server + */ +model InternalFailureErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client not being authorized to access the resource + */ +model NotAuthorizedErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client attempting to access a missing resource + */ +model NotFoundErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * BadRequestError 400 response + */ +@error +model BadRequestError { + @statusCode statusCode: 400; + @body body: BadRequestErrorResponseContent; +} + +/** + * NotAuthorizedError 403 response + */ +@error +model NotAuthorizedError { + @statusCode statusCode: 403; + @body body: NotAuthorizedErrorResponseContent; +} + +/** + * NotFoundError 404 response + */ +@error +model NotFoundError { + @statusCode statusCode: 404; + @body body: NotFoundErrorResponseContent; +} + +/** + * InternalFailureError 500 response + */ +@error +model InternalFailureError { + @statusCode statusCode: 500; + @body body: InternalFailureErrorResponseContent; +} +", + "model/tspconfig.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +emit: + - "@typespec/openapi3" +options: + "@typespec/openapi3": + output-file: openapi.json +output-dir: "{cwd}/dist" +", +} +`; + +exports[`Type Safe Api Project Unit Tests TypeSpec With typescript Infra 1`] = ` +{ + ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/generated/runtime/README.md +!/handlers/README.md +!/generated/infrastructure/README.md +", + ".projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/infrastructure/README.md", + "generated/runtime/README.md", + "handlers/README.md", + ], + }, + ".projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "default", + }, + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "cwd": "model", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/typescript", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/java", + "exec": "npx projen build", + }, + { + "cwd": "generated/runtime/python", + "exec": "npx projen build", + }, + { + "cwd": "generated/infrastructure/typescript", + "exec": "npx projen build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + }, + "eject": { + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": [ + { + "spawn": "default", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "README.md": "# Type Safe API + +This project contains an API built with Type Safe API. + +Please refer to the [Type Safe API Documentation](https://aws.github.io/aws-pdk/developer_guides/type-safe-api/index.html) for details about the project structure and how to add operations. +", + "generated/infrastructure/README.md": "## Generated Infrastructure + +This directory contains a generated type-safe CDK construct which can provision the API gateway infrastructure for an API based on your model.", + "generated/infrastructure/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc 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 +/pnpm-lock.yaml linguist-generated +/project.json linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated", + "generated/infrastructure/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/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 +!/.npmrc +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest +!/project.json +", + "generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/src +/dist +", + "generated/infrastructure/typescript/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +resolution-mode=highest +", + "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", + "type": "build", + }, + { + "name": "@types/node", + "type": "build", + "version": "^18", + }, + { + "name": "aws-cdk-lib", + "type": "build", + }, + { + "name": "cdk-nag", + "type": "build", + }, + { + "name": "constructs", + "type": "build", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "@aws/pdk", + "type": "peer", + }, + { + "name": "aws-cdk-lib", + "type": "peer", + }, + { + "name": "cdk-nag", + "type": "peer", + }, + { + "name": "constructs", + "type": "peer", + }, + { + "name": "typespec-typescript-typescript-runtime", + "type": "runtime", + "version": "file:../../runtime/typescript", + }, + ], + }, + "generated/infrastructure/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "project.json", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "generated/infrastructure/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"typespec-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","enableMockIntegrations":true,"x-handlers-python-module":"typespec_typescript_python_handlers","x-handlers-java-package":"com.generated.api.typespectypescriptjavahandlers.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/typespec-typescript-java-handlers/0.0.0/typespec-typescript-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", + }, + { + "exec": "cp -f ../../../model/.api.json assets/api.json", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-mock-data --specPath ../../../model/.api.json --outputPath .", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm link /../../runtime/typescript", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "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", + }, + { + "exec": "pnpm update @aws/pdk @types/aws-lambda @types/node aws-cdk-lib cdk-nag constructs typescript typespec-typescript-typescript-runtime", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "generated/infrastructure/typescript/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. +", + "generated/infrastructure/typescript/README.md": "# replace this", + "generated/infrastructure/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "typespec-typescript-typescript-runtime": "file:../../runtime/typescript", + }, + "devDependencies": { + "@aws/pdk": "*", + "@types/aws-lambda": "*", + "@types/node": "^18", + "aws-cdk-lib": "*", + "cdk-nag": "*", + "constructs": "*", + "typescript": "*", + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-typescript-typescript-infra", + "peerDependencies": { + "@aws/pdk": "*", + "aws-cdk-lib": "*", + "cdk-nag": "*", + "constructs": "*", + }, + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "generated/infrastructure/typescript/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-typescript-typescript-runtime", + "typespec-typescript-model", + ], + "name": "typespec-typescript-typescript-infra", + "root": "generated/infrastructure/typescript", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen build", + "cwd": "generated/infrastructure/typescript", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen compile", + "cwd": "generated/infrastructure/typescript", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen default", + "cwd": "generated/infrastructure/typescript", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen generate", + "cwd": "generated/infrastructure/typescript", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen package", + "cwd": "generated/infrastructure/typescript", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-compile", + "cwd": "generated/infrastructure/typescript", + }, + }, + "post-upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-upgrade", + "cwd": "generated/infrastructure/typescript", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen pre-compile", + "cwd": "generated/infrastructure/typescript", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test", + "cwd": "generated/infrastructure/typescript", + }, + }, + "upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen upgrade", + "cwd": "generated/infrastructure/typescript", + }, + }, + "watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen watch", + "cwd": "generated/infrastructure/typescript", + }, + }, + }, + }, + "generated/infrastructure/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "generated/infrastructure/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "generated/runtime/README.md": "## Generated Runtimes + +This directory contains generated runtime projects based on your API model. + +Each runtime project includes types from your API model, as well as type-safe client and server code.", + "generated/runtime/java/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pom.xml linguist-generated", + "generated/runtime/java/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pom.xml +.classpath +.project +.settings +target +dist/java +src +docs +api +README.md +.openapi-generator +.tsapi-manifest +", + "generated/runtime/java/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "metadata": { + "configuration": { + "source": "1.8", + "target": "1.8", + }, + }, + "name": "org.apache.maven.plugins/maven-compiler-plugin", + "type": "build", + "version": "3.8.1", + }, + { + "metadata": { + "configuration": { + "rules": [ + { + "requireMavenVersion": [ + { + "version": "3.6", + }, + ], + }, + ], + }, + "executions": [ + { + "goals": [ + "enforce", + ], + "id": "enforce-maven", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-enforcer-plugin", + "type": "build", + "version": "3.0.0-M3", + }, + { + "metadata": { + "configuration": { + "archive": { + "index": true, + "manifest": { + "addDefaultImplementationEntries": true, + "addDefaultSpecificationEntries": true, + }, + }, + }, + }, + "name": "org.apache.maven.plugins/maven-jar-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "additionalJOptions": { + "additionalJOption": [ + "-J-XX:+TieredCompilation", + "-J-XX:TieredStopAtLevel=1", + ], + }, + "detectJavaApiLink": false, + "failOnError": false, + "show": "protected", + }, + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-javadocs", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-javadoc-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-sources", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-source-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "com.amazonaws/aws-lambda-java-core", + "type": "runtime", + "version": "1.2.1", + }, + { + "name": "com.amazonaws/aws-lambda-java-events", + "type": "runtime", + "version": "3.11.0", + }, + { + "name": "com.google.code.findbugs/jsr305", + "type": "runtime", + "version": "3.0.2", + }, + { + "name": "com.google.code.gson/gson", + "type": "runtime", + "version": "2.9.1", + }, + { + "name": "com.squareup.okhttp3/logging-interceptor", + "type": "runtime", + "version": "4.10.0", + }, + { + "name": "com.squareup.okhttp3/okhttp", + "type": "runtime", + "version": "4.10.0", + }, + { + "name": "io.github.crac/org-crac", + "type": "runtime", + "version": "0.1.3", + }, + { + "name": "io.gsonfire/gson-fire", + "type": "runtime", + "version": "1.8.5", + }, + { + "name": "io.swagger/swagger-annotations", + "type": "runtime", + "version": "1.6.8", + }, + { + "name": "jakarta.annotation/jakarta.annotation-api", + "type": "runtime", + "version": "1.3.5", + }, + { + "name": "javax.ws.rs/javax.ws.rs-api", + "type": "runtime", + "version": "2.1.1", + }, + { + "name": "javax.ws.rs/jsr311-api", + "type": "runtime", + "version": "1.1.1", + }, + { + "name": "org.apache.commons/commons-lang3", + "type": "runtime", + "version": "3.12.0", + }, + { + "name": "org.openapitools/jackson-databind-nullable", + "type": "runtime", + "version": "0.2.4", + }, + { + "name": "org.projectlombok/lombok", + "type": "runtime", + "version": "1.18.24", + }, + { + "name": "software.amazon.lambda/powertools-logging", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.amazon.lambda/powertools-metrics", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.amazon.lambda/powertools-tracing", + "type": "runtime", + "version": "1.18.0", + }, + { + "name": "software.constructs/constructs", + "type": "runtime", + "version": "10.3.0", + }, + { + "name": "org.junit.jupiter/junit-jupiter-api", + "type": "test", + "version": "5.9.1", + }, + { + "name": "org.mockito/mockito-core", + "type": "test", + "version": "3.12.4", + }, + ], + }, + "generated/runtime/java/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "pom.xml", + ], + }, + "generated/runtime/java/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "mvn compiler:compile", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "java" --metadata '{"groupId":"com.generated.api","artifactId":"typespec-typescript-java-runtime","artifactVersion":"0.0.0","packageName":"com.generated.api.typespectypescriptjavaruntime.runtime","srcDir":"src/main/java/com/generated/api/typespectypescriptjavaruntime/runtime"}'", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "env": { + "MAVEN_OPTS": "-XX:+TieredCompilation -XX:TieredStopAtLevel=1", + }, + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/java", + }, + { + "exec": "mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/dist/java", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "generated/runtime/java/README.md": "# replace this", + "generated/runtime/java/pom.xml": " + + 4.0.0 + com.generated.api + typespec-typescript-java-runtime + 0.0.0 + jar + typespectypescriptjavaruntime + + UTF-8 + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + + 3.6 + + + + + + enforce-maven + + enforce + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + true + + true + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + false + protected + false + + -J-XX:+TieredCompilation + -J-XX:TieredStopAtLevel=1 + + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + + + + com.amazonaws + aws-lambda-java-core + 1.2.1 + + + com.amazonaws + aws-lambda-java-events + 3.11.0 + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.google.code.gson + gson + 2.9.1 + + + com.squareup.okhttp3 + logging-interceptor + 4.10.0 + + + com.squareup.okhttp3 + okhttp + 4.10.0 + + + io.github.crac + org-crac + 0.1.3 + + + io.gsonfire + gson-fire + 1.8.5 + + + io.swagger + swagger-annotations + 1.6.8 + + + jakarta.annotation + jakarta.annotation-api + 1.3.5 + + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + + + javax.ws.rs + jsr311-api + 1.1.1 + + + org.apache.commons + commons-lang3 + 3.12.0 + + + org.openapitools + jackson-databind-nullable + 0.2.4 + + + org.projectlombok + lombok + 1.18.24 + + + software.amazon.lambda + powertools-logging + 1.18.0 + + + software.amazon.lambda + powertools-metrics + 1.18.0 + + + software.amazon.lambda + powertools-tracing + 1.18.0 + + + software.constructs + constructs + 10.3.0 + + + org.junit.jupiter + junit-jupiter-api + 5.9.1 + test + + + org.mockito + mockito-core + 3.12.4 + test + + + +", + "generated/runtime/python/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pyproject.toml linguist-generated", + "generated/runtime/python/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pyproject.toml +/poetry.toml +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +typespec_typescript_python_runtime +docs +README.md +.openapi-generator +.tsapi-manifest +", + "generated/runtime/python/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "aenum", + "type": "runtime", + "version": "^3.1.11", + }, + { + "name": "aws-lambda-powertools", + "type": "runtime", + "version": "{extras=["tracer", "aws-sdk"],version="^2.28.0"}", + }, + { + "name": "pydantic", + "type": "runtime", + "version": "^2.5.2", + }, + { + "name": "python-dateutil", + "type": "runtime", + "version": "~2.8.2", + }, + { + "name": "python", + "type": "runtime", + "version": "^3.9", + }, + { + "name": "urllib3", + "type": "runtime", + "version": "~1.26.7", + }, + ], + }, + "generated/runtime/python/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "poetry.toml", + "pyproject.toml", + ], + }, + "generated/runtime/python/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(echo $(poetry env info -p)/bin:$PATH)", + "VIRTUAL_ENV": "$(poetry env info -p || poetry run poetry env info -p)", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "python" --metadata '{"srcDir":"typespec_typescript_python_runtime","moduleName":"typespec_typescript_python_runtime","projectName":"typespec-typescript-python-runtime"}'", + }, + ], + }, + "install": { + "description": "Install dependencies and update lockfile", + "name": "install", + "steps": [ + { + "exec": "mkdir -p typespec_typescript_python_runtime && touch typespec_typescript_python_runtime/__init__.py README.md", + }, + { + "exec": "poetry update", + }, + ], + }, + "install:ci": { + "description": "Install dependencies with frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "mkdir -p typespec_typescript_python_runtime && touch typespec_typescript_python_runtime/__init__.py README.md", + }, + { + "exec": "poetry check --lock && poetry install", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "poetry build", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "publish": { + "description": "Uploads the package to PyPI.", + "name": "publish", + "steps": [ + { + "exec": "poetry publish", + }, + ], + }, + "publish:test": { + "description": "Uploads the package against a test PyPI endpoint.", + "name": "publish:test", + "steps": [ + { + "exec": "poetry publish -r testpypi", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "generated/runtime/python/README.md": "# replace this", + "generated/runtime/python/poetry.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[repositories.testpypi] +url = "https://test.pypi.org/legacy/" +", + "generated/runtime/python/pyproject.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[tool.poetry] +name = "typespec-typescript-python-runtime" +version = "0.0.0" +description = "" +authors = [ "APJ Cope " ] +readme = "README.md" +include = [ + "typespec_typescript_python_runtime", + "typespec_typescript_python_runtime/**/*.py" +] + + [[tool.poetry.packages]] + include = "typespec_typescript_python_runtime" + + [tool.poetry.dependencies] + aenum = "^3.1.11" + pydantic = "^2.5.2" + python-dateutil = "~2.8.2" + python = "^3.9" + urllib3 = "~1.26.7" + + [tool.poetry.dependencies.aws-lambda-powertools] + extras = [ "tracer", "aws-sdk" ] + version = "^2.28.0" + +[tool.poetry.group.dev] +dependencies = { } + +[build-system] +requires = [ "poetry-core" ] +build-backend = "poetry.core.masonry.api" +", + "generated/runtime/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc 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 +/pnpm-lock.yaml linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated", + "generated/runtime/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/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 +!/.npmrc +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.npmignore +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/ +/src +/dist +", + "generated/runtime/typescript/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +resolution-mode=highest +strict-peer-dependencies=false +", + "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", + "version": "^18", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "@aws-lambda-powertools/logger", + "type": "runtime", + }, + { + "name": "@aws-lambda-powertools/metrics", + "type": "runtime", + }, + { + "name": "@aws-lambda-powertools/tracer", + "type": "runtime", + }, + { + "name": "@types/aws-lambda", + "type": "runtime", + }, + ], + }, + "generated/runtime/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "generated/runtime/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript" --metadata '{"srcDir":"src"}'", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=typescript,@aws-lambda-powertools/logger,@aws-lambda-powertools/metrics,@aws-lambda-powertools/tracer,@types/aws-lambda", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "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", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "generated/runtime/typescript/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. +", + "generated/runtime/typescript/README.md": "# replace this", + "generated/runtime/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "@aws-lambda-powertools/logger": "*", + "@aws-lambda-powertools/metrics": "*", + "@aws-lambda-powertools/tracer": "*", + "@types/aws-lambda": "*", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/node": "^18", + "typescript": "*", + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-typescript-typescript-runtime", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "generated/runtime/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "generated/runtime/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "handlers/README.md": "## Handlers + +This directory contains lambda handlers for implementing your API. + +Whenever an operation is annotated with the \`@handler\` trait in Smithy (or the \`x-handler\` vendor extension in OpenAPI), a stub handler implementation will be generated for you, which you are free to modify.", + "handlers/java/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/pom.xml linguist-generated +/project.json linguist-generated", + "handlers/java/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pom.xml +.classpath +.project +.settings +target +dist/java +.openapi-generator +.tsapi-manifest +!/project.json +", + "handlers/java/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "com.github.edwgiz/maven-shade-plugin.log4j2-cachefile-transformer", + "type": "build", + "version": "2.15.0", + }, + { + "metadata": { + "configuration": { + "source": "1.8", + "target": "1.8", + }, + }, + "name": "org.apache.maven.plugins/maven-compiler-plugin", + "type": "build", + "version": "3.8.1", + }, + { + "metadata": { + "configuration": { + "rules": [ + { + "requireMavenVersion": [ + { + "version": "3.6", + }, + ], + }, + ], + }, + "executions": [ + { + "goals": [ + "enforce", + ], + "id": "enforce-maven", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-enforcer-plugin", + "type": "build", + "version": "3.0.0-M3", + }, + { + "metadata": { + "configuration": { + "archive": { + "index": true, + "manifest": { + "addDefaultImplementationEntries": true, + "addDefaultSpecificationEntries": true, + }, + }, + }, + }, + "name": "org.apache.maven.plugins/maven-jar-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "additionalJOptions": { + "additionalJOption": [ + "-J-XX:+TieredCompilation", + "-J-XX:TieredStopAtLevel=1", + ], + }, + "detectJavaApiLink": false, + "failOnError": false, + "show": "protected", + }, + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-javadocs", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-javadoc-plugin", + "type": "build", + "version": "3.2.0", + }, + { + "metadata": { + "configuration": { + "createDependencyReducedPom": false, + "transformers": [ + { + "transformer": { + "@implementation": "com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer", + }, + }, + ], + }, + "dependencies": [ + "com.github.edwgiz/maven-shade-plugin.log4j2-cachefile-transformer@2.15.0", + ], + "executions": [ + { + "goals": [ + "shade", + ], + "id": "shade-task", + "phase": "package", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-shade-plugin", + "type": "build", + "version": "3.3.0", + }, + { + "metadata": { + "executions": [ + { + "goals": [ + "jar", + ], + "id": "attach-sources", + }, + ], + }, + "name": "org.apache.maven.plugins/maven-source-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "org.apache.maven.plugins/maven-surefire-plugin", + "type": "build", + "version": "3.2.1", + }, + { + "name": "com.generated.api/typespec-typescript-java-runtime", + "type": "runtime", + "version": "0.0.0", + }, + { + "name": "software.constructs/constructs", + "type": "runtime", + "version": "10.3.0", + }, + { + "name": "org.junit.jupiter/junit-jupiter-engine", + "type": "test", + "version": "5.10.2", + }, + ], + }, + "handlers/java/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "pom.xml", + "project.json", + ], + }, + "handlers/java/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "mvn compiler:compile", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "java-lambda-handlers" --metadata '{"srcDir":"src/main/java/com/generated/api/typespectypescriptjavahandlers/handlers","tstDir":"src/test/java/com/generated/api/typespectypescriptjavahandlers/handlers","packageName":"com.generated.api.typespectypescriptjavahandlers.handlers","runtimePackageName":"com.generated.api.typespectypescriptjavaruntime.runtime"}'", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "env": { + "MAVEN_OPTS": "-XX:+TieredCompilation -XX:TieredStopAtLevel=1", + }, + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/java", + }, + { + "exec": "mvn deploy -D=altDeploymentRepository=local::default::file:///$PWD/dist/java", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "handlers/java/README.md": "# replace this", + "handlers/java/pom.xml": " + + 4.0.0 + com.generated.api + typespec-typescript-java-handlers + 0.0.0 + jar + typespectypescriptjavahandlers + + UTF-8 + + + + file://../../generated/runtime/java/dist/java + com.generated.api-typespec-typescript-java-runtime-repo + + + + + + com.github.edwgiz + maven-shade-plugin.log4j2-cachefile-transformer + 2.15.0 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + + 3.6 + + + + + + enforce-maven + + enforce + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + true + + true + true + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + false + protected + false + + -J-XX:+TieredCompilation + -J-XX:TieredStopAtLevel=1 + + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.3.0 + + false + + + + + + + com.github.edwgiz + maven-shade-plugin.log4j2-cachefile-transformer + 2.15.0 + + + + + shade-task + + shade + + package + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.1 + + + + + + com.generated.api + typespec-typescript-java-runtime + 0.0.0 + + + software.constructs + constructs + 10.3.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.10.2 + test + + + +", + "handlers/java/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespectypescriptjavaruntime", + ], + "name": "typespectypescriptjavahandlers", + "root": "handlers/java", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "handlers/java", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "handlers/java", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "handlers/java", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen generate", + "cwd": "handlers/java", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "handlers/java", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "handlers/java", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "handlers/java", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "handlers/java", + }, + }, + }, + }, + "handlers/java/src/main/resources/log4j2.xml": " + + + + + + + + + + + + + + +", + "handlers/python/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/project.json linguist-generated +/pyproject.toml linguist-generated", + "handlers/python/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/pyproject.toml +/poetry.toml +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal +instance/ +.webassets-cache +.scrapy +docs/_build/ +.pybuilder/ +target/ +.ipynb_checkpoints +profile_default/ +ipython_config.py +__pypackages__/ +celerybeat-schedule +celerybeat.pid +*.sage.py +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +/site +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +.openapi-generator +.tsapi-manifest +!/project.json +", + "handlers/python/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "python", + "type": "runtime", + "version": "^3.11", + }, + { + "name": "typespec-typescript-python-runtime", + "type": "runtime", + "version": "{path="../../generated/runtime/python", develop=true}", + }, + { + "name": "pytest", + "type": "test", + "version": "7.4.3", + }, + ], + }, + "handlers/python/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "poetry.toml", + "project.json", + "pyproject.toml", + ], + }, + "handlers/python/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(echo $(poetry env info -p)/bin:$PATH)", + "VIRTUAL_ENV": "$(poetry env info -p || poetry run poetry env info -p)", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "python-lambda-handlers" --metadata '{"srcDir":"typespec_typescript_python_handlers","tstDir":"test","runtimeModuleName":"typespec_typescript_python_runtime","moduleName":"typespec_typescript_python_handlers"}'", + }, + ], + }, + "install": { + "description": "Install dependencies and update lockfile", + "name": "install", + "steps": [ + { + "exec": "poetry update", + }, + ], + }, + "install:ci": { + "description": "Install dependencies with frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "poetry check --lock && poetry install", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "poetry build", + }, + { + "exec": "mkdir -p dist/lambda && rm -rf dist/lambda/*", + }, + { + "exec": "cp -r typespec_typescript_python_handlers dist/lambda/typespec_typescript_python_handlers", + }, + { + "exec": "poetry export --without-hashes --format=requirements.txt | sed -E 's/^-e[[:space:]]+//' > dist/lambda/requirements.txt", + }, + { + "exec": "pip install -r dist/lambda/requirements.txt --target dist/lambda --upgrade --platform manylinux2014_x86_64 --only-binary :all: --python-version 3.11", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "publish": { + "description": "Uploads the package to PyPI.", + "name": "publish", + "steps": [ + { + "exec": "poetry publish", + }, + ], + }, + "publish:test": { + "description": "Uploads the package against a test PyPI endpoint.", + "name": "publish:test", + "steps": [ + { + "exec": "poetry publish -r testpypi", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "pytest test/ || ([ $? = 5 ] && exit 0 || exit $?)", + }, + ], + }, + }, + }, + "handlers/python/README.md": "# replace this", + "handlers/python/poetry.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[repositories.testpypi] +url = "https://test.pypi.org/legacy/" +", + "handlers/python/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-typescript-python-runtime", + ], + "name": "typespec-typescript-python-handlers", + "root": "handlers/python", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "handlers/python", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "handlers/python", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "handlers/python", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen generate", + "cwd": "handlers/python", + }, + }, + "install": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen install", + "cwd": "handlers/python", + }, + }, + "install:ci": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen install:ci", + "cwd": "handlers/python", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "handlers/python", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "handlers/python", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "handlers/python", + }, + }, + "publish": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen publish", + "cwd": "handlers/python", + }, + }, + "publish:test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen publish:test", + "cwd": "handlers/python", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "handlers/python", + }, + }, + }, + }, + "handlers/python/pyproject.toml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +[tool.poetry] +name = "typespec-typescript-python-handlers" +version = "0.0.0" +description = "" +authors = [ "APJ Cope " ] +readme = "README.md" +include = [ + "typespec_typescript_python_handlers", + "typespec_typescript_python_handlers/**/*.py" +] + + [[tool.poetry.packages]] + include = "typespec_typescript_python_handlers" + + [tool.poetry.dependencies] + python = "^3.11" + + [tool.poetry.dependencies.typespec-typescript-python-runtime] + path = "../../generated/runtime/python" + develop = true + +[tool.poetry.group.dev.dependencies] +pytest = "7.4.3" + +[build-system] +requires = [ "poetry-core" ] +build-backend = "poetry.core.masonry.api" +", + "handlers/python/typespec_typescript_python_handlers/__init__.py": "#", + "handlers/typescript/.eslintrc.json": { + "env": { + "jest": true, + "node": true, + }, + "extends": [ + "plugin:import/typescript", + ], + "ignorePatterns": [ + "*.js", + "*.d.ts", + "node_modules/", + "*.generated.ts", + "coverage", + ], + "overrides": [], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "project": "./tsconfig.dev.json", + "sourceType": "module", + }, + "plugins": [ + "@typescript-eslint", + "import", + ], + "root": true, + "rules": { + "@typescript-eslint/indent": [ + "error", + 2, + ], + "@typescript-eslint/member-delimiter-style": [ + "error", + ], + "@typescript-eslint/member-ordering": [ + "error", + { + "default": [ + "public-static-field", + "public-static-method", + "protected-static-field", + "protected-static-method", + "private-static-field", + "private-static-method", + "field", + "constructor", + "method", + ], + }, + ], + "@typescript-eslint/no-floating-promises": [ + "error", + ], + "@typescript-eslint/no-require-imports": [ + "error", + ], + "@typescript-eslint/no-shadow": [ + "error", + ], + "@typescript-eslint/return-await": [ + "error", + ], + "array-bracket-newline": [ + "error", + "consistent", + ], + "array-bracket-spacing": [ + "error", + "never", + ], + "brace-style": [ + "error", + "1tbs", + { + "allowSingleLine": true, + }, + ], + "comma-dangle": [ + "error", + "always-multiline", + ], + "comma-spacing": [ + "error", + { + "after": true, + "before": false, + }, + ], + "curly": [ + "error", + "multi-line", + "consistent", + ], + "dot-notation": [ + "error", + ], + "import/no-duplicates": [ + "error", + ], + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": [ + "**/test/**", + "**/build-tools/**", + ], + "optionalDependencies": false, + "peerDependencies": true, + }, + ], + "import/no-unresolved": [ + "error", + ], + "import/order": [ + "warn", + { + "alphabetize": { + "caseInsensitive": true, + "order": "asc", + }, + "groups": [ + "builtin", + "external", + ], + }, + ], + "indent": [ + "off", + ], + "key-spacing": [ + "error", + ], + "keyword-spacing": [ + "error", + ], + "max-len": [ + "error", + { + "code": 150, + "ignoreComments": true, + "ignoreRegExpLiterals": true, + "ignoreStrings": true, + "ignoreTemplateLiterals": true, + "ignoreUrls": true, + }, + ], + "no-bitwise": [ + "error", + ], + "no-multi-spaces": [ + "error", + { + "ignoreEOLComments": false, + }, + ], + "no-multiple-empty-lines": [ + "error", + ], + "no-return-await": [ + "off", + ], + "no-shadow": [ + "off", + ], + "no-trailing-spaces": [ + "error", + ], + "object-curly-newline": [ + "error", + { + "consistent": true, + "multiline": true, + }, + ], + "object-curly-spacing": [ + "error", + "always", + ], + "object-property-newline": [ + "error", + { + "allowAllPropertiesOnSameLine": true, + }, + ], + "quote-props": [ + "error", + "consistent-as-needed", + ], + "quotes": [ + "error", + "single", + { + "avoidEscape": true, + }, + ], + "semi": [ + "error", + "always", + ], + "space-before-blocks": [ + "error", + ], + }, + "settings": { + "import/parsers": { + "@typescript-eslint/parser": [ + ".ts", + ".tsx", + ], + }, + "import/resolver": { + "node": {}, + "typescript": { + "alwaysTryTypes": true, + "project": "./tsconfig.dev.json", + }, + }, + }, + }, + "handlers/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.eslintrc.json linguist-generated +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc 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 +/pnpm-lock.yaml linguist-generated +/project.json linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated", + "handlers/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/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 +/test-reports/ +junit.xml +/coverage/ +!/.npmrc +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.eslintrc.json +!/.npmignore +.openapi-generator +.tsapi-metadata +!/project.json +", + "handlers/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/src +/dist +", + "handlers/typescript/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +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", + }, + { + "name": "@types/jest", + "type": "build", + }, + { + "name": "@types/node", + "type": "build", + "version": "^18", + }, + { + "name": "@typescript-eslint/eslint-plugin", + "type": "build", + "version": "^7", + }, + { + "name": "@typescript-eslint/parser", + "type": "build", + "version": "^7", + }, + { + "name": "esbuild", + "type": "build", + }, + { + "name": "eslint-import-resolver-typescript", + "type": "build", + }, + { + "name": "eslint-plugin-import", + "type": "build", + }, + { + "name": "eslint", + "type": "build", + "version": "^8", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + { + "name": "ts-jest", + "type": "build", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "typespec-typescript-typescript-runtime", + "type": "runtime", + "version": "file:../../generated/runtime/typescript", + }, + ], + }, + "handlers/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".eslintrc.json", + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "project.json", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "handlers/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "../..", + "exec": "npx projen default", + }, + ], + }, + "eslint": { + "description": "Runs eslint against the codebase", + "name": "eslint", + "steps": [ + { + "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern $@ src test build-tools", + "receiveArgs": true, + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "typescript-lambda-handlers" --metadata '{"srcDir":"src","tstDir":"test","runtimePackageName":"typespec-typescript-typescript-runtime"}'", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm link /../../generated/runtime/typescript", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + { + "exec": "mkdir -p dist/lambda && rm -rf dist/lambda/*", + }, + { + "exec": "esbuild --bundle src/*.ts --platform=node --outdir=dist/lambda --target=node18", + }, + { + "exec": "for f in $(ls dist/lambda); do mkdir dist/lambda/$(basename $f .js) && mv dist/lambda/$f dist/lambda/$(basename $f .js)/index.js; done", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + { + "spawn": "eslint", + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,@types/jest,esbuild,eslint-import-resolver-typescript,eslint-plugin-import,jest,ts-jest,typescript", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "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 typespec-typescript-typescript-runtime", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "handlers/typescript/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. +", + "handlers/typescript/README.md": "# replace this", + "handlers/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "typespec-typescript-typescript-runtime": "file:../../generated/runtime/typescript", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/aws-lambda": "*", + "@types/jest": "*", + "@types/node": "^18", + "@typescript-eslint/eslint-plugin": "^7", + "@typescript-eslint/parser": "^7", + "esbuild": "*", + "eslint": "^8", + "eslint-import-resolver-typescript": "*", + "eslint-plugin-import": "*", + "jest": "*", + "jest-junit": "^15", + "ts-jest": "*", + "typescript": "*", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "/src/**/__tests__/**/*.ts?(x)", + "/@(test|src)/**/*(*.)@(spec|test).ts?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "transform": { + "^.+\\.[t]sx?$": [ + "ts-jest", + { + "tsconfig": "tsconfig.dev.json", + }, + ], + }, + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-typescript-typescript-handlers", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "eslint": "npx projen eslint", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "handlers/typescript/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-typescript-typescript-runtime", + ], + "name": "typespec-typescript-typescript-handlers", + "root": "handlers/typescript", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen build", + "cwd": "handlers/typescript", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen compile", + "cwd": "handlers/typescript", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen default", + "cwd": "handlers/typescript", + }, + }, + "eslint": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen eslint", + "cwd": "handlers/typescript", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen generate", + "cwd": "handlers/typescript", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen package", + "cwd": "handlers/typescript", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-compile", + "cwd": "handlers/typescript", + }, + }, + "post-upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen post-upgrade", + "cwd": "handlers/typescript", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen pre-compile", + "cwd": "handlers/typescript", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test", + "cwd": "handlers/typescript", + }, + }, + "test:watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen test:watch", + "cwd": "handlers/typescript", + }, + }, + "upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen upgrade", + "cwd": "handlers/typescript", + }, + }, + "watch": { + "executor": "nx:run-commands", + "options": { + "command": "pnpm exec projen watch", + "cwd": "handlers/typescript", + }, + }, + }, + }, + "handlers/typescript/src/index.ts": "", + "handlers/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "handlers/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "model/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.npmrc linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/generated/aws-pdk/prelude.js linguist-generated +/generated/aws-pdk/prelude.tsp linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/pnpm-lock.yaml linguist-generated +/tspconfig.yaml linguist-generated", + "model/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +!/LICENSE +!/.npmignore +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 +/test-reports/ +junit.xml +/coverage/ +!/.npmrc +dist +!/tspconfig.yaml +!/generated/aws-pdk/prelude.tsp +!/generated/aws-pdk/prelude.js +.api.json +", + "model/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/test-reports/ +junit.xml +/coverage/ +/.gitattributes +", + "model/.npmrc": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +resolution-mode=highest +", + "model/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@typespec/compiler", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/http", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi3", + "type": "build", + "version": "^0.61", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + ], + }, + "model/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".npmrc", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/aws-pdk/prelude.js", + "generated/aws-pdk/prelude.tsp", + "LICENSE", + "tspconfig.yaml", + ], + }, + "model/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(pnpm -c exec "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "cwd": "..", + "exec": "npx projen default", + }, + ], + }, + "generate": { + "env": { + "NODE_OPTIONS": "--experimental-default-type=module", + }, + "name": "generate", + "steps": [ + { + "exec": "tsp compile src --config tspconfig.yaml", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath dist/@typespec/openapi3/openapi.json --outputPath .api.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "pnpm i --no-frozen-lockfile", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "pnpm i --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "pnpm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=jest", + }, + { + "exec": "pnpm i --no-frozen-lockfile", + }, + { + "exec": "pnpm update @aws/pdk @typespec/compiler @typespec/http @typespec/openapi @typespec/openapi3 jest jest-junit", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + }, + }, + "model/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. +", + "model/README.md": "# replace this", + "model/generated/aws-pdk/prelude.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +", + "model/generated/aws-pdk/prelude.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.js"; + +using TypeSpec.Reflection; + +model HandlerOptions { + language: "java" | "python" | "typescript"; +} + +extern dec handler(target: Operation, options: HandlerOptions); +", + "model/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "devDependencies": { + "@aws/pdk": "^0", + "@typespec/compiler": "^0.61", + "@typespec/http": "^0.61", + "@typespec/openapi": "^0.61", + "@typespec/openapi3": "^0.61", + "jest": "*", + "jest-junit": "^15", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-typescript-model", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "upgrade": "npx projen upgrade", + }, + "version": "0.0.0", + }, + "model/src/main.tsp": "import "@typespec/http"; +import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; + +import "./types/errors.tsp"; + +using Http; +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyService", +}) +@info({ + version: "1.0", +}) +namespace MyService; + +@handler({ language: "java" }) +@get +@route("/hello") +op SayHello(@query name: string): + | { + @statusCode statusCode: 200; + @body body: { + message: string; + }; + } + | BadRequestError + | NotAuthorizedError + | NotFoundError + | InternalFailureError; +", + "model/src/types/errors.tsp": "import "@typespec/http"; + +using Http; + +/** + * An error at the fault of the client sending invalid input + */ +model BadRequestErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An internal failure at the fault of the server + */ +model InternalFailureErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client not being authorized to access the resource + */ +model NotAuthorizedErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client attempting to access a missing resource + */ +model NotFoundErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * BadRequestError 400 response + */ +@error +model BadRequestError { + @statusCode statusCode: 400; + @body body: BadRequestErrorResponseContent; +} + +/** + * NotAuthorizedError 403 response + */ +@error +model NotAuthorizedError { + @statusCode statusCode: 403; + @body body: NotAuthorizedErrorResponseContent; +} + +/** + * NotFoundError 404 response + */ +@error +model NotFoundError { + @statusCode statusCode: 404; + @body body: NotFoundErrorResponseContent; +} + +/** + * InternalFailureError 500 response + */ +@error +model InternalFailureError { + @statusCode statusCode: 500; + @body body: InternalFailureErrorResponseContent; +} +", + "model/tspconfig.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +emit: + - "@typespec/openapi3" +options: + "@typespec/openapi3": + output-file: openapi.json +output-dir: "{cwd}/dist" +", +} +`; 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 cf4a74e43..b7c14abd9 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 @@ -43814,3 +43814,4471 @@ operation SubscribeToNotifications { }, } `; + +exports[`Type Safe Api Project Unit Tests TypeSpec With typescript Infra in Monorepo 1`] = ` +{ + ".eslintrc.json": { + "env": { + "jest": true, + "node": true, + }, + "extends": [ + "plugin:import/typescript", + "plugin:prettier/recommended", + ], + "ignorePatterns": [ + "packages/**/*.*", + "!.projenrc.ts", + "!projenrc/**/*.ts", + ], + "overrides": [ + { + "files": [ + ".projenrc.ts", + ], + "rules": { + "@typescript-eslint/no-require-imports": "off", + "import/no-extraneous-dependencies": "off", + }, + }, + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "project": "./tsconfig.dev.json", + "sourceType": "module", + }, + "plugins": [ + "@typescript-eslint", + "import", + ], + "root": true, + "rules": { + "@typescript-eslint/member-ordering": [ + "error", + { + "default": [ + "public-static-field", + "public-static-method", + "protected-static-field", + "protected-static-method", + "private-static-field", + "private-static-method", + "field", + "constructor", + "method", + ], + }, + ], + "@typescript-eslint/no-floating-promises": [ + "error", + ], + "@typescript-eslint/no-require-imports": [ + "error", + ], + "@typescript-eslint/no-shadow": [ + "error", + ], + "@typescript-eslint/return-await": [ + "error", + ], + "dot-notation": [ + "error", + ], + "import/no-duplicates": [ + "error", + ], + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": [ + "**/test/**", + "**/build-tools/**", + ".projenrc.ts", + "projenrc/**/*.ts", + ], + "optionalDependencies": false, + "peerDependencies": true, + }, + ], + "import/no-unresolved": [ + "error", + ], + "import/order": [ + "warn", + { + "alphabetize": { + "caseInsensitive": true, + "order": "asc", + }, + "groups": [ + "builtin", + "external", + ], + }, + ], + "key-spacing": [ + "error", + ], + "no-bitwise": [ + "error", + ], + "no-multiple-empty-lines": [ + "error", + ], + "no-return-await": [ + "off", + ], + "no-shadow": [ + "off", + ], + "no-trailing-spaces": [ + "error", + ], + }, + "settings": { + "import/parsers": { + "@typescript-eslint/parser": [ + ".ts", + ".tsx", + ], + }, + "import/resolver": { + "node": {}, + "typescript": { + "alwaysTryTypes": true, + "project": "./tsconfig.dev.json", + }, + }, + }, + }, + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". + +*.snap linguist-generated +/.eslintrc.json linguist-generated +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.nxignore linguist-generated +/.prettierignore linguist-generated +/.prettierrc.json linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/.syncpackrc.json linguist-generated +/LICENSE linguist-generated +/nx.json linguist-generated +/package.json linguist-generated +/packages/api/generated/infrastructure/README.md linguist-generated +/packages/api/generated/runtime/README.md linguist-generated +/packages/api/handlers/README.md linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated +/yarn.lock linguist-generated", + ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +!/.npmignore +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 +.tmp +!/.prettierignore +!/.prettierrc.json +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.eslintrc.json +.nx/* +!.nx/plugins +!/nx.json +!/.nxignore +!/packages/api/generated/runtime/README.md +!/packages/api/handlers/README.md +!/packages/api/generated/infrastructure/README.md +!/.syncpackrc.json +!/.projenrc.ts +!/LICENSE +", + ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". +/.projen/ +/.prettierignore +/.prettierrc.json +/test/ +/tsconfig.dev.json +/src/ +!/lib/ +!/lib/**/*.js +!/lib/**/*.d.ts +dist +/tsconfig.json +/.github/ +/.vscode/ +/.idea/ +/.projenrc.js +tsconfig.tsbuildinfo +/.eslintrc.json +/.gitattributes +/.projenrc.ts +/projenrc +", + ".nxignore": "# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". +.tmp +.env +.pytest_cache +", + ".prettierignore": "# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen". +", + ".prettierrc.json": { + "overrides": [], + }, + ".projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@types/node", + "type": "build", + "version": "^18", + }, + { + "name": "@typescript-eslint/eslint-plugin", + "type": "build", + "version": "^7", + }, + { + "name": "@typescript-eslint/parser", + "type": "build", + "version": "^7", + }, + { + "name": "constructs", + "type": "build", + "version": "^10.0.0", + }, + { + "name": "eslint-config-prettier", + "type": "build", + }, + { + "name": "eslint-import-resolver-typescript", + "type": "build", + }, + { + "name": "eslint-plugin-import", + "type": "build", + }, + { + "name": "eslint-plugin-prettier", + "type": "build", + }, + { + "name": "eslint", + "type": "build", + "version": "^8", + }, + { + "name": "npm-check-updates", + "type": "build", + }, + { + "name": "nx", + "type": "build", + "version": "^19", + }, + { + "name": "prettier", + "type": "build", + }, + { + "name": "projen", + "type": "build", + "version": "^0.82.8", + }, + { + "name": "syncpack", + "type": "build", + "version": "^13", + }, + { + "name": "ts-node", + "type": "build", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "@types/babel__traverse", + "type": "override", + "version": "7.18.2", + }, + { + "name": "@zkochan/js-yaml", + "type": "override", + "version": "npm:js-yaml@4.1.0", + }, + { + "name": "wrap-ansi", + "type": "override", + "version": "^7.0.0", + }, + { + "name": "nx", + "type": "peer", + "version": "^19", + }, + { + "name": "@aws-cdk/aws-cognito-identitypool-alpha", + "type": "runtime", + "version": "latest", + }, + { + "name": "aws-cdk-lib", + "type": "runtime", + }, + { + "name": "cdk-nag", + "type": "runtime", + }, + ], + }, + ".projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".", + "files": [ + ".eslintrc.json", + ".gitattributes", + ".gitignore", + ".npmignore", + ".nxignore", + ".prettierignore", + ".prettierrc.json", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + ".syncpackrc.json", + "LICENSE", + "nx.json", + "packages/api/generated/infrastructure/README.md", + "packages/api/generated/runtime/README.md", + "packages/api/handlers/README.md", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + ".projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".", + "env": { + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build for all affected projects", + "name": "build", + "steps": [ + { + "exec": "yarn nx run-many --target=build --output-style=stream --nx-bail", + "receiveArgs": true, + }, + ], + }, + "clobber": { + "condition": "git diff --exit-code > /dev/null", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": { + "BRANCH": "$(git branch --show-current)", + }, + "name": "clobber", + "steps": [ + { + "exec": "git checkout -b scratch", + "name": "save current HEAD in "scratch" branch", + }, + { + "exec": "git checkout $BRANCH", + }, + { + "exec": "git fetch origin", + "name": "fetch latest changes from origin", + }, + { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit", + }, + { + "exec": "git clean -fdx", + "name": "clean all untracked files", + }, + { + "say": "ready to rock! (unpushed commits are under the "scratch" branch)", + }, + ], + }, + "compile": { + "description": "Only compile for all affected projects", + "name": "compile", + "steps": [ + { + "exec": "yarn nx run-many --target=compile --output-style=stream --nx-bail", + "receiveArgs": true, + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "exec": "ts-node --project tsconfig.dev.json .projenrc.ts", + }, + ], + }, + "eject": { + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": [ + { + "spawn": "default", + }, + ], + }, + "eslint": { + "description": "Runs eslint against the codebase for all affected projects", + "name": "eslint", + "steps": [ + { + "exec": "yarn nx run-many --target=eslint --output-style=stream --nx-bail", + "receiveArgs": true, + }, + ], + }, + "graph": { + "description": "Generate dependency graph for monorepo", + "name": "graph", + "steps": [ + { + "exec": "yarn nx graph", + "receiveArgs": true, + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + { + "exec": "yarn nx run-many --target=install:ci --output-style=stream --nx-bail", + "receiveArgs": true, + }, + ], + }, + "package": { + "description": "Creates the distribution package for all affected projects", + "name": "package", + "steps": [ + { + "exec": "yarn nx run-many --target=package --output-style=stream --nx-bail", + "receiveArgs": true, + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation for all affected projects", + "name": "post-compile", + "steps": [ + { + "exec": "yarn nx run-many --target=post-compile --output-style=stream --nx-bail", + "receiveArgs": true, + }, + ], + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation for all affected projects", + "name": "pre-compile", + "steps": [ + { + "exec": "yarn nx run-many --target=pre-compile --output-style=stream --nx-bail", + "receiveArgs": true, + }, + ], + }, + "run-many": { + "description": "Run task against multiple workspace projects", + "name": "run-many", + "steps": [ + { + "exec": "yarn nx run-many", + "receiveArgs": true, + }, + ], + }, + "test": { + "description": "Run tests for all affected projects", + "name": "test", + "steps": [ + { + "exec": "yarn nx run-many --target=test --output-style=stream --nx-bail", + "receiveArgs": true, + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=eslint-config-prettier,eslint-import-resolver-typescript,eslint-plugin-import,eslint-plugin-prettier,npm-check-updates,prettier,ts-node,typescript,aws-cdk-lib,cdk-nag", + }, + { + "exec": "yarn install --check-files", + }, + { + "exec": "yarn upgrade @aws/pdk @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser constructs eslint-config-prettier eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-prettier eslint npm-check-updates nx prettier projen syncpack ts-node typescript @aws-cdk/aws-cognito-identitypool-alpha aws-cdk-lib cdk-nag", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "upgrade-deps": { + "description": "Upgrade dependencies in the monorepo for all affected projects", + "name": "upgrade-deps", + "steps": [ + { + "exec": "yarn nx run-many --target=upgrade --output-style=stream --nx-bail --projects=typespec-typescript", + "receiveArgs": true, + }, + { + "exec": "yarn npm-check-updates --reject projen --deep --rejectVersion 0.0.0 -u --dep prod,dev,peer,optional,bundle --target=minor", + }, + { + "exec": "yarn syncpack fix-mismatches", + }, + { + "exec": "rm yarn.lock", + }, + { + "exec": "yarn install", + }, + { + "exec": "yarn projen", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background for all affected projects", + "name": "watch", + "steps": [ + { + "exec": "yarn nx run-many --target=watch --output-style=stream --skip-nx-cache --nx-ignore-cycles --nx-bail", + "receiveArgs": true, + }, + ], + }, + }, + }, + ".syncpackrc.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".", + "filter": ".", + "indent": " ", + "semverGroups": [ + { + "dependencies": [ + "**", + ], + "dependencyTypes": [ + "**", + ], + "packages": [ + "**", + ], + "range": "", + }, + ], + "sortAz": [ + "contributors", + "dependencies", + "devDependencies", + "keywords", + "peerDependencies", + "resolutions", + "scripts", + ], + "sortFirst": [ + "name", + "description", + "version", + "author", + ], + "source": [], + "versionGroups": [], + }, + "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": "# replace this", + "nx.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".", + "affected": { + "defaultBase": "main", + }, + "extends": "nx/presets/npm.json", + "namedInputs": { + "default": [ + "{projectRoot}/**/*", + ], + }, + "npmScope": "monorepo", + "targetDefaults": { + "build": { + "dependsOn": [ + "^build", + ], + "inputs": [ + "default", + "^default", + ], + "outputs": [ + "{projectRoot}/dist", + "{projectRoot}/lib", + "{projectRoot}/build", + "{projectRoot}/coverage", + "{projectRoot}/test-reports", + "{projectRoot}/target", + "{projectRoot}/cdk.out", + "{projectRoot}/LICENSE_THIRD_PARTY", + "{projectRoot}/.jsii", + ], + }, + }, + "tasksRunnerOptions": { + "default": { + "options": { + "cacheableOperations": [ + "build", + "test", + ], + "useDaemonProcess": false, + }, + "runner": "nx/tasks-runners/default", + }, + }, + }, + "package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".", + "dependencies": { + "@aws-cdk/aws-cognito-identitypool-alpha": "latest", + "aws-cdk-lib": "*", + "cdk-nag": "*", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/node": "^18", + "@typescript-eslint/eslint-plugin": "^7", + "@typescript-eslint/parser": "^7", + "constructs": "^10.0.0", + "eslint": "^8", + "eslint-config-prettier": "*", + "eslint-import-resolver-typescript": "*", + "eslint-plugin-import": "*", + "eslint-plugin-prettier": "*", + "npm-check-updates": "*", + "nx": "19.0.0", + "prettier": "*", + "projen": "^0.82.8", + "syncpack": "^13", + "ts-node": "*", + "typescript": "*", + }, + "engines": { + "node": ">=16", + "yarn": ">=1 <2", + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "monorepo", + "peerDependencies": { + "nx": "^19", + }, + "private": true, + "publishConfig": { + "access": "public", + }, + "resolutions": { + "@types/babel__traverse": "7.18.2", + "@zkochan/js-yaml": "npm:js-yaml@4.1.0", + "wrap-ansi": "^7.0.0", + }, + "scripts": { + "build": "npx projen build", + "clobber": "npx projen clobber", + "compile": "npx projen compile", + "default": "npx projen default", + "eject": "npx projen eject", + "eslint": "npx projen eslint", + "graph": "npx projen graph", + "install:ci": "yarn projen install:ci", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "run-many": "npx projen run-many", + "synth-workspace": "yarn projen", + "test": "npx projen test", + "upgrade": "npx projen upgrade", + "upgrade-deps": "npx projen upgrade-deps", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + "workspaces": { + "packages": [ + "packages/api/model", + "packages/api/handlers/typescript", + "packages/api/generated/infrastructure/typescript", + "packages/api/generated/runtime/typescript", + ], + }, + }, + "packages/api/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +node_modules/ +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/project.json +!/LICENSE +", + "packages/api/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "project.json", + ], + }, + "packages/api/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + }, + "default": { + "description": "Synthesize project files", + "name": "default", + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": { + "description": "Run tests", + "name": "test", + }, + }, + }, + "packages/api/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. +", + "packages/api/README.md": "# Type Safe API + +This project contains an API built with Type Safe API. + +Please refer to the [Type Safe API Documentation](https://aws.github.io/aws-pdk/developer_guides/type-safe-api/index.html) for details about the project structure and how to add operations. +", + "packages/api/generated/infrastructure/README.md": "## Generated Infrastructure + +This directory contains a generated type-safe CDK construct which can provision the API gateway infrastructure for an API based on your model.", + "packages/api/generated/infrastructure/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore 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 +/project.json linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated +/yarn.lock linguist-generated", + "packages/api/generated/infrastructure/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +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 +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.npmignore +/assets/api.json +src +mocks +.openapi-generator +.tsapi-manifest +!/project.json +!/LICENSE +", + "packages/api/generated/infrastructure/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/src +/dist +", + "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", + "type": "build", + }, + { + "name": "@types/node", + "type": "build", + "version": "^18", + }, + { + "name": "aws-cdk-lib", + "type": "build", + }, + { + "name": "cdk-nag", + "type": "build", + }, + { + "name": "constructs", + "type": "build", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "@aws/pdk", + "type": "peer", + }, + { + "name": "aws-cdk-lib", + "type": "peer", + }, + { + "name": "cdk-nag", + "type": "peer", + }, + { + "name": "constructs", + "type": "peer", + }, + { + "name": "typespec-typescript-typescript-runtime", + "type": "runtime", + "version": "0.0.0", + }, + ], + }, + "packages/api/generated/infrastructure/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "project.json", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "packages/api/generated/infrastructure/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-cdk-infrastructure" --metadata '{"srcDir":"src","runtimePackageName":"typespec-typescript-typescript-runtime","relativeSpecPath":"../assets/api.json","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"../../../handlers/typescript/dist/lambda","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"NODEJS_18_X","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}'", + }, + { + "exec": "mkdir -p assets", + }, + { + "exec": "cp -f ../../../model/.api.json assets/api.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "npm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "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", + }, + { + "exec": "yarn upgrade @aws/pdk @types/aws-lambda @types/node aws-cdk-lib cdk-nag constructs typescript typespec-typescript-typescript-runtime", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "packages/api/generated/infrastructure/typescript/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. +", + "packages/api/generated/infrastructure/typescript/README.md": "# replace this", + "packages/api/generated/infrastructure/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "typespec-typescript-typescript-runtime": "0.0.0", + }, + "devDependencies": { + "@aws/pdk": "*", + "@types/aws-lambda": "*", + "@types/node": "^18", + "aws-cdk-lib": "*", + "cdk-nag": "*", + "constructs": "*", + "typescript": "*", + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-typescript-typescript-infra", + "peerDependencies": { + "@aws/pdk": "*", + "aws-cdk-lib": "*", + "cdk-nag": "*", + "constructs": "*", + }, + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "test": "npx projen test", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "packages/api/generated/infrastructure/typescript/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-typescript-typescript-runtime", + "typespec-typescript-model", + ], + "name": "typespec-typescript-typescript-infra", + "root": "packages/api/generated/infrastructure/typescript", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen build", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen compile", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen default", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen generate", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen package", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen post-compile", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "post-upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen post-upgrade", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen pre-compile", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen test", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen upgrade", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + "watch": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen watch", + "cwd": "packages/api/generated/infrastructure/typescript", + }, + }, + }, + }, + "packages/api/generated/infrastructure/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "packages/api/generated/infrastructure/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "packages/api/generated/runtime/README.md": "## Generated Runtimes + +This directory contains generated runtime projects based on your API model. + +Each runtime project includes types from your API model, as well as type-safe client and server code.", + "packages/api/generated/runtime/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore 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 +/project.json linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated +/yarn.lock linguist-generated", + "packages/api/generated/runtime/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +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 +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.npmignore +src +.npmignore +README.md +.openapi-generator +.tsapi-manifest +!/project.json +!/LICENSE +", + "packages/api/generated/runtime/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/src +/dist +", + "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", + "version": "^18", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "@aws-lambda-powertools/logger", + "type": "runtime", + }, + { + "name": "@aws-lambda-powertools/metrics", + "type": "runtime", + }, + { + "name": "@aws-lambda-powertools/tracer", + "type": "runtime", + }, + { + "name": "@aws-sdk/client-apigatewaymanagementapi", + "type": "runtime", + }, + { + "name": "@types/aws-lambda", + "type": "runtime", + }, + ], + }, + "packages/api/generated/runtime/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "project.json", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "packages/api/generated/runtime/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../../model/.api.json --outputPath . --templateDirs "typescript-async-runtime" "typescript/templates/client/models" --metadata '{"srcDir":"src"}'", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "npm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=typescript,@aws-lambda-powertools/logger,@aws-lambda-powertools/metrics,@aws-lambda-powertools/tracer,@aws-sdk/client-apigatewaymanagementapi,@types/aws-lambda", + }, + { + "exec": "yarn install --check-files", + }, + { + "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", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "packages/api/generated/runtime/typescript/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. +", + "packages/api/generated/runtime/typescript/README.md": "# replace this", + "packages/api/generated/runtime/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "@aws-lambda-powertools/logger": "*", + "@aws-lambda-powertools/metrics": "*", + "@aws-lambda-powertools/tracer": "*", + "@aws-sdk/client-apigatewaymanagementapi": "*", + "@types/aws-lambda": "*", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/node": "^18", + "typescript": "*", + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-typescript-typescript-runtime", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "test": "npx projen test", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "packages/api/generated/runtime/typescript/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-typescript-model", + ], + "name": "typespec-typescript-typescript-runtime", + "root": "packages/api/generated/runtime/typescript", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen build", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen compile", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen default", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen generate", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen package", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen post-compile", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "post-upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen post-upgrade", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen pre-compile", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen test", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen upgrade", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + "watch": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen watch", + "cwd": "packages/api/generated/runtime/typescript", + }, + }, + }, + }, + "packages/api/generated/runtime/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "packages/api/generated/runtime/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": false, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": false, + "noImplicitReturns": false, + "noImplicitThis": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "packages/api/handlers/README.md": "## Handlers + +This directory contains lambda handlers for implementing your API. + +Whenever an operation is annotated with the \`@handler\` trait in Smithy (or the \`x-handler\` vendor extension in OpenAPI), a stub handler implementation will be generated for you, which you are free to modify.", + "packages/api/handlers/typescript/.eslintrc.json": { + "env": { + "jest": true, + "node": true, + }, + "extends": [ + "plugin:import/typescript", + ], + "ignorePatterns": [ + "*.js", + "*.d.ts", + "node_modules/", + "*.generated.ts", + "coverage", + ], + "overrides": [], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2018, + "project": "./tsconfig.dev.json", + "sourceType": "module", + }, + "plugins": [ + "@typescript-eslint", + "import", + ], + "root": true, + "rules": { + "@typescript-eslint/indent": [ + "error", + 2, + ], + "@typescript-eslint/member-delimiter-style": [ + "error", + ], + "@typescript-eslint/member-ordering": [ + "error", + { + "default": [ + "public-static-field", + "public-static-method", + "protected-static-field", + "protected-static-method", + "private-static-field", + "private-static-method", + "field", + "constructor", + "method", + ], + }, + ], + "@typescript-eslint/no-floating-promises": [ + "error", + ], + "@typescript-eslint/no-require-imports": [ + "error", + ], + "@typescript-eslint/no-shadow": [ + "error", + ], + "@typescript-eslint/return-await": [ + "error", + ], + "array-bracket-newline": [ + "error", + "consistent", + ], + "array-bracket-spacing": [ + "error", + "never", + ], + "brace-style": [ + "error", + "1tbs", + { + "allowSingleLine": true, + }, + ], + "comma-dangle": [ + "error", + "always-multiline", + ], + "comma-spacing": [ + "error", + { + "after": true, + "before": false, + }, + ], + "curly": [ + "error", + "multi-line", + "consistent", + ], + "dot-notation": [ + "error", + ], + "import/no-duplicates": [ + "error", + ], + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": [ + "**/test/**", + "**/build-tools/**", + ], + "optionalDependencies": false, + "peerDependencies": true, + }, + ], + "import/no-unresolved": [ + "error", + ], + "import/order": [ + "warn", + { + "alphabetize": { + "caseInsensitive": true, + "order": "asc", + }, + "groups": [ + "builtin", + "external", + ], + }, + ], + "indent": [ + "off", + ], + "key-spacing": [ + "error", + ], + "keyword-spacing": [ + "error", + ], + "max-len": [ + "error", + { + "code": 150, + "ignoreComments": true, + "ignoreRegExpLiterals": true, + "ignoreStrings": true, + "ignoreTemplateLiterals": true, + "ignoreUrls": true, + }, + ], + "no-bitwise": [ + "error", + ], + "no-multi-spaces": [ + "error", + { + "ignoreEOLComments": false, + }, + ], + "no-multiple-empty-lines": [ + "error", + ], + "no-return-await": [ + "off", + ], + "no-shadow": [ + "off", + ], + "no-trailing-spaces": [ + "error", + ], + "object-curly-newline": [ + "error", + { + "consistent": true, + "multiline": true, + }, + ], + "object-curly-spacing": [ + "error", + "always", + ], + "object-property-newline": [ + "error", + { + "allowAllPropertiesOnSameLine": true, + }, + ], + "quote-props": [ + "error", + "consistent-as-needed", + ], + "quotes": [ + "error", + "single", + { + "avoidEscape": true, + }, + ], + "semi": [ + "error", + "always", + ], + "space-before-blocks": [ + "error", + ], + }, + "settings": { + "import/parsers": { + "@typescript-eslint/parser": [ + ".ts", + ".tsx", + ], + }, + "import/resolver": { + "node": {}, + "typescript": { + "alwaysTryTypes": true, + "project": "./tsconfig.dev.json", + }, + }, + }, + }, + "packages/api/handlers/typescript/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.eslintrc.json linguist-generated +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore 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 +/project.json linguist-generated +/tsconfig.dev.json linguist-generated +/tsconfig.json linguist-generated +/yarn.lock linguist-generated", + "packages/api/handlers/typescript/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +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 +/test-reports/ +junit.xml +/coverage/ +!/test/ +!/tsconfig.json +!/tsconfig.dev.json +!/src/ +/lib +/dist/ +!/.eslintrc.json +!/.npmignore +.openapi-generator +.tsapi-metadata +!/project.json +!/LICENSE +", + "packages/api/handlers/typescript/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/src +/dist +", + "packages/api/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", + }, + { + "name": "@types/jest", + "type": "build", + }, + { + "name": "@types/node", + "type": "build", + "version": "^18", + }, + { + "name": "@typescript-eslint/eslint-plugin", + "type": "build", + "version": "^7", + }, + { + "name": "@typescript-eslint/parser", + "type": "build", + "version": "^7", + }, + { + "name": "esbuild", + "type": "build", + }, + { + "name": "eslint-import-resolver-typescript", + "type": "build", + }, + { + "name": "eslint-plugin-import", + "type": "build", + }, + { + "name": "eslint", + "type": "build", + "version": "^8", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + { + "name": "ts-jest", + "type": "build", + }, + { + "name": "typescript", + "type": "build", + }, + { + "name": "typespec-typescript-typescript-runtime", + "type": "runtime", + "version": "0.0.0", + }, + ], + }, + "packages/api/handlers/typescript/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".eslintrc.json", + ".gitattributes", + ".gitignore", + ".npmignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "LICENSE", + "project.json", + "tsconfig.dev.json", + "tsconfig.json", + ], + }, + "packages/api/handlers/typescript/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "exec": "tsc --build", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + }, + "eslint": { + "description": "Runs eslint against the codebase", + "name": "eslint", + "steps": [ + { + "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern $@ src test build-tools", + "receiveArgs": true, + }, + ], + }, + "generate": { + "name": "generate", + "steps": [ + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate --specPath ../../model/.api.json --outputPath . --templateDirs "typescript-async-lambda-handlers" --metadata '{"srcDir":"src","tstDir":"test","runtimePackageName":"typespec-typescript-typescript-runtime"}'", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "npm pack --pack-destination dist/js", + }, + { + "exec": "mkdir -p dist/lambda && rm -rf dist/lambda/*", + }, + { + "exec": "esbuild --bundle src/*.ts --platform=node --outdir=dist/lambda --target=node18", + }, + { + "exec": "for f in $(ls dist/lambda); do mkdir dist/lambda/$(basename $f .js) && mv dist/lambda/$f dist/lambda/$(basename $f .js)/index.js; done", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + { + "spawn": "eslint", + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=@types/aws-lambda,@types/jest,esbuild,eslint-import-resolver-typescript,eslint-plugin-import,jest,ts-jest,typescript", + }, + { + "exec": "yarn install --check-files", + }, + { + "exec": "yarn upgrade @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 typespec-typescript-typescript-runtime", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + "watch": { + "description": "Watch & compile in the background", + "name": "watch", + "steps": [ + { + "exec": "tsc --build -w", + }, + ], + }, + }, + }, + "packages/api/handlers/typescript/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. +", + "packages/api/handlers/typescript/README.md": "# replace this", + "packages/api/handlers/typescript/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": { + "typespec-typescript-typescript-runtime": "0.0.0", + }, + "devDependencies": { + "@aws/pdk": "^0", + "@types/aws-lambda": "*", + "@types/jest": "*", + "@types/node": "^18", + "@typescript-eslint/eslint-plugin": "^7", + "@typescript-eslint/parser": "^7", + "esbuild": "*", + "eslint": "^8", + "eslint-import-resolver-typescript": "*", + "eslint-plugin-import": "*", + "jest": "*", + "jest-junit": "^15", + "ts-jest": "*", + "typescript": "*", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "/src/**/__tests__/**/*.ts?(x)", + "/@(test|src)/**/*(*.)@(spec|test).ts?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "transform": { + "^.+\\.[t]sx?$": [ + "ts-jest", + { + "tsconfig": "tsconfig.dev.json", + }, + ], + }, + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-typescript-typescript-handlers", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "eslint": "npx projen eslint", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", + }, + "types": "lib/index.d.ts", + "version": "0.0.0", + }, + "packages/api/handlers/typescript/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "implicitDependencies": [ + "typespec-typescript-typescript-runtime", + ], + "name": "typespec-typescript-typescript-handlers", + "root": "packages/api/handlers/typescript", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen build", + "cwd": "packages/api/handlers/typescript", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen compile", + "cwd": "packages/api/handlers/typescript", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen default", + "cwd": "packages/api/handlers/typescript", + }, + }, + "eslint": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen eslint", + "cwd": "packages/api/handlers/typescript", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen generate", + "cwd": "packages/api/handlers/typescript", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen package", + "cwd": "packages/api/handlers/typescript", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen post-compile", + "cwd": "packages/api/handlers/typescript", + }, + }, + "post-upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen post-upgrade", + "cwd": "packages/api/handlers/typescript", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen pre-compile", + "cwd": "packages/api/handlers/typescript", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen test", + "cwd": "packages/api/handlers/typescript", + }, + }, + "test:watch": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen test:watch", + "cwd": "packages/api/handlers/typescript", + }, + }, + "upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen upgrade", + "cwd": "packages/api/handlers/typescript", + }, + }, + "watch": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen watch", + "cwd": "packages/api/handlers/typescript", + }, + }, + }, + }, + "packages/api/handlers/typescript/src/index.ts": "", + "packages/api/handlers/typescript/tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + }, + "packages/api/handlers/typescript/tsconfig.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "dom", + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": "src", + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + ], + }, + "packages/api/model/.gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +/.gitattributes linguist-generated +/.gitignore linguist-generated +/.npmignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/generated/aws-pdk/async.js linguist-generated +/generated/aws-pdk/async.tsp linguist-generated +/generated/aws-pdk/prelude.js linguist-generated +/generated/aws-pdk/prelude.tsp linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/project.json linguist-generated +/tspconfig.yaml linguist-generated +/yarn.lock linguist-generated", + "packages/api/model/.gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +!/.gitattributes +!/.projen/tasks.json +!/.projen/deps.json +!/.projen/files.json +!/package.json +!/.npmignore +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 +/test-reports/ +junit.xml +/coverage/ +dist +!/tspconfig.yaml +!/generated/aws-pdk/prelude.tsp +!/generated/aws-pdk/prelude.js +!/generated/aws-pdk/async.tsp +!/generated/aws-pdk/async.js +.api.json +.asyncapi.json +!/project.json +!/LICENSE +", + "packages/api/model/.npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/test-reports/ +junit.xml +/coverage/ +/.gitattributes +", + "packages/api/model/.projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@typespec/compiler", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/http", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi3", + "type": "build", + "version": "^0.61", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + ], + }, + "packages/api/model/.projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".gitignore", + ".npmignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/aws-pdk/async.js", + "generated/aws-pdk/async.tsp", + "generated/aws-pdk/prelude.js", + "generated/aws-pdk/prelude.tsp", + "LICENSE", + "project.json", + "tspconfig.yaml", + ], + }, + "packages/api/model/.projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + }, + "generate": { + "env": { + "NODE_OPTIONS": "--experimental-default-type=module", + }, + "name": "generate", + "steps": [ + { + "exec": "tsp compile src --config tspconfig.yaml", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath dist/@typespec/openapi3/openapi.json --outputPath .api.json", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "npm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=jest", + }, + { + "exec": "yarn install --check-files", + }, + { + "exec": "yarn upgrade @aws/pdk @typespec/compiler @typespec/http @typespec/openapi @typespec/openapi3 jest jest-junit", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + }, + }, + "packages/api/model/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. +", + "packages/api/model/README.md": "# replace this", + "packages/api/model/generated/aws-pdk/async.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; +import { $post, $route } from "@typespec/http"; + +export function $async(context, target, value) { + $post(context, target); + $route(context, target, \`/\${target.name}\`); + $extension(context, target, "x-async", value); +} + +export function $connectHandler(context, target, value) { + $extension(context, target, "x-connect-handler", value); +} + +export function $disconnectHandler(context, target, value) { + $extension(context, target, "x-disconnect-handler", value); +} +", + "packages/api/model/generated/aws-pdk/async.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.tsp"; +import "./async.js"; + +using TypeSpec.Reflection; + +model AsyncOptions { + direction: "client_to_server" | "server_to_client" | "bidirectional"; +} + +extern dec async(target: Operation, options: AsyncOptions); + +extern dec connectHandler(target: Namespace, options: HandlerOptions); +extern dec disconnectHandler(target: Namespace, options: HandlerOptions); +", + "packages/api/model/generated/aws-pdk/prelude.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +", + "packages/api/model/generated/aws-pdk/prelude.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.js"; + +using TypeSpec.Reflection; + +model HandlerOptions { + language: "typescript"; +} + +extern dec handler(target: Operation, options: HandlerOptions); +", + "packages/api/model/package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "devDependencies": { + "@aws/pdk": "^0", + "@typespec/compiler": "^0.61", + "@typespec/http": "^0.61", + "@typespec/openapi": "^0.61", + "@typespec/openapi3": "^0.61", + "jest": "*", + "jest-junit": "^15", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-typescript-model", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "compile": "npx projen compile", + "default": "npx projen default", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "upgrade": "npx projen upgrade", + }, + "version": "0.0.0", + }, + "packages/api/model/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "name": "typespec-typescript-model", + "root": "packages/api/model", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen build", + "cwd": "packages/api/model", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen compile", + "cwd": "packages/api/model", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen default", + "cwd": "packages/api/model", + }, + }, + "generate": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen generate", + "cwd": "packages/api/model", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen package", + "cwd": "packages/api/model", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen post-compile", + "cwd": "packages/api/model", + }, + }, + "post-upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen post-upgrade", + "cwd": "packages/api/model", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen pre-compile", + "cwd": "packages/api/model", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen test", + "cwd": "packages/api/model", + }, + }, + "test:watch": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen test:watch", + "cwd": "packages/api/model", + }, + }, + "upgrade": { + "executor": "nx:run-commands", + "options": { + "command": "yarn projen upgrade", + "cwd": "packages/api/model", + }, + }, + }, + }, + "packages/api/model/src/main.tsp": "import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; +import "../generated/aws-pdk/async.tsp"; + +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyService", +}) +@info({ + version: "1.0", +}) +@connectHandler({ language: "typescript" }) +@disconnectHandler({ language: "typescript" }) +namespace MyService; + +@handler({ language: "typescript" }) +@async({ direction: "client_to_server" }) +op SubscribeToNotifications( + topic: string, +): void; + +@async({ direction: "server_to_client" }) +op SendNotification( + topic: string, + title: string, + message: string, +): void; +", + "packages/api/model/tspconfig.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +emit: + - "@typespec/openapi3" +options: + "@typespec/openapi3": + output-file: openapi.json +output-dir: "{cwd}/dist" +", + "packages/api/project.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "name": "typespec-typescript", + "root": "packages/api", + "targets": { + "build": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen build", + "cwd": "packages/api", + }, + }, + "compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen compile", + "cwd": "packages/api", + }, + }, + "default": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen default", + "cwd": "packages/api", + }, + }, + "package": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen package", + "cwd": "packages/api", + }, + }, + "post-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen post-compile", + "cwd": "packages/api", + }, + }, + "pre-compile": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen pre-compile", + "cwd": "packages/api", + }, + }, + "test": { + "executor": "nx:run-commands", + "options": { + "command": "npx projen test", + "cwd": "packages/api", + }, + }, + }, + }, + "tsconfig.dev.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "rootDir": ".", + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [ + "node_modules", + ], + "include": [ + "src/**/*.ts", + "test/**/*.ts", + "**/*.ts", + ".projenrc.ts", + "projenrc/**/*.ts", + ], + }, + "tsconfig.json": { + "compilerOptions": { + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "es2019", + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "outDir": "lib", + "resolveJsonModule": true, + "rootDir": ".", + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019", + }, + "exclude": [], + "include": [ + "src/**/*.ts", + "**/*.ts", + ".projenrc.ts", + ], + }, +} +`; diff --git a/packages/type-safe-api/test/project/model/__snapshots__/type-safe-api-model-project.test.ts.snap b/packages/type-safe-api/test/project/model/__snapshots__/type-safe-api-model-project.test.ts.snap index 4716d5bd3..0bd933ad7 100644 --- a/packages/type-safe-api/test/project/model/__snapshots__/type-safe-api-model-project.test.ts.snap +++ b/packages/type-safe-api/test/project/model/__snapshots__/type-safe-api-model-project.test.ts.snap @@ -2326,3 +2326,2268 @@ structure NotAuthorizedError { ", } `; + +exports[`Type Safe Api Model Project Unit Tests TypeSpec 1`] = ` +{ + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +*.snap linguist-generated +/.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-mainline.yml linguist-generated +/.gitignore linguist-generated +/.mergify.yml linguist-generated +/.npmignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/generated/aws-pdk/prelude.js linguist-generated +/generated/aws-pdk/prelude.tsp linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/tspconfig.yaml 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: + - mainline + 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:mainline + run: npx projen release:mainline + - 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-mainline.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: upgrade-mainline +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: mainline + - 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: mainline + - 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-mainline" workflow* + branch: github-actions/upgrade-mainline + 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-mainline" 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 +!/.npmignore +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 +/test-reports/ +junit.xml +/coverage/ +!/.github/workflows/build.yml +/dist/changelog.md +/dist/version.txt +!/.github/workflows/release.yml +!/.mergify.yml +!/.github/workflows/upgrade-mainline.yml +!/.github/pull_request_template.md +dist +!/tspconfig.yaml +!/generated/aws-pdk/prelude.tsp +!/generated/aws-pdk/prelude.js +.api.json +!/.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 +", + ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/test-reports/ +junit.xml +/coverage/ +permissions-backup.acl +/dist/changelog.md +/dist/version.txt +/.mergify.yml +/.projenrc.js +/.gitattributes +", + ".projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@typespec/compiler", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/http", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi3", + "type": "build", + "version": "^0.61", + }, + { + "name": "constructs", + "type": "build", + "version": "^10.0.0", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + { + "name": "projen", + "type": "build", + }, + { + "name": "standard-version", + "type": "build", + "version": "^9", + }, + ], + }, + ".projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".github/pull_request_template.md", + ".github/workflows/build.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/release.yml", + ".github/workflows/upgrade-mainline.yml", + ".gitignore", + ".mergify.yml", + ".npmignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/aws-pdk/prelude.js", + "generated/aws-pdk/prelude.tsp", + "LICENSE", + "tspconfig.yaml", + ], + }, + ".projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "default", + }, + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "bump": { + "condition": "! git log --oneline -1 | grep -q "chore(release):"", + "description": "Bumps version based on latest git tag and generates a changelog entry", + "env": { + "BUMPFILE": "dist/version.txt", + "CHANGELOG": "dist/changelog.md", + "OUTFILE": "package.json", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + }, + "name": "bump", + "steps": [ + { + "builtin": "release/bump-version", + }, + ], + }, + "clobber": { + "condition": "git diff --exit-code > /dev/null", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": { + "BRANCH": "$(git branch --show-current)", + }, + "name": "clobber", + "steps": [ + { + "exec": "git checkout -b scratch", + "name": "save current HEAD in "scratch" branch", + }, + { + "exec": "git checkout $BRANCH", + }, + { + "exec": "git fetch origin", + "name": "fetch latest changes from origin", + }, + { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit", + }, + { + "exec": "git clean -fdx", + "name": "clean all untracked files", + }, + { + "say": "ready to rock! (unpushed commits are under the "scratch" branch)", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "exec": "node .projenrc.js", + }, + ], + }, + "eject": { + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": [ + { + "spawn": "default", + }, + ], + }, + "generate": { + "env": { + "NODE_OPTIONS": "--experimental-default-type=module", + }, + "name": "generate", + "steps": [ + { + "exec": "tsp compile src --config tspconfig.yaml", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath dist/@typespec/openapi3/openapi.json --outputPath .api.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "npm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "release:mainline": { + "description": "Prepare a release from "mainline" branch", + "env": { + "RELEASE": "true", + }, + "name": "release:mainline", + "steps": [ + { + "exec": "rm -fr dist", + }, + { + "spawn": "bump", + }, + { + "spawn": "build", + }, + { + "spawn": "unbump", + }, + { + "exec": "git diff --ignore-space-at-eol --exit-code", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "unbump": { + "description": "Restores version to 0.0.0", + "env": { + "BUMPFILE": "dist/version.txt", + "CHANGELOG": "dist/changelog.md", + "OUTFILE": "package.json", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + }, + "name": "unbump", + "steps": [ + { + "builtin": "release/reset-version", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=jest,projen", + }, + { + "exec": "yarn install --check-files", + }, + { + "exec": "yarn upgrade @aws/pdk @typespec/compiler @typespec/http @typespec/openapi @typespec/openapi3 constructs jest jest-junit projen standard-version", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + }, + }, + "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": "# replace this", + "generated/aws-pdk/prelude.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +", + "generated/aws-pdk/prelude.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.js"; + +using TypeSpec.Reflection; + + +", + "package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "devDependencies": { + "@aws/pdk": "^0", + "@typespec/compiler": "^0.61", + "@typespec/http": "^0.61", + "@typespec/openapi": "^0.61", + "@typespec/openapi3": "^0.61", + "constructs": "^10.0.0", + "jest": "*", + "jest-junit": "^15", + "projen": "*", + "standard-version": "^9", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "bump": "npx projen bump", + "clobber": "npx projen clobber", + "compile": "npx projen compile", + "default": "npx projen default", + "eject": "npx projen eject", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "release:mainline": "npx projen release:mainline", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "unbump": "npx projen unbump", + "upgrade": "npx projen upgrade", + }, + "version": "0.0.0", + }, + "src/main.tsp": "import "@typespec/http"; +import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; + +import "./types/errors.tsp"; + +using Http; +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyService", +}) +@info({ + version: "1.0", +}) +namespace MyService; + +@get +@route("/hello") +op SayHello(@query name: string): + | { + @statusCode statusCode: 200; + @body body: { + message: string; + }; + } + | BadRequestError + | NotAuthorizedError + | NotFoundError + | InternalFailureError; +", + "src/types/errors.tsp": "import "@typespec/http"; + +using Http; + +/** + * An error at the fault of the client sending invalid input + */ +model BadRequestErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An internal failure at the fault of the server + */ +model InternalFailureErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client not being authorized to access the resource + */ +model NotAuthorizedErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client attempting to access a missing resource + */ +model NotFoundErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * BadRequestError 400 response + */ +@error +model BadRequestError { + @statusCode statusCode: 400; + @body body: BadRequestErrorResponseContent; +} + +/** + * NotAuthorizedError 403 response + */ +@error +model NotAuthorizedError { + @statusCode statusCode: 403; + @body body: NotAuthorizedErrorResponseContent; +} + +/** + * NotFoundError 404 response + */ +@error +model NotFoundError { + @statusCode statusCode: 404; + @body body: NotFoundErrorResponseContent; +} + +/** + * InternalFailureError 500 response + */ +@error +model InternalFailureError { + @statusCode statusCode: 500; + @body body: InternalFailureErrorResponseContent; +} +", + "tspconfig.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +emit: + - "@typespec/openapi3" +options: + "@typespec/openapi3": + output-file: openapi.json +output-dir: "{cwd}/dist" +", +} +`; + +exports[`Type Safe Api Model Project Unit Tests TypeSpec with handlers 1`] = ` +{ + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +*.snap linguist-generated +/.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-mainline.yml linguist-generated +/.gitignore linguist-generated +/.mergify.yml linguist-generated +/.npmignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/generated/aws-pdk/prelude.js linguist-generated +/generated/aws-pdk/prelude.tsp linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/tspconfig.yaml 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: + - mainline + 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:mainline + run: npx projen release:mainline + - 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-mainline.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: upgrade-mainline +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: mainline + - 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: mainline + - 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-mainline" workflow* + branch: github-actions/upgrade-mainline + 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-mainline" 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 +!/.npmignore +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 +/test-reports/ +junit.xml +/coverage/ +!/.github/workflows/build.yml +/dist/changelog.md +/dist/version.txt +!/.github/workflows/release.yml +!/.mergify.yml +!/.github/workflows/upgrade-mainline.yml +!/.github/pull_request_template.md +dist +!/tspconfig.yaml +!/generated/aws-pdk/prelude.tsp +!/generated/aws-pdk/prelude.js +.api.json +!/.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 +", + ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/test-reports/ +junit.xml +/coverage/ +permissions-backup.acl +/dist/changelog.md +/dist/version.txt +/.mergify.yml +/.projenrc.js +/.gitattributes +", + ".projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@typespec/compiler", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/http", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi3", + "type": "build", + "version": "^0.61", + }, + { + "name": "constructs", + "type": "build", + "version": "^10.0.0", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + { + "name": "projen", + "type": "build", + }, + { + "name": "standard-version", + "type": "build", + "version": "^9", + }, + ], + }, + ".projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".github/pull_request_template.md", + ".github/workflows/build.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/release.yml", + ".github/workflows/upgrade-mainline.yml", + ".gitignore", + ".mergify.yml", + ".npmignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/aws-pdk/prelude.js", + "generated/aws-pdk/prelude.tsp", + "LICENSE", + "tspconfig.yaml", + ], + }, + ".projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "default", + }, + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "bump": { + "condition": "! git log --oneline -1 | grep -q "chore(release):"", + "description": "Bumps version based on latest git tag and generates a changelog entry", + "env": { + "BUMPFILE": "dist/version.txt", + "CHANGELOG": "dist/changelog.md", + "OUTFILE": "package.json", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + }, + "name": "bump", + "steps": [ + { + "builtin": "release/bump-version", + }, + ], + }, + "clobber": { + "condition": "git diff --exit-code > /dev/null", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": { + "BRANCH": "$(git branch --show-current)", + }, + "name": "clobber", + "steps": [ + { + "exec": "git checkout -b scratch", + "name": "save current HEAD in "scratch" branch", + }, + { + "exec": "git checkout $BRANCH", + }, + { + "exec": "git fetch origin", + "name": "fetch latest changes from origin", + }, + { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit", + }, + { + "exec": "git clean -fdx", + "name": "clean all untracked files", + }, + { + "say": "ready to rock! (unpushed commits are under the "scratch" branch)", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "exec": "node .projenrc.js", + }, + ], + }, + "eject": { + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": [ + { + "spawn": "default", + }, + ], + }, + "generate": { + "env": { + "NODE_OPTIONS": "--experimental-default-type=module", + }, + "name": "generate", + "steps": [ + { + "exec": "tsp compile src --config tspconfig.yaml", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath dist/@typespec/openapi3/openapi.json --outputPath .api.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "npm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "release:mainline": { + "description": "Prepare a release from "mainline" branch", + "env": { + "RELEASE": "true", + }, + "name": "release:mainline", + "steps": [ + { + "exec": "rm -fr dist", + }, + { + "spawn": "bump", + }, + { + "spawn": "build", + }, + { + "spawn": "unbump", + }, + { + "exec": "git diff --ignore-space-at-eol --exit-code", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "unbump": { + "description": "Restores version to 0.0.0", + "env": { + "BUMPFILE": "dist/version.txt", + "CHANGELOG": "dist/changelog.md", + "OUTFILE": "package.json", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + }, + "name": "unbump", + "steps": [ + { + "builtin": "release/reset-version", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=jest,projen", + }, + { + "exec": "yarn install --check-files", + }, + { + "exec": "yarn upgrade @aws/pdk @typespec/compiler @typespec/http @typespec/openapi @typespec/openapi3 constructs jest jest-junit projen standard-version", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + }, + }, + "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": "# replace this", + "generated/aws-pdk/prelude.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +", + "generated/aws-pdk/prelude.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.js"; + +using TypeSpec.Reflection; + +model HandlerOptions { + language: "typescript" | "python"; +} + +extern dec handler(target: Operation, options: HandlerOptions); +", + "package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "devDependencies": { + "@aws/pdk": "^0", + "@typespec/compiler": "^0.61", + "@typespec/http": "^0.61", + "@typespec/openapi": "^0.61", + "@typespec/openapi3": "^0.61", + "constructs": "^10.0.0", + "jest": "*", + "jest-junit": "^15", + "projen": "*", + "standard-version": "^9", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-handlers", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "bump": "npx projen bump", + "clobber": "npx projen clobber", + "compile": "npx projen compile", + "default": "npx projen default", + "eject": "npx projen eject", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "release:mainline": "npx projen release:mainline", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "unbump": "npx projen unbump", + "upgrade": "npx projen upgrade", + }, + "version": "0.0.0", + }, + "src/main.tsp": "import "@typespec/http"; +import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; + +import "./types/errors.tsp"; + +using Http; +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyService", +}) +@info({ + version: "1.0", +}) +namespace MyService; + +@handler({ language: "typescript" }) +@get +@route("/hello") +op SayHello(@query name: string): + | { + @statusCode statusCode: 200; + @body body: { + message: string; + }; + } + | BadRequestError + | NotAuthorizedError + | NotFoundError + | InternalFailureError; +", + "src/types/errors.tsp": "import "@typespec/http"; + +using Http; + +/** + * An error at the fault of the client sending invalid input + */ +model BadRequestErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An internal failure at the fault of the server + */ +model InternalFailureErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client not being authorized to access the resource + */ +model NotAuthorizedErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * An error due to the client attempting to access a missing resource + */ +model NotFoundErrorResponseContent { + /** + * Message with details about the error + */ + message: string; +} + +/** + * BadRequestError 400 response + */ +@error +model BadRequestError { + @statusCode statusCode: 400; + @body body: BadRequestErrorResponseContent; +} + +/** + * NotAuthorizedError 403 response + */ +@error +model NotAuthorizedError { + @statusCode statusCode: 403; + @body body: NotAuthorizedErrorResponseContent; +} + +/** + * NotFoundError 404 response + */ +@error +model NotFoundError { + @statusCode statusCode: 404; + @body body: NotFoundErrorResponseContent; +} + +/** + * InternalFailureError 500 response + */ +@error +model InternalFailureError { + @statusCode statusCode: 500; + @body body: InternalFailureErrorResponseContent; +} +", + "tspconfig.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +emit: + - "@typespec/openapi3" +options: + "@typespec/openapi3": + output-file: openapi.json +output-dir: "{cwd}/dist" +", +} +`; diff --git a/packages/type-safe-api/test/project/model/__snapshots__/type-safe-websocket-api-model-project.test.ts.snap b/packages/type-safe-api/test/project/model/__snapshots__/type-safe-websocket-api-model-project.test.ts.snap index 5185be91f..930b0c255 100644 --- a/packages/type-safe-api/test/project/model/__snapshots__/type-safe-websocket-api-model-project.test.ts.snap +++ b/packages/type-safe-api/test/project/model/__snapshots__/type-safe-websocket-api-model-project.test.ts.snap @@ -1613,3 +1613,2186 @@ operation SubscribeToNotifications { ", } `; + +exports[`Type Safe Api Model Project Unit Tests TypeSpec 1`] = ` +{ + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +*.snap linguist-generated +/.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-mainline.yml linguist-generated +/.gitignore linguist-generated +/.mergify.yml linguist-generated +/.npmignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/generated/aws-pdk/async.js linguist-generated +/generated/aws-pdk/async.tsp linguist-generated +/generated/aws-pdk/prelude.js linguist-generated +/generated/aws-pdk/prelude.tsp linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/tspconfig.yaml 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: + - mainline + 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:mainline + run: npx projen release:mainline + - 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-mainline.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: upgrade-mainline +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: mainline + - 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: mainline + - 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-mainline" workflow* + branch: github-actions/upgrade-mainline + 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-mainline" 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 +!/.npmignore +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 +/test-reports/ +junit.xml +/coverage/ +!/.github/workflows/build.yml +/dist/changelog.md +/dist/version.txt +!/.github/workflows/release.yml +!/.mergify.yml +!/.github/workflows/upgrade-mainline.yml +!/.github/pull_request_template.md +dist +!/tspconfig.yaml +!/generated/aws-pdk/prelude.tsp +!/generated/aws-pdk/prelude.js +!/generated/aws-pdk/async.tsp +!/generated/aws-pdk/async.js +.api.json +.asyncapi.json +!/.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 +", + ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/test-reports/ +junit.xml +/coverage/ +permissions-backup.acl +/dist/changelog.md +/dist/version.txt +/.mergify.yml +/.projenrc.js +/.gitattributes +", + ".projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@typespec/compiler", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/http", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi3", + "type": "build", + "version": "^0.61", + }, + { + "name": "constructs", + "type": "build", + "version": "^10.0.0", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + { + "name": "projen", + "type": "build", + }, + { + "name": "standard-version", + "type": "build", + "version": "^9", + }, + ], + }, + ".projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".github/pull_request_template.md", + ".github/workflows/build.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/release.yml", + ".github/workflows/upgrade-mainline.yml", + ".gitignore", + ".mergify.yml", + ".npmignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/aws-pdk/async.js", + "generated/aws-pdk/async.tsp", + "generated/aws-pdk/prelude.js", + "generated/aws-pdk/prelude.tsp", + "LICENSE", + "tspconfig.yaml", + ], + }, + ".projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "default", + }, + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "bump": { + "condition": "! git log --oneline -1 | grep -q "chore(release):"", + "description": "Bumps version based on latest git tag and generates a changelog entry", + "env": { + "BUMPFILE": "dist/version.txt", + "CHANGELOG": "dist/changelog.md", + "OUTFILE": "package.json", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + }, + "name": "bump", + "steps": [ + { + "builtin": "release/bump-version", + }, + ], + }, + "clobber": { + "condition": "git diff --exit-code > /dev/null", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": { + "BRANCH": "$(git branch --show-current)", + }, + "name": "clobber", + "steps": [ + { + "exec": "git checkout -b scratch", + "name": "save current HEAD in "scratch" branch", + }, + { + "exec": "git checkout $BRANCH", + }, + { + "exec": "git fetch origin", + "name": "fetch latest changes from origin", + }, + { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit", + }, + { + "exec": "git clean -fdx", + "name": "clean all untracked files", + }, + { + "say": "ready to rock! (unpushed commits are under the "scratch" branch)", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "exec": "node .projenrc.js", + }, + ], + }, + "eject": { + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": [ + { + "spawn": "default", + }, + ], + }, + "generate": { + "env": { + "NODE_OPTIONS": "--experimental-default-type=module", + }, + "name": "generate", + "steps": [ + { + "exec": "tsp compile src --config tspconfig.yaml", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath dist/@typespec/openapi3/openapi.json --outputPath .api.json", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "npm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "release:mainline": { + "description": "Prepare a release from "mainline" branch", + "env": { + "RELEASE": "true", + }, + "name": "release:mainline", + "steps": [ + { + "exec": "rm -fr dist", + }, + { + "spawn": "bump", + }, + { + "spawn": "build", + }, + { + "spawn": "unbump", + }, + { + "exec": "git diff --ignore-space-at-eol --exit-code", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "unbump": { + "description": "Restores version to 0.0.0", + "env": { + "BUMPFILE": "dist/version.txt", + "CHANGELOG": "dist/changelog.md", + "OUTFILE": "package.json", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + }, + "name": "unbump", + "steps": [ + { + "builtin": "release/reset-version", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=jest,projen", + }, + { + "exec": "yarn install --check-files", + }, + { + "exec": "yarn upgrade @aws/pdk @typespec/compiler @typespec/http @typespec/openapi @typespec/openapi3 constructs jest jest-junit projen standard-version", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + }, + }, + "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": "# replace this", + "generated/aws-pdk/async.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; +import { $post, $route } from "@typespec/http"; + +export function $async(context, target, value) { + $post(context, target); + $route(context, target, \`/\${target.name}\`); + $extension(context, target, "x-async", value); +} + +export function $connectHandler(context, target, value) { + $extension(context, target, "x-connect-handler", value); +} + +export function $disconnectHandler(context, target, value) { + $extension(context, target, "x-disconnect-handler", value); +} +", + "generated/aws-pdk/async.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.tsp"; +import "./async.js"; + +using TypeSpec.Reflection; + +model AsyncOptions { + direction: "client_to_server" | "server_to_client" | "bidirectional"; +} + +extern dec async(target: Operation, options: AsyncOptions); + +extern dec connectHandler(target: Namespace, options: HandlerOptions); +extern dec disconnectHandler(target: Namespace, options: HandlerOptions); +", + "generated/aws-pdk/prelude.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +", + "generated/aws-pdk/prelude.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.js"; + +using TypeSpec.Reflection; + + +", + "package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "devDependencies": { + "@aws/pdk": "^0", + "@typespec/compiler": "^0.61", + "@typespec/http": "^0.61", + "@typespec/openapi": "^0.61", + "@typespec/openapi3": "^0.61", + "constructs": "^10.0.0", + "jest": "*", + "jest-junit": "^15", + "projen": "*", + "standard-version": "^9", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-async", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "bump": "npx projen bump", + "clobber": "npx projen clobber", + "compile": "npx projen compile", + "default": "npx projen default", + "eject": "npx projen eject", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "release:mainline": "npx projen release:mainline", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "unbump": "npx projen unbump", + "upgrade": "npx projen upgrade", + }, + "version": "0.0.0", + }, + "src/main.tsp": "import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; +import "../generated/aws-pdk/async.tsp"; + +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyService", +}) +@info({ + version: "1.0", +}) +namespace MyService; + +@async({ direction: "client_to_server" }) +op SubscribeToNotifications( + topic: string, +): void; + +@async({ direction: "server_to_client" }) +op SendNotification( + topic: string, + title: string, + message: string, +): void; +", + "tspconfig.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +emit: + - "@typespec/openapi3" +options: + "@typespec/openapi3": + output-file: openapi.json +output-dir: "{cwd}/dist" +", +} +`; + +exports[`Type Safe Api Model Project Unit Tests TypeSpec with handlers 1`] = ` +{ + ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +*.snap linguist-generated +/.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-mainline.yml linguist-generated +/.gitignore linguist-generated +/.mergify.yml linguist-generated +/.npmignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/files.json linguist-generated +/.projen/tasks.json linguist-generated +/generated/aws-pdk/async.js linguist-generated +/generated/aws-pdk/async.tsp linguist-generated +/generated/aws-pdk/prelude.js linguist-generated +/generated/aws-pdk/prelude.tsp linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/tspconfig.yaml 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: + - mainline + 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:mainline + run: npx projen release:mainline + - 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-mainline.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: upgrade-mainline +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: mainline + - 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: mainline + - 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-mainline" workflow* + branch: github-actions/upgrade-mainline + 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-mainline" 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 +!/.npmignore +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 +/test-reports/ +junit.xml +/coverage/ +!/.github/workflows/build.yml +/dist/changelog.md +/dist/version.txt +!/.github/workflows/release.yml +!/.mergify.yml +!/.github/workflows/upgrade-mainline.yml +!/.github/pull_request_template.md +dist +!/tspconfig.yaml +!/generated/aws-pdk/prelude.tsp +!/generated/aws-pdk/prelude.js +!/generated/aws-pdk/async.tsp +!/generated/aws-pdk/async.js +.api.json +.asyncapi.json +!/.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 +", + ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +/.projen/ +/test-reports/ +junit.xml +/coverage/ +permissions-backup.acl +/dist/changelog.md +/dist/version.txt +/.mergify.yml +/.projenrc.js +/.gitattributes +", + ".projen/deps.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "dependencies": [ + { + "name": "@aws/pdk", + "type": "build", + "version": "^0", + }, + { + "name": "@typespec/compiler", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/http", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi", + "type": "build", + "version": "^0.61", + }, + { + "name": "@typespec/openapi3", + "type": "build", + "version": "^0.61", + }, + { + "name": "constructs", + "type": "build", + "version": "^10.0.0", + }, + { + "name": "jest", + "type": "build", + }, + { + "name": "jest-junit", + "type": "build", + "version": "^15", + }, + { + "name": "projen", + "type": "build", + }, + { + "name": "standard-version", + "type": "build", + "version": "^9", + }, + ], + }, + ".projen/files.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "files": [ + ".gitattributes", + ".github/pull_request_template.md", + ".github/workflows/build.yml", + ".github/workflows/pull-request-lint.yml", + ".github/workflows/release.yml", + ".github/workflows/upgrade-mainline.yml", + ".gitignore", + ".mergify.yml", + ".npmignore", + ".projen/deps.json", + ".projen/files.json", + ".projen/tasks.json", + "generated/aws-pdk/async.js", + "generated/aws-pdk/async.tsp", + "generated/aws-pdk/prelude.js", + "generated/aws-pdk/prelude.tsp", + "LICENSE", + "tspconfig.yaml", + ], + }, + ".projen/tasks.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "env": { + "AWS_PDK_VERSION": "0.0.0", + "PATH": "$(npx -c "node --print process.env.PATH")", + }, + "tasks": { + "build": { + "description": "Full release build", + "name": "build", + "steps": [ + { + "spawn": "default", + }, + { + "spawn": "pre-compile", + }, + { + "spawn": "compile", + }, + { + "spawn": "post-compile", + }, + { + "spawn": "test", + }, + { + "spawn": "package", + }, + ], + }, + "bump": { + "condition": "! git log --oneline -1 | grep -q "chore(release):"", + "description": "Bumps version based on latest git tag and generates a changelog entry", + "env": { + "BUMPFILE": "dist/version.txt", + "CHANGELOG": "dist/changelog.md", + "OUTFILE": "package.json", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + }, + "name": "bump", + "steps": [ + { + "builtin": "release/bump-version", + }, + ], + }, + "clobber": { + "condition": "git diff --exit-code > /dev/null", + "description": "hard resets to HEAD of origin and cleans the local repo", + "env": { + "BRANCH": "$(git branch --show-current)", + }, + "name": "clobber", + "steps": [ + { + "exec": "git checkout -b scratch", + "name": "save current HEAD in "scratch" branch", + }, + { + "exec": "git checkout $BRANCH", + }, + { + "exec": "git fetch origin", + "name": "fetch latest changes from origin", + }, + { + "exec": "git reset --hard origin/$BRANCH", + "name": "hard reset to origin commit", + }, + { + "exec": "git clean -fdx", + "name": "clean all untracked files", + }, + { + "say": "ready to rock! (unpushed commits are under the "scratch" branch)", + }, + ], + }, + "compile": { + "description": "Only compile", + "name": "compile", + "steps": [ + { + "spawn": "generate", + }, + ], + }, + "default": { + "description": "Synthesize project files", + "name": "default", + "steps": [ + { + "exec": "node .projenrc.js", + }, + ], + }, + "eject": { + "description": "Remove projen from the project", + "env": { + "PROJEN_EJECTING": "true", + }, + "name": "eject", + "steps": [ + { + "spawn": "default", + }, + ], + }, + "generate": { + "env": { + "NODE_OPTIONS": "--experimental-default-type=module", + }, + "name": "generate", + "steps": [ + { + "exec": "tsp compile src --config tspconfig.yaml", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api parse-openapi-spec --specPath dist/@typespec/openapi3/openapi.json --outputPath .api.json", + }, + { + "exec": "npx --yes -p @aws/pdk@$AWS_PDK_VERSION type-safe-api generate-asyncapi-spec --specPath .api.json --outputPath .asyncapi.json", + }, + ], + }, + "install": { + "description": "Install project dependencies and update lockfile (non-frozen)", + "name": "install", + "steps": [ + { + "exec": "yarn install --check-files", + }, + ], + }, + "install:ci": { + "description": "Install project dependencies using frozen lockfile", + "name": "install:ci", + "steps": [ + { + "exec": "yarn install --check-files --frozen-lockfile", + }, + ], + }, + "package": { + "description": "Creates the distribution package", + "name": "package", + "steps": [ + { + "exec": "mkdir -p dist/js", + }, + { + "exec": "npm pack --pack-destination dist/js", + }, + ], + }, + "post-compile": { + "description": "Runs after successful compilation", + "name": "post-compile", + }, + "post-upgrade": { + "description": "Runs after upgrading dependencies", + "name": "post-upgrade", + }, + "pre-compile": { + "description": "Prepare the project for compilation", + "name": "pre-compile", + }, + "release:mainline": { + "description": "Prepare a release from "mainline" branch", + "env": { + "RELEASE": "true", + }, + "name": "release:mainline", + "steps": [ + { + "exec": "rm -fr dist", + }, + { + "spawn": "bump", + }, + { + "spawn": "build", + }, + { + "spawn": "unbump", + }, + { + "exec": "git diff --ignore-space-at-eol --exit-code", + }, + ], + }, + "test": { + "description": "Run tests", + "name": "test", + "steps": [ + { + "exec": "jest --passWithNoTests --updateSnapshot", + "receiveArgs": true, + }, + ], + }, + "test:watch": { + "description": "Run jest in watch mode", + "name": "test:watch", + "steps": [ + { + "exec": "jest --watch", + }, + ], + }, + "unbump": { + "description": "Restores version to 0.0.0", + "env": { + "BUMPFILE": "dist/version.txt", + "CHANGELOG": "dist/changelog.md", + "OUTFILE": "package.json", + "RELEASETAG": "dist/releasetag.txt", + "RELEASE_TAG_PREFIX": "", + }, + "name": "unbump", + "steps": [ + { + "builtin": "release/reset-version", + }, + ], + }, + "upgrade": { + "description": "upgrade dependencies", + "env": { + "CI": "0", + }, + "name": "upgrade", + "steps": [ + { + "exec": "npx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=jest,projen", + }, + { + "exec": "yarn install --check-files", + }, + { + "exec": "yarn upgrade @aws/pdk @typespec/compiler @typespec/http @typespec/openapi @typespec/openapi3 constructs jest jest-junit projen standard-version", + }, + { + "exec": "npx projen", + }, + { + "spawn": "post-upgrade", + }, + ], + }, + }, + }, + "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": "# replace this", + "generated/aws-pdk/async.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; +import { $post, $route } from "@typespec/http"; + +export function $async(context, target, value) { + $post(context, target); + $route(context, target, \`/\${target.name}\`); + $extension(context, target, "x-async", value); +} + +export function $connectHandler(context, target, value) { + $extension(context, target, "x-connect-handler", value); +} + +export function $disconnectHandler(context, target, value) { + $extension(context, target, "x-disconnect-handler", value); +} +", + "generated/aws-pdk/async.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.tsp"; +import "./async.js"; + +using TypeSpec.Reflection; + +model AsyncOptions { + direction: "client_to_server" | "server_to_client" | "bidirectional"; +} + +extern dec async(target: Operation, options: AsyncOptions); + +extern dec connectHandler(target: Namespace, options: HandlerOptions); +extern dec disconnectHandler(target: Namespace, options: HandlerOptions); +", + "generated/aws-pdk/prelude.js": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import { $extension } from "@typespec/openapi"; + +export function $handler(context, target, value) { + $extension(context, target, "x-handler", value); +} +", + "generated/aws-pdk/prelude.tsp": "// ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". +import "./prelude.js"; + +using TypeSpec.Reflection; + +model HandlerOptions { + language: "python" | "java"; +} + +extern dec handler(target: Operation, options: HandlerOptions); +", + "package.json": { + "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", + "devDependencies": { + "@aws/pdk": "^0", + "@typespec/compiler": "^0.61", + "@typespec/http": "^0.61", + "@typespec/openapi": "^0.61", + "@typespec/openapi3": "^0.61", + "constructs": "^10.0.0", + "jest": "*", + "jest-junit": "^15", + "projen": "*", + "standard-version": "^9", + }, + "jest": { + "clearMocks": true, + "collectCoverage": true, + "coverageDirectory": "coverage", + "coveragePathIgnorePatterns": [ + "/node_modules/", + ], + "coverageProvider": "v8", + "coverageReporters": [ + "json", + "lcov", + "clover", + "cobertura", + "text", + ], + "reporters": [ + "default", + [ + "jest-junit", + { + "outputDirectory": "test-reports", + }, + ], + ], + "testMatch": [ + "**/__tests__/**/*.[jt]s?(x)", + "**/?(*.)+(spec|test).[tj]s?(x)", + ], + "testPathIgnorePatterns": [ + "/node_modules/", + ], + "watchPathIgnorePatterns": [ + "/node_modules/", + ], + }, + "license": "Apache-2.0", + "main": "lib/index.js", + "name": "typespec-async-handlers", + "publishConfig": { + "access": "public", + }, + "scripts": { + "build": "npx projen build", + "bump": "npx projen bump", + "clobber": "npx projen clobber", + "compile": "npx projen compile", + "default": "npx projen default", + "eject": "npx projen eject", + "generate": "npx projen generate", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "post-upgrade": "npx projen post-upgrade", + "pre-compile": "npx projen pre-compile", + "projen": "npx projen", + "release:mainline": "npx projen release:mainline", + "test": "npx projen test", + "test:watch": "npx projen test:watch", + "unbump": "npx projen unbump", + "upgrade": "npx projen upgrade", + }, + "version": "0.0.0", + }, + "src/main.tsp": "import "@typespec/openapi"; +import "@typespec/openapi3"; +import "../generated/aws-pdk/prelude.tsp"; +import "../generated/aws-pdk/async.tsp"; + +using OpenAPI; + +/** + * A sample TypeSpec api + */ +@service({ + title: "MyService", +}) +@info({ + version: "1.0", +}) +@connectHandler({ language: "python" }) +@disconnectHandler({ language: "python" }) +namespace MyService; + +@handler({ language: "python" }) +@async({ direction: "client_to_server" }) +op SubscribeToNotifications( + topic: string, +): void; + +@async({ direction: "server_to_client" }) +op SendNotification( + topic: string, + title: string, + message: string, +): void; +", + "tspconfig.yaml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +emit: + - "@typespec/openapi3" +options: + "@typespec/openapi3": + output-file: openapi.json +output-dir: "{cwd}/dist" +", +} +`; diff --git a/packages/type-safe-api/test/project/model/type-safe-api-model-project.test.ts b/packages/type-safe-api/test/project/model/type-safe-api-model-project.test.ts index c1d3c66de..ade0ad507 100644 --- a/packages/type-safe-api/test/project/model/type-safe-api-model-project.test.ts +++ b/packages/type-safe-api/test/project/model/type-safe-api-model-project.test.ts @@ -5,6 +5,7 @@ import { Language, OpenApiModelProject, SmithyModelProject, + TypeSpecModelProject, } from "../../../src"; import { synthProject, synthSmithyProject } from "../snapshot-utils"; @@ -133,4 +134,33 @@ describe("Type Safe Api Model Project Unit Tests", () => { expect(synthProject(project)).toMatchSnapshot(); }); + + it("TypeSpec", () => { + const project = new TypeSpecModelProject({ + outdir: path.resolve(__dirname, "typespec"), + name: "typespec", + typeSpecOptions: { + namespace: "MyService", + }, + parsedSpecFile: ".api.json", + defaultReleaseBranch: "mainline", + }); + + expect(synthProject(project)).toMatchSnapshot(); + }); + + it("TypeSpec with handlers", () => { + const project = new TypeSpecModelProject({ + outdir: path.resolve(__dirname, "typespec-handlers"), + name: "typespec-handlers", + typeSpecOptions: { + namespace: "MyService", + }, + parsedSpecFile: ".api.json", + defaultReleaseBranch: "mainline", + handlerLanguages: [Language.TYPESCRIPT, Language.PYTHON], + }); + + expect(synthProject(project)).toMatchSnapshot(); + }); }); diff --git a/packages/type-safe-api/test/project/model/type-safe-websocket-api-model-project.test.ts b/packages/type-safe-api/test/project/model/type-safe-websocket-api-model-project.test.ts index 86f699b8d..a32bccd45 100644 --- a/packages/type-safe-api/test/project/model/type-safe-websocket-api-model-project.test.ts +++ b/packages/type-safe-api/test/project/model/type-safe-websocket-api-model-project.test.ts @@ -5,6 +5,7 @@ import { Language, OpenApiAsyncModelProject, SmithyAsyncModelProject, + TypeSpecAsyncModelProject, } from "../../../src"; import { synthProject, synthSmithyProject } from "../snapshot-utils"; @@ -72,4 +73,35 @@ describe("Type Safe Api Model Project Unit Tests", () => { expect(synthProject(project)).toMatchSnapshot(); }); + + it("TypeSpec", () => { + const project = new TypeSpecAsyncModelProject({ + outdir: path.resolve(__dirname, "typespec-async"), + name: "typespec-async", + typeSpecOptions: { + namespace: "MyService", + }, + parsedSpecFile: ".api.json", + asyncApiSpecFile: ".asyncapi.json", + defaultReleaseBranch: "mainline", + }); + + expect(synthProject(project)).toMatchSnapshot(); + }); + + it("TypeSpec with handlers", () => { + const project = new TypeSpecAsyncModelProject({ + outdir: path.resolve(__dirname, "typespec-async-handlers"), + name: "typespec-async-handlers", + typeSpecOptions: { + namespace: "MyService", + }, + parsedSpecFile: ".api.json", + asyncApiSpecFile: ".asyncapi.json", + defaultReleaseBranch: "mainline", + handlerLanguages: [Language.PYTHON, Language.JAVA], + }); + + expect(synthProject(project)).toMatchSnapshot(); + }); }); 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 cea897442..5ccc4d410 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 @@ -516,6 +516,32 @@ describe("Type Safe Api Project Unit Tests", () => { ); }); + it.each([Language.TYPESCRIPT, Language.PYTHON, Language.JAVA])( + "TypeSpec With %s Infra", + (infrastructureLanguage) => { + const project = new TypeSafeApiProject({ + name: `typespec-${infrastructureLanguage}`, + outdir: path.resolve(__dirname, `typespec-${infrastructureLanguage}`), + infrastructure: { + language: infrastructureLanguage, + }, + handlers: { + languages: [Language.JAVA, Language.PYTHON, Language.TYPESCRIPT], + }, + model: { + language: ModelLanguage.TYPESPEC, + options: { + typeSpec: { + namespace: "MyService", + }, + }, + }, + }); + + expect(synthProject(project)).toMatchSnapshot(); + } + ); + it("Throws For Missing Smithy Options", () => { expect(() => { new TypeSafeApiProject({ @@ -547,4 +573,20 @@ describe("Type Safe Api Project Unit Tests", () => { }); }).toThrow(/modelOptions.openapi is required.*/); }); + + it("Throws For Missing TypeSpec Options", () => { + expect(() => { + new TypeSafeApiProject({ + outdir: path.resolve(__dirname, "typespec"), + name: "typespec", + model: { + language: ModelLanguage.TYPESPEC, + options: {}, + }, + infrastructure: { + language: Language.TYPESCRIPT, + }, + }); + }).toThrow(/modelOptions.typeSpec is required.*/); + }); }); diff --git a/packages/type-safe-api/test/project/type-safe-websocket-api-project.test.ts b/packages/type-safe-api/test/project/type-safe-websocket-api-project.test.ts index d3ef8bbe7..258c5248a 100644 --- a/packages/type-safe-api/test/project/type-safe-websocket-api-project.test.ts +++ b/packages/type-safe-api/test/project/type-safe-websocket-api-project.test.ts @@ -360,6 +360,42 @@ describe("Type Safe Api Project Unit Tests", () => { expect(synthSmithyProject(project)).toMatchSnapshot(); }); + it.each([Language.TYPESCRIPT /*, Language.PYTHON, Language.JAVA*/])( + "TypeSpec With %s Infra in Monorepo", + (infrastructureLanguage) => { + const monorepo = new MonorepoTsProject({ + name: "monorepo", + outdir: path.resolve( + __dirname, + `async-monorepo-typespec-${infrastructureLanguage}` + ), + defaultReleaseBranch: "main", + }); + + new TypeSafeWebSocketApiProject({ + parent: monorepo, + name: `typespec-${infrastructureLanguage}`, + outdir: "packages/api", + infrastructure: { + language: infrastructureLanguage, + }, + handlers: { + languages: [/*Language.JAVA, Language.PYTHON,*/ Language.TYPESCRIPT], + }, + model: { + language: ModelLanguage.TYPESPEC, + options: { + typeSpec: { + namespace: "MyService", + }, + }, + }, + }); + + expect(synthProject(monorepo)).toMatchSnapshot(); + } + ); + // TODO: Remove this test and uncomment JAVA/PYTHON test cases above once support is added it.each([Language.JAVA, Language.PYTHON])( "Throws an error for language %s", @@ -417,4 +453,20 @@ describe("Type Safe Api Project Unit Tests", () => { }); }).toThrow(/modelOptions.openapi is required.*/); }); + + it("Throws For Missing TypeSpec Options", () => { + expect(() => { + new TypeSafeWebSocketApiProject({ + outdir: path.resolve(__dirname, "typespec-async"), + name: "typespec-async", + model: { + language: ModelLanguage.TYPESPEC, + options: {}, + }, + infrastructure: { + language: Language.TYPESCRIPT, + }, + }); + }).toThrow(/modelOptions.typeSpec is required.*/); + }); });