@apideck/unify 0.37.1 → 0.38.1

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 (117) hide show
  1. package/README.md +19 -3
  2. package/examples/package-lock.json +3 -3
  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/ecommercecustomersfilter.d.ts +15 -0
  31. package/models/components/ecommercecustomersfilter.d.ts.map +1 -1
  32. package/models/components/ecommercecustomersfilter.js +6 -0
  33. package/models/components/ecommercecustomersfilter.js.map +1 -1
  34. package/models/components/project.d.ts +11 -2
  35. package/models/components/project.d.ts.map +1 -1
  36. package/models/components/project.js +4 -0
  37. package/models/components/project.js.map +1 -1
  38. package/models/components/projectsfilter.d.ts +3 -0
  39. package/models/components/projectsfilter.d.ts.map +1 -1
  40. package/models/components/projectsfilter.js +3 -0
  41. package/models/components/projectsfilter.js.map +1 -1
  42. package/models/errors/badrequestresponse.d.ts +25 -0
  43. package/models/errors/badrequestresponse.d.ts.map +1 -1
  44. package/models/errors/badrequestresponse.js +16 -1
  45. package/models/errors/badrequestresponse.js.map +1 -1
  46. package/models/errors/index.d.ts +1 -0
  47. package/models/errors/index.d.ts.map +1 -1
  48. package/models/errors/index.js +1 -0
  49. package/models/errors/index.js.map +1 -1
  50. package/models/errors/unauthorized.d.ts +142 -0
  51. package/models/errors/unauthorized.d.ts.map +1 -0
  52. package/models/errors/unauthorized.js +139 -0
  53. package/models/errors/unauthorized.js.map +1 -0
  54. package/models/operations/index.d.ts +6 -0
  55. package/models/operations/index.d.ts.map +1 -1
  56. package/models/operations/index.js +6 -0
  57. package/models/operations/index.js.map +1 -1
  58. package/models/operations/proxydeleteproxy.d.ts +103 -0
  59. package/models/operations/proxydeleteproxy.d.ts.map +1 -0
  60. package/models/operations/proxydeleteproxy.js +80 -0
  61. package/models/operations/proxydeleteproxy.js.map +1 -0
  62. package/models/operations/proxygetproxy.d.ts +103 -0
  63. package/models/operations/proxygetproxy.d.ts.map +1 -0
  64. package/models/operations/proxygetproxy.js +80 -0
  65. package/models/operations/proxygetproxy.js.map +1 -0
  66. package/models/operations/proxyoptionsproxy.d.ts +103 -0
  67. package/models/operations/proxyoptionsproxy.d.ts.map +1 -0
  68. package/models/operations/proxyoptionsproxy.js +80 -0
  69. package/models/operations/proxyoptionsproxy.js.map +1 -0
  70. package/models/operations/proxypatchproxy.d.ts +120 -0
  71. package/models/operations/proxypatchproxy.d.ts.map +1 -0
  72. package/models/operations/proxypatchproxy.js +102 -0
  73. package/models/operations/proxypatchproxy.js.map +1 -0
  74. package/models/operations/proxypostproxy.d.ts +120 -0
  75. package/models/operations/proxypostproxy.d.ts.map +1 -0
  76. package/models/operations/proxypostproxy.js +103 -0
  77. package/models/operations/proxypostproxy.js.map +1 -0
  78. package/models/operations/proxyputproxy.d.ts +120 -0
  79. package/models/operations/proxyputproxy.d.ts.map +1 -0
  80. package/models/operations/proxyputproxy.js +102 -0
  81. package/models/operations/proxyputproxy.js.map +1 -0
  82. package/package.json +3 -3
  83. package/sdk/proxy.d.ts +77 -0
  84. package/sdk/proxy.d.ts.map +1 -0
  85. package/sdk/proxy.js +90 -0
  86. package/sdk/proxy.js.map +1 -0
  87. package/sdk/sdk.d.ts +3 -0
  88. package/sdk/sdk.d.ts.map +1 -1
  89. package/sdk/sdk.js +4 -0
  90. package/sdk/sdk.js.map +1 -1
  91. package/src/__tests__/projects.test.ts +3 -0
  92. package/src/__tests__/proxy.test.ts +41 -0
  93. package/src/funcs/proxyDelete.ts +258 -0
  94. package/src/funcs/proxyGet.ts +258 -0
  95. package/src/funcs/proxyOptions.ts +258 -0
  96. package/src/funcs/proxyPatch.ts +259 -0
  97. package/src/funcs/proxyPost.ts +259 -0
  98. package/src/funcs/proxyPut.ts +259 -0
  99. package/src/lib/config.ts +4 -4
  100. package/src/models/components/ecommercecustomersfilter.ts +21 -0
  101. package/src/models/components/project.ts +17 -2
  102. package/src/models/components/projectsfilter.ts +3 -0
  103. package/src/models/errors/badrequestresponse.ts +51 -0
  104. package/src/models/errors/index.ts +1 -0
  105. package/src/models/errors/unauthorized.ts +282 -0
  106. package/src/models/operations/index.ts +6 -0
  107. package/src/models/operations/proxydeleteproxy.ts +158 -0
  108. package/src/models/operations/proxygetproxy.ts +158 -0
  109. package/src/models/operations/proxyoptionsproxy.ts +158 -0
  110. package/src/models/operations/proxypatchproxy.ts +227 -0
  111. package/src/models/operations/proxypostproxy.ts +212 -0
  112. package/src/models/operations/proxyputproxy.ts +215 -0
  113. package/src/sdk/proxy.ts +135 -0
  114. package/src/sdk/sdk.ts +6 -0
  115. package/src/types/smartUnion.ts +8 -0
  116. package/types/smartUnion.js +7 -0
  117. package/types/smartUnion.js.map +1 -1
