@typespec/http-client-js 0.1.0 → 0.2.0-dev.10
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/.github/copilot-instructions.md +193 -0
- package/README.md +31 -15
- package/dist/src/components/client-context/client-context-declaration.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-declaration.js.map +1 -1
- package/dist/src/components/client-context/client-context-factory.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-factory.js +7 -4
- package/dist/src/components/client-context/client-context-factory.js.map +1 -1
- package/dist/src/components/client-context/client-context-options.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-options.js +13 -9
- package/dist/src/components/client-context/client-context-options.js.map +1 -1
- package/dist/src/components/client-context/client-context.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context.js +7 -12
- package/dist/src/components/client-context/client-context.js.map +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.d.ts +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.d.ts.map +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.js +22 -13
- package/dist/src/components/client-context/parametrized-endpoint.js.map +1 -1
- package/dist/src/components/client-directory.d.ts +2 -2
- package/dist/src/components/client-directory.d.ts.map +1 -1
- package/dist/src/components/client-directory.js +33 -21
- package/dist/src/components/client-directory.js.map +1 -1
- package/dist/src/components/client-operation.d.ts.map +1 -1
- package/dist/src/components/client-operation.js +6 -6
- package/dist/src/components/client-operation.js.map +1 -1
- package/dist/src/components/client.d.ts +1 -1
- package/dist/src/components/client.d.ts.map +1 -1
- package/dist/src/components/client.js +83 -64
- package/dist/src/components/client.js.map +1 -1
- package/dist/src/components/encoding-provider.d.ts.map +1 -1
- package/dist/src/components/encoding-provider.js +0 -1
- package/dist/src/components/encoding-provider.js.map +1 -1
- package/dist/src/components/http-request-options.d.ts.map +1 -1
- package/dist/src/components/http-request-options.js +3 -3
- package/dist/src/components/http-request-options.js.map +1 -1
- package/dist/src/components/http-request-parameters-expression.d.ts +1 -2
- package/dist/src/components/http-request-parameters-expression.d.ts.map +1 -1
- package/dist/src/components/http-request-parameters-expression.js +37 -33
- package/dist/src/components/http-request-parameters-expression.js.map +1 -1
- package/dist/src/components/http-request.d.ts.map +1 -1
- package/dist/src/components/http-request.js +24 -20
- package/dist/src/components/http-request.js.map +1 -1
- package/dist/src/components/http-response.d.ts +1 -1
- package/dist/src/components/http-response.d.ts.map +1 -1
- package/dist/src/components/http-response.js +36 -33
- package/dist/src/components/http-response.js.map +1 -1
- package/dist/src/components/models.d.ts.map +1 -1
- package/dist/src/components/models.js +21 -18
- package/dist/src/components/models.js.map +1 -1
- package/dist/src/components/operation-options.d.ts.map +1 -1
- package/dist/src/components/operation-options.js +17 -14
- package/dist/src/components/operation-options.js.map +1 -1
- package/dist/src/components/output.d.ts.map +1 -1
- package/dist/src/components/output.js +2 -1
- package/dist/src/components/output.js.map +1 -1
- package/dist/src/components/serializers.d.ts.map +1 -1
- package/dist/src/components/serializers.js +21 -14
- package/dist/src/components/serializers.js.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.d.ts.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.js +2 -2
- package/dist/src/components/static-helpers/bytes-encoding.js.map +1 -1
- package/dist/src/components/static-helpers/interfaces.d.ts.map +1 -1
- package/dist/src/components/static-helpers/interfaces.js.map +1 -1
- package/dist/src/components/static-helpers/multipart-helpers.d.ts.map +1 -1
- package/dist/src/components/static-helpers/multipart-helpers.js +4 -4
- package/dist/src/components/static-helpers/multipart-helpers.js.map +1 -1
- package/dist/src/components/static-helpers/rest-error.d.ts.map +1 -1
- package/dist/src/components/static-helpers/rest-error.js +66 -57
- package/dist/src/components/static-helpers/rest-error.js.map +1 -1
- package/dist/src/components/testing/client-options.d.ts.map +1 -1
- package/dist/src/components/testing/client-options.js +0 -2
- package/dist/src/components/testing/client-options.js.map +1 -1
- package/dist/src/components/transforms/content-type-encoding-provider.d.ts.map +1 -1
- package/dist/src/components/transforms/content-type-encoding-provider.js +0 -1
- package/dist/src/components/transforms/content-type-encoding-provider.js.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.js +4 -4
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-base-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-base-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-property-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-property-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-transform.js +20 -17
- package/dist/src/components/transforms/json/json-model-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-record-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-record-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-transform-discriminator.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform-discriminator.js +5 -10
- package/dist/src/components/transforms/json/json-transform-discriminator.js.map +1 -1
- package/dist/src/components/transforms/json/json-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform.js.map +1 -1
- package/dist/src/components/transforms/json/union-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/union-transform.js +2 -2
- package/dist/src/components/transforms/json/union-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/array-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/array-part-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/file-part-transform.js +1 -1
- package/dist/src/components/transforms/multipart/file-part-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/multipart-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/multipart-transform.js +9 -6
- package/dist/src/components/transforms/multipart/multipart-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.js +23 -13
- package/dist/src/components/transforms/multipart/simple-part-transform.js.map +1 -1
- package/dist/src/components/transforms/operation-transform-declaration.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-declaration.js +2 -2
- package/dist/src/components/transforms/operation-transform-declaration.js.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.js.map +1 -1
- package/dist/src/components/utils/unpack-model-property.d.ts.map +1 -1
- package/dist/src/components/utils/unpack-model-property.js +11 -2
- package/dist/src/components/utils/unpack-model-property.js.map +1 -1
- package/dist/src/components/utils/url-template.d.ts.map +1 -1
- package/dist/src/components/utils/url-template.js.map +1 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +6 -6
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +2 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/utils/operations.d.ts +13 -1
- package/dist/src/utils/operations.d.ts.map +1 -1
- package/dist/src/utils/operations.js +71 -0
- package/dist/src/utils/operations.js.map +1 -1
- package/dist/src/utils/parameters.d.ts.map +1 -1
- package/dist/src/utils/parameters.js +1 -1
- package/dist/src/utils/parameters.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/emit-e2e.js +1 -1
- package/package.json +14 -13
- package/src/components/client-context/client-context-declaration.tsx +8 -1
- package/src/components/client-context/client-context-factory.tsx +50 -30
- package/src/components/client-context/client-context-options.tsx +13 -6
- package/src/components/client-context/client-context.tsx +5 -3
- package/src/components/client-context/parametrized-endpoint.tsx +26 -15
- package/src/components/client-directory.tsx +26 -16
- package/src/components/client-operation.tsx +24 -12
- package/src/components/client.tsx +77 -39
- package/src/components/encoding-provider.tsx +1 -3
- package/src/components/http-request-options.tsx +24 -14
- package/src/components/http-request-parameters-expression.tsx +34 -37
- package/src/components/http-request.tsx +26 -16
- package/src/components/http-response.tsx +31 -26
- package/src/components/models.tsx +18 -14
- package/src/components/operation-options.tsx +18 -5
- package/src/components/output.tsx +10 -9
- package/src/components/serializers.tsx +21 -9
- package/src/components/static-helpers/bytes-encoding.tsx +26 -8
- package/src/components/static-helpers/interfaces.tsx +14 -9
- package/src/components/static-helpers/multipart-helpers.tsx +34 -13
- package/src/components/static-helpers/rest-error.tsx +56 -18
- package/src/components/testing/client-options.tsx +0 -3
- package/src/components/transforms/content-type-encoding-provider.tsx +1 -3
- package/src/components/transforms/json/json-array-transform.tsx +6 -4
- package/src/components/transforms/json/json-model-additional-properties-transform.tsx +18 -13
- package/src/components/transforms/json/json-model-base-transform.tsx +6 -1
- package/src/components/transforms/json/json-model-property-transform.tsx +7 -9
- package/src/components/transforms/json/json-model-transform.tsx +44 -16
- package/src/components/transforms/json/json-record-transform.tsx +5 -3
- package/src/components/transforms/json/json-transform-discriminator.tsx +17 -30
- package/src/components/transforms/json/json-transform.tsx +5 -3
- package/src/components/transforms/json/union-transform.tsx +20 -8
- package/src/components/transforms/multipart/array-part-transform.tsx +6 -3
- package/src/components/transforms/multipart/file-part-transform.tsx +1 -1
- package/src/components/transforms/multipart/multipart-transform.tsx +4 -6
- package/src/components/transforms/multipart/part-transform.tsx +1 -1
- package/src/components/transforms/multipart/simple-part-transform.tsx +16 -13
- package/src/components/transforms/operation-transform-declaration.tsx +24 -7
- package/src/components/transforms/operation-transform-expression.tsx +12 -5
- package/src/components/utils/unpack-model-property.ts +13 -2
- package/src/components/utils/url-template.tsx +10 -6
- package/src/emitter.tsx +4 -3
- package/src/lib.ts +6 -1
- package/src/utils/operations.ts +96 -1
- package/src/utils/parameters.tsx +5 -1
- package/test/e2e/http/payload/multipart/main.test.ts +20 -24
- package/test/e2e/http/type/property/additional-properties/spreads.test.ts +4 -1
- package/test/scenarios/additional-properties/extends.md +0 -4
- package/test/scenarios/additional-properties/is.md +0 -4
- package/test/scenarios/additional-properties/spread.md +0 -4
- package/test/scenarios/auth/basic_auth.md +0 -1
- package/test/scenarios/auth/bearer.md +0 -1
- package/test/scenarios/auth/client_parameters.md +0 -1
- package/test/scenarios/auth/key_credential.md +0 -1
- package/test/scenarios/auth/sub_client_override.md +0 -2
- package/test/scenarios/client/dotted_namespace.md +0 -1
- package/test/scenarios/client/global_namespace.md +0 -5
- package/test/scenarios/client/multiple_top_level_clients.md +0 -2
- package/test/scenarios/client/nested_client.md +0 -2
- package/test/scenarios/encoding/bytes_body.md +0 -4
- package/test/scenarios/encoding/bytes_json_property.md +0 -5
- package/test/scenarios/encoding/bytes_nullable.md +0 -14
- package/test/scenarios/encoding/header_bytes.md +0 -12
- package/test/scenarios/encoding/header_date.md +0 -20
- package/test/scenarios/encoding/model_with_bytes_property.md +0 -5
- package/test/scenarios/encoding/query_bytes.md +0 -4
- package/test/scenarios/encoding/query_date.md +0 -20
- package/test/scenarios/http-operations/basic-request.md +0 -12
- package/test/scenarios/http-operations/basic-response.md +0 -19
- package/test/scenarios/http-operations/basic.md +0 -6
- package/test/scenarios/http-operations/constant-header.md +0 -4
- package/test/scenarios/http-operations/create-operation.md +0 -4
- package/test/scenarios/http-operations/on_response.md +0 -4
- package/test/scenarios/http-operations/optional-request-body.md +0 -5
- package/test/scenarios/http-operations/path-parameter-in-model.md +0 -4
- package/test/scenarios/http-operations/path-parameter.md +0 -4
- package/test/scenarios/http-operations/scalar-payload.md +0 -4
- package/test/scenarios/http-operations/with-parameters.md +0 -5
- package/test/scenarios/models/inheritance_2_discriminators.md +0 -24
- package/test/scenarios/models/inheritance_discriminator.md +0 -4
- package/test/scenarios/models/inline-models.md +1 -4
- package/test/scenarios/models/model_additional_properties.md +0 -4
- package/test/scenarios/models/model_extends.md +0 -4
- package/test/scenarios/models/model_spread.md +0 -2
- package/test/scenarios/models/nested_property.md +0 -4
- package/test/scenarios/models/property_references_property.md +0 -6
- package/test/scenarios/multipart/anonymous_part.md +2 -11
- package/test/scenarios/multipart/file.md +0 -12
- package/test/scenarios/multipart/file_content_type.md +15 -5
- package/test/scenarios/multipart/non-string-float.md +50 -0
- package/test/scenarios/multipart/simple_part.md +0 -4
- package/test/scenarios/operation-parameters/body_root_anonymous.md +2 -17
- package/test/scenarios/operation-parameters/constant_as_optional.md +0 -5
- package/test/scenarios/operation-parameters/default_value_as_optional.md +0 -5
- package/test/scenarios/operation-parameters/no_content_type.md +0 -5
- package/test/scenarios/operation-parameters/no_parameters.md +0 -5
- package/test/scenarios/operation-parameters/only_optional.md +0 -5
- package/test/scenarios/operation-parameters/only_required.md +0 -5
- package/test/scenarios/operation-parameters/reserved_names.md +0 -5
- package/test/scenarios/operation-parameters/spread_body.md +0 -5
- package/test/scenarios/operation-parameters/spread_with_nested.md +0 -5
- package/test/scenarios/operation-parameters/union_body.md +0 -6
- package/test/scenarios/operation-parameters/with_body_property.md +0 -5
- package/test/scenarios/operation-parameters/with_body_root.md +0 -5
- package/test/scenarios/serializers/arrays.md +0 -8
- package/test/scenarios/serializers/basic_model.md +0 -4
- package/test/scenarios/serializers/basic_model_wire_name.md +0 -2
- package/test/scenarios/serializers/discriminated_union.md +1 -1
- package/test/scenarios/serializers/discriminated_union_spread.md +1 -5
- package/test/scenarios/serializers/multipart.md +0 -4
- package/test/scenarios/serializers/polymorphic_single_level_inheritance.md +0 -5
- package/test/scenarios/serializers/property_references_property.md +72 -0
- package/test/scenarios/serializers/record.md +0 -4
- package/test/scenarios/serializers/scalars.md +0 -5
- package/test/scenarios/serializers/spread.md +0 -4
- package/test/scenarios/serializers/string_union.md +0 -4
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
> **Scope**: These instructions apply **only** to the `packages/http-client-js` sub-project in this monorepo. Use them whenever Copilot generates code, tests, commit messages, or pull request descriptions for the emitter. If Copilot is used in other sub-projects, these rules do not apply unless stated otherwise.
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 1. Code Generation Instructions
|
|
6
|
+
|
|
7
|
+
- **Project Purpose**
|
|
8
|
+
We are building a TypeSpec Emitter that generates JavaScript (TypeScript) HTTP clients.
|
|
9
|
+
|
|
10
|
+
- **Language & Modules**
|
|
11
|
+
|
|
12
|
+
- Always generate TypeScript using **ES Modules**.
|
|
13
|
+
- Do **not** use `require` or `__dirname`.
|
|
14
|
+
- Do **not** introduce new dependencies or frameworks without explicit approval.
|
|
15
|
+
|
|
16
|
+
- **Core Stack**
|
|
17
|
+
|
|
18
|
+
1. **TypeSpec Compiler & Libraries**
|
|
19
|
+
- `@typespec/compiler`, `@typespec/http`, `@typespec/emitter-framework`, `@typespec/http-client`
|
|
20
|
+
- Activate typekits by importing:
|
|
21
|
+
```ts
|
|
22
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
23
|
+
import "@typespec/http/experimental/typekit";
|
|
24
|
+
```
|
|
25
|
+
2. **Alloy-JS**
|
|
26
|
+
- `@alloy-js/core` + `@alloy-js/typescript` for templating code with JSX-like syntax.
|
|
27
|
+
- **`@typespec/emitter-framework/typescript`** offers higher-level React-like components (e.g., `<ef.InterfaceDeclaration type={model} />`) for converting TypeSpec types to TypeScript code.
|
|
28
|
+
3. **No React**
|
|
29
|
+
- Alloy-JS syntax **resembles** React but is implemented independently. Don’t import React libraries.
|
|
30
|
+
|
|
31
|
+
- **Emitter Implementation**
|
|
32
|
+
|
|
33
|
+
- Implement `$onEmit` to hook into TypeSpec’s compiler. For example:
|
|
34
|
+
```ts
|
|
35
|
+
export async function $onEmit(program: Program, emitterOptions: MyEmitterOptions) {
|
|
36
|
+
// Query the type graph using program.checker, typekits, etc.
|
|
37
|
+
// Generate TypeScript code using Alloy-JS.
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
- Parse TypeSpec’s type graph to gather HTTP metadata (e.g., operations, models) and emit TypeScript code using Alloy-JS components.
|
|
41
|
+
|
|
42
|
+
- **Coding Style**
|
|
43
|
+
- Follow **SOLID** and **KISS** principles.
|
|
44
|
+
- Use TypeScript best practices; keep your code readable and reusable.
|
|
45
|
+
- Write **JSDoc** for public/exported functions or classes.
|
|
46
|
+
- Add inline comments for non-obvious logic or design decisions.
|
|
47
|
+
- Favor clarity over cleverness, particularly for new developer onboarding.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2. Test Generation Instructions
|
|
52
|
+
|
|
53
|
+
- **Test Format**
|
|
54
|
+
|
|
55
|
+
- Use **literate tests** in Markdown files under `test/scenarios/**/*.md`.
|
|
56
|
+
- Each test file typically has:
|
|
57
|
+
1. `# [TestTitle]`: High-level description of the scenario being tested.
|
|
58
|
+
2. `## Spec`: Contains a TypeSpec snippet as input for the emitter.
|
|
59
|
+
3. `## [Test Expectation]`: Contains code blocks showing the _expected_ generated code.
|
|
60
|
+
|
|
61
|
+
- **Example**
|
|
62
|
+
|
|
63
|
+
```md
|
|
64
|
+
# [MyTest]
|
|
65
|
+
|
|
66
|
+
Tests generating a client for a simple model.
|
|
67
|
+
|
|
68
|
+
## Spec
|
|
69
|
+
|
|
70
|
+
\`\`\`tsp
|
|
71
|
+
namespace Test;
|
|
72
|
+
model Foo { name: string; }
|
|
73
|
+
@get op getFoo(): Foo;
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
## [Test Expectation]
|
|
77
|
+
|
|
78
|
+
\`\`\`ts path/to/generated.ts function jsonFooToTransportTransform
|
|
79
|
+
export function jsonFooToTransportTransform(input: Foo) {
|
|
80
|
+
// This is the expected code snippet
|
|
81
|
+
}
|
|
82
|
+
\`\`\`
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- **Implementation**
|
|
86
|
+
|
|
87
|
+
- Use the `@typespec/emitter-framework` test harness to process these `.md` files and validate generated outputs.
|
|
88
|
+
- Do **not** add extra test libraries (e.g., Jest, Mocha). The built-in harness is sufficient.
|
|
89
|
+
|
|
90
|
+
- There should only be a single tsp code block per h1 (#) heading.
|
|
91
|
+
- H1 Headings translate to describe blocks in vitest
|
|
92
|
+
- ts codeblocks translate to it blocks in vitest.
|
|
93
|
+
- !NEVER modify existing ts or tsp code blocks
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 3. Code Review Instructions
|
|
98
|
+
|
|
99
|
+
- **Review Criteria**
|
|
100
|
+
|
|
101
|
+
- Confirm ES Module usage (no `require`).
|
|
102
|
+
- Check that code remains **SOLID** and not over-engineered.
|
|
103
|
+
- Ensure public functions are documented with JSDoc.
|
|
104
|
+
- Verify usage of the correct TypeSpec or Alloy-JS APIs (e.g., `$onEmit`, `<ef.InterfaceDeclaration>`, etc.).
|
|
105
|
+
- If logic is complex, suggest more inline comments or a concise doc block.
|
|
106
|
+
|
|
107
|
+
- **No Unauthorized Dependencies**
|
|
108
|
+
- Code reviewers should flag any added libraries or frameworks without explicit approval.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 4. Commit Message Generation
|
|
113
|
+
|
|
114
|
+
- **Format**
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
<type>(<scope>): <description>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Examples:
|
|
121
|
+
|
|
122
|
+
- `feat(emitter): add support for generating query parameters`
|
|
123
|
+
- `fix(api): handle empty model in TypeSpec`
|
|
124
|
+
|
|
125
|
+
- **Scopes**
|
|
126
|
+
|
|
127
|
+
- `emitter` for changes in emitter code
|
|
128
|
+
- `compiler` for changes in TypeSpec compiler logic
|
|
129
|
+
- `test` for changes to the literate tests
|
|
130
|
+
|
|
131
|
+
- **Automation & Strictness**
|
|
132
|
+
- Copilot may suggest commit messages, but they **must** follow this conventional format.
|
|
133
|
+
- Keep commit messages self-contained (no external links).
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 5. Pull Request Title & Description
|
|
138
|
+
|
|
139
|
+
- **Title**
|
|
140
|
+
- Same format as commits: `<type>(<scope>): <description>`.
|
|
141
|
+
- **Body**
|
|
142
|
+
|
|
143
|
+
1. **Why** this change is needed
|
|
144
|
+
2. **What** has changed
|
|
145
|
+
3. **How** to test or verify (if relevant)
|
|
146
|
+
4. **Implications** on emitter output or user-facing APIs
|
|
147
|
+
|
|
148
|
+
- **Keep it Brief**
|
|
149
|
+
- Provide enough context for the reviewer without unnecessary details.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 6. Context Management
|
|
154
|
+
|
|
155
|
+
- **Random Emoji**
|
|
156
|
+
- Prepend a random emoji at the beginning of **every** generated response.
|
|
157
|
+
- **Summaries**
|
|
158
|
+
- Periodically generate concise summaries of progress or changes.
|
|
159
|
+
- Write or append these summaries to `.github/context/[timestamp]-context-summary.md`.
|
|
160
|
+
- **No Additional Dependencies**
|
|
161
|
+
|
|
162
|
+
- Implement emoji generation or summary logic with built-in JS features only.
|
|
163
|
+
|
|
164
|
+
***
|
|
165
|
+
|
|
166
|
+
## 7. Debugging and Troubleshooting
|
|
167
|
+
|
|
168
|
+
- **TypeSpec Type System**
|
|
169
|
+
|
|
170
|
+
- When investigating issues, understand that TypeSpec has a complex type system with these key concepts:
|
|
171
|
+
- **Type References**: Types can reference other types (e.g., `ModelProperty` can reference another `ModelProperty`)
|
|
172
|
+
- **Type Unpacking**: Many types need to be "unpacked" to get their underlying type (e.g., `HttpPart`, `ModelProperty`, etc.)
|
|
173
|
+
- **Typekits**: Use `$` from `@typespec/compiler/experimental/typekit` to check type kinds (e.g., `$.modelProperty.is()`)
|
|
174
|
+
|
|
175
|
+
- **Common Transformation Patterns**
|
|
176
|
+
|
|
177
|
+
- Transforms like `JsonTransform` have this general flow:
|
|
178
|
+
1. Check for a declared transform reference
|
|
179
|
+
2. Switch on the type kind (Model, Union, ModelProperty, etc.)
|
|
180
|
+
3. Route to the appropriate specialized transform
|
|
181
|
+
4. Generate code with property accessors
|
|
182
|
+
|
|
183
|
+
- **Debugging Strategies**
|
|
184
|
+
|
|
185
|
+
- **Type Inspection**: For type-related bugs, check what the actual TypeSpec type is at each step
|
|
186
|
+
- **Transform Chain**: Follow the transformation chain from root component to leaf components
|
|
187
|
+
- **Recursive Handling**: Pay special attention to places where types are handled recursively
|
|
188
|
+
- **Edge Cases**: Look for special cases like nullable types, union types, and type references
|
|
189
|
+
|
|
190
|
+
- **Common Issues**
|
|
191
|
+
- **Duplicated Properties**: Check property reference resolution in transforms
|
|
192
|
+
- **Missing Properties**: Verify type unpacking is complete at all points
|
|
193
|
+
- **Type Mismatches**: Ensure the right transform is being selected for each type kind
|
package/README.md
CHANGED
|
@@ -1,26 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @typespec/http-client-js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeSpec library for emitting Http Client libraries for JavaScript/TypeScript
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @typespec/http-client-js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
- **Type:** `boolean`
|
|
11
|
-
- **Default:** `false`
|
|
12
|
-
- **Description:** When set to `true`, enables testing-specific options in the TypeSpec JavaScript emitter. This is used to configure the client for testing purposes, such as allowing insecure connections and setting retry options.
|
|
13
|
+
1. Via the command line
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
```bash
|
|
16
|
+
tsp compile . --emit=@typespec/http-client-js
|
|
17
|
+
```
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
2. Via the config
|
|
17
20
|
|
|
18
|
-
```
|
|
19
|
-
|
|
21
|
+
```yaml
|
|
22
|
+
emit:
|
|
23
|
+
- "@typespec/http-client-js"
|
|
20
24
|
```
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
The config can be extended with options as follows:
|
|
23
27
|
|
|
24
|
-
```
|
|
25
|
-
|
|
28
|
+
```yaml
|
|
29
|
+
emit:
|
|
30
|
+
- "@typespec/http-client-js"
|
|
31
|
+
options:
|
|
32
|
+
"@typespec/http-client-js":
|
|
33
|
+
option: value
|
|
26
34
|
```
|
|
35
|
+
|
|
36
|
+
## Emitter options
|
|
37
|
+
|
|
38
|
+
### `package-name`
|
|
39
|
+
|
|
40
|
+
**Type:** `string`
|
|
41
|
+
|
|
42
|
+
Name of the package as it will be in package.json
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context-declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG5C,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAE/D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,
|
|
1
|
+
{"version":3,"file":"client-context-declaration.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-declaration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG5C,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAE/D;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,eAY5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context-declaration.js","names":["ay","ts","httpRuntimeTemplateLib","getClientcontextDeclarationRef","client","refkey","ClientContextDeclaration","props","ref","namePolicy","useTSNamePolicy","name","getName","_$createComponent","InterfaceDeclaration","extends","Client"],"sources":["../../../../src/components/client-context/client-context-declaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,sBAAsB,QAAQ,yCAAyC;AAMhF,OAAO,SAASC,8BAA8BA,CAACC,MAAiB,EAAE;EAChE,OAAOJ,EAAE,CAACK,MAAM,CAACD,MAAM,EAAE,aAAa,CAAC;AACzC;AAEA,OAAO,SAASE,wBAAwBA,CAACC,KAAoC,EAAE;EAC7E,MAAMC,GAAG,GAAGL,8BAA8B,CAACI,KAAK,CAACH,MAAM,CAAC;EACxD,MAAMK,UAAU,GAAGR,EAAE,CAACS,eAAe,CAAC,CAAC;EACvC,MAAMC,IAAI,GAAGF,UAAU,CAACG,OAAO,CAAC,GAAGL,KAAK,CAACH,MAAM,CAACO,IAAI,SAAS,EAAE,OAAO,CAAC;EACvE,OAAAE,iBAAA,
|
|
1
|
+
{"version":3,"file":"client-context-declaration.js","names":["ay","ts","httpRuntimeTemplateLib","getClientcontextDeclarationRef","client","refkey","ClientContextDeclaration","props","ref","namePolicy","useTSNamePolicy","name","getName","_$createComponent","InterfaceDeclaration","extends","Client"],"sources":["../../../../src/components/client-context/client-context-declaration.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,sBAAsB,QAAQ,yCAAyC;AAMhF,OAAO,SAASC,8BAA8BA,CAACC,MAAiB,EAAE;EAChE,OAAOJ,EAAE,CAACK,MAAM,CAACD,MAAM,EAAE,aAAa,CAAC;AACzC;AAEA,OAAO,SAASE,wBAAwBA,CAACC,KAAoC,EAAE;EAC7E,MAAMC,GAAG,GAAGL,8BAA8B,CAACI,KAAK,CAACH,MAAM,CAAC;EACxD,MAAMK,UAAU,GAAGR,EAAE,CAACS,eAAe,CAAC,CAAC;EACvC,MAAMC,IAAI,GAAGF,UAAU,CAACG,OAAO,CAAC,GAAGL,KAAK,CAACH,MAAM,CAACO,IAAI,SAAS,EAAE,OAAO,CAAC;EACvE,OAAAE,iBAAA,CACGZ,EAAE,CAACa,oBAAoB;IAAA;IAEtBH,IAAI,EAAEA,IAAI;IACVN,MAAM,EAAEG,GAAG;IAAA,eAAAO,CAAA;MAAA,OACFb,sBAAsB,CAACc,MAAM;IAAA;EAAA;AAG5C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context-factory.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQ5C,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAE3D;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"client-context-factory.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQ5C,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAE3D;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,yBAAyB,eA8C/E"}
|
|
@@ -53,8 +53,8 @@ export function ClientContextFactoryDeclaration(props) {
|
|
|
53
53
|
parametersMode: "replace",
|
|
54
54
|
parameters: parameters,
|
|
55
55
|
get children() {
|
|
56
|
-
return [resolvedEndpoint, "
|
|
57
|
-
get
|
|
56
|
+
return [resolvedEndpoint, "return ", _$createComponent(ts.FunctionCallExpression, {
|
|
57
|
+
get target() {
|
|
58
58
|
return httpRuntimeTemplateLib.getClient;
|
|
59
59
|
},
|
|
60
60
|
args: [args]
|
|
@@ -145,8 +145,11 @@ function ClientOptionsExpression(props) {
|
|
|
145
145
|
}
|
|
146
146
|
return _$createComponent(ts.ObjectExpression, {
|
|
147
147
|
get children() {
|
|
148
|
-
return ay.
|
|
149
|
-
|
|
148
|
+
return _$createComponent(ay.For, {
|
|
149
|
+
each: options,
|
|
150
|
+
joiner: ",",
|
|
151
|
+
line: true,
|
|
152
|
+
children: child => child
|
|
150
153
|
});
|
|
151
154
|
}
|
|
152
155
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context-factory.js","names":["ay","ts","$","FunctionDeclaration","reportDiagnostic","buildClientParameters","httpRuntimeTemplateLib","addClientTestOptions","getClientcontextDeclarationRef","ParametrizedEndpoint","getClientContextFactoryRef","client","refkey","ClientContextFactoryDeclaration","props","ref","contextDeclarationRef","namePolicy","useTSNamePolicy","factoryFunctionName","getName","name","clientConstructor","getConstructor","parameters","urlTemplate","getUrlTemplate","endpointRef","resolvedEndpoint","_$createComponent","template","url","params","credentialsRef","properties","has","args","ClientFactoryArguments","type","returnType","parametersMode","children","FunctionCallExpression","getClient","_$memo","push","ClientOptionsExpression","CredentialOptions","clientCredential","getAuth","schemes","length","program","code","
|
|
1
|
+
{"version":3,"file":"client-context-factory.js","names":["ay","ts","$","FunctionDeclaration","reportDiagnostic","buildClientParameters","httpRuntimeTemplateLib","addClientTestOptions","getClientcontextDeclarationRef","ParametrizedEndpoint","getClientContextFactoryRef","client","refkey","ClientContextFactoryDeclaration","props","ref","contextDeclarationRef","namePolicy","useTSNamePolicy","factoryFunctionName","getName","name","clientConstructor","getConstructor","parameters","urlTemplate","getUrlTemplate","endpointRef","resolvedEndpoint","_$createComponent","template","url","params","credentialsRef","properties","has","args","ClientFactoryArguments","type","returnType","parametersMode","children","FunctionCallExpression","target","getClient","_$memo","push","ClientOptionsExpression","CredentialOptions","clientCredential","getAuth","schemes","length","program","code","scheme","ObjectProperty","ObjectExpression","jsValue","in","service","options","Array","isArray","For","each","joiner","line","child"],"sources":["../../../../src/components/client-context/client-context-factory.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAC1C,SAASC,CAAC,QAAQ,yCAAyC;AAC3D,SAASC,mBAAmB,QAAQ,wCAAwC;AAE5E,SAASC,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,qBAAqB;AAC9B,SAASC,sBAAsB,QAAQ,yCAAyC;AAChF,SAASC,oBAAoB;AAC7B,SAASC,8BAA8B;AACvC,SAASC,oBAAoB;AAM7B,OAAO,SAASC,0BAA0BA,CAACC,MAAiB,EAAE;EAC5D,OAAOX,EAAE,CAACY,MAAM,CAACD,MAAM,EAAE,gBAAgB,CAAC;AAC5C;AAEA,OAAO,SAASE,+BAA+BA,CAACC,KAAgC,EAAE;EAChF,MAAMC,GAAG,GAAGL,0BAA0B,CAACI,KAAK,CAACH,MAAM,CAAC;EACpD,MAAMK,qBAAqB,GAAGR,8BAA8B,CAACM,KAAK,CAACH,MAAM,CAAC;EAC1E,MAAMM,UAAU,GAAGhB,EAAE,CAACiB,eAAe,CAAC,CAAC;EACvC,MAAMC,mBAAmB,GAAGF,UAAU,CAACG,OAAO,CAAC,UAAUN,KAAK,CAACH,MAAM,CAACU,IAAI,SAAS,EAAE,UAAU,CAAC;EAEhG,MAAMC,iBAAiB,GAAGpB,CAAC,CAACS,MAAM,CAACY,cAAc,CAACT,KAAK,CAACH,MAAM,CAAC;EAC/D,MAAMa,UAAU,GAAGnB,qBAAqB,CAACS,KAAK,CAACH,MAAM,CAAC;EACtD,MAAMc,WAAW,GAAGvB,CAAC,CAACS,MAAM,CAACe,cAAc,CAACZ,KAAK,CAACH,MAAM,CAAC;EACzD,MAAMgB,WAAW,GAAG3B,EAAE,CAAC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oot":"","sources":["../../../../src/components/client-context/client-context-options.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG5C,MAAM,WAAW,oCAAoC;IACnD,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAE3D;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,
|
|
1
|
+
{"version":3,"file":"client-context-options.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context-options.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG5C,MAAM,WAAW,oCAAoC;IACnD,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAE3D;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,eAqB1F"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
2
|
import * as ay from "@alloy-js/core";
|
|
4
3
|
import * as ts from "@alloy-js/typescript";
|
|
5
4
|
import { httpRuntimeTemplateLib } from "../external-packages/ts-http-runtime.js";
|
|
@@ -25,17 +24,22 @@ export function ClientContextOptionsDeclaration(props) {
|
|
|
25
24
|
});
|
|
26
25
|
},
|
|
27
26
|
get children() {
|
|
28
|
-
return [_$
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
return [_$createComponent(ay.For, {
|
|
28
|
+
get each() {
|
|
29
|
+
return Array.from(clientOptions.entries());
|
|
30
|
+
},
|
|
31
|
+
semicolon: true,
|
|
32
|
+
line: true,
|
|
33
|
+
children: ([key, value]) => _$createComponent(ts.InterfaceMember, {
|
|
34
|
+
optional: true,
|
|
35
|
+
name: key,
|
|
36
|
+
type: value
|
|
37
|
+
})
|
|
38
|
+
}), _$createComponent(ts.InterfaceMember, {
|
|
35
39
|
optional: true,
|
|
36
40
|
name: "endpoint",
|
|
37
41
|
type: "string"
|
|
38
|
-
})];
|
|
42
|
+
}), ";"];
|
|
39
43
|
}
|
|
40
44
|
});
|
|
41
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context-options.js","names":["ay","ts","httpRuntimeTemplateLib","getClientContextOptionsRef","client","refkey","ClientContextOptionsDeclaration","props","ref","namePolicy","useTSNamePolicy","name","getName","clientOptions","Map","_$createComponent","InterfaceDeclaration","extends","Reference","ClientOptions","children","
|
|
1
|
+
{"version":3,"file":"client-context-options.js","names":["ay","ts","httpRuntimeTemplateLib","getClientContextOptionsRef","client","refkey","ClientContextOptionsDeclaration","props","ref","namePolicy","useTSNamePolicy","name","getName","clientOptions","Map","_$createComponent","InterfaceDeclaration","extends","Reference","ClientOptions","children","For","each","Array","from","entries","semicolon","line","key","value","InterfaceMember","optional","type"],"sources":["../../../../src/components/client-context/client-context-options.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,sBAAsB,QAAQ,yCAAyC;AAMhF,OAAO,SAASC,0BAA0BA,CAACC,MAAiB,EAAE;EAC5D,OAAOJ,EAAE,CAACK,MAAM,CAACD,MAAM,EAAE,SAAS,CAAC;AACrC;AAEA,OAAO,SAASE,+BAA+BA,CAACC,KAA2C,EAAE;EAC3F,MAAMC,GAAG,GAAGL,0BAA0B,CAACI,KAAK,CAACH,MAAM,CAAC;EACpD,MAAMK,UAAU,GAAGR,EAAE,CAACS,eAAe,CAAC,CAAC;EACvC,MAAMC,IAAI,GAAGF,UAAU,CAACG,OAAO,CAAC,GAAGL,KAAK,CAACH,MAAM,CAACO,IAAI,SAAS,EAAE,WAAW,CAAC;;EAE3E;EACA,MAAME,aAAuC,GAAG,IAAIC,GAAG,CAAC,CAAC;EAEzD,OAAAC,iBAAA,CACGd,EAAE,CAACe,oBAAoB;IAAA;IAEtBL,IAAI,EAAEA,IAAI;IACVN,MAAM,EAAEG,GAAG;IAAA,eAAAS,CAAA;MAAA,OAAAF,iBAAA,CACDd,EAAE,CAACiB,SAAS;QAAA,IAACb,MAAMA,CAAA;UAAA,OAAEH,sBAAsB,CAACiB,aAAa;QAAA;MAAA;IAAA;IAAA,IAAAC,SAAA;MAAA,QAAAL,iBAAA,CAElEf,EAAE,CAACqB,GAAG;QAAA,IAACC,IAAIA,CAAA;UAAA,OAAEC,KAAK,CAACC,IAAI,CAACX,aAAa,CAACY,OAAO,CAAC,CAAC,CAAC;QAAA;QAAEC,SAAS;QAACC,IAAI;QAAAP,QAAA,EAC9DA,CAAC,CAACQ,GAAG,EAAEC,KAAK,CAAC,KAAAd,iBAAA,CAAMd,EAAE,CAAC6B,eAAe;UAACC,QAAQ;UAACpB,IAAI,EAAEiB,GAAG;UAAEI,IAAI,EAAEH;QAAK;MAAI,IAAAd,iBAAA,CAE3Ed,EAAE,CAAC6B,eAAe;QAACC,QAAQ;QAACpB,IAAI;QAAYqB,IAAI;MAAA;IAAA;EAAA;AAGvD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK5C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"client-context.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/client-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK5C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAUtD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Indent as _$Indent } from "@alloy-js/core";
|
|
3
2
|
import * as ts from "@alloy-js/typescript";
|
|
4
3
|
import { ClientContextDeclaration } from "./client-context-declaration.js";
|
|
5
4
|
import { ClientContextFactoryDeclaration } from "./client-context-factory.js";
|
|
@@ -14,17 +13,13 @@ export function ClientContext(props) {
|
|
|
14
13
|
get client() {
|
|
15
14
|
return props.client;
|
|
16
15
|
}
|
|
17
|
-
}), _$createComponent(
|
|
18
|
-
get
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
get client() {
|
|
25
|
-
return props.client;
|
|
26
|
-
}
|
|
27
|
-
})];
|
|
16
|
+
}), _$createComponent(ClientContextOptionsDeclaration, {
|
|
17
|
+
get client() {
|
|
18
|
+
return props.client;
|
|
19
|
+
}
|
|
20
|
+
}), _$createComponent(ClientContextFactoryDeclaration, {
|
|
21
|
+
get client() {
|
|
22
|
+
return props.client;
|
|
28
23
|
}
|
|
29
24
|
})];
|
|
30
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-context.js","names":["ts","ClientContextDeclaration","ClientContextFactoryDeclaration","ClientContextOptionsDeclaration","ClientContext","props","namePolicy","useTSNamePolicy","fileName","getName","client","name","_$createComponent","SourceFile","path","children"
|
|
1
|
+
{"version":3,"file":"client-context.js","names":["ts","ClientContextDeclaration","ClientContextFactoryDeclaration","ClientContextOptionsDeclaration","ClientContext","props","namePolicy","useTSNamePolicy","fileName","getName","client","name","_$createComponent","SourceFile","path","children"],"sources":["../../../../src/components/client-context/client-context.tsx"],"sourcesContent":[null],"mappings":";AACA,OAAO,KAAKA,EAAE,MAAM,sBAAsB;AAE1C,SAASC,wBAAwB;AACjC,SAASC,+BAA+B;AACxC,SAASC,+BAA+B;AAOxC,OAAO,SAASC,aAAaA,CAACC,KAAyB,EAAE;EACvD,MAAMC,UAAU,GAAGN,EAAE,CAACO,eAAe,CAAC,CAAC;EACvC,MAAMC,QAAQ,GAAGF,UAAU,CAACG,OAAO,CAACJ,KAAK,CAACK,MAAM,CAACC,IAAI,GAAG,SAAS,EAAE,UAAU,CAAC;EAC9E,OAAAC,iBAAA,CACGZ,EAAE,CAACa,UAAU;IAACC,IAAI,EAAE,GAAGN,QAAQ,KAAK;IAAA,IAAAO,SAAA;MAAA,QAAAH,iBAAA,CAClCX,wBAAwB;QAAA,IAACS,MAAMA,CAAA;UAAA,OAAEL,KAAK,CAACK,MAAM;QAAA;MAAA,IAAAE,iBAAA,CAC7CT,+BAA+B;QAAA,IAACO,MAAMA,CAAA;UAAA,OAAEL,KAAK,CAACK,MAAM;QAAA;MAAA,IAAAE,iBAAA,CACpDV,+BAA+B;QAAA,IAACQ,MAAMA,CAAA;UAAA,OAAEL,KAAK,CAACK,MAAM;QAAA;MAAA;IAAA;EAAA;AAG3D","ignoreList":[]}
|
|
@@ -5,5 +5,5 @@ export interface ParametrizedEndpointProps {
|
|
|
5
5
|
template: string;
|
|
6
6
|
params: ModelProperty[];
|
|
7
7
|
}
|
|
8
|
-
export declare function ParametrizedEndpoint(props: ParametrizedEndpointProps): ay.Children
|
|
8
|
+
export declare function ParametrizedEndpoint(props: ParametrizedEndpointProps): ay.Children;
|
|
9
9
|
//# sourceMappingURL=parametrized-endpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parametrized-endpoint.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/parametrized-endpoint.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"parametrized-endpoint.d.ts","sourceRoot":"","sources":["../../../../src/components/client-context/parametrized-endpoint.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eAqCpE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
1
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
3
|
import * as ay from "@alloy-js/core";
|
|
4
4
|
import * as ts from "@alloy-js/typescript";
|
|
5
5
|
import { useTransformNamePolicy } from "@typespec/emitter-framework";
|
|
@@ -14,17 +14,22 @@ export function ParametrizedEndpoint(props) {
|
|
|
14
14
|
get children() {
|
|
15
15
|
return _$createComponent(ts.ObjectExpression, {
|
|
16
16
|
get children() {
|
|
17
|
-
return ay.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
return _$createComponent(ay.For, {
|
|
18
|
+
get each() {
|
|
19
|
+
return props.params;
|
|
20
|
+
},
|
|
21
|
+
joiner: ",",
|
|
22
|
+
line: true,
|
|
23
|
+
children: p => {
|
|
24
|
+
const applicationName = propNamer.getApplicationName(p);
|
|
25
|
+
const transportName = propNamer.getTransportName(p);
|
|
26
|
+
const defaultValue = p.defaultValue ? ` ?? ${getDefaultValue(p)}` : "";
|
|
27
|
+
const itemRef = p.optional ? `options?.${applicationName}${defaultValue}` : applicationName;
|
|
28
|
+
return _$createComponent(ts.ObjectProperty, {
|
|
29
|
+
name: transportName,
|
|
30
|
+
value: itemRef
|
|
31
|
+
});
|
|
32
|
+
}
|
|
28
33
|
});
|
|
29
34
|
}
|
|
30
35
|
});
|
|
@@ -43,6 +48,10 @@ export function ParametrizedEndpoint(props) {
|
|
|
43
48
|
`;
|
|
44
49
|
}
|
|
45
50
|
});
|
|
46
|
-
return
|
|
51
|
+
return _$createComponent(ay.StatementList, {
|
|
52
|
+
get children() {
|
|
53
|
+
return [params, resolvedEndpoint];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
47
56
|
}
|
|
48
57
|
//# sourceMappingURL=parametrized-endpoint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parametrized-endpoint.js","names":["ay","ts","useTransformNamePolicy","getDefaultValue","ParametrizedEndpoint","props","propNamer","paramsRef","refkey","params","_$createComponent","VarDeclaration","name","type","children","ObjectExpression","
|
|
1
|
+
{"version":3,"file":"parametrized-endpoint.js","names":["ay","ts","useTransformNamePolicy","getDefaultValue","ParametrizedEndpoint","props","propNamer","paramsRef","refkey","params","_$createComponent","VarDeclaration","name","type","children","ObjectExpression","For","each","joiner","line","p","applicationName","getApplicationName","transportName","getTransportName","defaultValue","itemRef","optional","ObjectProperty","value","resolvedEndpoint","code","template","StatementList"],"sources":["../../../../src/components/client-context/parametrized-endpoint.tsx"],"sourcesContent":[null],"mappings":";;AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,eAAe;AAQxB,OAAO,SAASC,oBAAoBA,CAACC,KAAgC,EAAE;EACrE,MAAMC,SAAS,GAAGJ,sBAAsB,CAAC,CAAC;EAC1C,MAAMK,SAAS,GAAGP,EAAE,CAACQ,MAAM,CAAC,CAAC;EAC7B,MAAMC,MAAM,GAAAC,iBAAA,CACTT,EAAE,CAACU,cAAc;IAACC,IAAI;IAAUC,IAAI,EAAE,qBAAqB;IAAEL,MAAM,EAAED,SAAS;IAAA,IAAAO,SAAA;MAAA,OAAAJ,iBAAA,CAC5ET,EAAE,CAACc,gBAAgB;QAAA,IAAAD,SAAA;UAAA,OAAAJ,iBAAA,CACjBV,EAAE,CAACgB,GAAG;YAAA,IAACC,IAAIA,CAAA;cAAA,OAAEZ,KAAK,CAACI,MAAM;YAAA;YAAES,MAAM;YAAKC,IAAI;YAAAL,QAAA,EACvCM,CAAC,IAAK;cACN,MAAMC,eAAe,GAAGf,SAAS,CAACgB,kBAAkB,CAACF,CAAC,CAAC;cACvD,MAAMG,aAAa,GAAGjB,SAAS,CAACkB,gBAAgB,CAACJ,CAAC,CAAC;cACnD,MAAMK,YAAY,GAAGL,CAAC,CAACK,YAAY,GAAG,OAAOtB,eAAe,CAACiB,CAAC,CAAC,EAAE,GAAG,EAAE;cACtE,MAAMM,OAAO,GAAGN,CAAC,CAACO,QAAQ,GACtB,YAAYN,eAAe,GAAGI,YAAY,EAAE,GAC5CJ,eAAe;cACnB,OAAAX,iBAAA,CAAQT,EAAE,CAAC2B,cAAc;gBAAChB,IAAI,EAAEW,aAAa;gBAAEM,KAAK,EAAEH;cAAO;YAC/D;UAAC;QAAA;MAAA;IAAA;EAAA,EAIR;EAED,MAAMI,gBAAgB,GAAApB,iBAAA,CACnBT,EAAE,CAACU,cAAc;IAACC,IAAI;IAAA,IAAoBJ,MAAMA,CAAA;MAAA,OAAEH,KAAK,CAACG,MAAM;IAAA;IAAA,IAAAM,SAAA;MAAA,OAC5Dd,EAAE,CAAC+B,IAAI;AACd,SAAS1B,KAAK,CAAC2B,QAAQ;AACvB,iBAAiBzB,SAAS;AAC1B;AACA,KAAK;IAAA;EAAA,EAEF;EAED,OAAAG,iBAAA,CACGV,EAAE,CAACiC,aAAa;IAAA,IAAAnB,SAAA;MAAA,QACdL,MAAM,EACNqB,gBAAgB;IAAA;EAAA;AAGvB","ignoreList":[]}
|
|
@@ -3,9 +3,9 @@ import * as cl from "@typespec/http-client";
|
|
|
3
3
|
export interface OperationsDirectoryProps {
|
|
4
4
|
children?: ay.Children;
|
|
5
5
|
}
|
|
6
|
-
export declare function OperationsDirectory(props: OperationsDirectoryProps): ay.Children
|
|
6
|
+
export declare function OperationsDirectory(props: OperationsDirectoryProps): ay.Children;
|
|
7
7
|
export interface SubClientsProps {
|
|
8
8
|
client: cl.Client;
|
|
9
9
|
}
|
|
10
|
-
export declare function SubClients(props: SubClientsProps): ay.Children
|
|
10
|
+
export declare function SubClients(props: SubClientsProps): ay.Children;
|
|
11
11
|
//# sourceMappingURL=client-directory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-directory.d.ts","sourceRoot":"","sources":["../../../src/components/client-directory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK5C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"client-directory.d.ts","sourceRoot":"","sources":["../../../src/components/client-directory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAK5C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAclE;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAkBhD"}
|
|
@@ -9,31 +9,43 @@ export function OperationsDirectory(props) {
|
|
|
9
9
|
topLevel: clients
|
|
10
10
|
} = useClientLibrary();
|
|
11
11
|
// If it is the root client, we don't need to create a directory
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
client: client
|
|
18
|
-
})]);
|
|
19
|
-
}
|
|
20
|
-
export function SubClients(props) {
|
|
21
|
-
const subClients = props.client.subClients;
|
|
22
|
-
return ay.mapJoin(subClients, subClient => {
|
|
23
|
-
const namePolicy = ts.useTSNamePolicy();
|
|
24
|
-
const subClientName = namePolicy.getName(subClient.name, "variable");
|
|
25
|
-
return _$createComponent(ay.SourceDirectory, {
|
|
26
|
-
path: subClientName,
|
|
12
|
+
return _$createComponent(ay.For, {
|
|
13
|
+
each: clients,
|
|
14
|
+
joiner: ",",
|
|
15
|
+
line: true,
|
|
16
|
+
children: client => _$createComponent(ay.StatementList, {
|
|
27
17
|
get children() {
|
|
28
18
|
return [_$createComponent(ClientOperations, {
|
|
29
|
-
client:
|
|
30
|
-
}),
|
|
31
|
-
client:
|
|
32
|
-
}),
|
|
33
|
-
client:
|
|
19
|
+
client: client
|
|
20
|
+
}), _$createComponent(ClientContext, {
|
|
21
|
+
client: client
|
|
22
|
+
}), _$createComponent(SubClients, {
|
|
23
|
+
client: client
|
|
34
24
|
})];
|
|
35
25
|
}
|
|
36
|
-
})
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function SubClients(props) {
|
|
30
|
+
const subClients = props.client.subClients;
|
|
31
|
+
return _$createComponent(ay.For, {
|
|
32
|
+
each: subClients,
|
|
33
|
+
children: subClient => {
|
|
34
|
+
const namePolicy = ts.useTSNamePolicy();
|
|
35
|
+
const subClientName = namePolicy.getName(subClient.name, "variable");
|
|
36
|
+
return _$createComponent(ay.SourceDirectory, {
|
|
37
|
+
path: subClientName,
|
|
38
|
+
get children() {
|
|
39
|
+
return [_$createComponent(ClientOperations, {
|
|
40
|
+
client: subClient
|
|
41
|
+
}), _$createComponent(ClientContext, {
|
|
42
|
+
client: subClient
|
|
43
|
+
}), _$createComponent(SubClients, {
|
|
44
|
+
client: subClient
|
|
45
|
+
})];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
37
49
|
});
|
|
38
50
|
}
|
|
39
51
|
//# sourceMappingURL=client-directory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-directory.js","names":["ay","ts","useClientLibrary","ClientContext","ClientOperations","OperationsDirectory","props","topLevel","clients","
|
|
1
|
+
{"version":3,"file":"client-directory.js","names":["ay","ts","useClientLibrary","ClientContext","ClientOperations","OperationsDirectory","props","topLevel","clients","_$createComponent","For","each","joiner","line","children","client","StatementList","SubClients","subClients","subClient","namePolicy","useTSNamePolicy","subClientName","getName","name","SourceDirectory","path"],"sources":["../../../src/components/client-directory.tsx"],"sourcesContent":[null],"mappings":";AAAA,OAAO,KAAKA,EAAE,MAAM,gBAAgB;AACpC,OAAO,KAAKC,EAAE,MAAM,sBAAsB;AAE1C,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,aAAa;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.d.ts","sourceRoot":"","sources":["../../../src/components/client-operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAO5C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"client-operation.d.ts","sourceRoot":"","sources":["../../../src/components/client-operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAO5C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAgB5D;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,EAAE,CAAC,eAAe,CAAC;CACrC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eA0B1D"}
|