@apideck/unify 0.38.0 → 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 (98) hide show
  1. package/README.md +19 -3
  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/ecommercecustomersfilter.d.ts +10 -0
  31. package/models/components/ecommercecustomersfilter.d.ts.map +1 -1
  32. package/models/components/ecommercecustomersfilter.js +4 -0
  33. package/models/components/ecommercecustomersfilter.js.map +1 -1
  34. package/models/errors/index.d.ts +1 -0
  35. package/models/errors/index.d.ts.map +1 -1
  36. package/models/errors/index.js +1 -0
  37. package/models/errors/index.js.map +1 -1
  38. package/models/errors/unauthorized.d.ts +142 -0
  39. package/models/errors/unauthorized.d.ts.map +1 -0
  40. package/models/errors/unauthorized.js +139 -0
  41. package/models/errors/unauthorized.js.map +1 -0
  42. package/models/operations/index.d.ts +6 -0
  43. package/models/operations/index.d.ts.map +1 -1
  44. package/models/operations/index.js +6 -0
  45. package/models/operations/index.js.map +1 -1
  46. package/models/operations/proxydeleteproxy.d.ts +103 -0
  47. package/models/operations/proxydeleteproxy.d.ts.map +1 -0
  48. package/models/operations/proxydeleteproxy.js +80 -0
  49. package/models/operations/proxydeleteproxy.js.map +1 -0
  50. package/models/operations/proxygetproxy.d.ts +103 -0
  51. package/models/operations/proxygetproxy.d.ts.map +1 -0
  52. package/models/operations/proxygetproxy.js +80 -0
  53. package/models/operations/proxygetproxy.js.map +1 -0
  54. package/models/operations/proxyoptionsproxy.d.ts +103 -0
  55. package/models/operations/proxyoptionsproxy.d.ts.map +1 -0
  56. package/models/operations/proxyoptionsproxy.js +80 -0
  57. package/models/operations/proxyoptionsproxy.js.map +1 -0
  58. package/models/operations/proxypatchproxy.d.ts +120 -0
  59. package/models/operations/proxypatchproxy.d.ts.map +1 -0
  60. package/models/operations/proxypatchproxy.js +102 -0
  61. package/models/operations/proxypatchproxy.js.map +1 -0
  62. package/models/operations/proxypostproxy.d.ts +120 -0
  63. package/models/operations/proxypostproxy.d.ts.map +1 -0
  64. package/models/operations/proxypostproxy.js +103 -0
  65. package/models/operations/proxypostproxy.js.map +1 -0
  66. package/models/operations/proxyputproxy.d.ts +120 -0
  67. package/models/operations/proxyputproxy.d.ts.map +1 -0
  68. package/models/operations/proxyputproxy.js +102 -0
  69. package/models/operations/proxyputproxy.js.map +1 -0
  70. package/package.json +1 -1
  71. package/sdk/proxy.d.ts +77 -0
  72. package/sdk/proxy.d.ts.map +1 -0
  73. package/sdk/proxy.js +90 -0
  74. package/sdk/proxy.js.map +1 -0
  75. package/sdk/sdk.d.ts +3 -0
  76. package/sdk/sdk.d.ts.map +1 -1
  77. package/sdk/sdk.js +4 -0
  78. package/sdk/sdk.js.map +1 -1
  79. package/src/__tests__/proxy.test.ts +41 -0
  80. package/src/funcs/proxyDelete.ts +258 -0
  81. package/src/funcs/proxyGet.ts +258 -0
  82. package/src/funcs/proxyOptions.ts +258 -0
  83. package/src/funcs/proxyPatch.ts +259 -0
  84. package/src/funcs/proxyPost.ts +259 -0
  85. package/src/funcs/proxyPut.ts +259 -0
  86. package/src/lib/config.ts +4 -4
  87. package/src/models/components/ecommercecustomersfilter.ts +14 -0
  88. package/src/models/errors/index.ts +1 -0
  89. package/src/models/errors/unauthorized.ts +282 -0
  90. package/src/models/operations/index.ts +6 -0
  91. package/src/models/operations/proxydeleteproxy.ts +158 -0
  92. package/src/models/operations/proxygetproxy.ts +158 -0
  93. package/src/models/operations/proxyoptionsproxy.ts +158 -0
  94. package/src/models/operations/proxypatchproxy.ts +227 -0
  95. package/src/models/operations/proxypostproxy.ts +212 -0
  96. package/src/models/operations/proxyputproxy.ts +215 -0
  97. package/src/sdk/proxy.ts +135 -0
  98. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,215 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type ProxyPutProxyGlobals = {
14
+ /**
15
+ * ID of the consumer which you want to get or push data from
16
+ */
17
+ consumerId?: string | undefined;
18
+ /**
19
+ * The ID of your Unify application
20
+ */
21
+ appId?: string | undefined;
22
+ };
23
+
24
+ export type RequestBody3 = {};
25
+
26
+ export type RequestBody1 = {};
27
+
28
+ export type ProxyPutProxyRequest = {
29
+ /**
30
+ * ID of the consumer which you want to get or push data from
31
+ */
32
+ consumerId?: string | undefined;
33
+ /**
34
+ * The ID of your Unify application
35
+ */
36
+ appId?: string | undefined;
37
+ /**
38
+ * Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API.
39
+ */
40
+ serviceId: string;
41
+ /**
42
+ * Specify which unified API to use for the connection lookup. Required for multi-API connectors (e.g., Workday) to ensure the correct credentials are used.
43
+ */
44
+ unifiedApi?: string | undefined;
45
+ /**
46
+ * Downstream URL
47
+ */
48
+ downstreamUrl: string;
49
+ /**
50
+ * Downstream authorization header. This will skip the Vault token injection.
51
+ */
52
+ downstreamAuthorization?: string | undefined;
53
+ /**
54
+ * Depending on the verb/method of the request this will contain the request body you want to POST/PATCH/PUT.
55
+ */
56
+ requestBody?:
57
+ | ReadableStream<Uint8Array>
58
+ | Blob
59
+ | ArrayBuffer
60
+ | Uint8Array
61
+ | undefined;
62
+ };
63
+
64
+ export type ProxyPutProxyResponse = {
65
+ httpMeta: components.HTTPMetadata;
66
+ /**
67
+ * Ok
68
+ */
69
+ responseJson?: { [k: string]: any } | undefined;
70
+ /**
71
+ * Ok
72
+ */
73
+ responseBinary?: ReadableStream<Uint8Array> | undefined;
74
+ /**
75
+ * Ok
76
+ */
77
+ responsePdf?: ReadableStream<Uint8Array> | undefined;
78
+ /**
79
+ * Ok
80
+ */
81
+ responseXml?: string | undefined;
82
+ /**
83
+ * Ok
84
+ */
85
+ responseCsv?: string | undefined;
86
+ /**
87
+ * Ok
88
+ */
89
+ responseText?: string | undefined;
90
+ /**
91
+ * Proxy error
92
+ */
93
+ errorJson?: { [k: string]: any } | undefined;
94
+ /**
95
+ * Proxy error
96
+ */
97
+ errorXml?: string | undefined;
98
+ /**
99
+ * Proxy error
100
+ */
101
+ errorHtml?: string | undefined;
102
+ /**
103
+ * Proxy error
104
+ */
105
+ errorText?: string | undefined;
106
+ };
107
+
108
+ /** @internal */
109
+ export type RequestBody3$Outbound = {};
110
+
111
+ /** @internal */
112
+ export const RequestBody3$outboundSchema: z.ZodType<
113
+ RequestBody3$Outbound,
114
+ z.ZodTypeDef,
115
+ RequestBody3
116
+ > = z.object({});
117
+
118
+ export function requestBody3ToJSON(requestBody3: RequestBody3): string {
119
+ return JSON.stringify(RequestBody3$outboundSchema.parse(requestBody3));
120
+ }
121
+
122
+ /** @internal */
123
+ export type RequestBody1$Outbound = {};
124
+
125
+ /** @internal */
126
+ export const RequestBody1$outboundSchema: z.ZodType<
127
+ RequestBody1$Outbound,
128
+ z.ZodTypeDef,
129
+ RequestBody1
130
+ > = z.object({});
131
+
132
+ export function requestBody1ToJSON(requestBody1: RequestBody1): string {
133
+ return JSON.stringify(RequestBody1$outboundSchema.parse(requestBody1));
134
+ }
135
+
136
+ /** @internal */
137
+ export type ProxyPutProxyRequest$Outbound = {
138
+ consumerId?: string | undefined;
139
+ appId?: string | undefined;
140
+ serviceId: string;
141
+ unifiedApi?: string | undefined;
142
+ downstreamUrl: string;
143
+ downstreamAuthorization?: string | undefined;
144
+ RequestBody?:
145
+ | ReadableStream<Uint8Array>
146
+ | Blob
147
+ | ArrayBuffer
148
+ | Uint8Array
149
+ | undefined;
150
+ };
151
+
152
+ /** @internal */
153
+ export const ProxyPutProxyRequest$outboundSchema: z.ZodType<
154
+ ProxyPutProxyRequest$Outbound,
155
+ z.ZodTypeDef,
156
+ ProxyPutProxyRequest
157
+ > = z.object({
158
+ consumerId: z.string().optional(),
159
+ appId: z.string().optional(),
160
+ serviceId: z.string(),
161
+ unifiedApi: z.string().optional(),
162
+ downstreamUrl: z.string(),
163
+ downstreamAuthorization: z.string().optional(),
164
+ requestBody: z.union([
165
+ z.instanceof(ReadableStream<Uint8Array>),
166
+ z.instanceof(Blob),
167
+ z.instanceof(ArrayBuffer),
168
+ z.instanceof(Uint8Array),
169
+ ]).optional(),
170
+ }).transform((v) => {
171
+ return remap$(v, {
172
+ requestBody: "RequestBody",
173
+ });
174
+ });
175
+
176
+ export function proxyPutProxyRequestToJSON(
177
+ proxyPutProxyRequest: ProxyPutProxyRequest,
178
+ ): string {
179
+ return JSON.stringify(
180
+ ProxyPutProxyRequest$outboundSchema.parse(proxyPutProxyRequest),
181
+ );
182
+ }
183
+
184
+ /** @internal */
185
+ export const ProxyPutProxyResponse$inboundSchema: z.ZodType<
186
+ ProxyPutProxyResponse,
187
+ z.ZodTypeDef,
188
+ unknown
189
+ > = z.object({
190
+ HttpMeta: components.HTTPMetadata$inboundSchema,
191
+ responseJson: types.optional(z.record(z.any())),
192
+ responseBinary: types.optional(z.instanceof(ReadableStream<Uint8Array>)),
193
+ responsePdf: types.optional(z.instanceof(ReadableStream<Uint8Array>)),
194
+ responseXml: types.optional(types.string()),
195
+ responseCsv: types.optional(types.string()),
196
+ responseText: types.optional(types.string()),
197
+ errorJson: types.optional(z.record(z.any())),
198
+ errorXml: types.optional(types.string()),
199
+ errorHtml: types.optional(types.string()),
200
+ errorText: types.optional(types.string()),
201
+ }).transform((v) => {
202
+ return remap$(v, {
203
+ "HttpMeta": "httpMeta",
204
+ });
205
+ });
206
+
207
+ export function proxyPutProxyResponseFromJSON(
208
+ jsonString: string,
209
+ ): SafeParseResult<ProxyPutProxyResponse, SDKValidationError> {
210
+ return safeParse(
211
+ jsonString,
212
+ (x) => ProxyPutProxyResponse$inboundSchema.parse(JSON.parse(x)),
213
+ `Failed to parse 'ProxyPutProxyResponse' from JSON`,
214
+ );
215
+ }
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { DeleteAcceptEnum, proxyDelete } from "../funcs/proxyDelete.js";
6
+ import { GetAcceptEnum, proxyGet } from "../funcs/proxyGet.js";
7
+ import { OptionsAcceptEnum, proxyOptions } from "../funcs/proxyOptions.js";
8
+ import { PatchAcceptEnum, proxyPatch } from "../funcs/proxyPatch.js";
9
+ import { PostAcceptEnum, proxyPost } from "../funcs/proxyPost.js";
10
+ import { proxyPut, PutAcceptEnum } from "../funcs/proxyPut.js";
11
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
12
+ import * as operations from "../models/operations/index.js";
13
+ import { unwrapAsync } from "../types/fp.js";
14
+
15
+ export { GetAcceptEnum } from "../funcs/proxyGet.js";
16
+
17
+ export { OptionsAcceptEnum } from "../funcs/proxyOptions.js";
18
+
19
+ export { PostAcceptEnum } from "../funcs/proxyPost.js";
20
+
21
+ export { PutAcceptEnum } from "../funcs/proxyPut.js";
22
+
23
+ export { PatchAcceptEnum } from "../funcs/proxyPatch.js";
24
+
25
+ export { DeleteAcceptEnum } from "../funcs/proxyDelete.js";
26
+
27
+ export class Proxy extends ClientSDK {
28
+ /**
29
+ * GET
30
+ *
31
+ * @remarks
32
+ * Proxies a downstream GET 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.
33
+ * **Note**: Vault will proxy all data to the downstream URL and method/verb in the headers.
34
+ */
35
+ async get(
36
+ request: operations.ProxyGetProxyRequest,
37
+ options?: RequestOptions & { acceptHeaderOverride?: GetAcceptEnum },
38
+ ): Promise<operations.ProxyGetProxyResponse> {
39
+ return unwrapAsync(proxyGet(
40
+ this,
41
+ request,
42
+ options,
43
+ ));
44
+ }
45
+
46
+ /**
47
+ * OPTIONS
48
+ *
49
+ * @remarks
50
+ * Proxies a downstream OPTION 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.
51
+ * **Note**: Vault will proxy all data to the downstream URL and method/verb in the headers.
52
+ */
53
+ async options(
54
+ request: operations.ProxyOptionsProxyRequest,
55
+ options?: RequestOptions & { acceptHeaderOverride?: OptionsAcceptEnum },
56
+ ): Promise<operations.ProxyOptionsProxyResponse> {
57
+ return unwrapAsync(proxyOptions(
58
+ this,
59
+ request,
60
+ options,
61
+ ));
62
+ }
63
+
64
+ /**
65
+ * POST
66
+ *
67
+ * @remarks
68
+ * 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.
69
+ * **Note**: Vault will proxy all data to the downstream URL and method/verb in the headers.
70
+ */
71
+ async post(
72
+ request: operations.ProxyPostProxyRequest,
73
+ options?: RequestOptions & { acceptHeaderOverride?: PostAcceptEnum },
74
+ ): Promise<operations.ProxyPostProxyResponse> {
75
+ return unwrapAsync(proxyPost(
76
+ this,
77
+ request,
78
+ options,
79
+ ));
80
+ }
81
+
82
+ /**
83
+ * PUT
84
+ *
85
+ * @remarks
86
+ * 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.
87
+ * **Note**: Vault will proxy all data to the downstream URL and method/verb in the headers.
88
+ */
89
+ async put(
90
+ request: operations.ProxyPutProxyRequest,
91
+ options?: RequestOptions & { acceptHeaderOverride?: PutAcceptEnum },
92
+ ): Promise<operations.ProxyPutProxyResponse> {
93
+ return unwrapAsync(proxyPut(
94
+ this,
95
+ request,
96
+ options,
97
+ ));
98
+ }
99
+
100
+ /**
101
+ * PATCH
102
+ *
103
+ * @remarks
104
+ * 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.
105
+ * **Note**: Vault will proxy all data to the downstream URL and method/verb in the headers.
106
+ */
107
+ async patch(
108
+ request: operations.ProxyPatchProxyRequest,
109
+ options?: RequestOptions & { acceptHeaderOverride?: PatchAcceptEnum },
110
+ ): Promise<operations.ProxyPatchProxyResponse> {
111
+ return unwrapAsync(proxyPatch(
112
+ this,
113
+ request,
114
+ options,
115
+ ));
116
+ }
117
+
118
+ /**
119
+ * DELETE
120
+ *
121
+ * @remarks
122
+ * Proxies a downstream DELETE 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.
123
+ * **Note**: Vault will proxy all data to the downstream URL and method/verb in the headers.
124
+ */
125
+ async delete(
126
+ request: operations.ProxyDeleteProxyRequest,
127
+ options?: RequestOptions & { acceptHeaderOverride?: DeleteAcceptEnum },
128
+ ): Promise<operations.ProxyDeleteProxyResponse> {
129
+ return unwrapAsync(proxyDelete(
130
+ this,
131
+ request,
132
+ options,
133
+ ));
134
+ }
135
+ }
package/src/sdk/sdk.ts CHANGED
@@ -11,6 +11,7 @@ import { Ecommerce } from "./ecommerce.js";
11
11
  import { FileStorage } from "./filestorage.js";
12
12
  import { Hris } from "./hris.js";
13
13
  import { IssueTracking } from "./issuetracking.js";
14
+ import { Proxy } from "./proxy.js";
14
15
  import { Sms } from "./sms.js";
15
16
  import { Vault } from "./vault.js";
16
17
  import { Webhook } from "./webhook.js";
@@ -61,6 +62,11 @@ export class Apideck extends ClientSDK {
61
62
  return (this._connector ??= new Connector(this._options));
62
63
  }
63
64
 
65
+ private _proxy?: Proxy;
66
+ get proxy(): Proxy {
67
+ return (this._proxy ??= new Proxy(this._options));
68
+ }
69
+
64
70
  private _vault?: Vault;
65
71
  get vault(): Vault {
66
72
  return (this._vault ??= new Vault(this._options));