@@ -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 PutAcceptEnum {
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
+ * PUT
40
+ *
41
+ * @remarks
42
+ * Proxies a downstream PUT 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 proxyPut(
46
+ client: ApideckCore,
47
+ request: operations.ProxyPutProxyRequest,
48
+ options?: RequestOptions & { acceptHeaderOverride?: PutAcceptEnum },
49
+ ): APIPromise<
50
+ Result<
51
+ operations.ProxyPutProxyResponse,
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.ProxyPutProxyRequest,
73
+ options?: RequestOptions & { acceptHeaderOverride?: PutAcceptEnum },
74
+ ): Promise<
75
+ [
76
+ Result<
77
+ operations.ProxyPutProxyResponse,
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.ProxyPutProxyRequest$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.putProxy",
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: "PUT",
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.ProxyPutProxyResponse,
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.ProxyPutProxyResponse$inboundSchema, {
212
+ key: "responseJson",
213
+ }),
214
+ M.stream(200, operations.ProxyPutProxyResponse$inboundSchema, {
215
+ key: "responseBinary",
216
+ }),
217
+ M.stream(200, operations.ProxyPutProxyResponse$inboundSchema, {
218
+ ctype: "application/pdf",
219
+ key: "responsePdf",
220
+ }),
221
+ M.text(200, operations.ProxyPutProxyResponse$inboundSchema, {
222
+ ctype: "application/xml",
223
+ key: "responseXml",
224
+ }),
225
+ M.text(200, operations.ProxyPutProxyResponse$inboundSchema, {
226
+ ctype: "text/csv",
227
+ key: "responseCsv",
228
+ }),
229
+ M.text(200, operations.ProxyPutProxyResponse$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.ProxyPutProxyResponse$inboundSchema, {
236
+ hdrs: true,
237
+ key: "errorJson",
238
+ }),
239
+ M.text("default", operations.ProxyPutProxyResponse$inboundSchema, {
240
+ ctype: "application/xml",
241
+ hdrs: true,
242
+ key: "errorXml",
243
+ }),
244
+ M.text("default", operations.ProxyPutProxyResponse$inboundSchema, {
245
+ ctype: "text/html",
246
+ hdrs: true,
247
+ key: "errorHtml",
248
+ }),
249
+ M.text("default", operations.ProxyPutProxyResponse$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
+ }
package/src/lib/config.ts CHANGED
@@ -67,8 +67,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
67
67
 
68
68
  export const SDK_METADATA = {
69
69
  language: "typescript",
70
- openapiDocVersion: "10.23.10",
71
- sdkVersion: "0.37.1",
72
- genVersion: "2.797.1",
73
- userAgent: "speakeasy-sdk/typescript 0.37.1 2.797.1 10.23.10 @apideck/unify",
70
+ openapiDocVersion: "10.23.16",
71
+ sdkVersion: "0.38.1",
72
+ genVersion: "2.814.0",
73
+ userAgent: "speakeasy-sdk/typescript 0.38.1 2.814.0 10.23.16 @apideck/unify",
74
74
  } as const;
@@ -14,12 +14,27 @@ export type EcommerceCustomersFilter = {
14
14
  * Customer phone number to filter on
15
15
  */
16
16
  phoneNumber?: string | undefined;
17
+ /**
18
+ * Filter by customer IDs. Specify multiple IDs as a comma-separated string.
19
+ */
20
+ customerIds?: string | undefined;
21
+ /**
22
+ * Minimum date the customer was last modified
23
+ */
24
+ updatedSince?: string | undefined;
25
+ /**
26
+ * Minimum date the customer was created
27
+ */
28
+ createdSince?: string | undefined;
17
29
  };
