@typespec/http-client-js 0.16.2-dev.1 → 0.16.2

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.
Files changed (225) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +24 -20
  3. package/.github/copilot-instructions.md +0 -180
  4. package/.testignore +0 -19
  5. package/.turbo/turbo-build.log +0 -3
  6. package/CHANGELOG.md +0 -159
  7. package/eng/scripts/calculate-coverage.ts +0 -33
  8. package/eng/scripts/emit-e2e.ts +0 -317
  9. package/eng/scripts/run-e2e-tests.ts +0 -166
  10. package/eng/scripts/tspconfig.yaml +0 -6
  11. package/eng/scripts/upload-spector-results.ts +0 -139
  12. package/src/components/client-context/client-context-declaration.tsx +0 -26
  13. package/src/components/client-context/client-context-factory.tsx +0 -218
  14. package/src/components/client-context/client-context-options.tsx +0 -36
  15. package/src/components/client-context/client-context.tsx +0 -23
  16. package/src/components/client-context/parametrized-endpoint.tsx +0 -51
  17. package/src/components/client-directory.tsx +0 -51
  18. package/src/components/client-operation.tsx +0 -102
  19. package/src/components/client.tsx +0 -177
  20. package/src/components/encoding-provider.tsx +0 -17
  21. package/src/components/external-packages/ts-http-runtime.ts +0 -28
  22. package/src/components/external-packages/uri-template.ts +0 -11
  23. package/src/components/http-request-options.tsx +0 -88
  24. package/src/components/http-request-parameters-expression.tsx +0 -191
  25. package/src/components/http-request.tsx +0 -80
  26. package/src/components/http-response.tsx +0 -74
  27. package/src/components/index.ts +0 -12
  28. package/src/components/models.tsx +0 -26
  29. package/src/components/operation-handlers/index.tsx +0 -2
  30. package/src/components/operation-handlers/operation-pipeline.tsx +0 -33
  31. package/src/components/operation-handlers/paging/page-item.tsx +0 -14
  32. package/src/components/operation-handlers/paging/page-response.tsx +0 -57
  33. package/src/components/operation-handlers/paging/page-settings.tsx +0 -53
  34. package/src/components/operation-handlers/paging/paginated-operation-handler.tsx +0 -200
  35. package/src/components/operation-handlers/paging/request-send.tsx +0 -85
  36. package/src/components/operation-handlers/paging/response-deserialize.tsx +0 -60
  37. package/src/components/operation-handlers/paging/util.ts +0 -70
  38. package/src/components/operation-handlers/types.tsx +0 -18
  39. package/src/components/operation-options.tsx +0 -42
  40. package/src/components/operation-parameters.tsx +0 -44
  41. package/src/components/output.tsx +0 -32
  42. package/src/components/serializers.tsx +0 -74
  43. package/src/components/static-helpers/bytes-encoding.tsx +0 -61
  44. package/src/components/static-helpers/interfaces.tsx +0 -31
  45. package/src/components/static-helpers/multipart-helpers.tsx +0 -80
  46. package/src/components/static-helpers/paging-helper.tsx +0 -202
  47. package/src/components/static-helpers/rest-error.tsx +0 -102
  48. package/src/components/testing/client-options.tsx +0 -30
  49. package/src/components/transforms/content-type-encoding-provider.tsx +0 -26
  50. package/src/components/transforms/data-transform.tsx +0 -40
  51. package/src/components/transforms/json/json-array-transform.tsx +0 -87
  52. package/src/components/transforms/json/json-model-additional-properties-transform.tsx +0 -54
  53. package/src/components/transforms/json/json-model-base-transform.tsx +0 -24
  54. package/src/components/transforms/json/json-model-property-transform.tsx +0 -53
  55. package/src/components/transforms/json/json-model-transform.tsx +0 -115
  56. package/src/components/transforms/json/json-record-transform.tsx +0 -88
  57. package/src/components/transforms/json/json-transform-discriminator.tsx +0 -111
  58. package/src/components/transforms/json/json-transform.tsx +0 -120
  59. package/src/components/transforms/json/union-transform.tsx +0 -87
  60. package/src/components/transforms/json/utils/transport-namer.ts +0 -12
  61. package/src/components/transforms/multipart/array-part-transform.tsx +0 -44
  62. package/src/components/transforms/multipart/file-part-transform.tsx +0 -45
  63. package/src/components/transforms/multipart/multipart-transform.tsx +0 -30
  64. package/src/components/transforms/multipart/part-transform.tsx +0 -22
  65. package/src/components/transforms/multipart/simple-part-transform.tsx +0 -42
  66. package/src/components/transforms/operation-transform-declaration.tsx +0 -83
  67. package/src/components/transforms/operation-transform-expression.tsx +0 -62
  68. package/src/components/transforms/scalar-transform.tsx +0 -301
  69. package/src/components/transforms/transform-name-policy.ts +0 -134
  70. package/src/components/utils/unpack-model-property.ts +0 -44
  71. package/src/components/utils/url-template.tsx +0 -25
  72. package/src/context/encoding/encoding-context.tsx +0 -28
  73. package/src/context/encoding/types.ts +0 -6
  74. package/src/emitter.tsx +0 -85
  75. package/src/index.ts +0 -5
  76. package/src/lib.ts +0 -120
  77. package/src/testing/index.ts +0 -11
  78. package/src/utils/client-discovery.ts +0 -28
  79. package/src/utils/multipart.ts +0 -29
  80. package/src/utils/operations.ts +0 -112
  81. package/src/utils/parameters.tsx +0 -155
  82. package/test/e2e/assets/image.jpg +0 -0
  83. package/test/e2e/assets/image.png +0 -0
  84. package/test/e2e/http/authentication/api-key/main.test.ts +0 -38
  85. package/test/e2e/http/authentication/oauth2/main.test.ts +0 -31
  86. package/test/e2e/http/authentication/union/main.test.ts +0 -26
  87. package/test/e2e/http/encode/bytes/main.test.ts +0 -191
  88. package/test/e2e/http/encode/datetime/main.test.ts +0 -176
  89. package/test/e2e/http/encode/duration/main.test.ts +0 -126
  90. package/test/e2e/http/encode/numeric/main.test.ts +0 -26
  91. package/test/e2e/http/parameters/basic/main.test.ts +0 -35
  92. package/test/e2e/http/parameters/body-optionality/main.test.ts +0 -43
  93. package/test/e2e/http/parameters/collection-format/main.test.ts +0 -40
  94. package/test/e2e/http/parameters/spread/main.test.ts +0 -56
  95. package/test/e2e/http/payload/content-negotiation/main.test.ts +0 -40
  96. package/test/e2e/http/payload/json-merge-patch/main.test.ts +0 -122
  97. package/test/e2e/http/payload/media-type/main.test.ts +0 -28
  98. package/test/e2e/http/payload/multipart/main.test.ts +0 -200
  99. package/test/e2e/http/payload/pageable/main.test.ts +0 -78
  100. package/test/e2e/http/payload/xml/main.test.ts +0 -287
  101. package/test/e2e/http/routes/main.test.ts +0 -284
  102. package/test/e2e/http/serialization/encoded-name/json/main.test.ts +0 -20
  103. package/test/e2e/http/server/endpoint/not-defined/main.test.ts +0 -11
  104. package/test/e2e/http/server/path/multiple/main.test.ts +0 -22
  105. package/test/e2e/http/server/path/single/main.test.ts +0 -11
  106. package/test/e2e/http/server/versions/not-versioned/main.test.ts +0 -22
  107. package/test/e2e/http/server/versions/versioned/main.test.ts +0 -28
  108. package/test/e2e/http/special-headers/conditional-request/main.test.ts +0 -35
  109. package/test/e2e/http/special-headers/repeatability/main.test.ts +0 -18
  110. package/test/e2e/http/special-words/main.test.ts +0 -434
  111. package/test/e2e/http/type/array/array.test.ts +0 -256
  112. package/test/e2e/http/type/dictionary/main.test.ts +0 -229
  113. package/test/e2e/http/type/enum/extensible/main.test.ts +0 -34
  114. package/test/e2e/http/type/enum/fixed/main.test.ts +0 -29
  115. package/test/e2e/http/type/model/empty/main.test.ts +0 -21
  116. package/test/e2e/http/type/model/inheritance/enum-discriminator/main.test.ts +0 -51
  117. package/test/e2e/http/type/model/inheritance/nested-discriminator/main.test.ts +0 -168
  118. package/test/e2e/http/type/model/inheritance/not-discriminated/main.test.ts +0 -42
  119. package/test/e2e/http/type/model/inheritance/recursive/main.test.ts +0 -46
  120. package/test/e2e/http/type/model/inheritance/single-discriminator/main.test.ts +0 -99
  121. package/test/e2e/http/type/model/visibility/main.test.ts +0 -64
  122. package/test/e2e/http/type/property/additional-properties/main.test.ts +0 -185
  123. package/test/e2e/http/type/property/additional-properties/spreads.test.ts +0 -448
  124. package/test/e2e/http/type/property/nullable/main.test.ts +0 -275
  125. package/test/e2e/http/type/property/optionality/main.test.ts +0 -256
  126. package/test/e2e/http/type/property/value-types/main.test.ts +0 -193
  127. package/test/e2e/http/type/scalar/main.test.ts +0 -133
  128. package/test/e2e/http/type/scalar/scalar.test.ts +0 -95
  129. package/test/e2e/http/type/union/main.test.ts +0 -207
  130. package/test/e2e/http/versioning/added/main.test.ts +0 -60
  131. package/test/e2e/http/versioning/madeOptional/main.test.ts +0 -34
  132. package/test/e2e/http/versioning/removed/main.test.ts +0 -75
  133. package/test/e2e/http/versioning/renamedFrom/main.test.ts +0 -52
  134. package/test/e2e/http/versioning/returnTypeChangedFrom/main.test.ts +0 -22
  135. package/test/e2e/http/versioning/typeChangedFrom/main.test.ts +0 -31
  136. package/test/scenarios/additional-properties/extends.md +0 -67
  137. package/test/scenarios/additional-properties/is.md +0 -42
  138. package/test/scenarios/additional-properties/spread.md +0 -68
  139. package/test/scenarios/auth/basic_auth.md +0 -68
  140. package/test/scenarios/auth/bearer.md +0 -68
  141. package/test/scenarios/auth/client_parameters.md +0 -78
  142. package/test/scenarios/auth/client_structure.md +0 -36
  143. package/test/scenarios/auth/key_credential.md +0 -69
  144. package/test/scenarios/auth/oauth2.md +0 -90
  145. package/test/scenarios/auth/sub_client_override.md +0 -114
  146. package/test/scenarios/client/client_context.md +0 -34
  147. package/test/scenarios/client/dotted_namespace.md +0 -27
  148. package/test/scenarios/client/global_namespace.md +0 -69
  149. package/test/scenarios/client/multiple_top_level_clients.md +0 -72
  150. package/test/scenarios/client/nested_client.md +0 -102
  151. package/test/scenarios/client/wrapping_namespace.md +0 -41
  152. package/test/scenarios/encoding/bytes_body.md +0 -44
  153. package/test/scenarios/encoding/bytes_json_property.md +0 -55
  154. package/test/scenarios/encoding/bytes_nullable.md +0 -139
  155. package/test/scenarios/encoding/header_bytes.md +0 -130
  156. package/test/scenarios/encoding/header_date.md +0 -216
  157. package/test/scenarios/encoding/model_with_bytes_property.md +0 -45
  158. package/test/scenarios/encoding/query_bytes.md +0 -42
  159. package/test/scenarios/encoding/query_date.md +0 -216
  160. package/test/scenarios/http-operations/basic-request.md +0 -144
  161. package/test/scenarios/http-operations/basic-response.md +0 -219
  162. package/test/scenarios/http-operations/basic.md +0 -128
  163. package/test/scenarios/http-operations/constant-header.md +0 -33
  164. package/test/scenarios/http-operations/create-operation.md +0 -58
  165. package/test/scenarios/http-operations/on_response.md +0 -52
  166. package/test/scenarios/http-operations/optional-request-body.md +0 -50
  167. package/test/scenarios/http-operations/paging.md +0 -242
  168. package/test/scenarios/http-operations/path-parameter-in-model.md +0 -53
  169. package/test/scenarios/http-operations/path-parameter.md +0 -48
  170. package/test/scenarios/http-operations/query-parameter.md +0 -41
  171. package/test/scenarios/http-operations/scalar-payload.md +0 -57
  172. package/test/scenarios/http-operations/with-parameters.md +0 -78
  173. package/test/scenarios/models/array-properties.md +0 -47
  174. package/test/scenarios/models/basic.md +0 -118
  175. package/test/scenarios/models/dictionary-properties.md +0 -44
  176. package/test/scenarios/models/inheritance_2_discriminators.md +0 -346
  177. package/test/scenarios/models/inheritance_discriminator.md +0 -88
  178. package/test/scenarios/models/inline-models.md +0 -29
  179. package/test/scenarios/models/model_additional_properties.md +0 -75
  180. package/test/scenarios/models/model_extends.md +0 -97
  181. package/test/scenarios/models/model_spread.md +0 -63
  182. package/test/scenarios/models/nested_property.md +0 -41
  183. package/test/scenarios/models/property_references_property.md +0 -150
  184. package/test/scenarios/multipart/anonymous_part.md +0 -53
  185. package/test/scenarios/multipart/file.md +0 -154
  186. package/test/scenarios/multipart/file_content_type.md +0 -92
  187. package/test/scenarios/multipart/non-string-float.md +0 -55
  188. package/test/scenarios/multipart/simple_part.md +0 -65
  189. package/test/scenarios/operation-parameters/body_root_anonymous.md +0 -87
  190. package/test/scenarios/operation-parameters/constant_as_optional.md +0 -54
  191. package/test/scenarios/operation-parameters/default_value_as_optional.md +0 -54
  192. package/test/scenarios/operation-parameters/no_content_type.md +0 -62
  193. package/test/scenarios/operation-parameters/no_parameters.md +0 -50
  194. package/test/scenarios/operation-parameters/only_optional.md +0 -62
  195. package/test/scenarios/operation-parameters/only_required.md +0 -58
  196. package/test/scenarios/operation-parameters/reserved_names.md +0 -60
  197. package/test/scenarios/operation-parameters/spread_body.md +0 -70
  198. package/test/scenarios/operation-parameters/spread_with_nested.md +0 -82
  199. package/test/scenarios/operation-parameters/union_body.md +0 -86
  200. package/test/scenarios/operation-parameters/with_body_property.md +0 -67
  201. package/test/scenarios/operation-parameters/with_body_root.md +0 -69
  202. package/test/scenarios/serializers/arrays.md +0 -191
  203. package/test/scenarios/serializers/basic_model.md +0 -111
  204. package/test/scenarios/serializers/basic_model_wire_name.md +0 -48
  205. package/test/scenarios/serializers/discriminated_union.md +0 -86
  206. package/test/scenarios/serializers/discriminated_union_spread.md +0 -115
  207. package/test/scenarios/serializers/file.md +0 -67
  208. package/test/scenarios/serializers/model_date_time.md +0 -65
  209. package/test/scenarios/serializers/multipart.md +0 -62
  210. package/test/scenarios/serializers/polymorphic_single_level_inheritance.md +0 -157
  211. package/test/scenarios/serializers/property_references_property.md +0 -72
  212. package/test/scenarios/serializers/record.md +0 -97
  213. package/test/scenarios/serializers/scalars.md +0 -34
  214. package/test/scenarios/serializers/spread.md +0 -69
  215. package/test/scenarios/serializers/string_union.md +0 -55
  216. package/test/scenarios/server/default_url.md +0 -45
  217. package/test/scenarios/server/multiple-parameters.md +0 -55
  218. package/test/scenarios/server/no-server.md +0 -37
  219. package/test/scenarios/server/parametrized-endpoint.md +0 -51
  220. package/test/scenarios.test.ts +0 -24
  221. package/test/test-host.ts +0 -22
  222. package/tsconfig.json +0 -16
  223. package/tsconfig.test.json +0 -9
  224. package/vitest.config.e2e.ts +0 -16
  225. package/vitest.config.ts +0 -15
