@apideck/unify 0.38.0 → 0.38.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 (118) hide show
  1. package/README.md +30 -10
  2. package/examples/package-lock.json +1 -1
  3. package/funcs/proxyDelete.d.ts +30 -0
  4. package/funcs/proxyDelete.d.ts.map +1 -0
  5. package/funcs/proxyDelete.js +175 -0
  6. package/funcs/proxyDelete.js.map +1 -0
  7. package/funcs/proxyGet.d.ts +30 -0
  8. package/funcs/proxyGet.d.ts.map +1 -0
  9. package/funcs/proxyGet.js +175 -0
  10. package/funcs/proxyGet.js.map +1 -0
  11. package/funcs/proxyOptions.d.ts +30 -0
  12. package/funcs/proxyOptions.d.ts.map +1 -0
  13. package/funcs/proxyOptions.js +175 -0
  14. package/funcs/proxyOptions.js.map +1 -0
  15. package/funcs/proxyPatch.d.ts +30 -0
  16. package/funcs/proxyPatch.d.ts.map +1 -0
  17. package/funcs/proxyPatch.js +176 -0
  18. package/funcs/proxyPatch.js.map +1 -0
  19. package/funcs/proxyPost.d.ts +30 -0
  20. package/funcs/proxyPost.d.ts.map +1 -0
  21. package/funcs/proxyPost.js +176 -0
  22. package/funcs/proxyPost.js.map +1 -0
  23. package/funcs/proxyPut.d.ts +30 -0
  24. package/funcs/proxyPut.d.ts.map +1 -0
  25. package/funcs/proxyPut.js +176 -0
  26. package/funcs/proxyPut.js.map +1 -0
  27. package/jsr.json +1 -1
  28. package/lib/config.d.ts +4 -4
  29. package/lib/config.js +4 -4
  30. package/models/components/companiesfilter.d.ts +4 -0
  31. package/models/components/companiesfilter.d.ts.map +1 -1
  32. package/models/components/companiesfilter.js +8 -0
  33. package/models/components/companiesfilter.js.map +1 -1
  34. package/models/components/contactsfilter.d.ts +4 -0
  35. package/models/components/contactsfilter.d.ts.map +1 -1
  36. package/models/components/contactsfilter.js +4 -0
  37. package/models/components/contactsfilter.js.map +1 -1
  38. package/models/components/ecommercecustomersfilter.d.ts +10 -0
  39. package/models/components/ecommercecustomersfilter.d.ts.map +1 -1
  40. package/models/components/ecommercecustomersfilter.js +4 -0
  41. package/models/components/ecommercecustomersfilter.js.map +1 -1
  42. package/models/components/employee.d.ts +1 -0
  43. package/models/components/employee.d.ts.map +1 -1
  44. package/models/components/employee.js +1 -0
  45. package/models/components/employee.js.map +1 -1
  46. package/models/components/invoiceitemsfilter.d.ts +2 -0
  47. package/models/components/invoiceitemsfilter.d.ts.map +1 -1
  48. package/models/components/invoiceitemsfilter.js +2 -0
  49. package/models/components/invoiceitemsfilter.js.map +1 -1
  50. package/models/errors/index.d.ts +1 -0
  51. package/models/errors/index.d.ts.map +1 -1
  52. package/models/errors/index.js +1 -0
  53. package/models/errors/index.js.map +1 -1
  54. package/models/errors/unauthorized.d.ts +142 -0
  55. package/models/errors/unauthorized.d.ts.map +1 -0
  56. package/models/errors/unauthorized.js +139 -0
  57. package/models/errors/unauthorized.js.map +1 -0
  58. package/models/operations/index.d.ts +6 -0
  59. package/models/operations/index.d.ts.map +1 -1
  60. package/models/operations/index.js +6 -0
  61. package/models/operations/index.js.map +1 -1
  62. package/models/operations/proxydeleteproxy.d.ts +103 -0
  63. package/models/operations/proxydeleteproxy.d.ts.map +1 -0
  64. package/models/operations/proxydeleteproxy.js +80 -0
  65. package/models/operations/proxydeleteproxy.js.map +1 -0
  66. package/models/operations/proxygetproxy.d.ts +103 -0
  67. package/models/operations/proxygetproxy.d.ts.map +1 -0
  68. package/models/operations/proxygetproxy.js +80 -0
  69. package/models/operations/proxygetproxy.js.map +1 -0
  70. package/models/operations/proxyoptionsproxy.d.ts +103 -0
  71. package/models/operations/proxyoptionsproxy.d.ts.map +1 -0
  72. package/models/operations/proxyoptionsproxy.js +80 -0
  73. package/models/operations/proxyoptionsproxy.js.map +1 -0
  74. package/models/operations/proxypatchproxy.d.ts +120 -0
  75. package/models/operations/proxypatchproxy.d.ts.map +1 -0
  76. package/models/operations/proxypatchproxy.js +102 -0
  77. package/models/operations/proxypatchproxy.js.map +1 -0
  78. package/models/operations/proxypostproxy.d.ts +120 -0
  79. package/models/operations/proxypostproxy.d.ts.map +1 -0
  80. package/models/operations/proxypostproxy.js +103 -0
  81. package/models/operations/proxypostproxy.js.map +1 -0
  82. package/models/operations/proxyputproxy.d.ts +120 -0
  83. package/models/operations/proxyputproxy.d.ts.map +1 -0
  84. package/models/operations/proxyputproxy.js +102 -0
  85. package/models/operations/proxyputproxy.js.map +1 -0
  86. package/package.json +1 -1
  87. package/sdk/proxy.d.ts +77 -0
  88. package/sdk/proxy.d.ts.map +1 -0
  89. package/sdk/proxy.js +90 -0
  90. package/sdk/proxy.js.map +1 -0
  91. package/sdk/sdk.d.ts +3 -0
  92. package/sdk/sdk.d.ts.map +1 -1
  93. package/sdk/sdk.js +4 -0
  94. package/sdk/sdk.js.map +1 -1
  95. package/src/__tests__/proxy.test.ts +41 -0
  96. package/src/funcs/proxyDelete.ts +258 -0
  97. package/src/funcs/proxyGet.ts +258 -0
  98. package/src/funcs/proxyOptions.ts +258 -0
  99. package/src/funcs/proxyPatch.ts +259 -0
  100. package/src/funcs/proxyPost.ts +259 -0
  101. package/src/funcs/proxyPut.ts +259 -0
  102. package/src/lib/config.ts +4 -4
  103. package/src/models/components/companiesfilter.ts +12 -0
  104. package/src/models/components/contactsfilter.ts +8 -0
  105. package/src/models/components/ecommercecustomersfilter.ts +14 -0
  106. package/src/models/components/employee.ts +1 -0
  107. package/src/models/components/invoiceitemsfilter.ts +4 -0
  108. package/src/models/errors/index.ts +1 -0
  109. package/src/models/errors/unauthorized.ts +282 -0
  110. package/src/models/operations/index.ts +6 -0
  111. package/src/models/operations/proxydeleteproxy.ts +158 -0
  112. package/src/models/operations/proxygetproxy.ts +158 -0
  113. package/src/models/operations/proxyoptionsproxy.ts +158 -0
  114. package/src/models/operations/proxypatchproxy.ts +227 -0
  115. package/src/models/operations/proxypostproxy.ts +212 -0
  116. package/src/models/operations/proxyputproxy.ts +215 -0
  117. package/src/sdk/proxy.ts +135 -0
  118. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,259 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ApideckCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { ApideckError } from "../models/errors/apideckerror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ export enum PatchAcceptEnum {