18
30
 
19
31
  /** @internal */
20
32
  export type EcommerceCustomersFilter$Outbound = {
21
33
  email?: string | undefined;
22
34
  phone_number?: string | undefined;
35
+ customer_ids?: string | undefined;
36
+ updated_since?: string | undefined;
37
+ created_since?: string | undefined;
23
38
  };
24
39
 
25
40
  /** @internal */
@@ -30,9 +45,15 @@ export const EcommerceCustomersFilter$outboundSchema: z.ZodType<
30
45
  > = z.object({
31
46
  email: z.string().optional(),
32
47
  phoneNumber: z.string().optional(),
48
+ customerIds: z.string().optional(),
49
+ updatedSince: z.string().optional(),
50
+ createdSince: z.string().optional(),
33
51
  }).transform((v) => {
34
52
  return remap$(v, {
35
53
  phoneNumber: "phone_number",
54
+ customerIds: "customer_ids",
55
+ updatedSince: "updated_since",
56
+ createdSince: "created_since",
36
57
  });
37
58
  });
38
59
 
@@ -220,9 +220,13 @@ export type Project = {
220
220
  */
221
221
  startDate?: Date | null | undefined;
222
222
  /**
223
- * Expected or actual end date of the project
223
+ * Expected or planned end date of the project
224
224
  */
225
225
  endDate?: Date | null | undefined;
226
+ /**
227
+ * Actual end date of the project
228
+ */
229
+ completionDate?: Date | null | undefined;
226
230
  /**
227
231
  * The customer this entity is linked to.
228
232
  */
@@ -381,9 +385,13 @@ export type ProjectInput = {
381
385
  */
382
386
  startDate?: Date | null | undefined;
383
387
  /**
384
- * Expected or actual end date of the project
388
+ * Expected or planned end date of the project
385
389
  */
386
390
  endDate?: Date | null | undefined;
391
+ /**
392
+ * Actual end date of the project
393
+ */
394
+ completionDate?: Date | null | undefined;
387
395
  /**
388
396
  * The customer this entity is linked to.
389
397
  */
@@ -650,6 +658,7 @@ export const Project$inboundSchema: z.ZodType<Project, z.ZodTypeDef, unknown> =
650
658
  completion_percentage: z.nullable(types.number()).optional(),
651
659
  start_date: z.nullable(types.date()).optional(),
652
660
  end_date: z.nullable(types.date()).optional(),
661
+ completion_date: z.nullable(types.date()).optional(),
653
662
  customer: z.nullable(LinkedCustomer$inboundSchema).optional(),
654
663
  department: z.nullable(z.lazy(() => ProjectDepartment$inboundSchema))
655
664
  .optional(),
@@ -693,6 +702,7 @@ export const Project$inboundSchema: z.ZodType<Project, z.ZodTypeDef, unknown> =
693
702
  "completion_percentage": "completionPercentage",
694
703
  "start_date": "startDate",
695
704
  "end_date": "endDate",
705
+ "completion_date": "completionDate",
696
706
  "company_id": "companyId",
697
707
  "owner_id": "ownerId",
698
708
  "parent_project": "parentProject",
@@ -742,6 +752,7 @@ export type ProjectInput$Outbound = {
742
752
  completion_percentage?: number | null | undefined;
743
753
  start_date?: string | null | undefined;
744
754
  end_date?: string | null | undefined;
755
+ completion_date?: string | null | undefined;
745
756
  customer?: LinkedCustomerInput$Outbound | null | undefined;
746
757
  department?: ProjectDepartment$Outbound | null | undefined;
747
758
  company_id?: string | null | undefined;
@@ -792,6 +803,9 @@ export const ProjectInput$outboundSchema: z.ZodType<
792
803
  endDate: z.nullable(
793
804
  z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)),
794
805
  ).optional(),
806
+ completionDate: z.nullable(
807
+ z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)),
808
+ ).optional(),
795
809
  customer: z.nullable(LinkedCustomerInput$outboundSchema).optional(),
796
810
  department: z.nullable(z.lazy(() => ProjectDepartment$outboundSchema))
797
811
  .optional(),
@@ -828,6 +842,7 @@ export const ProjectInput$outboundSchema: z.ZodType<
828
842
  completionPercentage: "completion_percentage",
829
843
  startDate: "start_date",
830
844
  endDate: "end_date",
845
+ completionDate: "completion_date",
831
846
  companyId: "company_id",
832
847
  ownerId: "owner_id",
833
848
  parentProject: "parent_project",
@@ -16,6 +16,9 @@ export const ProjectStatus = {
16
16
  OnHold: "on_hold",
17
17
  Cancelled: "cancelled",
18
18
  Draft: "draft",
19
+ InProgress: "in_progress",
20
+ Approved: "approved",
21
+ Other: "other",
19
22
  } as const;
