@dalmore/api-contracts 0.0.0-dev.fbec0a1 → 0.0.0-dev.fef3ec8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/constants.d.ts +15 -0
- package/common/constants.js +15 -0
- package/common/constants.js.map +1 -1
- package/common/types/account.types.js +3 -3
- package/common/types/account.types.js.map +1 -1
- package/common/types/common.types.d.ts +12 -3
- package/common/types/common.types.js +12 -3
- package/common/types/common.types.js.map +1 -1
- package/common/types/csv.types.d.ts +2020 -138
- package/common/types/csv.types.js +145 -33
- package/common/types/csv.types.js.map +1 -1
- package/common/types/index.d.ts +0 -2
- package/common/types/index.js +0 -2
- package/common/types/index.js.map +1 -1
- package/common/types/invite.types.d.ts +3 -0
- package/common/types/invite.types.js +1 -0
- package/common/types/invite.types.js.map +1 -1
- package/common/types/issuer-offering.types.d.ts +163 -0
- package/common/types/issuer-offering.types.js +5 -6
- package/common/types/issuer-offering.types.js.map +1 -1
- package/common/types/mail-template.types.d.ts +4 -4
- package/common/types/notification.types.d.ts +1 -0
- package/common/types/notification.types.js +3 -0
- package/common/types/notification.types.js.map +1 -1
- package/common/types/offering-submission.types.js +1 -1
- package/common/types/offering.types.js +4 -1
- package/common/types/offering.types.js.map +1 -1
- package/common/types/payment-methods.types.d.ts +365 -0
- package/common/types/payment-methods.types.js +121 -0
- package/common/types/payment-methods.types.js.map +1 -1
- package/common/types/task.types.d.ts +8 -0
- package/common/types/task.types.js +3 -0
- package/common/types/task.types.js.map +1 -1
- package/common/types/trade.types.d.ts +10 -14
- package/common/types/trade.types.js +2 -7
- package/common/types/trade.types.js.map +1 -1
- package/common/types/transaction.types.d.ts +24 -1
- package/common/types/transaction.types.js +26 -0
- package/common/types/transaction.types.js.map +1 -1
- package/common/types/user.types.d.ts +6 -112
- package/common/types/user.types.js +5 -26
- package/common/types/user.types.js.map +1 -1
- package/common/types/zapier.types.d.ts +126 -0
- package/common/types/zapier.types.js +247 -0
- package/common/types/zapier.types.js.map +1 -0
- package/contracts/clients/csv/index.d.ts +74 -7
- package/contracts/clients/csv/index.js +19 -2
- package/contracts/clients/csv/index.js.map +1 -1
- package/contracts/clients/index.d.ts +1163 -671
- package/contracts/clients/index.js +4 -2
- package/contracts/clients/index.js.map +1 -1
- package/contracts/clients/webhooks/index.d.ts +506 -0
- package/contracts/clients/webhooks/index.js +118 -0
- package/contracts/clients/webhooks/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -23,15 +23,16 @@ import { tradeLineItemsContract } from './trade-line-items/index.js';
|
|
|
23
23
|
import { clientsTransactionsContract } from './transactions/index.js';
|
|
24
24
|
import { csvContract } from './csv/index.js';
|
|
25
25
|
import { reviewContract } from './review/index.js';
|
|
26
|
+
import { webhooksContract } from './webhooks/index.js';
|
|
26
27
|
const c = initContract();
|
|
27
28
|
// API KEY AUTH
|
|
28
29
|
export const clientsContract = c.router({
|
|
29
30
|
accounts: accountsContract,
|
|
30
31
|
aic: aicContract,
|
|
31
|
-
auth: authContract,
|
|
32
|
-
apiKeys: apiKeysContract,
|
|
33
32
|
apiKeyLogs: clientApiKeyLogsContract,
|
|
33
|
+
apiKeys: apiKeysContract,
|
|
34
34
|
assets: assetsContract,
|
|
35
|
+
auth: authContract,
|
|
35
36
|
cart: cartContract,
|
|
36
37
|
csv: csvContract,
|
|
37
38
|
files: filesContract,
|
|
@@ -50,6 +51,7 @@ export const clientsContract = c.router({
|
|
|
50
51
|
tradeLineItems: tradeLineItemsContract,
|
|
51
52
|
trades: tradesContract,
|
|
52
53
|
transactions: clientsTransactionsContract,
|
|
54
|
+
webhooks: webhooksContract,
|
|
53
55
|
}, {
|
|
54
56
|
pathPrefix: '/clients/api/v1/',
|
|
55
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBA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EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;AAEzB,eAAe;AACf,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CACrC;IACE,QAAQ,EAAE,gBAAgB;IAC1B,GAAG,EAAE,WAAW;IAChB,UAAU,EAAE,wBAAwB;IACpC,OAAO,EAAE,eAAe;IACxB,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;IAChB,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,mBAAmB;IAChC,gBAAgB,EAAE,wBAAwB;IAC1C,oBAAoB,EAAE,4BAA4B;IAClD,OAAO,EAAE,eAAe;IACxB,GAAG,EAAE,WAAW;IAChB,aAAa,EAAE,mBAAmB;IAClC,SAAS,EAAE,iBAAiB;IAC5B,cAAc,EAAE,sBAAsB;IACtC,MAAM,EAAE,cAAc;IACtB,cAAc,EAAE,qBAAqB;IACrC,KAAK,EAAE,aAAa;IACpB,cAAc,EAAE,sBAAsB;IACtC,MAAM,EAAE,cAAc;IACtB,YAAY,EAAE,2BAA2B;IACzC,QAAQ,EAAE,gBAAgB;CAC3B,EACD;IACE,UAAU,EAAE,kBAAkB;CAC/B,CACF,CAAC"}
|
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const IPaginatedWebhookSubscriptions: z.ZodObject<{
|
|
3
|
+
items: z.ZodArray<z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
targetUrl: z.ZodString;
|
|
6
|
+
eventTypes: z.ZodArray<z.ZodString, "many">;
|
|
7
|
+
name: z.ZodNullable<z.ZodString>;
|
|
8
|
+
enabled: z.ZodBoolean;
|
|
9
|
+
createdAt: z.ZodString;
|
|
10
|
+
updatedAt: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
id: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
name: string | null;
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
targetUrl: string;
|
|
18
|
+
eventTypes: string[];
|
|
19
|
+
}, {
|
|
20
|
+
id: string;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
name: string | null;
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
targetUrl: string;
|
|
26
|
+
eventTypes: string[];
|
|
27
|
+
}>, "many">;
|
|
28
|
+
meta: z.ZodObject<{
|
|
29
|
+
itemCount: z.ZodNumber;
|
|
30
|
+
totalItems: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
itemsPerPage: z.ZodNumber;
|
|
32
|
+
totalPages: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
currentPage: z.ZodNumber;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
itemCount: number;
|
|
36
|
+
itemsPerPage: number;
|
|
37
|
+
currentPage: number;
|
|
38
|
+
totalItems?: number | undefined;
|
|
39
|
+
totalPages?: number | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
itemCount: number;
|
|
42
|
+
itemsPerPage: number;
|
|
43
|
+
currentPage: number;
|
|
44
|
+
totalItems?: number | undefined;
|
|
45
|
+
totalPages?: number | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
items: {
|
|
49
|
+
id: string;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
updatedAt: string;
|
|
52
|
+
name: string | null;
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
targetUrl: string;
|
|
55
|
+
eventTypes: string[];
|
|
56
|
+
}[];
|
|
57
|
+
meta: {
|
|
58
|
+
itemCount: number;
|
|
59
|
+
itemsPerPage: number;
|
|
60
|
+
currentPage: number;
|
|
61
|
+
totalItems?: number | undefined;
|
|
62
|
+
totalPages?: number | undefined;
|
|
63
|
+
};
|
|
64
|
+
}, {
|
|
65
|
+
items: {
|
|
66
|
+
id: string;
|
|
67
|
+
createdAt: string;
|
|
68
|
+
updatedAt: string;
|
|
69
|
+
name: string | null;
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
targetUrl: string;
|
|
72
|
+
eventTypes: string[];
|
|
73
|
+
}[];
|
|
74
|
+
meta: {
|
|
75
|
+
itemCount: number;
|
|
76
|
+
itemsPerPage: number;
|
|
77
|
+
currentPage: number;
|
|
78
|
+
totalItems?: number | undefined;
|
|
79
|
+
totalPages?: number | undefined;
|
|
80
|
+
};
|
|
81
|
+
}>;
|
|
82
|
+
export declare const webhooksContract: {
|
|
83
|
+
subscribe: {
|
|
84
|
+
description: "Creates a new webhook subscription for the specified event types. Used by Zapier REST Hook.";
|
|
85
|
+
method: "POST";
|
|
86
|
+
metadata: {
|
|
87
|
+
auth: boolean;
|
|
88
|
+
};
|
|
89
|
+
body: z.ZodObject<{
|
|
90
|
+
targetUrl: z.ZodString;
|
|
91
|
+
eventTypes: z.ZodArray<z.ZodString, "many">;
|
|
92
|
+
name: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
targetUrl: string;
|
|
95
|
+
eventTypes: string[];
|
|
96
|
+
name?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
targetUrl: string;
|
|
99
|
+
eventTypes: string[];
|
|
100
|
+
name?: string | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
summary: "Subscribe to webhook events";
|
|
103
|
+
path: "webhooks/subscribe";
|
|
104
|
+
responses: {
|
|
105
|
+
201: z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
hook0SubscriptionId: z.ZodNullable<z.ZodString>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
id: string;
|
|
110
|
+
hook0SubscriptionId: string | null;
|
|
111
|
+
}, {
|
|
112
|
+
id: string;
|
|
113
|
+
hook0SubscriptionId: string | null;
|
|
114
|
+
}>;
|
|
115
|
+
400: z.ZodObject<{
|
|
116
|
+
status: z.ZodNumber;
|
|
117
|
+
message: z.ZodString;
|
|
118
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
message: string;
|
|
121
|
+
status: number;
|
|
122
|
+
errors: string[];
|
|
123
|
+
}, {
|
|
124
|
+
message: string;
|
|
125
|
+
status: number;
|
|
126
|
+
errors: string[];
|
|
127
|
+
}>;
|
|
128
|
+
401: z.ZodObject<{
|
|
129
|
+
status: z.ZodNumber;
|
|
130
|
+
message: z.ZodString;
|
|
131
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
message: string;
|
|
134
|
+
status: number;
|
|
135
|
+
errors: string[];
|
|
136
|
+
}, {
|
|
137
|
+
message: string;
|
|
138
|
+
status: number;
|
|
139
|
+
errors: string[];
|
|
140
|
+
}>;
|
|
141
|
+
403: z.ZodObject<{
|
|
142
|
+
status: z.ZodNumber;
|
|
143
|
+
message: z.ZodString;
|
|
144
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
|
146
|
+
message: string;
|
|
147
|
+
status: number;
|
|
148
|
+
errors: string[];
|
|
149
|
+
}, {
|
|
150
|
+
message: string;
|
|
151
|
+
status: number;
|
|
152
|
+
errors: string[];
|
|
153
|
+
}>;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
unsubscribe: {
|
|
157
|
+
description: "Deletes a webhook subscription by ID. Used by Zapier REST Hook.";
|
|
158
|
+
method: "DELETE";
|
|
159
|
+
metadata: {
|
|
160
|
+
auth: boolean;
|
|
161
|
+
};
|
|
162
|
+
body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
163
|
+
pathParams: z.ZodObject<{
|
|
164
|
+
id: z.ZodString;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
id: string;
|
|
167
|
+
}, {
|
|
168
|
+
id: string;
|
|
169
|
+
}>;
|
|
170
|
+
summary: "Unsubscribe from webhook";
|
|
171
|
+
path: "webhooks/:id";
|
|
172
|
+
responses: {
|
|
173
|
+
204: z.ZodUndefined;
|
|
174
|
+
401: z.ZodObject<{
|
|
175
|
+
status: z.ZodNumber;
|
|
176
|
+
message: z.ZodString;
|
|
177
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
178
|
+
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
message: string;
|
|
180
|
+
status: number;
|
|
181
|
+
errors: string[];
|
|
182
|
+
}, {
|
|
183
|
+
message: string;
|
|
184
|
+
status: number;
|
|
185
|
+
errors: string[];
|
|
186
|
+
}>;
|
|
187
|
+
403: z.ZodObject<{
|
|
188
|
+
status: z.ZodNumber;
|
|
189
|
+
message: z.ZodString;
|
|
190
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
message: string;
|
|
193
|
+
status: number;
|
|
194
|
+
errors: string[];
|
|
195
|
+
}, {
|
|
196
|
+
message: string;
|
|
197
|
+
status: number;
|
|
198
|
+
errors: string[];
|
|
199
|
+
}>;
|
|
200
|
+
404: z.ZodObject<{
|
|
201
|
+
status: z.ZodNumber;
|
|
202
|
+
message: z.ZodString;
|
|
203
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
message: string;
|
|
206
|
+
status: number;
|
|
207
|
+
errors: string[];
|
|
208
|
+
}, {
|
|
209
|
+
message: string;
|
|
210
|
+
status: number;
|
|
211
|
+
errors: string[];
|
|
212
|
+
}>;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
list: {
|
|
216
|
+
description: "Returns a paginated list of webhook subscriptions.";
|
|
217
|
+
method: "GET";
|
|
218
|
+
metadata: {
|
|
219
|
+
auth: boolean;
|
|
220
|
+
};
|
|
221
|
+
query: z.ZodObject<{
|
|
222
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>>;
|
|
223
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>>;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
page: number;
|
|
226
|
+
limit: number;
|
|
227
|
+
}, {
|
|
228
|
+
page?: number | undefined;
|
|
229
|
+
limit?: number | undefined;
|
|
230
|
+
}>;
|
|
231
|
+
summary: "List webhook subscriptions";
|
|
232
|
+
path: "webhooks";
|
|
233
|
+
responses: {
|
|
234
|
+
200: z.ZodObject<{
|
|
235
|
+
items: z.ZodArray<z.ZodObject<{
|
|
236
|
+
id: z.ZodString;
|
|
237
|
+
targetUrl: z.ZodString;
|
|
238
|
+
eventTypes: z.ZodArray<z.ZodString, "many">;
|
|
239
|
+
name: z.ZodNullable<z.ZodString>;
|
|
240
|
+
enabled: z.ZodBoolean;
|
|
241
|
+
createdAt: z.ZodString;
|
|
242
|
+
updatedAt: z.ZodString;
|
|
243
|
+
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
id: string;
|
|
245
|
+
createdAt: string;
|
|
246
|
+
updatedAt: string;
|
|
247
|
+
name: string | null;
|
|
248
|
+
enabled: boolean;
|
|
249
|
+
targetUrl: string;
|
|
250
|
+
eventTypes: string[];
|
|
251
|
+
}, {
|
|
252
|
+
id: string;
|
|
253
|
+
createdAt: string;
|
|
254
|
+
updatedAt: string;
|
|
255
|
+
name: string | null;
|
|
256
|
+
enabled: boolean;
|
|
257
|
+
targetUrl: string;
|
|
258
|
+
eventTypes: string[];
|
|
259
|
+
}>, "many">;
|
|
260
|
+
meta: z.ZodObject<{
|
|
261
|
+
itemCount: z.ZodNumber;
|
|
262
|
+
totalItems: z.ZodOptional<z.ZodNumber>;
|
|
263
|
+
itemsPerPage: z.ZodNumber;
|
|
264
|
+
totalPages: z.ZodOptional<z.ZodNumber>;
|
|
265
|
+
currentPage: z.ZodNumber;
|
|
266
|
+
}, "strip", z.ZodTypeAny, {
|
|
267
|
+
itemCount: number;
|
|
268
|
+
itemsPerPage: number;
|
|
269
|
+
currentPage: number;
|
|
270
|
+
totalItems?: number | undefined;
|
|
271
|
+
totalPages?: number | undefined;
|
|
272
|
+
}, {
|
|
273
|
+
itemCount: number;
|
|
274
|
+
itemsPerPage: number;
|
|
275
|
+
currentPage: number;
|
|
276
|
+
totalItems?: number | undefined;
|
|
277
|
+
totalPages?: number | undefined;
|
|
278
|
+
}>;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
items: {
|
|
281
|
+
id: string;
|
|
282
|
+
createdAt: string;
|
|
283
|
+
updatedAt: string;
|
|
284
|
+
name: string | null;
|
|
285
|
+
enabled: boolean;
|
|
286
|
+
targetUrl: string;
|
|
287
|
+
eventTypes: string[];
|
|
288
|
+
}[];
|
|
289
|
+
meta: {
|
|
290
|
+
itemCount: number;
|
|
291
|
+
itemsPerPage: number;
|
|
292
|
+
currentPage: number;
|
|
293
|
+
totalItems?: number | undefined;
|
|
294
|
+
totalPages?: number | undefined;
|
|
295
|
+
};
|
|
296
|
+
}, {
|
|
297
|
+
items: {
|
|
298
|
+
id: string;
|
|
299
|
+
createdAt: string;
|
|
300
|
+
updatedAt: string;
|
|
301
|
+
name: string | null;
|
|
302
|
+
enabled: boolean;
|
|
303
|
+
targetUrl: string;
|
|
304
|
+
eventTypes: string[];
|
|
305
|
+
}[];
|
|
306
|
+
meta: {
|
|
307
|
+
itemCount: number;
|
|
308
|
+
itemsPerPage: number;
|
|
309
|
+
currentPage: number;
|
|
310
|
+
totalItems?: number | undefined;
|
|
311
|
+
totalPages?: number | undefined;
|
|
312
|
+
};
|
|
313
|
+
}>;
|
|
314
|
+
401: z.ZodObject<{
|
|
315
|
+
status: z.ZodNumber;
|
|
316
|
+
message: z.ZodString;
|
|
317
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
318
|
+
}, "strip", z.ZodTypeAny, {
|
|
319
|
+
message: string;
|
|
320
|
+
status: number;
|
|
321
|
+
errors: string[];
|
|
322
|
+
}, {
|
|
323
|
+
message: string;
|
|
324
|
+
status: number;
|
|
325
|
+
errors: string[];
|
|
326
|
+
}>;
|
|
327
|
+
403: z.ZodObject<{
|
|
328
|
+
status: z.ZodNumber;
|
|
329
|
+
message: z.ZodString;
|
|
330
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
message: string;
|
|
333
|
+
status: number;
|
|
334
|
+
errors: string[];
|
|
335
|
+
}, {
|
|
336
|
+
message: string;
|
|
337
|
+
status: number;
|
|
338
|
+
errors: string[];
|
|
339
|
+
}>;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
triggerTypes: {
|
|
343
|
+
description: "Returns a list of event types that can be subscribed to for triggers.";
|
|
344
|
+
method: "GET";
|
|
345
|
+
metadata: {
|
|
346
|
+
auth: boolean;
|
|
347
|
+
};
|
|
348
|
+
summary: "Get available trigger types";
|
|
349
|
+
path: "webhooks/trigger-types";
|
|
350
|
+
responses: {
|
|
351
|
+
200: z.ZodArray<z.ZodObject<{
|
|
352
|
+
eventType: z.ZodString;
|
|
353
|
+
displayName: z.ZodString;
|
|
354
|
+
description: z.ZodString;
|
|
355
|
+
source: z.ZodEnum<["api", "external", "both"]>;
|
|
356
|
+
}, "strip", z.ZodTypeAny, {
|
|
357
|
+
description: string;
|
|
358
|
+
source: "api" | "external" | "both";
|
|
359
|
+
eventType: string;
|
|
360
|
+
displayName: string;
|
|
361
|
+
}, {
|
|
362
|
+
description: string;
|
|
363
|
+
source: "api" | "external" | "both";
|
|
364
|
+
eventType: string;
|
|
365
|
+
displayName: string;
|
|
366
|
+
}>, "many">;
|
|
367
|
+
401: z.ZodObject<{
|
|
368
|
+
status: z.ZodNumber;
|
|
369
|
+
message: z.ZodString;
|
|
370
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
371
|
+
}, "strip", z.ZodTypeAny, {
|
|
372
|
+
message: string;
|
|
373
|
+
status: number;
|
|
374
|
+
errors: string[];
|
|
375
|
+
}, {
|
|
376
|
+
message: string;
|
|
377
|
+
status: number;
|
|
378
|
+
errors: string[];
|
|
379
|
+
}>;
|
|
380
|
+
403: z.ZodObject<{
|
|
381
|
+
status: z.ZodNumber;
|
|
382
|
+
message: z.ZodString;
|
|
383
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
384
|
+
}, "strip", z.ZodTypeAny, {
|
|
385
|
+
message: string;
|
|
386
|
+
status: number;
|
|
387
|
+
errors: string[];
|
|
388
|
+
}, {
|
|
389
|
+
message: string;
|
|
390
|
+
status: number;
|
|
391
|
+
errors: string[];
|
|
392
|
+
}>;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
actionTypes: {
|
|
396
|
+
description: "Returns a list of API endpoints available as Zapier actions.";
|
|
397
|
+
method: "GET";
|
|
398
|
+
metadata: {
|
|
399
|
+
auth: boolean;
|
|
400
|
+
};
|
|
401
|
+
summary: "Get available action types";
|
|
402
|
+
path: "webhooks/action-types";
|
|
403
|
+
responses: {
|
|
404
|
+
200: z.ZodArray<z.ZodObject<{
|
|
405
|
+
key: z.ZodString;
|
|
406
|
+
displayName: z.ZodString;
|
|
407
|
+
description: z.ZodString;
|
|
408
|
+
method: z.ZodEnum<["GET", "POST", "PATCH", "PUT", "DELETE"]>;
|
|
409
|
+
endpoint: z.ZodString;
|
|
410
|
+
noun: z.ZodString;
|
|
411
|
+
}, "strip", z.ZodTypeAny, {
|
|
412
|
+
key: string;
|
|
413
|
+
description: string;
|
|
414
|
+
endpoint: string;
|
|
415
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
416
|
+
displayName: string;
|
|
417
|
+
noun: string;
|
|
418
|
+
}, {
|
|
419
|
+
key: string;
|
|
420
|
+
description: string;
|
|
421
|
+
endpoint: string;
|
|
422
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
423
|
+
displayName: string;
|
|
424
|
+
noun: string;
|
|
425
|
+
}>, "many">;
|
|
426
|
+
401: z.ZodObject<{
|
|
427
|
+
status: z.ZodNumber;
|
|
428
|
+
message: z.ZodString;
|
|
429
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
430
|
+
}, "strip", z.ZodTypeAny, {
|
|
431
|
+
message: string;
|
|
432
|
+
status: number;
|
|
433
|
+
errors: string[];
|
|
434
|
+
}, {
|
|
435
|
+
message: string;
|
|
436
|
+
status: number;
|
|
437
|
+
errors: string[];
|
|
438
|
+
}>;
|
|
439
|
+
403: z.ZodObject<{
|
|
440
|
+
status: z.ZodNumber;
|
|
441
|
+
message: z.ZodString;
|
|
442
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
443
|
+
}, "strip", z.ZodTypeAny, {
|
|
444
|
+
message: string;
|
|
445
|
+
status: number;
|
|
446
|
+
errors: string[];
|
|
447
|
+
}, {
|
|
448
|
+
message: string;
|
|
449
|
+
status: number;
|
|
450
|
+
errors: string[];
|
|
451
|
+
}>;
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
performList: {
|
|
455
|
+
description: "Returns recent events for a specific event type. Used as a polling fallback by Zapier.";
|
|
456
|
+
method: "GET";
|
|
457
|
+
metadata: {
|
|
458
|
+
auth: boolean;
|
|
459
|
+
};
|
|
460
|
+
pathParams: z.ZodObject<{
|
|
461
|
+
eventType: z.ZodString;
|
|
462
|
+
}, "strip", z.ZodTypeAny, {
|
|
463
|
+
eventType: string;
|
|
464
|
+
}, {
|
|
465
|
+
eventType: string;
|
|
466
|
+
}>;
|
|
467
|
+
query: z.ZodObject<{
|
|
468
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
469
|
+
}, "strip", z.ZodTypeAny, {
|
|
470
|
+
limit: number;
|
|
471
|
+
}, {
|
|
472
|
+
limit?: number | undefined;
|
|
473
|
+
}>;
|
|
474
|
+
summary: "Perform list for event type";
|
|
475
|
+
path: "webhooks/perform/:eventType";
|
|
476
|
+
responses: {
|
|
477
|
+
200: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
478
|
+
401: z.ZodObject<{
|
|
479
|
+
status: z.ZodNumber;
|
|
480
|
+
message: z.ZodString;
|
|
481
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
482
|
+
}, "strip", z.ZodTypeAny, {
|
|
483
|
+
message: string;
|
|
484
|
+
status: number;
|
|
485
|
+
errors: string[];
|
|
486
|
+
}, {
|
|
487
|
+
message: string;
|
|
488
|
+
status: number;
|
|
489
|
+
errors: string[];
|
|
490
|
+
}>;
|
|
491
|
+
403: z.ZodObject<{
|
|
492
|
+
status: z.ZodNumber;
|
|
493
|
+
message: z.ZodString;
|
|
494
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
495
|
+
}, "strip", z.ZodTypeAny, {
|
|
496
|
+
message: string;
|
|
497
|
+
status: number;
|
|
498
|
+
errors: string[];
|
|
499
|
+
}, {
|
|
500
|
+
message: string;
|
|
501
|
+
status: number;
|
|
502
|
+
errors: string[];
|
|
503
|
+
}>;
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { BadRequestError, ForbiddenError, NotFoundError, UnauthorizedError, PaginationOptionsZod, IPaginationMeta, } from '../../../common/types/index.js';
|
|
4
|
+
import { CreateWebhookSubscriptionZod, WebhookSubscriptionResponseZod, WebhookSubscriptionZod, ZapierActionTypeZod, ZapierTriggerTypeZod, } from '../../../common/types/zapier.types.js';
|
|
5
|
+
const c = initContract();
|
|
6
|
+
export const IPaginatedWebhookSubscriptions = z.object({
|
|
7
|
+
items: z.array(WebhookSubscriptionZod),
|
|
8
|
+
meta: IPaginationMeta,
|
|
9
|
+
});
|
|
10
|
+
export const webhooksContract = c.router({
|
|
11
|
+
// Subscribe to events (Zapier REST Hook)
|
|
12
|
+
subscribe: {
|
|
13
|
+
summary: 'Subscribe to webhook events',
|
|
14
|
+
description: 'Creates a new webhook subscription for the specified event types. Used by Zapier REST Hook.',
|
|
15
|
+
method: 'POST',
|
|
16
|
+
path: '/subscribe',
|
|
17
|
+
metadata: {
|
|
18
|
+
auth: true,
|
|
19
|
+
},
|
|
20
|
+
body: CreateWebhookSubscriptionZod,
|
|
21
|
+
responses: {
|
|
22
|
+
201: WebhookSubscriptionResponseZod,
|
|
23
|
+
400: BadRequestError,
|
|
24
|
+
401: UnauthorizedError,
|
|
25
|
+
403: ForbiddenError,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
// Unsubscribe (Zapier REST Hook)
|
|
29
|
+
unsubscribe: {
|
|
30
|
+
summary: 'Unsubscribe from webhook',
|
|
31
|
+
description: 'Deletes a webhook subscription by ID. Used by Zapier REST Hook.',
|
|
32
|
+
method: 'DELETE',
|
|
33
|
+
path: '/:id',
|
|
34
|
+
metadata: {
|
|
35
|
+
auth: true,
|
|
36
|
+
},
|
|
37
|
+
pathParams: z.object({
|
|
38
|
+
id: z.string(),
|
|
39
|
+
}),
|
|
40
|
+
body: z.object({}),
|
|
41
|
+
responses: {
|
|
42
|
+
204: z.undefined(),
|
|
43
|
+
401: UnauthorizedError,
|
|
44
|
+
403: ForbiddenError,
|
|
45
|
+
404: NotFoundError,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
// List subscriptions
|
|
49
|
+
list: {
|
|
50
|
+
summary: 'List webhook subscriptions',
|
|
51
|
+
description: 'Returns a paginated list of webhook subscriptions.',
|
|
52
|
+
method: 'GET',
|
|
53
|
+
path: '',
|
|
54
|
+
metadata: {
|
|
55
|
+
auth: true,
|
|
56
|
+
},
|
|
57
|
+
query: PaginationOptionsZod,
|
|
58
|
+
responses: {
|
|
59
|
+
200: IPaginatedWebhookSubscriptions,
|
|
60
|
+
401: UnauthorizedError,
|
|
61
|
+
403: ForbiddenError,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
// Get available trigger event types
|
|
65
|
+
triggerTypes: {
|
|
66
|
+
summary: 'Get available trigger types',
|
|
67
|
+
description: 'Returns a list of event types that can be subscribed to for triggers.',
|
|
68
|
+
method: 'GET',
|
|
69
|
+
path: '/trigger-types',
|
|
70
|
+
metadata: {
|
|
71
|
+
auth: true,
|
|
72
|
+
},
|
|
73
|
+
responses: {
|
|
74
|
+
200: z.array(ZapierTriggerTypeZod),
|
|
75
|
+
401: UnauthorizedError,
|
|
76
|
+
403: ForbiddenError,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
// Get available actions (endpoints that can be called)
|
|
80
|
+
actionTypes: {
|
|
81
|
+
summary: 'Get available action types',
|
|
82
|
+
description: 'Returns a list of API endpoints available as Zapier actions.',
|
|
83
|
+
method: 'GET',
|
|
84
|
+
path: '/action-types',
|
|
85
|
+
metadata: {
|
|
86
|
+
auth: true,
|
|
87
|
+
},
|
|
88
|
+
responses: {
|
|
89
|
+
200: z.array(ZapierActionTypeZod),
|
|
90
|
+
401: UnauthorizedError,
|
|
91
|
+
403: ForbiddenError,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
// Perform List - polling fallback for Zapier
|
|
95
|
+
performList: {
|
|
96
|
+
summary: 'Perform list for event type',
|
|
97
|
+
description: 'Returns recent events for a specific event type. Used as a polling fallback by Zapier.',
|
|
98
|
+
method: 'GET',
|
|
99
|
+
path: '/perform/:eventType',
|
|
100
|
+
metadata: {
|
|
101
|
+
auth: true,
|
|
102
|
+
},
|
|
103
|
+
pathParams: z.object({
|
|
104
|
+
eventType: z.string(),
|
|
105
|
+
}),
|
|
106
|
+
query: z.object({
|
|
107
|
+
limit: z.coerce.number().optional().default(50),
|
|
108
|
+
}),
|
|
109
|
+
responses: {
|
|
110
|
+
200: z.array(z.record(z.unknown())),
|
|
111
|
+
401: UnauthorizedError,
|
|
112
|
+
403: ForbiddenError,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
}, {
|
|
116
|
+
pathPrefix: 'webhooks',
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;AAEzB,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC;IACtC,IAAI,EAAE,eAAe;CACtB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CACtC;IACE,yCAAyC;IACzC,SAAS,EAAE;QACT,OAAO,EAAE,6BAA6B;QACtC,WAAW,EACT,6FAA6F;QAC/F,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI;SACX;QACD,IAAI,EAAE,4BAA4B;QAClC,SAAS,EAAE;YACT,GAAG,EAAE,8BAA8B;YACnC,GAAG,EAAE,eAAe;YACpB,GAAG,EAAE,iBAAiB;YACtB,GAAG,EAAE,cAAc;SACpB;KACF;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