29
+ applicationJson = "application/json",
30
+ textCsv = "text/csv",
31
+ textPlain = "text/plain",
32
+ applicationOctetStream = "application/octet-stream",
33
+ applicationPdf = "application/pdf",
34
+ applicationXml = "application/xml",
35
+ textHtml = "text/html",
36
+ }
37
+
38
+ /**
39
+ * PATCH
40
+ *
41
+ * @remarks
42
+ * Proxies a downstream PATCH request to a service and injects the necessary credentials into a request stored in Vault. This allows you to have an additional security layer and logging without needing to rely on Unify for normalization.
43
+ * **Note**: Vault will proxy all data to the downstream URL and method/verb in the headers.
44
+ */
45
+ export function proxyPatch(
46
+ client: ApideckCore,
47
+ request: operations.ProxyPatchProxyRequest,
48
+ options?: RequestOptions & { acceptHeaderOverride?: PatchAcceptEnum },
49
+ ): APIPromise<
50
+ Result<
51
+ operations.ProxyPatchProxyResponse,
52
+ | errors.Unauthorized
53
+ | ApideckError
54
+ | ResponseValidationError
55
+ | ConnectionError
56
+ | RequestAbortedError
57
+ | RequestTimeoutError
58
+ | InvalidRequestError
59
+ | UnexpectedClientError
60
+ | SDKValidationError
61
+ >
62
+ > {
63
+ return new APIPromise($do(
64
+ client,
65
+ request,
66
+ options,
67
+ ));
68
+ }
69
+
70
+ async function $do(
71
+ client: ApideckCore,
72
+ request: operations.ProxyPatchProxyRequest,
73
+ options?: RequestOptions & { acceptHeaderOverride?: PatchAcceptEnum },
74
+ ): Promise<
75
+ [
76
+ Result<
77
+ operations.ProxyPatchProxyResponse,
78
+ | errors.Unauthorized
79
+ | ApideckError
80
+ | ResponseValidationError
81
+ | ConnectionError
82
+ | RequestAbortedError
83
+ | RequestTimeoutError
84
+ | InvalidRequestError
85
+ | UnexpectedClientError
86
+ | SDKValidationError
87
+ >,
88
+ APICall,
89
+ ]
90
+ > {
91
+ const parsed = safeParse(
92
+ request,
93
+ (value) => operations.ProxyPatchProxyRequest$outboundSchema.parse(value),
94
+ "Input validation failed",
95
+ );
96
+ if (!parsed.ok) {
97
+ return [parsed, { status: "invalid" }];
98
+ }
99
+ const payload = parsed.value;
100
+ const body = payload.RequestBody;
101
+
102
+ const path = pathToFunc("/proxy")();
103
+
104
+ const headers = new Headers(compactMap({
105
+ "Content-Type": body instanceof Blob && body.type ? body.type : undefined,
106
+ Accept: options?.acceptHeaderOverride
107
+ || "application/json;q=1, text/csv;q=0.9, text/plain;q=0.7, application/octet-stream;q=0.6, application/pdf;q=0.4, application/xml;q=0.3, text/html;q=0",
108
+ "x-apideck-app-id": encodeSimple(
109
+ "x-apideck-app-id",
110
+ payload.appId ?? client._options.appId,
111
+ { explode: false, charEncoding: "none" },
112
+ ),
113
+ "x-apideck-consumer-id": encodeSimple(
114
+ "x-apideck-consumer-id",
115
+ payload.consumerId ?? client._options.consumerId,
116
+ { explode: false, charEncoding: "none" },
117
+ ),
118
+ "x-apideck-downstream-authorization": encodeSimple(
119
+ "x-apideck-downstream-authorization",
120
+ payload.downstreamAuthorization,
121
+ { explode: false, charEncoding: "none" },
122
+ ),
123
+ "x-apideck-downstream-url": encodeSimple(
124
+ "x-apideck-downstream-url",
125
+ payload.downstreamUrl,
126
+ { explode: false, charEncoding: "none" },
127
+ ),
128
+ "x-apideck-service-id": encodeSimple(
129
+ "x-apideck-service-id",
130
+ payload.serviceId,
131
+ { explode: false, charEncoding: "none" },
132
+ ),
133
+ "x-apideck-unified-api": encodeSimple(
134
+ "x-apideck-unified-api",
135
+ payload.unifiedApi,
136
+ { explode: false, charEncoding: "none" },
137
+ ),
138
+ }));
139
+
140
+ const secConfig = await extractSecurity(client._options.apiKey);
141
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
142
+ const requestSecurity = resolveGlobalSecurity(securityInput);
143
+
144
+ const context = {
145
+ options: client._options,
146
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
147
+ operationID: "proxy.patchProxy",
148
+ oAuth2Scopes: null,
149
+
150
+ resolvedSecurity: requestSecurity,
151
+
152
+ securitySource: client._options.apiKey,
153
+ retryConfig: options?.retries
154
+ || client._options.retryConfig
155
+ || {
156
+ strategy: "backoff",
157
+ backoff: {
158
+ initialInterval: 500,
159
+ maxInterval: 60000,
160
+ exponent: 1.5,
161
+ maxElapsedTime: 900000,
162
+ },
163
+ retryConnectionErrors: true,
164
+ }
165
+ || { strategy: "none" },
166
+ retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
167
+ };
168
+
169
+ const requestRes = client._createRequest(context, {
170
+ security: requestSecurity,
171
+ method: "PATCH",
172
+ baseURL: options?.serverURL,
173
+ path: path,
174
+ headers: headers,
175
+ body: body,
176
+ userAgent: client._options.userAgent,
177
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
178
+ }, options);
179
+ if (!requestRes.ok) {
180
+ return [requestRes, { status: "invalid" }];
181
+ }
182
+ const req = requestRes.value;
183
+
184
+ const doResult = await client._do(req, {
185
+ context,
186
+ errorCodes: ["401", "4XX", "5XX"],
187
+ retryConfig: context.retryConfig,
188
+ retryCodes: context.retryCodes,
189
+ });
190
+ if (!doResult.ok) {
191
+ return [doResult, { status: "request-error", request: req }];
192
+ }
193
+ const response = doResult.value;
194
+
195
+ const responseFields = {
196
+ HttpMeta: { Response: response, Request: req },
197
+ };
198
+
199
+ const [result] = await M.match<
200
+ operations.ProxyPatchProxyResponse,
201
+ | errors.Unauthorized
202
+ | ApideckError
203
+ | ResponseValidationError
204
+ | ConnectionError
205
+ | RequestAbortedError
206
+ | RequestTimeoutError
207
+ | InvalidRequestError
208
+ | UnexpectedClientError
209
+ | SDKValidationError
210
+ >(
211
+ M.json(200, operations.ProxyPatchProxyResponse$inboundSchema, {
212
+ key: "responseJson",
213
+ }),
214
+ M.stream(200, operations.ProxyPatchProxyResponse$inboundSchema, {
215
+ key: "responseBinary",
216
+ }),
217
+ M.stream(200, operations.ProxyPatchProxyResponse$inboundSchema, {
218
+ ctype: "application/pdf",
219
+ key: "responsePdf",
220
+ }),
221
+ M.text(200, operations.ProxyPatchProxyResponse$inboundSchema, {
222
+ ctype: "application/xml",
223
+ key: "responseXml",
224
+ }),
225
+ M.text(200, operations.ProxyPatchProxyResponse$inboundSchema, {
226
+ ctype: "text/csv",
227
+ key: "responseCsv",
228
+ }),
229
+ M.text(200, operations.ProxyPatchProxyResponse$inboundSchema, {
230
+ key: "responseText",
231
+ }),
232
+ M.jsonErr(401, errors.Unauthorized$inboundSchema),
233
+ M.fail("4XX"),
234
+ M.fail("5XX"),
235
+ M.json("default", operations.ProxyPatchProxyResponse$inboundSchema, {
236
+ hdrs: true,
237
+ key: "errorJson",
238
+ }),
239
+ M.text("default", operations.ProxyPatchProxyResponse$inboundSchema, {
240
+ ctype: "application/xml",
241
+ hdrs: true,
242
+ key: "errorXml",
243
+ }),
244
+ M.text("default", operations.ProxyPatchProxyResponse$inboundSchema, {
245
+ ctype: "text/html",
246
+ hdrs: true,
247
+ key: "errorHtml",
248
+ }),
249
+ M.text("default", operations.ProxyPatchProxyResponse$inboundSchema, {
250
+ hdrs: true,
251
+ key: "errorText",
252
+ }),
253
+ )(response, req, { extraFields: responseFields });
254
+ if (!result.ok) {
255
+ return [result, { status: "complete", request: req, response }];
256
+ }
257
+
258
+ return [result, { status: "complete", request: req, response }];
259
+ }
@@ -0,0 +1,259 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ApideckCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { ApideckError } from "../models/errors/apideckerror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ export enum PostAcceptEnum {
29
+ applicationJson = "application/json",
30
+ textCsv = "text/csv",
31
+ textPlain = "text/plain",
32
+ applicationOctetStream = "application/octet-stream",
33
+ applicationPdf = "application/pdf",
34
+ applicationXml = "application/xml",
35
+ textHtml = "text/html",
36
+ }
37
+
38
+ /**
39
+ * POST
40
+ *
41
+ * @remarks
42
+ * Proxies a downstream POST request to a service and injects the necessary credentials into a request stored in Vault. This allows you to have an additional security layer and logging without needing to rely on Unify for normalization.
43
+ * **Note**: Vault will proxy all data to the downstream URL and method/verb in the headers.
44
+ */
45
+ export function proxyPost(
46
+ client: ApideckCore,
47
+ request: operations.ProxyPostProxyRequest,
48
+ options?: RequestOptions & { acceptHeaderOverride?: PostAcceptEnum },
49
+ ): APIPromise<
50
+ Result<
51
+ operations.ProxyPostProxyResponse,
52
+ | errors.Unauthorized
53
+ | ApideckError
54
+ | ResponseValidationError
55
+ | ConnectionError
56
+ | RequestAbortedError
57
+ | RequestTimeoutError
58
+ | InvalidRequestError
59
+ | UnexpectedClientError
60
+ | SDKValidationError
61
+ >
62
+ > {
63
+ return new APIPromise($do(
64
+ client,
65
+ request,
66
+ options,
67
+ ));
68
+ }
69
+
70
+ async function $do(
71
+ client: ApideckCore,
72
+ request: operations.ProxyPostProxyRequest,
73
+ options?: RequestOptions & { acceptHeaderOverride?: PostAcceptEnum },
74
+ ): Promise<
75
+ [
76
+ Result<
77
+ operations.ProxyPostProxyResponse,
78
+ | errors.Unauthorized
79
+ | ApideckError
80
+ | ResponseValidationError
81
+ | ConnectionError
82
+ | RequestAbortedError
83
+ | RequestTimeoutError
84
+ | InvalidRequestError
85
+ | UnexpectedClientError
86
+ | SDKValidationError
87
+ >,
88
+ APICall,
89
+ ]
90
+ > {
91
+ const parsed = safeParse(
92
+ request,
93
+ (value) => operations.ProxyPostProxyRequest$outboundSchema.parse(value),
94
+ "Input validation failed",
95
+ );
96
+ if (!parsed.ok) {
97
+ return [parsed, { status: "invalid" }];
98
+ }
99
+ const payload = parsed.value;
100
+ const body = payload.RequestBody;
101
+
102
+ const path = pathToFunc("/proxy")();
103
+
104
+ const headers = new Headers(compactMap({
105
+ "Content-Type": body instanceof Blob && body.type ? body.type : undefined,
106
+ Accept: options?.acceptHeaderOverride
107
+ || "application/json;q=1, text/csv;q=0.9, text/plain;q=0.7, application/octet-stream;q=0.6, application/pdf;q=0.4, application/xml;q=0.3, text/html;q=0",
108
+ "x-apideck-app-id": encodeSimple(
109
+ "x-apideck-app-id",
110
+ payload.appId ?? client._options.appId,
111
+ { explode: false, charEncoding: "none" },
112
+ ),
113
+ "x-apideck-consumer-id": encodeSimple(
114
+ "x-apideck-consumer-id",
115
+ payload.consumerId ?? client._options.consumerId,
116
+ { explode: false, charEncoding: "none" },
117
+ ),
118
+ "x-apideck-downstream-authorization": encodeSimple(
119
+ "x-apideck-downstream-authorization",
120
+ payload.downstreamAuthorization,
121
+ { explode: false, charEncoding: "none" },
122
+ ),
123
+ "x-apideck-downstream-url": encodeSimple(
124
+ "x-apideck-downstream-url",
125
+ payload.downstreamUrl,
126
+ { explode: false, charEncoding: "none" },
127
+ ),
128
+ "x-apideck-service-id": encodeSimple(
129
+ "x-apideck-service-id",
130
+ payload.serviceId,
131
+ { explode: false, charEncoding: "none" },
132
+ ),
133
+ "x-apideck-unified-api": encodeSimple(
134
+ "x-apideck-unified-api",
135
+ payload.unifiedApi,
136
+ { explode: false, charEncoding: "none" },
137
+ ),
138
+ }));
139
+
140
+ const secConfig = await extractSecurity(client._options.apiKey);
141
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
142
+ const requestSecurity = resolveGlobalSecurity(securityInput);
143
+
144
+ const context = {
145
+ options: client._options,
146
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
147
+ operationID: "proxy.postProxy",
148
+ oAuth2Scopes: null,
149
+
150
+ resolvedSecurity: requestSecurity,
151
+
152
+ securitySource: client._options.apiKey,
153
+ retryConfig: options?.retries
154
+ || client._options.retryConfig
155
+ || {
156
+ strategy: "backoff",
157
+ backoff: {
158
+ initialInterval: 500,
159
+ maxInterval: 60000,
160
+ exponent: 1.5,
161
+ maxElapsedTime: 900000,
162
+ },
163
+ retryConnectionErrors: true,
164
+ }
165
+ || { strategy: "none" },
166
+ retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
167
+ };
168
+
169
+ const requestRes = client._createRequest(context, {
170
+ security: requestSecurity,
171
+ method: "POST",
172
+ baseURL: options?.serverURL,
173
+ path: path,
174
+ headers: headers,
175
+ body: body,
176
+ userAgent: client._options.userAgent,
177
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
178
+ }, options);
179
+ if (!requestRes.ok) {
180
+ return [requestRes, { status: "invalid" }];
181
+ }
182
+ const req = requestRes.value;
183
+
184
+ const doResult = await client._do(req, {
185
+ context,
186
+ errorCodes: ["401", "4XX", "5XX"],
187
+ retryConfig: context.retryConfig,
188
+ retryCodes: context.retryCodes,
189
+ });
190
+ if (!doResult.ok) {
191
+ return [doResult, { status: "request-error", request: req }];
192
+ }
193
+ const response = doResult.value;
194
+
195
+ const responseFields = {
196
+ HttpMeta: { Response: response, Request: req },
197
+ };
198
+
199
+ const [result] = await M.match<
200
+ operations.ProxyPostProxyResponse,
201
+ | errors.Unauthorized
202
+ | ApideckError
203
+ | ResponseValidationError
204
+ | ConnectionError
205
+ | RequestAbortedError
206
+ | RequestTimeoutError
207
+ | InvalidRequestError
208
+ | UnexpectedClientError
209
+ | SDKValidationError
210
+ >(
211
+ M.json(200, operations.ProxyPostProxyResponse$inboundSchema, {
212
+ key: "responseJson",
213
+ }),
214
+ M.stream(200, operations.ProxyPostProxyResponse$inboundSchema, {
215
+ key: "responseBinary",
216
+ }),
217
+ M.stream(200, operations.ProxyPostProxyResponse$inboundSchema, {
218
+ ctype: "application/pdf",
219
+ key: "responsePdf",
220
+ }),
221
+ M.text(200, operations.ProxyPostProxyResponse$inboundSchema, {
222
+ ctype: "application/xml",
223
+ key: "responseXml",
224
+ }),
225
+ M.text(200, operations.ProxyPostProxyResponse$inboundSchema, {
226
+ ctype: "text/csv",
227
+ key: "responseCsv",
228
+ }),
229
+ M.text(200, operations.ProxyPostProxyResponse$inboundSchema, {
230
+ key: "responseText",
231
+ }),
232
+ M.jsonErr(401, errors.Unauthorized$inboundSchema),
233
+ M.fail("4XX"),
234
+ M.fail("5XX"),
235
+ M.json("default", operations.ProxyPostProxyResponse$inboundSchema, {
236
+ hdrs: true,
237
+ key: "errorJson",
238
+ }),
239
+ M.text("default", operations.ProxyPostProxyResponse$inboundSchema, {
240
+ ctype: "application/xml",
241
+ hdrs: true,
242
+ key: "errorXml",
243
+ }),
244
+ M.text("default", operations.ProxyPostProxyResponse$inboundSchema, {
245
+ ctype: "text/html",
246
+ hdrs: true,
247
+ key: "errorHtml",
248
+ }),
249
+ M.text("default", operations.ProxyPostProxyResponse$inboundSchema, {
250
+ hdrs: true,
251
+ key: "errorText",
252
+ }),
253
+ )(response, req, { extraFields: responseFields });
254
+ if (!result.ok) {
255
+ return [result, { status: "complete", request: req, response }];
256
+ }
257
+
258
+ return [result, { status: "complete", request: req, response }];
259
+ }