20
23
  /**
21
24
  * Status of projects to filter by
@@ -16,6 +16,21 @@ import { SDKValidationError } from "./sdkvalidationerror.js";
16
16
  */
17
17
  export type Detail = string | { [k: string]: any };
18
18
 
19
+ export type DownstreamErrors = {
20
+ /**
21
+ * Error message from the downstream provider
22
+ */
23
+ message?: string | undefined;
24
+ /**
25
+ * Additional error details
26
+ */
27
+ detail?: string | undefined;
28
+ /**
29
+ * Error code from the downstream provider
30
+ */
31
+ code?: string | undefined;
32
+ };
33
+
19
34
  /**
20
35
  * Bad Request
21
36
  */
@@ -44,6 +59,10 @@ export type BadRequestResponseData = {
44
59
  * Link to documentation of error type
45
60
  */
46
61
  ref?: string | undefined;
62
+ /**
63
+ * Contains downstream errors returned from the connector. Only present when type_name is ConnectorExecutionError.
64
+ */
65
+ downstreamErrors?: Array<DownstreamErrors> | undefined;
47
66
  };
48
67
 
49
68
  /**
@@ -70,6 +89,10 @@ export class BadRequestResponse extends ApideckError {
70
89
  * Link to documentation of error type
71
90
  */
72
91
  ref?: string | undefined;
92
+ /**
93
+ * Contains downstream errors returned from the connector. Only present when type_name is ConnectorExecutionError.
94
+ */
95
+ downstreamErrors?: Array<DownstreamErrors> | undefined;
73
96
 
74
97
  /** The original data that was passed to this error instance. */
75
98
  data$: BadRequestResponseData;
@@ -86,6 +109,9 @@ export class BadRequestResponse extends ApideckError {
86
109
  if (err.typeName != null) this.typeName = err.typeName;
87
110
  if (err.detail != null) this.detail = err.detail;
88
111
  if (err.ref != null) this.ref = err.ref;
112
+ if (err.downstreamErrors != null) {
113
+ this.downstreamErrors = err.downstreamErrors;
114
+ }
89
115
 
90
116
  this.name = "BadRequestResponse";
91
117
  }
@@ -105,6 +131,27 @@ export function detailFromJSON(
105
131
  );
106
132
  }
107
133
 
134
+ /** @internal */
135
+ export const DownstreamErrors$inboundSchema: z.ZodType<
136
+ DownstreamErrors,
137
+ z.ZodTypeDef,
138
+ unknown
139
+ > = z.object({
140
+ message: types.optional(types.string()),
141
+ detail: types.optional(types.string()),
142
+ code: types.optional(types.string()),
143
+ });
144
+
145
+ export function downstreamErrorsFromJSON(
146
+ jsonString: string,
147
+ ): SafeParseResult<DownstreamErrors, SDKValidationError> {
148
+ return safeParse(
149
+ jsonString,
150
+ (x) => DownstreamErrors$inboundSchema.parse(JSON.parse(x)),
151
+ `Failed to parse 'DownstreamErrors' from JSON`,
152
+ );
153
+ }
154
+
108
155
  /** @internal */
109
156
  export const BadRequestResponse$inboundSchema: z.ZodType<
110
157
  BadRequestResponse,
@@ -117,6 +164,9 @@ export const BadRequestResponse$inboundSchema: z.ZodType<
117
164
  message: types.optional(types.string()),
118
165
  detail: types.optional(smartUnion([types.string(), z.record(z.any())])),
119
166
  ref: types.optional(types.string()),
167
+ downstream_errors: types.optional(
168
+ z.array(z.lazy(() => DownstreamErrors$inboundSchema)),
169
+ ),
120
170
  request$: z.instanceof(Request),
121
171
  response$: z.instanceof(Response),
122
172
  body$: z.string(),
@@ -125,6 +175,7 @@ export const BadRequestResponse$inboundSchema: z.ZodType<
125
175
  const remapped = remap$(v, {
126
176
  "status_code": "statusCode",
127
177
  "type_name": "typeName",
178
+ "downstream_errors": "downstreamErrors",
128
179
  });
129
180
 
130
181
  return new BadRequestResponse(remapped, {
@@ -10,5 +10,6 @@ export * from "./notfoundresponse.js";
10
10
  export * from "./paymentrequiredresponse.js";
11
11
  export * from "./responsevalidationerror.js";
12
12
  export * from "./sdkvalidationerror.js";
13
+ export * from "./unauthorized.js";
13
14
  export * from "./unauthorizedresponse.js";
14
15
  export * from "./unprocessableresponse.js";