@typespec/http-client-js 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.testignore +2 -0
- package/LICENSE +21 -0
- package/README.md +26 -0
- package/babel.config.js +4 -0
- package/dist/src/components/client-context/client-context-declaration.d.ts +8 -0
- package/dist/src/components/client-context/client-context-declaration.d.ts.map +1 -0
- package/dist/src/components/client-context/client-context-declaration.js +21 -0
- package/dist/src/components/client-context/client-context-declaration.js.map +1 -0
- package/dist/src/components/client-context/client-context-factory.d.ts +8 -0
- package/dist/src/components/client-context/client-context-factory.d.ts.map +1 -0
- package/dist/src/components/client-context/client-context-factory.js +154 -0
- package/dist/src/components/client-context/client-context-factory.js.map +1 -0
- package/dist/src/components/client-context/client-context-options.d.ts +8 -0
- package/dist/src/components/client-context/client-context-options.d.ts.map +1 -0
- package/dist/src/components/client-context/client-context-options.js +42 -0
- package/dist/src/components/client-context/client-context-options.js.map +1 -0
- package/dist/src/components/client-context/client-context.d.ts +8 -0
- package/dist/src/components/client-context/client-context.d.ts.map +1 -0
- package/dist/src/components/client-context/client-context.js +33 -0
- package/dist/src/components/client-context/client-context.js.map +1 -0
- package/dist/src/components/client-context/parametrized-endpoint.d.ts +9 -0
- package/dist/src/components/client-context/parametrized-endpoint.d.ts.map +1 -0
- package/dist/src/components/client-context/parametrized-endpoint.js +48 -0
- package/dist/src/components/client-context/parametrized-endpoint.js.map +1 -0
- package/dist/src/components/client-directory.d.ts +11 -0
- package/dist/src/components/client-directory.d.ts.map +1 -0
- package/dist/src/components/client-directory.js +39 -0
- package/dist/src/components/client-directory.js.map +1 -0
- package/dist/src/components/client-operation.d.ts +11 -0
- package/dist/src/components/client-operation.d.ts.map +1 -0
- package/dist/src/components/client-operation.js +74 -0
- package/dist/src/components/client-operation.js.map +1 -0
- package/dist/src/components/client.d.ts +15 -0
- package/dist/src/components/client.d.ts.map +1 -0
- package/dist/src/components/client.js +153 -0
- package/dist/src/components/client.js.map +1 -0
- package/dist/src/components/encoding-provider.d.ts +8 -0
- package/dist/src/components/encoding-provider.d.ts.map +1 -0
- package/dist/src/components/encoding-provider.js +17 -0
- package/dist/src/components/encoding-provider.js.map +1 -0
- package/dist/src/components/external-packages/ts-http-runtime.d.ts +13 -0
- package/dist/src/components/external-packages/ts-http-runtime.d.ts.map +1 -0
- package/dist/src/components/external-packages/ts-http-runtime.js +11 -0
- package/dist/src/components/external-packages/ts-http-runtime.js.map +1 -0
- package/dist/src/components/external-packages/uri-template.d.ts +4 -0
- package/dist/src/components/external-packages/uri-template.d.ts.map +1 -0
- package/dist/src/components/external-packages/uri-template.js +11 -0
- package/dist/src/components/external-packages/uri-template.js.map +1 -0
- package/dist/src/components/http-request-options.d.ts +25 -0
- package/dist/src/components/http-request-options.d.ts.map +1 -0
- package/dist/src/components/http-request-options.js +74 -0
- package/dist/src/components/http-request-options.js.map +1 -0
- package/dist/src/components/http-request-parameters-expression.d.ts +10 -0
- package/dist/src/components/http-request-parameters-expression.d.ts.map +1 -0
- package/dist/src/components/http-request-parameters-expression.js +62 -0
- package/dist/src/components/http-request-parameters-expression.js.map +1 -0
- package/dist/src/components/http-request.d.ts +16 -0
- package/dist/src/components/http-request.d.ts.map +1 -0
- package/dist/src/components/http-request.js +70 -0
- package/dist/src/components/http-request.js.map +1 -0
- package/dist/src/components/http-response.d.ts +14 -0
- package/dist/src/components/http-response.d.ts.map +1 -0
- package/dist/src/components/http-response.js +61 -0
- package/dist/src/components/http-response.js.map +1 -0
- package/dist/src/components/models.d.ts +5 -0
- package/dist/src/components/models.d.ts.map +1 -0
- package/dist/src/components/models.js +41 -0
- package/dist/src/components/models.js.map +1 -0
- package/dist/src/components/operation-options.d.ts +8 -0
- package/dist/src/components/operation-options.d.ts.map +1 -0
- package/dist/src/components/operation-options.js +41 -0
- package/dist/src/components/operation-options.js.map +1 -0
- package/dist/src/components/operation-parameters.d.ts +9 -0
- package/dist/src/components/operation-parameters.d.ts.map +1 -0
- package/dist/src/components/operation-parameters.js +33 -0
- package/dist/src/components/operation-parameters.js.map +1 -0
- package/dist/src/components/output.d.ts +6 -0
- package/dist/src/components/output.d.ts.map +1 -0
- package/dist/src/components/output.js +35 -0
- package/dist/src/components/output.js.map +1 -0
- package/dist/src/components/serializers.d.ts +5 -0
- package/dist/src/components/serializers.d.ts.map +1 -0
- package/dist/src/components/serializers.js +43 -0
- package/dist/src/components/serializers.js.map +1 -0
- package/dist/src/components/static-helpers/bytes-encoding.d.ts +6 -0
- package/dist/src/components/static-helpers/bytes-encoding.d.ts.map +1 -0
- package/dist/src/components/static-helpers/bytes-encoding.js +68 -0
- package/dist/src/components/static-helpers/bytes-encoding.js.map +1 -0
- package/dist/src/components/static-helpers/interfaces.d.ts +5 -0
- package/dist/src/components/static-helpers/interfaces.d.ts.map +1 -0
- package/dist/src/components/static-helpers/interfaces.js +41 -0
- package/dist/src/components/static-helpers/interfaces.js.map +1 -0
- package/dist/src/components/static-helpers/multipart-helpers.d.ts +8 -0
- package/dist/src/components/static-helpers/multipart-helpers.d.ts.map +1 -0
- package/dist/src/components/static-helpers/multipart-helpers.js +83 -0
- package/dist/src/components/static-helpers/multipart-helpers.js.map +1 -0
- package/dist/src/components/static-helpers/rest-error.d.ts +5 -0
- package/dist/src/components/static-helpers/rest-error.d.ts.map +1 -0
- package/dist/src/components/static-helpers/rest-error.js +127 -0
- package/dist/src/components/static-helpers/rest-error.js.map +1 -0
- package/dist/src/components/testing/client-options.d.ts +8 -0
- package/dist/src/components/testing/client-options.d.ts.map +1 -0
- package/dist/src/components/testing/client-options.js +27 -0
- package/dist/src/components/testing/client-options.js.map +1 -0
- package/dist/src/components/transforms/content-type-encoding-provider.d.ts +7 -0
- package/dist/src/components/transforms/content-type-encoding-provider.d.ts.map +1 -0
- package/dist/src/components/transforms/content-type-encoding-provider.js +25 -0
- package/dist/src/components/transforms/content-type-encoding-provider.js.map +1 -0
- package/dist/src/components/transforms/data-transform.d.ts +9 -0
- package/dist/src/components/transforms/data-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/data-transform.js +31 -0
- package/dist/src/components/transforms/data-transform.js.map +1 -0
- package/dist/src/components/transforms/json/json-array-transform.d.ts +15 -0
- package/dist/src/components/transforms/json/json-array-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/json/json-array-transform.js +71 -0
- package/dist/src/components/transforms/json/json-array-transform.js.map +1 -0
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.d.ts +9 -0
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.js +35 -0
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.js.map +1 -0
- package/dist/src/components/transforms/json/json-model-base-transform.d.ts +9 -0
- package/dist/src/components/transforms/json/json-model-base-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/json/json-model-base-transform.js +13 -0
- package/dist/src/components/transforms/json/json-model-base-transform.js.map +1 -0
- package/dist/src/components/transforms/json/json-model-property-transform.d.ts +9 -0
- package/dist/src/components/transforms/json/json-model-property-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/json/json-model-property-transform.js +44 -0
- package/dist/src/components/transforms/json/json-model-property-transform.js.map +1 -0
- package/dist/src/components/transforms/json/json-model-transform.d.ts +15 -0
- package/dist/src/components/transforms/json/json-model-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/json/json-model-transform.js +96 -0
- package/dist/src/components/transforms/json/json-model-transform.js.map +1 -0
- package/dist/src/components/transforms/json/json-record-transform.d.ts +15 -0
- package/dist/src/components/transforms/json/json-record-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/json/json-record-transform.js +71 -0
- package/dist/src/components/transforms/json/json-record-transform.js.map +1 -0
- package/dist/src/components/transforms/json/json-transform-discriminator.d.ts +16 -0
- package/dist/src/components/transforms/json/json-transform-discriminator.d.ts.map +1 -0
- package/dist/src/components/transforms/json/json-transform-discriminator.js +82 -0
- package/dist/src/components/transforms/json/json-transform-discriminator.js.map +1 -0
- package/dist/src/components/transforms/json/json-transform.d.ts +14 -0
- package/dist/src/components/transforms/json/json-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/json/json-transform.js +149 -0
- package/dist/src/components/transforms/json/json-transform.js.map +1 -0
- package/dist/src/components/transforms/json/union-transform.d.ts +15 -0
- package/dist/src/components/transforms/json/union-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/json/union-transform.js +67 -0
- package/dist/src/components/transforms/json/union-transform.js.map +1 -0
- package/dist/src/components/transforms/json/utils/transport-namer.d.ts +3 -0
- package/dist/src/components/transforms/json/utils/transport-namer.d.ts.map +1 -0
- package/dist/src/components/transforms/json/utils/transport-namer.js +13 -0
- package/dist/src/components/transforms/json/utils/transport-namer.js.map +1 -0
- package/dist/src/components/transforms/multipart/array-part-transform.d.ts +8 -0
- package/dist/src/components/transforms/multipart/array-part-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/multipart/array-part-transform.js +29 -0
- package/dist/src/components/transforms/multipart/array-part-transform.js.map +1 -0
- package/dist/src/components/transforms/multipart/file-part-transform.d.ts +8 -0
- package/dist/src/components/transforms/multipart/file-part-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/multipart/file-part-transform.js +40 -0
- package/dist/src/components/transforms/multipart/file-part-transform.js.map +1 -0
- package/dist/src/components/transforms/multipart/multipart-transform.d.ts +7 -0
- package/dist/src/components/transforms/multipart/multipart-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/multipart/multipart-transform.js +26 -0
- package/dist/src/components/transforms/multipart/multipart-transform.js.map +1 -0
- package/dist/src/components/transforms/multipart/part-transform.d.ts +8 -0
- package/dist/src/components/transforms/multipart/part-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/multipart/part-transform.js +35 -0
- package/dist/src/components/transforms/multipart/part-transform.js.map +1 -0
- package/dist/src/components/transforms/multipart/simple-part-transform.d.ts +8 -0
- package/dist/src/components/transforms/multipart/simple-part-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/multipart/simple-part-transform.js +48 -0
- package/dist/src/components/transforms/multipart/simple-part-transform.js.map +1 -0
- package/dist/src/components/transforms/operation-transform-declaration.d.ts +17 -0
- package/dist/src/components/transforms/operation-transform-declaration.d.ts.map +1 -0
- package/dist/src/components/transforms/operation-transform-declaration.js +74 -0
- package/dist/src/components/transforms/operation-transform-declaration.js.map +1 -0
- package/dist/src/components/transforms/operation-transform-expression.d.ts +6 -0
- package/dist/src/components/transforms/operation-transform-expression.d.ts.map +1 -0
- package/dist/src/components/transforms/operation-transform-expression.js +60 -0
- package/dist/src/components/transforms/operation-transform-expression.js.map +1 -0
- package/dist/src/components/transforms/scalar-transform.d.ts +15 -0
- package/dist/src/components/transforms/scalar-transform.d.ts.map +1 -0
- package/dist/src/components/transforms/scalar-transform.js +317 -0
- package/dist/src/components/transforms/scalar-transform.js.map +1 -0
- package/dist/src/components/transforms/transform-name-policy.d.ts +71 -0
- package/dist/src/components/transforms/transform-name-policy.d.ts.map +1 -0
- package/dist/src/components/transforms/transform-name-policy.js +111 -0
- package/dist/src/components/transforms/transform-name-policy.js.map +1 -0
- package/dist/src/components/utils/unpack-model-property.d.ts +8 -0
- package/dist/src/components/utils/unpack-model-property.d.ts.map +1 -0
- package/dist/src/components/utils/unpack-model-property.js +33 -0
- package/dist/src/components/utils/unpack-model-property.js.map +1 -0
- package/dist/src/components/utils/url-template.d.ts +7 -0
- package/dist/src/components/utils/url-template.d.ts.map +1 -0
- package/dist/src/components/utils/url-template.js +23 -0
- package/dist/src/components/utils/url-template.js.map +1 -0
- package/dist/src/context/encoding/encoding-context.d.ts +6 -0
- package/dist/src/context/encoding/encoding-context.d.ts.map +1 -0
- package/dist/src/context/encoding/encoding-context.js +20 -0
- package/dist/src/context/encoding/encoding-context.js.map +1 -0
- package/dist/src/context/encoding/types.d.ts +6 -0
- package/dist/src/context/encoding/types.d.ts.map +1 -0
- package/dist/src/context/encoding/types.js +1 -0
- package/dist/src/context/encoding/types.js.map +1 -0
- package/dist/src/emitter.d.ts +8 -0
- package/dist/src/emitter.d.ts.map +1 -0
- package/dist/src/emitter.js +68 -0
- package/dist/src/emitter.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib.d.ts +206 -0
- package/dist/src/lib.d.ts.map +1 -0
- package/dist/src/lib.js +107 -0
- package/dist/src/lib.js.map +1 -0
- package/dist/src/testing/index.d.ts +3 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +8 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/utils/client-discovery.d.ts +7 -0
- package/dist/src/utils/client-discovery.d.ts.map +1 -0
- package/dist/src/utils/client-discovery.js +26 -0
- package/dist/src/utils/client-discovery.js.map +1 -0
- package/dist/src/utils/multipart.d.ts +3 -0
- package/dist/src/utils/multipart.d.ts.map +1 -0
- package/dist/src/utils/multipart.js +26 -0
- package/dist/src/utils/multipart.js.map +1 -0
- package/dist/src/utils/operations.d.ts +3 -0
- package/dist/src/utils/operations.d.ts.map +1 -0
- package/dist/src/utils/operations.js +11 -0
- package/dist/src/utils/operations.js.map +1 -0
- package/dist/src/utils/parameters.d.ts +14 -0
- package/dist/src/utils/parameters.d.ts.map +1 -0
- package/dist/src/utils/parameters.js +98 -0
- package/dist/src/utils/parameters.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/eng/scripts/calculate-coverage.js +36 -0
- package/eng/scripts/emit-e2e.js +329 -0
- package/eng/scripts/run-e2e-tests.js +162 -0
- package/eng/scripts/tspconfig.yaml +6 -0
- package/eng/scripts/upload-spector-results.js +120 -0
- package/package.json +83 -0
- package/src/components/client-context/client-context-declaration.tsx +19 -0
- package/src/components/client-context/client-context-factory.tsx +142 -0
- package/src/components/client-context/client-context-options.tsx +28 -0
- package/src/components/client-context/client-context.tsx +21 -0
- package/src/components/client-context/parametrized-endpoint.tsx +39 -0
- package/src/components/client-directory.tsx +40 -0
- package/src/components/client-operation.tsx +52 -0
- package/src/components/client.tsx +137 -0
- package/src/components/encoding-provider.tsx +19 -0
- package/src/components/external-packages/ts-http-runtime.ts +22 -0
- package/src/components/external-packages/uri-template.ts +11 -0
- package/src/components/http-request-options.tsx +69 -0
- package/src/components/http-request-parameters-expression.tsx +69 -0
- package/src/components/http-request.tsx +58 -0
- package/src/components/http-response.tsx +68 -0
- package/src/components/models.tsx +29 -0
- package/src/components/operation-options.tsx +26 -0
- package/src/components/operation-parameters.tsx +43 -0
- package/src/components/output.tsx +26 -0
- package/src/components/serializers.tsx +47 -0
- package/src/components/static-helpers/bytes-encoding.tsx +41 -0
- package/src/components/static-helpers/interfaces.tsx +26 -0
- package/src/components/static-helpers/multipart-helpers.tsx +59 -0
- package/src/components/static-helpers/rest-error.tsx +61 -0
- package/src/components/testing/client-options.tsx +32 -0
- package/src/components/transforms/content-type-encoding-provider.tsx +28 -0
- package/src/components/transforms/data-transform.tsx +39 -0
- package/src/components/transforms/json/json-array-transform.tsx +83 -0
- package/src/components/transforms/json/json-model-additional-properties-transform.tsx +47 -0
- package/src/components/transforms/json/json-model-base-transform.tsx +19 -0
- package/src/components/transforms/json/json-model-property-transform.tsx +41 -0
- package/src/components/transforms/json/json-model-transform.tsx +87 -0
- package/src/components/transforms/json/json-record-transform.tsx +84 -0
- package/src/components/transforms/json/json-transform-discriminator.tsx +114 -0
- package/src/components/transforms/json/json-transform.tsx +113 -0
- package/src/components/transforms/json/union-transform.tsx +73 -0
- package/src/components/transforms/json/utils/transport-namer.ts +12 -0
- package/src/components/transforms/multipart/array-part-transform.tsx +40 -0
- package/src/components/transforms/multipart/file-part-transform.tsx +44 -0
- package/src/components/transforms/multipart/multipart-transform.tsx +32 -0
- package/src/components/transforms/multipart/part-transform.tsx +22 -0
- package/src/components/transforms/multipart/simple-part-transform.tsx +49 -0
- package/src/components/transforms/operation-transform-declaration.tsx +64 -0
- package/src/components/transforms/operation-transform-expression.tsx +54 -0
- package/src/components/transforms/scalar-transform.tsx +289 -0
- package/src/components/transforms/transform-name-policy.ts +133 -0
- package/src/components/utils/unpack-model-property.ts +31 -0
- package/src/components/utils/url-template.tsx +21 -0
- package/src/context/encoding/encoding-context.tsx +26 -0
- package/src/context/encoding/types.ts +6 -0
- package/src/emitter.tsx +53 -0
- package/src/index.ts +5 -0
- package/src/lib.ts +108 -0
- package/src/testing/index.ts +8 -0
- package/src/utils/client-discovery.ts +28 -0
- package/src/utils/multipart.ts +28 -0
- package/src/utils/operations.ts +14 -0
- package/src/utils/parameters.tsx +129 -0
- package/test/e2e/assets/image.jpg +0 -0
- package/test/e2e/assets/image.png +0 -0
- package/test/e2e/http/authentication/api-key/main.test.ts +38 -0
- package/test/e2e/http/authentication/oauth2/main.test.ts +41 -0
- package/test/e2e/http/authentication/union/main.test.ts +29 -0
- package/test/e2e/http/encode/bytes/main.test.ts +191 -0
- package/test/e2e/http/encode/datetime/main.test.ts +176 -0
- package/test/e2e/http/encode/duration/main.test.ts +126 -0
- package/test/e2e/http/encode/numeric/main.test.ts +26 -0
- package/test/e2e/http/parameters/basic/main.test.ts +35 -0
- package/test/e2e/http/parameters/body-optionality/main.test.ts +43 -0
- package/test/e2e/http/parameters/collection-format/main.test.ts +45 -0
- package/test/e2e/http/parameters/spread/main.test.ts +56 -0
- package/test/e2e/http/payload/content-negotiation/main.test.ts +40 -0
- package/test/e2e/http/payload/json-merge-patch/main.test.ts +122 -0
- package/test/e2e/http/payload/media-type/main.test.ts +28 -0
- package/test/e2e/http/payload/multipart/main.test.ts +164 -0
- package/test/e2e/http/payload/pageable/main.test.ts +24 -0
- package/test/e2e/http/payload/xml/main.test.ts +287 -0
- package/test/e2e/http/routes/main.test.ts +284 -0
- package/test/e2e/http/serialization/encoded-name/json/main.test.ts +20 -0
- package/test/e2e/http/server/endpoint/not-defined/main.test.ts +11 -0
- package/test/e2e/http/server/path/multiple/main.test.ts +22 -0
- package/test/e2e/http/server/path/single/main.test.ts +11 -0
- package/test/e2e/http/server/versions/not-versioned/main.test.ts +22 -0
- package/test/e2e/http/server/versions/versioned/main.test.ts +28 -0
- package/test/e2e/http/special-headers/conditional-request/main.test.ts +35 -0
- package/test/e2e/http/special-headers/repeatability/main.test.ts +18 -0
- package/test/e2e/http/special-words/main.test.ts +434 -0
- package/test/e2e/http/type/array/array.test.ts +256 -0
- package/test/e2e/http/type/dictionary/main.test.ts +229 -0
- package/test/e2e/http/type/enum/extensible/main.test.ts +34 -0
- package/test/e2e/http/type/enum/fixed/main.test.ts +29 -0
- package/test/e2e/http/type/model/empty/main.test.ts +21 -0
- package/test/e2e/http/type/model/inheritance/enum-discriminator/main.test.ts +51 -0
- package/test/e2e/http/type/model/inheritance/nested-discriminator/main.test.ts +168 -0
- package/test/e2e/http/type/model/inheritance/not-discriminated/main.test.ts +42 -0
- package/test/e2e/http/type/model/inheritance/recursive/main.test.ts +46 -0
- package/test/e2e/http/type/model/inheritance/single-discriminator/main.test.ts +101 -0
- package/test/e2e/http/type/model/visibility/main.test.ts +64 -0
- package/test/e2e/http/type/property/additional-properties/main.test.ts +185 -0
- package/test/e2e/http/type/property/additional-properties/spreads.test.ts +470 -0
- package/test/e2e/http/type/property/nullable/main.test.ts +275 -0
- package/test/e2e/http/type/property/optionality/main.test.ts +256 -0
- package/test/e2e/http/type/property/value-types/main.test.ts +193 -0
- package/test/e2e/http/type/scalar/main.test.ts +133 -0
- package/test/e2e/http/type/scalar/scalar.test.ts +95 -0
- package/test/e2e/http/type/union/main.test.ts +207 -0
- package/test/e2e/http/versioning/added/main.test.ts +61 -0
- package/test/e2e/http/versioning/madeOptional/main.test.ts +34 -0
- package/test/e2e/http/versioning/removed/main.test.ts +75 -0
- package/test/e2e/http/versioning/renamedFrom/main.test.ts +52 -0
- package/test/e2e/http/versioning/returnTypeChangedFrom/main.test.ts +22 -0
- package/test/e2e/http/versioning/typeChangedFrom/main.test.ts +31 -0
- package/test/scenarios/additional-properties/extends.md +71 -0
- package/test/scenarios/additional-properties/is.md +46 -0
- package/test/scenarios/additional-properties/spread.md +72 -0
- package/test/scenarios/auth/basic_auth.md +67 -0
- package/test/scenarios/auth/bearer.md +67 -0
- package/test/scenarios/auth/client_parameters.md +68 -0
- package/test/scenarios/auth/client_structure.md +38 -0
- package/test/scenarios/auth/key_credential.md +67 -0
- package/test/scenarios/auth/sub_client_override.md +114 -0
- package/test/scenarios/client/client_context.md +36 -0
- package/test/scenarios/client/dotted_namespace.md +30 -0
- package/test/scenarios/client/global_namespace.md +74 -0
- package/test/scenarios/client/multiple_top_level_clients.md +74 -0
- package/test/scenarios/client/nested_client.md +106 -0
- package/test/scenarios/client/wrapping_namespace.md +43 -0
- package/test/scenarios/encoding/bytes_body.md +48 -0
- package/test/scenarios/encoding/bytes_json_property.md +60 -0
- package/test/scenarios/encoding/bytes_nullable.md +153 -0
- package/test/scenarios/encoding/header_bytes.md +142 -0
- package/test/scenarios/encoding/header_date.md +236 -0
- package/test/scenarios/encoding/model_with_bytes_property.md +50 -0
- package/test/scenarios/encoding/query_bytes.md +46 -0
- package/test/scenarios/encoding/query_date.md +236 -0
- package/test/scenarios/http-operations/basic-request.md +162 -0
- package/test/scenarios/http-operations/basic-response.md +246 -0
- package/test/scenarios/http-operations/basic.md +134 -0
- package/test/scenarios/http-operations/constant-header.md +37 -0
- package/test/scenarios/http-operations/create-operation.md +62 -0
- package/test/scenarios/http-operations/on_response.md +56 -0
- package/test/scenarios/http-operations/optional-request-body.md +55 -0
- package/test/scenarios/http-operations/path-parameter-in-model.md +59 -0
- package/test/scenarios/http-operations/path-parameter.md +54 -0
- package/test/scenarios/http-operations/scalar-payload.md +63 -0
- package/test/scenarios/http-operations/with-parameters.md +85 -0
- package/test/scenarios/models/array-properties.md +47 -0
- package/test/scenarios/models/basic.md +118 -0
- package/test/scenarios/models/dictionary-properties.md +44 -0
- package/test/scenarios/models/inheritance_2_discriminators.md +370 -0
- package/test/scenarios/models/inheritance_discriminator.md +92 -0
- package/test/scenarios/models/inline-models.md +29 -0
- package/test/scenarios/models/model_additional_properties.md +79 -0
- package/test/scenarios/models/model_extends.md +101 -0
- package/test/scenarios/models/model_spread.md +65 -0
- package/test/scenarios/models/nested_property.md +45 -0
- package/test/scenarios/models/property_references_property.md +156 -0
- package/test/scenarios/multipart/anonymous_part.md +57 -0
- package/test/scenarios/multipart/file.md +166 -0
- package/test/scenarios/multipart/file_content_type.md +67 -0
- package/test/scenarios/multipart/simple_part.md +69 -0
- package/test/scenarios/operation-parameters/body_root_anonymous.md +92 -0
- package/test/scenarios/operation-parameters/constant_as_optional.md +59 -0
- package/test/scenarios/operation-parameters/default_value_as_optional.md +59 -0
- package/test/scenarios/operation-parameters/no_content_type.md +67 -0
- package/test/scenarios/operation-parameters/no_parameters.md +55 -0
- package/test/scenarios/operation-parameters/only_optional.md +67 -0
- package/test/scenarios/operation-parameters/only_required.md +63 -0
- package/test/scenarios/operation-parameters/reserved_names.md +65 -0
- package/test/scenarios/operation-parameters/spread_body.md +75 -0
- package/test/scenarios/operation-parameters/spread_with_nested.md +87 -0
- package/test/scenarios/operation-parameters/union_body.md +92 -0
- package/test/scenarios/operation-parameters/with_body_property.md +72 -0
- package/test/scenarios/operation-parameters/with_body_root.md +74 -0
- package/test/scenarios/serializers/arrays.md +199 -0
- package/test/scenarios/serializers/basic_model.md +115 -0
- package/test/scenarios/serializers/basic_model_wire_name.md +50 -0
- package/test/scenarios/serializers/discriminated_union.md +86 -0
- package/test/scenarios/serializers/discriminated_union_spread.md +119 -0
- package/test/scenarios/serializers/model_date_time.md +65 -0
- package/test/scenarios/serializers/multipart.md +66 -0
- package/test/scenarios/serializers/polymorphic_single_level_inheritance.md +164 -0
- package/test/scenarios/serializers/record.md +101 -0
- package/test/scenarios/serializers/scalars.md +33 -0
- package/test/scenarios/serializers/spread.md +75 -0
- package/test/scenarios/serializers/string_union.md +61 -0
- package/test/scenarios/server/default_url.md +45 -0
- package/test/scenarios/server/multiple-parameters.md +57 -0
- package/test/scenarios/server/no-server.md +37 -0
- package/test/scenarios/server/parametrized-endpoint.md +53 -0
- package/test/scenarios.test.ts +18 -0
- package/test/test-host.ts +76 -0
- package/tsconfig.json +16 -0
- package/tsconfig.test.json +7 -0
- package/vitest.config.js +23 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import * as ay from "@alloy-js/core";
|
|
4
|
+
import * as ts from "@alloy-js/typescript";
|
|
5
|
+
import { httpRuntimeTemplateLib } from "../external-packages/ts-http-runtime.js";
|
|
6
|
+
export function getRestErrorRefkey() {
|
|
7
|
+
return ay.refkey("rest-error", "static-helpers", "class");
|
|
8
|
+
}
|
|
9
|
+
export function getCreateRestErrorRefkey() {
|
|
10
|
+
return ay.refkey("create-rest-error", "static-helpers", "function");
|
|
11
|
+
}
|
|
12
|
+
export function RestError() {
|
|
13
|
+
const requestRefkey = ay.refkey("request", "rest-error-class-field");
|
|
14
|
+
const responseRefkey = ay.refkey("response", "rest-error-class-field");
|
|
15
|
+
const statusRefkey = ay.refkey("status", "rest-error-class-field");
|
|
16
|
+
const bodyRefkey = ay.refkey("body", "rest-error-class-field");
|
|
17
|
+
const headersRefkey = ay.refkey("headers", "rest-error-class-field");
|
|
18
|
+
const constructorRefkey = ay.refkey("constructor", "rest-error-class-method");
|
|
19
|
+
const fromHttpResponseRefkey = ay.refkey("from-http-response", "rest-error-class-method");
|
|
20
|
+
const restErrorClass = _$createComponent(ts.ClassDeclaration, {
|
|
21
|
+
"export": true,
|
|
22
|
+
name: "RestError",
|
|
23
|
+
"extends": "Error",
|
|
24
|
+
get refkey() {
|
|
25
|
+
return getRestErrorRefkey();
|
|
26
|
+
},
|
|
27
|
+
get children() {
|
|
28
|
+
return [_$createComponent(ts.ClassField, {
|
|
29
|
+
"public": true,
|
|
30
|
+
name: "request",
|
|
31
|
+
get type() {
|
|
32
|
+
return httpRuntimeTemplateLib.PipelineRequest;
|
|
33
|
+
},
|
|
34
|
+
refkey: requestRefkey
|
|
35
|
+
}), "\n", _$createComponent(ts.ClassField, {
|
|
36
|
+
"public": true,
|
|
37
|
+
name: "response",
|
|
38
|
+
get type() {
|
|
39
|
+
return httpRuntimeTemplateLib.HttpResponse;
|
|
40
|
+
},
|
|
41
|
+
refkey: responseRefkey
|
|
42
|
+
}), "\n", _$createComponent(ts.ClassField, {
|
|
43
|
+
"public": true,
|
|
44
|
+
name: "status",
|
|
45
|
+
type: "string",
|
|
46
|
+
refkey: statusRefkey
|
|
47
|
+
}), "\n", _$createComponent(ts.ClassField, {
|
|
48
|
+
"public": true,
|
|
49
|
+
name: "body",
|
|
50
|
+
type: "any",
|
|
51
|
+
refkey: bodyRefkey
|
|
52
|
+
}), "\n", _$createComponent(ts.ClassField, {
|
|
53
|
+
"public": true,
|
|
54
|
+
name: "headers",
|
|
55
|
+
get type() {
|
|
56
|
+
return httpRuntimeTemplateLib.RawHttpHeaders;
|
|
57
|
+
},
|
|
58
|
+
refkey: headersRefkey
|
|
59
|
+
}), "\n\n", _$createComponent(ts.ClassMethod, {
|
|
60
|
+
name: "constructor",
|
|
61
|
+
get parameters() {
|
|
62
|
+
return {
|
|
63
|
+
message: "string",
|
|
64
|
+
response: httpRuntimeTemplateLib.HttpResponse
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
returnType: null,
|
|
68
|
+
refkey: constructorRefkey,
|
|
69
|
+
get children() {
|
|
70
|
+
return ay.code`
|
|
71
|
+
// Create an error message that includes relevant details.
|
|
72
|
+
super(\`$\{message\} - HTTP $\{response.status} received for $\{response.request.method} $\{response.request.url}\`);
|
|
73
|
+
this.name = 'RestError';
|
|
74
|
+
this.request = response.request;
|
|
75
|
+
this.response = response;
|
|
76
|
+
this.status = response.status;
|
|
77
|
+
this.headers = response.headers;
|
|
78
|
+
this.body = response.body;
|
|
79
|
+
|
|
80
|
+
// Set the prototype explicitly.
|
|
81
|
+
Object.setPrototypeOf(this, RestError.prototype);
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
}), "\n", _$createComponent(ts.ClassMethod, {
|
|
85
|
+
"static": true,
|
|
86
|
+
name: "fromHttpResponse",
|
|
87
|
+
get parameters() {
|
|
88
|
+
return {
|
|
89
|
+
response: httpRuntimeTemplateLib.HttpResponse
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
get returnType() {
|
|
93
|
+
return getRestErrorRefkey();
|
|
94
|
+
},
|
|
95
|
+
refkey: fromHttpResponseRefkey,
|
|
96
|
+
get children() {
|
|
97
|
+
return ay.code`
|
|
98
|
+
const defaultMessage = \`Unexpected HTTP status code: $\{response.status}\`;
|
|
99
|
+
return new RestError(defaultMessage, response);
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
})];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const createRestError = _$createComponent(ts.FunctionDeclaration, {
|
|
106
|
+
"export": true,
|
|
107
|
+
name: "createRestError",
|
|
108
|
+
get parameters() {
|
|
109
|
+
return {
|
|
110
|
+
response: httpRuntimeTemplateLib.HttpResponse
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
get returnType() {
|
|
114
|
+
return getRestErrorRefkey();
|
|
115
|
+
},
|
|
116
|
+
get refkey() {
|
|
117
|
+
return getCreateRestErrorRefkey();
|
|
118
|
+
},
|
|
119
|
+
get children() {
|
|
120
|
+
return ay.code`
|
|
121
|
+
return ${fromHttpResponseRefkey}(response);
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return [restErrorClass, "\n\n", createRestError];
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=rest-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest-error.js","names":["ay","ts","httpRuntimeTemplateLib","getRestErrorRefkey","refkey","getCreateRestErrorRefkey","RestError","requestRefkey","responseRefkey","statusRefkey","bodyRefkey","headersRefkey","constructorRefkey","fromHttpResponseRefkey","restErrorClass","_$createComponent","ClassDeclaration","name","children","ClassField","type","PipelineRequest","HttpResponse","RawHttpHeaders","ClassMethod","parameters","message","response","returnType","code","createRestError","FunctionDeclaration"],"sources":["../../../../src/components/static-helpers/rest-error.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAC1C,SAASC,sBAAsB,QAAQ,yCAAyC;AAEhF,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACnC,OAAOH,EAAE,CAACI,MAAM,CAAC,YAAY,EAAE,gBAAgB,EAAE,OAAO,CAAC;AAC3D;AAEA,OAAO,SAASC,wBAAwBA,CAAA,EAAG;EACzC,OAAOL,EAAE,CAACI,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,EAAE,UAAU,CAAC;AACrE;AAEA,OAAO,SAASE,SAASA,CAAA,EAAG;EAC1B,MAAMC,aAAa,GAAGP,EAAE,CAACI,MAAM,CAAC,SAAS,EAAE,wBAAwB,CAAC;EACpE,MAAMI,cAAc,GAAGR,EAAE,CAACI,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC;EACtE,MAAMK,YAAY,GAAGT,EAAE,CAACI,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC;EAClE,MAAMM,UAAU,GAAGV,EAAE,CAACI,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC;EAC9D,MAAMO,aAAa,GAAGX,EAAE,CAACI,MAAM,CAAC,SAAS,EAAE,wBAAwB,CAAC;EACpE,MAAMQ,iBAAiB,GAAGZ,EAAE,CAACI,MAAM,CAAC,aAAa,EAAE,yBAAyB,CAAC;EAC7E,MAAMS,sBAAsB,GAAGb,EAAE,CAACI,MAAM,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;EAEzF,MAAMU,cAAc,GAAAC,iBAAA,CACjBd,EAAE,CAACe,gBAAgB;IAAA;IAAQC,IAAI;IAAA;IAAA,IAA6Bb,MAAMA,CAAA;MAAA,OAAED,kBAAkB,CAAC,CAAC;IAAA;IAAA,IAAAe,SAAA;MAAA,QAAAH,iBAAA,CACtFd,EAAE,CAACkB,UAAU;QAAA;QAAQF,IAAI;QAAA,IAAWG,IAAIA,CAAA;UAAA,OAAElB,sBAAsB,CAACmB,eAAe;QAAA;QAAEjB,MAAM,EAAEG;MAAa,UAAAQ,iBAAA,CACvGd,EAAE,CAACkB,UAAU;QAAA;QAAQF,IAAI;QAAA,IAAYG,IAAIA,CAAA;UAAA,OAAElB,sBAAsB,CAACoB,YAAY;QAAA;QAAElB,MAAM,EAAEI;MAAc,UAAAO,iBAAA,CACtGd,EAAE,CAACkB,UAAU;QAAA;QAAQF,IAAI;QAAUG,IAAI;QAAUhB,MAAM,EAAEK;MAAY,UAAAM,iBAAA,CACrEd,EAAE,CAACkB,UAAU;QAAA;QAAQF,IAAI;QAAQG,IAAI;QAAOhB,MAAM,EAAEM;MAAU,UAAAK,iBAAA,CAC9Dd,EAAE,CAACkB,UAAU;QAAA;QAAQF,IAAI;QAAA,IAAWG,IAAIA,CAAA;UAAA,OAAElB,sBAAsB,CAACqB,cAAc;QAAA;QAAEnB,MAAM,EAAEO;MAAa,YAAAI,iBAAA,CAEtGd,EAAE,CAACuB,WAAW;QAACP,IAAI;QAAA,IAAeQ,UAAUA,CAAA;UAAA,OAAE;YAACC,OAAO,EAAE,QAAQ;YAAEC,QAAQ,EAAEzB,sBAAsB,CAACoB;UAAY,CAAC;QAAA;QAAEM,UAAU,EAAE,IAAI;QAAExB,MAAM,EAAEQ,iBAAiB;QAAA,IAAAM,SAAA;UAAA,OAC3JlB,EAAE,CAAC6B,IAAI;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;QAAA;MAAA,UAAAd,iBAAA,CAEFd,EAAE,CAACuB,WAAW;QAAA;QAAQP,IAAI;QAAA,IAAoBQ,UAAUA,CAAA;UAAA,OAAE;YAACE,QAAQ,EAAEzB,sBAAsB,CAACoB;UAAY,CAAC;QAAA;QAAA,IAAEM,UAAUA,CAAA;UAAA,OAAEzB,kBAAkB,CAAC,CAAC;QAAA;QAAEC,MAAM,EAAES,sBAAsB;QAAA,IAAAK,SAAA;UAAA,OACzKlB,EAAE,CAAC6B,IAAI;AAChB;AACA;AACA,SAAS;QAAA;MAAA;IAAA;EAAA,EAEiB;EAExB,MAAMC,eAAe,GAAAf,iBAAA,CAClBd,EAAE,CAAC8B,mBAAmB;IAAA;IAAQd,IAAI;IAAA,IAAmBQ,UAAUA,CAAA;MAAA,OAAE;QAACE,QAAQ,EAAEzB,sBAAsB,CAACoB;MAAY,CAAC;IAAA;IAAA,IAAEM,UAAUA,CAAA;MAAA,OAAEzB,kBAAkB,CAAC,CAAC;IAAA;IAAA,IAAEC,MAAMA,CAAA;MAAA,OAAEC,wBAAwB,CAAC,CAAC;IAAA;IAAA,IAAAa,SAAA;MAAA,OACtLlB,EAAE,CAAC6B,IAAI;AACZ,eAAehB,sBAAsB;AACrC,KAAK;IAAA;EAAA,EACsB;EAEzB,OAAO,CAACC,cAAc,EAAE,MAAM,EAAEgB,eAAe,CAAC;AAClD","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
export interface ClientTestOptions {
|
|
3
|
+
}
|
|
4
|
+
export declare function ClientTestOptions(_props: ClientTestOptions): ay.Child[] | null;
|
|
5
|
+
export declare function addClientTestOptions(options: ay.Children[], settings?: {
|
|
6
|
+
location?: "front" | "back";
|
|
7
|
+
}): void;
|
|
8
|
+
//# sourceMappingURL=client-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-options.d.ts","sourceRoot":"","sources":["../../../../src/components/testing/client-options.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAKrC,MAAM,WAAW,iBAAiB;CAAG;AAErC,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,qBAU1D;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,EAAE,CAAC,QAAQ,EAAE,EACtB,QAAQ,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAA0B,QAUlE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import * as ay from "@alloy-js/core";
|
|
3
|
+
import { config } from "dotenv";
|
|
4
|
+
config();
|
|
5
|
+
export function ClientTestOptions(_props) {
|
|
6
|
+
if (process.env.TYPESPEC_JS_EMITTER_TESTING !== "true") {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return ay.code`
|
|
10
|
+
allowInsecureConnection: true,
|
|
11
|
+
retryOptions: {
|
|
12
|
+
maxRetries: 1,
|
|
13
|
+
}`;
|
|
14
|
+
}
|
|
15
|
+
export function addClientTestOptions(options, settings = {
|
|
16
|
+
location: "front"
|
|
17
|
+
}) {
|
|
18
|
+
if (process.env.TYPESPEC_JS_EMITTER_TESTING === "true") {
|
|
19
|
+
const testOptions = _$createComponent(ClientTestOptions, {});
|
|
20
|
+
if (settings.location === "front") {
|
|
21
|
+
options.unshift(testOptions);
|
|
22
|
+
} else {
|
|
23
|
+
options.push(testOptions);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=client-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-options.js","names":["ay","config","ClientTestOptions","_props","process","env","TYPESPEC_JS_EMITTER_TESTING","code","addClientTestOptions","options","settings","location","testOptions","_$createComponent","unshift","push"],"sources":["../../../../src/components/testing/client-options.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,SAASC,MAAM,QAAQ,QAAQ;AAE/BA,MAAM,CAAC,CAAC;AAIR,OAAO,SAASC,iBAAiBA,CAACC,MAAyB,EAAE;EAC3D,IAAIC,OAAO,CAACC,GAAG,CAACC,2BAA2B,KAAK,MAAM,EAAE;IACtD,OAAO,IAAI;EACb;EAEA,OAAON,EAAE,CAACO,IAAI;AAChB;AACA;AACA;AACA,MAAM;AACN;AAEA,OAAO,SAASC,oBAAoBA,CAClCC,OAAsB,EACtBC,QAAyC,GAAG;EAAEC,QAAQ,EAAE;AAAQ,CAAC,EACjE;EACA,IAAIP,OAAO,CAACC,GAAG,CAACC,2BAA2B,KAAK,MAAM,EAAE;IACtD,MAAMM,WAAW,GAAAC,iBAAA,CAAIX,iBAAiB,KAAG;IACzC,IAAIQ,QAAQ,CAACC,QAAQ,KAAK,OAAO,EAAE;MACjCF,OAAO,CAACK,OAAO,CAACF,WAAW,CAAC;IAC9B,CAAC,MAAM;MACLH,OAAO,CAACM,IAAI,CAACH,WAAW,CAAC;IAC3B;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
|
+
export interface ContentTypeEncodingProviderProps {
|
|
3
|
+
contentType?: string;
|
|
4
|
+
children?: Children;
|
|
5
|
+
}
|
|
6
|
+
export declare function ContentTypeEncodingProvider(props: ContentTypeEncodingProviderProps): Children;
|
|
7
|
+
//# sourceMappingURL=content-type-encoding-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-type-encoding-provider.d.ts","sourceRoot":"","sources":["../../../../src/components/transforms/content-type-encoding-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,MAAM,WAAW,gCAAgC;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gCAAgC,YAkBlF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { EncodingProvider } from "../encoding-provider.js";
|
|
4
|
+
export function ContentTypeEncodingProvider(props) {
|
|
5
|
+
const contentType = props.contentType ?? "application/json";
|
|
6
|
+
let defaults = {
|
|
7
|
+
bytes: "none",
|
|
8
|
+
datetime: "rfc3339"
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Follows the media type conventions from RFC 6838 section 4.2.8, which standardizes the +json suffix for JSON-structured syntaxes.
|
|
12
|
+
if (contentType?.includes("application/json") || contentType.trim()?.endsWith("+json")) {
|
|
13
|
+
defaults = {
|
|
14
|
+
bytes: "base64",
|
|
15
|
+
datetime: "rfc3339"
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return _$createComponent(EncodingProvider, {
|
|
19
|
+
defaults: defaults,
|
|
20
|
+
get children() {
|
|
21
|
+
return props.children;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=content-type-encoding-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-type-encoding-provider.js","names":["EncodingProvider","ContentTypeEncodingProvider","props","contentType","defaults","bytes","datetime","includes","trim","endsWith","_$createComponent","children"],"sources":["../../../../src/components/transforms/content-type-encoding-provider.tsx"],"sourcesContent":[null],"mappings":";;AAEA,SAASA,gBAAgB;AAOzB,OAAO,SAASC,2BAA2BA,CAACC,KAAuC,EAAE;EACnF,MAAMC,WAAW,GAAGD,KAAK,CAACC,WAAW,IAAI,kBAAkB;EAC3D,IAAIC,QAA0B,GAAG;IAC/BC,KAAK,EAAE,MAAM;IACbC,QAAQ,EAAE;EACZ,CAAC;;EAED;EACA,IAAIH,WAAW,EAAEI,QAAQ,CAAC,kBAAkB,CAAC,IAAIJ,WAAW,CAACK,IAAI,CAAC,CAAC,EAAEC,QAAQ,CAAC,OAAO,CAAC,EAAE;IACtFL,QAAQ,GAAG;MACTC,KAAK,EAAE,QAAQ;MACfC,QAAQ,EAAE;IACZ,CAAC;EACH;EAEA,OAAAI,iBAAA,CAAQV,gBAAgB;IAACI,QAAQ,EAAEA,QAAQ;IAAA,IAAAO,SAAA;MAAA,OACxCT,KAAK,CAACS,QAAQ;IAAA;EAAA;AAEnB","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Children, Refkey } from "@alloy-js/core";
|
|
2
|
+
import { ModelProperty, Scalar } from "@typespec/compiler";
|
|
3
|
+
export interface ScalarDataTransformProps {
|
|
4
|
+
itemRef: Refkey | Children;
|
|
5
|
+
type: Scalar | ModelProperty;
|
|
6
|
+
target: "transport" | "application";
|
|
7
|
+
}
|
|
8
|
+
export declare function ScalarDataTransform(props: ScalarDataTransformProps): Children;
|
|
9
|
+
//# sourceMappingURL=data-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../../src/components/transforms/data-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAc,aAAa,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAMvE,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,YAyBlE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
2
|
+
import { reportDiagnostic } from "../../lib.js";
|
|
3
|
+
import { unpackProperty } from "../utils/unpack-model-property.js";
|
|
4
|
+
import { getScalarTransformer } from "./scalar-transform.js";
|
|
5
|
+
export function ScalarDataTransform(props) {
|
|
6
|
+
let scalar;
|
|
7
|
+
let encoding;
|
|
8
|
+
if ($.modelProperty.is(props.type)) {
|
|
9
|
+
const valueType = unpackProperty(props.type);
|
|
10
|
+
if (!$.scalar.is(valueType)) {
|
|
11
|
+
reportDiagnostic($.program, {
|
|
12
|
+
code: "unexpected-non-scalar-type",
|
|
13
|
+
target: props.type
|
|
14
|
+
});
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
scalar = valueType;
|
|
18
|
+
encoding = $.modelProperty.getEncoding(props.type);
|
|
19
|
+
} else {
|
|
20
|
+
scalar = props.type;
|
|
21
|
+
encoding = $.scalar.getEncoding(scalar);
|
|
22
|
+
}
|
|
23
|
+
// const encoding = $.scalar.getEncoding(scalar);
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
toApplication,
|
|
27
|
+
toTransport
|
|
28
|
+
} = getScalarTransformer(scalar);
|
|
29
|
+
return props.target === "transport" ? toTransport(props.itemRef, encoding) : toApplication(props.itemRef, encoding);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=data-transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-transform.js","names":["$","reportDiagnostic","unpackProperty","getScalarTransformer","ScalarDataTransform","props","scalar","encoding","modelProperty","is","type","valueType","program","code","target","getEncoding","toApplication","toTransport","itemRef"],"sources":["../../../../src/components/transforms/data-transform.tsx"],"sourcesContent":[null],"mappings":"AAEA,SAASA,CAAC,QAAQ,yCAAyC;AAC3D,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,cAAc,QAAQ,mCAAmC;AAClE,SAASC,oBAAoB;AAQ7B,OAAO,SAASC,mBAAmBA,CAACC,KAA+B,EAAE;EACnE,IAAIC,MAAc;EAClB,IAAIC,QAAgC;EACpC,IAAIP,CAAC,CAACQ,aAAa,CAACC,EAAE,CAACJ,KAAK,CAACK,IAAI,CAAC,EAAE;IAClC,MAAMC,SAAS,GAAGT,cAAc,CAACG,KAAK,CAACK,IAAI,CAAC;IAC5C,IAAI,CAACV,CAAC,CAACM,MAAM,CAACG,EAAE,CAACE,SAAS,CAAC,EAAE;MAC3BV,gBAAgB,CAACD,CAAC,CAACY,OAAO,EAAE;QAC1BC,IAAI,EAAE,4BAA4B;QAClCC,MAAM,EAAET,KAAK,CAACK;MAChB,CAAC,CAAC;MACF,OAAO,IAAI;IACb;IACAJ,MAAM,GAAGK,SAAS;IAClBJ,QAAQ,GAAGP,CAAC,CAACQ,aAAa,CAACO,WAAW,CAACV,KAAK,CAACK,IAAI,CAAC;EACpD,CAAC,MAAM;IACLJ,MAAM,GAAGD,KAAK,CAACK,IAAI;IACnBH,QAAQ,GAAGP,CAAC,CAACM,MAAM,CAACS,WAAW,CAACT,MAAM,CAAC;EACzC;EACA;;EAEA,MAAM;IAAEU,aAAa;IAAEC;EAAY,CAAC,GAAGd,oBAAoB,CAACG,MAAM,CAAC;EAEnE,OAAOD,KAAK,CAACS,MAAM,KAAK,WAAW,GAC/BG,WAAW,CAACZ,KAAK,CAACa,OAAO,EAAEX,QAAQ,CAAC,GACpCS,aAAa,CAACX,KAAK,CAACa,OAAO,EAAEX,QAAQ,CAAC;AAC5C","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { Model } from "@typespec/compiler";
|
|
3
|
+
export interface JsonArrayTransformProps {
|
|
4
|
+
itemRef: ay.Refkey | ay.Children;
|
|
5
|
+
type: Model;
|
|
6
|
+
target: "transport" | "application";
|
|
7
|
+
}
|
|
8
|
+
export declare function JsonArrayTransform(props: JsonArrayTransformProps): ay.Child[] | null;
|
|
9
|
+
export declare function getJsonArrayTransformRefkey(type: Model, target: "transport" | "application"): ay.Refkey;
|
|
10
|
+
export interface JsonArrayTransformDeclarationProps {
|
|
11
|
+
type: Model;
|
|
12
|
+
target: "transport" | "application";
|
|
13
|
+
}
|
|
14
|
+
export declare function JsonArrayTransformDeclaration(props: JsonArrayTransformDeclarationProps): ay.Children;
|
|
15
|
+
//# sourceMappingURL=json-array-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-array-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-array-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,qBAoBhE;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,WAAW,GAAG,aAAa,GAClC,EAAE,CAAC,MAAM,CAEX;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,kCAAkC,eAkCtF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import * as ay from "@alloy-js/core";
|
|
4
|
+
import * as ts from "@alloy-js/typescript";
|
|
5
|
+
import * as ef from "@typespec/emitter-framework/typescript";
|
|
6
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
7
|
+
import { JsonTransform } from "./json-transform.js";
|
|
8
|
+
export function JsonArrayTransform(props) {
|
|
9
|
+
if (!$.array.is(props.type)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const elementType = $.array.getElementType(props.type);
|
|
13
|
+
return ay.code`
|
|
14
|
+
if(!${props.itemRef}) {
|
|
15
|
+
return ${props.itemRef} as any;
|
|
16
|
+
}
|
|
17
|
+
const _transformedArray = [];
|
|
18
|
+
|
|
19
|
+
for (const item of ${props.itemRef} ?? []) {
|
|
20
|
+
const transformedItem = ${_$createComponent(JsonTransform, {
|
|
21
|
+
type: elementType,
|
|
22
|
+
get target() {
|
|
23
|
+
return props.target;
|
|
24
|
+
},
|
|
25
|
+
itemRef: "item as any"
|
|
26
|
+
})};
|
|
27
|
+
_transformedArray.push(transformedItem);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return _transformedArray as any;
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
export function getJsonArrayTransformRefkey(type, target) {
|
|
34
|
+
return ay.refkey(type, "json_array_transform", target);
|
|
35
|
+
}
|
|
36
|
+
export function JsonArrayTransformDeclaration(props) {
|
|
37
|
+
if (!$.array.is(props.type)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const elementType = $.array.getElementType(props.type);
|
|
41
|
+
const elementName = "name" in elementType && typeof elementType.name === "string" ? elementType.name : "element";
|
|
42
|
+
const namePolicy = ts.useTSNamePolicy();
|
|
43
|
+
const transformName = namePolicy.getName(`json_Array_${elementName}_to_${props.target}_transform`, "function");
|
|
44
|
+
const itemType = ay.code`Array<${_$createComponent(ef.TypeExpression, {
|
|
45
|
+
type: elementType
|
|
46
|
+
})}>`;
|
|
47
|
+
const returnType = props.target === "transport" ? "any" : itemType;
|
|
48
|
+
const inputType = props.target === "transport" ? [itemType, " | null"] : "any";
|
|
49
|
+
const inputRef = ay.refkey();
|
|
50
|
+
const parameters = {
|
|
51
|
+
items_: {
|
|
52
|
+
type: inputType,
|
|
53
|
+
refkey: inputRef,
|
|
54
|
+
optional: true
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const declarationRefkey = getJsonArrayTransformRefkey(props.type, props.target);
|
|
58
|
+
return _$createComponent(ts.FunctionDeclaration, {
|
|
59
|
+
name: transformName,
|
|
60
|
+
"export": true,
|
|
61
|
+
returnType: returnType,
|
|
62
|
+
parameters: parameters,
|
|
63
|
+
refkey: declarationRefkey,
|
|
64
|
+
get children() {
|
|
65
|
+
return _$createComponent(JsonArrayTransform, _$mergeProps(props, {
|
|
66
|
+
itemRef: inputRef
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=json-array-transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-array-transform.js","names":["ay","ts","ef","$","JsonTransform","JsonArrayTransform","props","array","is","type","elementType","getElementType","code","itemRef","_$createComponent","target","getJsonArrayTransformRefkey","refkey","JsonArrayTransformDeclaration","elementName","name","namePolicy","useTSNamePolicy","transformName","getName","itemType","TypeExpression","returnType","inputType","inputRef","parameters","items_","optional","declarationRefkey","FunctionDeclaration","children","_$mergeProps"],"sources":["../../../../../src/components/transforms/json/json-array-transform.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAC1C,OAAO,KAAKC,EAAE,MAAM,wCAAwC;AAG5D,SAASC,CAAC,QAAQ,yCAAyC;AAC3D,SAASC,aAAa;AAQtB,OAAO,SAASC,kBAAkBA,CAACC,KAA8B,EAAE;EACjE,IAAI,CAACH,CAAC,CAACI,KAAK,CAACC,EAAE,CAACF,KAAK,CAACG,IAAI,CAAC,EAAE;IAC3B,OAAO,IAAI;EACb;EAEA,MAAMC,WAAW,GAAGP,CAAC,CAACI,KAAK,CAACI,cAAc,CAACL,KAAK,CAACG,IAAI,CAAC;EAEtD,OAAOT,EAAE,CAACY,IAAI;AAChB,UAAUN,KAAK,CAACO,OAAO;AACvB,eAAeP,KAAK,CAACO,OAAO;AAC5B;AACA;AACA;AACA,yBAAyBP,KAAK,CAACO,OAAO;AACtC,gCADsCC,iBAAA,CACLV,aAAa;IAACK,IAAI,EAAEC,WAAW;IAAA,IAAEK,MAAMA,CAAA;MAAA,OAAET,KAAK,CAACS,MAAM;IAAA;IAAEF,OAAO;EAAA;AAC/F;AACA;AACA;AACA;AACA,GAAG;AACH;AAEA,OAAO,SAASG,2BAA2BA,CACzCP,IAAW,EACXM,MAAmC,EACxB;EACX,OAAOf,EAAE,CAACiB,MAAM,CAACR,IAAI,EAAE,sBAAsB,EAAEM,MAAM,CAAC;AACxD;AAOA,OAAO,SAASG,6BAA6BA,CAACZ,KAAyC,EAAE;EACvF,IAAI,CAACH,CAAC,CAACI,KAAK,CAACC,EAAE,CAACF,KAAK,CAACG,IAAI,CAAC,EAAE;IAC3B,OAAO,IAAI;EACb;EAEA,MAAMC,WAAW,GAAGP,CAAC,CAACI,KAAK,CAACI,cAAc,CAACL,KAAK,CAACG,IAAI,CAAC;EACtD,MAAMU,WAAW,GACf,MAAM,IAAIT,WAAW,IAAI,OAAOA,WAAW,CAACU,IAAI,KAAK,QAAQ,GAAGV,WAAW,CAACU,IAAI,GAAG,SAAS;EAE9F,MAAMC,UAAU,GAAGpB,EAAE,CAACqB,eAAe,CAAC,CAAC;EACvC,MAAMC,aAAa,GAAGF,UAAU,CAACG,OAAO,CACtC,cAAcL,WAAW,OAAOb,KAAK,CAACS,MAAM,YAAY,EACxD,UACF,CAAC;EAED,MAAMU,QAAQ,GAAGzB,EAAE,CAACY,IAAI,SAAAE,iBAAA,CAAUZ,EAAE,CAACwB,cAAc;IAACjB,IAAI,EAAEC;EAAW,KAAO;EAC5E,MAAMiB,UAAU,GAAGrB,KAAK,CAACS,MAAM,KAAK,WAAW,GAAG,KAAK,GAAGU,QAAQ;EAClE,MAAMG,SAAS,GAAGtB,KAAK,CAACS,MAAM,KAAK,WAAW,IAAMU,QAAQ,eAAc,KAAK;EAC/E,MAAMI,QAAQ,GAAG7B,EAAE,CAACiB,MAAM,CAAC,CAAC;EAE5B,MAAMa,UAAkD,GAAG;IACzDC,MAAM,EAAE;MAAEtB,IAAI,EAAEmB,SAAS;MAAEX,MAAM,EAAEY,QAAQ;MAAEG,QAAQ,EAAE;IAAK;EAC9D,CAAC;EAED,MAAMC,iBAAiB,GAAGjB,2BAA2B,CAACV,KAAK,CAACG,IAAI,EAAEH,KAAK,CAACS,MAAM,CAAC;EAC/E,OAAAD,iBAAA,CAAQb,EAAE,CAACiC,mBAAmB;IAC1Bd,IAAI,EAAEG,aAAa;IAAA;IAEnBI,UAAU,EAAEA,UAAU;IACtBG,UAAU,EAAEA,UAAU;IACtBb,MAAM,EAAEgB,iBAAiB;IAAA,IAAAE,SAAA;MAAA,OAAArB,iBAAA,CAExBT,kBAAkB,EAAA+B,YAAA,CAAK9B,KAAK;QAAEO,OAAO,EAAEgB;MAAQ;IAAA;EAAA;AAEtD","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { Model } from "@typespec/compiler";
|
|
3
|
+
export interface JsonAdditionalPropertiesTransformProps {
|
|
4
|
+
itemRef: ay.Children;
|
|
5
|
+
type: Model;
|
|
6
|
+
target: "transport" | "application";
|
|
7
|
+
}
|
|
8
|
+
export declare function JsonAdditionalPropertiesTransform(props: JsonAdditionalPropertiesTransformProps): ay.Children;
|
|
9
|
+
//# sourceMappingURL=json-model-additional-properties-transform.d.ts.map
|
package/dist/src/components/transforms/json/json-model-additional-properties-transform.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-model-additional-properties-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-additional-properties-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,WAAW,sCAAsC;IACrD,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,sCAAsC,eAkC9F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import * as ay from "@alloy-js/core";
|
|
4
|
+
import * as ts from "@alloy-js/typescript";
|
|
5
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
6
|
+
import { getJsonRecordTransformRefkey } from "./json-record-transform.js";
|
|
7
|
+
export function JsonAdditionalPropertiesTransform(props) {
|
|
8
|
+
const additionalProperties = $.model.getAdditionalPropertiesRecord(props.type);
|
|
9
|
+
if (!additionalProperties) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
if (props.target === "application") {
|
|
13
|
+
const properties = $.model.getProperties(props.type, {
|
|
14
|
+
includeExtended: true
|
|
15
|
+
});
|
|
16
|
+
const destructuredProperties = ay.mapJoin(properties, name => name, {
|
|
17
|
+
joiner: ",",
|
|
18
|
+
ender: ","
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Inline destructuring that extracts the properties and passes the rest to jsonRecordUnknownToApplicationTransform_2
|
|
22
|
+
const inlineDestructure = ay.code`
|
|
23
|
+
${getJsonRecordTransformRefkey(additionalProperties, props.target)}(
|
|
24
|
+
(({ ${destructuredProperties} ...rest }) => rest)(${props.itemRef})
|
|
25
|
+
),
|
|
26
|
+
`;
|
|
27
|
+
return _$createComponent(ts.ObjectProperty, {
|
|
28
|
+
name: "additionalProperties",
|
|
29
|
+
children: inlineDestructure
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const itemRef = ay.code`${props.itemRef}.additionalProperties`;
|
|
33
|
+
return ["...(", _$memo(() => getJsonRecordTransformRefkey(additionalProperties, props.target)), "(", itemRef, ")\n),"];
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=json-model-additional-properties-transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-model-additional-properties-transform.js","names":["ay","ts","$","getJsonRecordTransformRefkey","JsonAdditionalPropertiesTransform","props","additionalProperties","model","getAdditionalPropertiesRecord","type","target","properties","getProperties","includeExtended","destructuredProperties","mapJoin","name","joiner","ender","inlineDestructure","code","itemRef","_$createComponent","ObjectProperty","children","_$memo"],"sources":["../../../../../src/components/transforms/json/json-model-additional-properties-transform.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,CAAC,QAAQ,yCAAyC;AAC3D,SAASC,4BAA4B;AAQrC,OAAO,SAASC,iCAAiCA,CAACC,KAA6C,EAAE;EAC/F,MAAMC,oBAAoB,GAAGJ,CAAC,CAACK,KAAK,CAACC,6BAA6B,CAACH,KAAK,CAACI,IAAI,CAAC;EAE9E,IAAI,CAACH,oBAAoB,EAAE;IACzB,OAAO,IAAI;EACb;EAEA,IAAID,KAAK,CAACK,MAAM,KAAK,aAAa,EAAE;IAClC,MAAMC,UAAU,GAAGT,CAAC,CAACK,KAAK,CAACK,aAAa,CAACP,KAAK,CAACI,IAAI,EAAE;MAAEI,eAAe,EAAE;IAAK,CAAC,CAAC;IAC/E,MAAMC,sBAAsB,GAAGd,EAAE,CAACe,OAAO,CAACJ,UAAU,EAAGK,IAAI,IAAKA,IAAI,EAAE;MACpEC,MAAM,EAAE,GAAG;MACXC,KAAK,EAAE;IACT,CAAC,CAAC;;IAEF;IACA,MAAMC,iBAAiB,GAAGnB,EAAE,CAACoB,IAAI;AACrC,MAAMjB,4BAA4B,CAACG,oBAAoB,EAAED,KAAK,CAACK,MAAM,CAAC;AACtE,YAAYI,sBAAsB,wBAAwBT,KAAK,CAACgB,OAAO;AACvE;AACA,KAAK;IAED,OAAAC,iBAAA,CACGrB,EAAE,CAACsB,cAAc;MAACP,IAAI;MAAAQ,QAAA,EACpBL;IAAiB;EAGxB;EAEA,MAAME,OAAO,GAAGrB,EAAE,CAACoB,IAAI,GAAGf,KAAK,CAACgB,OAAO,uBAAuB;EAE9D,gBAAAI,MAAA,OACatB,4BAA4B,CAACG,oBAAoB,EAAED,KAAK,CAACK,MAAM,CAAC,QAAGW,OAAO;AAGzF","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { Model } from "@typespec/compiler";
|
|
3
|
+
export interface JsonModelBaseTransformProps {
|
|
4
|
+
itemRef: ay.Children;
|
|
5
|
+
type: Model;
|
|
6
|
+
target: "transport" | "application";
|
|
7
|
+
}
|
|
8
|
+
export declare function JsonModelBaseTransform(props: JsonModelBaseTransformProps): ay.Children;
|
|
9
|
+
//# sourceMappingURL=json-model-base-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-model-base-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-base-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAQxE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { JsonTransform } from "./json-transform.js";
|
|
4
|
+
export function JsonModelBaseTransform(props) {
|
|
5
|
+
const baseModel = props.type.baseModel;
|
|
6
|
+
if (!baseModel) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return ["...", _$createComponent(JsonTransform, _$mergeProps(props, {
|
|
10
|
+
type: baseModel
|
|
11
|
+
})), ","];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=json-model-base-transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-model-base-transform.js","names":["JsonTransform","JsonModelBaseTransform","props","baseModel","type","_$createComponent","_$mergeProps"],"sources":["../../../../../src/components/transforms/json/json-model-base-transform.tsx"],"sourcesContent":[null],"mappings":";;AAEA,SAASA,aAAa;AAQtB,OAAO,SAASC,sBAAsBA,CAACC,KAAkC,EAAE;EACzE,MAAMC,SAAS,GAAGD,KAAK,CAACE,IAAI,CAACD,SAAS;EAEtC,IAAI,CAACA,SAAS,EAAE;IACd,OAAO,IAAI;EACb;EAEA,eAAAE,iBAAA,CAAaL,aAAa,EAAAM,YAAA,CAAKJ,KAAK;IAAEE,IAAI,EAAED;EAAS;AACvD","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { ModelProperty } from "@typespec/compiler";
|
|
3
|
+
export interface JsonModelPropertyTransformProps {
|
|
4
|
+
itemRef: ay.Refkey | ay.Children;
|
|
5
|
+
type: ModelProperty;
|
|
6
|
+
target: "transport" | "application";
|
|
7
|
+
}
|
|
8
|
+
export declare function JsonModelPropertyTransform(props: JsonModelPropertyTransformProps): ay.Children;
|
|
9
|
+
//# sourceMappingURL=json-model-property-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-model-property-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-property-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOnD,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,GAAG,EAAE,CAAC,QAAQ,CAyB9F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import * as ay from "@alloy-js/core";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
5
|
+
import { unpackProperty } from "../../utils/unpack-model-property.js";
|
|
6
|
+
import { ScalarDataTransform } from "../data-transform.js";
|
|
7
|
+
import { useTransformNamePolicy } from "../transform-name-policy.js";
|
|
8
|
+
import { JsonTransform } from "./json-transform.js";
|
|
9
|
+
export function JsonModelPropertyTransform(props) {
|
|
10
|
+
const transformNamer = useTransformNamePolicy();
|
|
11
|
+
const propertyValueType = unpackProperty(props.type);
|
|
12
|
+
const transportName = transformNamer.getTransportName(props.type);
|
|
13
|
+
const applicationName = transformNamer.getApplicationName(props.type);
|
|
14
|
+
const targetName = props.target === "transport" ? transportName : applicationName;
|
|
15
|
+
const sourceName = props.target === "transport" ? applicationName : transportName;
|
|
16
|
+
const propertyValueRef = props.itemRef ? ay.code`${props.itemRef}.${sourceName}` : sourceName;
|
|
17
|
+
let propertyValue;
|
|
18
|
+
if ($.scalar.is(propertyValueType)) {
|
|
19
|
+
propertyValue = _$createComponent(ScalarDataTransform, {
|
|
20
|
+
get type() {
|
|
21
|
+
return props.type;
|
|
22
|
+
},
|
|
23
|
+
get target() {
|
|
24
|
+
return props.target;
|
|
25
|
+
},
|
|
26
|
+
itemRef: propertyValueRef
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
propertyValue = _$createComponent(JsonTransform, {
|
|
30
|
+
type: propertyValueType,
|
|
31
|
+
get target() {
|
|
32
|
+
return props.target;
|
|
33
|
+
},
|
|
34
|
+
itemRef: propertyValueRef
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return _$createComponent(ts.ObjectProperty, {
|
|
38
|
+
get name() {
|
|
39
|
+
return JSON.stringify(targetName);
|
|
40
|
+
},
|
|
41
|
+
value: propertyValue
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=json-model-property-transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-model-property-transform.js","names":["ay","ts","$","unpackProperty","ScalarDataTransform","useTransformNamePolicy","JsonTransform","JsonModelPropertyTransform","props","transformNamer","propertyValueType","type","transportName","getTransportName","applicationName","getApplicationName","targetName","target","sourceName","propertyValueRef","itemRef","code","propertyValue","scalar","is","_$createComponent","ObjectProperty","name","JSON","stringify","value"],"sources":["../../../../../src/components/transforms/json/json-model-property-transform.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,CAAC,QAAQ,yCAAyC;AAC3D,SAASC,cAAc,QAAQ,sCAAsC;AACrE,SAASC,mBAAmB;AAC5B,SAASC,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,aAAa;AAQtB,OAAO,SAASC,0BAA0BA,CAACC,KAAsC,EAAe;EAC9F,MAAMC,cAAc,GAAGJ,sBAAsB,CAAC,CAAC;EAC/C,MAAMK,iBAAiB,GAAGP,cAAc,CAACK,KAAK,CAACG,IAAI,CAAC;EAEpD,MAAMC,aAAa,GAAGH,cAAc,CAACI,gBAAgB,CAACL,KAAK,CAACG,IAAI,CAAC;EACjE,MAAMG,eAAe,GAAGL,cAAc,CAACM,kBAAkB,CAACP,KAAK,CAACG,IAAI,CAAC;EACrE,MAAMK,UAAU,GAAGR,KAAK,CAACS,MAAM,KAAK,WAAW,GAAGL,aAAa,GAAGE,eAAe;EACjF,MAAMI,UAAU,GAAGV,KAAK,CAACS,MAAM,KAAK,WAAW,GAAGH,eAAe,GAAGF,aAAa;EAEjF,MAAMO,gBAAgB,GAAGX,KAAK,CAACY,OAAO,GAAGpB,EAAE,CAACqB,IAAI,GAAGb,KAAK,CAACY,OAAO,IAAIF,UAAU,EAAE,GAAGA,UAAU;EAC7F,IAAII,aAA0B;EAE9B,IAAIpB,CAAC,CAACqB,MAAM,CAACC,EAAE,CAACd,iBAAiB,CAAC,EAAE;IAClCY,aAAa,GAAAG,iBAAA,CACVrB,mBAAmB;MAAA,IAClBO,IAAIA,CAAA;QAAA,OAAEH,KAAK,CAACG,IAAI;MAAA;MAAA,IAChBM,MAAMA,CAAA;QAAA,OAAET,KAAK,CAACS,MAAM;MAAA;MACpBG,OAAO,EAAED;IAAgB,EACzB;EACN,CAAC,MAAM;IACLG,aAAa,GAAAG,iBAAA,CACVnB,aAAa;MAACK,IAAI,EAAED,iBAAiB;MAAA,IAAEO,MAAMA,CAAA;QAAA,OAAET,KAAK,CAACS,MAAM;MAAA;MAAEG,OAAO,EAAED;IAAgB,EAAI;EAC/F;EAEA,OAAAM,iBAAA,CAAQxB,EAAE,CAACyB,cAAc;IAAA,IAACC,IAAIA,CAAA;MAAA,OAAEC,IAAI,CAACC,SAAS,CAACb,UAAU,CAAC;IAAA;IAAEc,KAAK,EAAER;EAAa;AAClF","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { Model } from "@typespec/compiler";
|
|
3
|
+
export interface JsonModelTransformProps {
|
|
4
|
+
itemRef: ay.Refkey | ay.Children;
|
|
5
|
+
type: Model;
|
|
6
|
+
target: "transport" | "application";
|
|
7
|
+
}
|
|
8
|
+
export declare function JsonModelTransform(props: JsonModelTransformProps): ay.Children;
|
|
9
|
+
export declare function getJsonModelTransformRefkey(type: Model, target: "transport" | "application"): ay.Refkey;
|
|
10
|
+
export interface JsonModelTransformDeclarationProps {
|
|
11
|
+
type: Model;
|
|
12
|
+
target: "transport" | "application";
|
|
13
|
+
}
|
|
14
|
+
export declare function JsonModelTransformDeclaration(props: JsonModelTransformDeclarationProps): ay.Children;
|
|
15
|
+
//# sourceMappingURL=json-model-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-model-transform.d.ts","sourceRoot":"","sources":["../../../../../src/components/transforms/json/json-model-transform.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAU3C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAiBhE;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,WAAW,GAAG,aAAa,GAClC,EAAE,CAAC,MAAM,CAEX;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,GACxC,EAAE,CAAC,QAAQ,CAkCb"}
|