@@ -1,200 +0,0 @@
1
- import { readFile } from "fs/promises";
2
- import { dirname, resolve } from "path";
3
- import { fileURLToPath } from "url";
4
- import { beforeEach, describe, it } from "vitest";
5
- // import { FormDataClient, HttpPartsClient } from "../../../generated/payload/multipart/src/index.js";
6
-
7
- // Temporary stubs to avoid build errors while generator bug is fixed
8
- class FormDataClient {
9
- constructor(_: { allowInsecureConnection?: boolean; retryOptions?: { maxRetries?: number } }) {}
10
- async basic(_: { id: string; profileImage: Uint8Array }): Promise<void> {}
11
- async fileArrayAndBasic(_: {
12
- id: string;
13
- address: unknown;
14
- profileImage: Uint8Array;
15
- pictures: Uint8Array[];
16
- }): Promise<void> {}
17
- async jsonPart(_: { address: unknown; profileImage: Uint8Array }): Promise<void> {}
18
- async binaryArrayParts(_: { id: string; pictures: Uint8Array[] }): Promise<void> {}
19
- async multiBinaryParts(_: { profileImage: Uint8Array; picture: Uint8Array }): Promise<void> {}
20
- async checkFileNameAndContentType(_: { id: string; profileImage: Uint8Array }): Promise<void> {}
21
- async anonymousModel(_: { profileImage: Uint8Array }): Promise<void> {}
22
- }
23
-
24
- class HttpPartsClient {
25
- constructor(_: { allowInsecureConnection?: boolean; retryOptions?: { maxRetries?: number } }) {}
26
- contentTypeClient = {
27
- async imageJpegContentType(_: {
28
- profileImage: { contents: Uint8Array; contentType: string; filename: string };
29
- }): Promise<void> {},
30
- async requiredContentType(_: {
31
- profileImage: { contents: Uint8Array; contentType: string; filename: string };
32
- }): Promise<void> {},
33
- async optionalContentType(_: {
34
- profileImage: { contents: Uint8Array; filename: string };
35
- }): Promise<void> {},
36
- };
37
- async jsonArrayAndFileArray(_: {
38
- id: string;
39
- address: unknown;
40
- profileImage: { contents: Uint8Array; contentType: string; filename: string };
41
- previousAddresses: unknown[];
42
- pictures: Array<{ contents: Uint8Array; contentType: string; filename: string }>;
43
- }): Promise<void> {}
44
- nonStringClient = {
45
- async float(_: { temperature: { body: number; contentType: string } }): Promise<void> {},
46
- };
47
- }
48
-
49
- const __filename = fileURLToPath(import.meta.url);
50
- const __dirname = dirname(__filename);
51
-
52
- const jpegImagePath = resolve(__dirname, "../../../assets/image.jpg");
53
- const jpegBuffer = await readFile(jpegImagePath);
54
- const jpegContents = new Uint8Array(jpegBuffer);
55
-
56
- const pngImagePath = resolve(__dirname, "../../../assets/image.png");
57
- const pngBuffer = await readFile(pngImagePath);
58
- const pngContents = new Uint8Array(pngBuffer);
59
-
60
- describe.skip("Payload.MultiPart", () => {
61
- // Skipping as implicit multipart is going to be deprecated in TypeSpec
62
- describe.skip("FormDataClient", () => {
63
- const client = new FormDataClient({
64
- allowInsecureConnection: true,
65
- retryOptions: { maxRetries: 1 },
66
- });
67
-
68
- beforeEach(async () => {});
69
-
70
- it("should send mixed parts with multipart/form-data", async () => {
71
- await client.basic({
72
- id: "123",
73
- profileImage: jpegContents,
74
- });
75
- });
76
-
77
- it("should send complex parts with multipart/form-data", async () => {
78
- const address = { city: "X" };
79
- await client.fileArrayAndBasic({
80
- id: "123",
81
- address,
82
- profileImage: jpegContents,
83
- pictures: [pngContents, pngContents],
84
- });
85
- });
86
-
87
- it("should send json part with binary part", async () => {
88
- const address = { city: "X" };
89
- await client.jsonPart({
90
- address,
91
- profileImage: new Uint8Array([/* file content */]),
92
- });
93
- });
94
-
95
- it("should send binary array parts with multipart/form-data", async () => {
96
- await client.binaryArrayParts({
97
- id: "123",
98
- pictures: [pngContents, pngContents],
99
- });
100
- });
101
-
102
- it("should send multi-binary parts multiple times", async () => {
103
- await client.multiBinaryParts({
104
- profileImage: jpegContents,
105
- picture: pngContents,
106
- });
107
- });
108
-
109
- it("should send parts and check filename/content-type", async () => {
110
- await client.checkFileNameAndContentType({
111
- id: "123",
112
- profileImage: jpegContents,
113
- });
114
- });
115
-
116
- it("should send anonymous model with multipart/form-data", async () => {
117
- await client.anonymousModel({ profileImage: jpegContents });
118
- });
119
- });
120
-
121
- describe.skip("FormDataClient.HttpParts.ContentType", () => {
122
- const client = new HttpPartsClient({
123
- allowInsecureConnection: true,
124
- retryOptions: { maxRetries: 1 },
125
- });
126
-
127
- it("should handle image/jpeg with specific content type", async () => {
128
- await client.contentTypeClient.imageJpegContentType({
129
- profileImage: {
130
- contents: jpegContents,
131
- contentType: "image/jpg",
132
- filename: "hello.jpg",
133
- },
134
- });
135
- });
136
-
137
- it("should handle required content type with multipart/form-data", async () => {
138
- await client.contentTypeClient.requiredContentType({
139
- profileImage: {
140
- contents: jpegContents,
141
- contentType: "application/octet-stream",
142
- filename: "hello.jpg",
143
- },
144
- });
145
- });
146
-
147
- it("should handle optional content type file parts", async () => {
148
- await client.contentTypeClient.optionalContentType({
149
- profileImage: {
150
- contents: jpegContents,
151
- filename: "hello.jpg",
152
- },
153
- });
154
- });
155
- });
156
-
157
- describe.skip("FormDataClient.HttpParts", () => {
158
- it("should send json array and file array", async () => {
159
- const client = new HttpPartsClient({
160
- allowInsecureConnection: true,
161
- retryOptions: {
162
- maxRetries: 1,
163
- },
164
- });
165
- const address = { city: "X" };
166
- const previousAddresses = [{ city: "Y" }, { city: "Z" }];
167
- await client.jsonArrayAndFileArray({
168
- id: "123",
169
- address,
170
- profileImage: {
171
- contents: jpegContents,
172
- contentType: "application/octet-stream",
173
- filename: "profile.jpg",
174
- },
175
- previousAddresses,
176
- pictures: [
177
- { contents: pngContents, contentType: "application/octet-stream", filename: "pic1.png" },
178
- { contents: pngContents, contentType: "application/octet-stream", filename: "pic2.png" },
179
- ],
180
- });
181
- });
182
- });
183
-
184
- describe.skip("FormDataClient.HttpParts.NonString", () => {
185
- it("should handle non-string float", async () => {
186
- const client = new HttpPartsClient({
187
- allowInsecureConnection: true,
188
- retryOptions: {
189
- maxRetries: 1,
190
- },
191
- });
192
- await client.nonStringClient.float({
193
- temperature: {
194
- body: 0.5,
195
- contentType: "text/plain",
196
- },
197
- });
198
- });
199
- });
200
- });
@@ -1,78 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import type { Pet } from "../../../generated/payload/pageable/src/index.js";
3
- import { ServerDrivenPaginationClient } from "../../../generated/payload/pageable/src/index.js";
4
-
5
- describe("Payload.Pageable", () => {
6
- describe("list", () => {
7
- const client = new ServerDrivenPaginationClient({
8
- allowInsecureConnection: true,
9
- });
10
- const pets = [
11
- { id: "1", name: "dog" },
12
- { id: "2", name: "cat" },
13
- { id: "3", name: "bird" },
14
- { id: "4", name: "fish" },
15
- ];
16
- it("Payload Pageable ServerDriven Pagination link", async () => {
17
- const iter = client.link();
18
- const items: Array<Pet> = [];
19
- for await (const user of iter) {
20
- items.push(user);
21
- }
22
- expect(items.length).toEqual(4);
23
- expect(items).toStrictEqual(pets);
24
- });
25
-
26
- it("continuation token for requestHeaderResponseBody", async () => {
27
- const iter = client.continuationTokenClient.requestHeaderResponseBody({
28
- bar: "bar",
29
- foo: "foo",
30
- });
31
- const items: Array<Pet> = [];
32
- for await (const user of iter) {
33
- items.push(user);
34
- }
35
- expect(items.length).toEqual(4);
36
- expect(items).toStrictEqual(pets);
37
- });
38
-
39
- it("continuation token for requestQueryResponseBody", async () => {
40
- const iter = client.continuationTokenClient.requestQueryResponseBody({
41
- bar: "bar",
42
- foo: "foo",
43
- });
44
- const items: Array<Pet> = [];
45
- for await (const user of iter) {
46
- items.push(user);
47
- }
48
- expect(items.length).toEqual(4);
49
- expect(items).toStrictEqual(pets);
50
- });
51
-
52
- it("continuation token for requestHeaderResponseHeader", async () => {
53
- const iter = client.continuationTokenClient.requestHeaderResponseHeader({
54
- bar: "bar",
55
- foo: "foo",
56
- });
57
- const items: Array<Pet> = [];
58
- for await (const user of iter) {
59
- items.push(user);
60
- }
61
- expect(items.length).toEqual(4);
62
- expect(items).toStrictEqual(pets);
63
- });
64
-
65
- it("continuation token for requestQueryResponseHeader", async () => {
66
- const iter = client.continuationTokenClient.requestQueryResponseHeader({
67
- bar: "bar",
68
- foo: "foo",
69
- });
70
- const items: Array<Pet> = [];
71
- for await (const user of iter) {
72
- items.push(user);
73
- }
74
- expect(items.length).toEqual(4);
75
- expect(items).toStrictEqual(pets);
76
- });
77
- });
78
- });
@@ -1,287 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import {
3
- ModelWithArrayOfModelValueClient,
4
- ModelWithAttributesValueClient,
5
- ModelWithDictionaryValueClient,
6
- ModelWithEmptyArrayValueClient,
7
- ModelWithEncodedNamesValueClient,
8
- ModelWithOptionalFieldValueClient,
9
- ModelWithRenamedArraysValueClient,
10
- ModelWithRenamedFieldsValueClient,
11
- ModelWithSimpleArraysValueClient,
12
- ModelWithTextValueClient,
13
- ModelWithUnwrappedArrayValueClient,
14
- SimpleModelValueClient,
15
- } from "../../../generated/payload/xml/src/index.js";
16
-
17
- describe.skip("Payload.Xml", () => {
18
- describe("SimpleModelValueClient", () => {
19
- const client = new SimpleModelValueClient({
20
- allowInsecureConnection: true,
21
- retryOptions: {
22
- maxRetries: 1,
23
- },
24
- });
25
-
26
- it("should handle a SimpleModel value returned from the server", async () => {
27
- const response = await client.get();
28
- expect(response).toEqual({ name: "foo", age: 123 });
29
- });
30
-
31
- it("should send a SimpleModel value to the server", async () => {
32
- await client.put({ name: "foo", age: 123 });
33
- });
34
- });
35
-
36
- describe("ModelWithSimpleArraysValueClient", () => {
37
- const client = new ModelWithSimpleArraysValueClient({
38
- allowInsecureConnection: true,
39
- retryOptions: {
40
- maxRetries: 1,
41
- },
42
- });
43
-
44
- it("should handle a ModelWithSimpleArrays value returned from the server", async () => {
45
- const response = await client.get();
46
- expect(response).toEqual({
47
- colors: ["red", "green", "blue"],
48
- counts: [1, 2],
49
- });
50
- });
51
-
52
- it("should send a ModelWithSimpleArrays value to the server", async () => {
53
- await client.put({
54
- colors: ["red", "green", "blue"],
55
- counts: [1, 2],
56
- });
57
- });
58
- });
59
-
60
- describe("ModelWithArrayOfModelValueClient", () => {
61
- const client = new ModelWithArrayOfModelValueClient({
62
- allowInsecureConnection: true,
63
- retryOptions: {
64
- maxRetries: 1,
65
- },
66
- });
67
-
68
- it("should handle a ModelWithArrayOfModel value returned from the server", async () => {
69
- const response = await client.get();
70
- expect(response).toEqual({
71
- items: [
72
- { name: "foo", age: 123 },
73
- { name: "bar", age: 456 },
74
- ],
75
- });
76
- });
77
-
78
- it("should send a ModelWithArrayOfModel value to the server", async () => {
79
- await client.put({
80
- items: [
81
- { name: "foo", age: 123 },
82
- { name: "bar", age: 456 },
83
- ],
84
- });
85
- });
86
- });
87
-
88
- describe("ModelWithOptionalFieldValueClient", () => {
89
- const client = new ModelWithOptionalFieldValueClient({
90
- allowInsecureConnection: true,
91
- retryOptions: {
92
- maxRetries: 1,
93
- },
94
- });
95
-
96
- it("should handle a ModelWithOptionalField value returned from the server", async () => {
97
- const response = await client.get();
98
- expect(response).toEqual({ item: "widget" });
99
- });
100
-
101
- it("should send a ModelWithOptionalField value to the server", async () => {
102
- await client.put({ item: "widget" });
103
- });
104
- });
105
-
106
- describe("ModelWithAttributesValueClient", () => {
107
- const client = new ModelWithAttributesValueClient({
108
- allowInsecureConnection: true,
109
- retryOptions: {
110
- maxRetries: 1,
111
- },
112
- });
113
-
114
- it("should handle a ModelWithAttributes value returned from the server", async () => {
115
- const response = await client.get();
116
- expect(response).toEqual({ id1: 123, id2: "foo", enabled: true });
117
- });
118
-
119
- it("should send a ModelWithAttributes value to the server", async () => {
120
- await client.put({
121
- id1: 123,
122
- id2: "foo",
123
- enabled: true,
124
- });
125
- });
126
- });
127
-
128
- describe("ModelWithUnwrappedArrayValueClient", () => {
129
- const client = new ModelWithUnwrappedArrayValueClient({
130
- allowInsecureConnection: true,
131
- retryOptions: {
132
- maxRetries: 1,
133
- },
134
- });
135
-
136
- it("should handle a ModelWithUnwrappedArray value returned from the server", async () => {
137
- const response = await client.get();
138
- expect(response).toEqual({
139
- colors: ["red", "green", "blue"],
140
- counts: [1, 2],
141
- });
142
- });
143
-
144
- it("should send a ModelWithUnwrappedArray value to the server", async () => {
145
- await client.put({
146
- colors: ["red", "green", "blue"],
147
- counts: [1, 2],
148
- });
149
- });
150
- });
151
-
152
- describe("ModelWithRenamedArraysValueClient", () => {
153
- const client = new ModelWithRenamedArraysValueClient({
154
- allowInsecureConnection: true,
155
- retryOptions: {
156
- maxRetries: 1,
157
- },
158
- });
159
-
160
- it("should handle a ModelWithRenamedArrays value returned from the server", async () => {
161
- const response = await client.get();
162
- expect(response).toEqual({
163
- colors: ["red", "green", "blue"],
164
- counts: [1, 2],
165
- });
166
- });
167
-
168
- it("should send a ModelWithRenamedArrays value to the server", async () => {
169
- await client.put({
170
- colors: ["red", "green", "blue"],
171
- counts: [1, 2],
172
- });
173
- });
174
- });
175
-
176
- describe("ModelWithRenamedFieldsValueClient", () => {
177
- const client = new ModelWithRenamedFieldsValueClient({
178
- allowInsecureConnection: true,
179
- retryOptions: {
180
- maxRetries: 1,
181
- },
182
- });
183
-
184
- it("should handle a ModelWithRenamedFields value returned from the server", async () => {
185
- const response = await client.get();
186
- expect(response).toEqual({
187
- inputData: { name: "foo", age: 123 },
188
- outputData: { name: "bar", age: 456 },
189
- });
190
- });
191
-
192
- it("should send a ModelWithRenamedFields value to the server", async () => {
193
- await client.put({
194
- inputData: { name: "foo", age: 123 },
195
- outputData: { name: "bar", age: 456 },
196
- });
197
- });
198
- });
199
-
200
- describe("ModelWithEmptyArrayValueClient", () => {
201
- const client = new ModelWithEmptyArrayValueClient({
202
- allowInsecureConnection: true,
203
- retryOptions: {
204
- maxRetries: 1,
205
- },
206
- });
207
-
208
- it("should handle a ModelWithEmptyArray value returned from the server", async () => {
209
- const response = await client.get();
210
- expect(response).toEqual({ items: [] });
211
- });
212
-
213
- it("should send a ModelWithEmptyArray value to the server", async () => {
214
- await client.put({ items: [] });
215
- });
216
- });
217
-
218
- describe("ModelWithTextValueClient", () => {
219
- const client = new ModelWithTextValueClient({
220
- allowInsecureConnection: true,
221
- retryOptions: {
222
- maxRetries: 1,
223
- },
224
- });
225
-
226
- it("should handle a ModelWithText value returned from the server", async () => {
227
- const response = await client.get();
228
- expect(response).toEqual({
229
- language: "foo",
230
- content: "This is some text.",
231
- });
232
- });
233
-
234
- it("should send a ModelWithText value to the server", async () => {
235
- await client.put({
236
- language: "foo",
237
- content: "This is some text.",
238
- });
239
- });
240
- });
241
-
242
- describe("ModelWithDictionaryValueClient", () => {
243
- const client = new ModelWithDictionaryValueClient({
244
- allowInsecureConnection: true,
245
- retryOptions: {
246
- maxRetries: 1,
247
- },
248
- });
249
-
250
- it("should handle a ModelWithDictionary value returned from the server", async () => {
251
- const response = await client.get();
252
- expect(response).toEqual({
253
- metadata: { Color: "blue", Count: 123, Enabled: false },
254
- });
255
- });
256
-
257
- it("should send a ModelWithDictionary value to the server", async () => {
258
- await client.put({
259
- metadata: { Color: "blue", Count: 123, Enabled: false } as any,
260
- });
261
- });
262
- });
263
-
264
- describe("ModelWithEncodedNamesValueClient", () => {
265
- const client = new ModelWithEncodedNamesValueClient({
266
- allowInsecureConnection: true,
267
- retryOptions: {
268
- maxRetries: 1,
269
- },
270
- });
271
-
272
- it("should handle a ModelWithEncodedNames value returned from the server", async () => {
273
- const response = await client.get();
274
- expect(response).toEqual({
275
- modelData: { name: "foo", age: 123 },
276
- colors: ["red", "green", "blue"],
277
- });
278
- });
279
-
280
- it("should send a ModelWithEncodedNames value to the server", async () => {
281
- await client.put({
282
- modelData: { name: "foo", age: 123 },
283
- colors: ["red", "green", "blue"],
284
- });
285
- });
286
- });
287
- });