@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,317 @@
|
|
|
1
|
+
import { code } from "@alloy-js/core";
|
|
2
|
+
import { NoTarget } from "@typespec/compiler";
|
|
3
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
4
|
+
import * as ef from "@typespec/emitter-framework/typescript";
|
|
5
|
+
import { useDefaultEncoding } from "../../context/encoding/encoding-context.js";
|
|
6
|
+
import { reportDiagnostic } from "../../lib.js";
|
|
7
|
+
import { getDecodeUint8ArrayRef, getEncodeUint8ArrayRef } from "../static-helpers/bytes-encoding.js";
|
|
8
|
+
|
|
9
|
+
// Define the transformer function type.
|
|
10
|
+
|
|
11
|
+
// Define a pair that holds both directions.
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns the transformer pair for the given scalar type.
|
|
15
|
+
*
|
|
16
|
+
* @param type - The scalar type to look up.
|
|
17
|
+
* @returns The transformer pair from scalarTransformerMap for the given type.
|
|
18
|
+
*/
|
|
19
|
+
export function getScalarTransformer(type) {
|
|
20
|
+
return scalarTransformerMap[getScalarTransformKey(type)];
|
|
21
|
+
}
|
|
22
|
+
function defineScalarTransformerMap(map) {
|
|
23
|
+
return map;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A paired transformer map for scalar types.
|
|
28
|
+
*
|
|
29
|
+
* Each scalar type is associated with a pair of functions: one for transforming the value for transport
|
|
30
|
+
* (serialization) and one for transforming the value for application (deserialization).
|
|
31
|
+
*/
|
|
32
|
+
const scalarTransformerMap = defineScalarTransformerMap({
|
|
33
|
+
boolean: {
|
|
34
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
35
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
36
|
+
},
|
|
37
|
+
bytes: {
|
|
38
|
+
toTransport: (itemRef, encoding) => {
|
|
39
|
+
const bytesEncoding = encoding?.encoding ?? useDefaultEncoding("bytes");
|
|
40
|
+
switch (bytesEncoding) {
|
|
41
|
+
case "base64":
|
|
42
|
+
case "base64url":
|
|
43
|
+
const bytesEncodeRef = getEncodeUint8ArrayRef();
|
|
44
|
+
return code`${bytesEncodeRef}(${itemRef}, "${bytesEncoding}")!`;
|
|
45
|
+
default:
|
|
46
|
+
reportDiagnostic($.program, {
|
|
47
|
+
code: "unknown-encoding",
|
|
48
|
+
target: encoding?.type ?? NoTarget
|
|
49
|
+
});
|
|
50
|
+
return passthroughTransformer(itemRef);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
toApplication: (itemRef, encoding) => {
|
|
54
|
+
const bytesEncoding = encoding?.encoding ?? useDefaultEncoding("bytes");
|
|
55
|
+
switch (bytesEncoding) {
|
|
56
|
+
case "base64":
|
|
57
|
+
case "base64url":
|
|
58
|
+
const bytesDecodeRef = getDecodeUint8ArrayRef();
|
|
59
|
+
return code`${bytesDecodeRef}(${itemRef})!`;
|
|
60
|
+
default:
|
|
61
|
+
reportDiagnostic($.program, {
|
|
62
|
+
code: "unknown-encoding",
|
|
63
|
+
target: encoding?.type ?? NoTarget
|
|
64
|
+
});
|
|
65
|
+
return passthroughTransformer(itemRef);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
// For numerics that have no transformation, both directions simply passthrough.
|
|
70
|
+
decimal: {
|
|
71
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
72
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
73
|
+
},
|
|
74
|
+
decimal128: {
|
|
75
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
76
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
77
|
+
},
|
|
78
|
+
float: {
|
|
79
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
80
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
81
|
+
},
|
|
82
|
+
float32: {
|
|
83
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
84
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
85
|
+
},
|
|
86
|
+
float64: {
|
|
87
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
88
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
89
|
+
},
|
|
90
|
+
int16: {
|
|
91
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
92
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
93
|
+
},
|
|
94
|
+
int32: {
|
|
95
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
96
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
97
|
+
},
|
|
98
|
+
int64: {
|
|
99
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
100
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
101
|
+
},
|
|
102
|
+
int8: {
|
|
103
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
104
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
105
|
+
},
|
|
106
|
+
integer: {
|
|
107
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
108
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
109
|
+
},
|
|
110
|
+
numeric: {
|
|
111
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
112
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
113
|
+
},
|
|
114
|
+
safeint: {
|
|
115
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
116
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
117
|
+
},
|
|
118
|
+
uint16: {
|
|
119
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
120
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
121
|
+
},
|
|
122
|
+
uint32: {
|
|
123
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
124
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
125
|
+
},
|
|
126
|
+
uint64: {
|
|
127
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
128
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
129
|
+
},
|
|
130
|
+
uint8: {
|
|
131
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
132
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
133
|
+
},
|
|
134
|
+
// Duration: We don't apply any transformation so just passthrough.
|
|
135
|
+
duration: {
|
|
136
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
137
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
138
|
+
},
|
|
139
|
+
// Date/Time scalars: using a serializer on transport and a deserializer on application.
|
|
140
|
+
offsetDateTime: {
|
|
141
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
142
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
143
|
+
},
|
|
144
|
+
plainDate: {
|
|
145
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
146
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
147
|
+
},
|
|
148
|
+
plainTime: {
|
|
149
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
150
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
151
|
+
},
|
|
152
|
+
utcDateTime: {
|
|
153
|
+
toTransport: (itemRef, encoding) => {
|
|
154
|
+
const dateEncoding = encoding?.encoding ?? useDefaultEncoding("datetime");
|
|
155
|
+
let encodingFnRef = ef.DateRfc3339SerializerRefkey;
|
|
156
|
+
switch (dateEncoding) {
|
|
157
|
+
case "unixTimestamp":
|
|
158
|
+
encodingFnRef = ef.DateUnixTimestampSerializerRefkey;
|
|
159
|
+
break;
|
|
160
|
+
case "rfc7231":
|
|
161
|
+
encodingFnRef = ef.DateRfc7231SerializerRefkey;
|
|
162
|
+
break;
|
|
163
|
+
case "rfc3339":
|
|
164
|
+
// already defaulted above.
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
reportDiagnostic($.program, {
|
|
168
|
+
code: "unknown-encoding",
|
|
169
|
+
target: encoding?.type ?? NoTarget
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return code`${encodingFnRef}(${itemRef})`;
|
|
173
|
+
},
|
|
174
|
+
toApplication: (itemRef, encoding) => {
|
|
175
|
+
const dateEncoding = encoding?.encoding ?? useDefaultEncoding("datetime");
|
|
176
|
+
let decodingFnRef = ef.DateDeserializerRefkey;
|
|
177
|
+
switch (dateEncoding) {
|
|
178
|
+
case "unixTimestamp":
|
|
179
|
+
decodingFnRef = ef.DateUnixTimestampDeserializerRefkey;
|
|
180
|
+
break;
|
|
181
|
+
case "rfc7231":
|
|
182
|
+
decodingFnRef = ef.DateRfc7231DeserializerRefkey;
|
|
183
|
+
break;
|
|
184
|
+
case "rfc3339":
|
|
185
|
+
// default already
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
reportDiagnostic($.program, {
|
|
189
|
+
code: "unknown-encoding",
|
|
190
|
+
target: encoding?.type ?? NoTarget
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return code`${decodingFnRef}(${itemRef})!`;
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
unixTimestamp32: {
|
|
197
|
+
toTransport: itemRef => {
|
|
198
|
+
return code`${ef.DateUnixTimestampSerializerRefkey}(${itemRef})`;
|
|
199
|
+
},
|
|
200
|
+
toApplication: itemRef => {
|
|
201
|
+
return code`${ef.DateUnixTimestampDeserializerRefkey}(${itemRef})`;
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
// For URL and string, no transformation is needed.
|
|
205
|
+
url: {
|
|
206
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
207
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
208
|
+
},
|
|
209
|
+
string: {
|
|
210
|
+
toTransport: itemRef => passthroughTransformer(itemRef),
|
|
211
|
+
toApplication: itemRef => passthroughTransformer(itemRef)
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Tests for determining the scalar transformation key.
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
const scalarTests = [{
|
|
220
|
+
key: "boolean",
|
|
221
|
+
test: t => $.scalar.isBoolean(t) || $.scalar.extendsBoolean(t)
|
|
222
|
+
}, {
|
|
223
|
+
key: "bytes",
|
|
224
|
+
test: t => $.scalar.isBytes(t) || $.scalar.extendsBytes(t)
|
|
225
|
+
}, {
|
|
226
|
+
key: "decimal",
|
|
227
|
+
test: t => $.scalar.isDecimal(t) || $.scalar.extendsDecimal(t)
|
|
228
|
+
}, {
|
|
229
|
+
key: "decimal128",
|
|
230
|
+
test: t => $.scalar.isDecimal128(t) || $.scalar.extendsDecimal128(t)
|
|
231
|
+
}, {
|
|
232
|
+
key: "duration",
|
|
233
|
+
test: t => $.scalar.isDuration(t) || $.scalar.extendsDuration(t)
|
|
234
|
+
}, {
|
|
235
|
+
key: "float",
|
|
236
|
+
test: t => $.scalar.isFloat(t) || $.scalar.extendsFloat(t)
|
|
237
|
+
}, {
|
|
238
|
+
key: "float32",
|
|
239
|
+
test: t => $.scalar.isFloat32(t) || $.scalar.extendsFloat32(t)
|
|
240
|
+
}, {
|
|
241
|
+
key: "float64",
|
|
242
|
+
test: t => $.scalar.isFloat64(t) || $.scalar.extendsFloat64(t)
|
|
243
|
+
}, {
|
|
244
|
+
key: "int16",
|
|
245
|
+
test: t => $.scalar.isInt16(t) || $.scalar.extendsInt16(t)
|
|
246
|
+
}, {
|
|
247
|
+
key: "int32",
|
|
248
|
+
test: t => $.scalar.isInt32(t) || $.scalar.extendsInt32(t)
|
|
249
|
+
}, {
|
|
250
|
+
key: "int64",
|
|
251
|
+
test: t => $.scalar.isInt64(t) || $.scalar.extendsInt64(t)
|
|
252
|
+
}, {
|
|
253
|
+
key: "int8",
|
|
254
|
+
test: t => $.scalar.isInt8(t) || $.scalar.extendsInt8(t)
|
|
255
|
+
}, {
|
|
256
|
+
key: "integer",
|
|
257
|
+
test: t => $.scalar.isInteger(t) || $.scalar.extendsInteger(t)
|
|
258
|
+
}, {
|
|
259
|
+
key: "numeric",
|
|
260
|
+
test: t => $.scalar.isNumeric(t) || $.scalar.extendsNumeric(t)
|
|
261
|
+
}, {
|
|
262
|
+
key: "offsetDateTime",
|
|
263
|
+
test: t => $.scalar.isOffsetDateTime(t) || $.scalar.extendsOffsetDateTime(t)
|
|
264
|
+
}, {
|
|
265
|
+
key: "plainDate",
|
|
266
|
+
test: t => $.scalar.isPlainDate(t) || $.scalar.extendsPlainDate(t)
|
|
267
|
+
}, {
|
|
268
|
+
key: "plainTime",
|
|
269
|
+
test: t => $.scalar.isPlainTime(t) || $.scalar.extendsPlainTime(t)
|
|
270
|
+
}, {
|
|
271
|
+
key: "safeint",
|
|
272
|
+
test: t => $.scalar.isSafeint(t) || $.scalar.extendsSafeint(t)
|
|
273
|
+
}, {
|
|
274
|
+
key: "string",
|
|
275
|
+
test: t => $.scalar.isString(t) || $.scalar.extendsString(t)
|
|
276
|
+
}, {
|
|
277
|
+
key: "uint16",
|
|
278
|
+
test: t => $.scalar.isUint16(t) || $.scalar.extendsUint16(t)
|
|
279
|
+
}, {
|
|
280
|
+
key: "uint32",
|
|
281
|
+
test: t => $.scalar.isUint32(t) || $.scalar.extendsUint32(t)
|
|
282
|
+
}, {
|
|
283
|
+
key: "uint64",
|
|
284
|
+
test: t => $.scalar.isUint64(t) || $.scalar.extendsUint64(t)
|
|
285
|
+
}, {
|
|
286
|
+
key: "uint8",
|
|
287
|
+
test: t => $.scalar.isUint8(t) || $.scalar.extendsUint8(t)
|
|
288
|
+
}, {
|
|
289
|
+
key: "url",
|
|
290
|
+
test: t => $.scalar.isUrl(t) || $.scalar.extendsUrl(t)
|
|
291
|
+
}, {
|
|
292
|
+
key: "utcDateTime",
|
|
293
|
+
test: t => $.scalar.isUtcDateTime(t) || $.scalar.extendsUtcDateTime(t)
|
|
294
|
+
}];
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Determines the key to use in the scalarTransformerMap for the given scalar type.
|
|
298
|
+
*
|
|
299
|
+
* @param type - The scalar type to check.
|
|
300
|
+
* @returns The corresponding key from the scalarTransformerMap.
|
|
301
|
+
* @throws Error if the scalar type is unknown.
|
|
302
|
+
*/
|
|
303
|
+
function getScalarTransformKey(type) {
|
|
304
|
+
for (const {
|
|
305
|
+
key,
|
|
306
|
+
test
|
|
307
|
+
} of scalarTests) {
|
|
308
|
+
if (test(type)) {
|
|
309
|
+
return key;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
throw new Error(`Unknown scalar type: ${type}`);
|
|
313
|
+
}
|
|
314
|
+
function passthroughTransformer(itemRef) {
|
|
315
|
+
return itemRef;
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=scalar-transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalar-transform.js","names":["code","NoTarget","$","ef","useDefaultEncoding","reportDiagnostic","getDecodeUint8ArrayRef","getEncodeUint8ArrayRef","getScalarTransformer","type","scalarTransformerMap","getScalarTransformKey","defineScalarTransformerMap","map","boolean","toTransport","itemRef","passthroughTransformer","toApplication","bytes","encoding","bytesEncoding","bytesEncodeRef","program","target","bytesDecodeRef","decimal","decimal128","float","float32","float64","int16","int32","int64","int8","integer","numeric","safeint","uint16","uint32","uint64","uint8","duration","offsetDateTime","plainDate","plainTime","utcDateTime","dateEncoding","encodingFnRef","DateRfc3339SerializerRefkey","DateUnixTimestampSerializerRefkey","DateRfc7231SerializerRefkey","decodingFnRef","DateDeserializerRefkey","DateUnixTimestampDeserializerRefkey","DateRfc7231DeserializerRefkey","unixTimestamp32","url","string","scalarTests","key","test","t","scalar","isBoolean","extendsBoolean","isBytes","extendsBytes","isDecimal","extendsDecimal","isDecimal128","extendsDecimal128","isDuration","extendsDuration","isFloat","extendsFloat","isFloat32","extendsFloat32","isFloat64","extendsFloat64","isInt16","extendsInt16","isInt32","extendsInt32","isInt64","extendsInt64","isInt8","extendsInt8","isInteger","extendsInteger","isNumeric","extendsNumeric","isOffsetDateTime","extendsOffsetDateTime","isPlainDate","extendsPlainDate","isPlainTime","extendsPlainTime","isSafeint","extendsSafeint","isString","extendsString","isUint16","extendsUint16","isUint32","extendsUint32","isUint64","extendsUint64","isUint8","extendsUint8","isUrl","extendsUrl","isUtcDateTime","extendsUtcDateTime","Error"],"sources":["../../../../src/components/transforms/scalar-transform.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAmBA,IAAI,QAAgB,gBAAgB;AACvD,SAAyCC,QAAQ,QAAgB,oBAAoB;AACrF,SAASC,CAAC,QAAQ,yCAAyC;AAC3D,OAAO,KAAKC,EAAE,MAAM,wCAAwC;AAC5D,SAASC,kBAAkB;AAC3B,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,SACEC,sBAAsB,EACtBC,sBAAsB;;AAGxB;;AAGA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,IAAY,EAAmB;EAClE,OAAOC,oBAAoB,CAACC,qBAAqB,CAACF,IAAI,CAAC,CAAC;AAC1D;AAEA,SAASG,0BAA0BA,CAA4CC,GAAM,EAAK;EACxF,OAAOA,GAAG;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMH,oBAAoB,GAAGE,0BAA0B,CAAC;EACtDE,OAAO,EAAE;IACPC,WAAW,EAAGC,OAAO,IAAKC,sBAAsB,CAACD,OAAO,CAAC;IACzDE,aAAa,EAAGF,OAAO,IAAKC,sBAAsB,CAACD,OAAO;EAC5D,CAAC;EAEDG,KAAK,EAAE;IACLJ,WAAW,EAAEA,CAACC,OAAO,EAAEI,QAAQ,KAAK;MAClC,MAAMC,aAA6C,GAChDD,QAAQ,EAAEA,QAAQ,IAClBhB,kBAA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IAAK5D,CAAC,CAAC6D,MAAM,CAAC6C,OAAO,CAAC9C,CAAC,CAAC,IAAI5D,CAAC,CAAC6D,MAAM,CAAC8C,YAAY,CAAC/C,CAAC;AAAE,CAAC,EAC9E;EAAEF,GAAG,EAAE,KAAK;EAAEC,IAAI,EAAGC,CAAC,IAAK5D,CAAC,CAAC6D,MAAM,CAAC+C,KAAK,CAAChD,CAAC,CAAC,IAAI5D,CAAC,CAAC6D,MAAM,CAACgD,UAAU,CAACjD,CAAC;AAAE,CAAC,EACxE;EAAEF,GAAG,EAAE,aAAa;EAAEC,IAAI,EAAGC,CAAC,IAAK5D,CAAC,CAAC6D,MAAM,CAACiD,aAAa,CAAClD,CAAC,CAAC,IAAI5D,CAAC,CAAC6D,MAAM,CAACkD,kBAAkB,CAACnD,CAAC;AAAE,CAAC,CACjG;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASnD,qBAAqBA,CAACF,IAAY,EAAqC;EAC9E,KAAK,MAAM;IAAEmD,GAAG;IAAEC;EAAK,CAAC,IAAIF,WAAW,EAAE;IACvC,IAAIE,IAAI,CAACpD,IAAI,CAAC,EAAE;MACd,OAAOmD,GAAG;IACZ;EACF;EACA,MAAM,IAAIsD,KAAK,CAAC,wBAAwBzG,IAAI,EAAE,CAAC;AACjD;AAEA,SAASQ,sBAAsBA,CAACD,OAA0B,EAAE;EAC1D,OAAOA,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Type } from "@typespec/compiler";
|
|
2
|
+
import * as ef from "@typespec/emitter-framework";
|
|
3
|
+
export declare function useTransformNamePolicy(): ef.TransformNamePolicy;
|
|
4
|
+
/**
|
|
5
|
+
* A type that extends `Type` and includes a `name` property of type `string`.
|
|
6
|
+
* This type is used to represent objects that specifically have a `name` property of type `string`.
|
|
7
|
+
*/
|
|
8
|
+
export type WithStringName = Type & {
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A type that extends `Type` and includes a `name` property of type `string | symbol`.
|
|
13
|
+
* This type is used to represent objects that have a `name` property which can either be a `string` or `symbol`.
|
|
14
|
+
*/
|
|
15
|
+
export type WithName = Type & {
|
|
16
|
+
name: string | symbol;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A set of optional namers that can be provided for transforming transport and application names.
|
|
20
|
+
* The `transportNamer` transforms the transport name, while `applicationNamer` transforms the application name.
|
|
21
|
+
*/
|
|
22
|
+
export interface TransformNamers {
|
|
23
|
+
/**
|
|
24
|
+
* Function to generate a transport name from a `Type` object.
|
|
25
|
+
*
|
|
26
|
+
* @param type - The type object to transform.
|
|
27
|
+
* @param encoding - An optional encoding string to modify the transformation.
|
|
28
|
+
* @returns A transformed transport name as a string.
|
|
29
|
+
*/
|
|
30
|
+
transportNamer?: (type: WithName, encoding?: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Function to generate an application name from a `Type` object.
|
|
33
|
+
*
|
|
34
|
+
* @param type - The type object to transform.
|
|
35
|
+
* @returns A transformed application name as a string.
|
|
36
|
+
*/
|
|
37
|
+
applicationNamer?: (type: WithName) => string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Factory function to create a `TransformNamePolicy` implementation with custom or default name transformation logic.
|
|
41
|
+
* This function uses the provided namers for transport and application names. If no namers are provided,
|
|
42
|
+
* default implementations are used.
|
|
43
|
+
*
|
|
44
|
+
* @param namers - An optional object containing custom `transportNamer` and `applicationNamer` functions.
|
|
45
|
+
* @returns A `TransformNamePolicy` implementation.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createTransformNamePolicy(namers?: TransformNamers): ef.TransformNamePolicy;
|
|
48
|
+
/**
|
|
49
|
+
* Default function for transforming the application name. It assumes that the `type` has a `name` of type `string`.
|
|
50
|
+
*
|
|
51
|
+
* @param type - The type object that must have a `name` property of type `string`.
|
|
52
|
+
* @returns The transformed application name as a string.
|
|
53
|
+
*/
|
|
54
|
+
export declare function defaultApplicationNameGetter(type: WithName): string;
|
|
55
|
+
/**
|
|
56
|
+
* Default function for transforming the transport name. It assumes that the `type` has a `name` of type `string`.
|
|
57
|
+
* Optionally uses an `encoding` string to modify the name.
|
|
58
|
+
*
|
|
59
|
+
* @param type - The type object that must have a `name` property of type `string`.
|
|
60
|
+
* @param encoding - Optional encoding for the transport name.
|
|
61
|
+
* @returns The transformed transport name as a string.
|
|
62
|
+
*/
|
|
63
|
+
export declare function defaultTransportNameGetter(type: WithName, encoding?: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Helper function to check if the provided `type` has a `name` property of type `string`.
|
|
66
|
+
*
|
|
67
|
+
* @param type - The type object that may have a `name` property of type `string` or `symbol`.
|
|
68
|
+
* @returns A boolean indicating whether the `name` property is a string.
|
|
69
|
+
*/
|
|
70
|
+
export declare function hasStringName(type: WithName): type is WithStringName;
|
|
71
|
+
//# sourceMappingURL=transform-name-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-name-policy.d.ts","sourceRoot":"","sources":["../../../../src/components/transforms/transform-name-policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAIlD,wBAAgB,sBAAsB,IAAI,EAAE,CAAC,mBAAmB,CAE/D;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAE/D;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,GAAE,eAAoB,GAAG,EAAE,CAAC,mBAAmB,CA2B9F;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CASnE;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,QAAQ,EACd,QAAQ,GAAE,MAA2B,GACpC,MAAM,CAWR;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,cAAc,CAEpE"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as ts from "@alloy-js/typescript";
|
|
2
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
3
|
+
import * as ef from "@typespec/emitter-framework";
|
|
4
|
+
import { kebabCase } from "change-case";
|
|
5
|
+
import { reportDiagnostic } from "../../lib.js";
|
|
6
|
+
export function useTransformNamePolicy() {
|
|
7
|
+
return ef.useTransformNamePolicy();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A type that extends `Type` and includes a `name` property of type `string`.
|
|
12
|
+
* This type is used to represent objects that specifically have a `name` property of type `string`.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A type that extends `Type` and includes a `name` property of type `string | symbol`.
|
|
17
|
+
* This type is used to represent objects that have a `name` property which can either be a `string` or `symbol`.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A set of optional namers that can be provided for transforming transport and application names.
|
|
22
|
+
* The `transportNamer` transforms the transport name, while `applicationNamer` transforms the application name.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Factory function to create a `TransformNamePolicy` implementation with custom or default name transformation logic.
|
|
27
|
+
* This function uses the provided namers for transport and application names. If no namers are provided,
|
|
28
|
+
* default implementations are used.
|
|
29
|
+
*
|
|
30
|
+
* @param namers - An optional object containing custom `transportNamer` and `applicationNamer` functions.
|
|
31
|
+
* @returns A `TransformNamePolicy` implementation.
|
|
32
|
+
*/
|
|
33
|
+
export function createTransformNamePolicy(namers = {}) {
|
|
34
|
+
const transportNamer = namers.transportNamer ?? defaultTransportNameGetter;
|
|
35
|
+
const applicationNamer = namers.applicationNamer ?? defaultApplicationNameGetter;
|
|
36
|
+
return {
|
|
37
|
+
/**
|
|
38
|
+
* Transforms the transport name based on the provided `transportNamer` function or the default.
|
|
39
|
+
* If the `type` does not have a string `name`, it reports a diagnostic.
|
|
40
|
+
*
|
|
41
|
+
* @param type - The object that has a `name` property (either string or symbol).
|
|
42
|
+
* @returns The transformed transport name as a string.
|
|
43
|
+
*/
|
|
44
|
+
getTransportName(type) {
|
|
45
|
+
return transportNamer(type);
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Transforms the application name based on the provided `applicationNamer` function or the default.
|
|
49
|
+
* If the `type` does not have a string `name`, it reports a diagnostic.
|
|
50
|
+
*
|
|
51
|
+
* @param type - The object that has a `name` property (either string or symbol).
|
|
52
|
+
* @returns The transformed application name as a string.
|
|
53
|
+
*/
|
|
54
|
+
getApplicationName(type) {
|
|
55
|
+
return applicationNamer(type);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Default function for transforming the application name. It assumes that the `type` has a `name` of type `string`.
|
|
62
|
+
*
|
|
63
|
+
* @param type - The type object that must have a `name` property of type `string`.
|
|
64
|
+
* @returns The transformed application name as a string.
|
|
65
|
+
*/
|
|
66
|
+
export function defaultApplicationNameGetter(type) {
|
|
67
|
+
if (!hasStringName(type)) {
|
|
68
|
+
reportDiagnostic($.program, {
|
|
69
|
+
code: "symbol-name-not-supported",
|
|
70
|
+
target: type
|
|
71
|
+
});
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
const namePolicy = ts.useTSNamePolicy();
|
|
75
|
+
const name = type.name;
|
|
76
|
+
return namePolicy.getName(name, "object-member-data");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Default function for transforming the transport name. It assumes that the `type` has a `name` of type `string`.
|
|
81
|
+
* Optionally uses an `encoding` string to modify the name.
|
|
82
|
+
*
|
|
83
|
+
* @param type - The type object that must have a `name` property of type `string`.
|
|
84
|
+
* @param encoding - Optional encoding for the transport name.
|
|
85
|
+
* @returns The transformed transport name as a string.
|
|
86
|
+
*/
|
|
87
|
+
export function defaultTransportNameGetter(type, encoding = "application/json") {
|
|
88
|
+
if (!hasStringName(type)) {
|
|
89
|
+
reportDiagnostic($.program, {
|
|
90
|
+
code: "symbol-name-not-supported",
|
|
91
|
+
target: type
|
|
92
|
+
});
|
|
93
|
+
return "";
|
|
94
|
+
}
|
|
95
|
+
let name = encoding ? $.type.getEncodedName(type, encoding) : type.name;
|
|
96
|
+
if ($.modelProperty.is(type) && $.modelProperty.isHttpHeader(type)) {
|
|
97
|
+
name = kebabCase(name);
|
|
98
|
+
}
|
|
99
|
+
return name;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Helper function to check if the provided `type` has a `name` property of type `string`.
|
|
104
|
+
*
|
|
105
|
+
* @param type - The type object that may have a `name` property of type `string` or `symbol`.
|
|
106
|
+
* @returns A boolean indicating whether the `name` property is a string.
|
|
107
|
+
*/
|
|
108
|
+
export function hasStringName(type) {
|
|
109
|
+
return typeof type.name === "string";
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=transform-name-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-name-policy.js","names":["ts","$","ef","kebabCase","reportDiagnostic","useTransformNamePolicy","createTransformNamePolicy","namers","transportNamer","defaultTransportNameGetter","applicationNamer","defaultApplicationNameGetter","getTransportName","type","getApplicationName","hasStringName","program","code","target","namePolicy","useTSNamePolicy","name","getName","encoding","getEncodedName","modelProperty","is","isHttpHeader"],"sources":["../../../../src/components/transforms/transform-name-policy.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,EAAE,MAAM,sBAAsB;AAE1C,SAASC,CAAC,QAAQ,yCAAyC;AAC3D,OAAO,KAAKC,EAAE,MAAM,6BAA6B;AACjD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,cAAc;AAE/C,OAAO,SAASC,sBAAsBA,CAAA,EAA2B;EAC/D,OAAOH,EAAE,CAACG,sBAAsB,CAAC,CAAC;AACpC;;AAEA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CAACC,MAAuB,GAAG,CAAC,CAAC,EAA0B;EAC9F,MAAMC,cAAc,GAAGD,MAAM,CAACC,cAAc,IAAIC,0BAA0B;EAC1E,MAAMC,gBAAgB,GAAGH,MAAM,CAACG,gBAAgB,IAAIC,4BAA4B;EAEhF,OAAO;IACL;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,gBAAgBA,CAACC,IAAI,EAAE;MACrB,OAAOL,cAAc,CAACK,IAAI,CAAC;IAC7B,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,kBAAkBA,CAACD,IAAI,EAAE;MACvB,OAAOH,gBAAgB,CAACG,IAAI,CAAC;IAC/B;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASF,4BAA4BA,CAACE,IAAc,EAAU;EACnE,IAAI,CAACE,aAAa,CAACF,IAAI,CAAC,EAAE;IACxBT,gBAAgB,CAACH,CAAC,CAACe,OAAO,EAAE;MAAEC,IAAI,EAAE,2BAA2B;MAAEC,MAAM,EAAEL;IAAK,CAAC,CAAC;IAChF,OAAO,EAAE;EACX;EAEA,MAAMM,UAAU,GAAGnB,EAAE,CAACoB,eAAe,CAAC,CAAC;EACvC,MAAMC,IAAI,GAAGR,IAAI,CAACQ,IAAI;EACtB,OAAOF,UAAU,CAACG,OAAO,CAACD,IAAI,EAAE,oBAAoB,CAAC;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASZ,0BAA0BA,CACxCI,IAAc,EACdU,QAAgB,GAAG,kBAAkB,EAC7B;EACR,IAAI,CAACR,aAAa,CAACF,IAAI,CAAC,EAAE;IACxBT,gBAAgB,CAACH,CAAC,CAACe,OAAO,EAAE;MAAEC,IAAI,EAAE,2BAA2B;MAAEC,MAAM,EAAEL;IAAK,CAAC,CAAC;IAChF,OAAO,EAAE;EACX;EACA,IAAIQ,IAAI,GAAGE,QAAQ,GAAGtB,CAAC,CAACY,IAAI,CAACW,cAAc,CAACX,IAAI,EAAEU,QAAQ,CAAC,GAAGV,IAAI,CAACQ,IAAI;EAEvE,IAAIpB,CAAC,CAACwB,aAAa,CAACC,EAAE,CAACb,IAAI,CAAC,IAAIZ,CAAC,CAACwB,aAAa,CAACE,YAAY,CAACd,IAAI,CAAC,EAAE;IAClEQ,IAAI,GAAGlB,SAAS,CAACkB,IAAI,CAAC;EACxB;EACA,OAAOA,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASN,aAAaA,CAACF,IAAc,EAA0B;EACpE,OAAO,OAAOA,IAAI,CAACQ,IAAI,KAAK,QAAQ;AACtC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModelProperty, Type } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* Sometimes a model property type would be another ModelProperty in this case we need to keep unpacking until we find a non Model Property
|
|
4
|
+
* type to get to the actual type.
|
|
5
|
+
* This also handles an HttpPart which needs to be unpacked as well.
|
|
6
|
+
*/
|
|
7
|
+
export declare function unpackProperty(modelProperty: ModelProperty): Type;
|
|
8
|
+
//# sourceMappingURL=unpack-model-property.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpack-model-property.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/unpack-model-property.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAGrE;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAsBjE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isNullType } from "@typespec/compiler";
|
|
2
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sometimes a model property type would be another ModelProperty in this case we need to keep unpacking until we find a non Model Property
|
|
6
|
+
* type to get to the actual type.
|
|
7
|
+
* This also handles an HttpPart which needs to be unpacked as well.
|
|
8
|
+
*/
|
|
9
|
+
export function unpackProperty(modelProperty) {
|
|
10
|
+
const type = $.httpPart.unpack(modelProperty.type) ?? modelProperty.type;
|
|
11
|
+
if ($.modelProperty.is(type)) {
|
|
12
|
+
return unpackProperty(type);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Check if it is nullable
|
|
16
|
+
if ($.union.is(type)) {
|
|
17
|
+
const variants = Array.from(type.variants.values());
|
|
18
|
+
const nullVariant = variants.find(v => isNullType(v.type));
|
|
19
|
+
if (variants.length === 2 && nullVariant) {
|
|
20
|
+
// When the union has only null and another variant unpack the non-null type
|
|
21
|
+
return variants.find(v => v !== nullVariant).type;
|
|
22
|
+
}
|
|
23
|
+
if (variants.length > 2 && nullVariant) {
|
|
24
|
+
const nonNullVariants = variants.filter(v => v !== nullVariant);
|
|
25
|
+
return $.union.create({
|
|
26
|
+
name: type.name,
|
|
27
|
+
variants: nonNullVariants
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return type;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=unpack-model-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpack-model-property.js","names":["isNullType","$","unpackProperty","modelProperty","type","httpPart","unpack","is","union","variants","Array","from","values","nullVariant","find","v","length","nonNullVariants","filter","create","name"],"sources":["../../../../src/components/utils/unpack-model-property.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAU,QAA6B,oBAAoB;AACpE,SAASC,CAAC,QAAQ,yCAAyC;;AAE3D;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,aAA4B,EAAQ;EACjE,MAAMC,IAAI,GAAGH,CAAC,CAACI,QAAQ,CAACC,MAAM,CAACH,aAAa,CAACC,IAAI,CAAC,IAAID,aAAa,CAACC,IAAI;EACxE,IAAIH,CAAC,CAACE,aAAa,CAACI,EAAE,CAACH,IAAI,CAAC,EAAE;IAC5B,OAAOF,cAAc,CAACE,IAAI,CAAC;EAC7B;;EAEA;EACA,IAAIH,CAAC,CAACO,KAAK,CAACD,EAAE,CAACH,IAAI,CAAC,EAAE;IACpB,MAAMK,QAAQ,GAAGC,KAAK,CAACC,IAAI,CAACP,IAAI,CAACK,QAAQ,CAACG,MAAM,CAAC,CAAC,CAAC;IACnD,MAAMC,WAAW,GAAGJ,QAAQ,CAACK,IAAI,CAAEC,CAAC,IAAKf,UAAU,CAACe,CAAC,CAACX,IAAI,CAAC,CAAC;IAC5D,IAAIK,QAAQ,CAACO,MAAM,KAAK,CAAC,IAAIH,WAAW,EAAE;MACxC;MACA,OAAOJ,QAAQ,CAACK,IAAI,CAAEC,CAAC,IAAKA,CAAC,KAAKF,WAAW,CAAC,CAAET,IAAI;IACtD;IAEA,IAAIK,QAAQ,CAACO,MAAM,GAAG,CAAC,IAAIH,WAAW,EAAE;MACtC,MAAMI,eAAe,GAAGR,QAAQ,CAACS,MAAM,CAAEH,CAAC,IAAKA,CAAC,KAAKF,WAAW,CAAC;MACjE,OAAOZ,CAAC,CAACO,KAAK,CAACW,MAAM,CAAC;QAAEC,IAAI,EAAEhB,IAAI,CAACgB,IAAI;QAAEX,QAAQ,EAAEQ;MAAgB,CAAC,CAAC;IACvE;EACF;EAEA,OAAOb,IAAI;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModelProperty } from "@typespec/compiler";
|
|
2
|
+
export interface UrlTemplateProps {
|
|
3
|
+
template: string;
|
|
4
|
+
parameters: ModelProperty[];
|
|
5
|
+
}
|
|
6
|
+
export declare function UrlTemplate(props: UrlTemplateProps): import("@alloy-js/core").Children;
|
|
7
|
+
//# sourceMappingURL=url-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-template.d.ts","sourceRoot":"","sources":["../../../../src/components/utils/url-template.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qCAUlD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import * as ts from "@alloy-js/typescript";
|
|
4
|
+
import { useTransformNamePolicy } from "@typespec/emitter-framework";
|
|
5
|
+
import { uriTemplateLib } from "../external-packages/uri-template.js";
|
|
6
|
+
export function UrlTemplate(props) {
|
|
7
|
+
const namer = useTransformNamePolicy();
|
|
8
|
+
const params = props.parameters.map(p => {
|
|
9
|
+
return _$createComponent(ts.ObjectExpression, {
|
|
10
|
+
get children() {
|
|
11
|
+
return ["\"", _$memo(() => namer.getTransportName(p)), "\": ", _$memo(() => namer.getApplicationName(p))];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return _$createComponent(ts.VarDeclaration, {
|
|
16
|
+
name: "url",
|
|
17
|
+
type: "string",
|
|
18
|
+
get children() {
|
|
19
|
+
return [_$memo(() => uriTemplateLib.parse), "(", _$memo(() => JSON.stringify(props.template)), ").expand(", params, ")"];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=url-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-template.js","names":["ts","useTransformNamePolicy","uriTemplateLib","UrlTemplate","props","namer","params","parameters","map","p","_$createComponent","ObjectExpression","children","_$memo","getTransportName","getApplicationName","VarDeclaration","name","type","parse","JSON","stringify","template"],"sources":["../../../../src/components/utils/url-template.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,EAAE,MAAM,sBAAsB;AAE1C,SAASC,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,cAAc,QAAQ,sCAAsC;AAOrE,OAAO,SAASC,WAAWA,CAACC,KAAuB,EAAE;EACnD,MAAMC,KAAK,GAAGJ,sBAAsB,CAAC,CAAC;EACtC,MAAMK,MAAM,GAAGF,KAAK,CAACG,UAAU,CAACC,GAAG,CAAEC,CAAC,IAAK;IACzC,OAAAC,iBAAA,CAAQV,EAAE,CAACW,gBAAgB;MAAA,IAAAC,SAAA;QAAA,cAAAC,MAAA,OACvBR,KAAK,CAACS,gBAAgB,CAACL,CAAC,CAAC,WAAAI,MAAA,OAAKR,KAAK,CAACU,kBAAkB,CAACN,CAAC,CAAC;MAAA;IAAA;EAE/D,CAAC,CAAC;EACF,OAAAC,iBAAA,CAAQV,EAAE,CAACgB,cAAc;IAACC,IAAI;IAAOC,IAAI;IAAA,IAAAN,SAAA;MAAA,QAAAC,MAAA,OACtCX,cAAc,CAACiB,KAAK,QAAAN,MAAA,OAAGO,IAAI,CAACC,SAAS,CAACjB,KAAK,CAACkB,QAAQ,CAAC,gBAAWhB,MAAM;IAAA;EAAA;AAE3E","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentContext } from "@alloy-js/core";
|
|
2
|
+
import { EncodingDefaults } from "./types.js";
|
|
3
|
+
export declare const EncodingContext: ComponentContext<EncodingDefaults>;
|
|
4
|
+
export declare function useEncoding(): Partial<import("./types.js").ScalarEncoding>;
|
|
5
|
+
export declare function useDefaultEncoding(scalarType: keyof EncodingDefaults): string | undefined;
|
|
6
|
+
//# sourceMappingURL=encoding-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoding-context.d.ts","sourceRoot":"","sources":["../../../../src/context/encoding/encoding-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAkC,MAAM,gBAAgB,CAAC;AAIlF,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,gBAAgB,CACb,CAAC;AAEnD,wBAAgB,WAAW,iDAW1B;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAGzF"}
|