@deliverart/sdk-js-webhook 0.0.0-dev-20260721002647

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/dist/index.js ADDED
@@ -0,0 +1,367 @@
1
+ // src/models.ts
2
+ import {
3
+ booleanSchema,
4
+ datetimeSchema,
5
+ sortDirSchema,
6
+ timestampsFilterSchema
7
+ } from "@deliverart/sdk-js-global-types";
8
+ import { pointOfSaleIriSchema } from "@deliverart/sdk-js-point-of-sale";
9
+ import { z } from "zod";
10
+
11
+ // src/types.ts
12
+ import { iriNullableSchema, iriSchema } from "@deliverart/sdk-js-global-types";
13
+ import {
14
+ webhookEntities,
15
+ webhookEntitySchema,
16
+ webhookEvents,
17
+ webhookEventSchema,
18
+ webhookLogStatuses,
19
+ webhookLogStatusSchema
20
+ } from "@deliverart/sdk-js-global-types";
21
+ var webhookConfigurationIriSchema = iriSchema("/webhooks/configurations/:id");
22
+ var webhookConfigurationNullableIriSchema = iriNullableSchema(
23
+ "/webhooks/configurations/:id"
24
+ );
25
+ var webhookLogIriSchema = iriSchema("/webhooks/logs/:id");
26
+ var webhookLogNullableIriSchema = iriNullableSchema("/webhooks/logs/:id");
27
+
28
+ // src/models.ts
29
+ var webhookConfigurationSchema = z.object({
30
+ id: z.string(),
31
+ pointOfSale: pointOfSaleIriSchema,
32
+ entityClass: webhookEntitySchema,
33
+ events: z.array(webhookEventSchema).min(1, "events.required"),
34
+ callbackUrl: z.url("callbackUrl.invalid").min(1, "callbackUrl.required"),
35
+ secretKey: z.string().min(1, "secretKey.required"),
36
+ isActive: z.boolean().default(true),
37
+ description: z.string().optional().nullable().default(null),
38
+ createdAt: datetimeSchema,
39
+ updatedAt: datetimeSchema
40
+ });
41
+ var webhookConfigurationListItemSchema = webhookConfigurationSchema.omit({
42
+ pointOfSale: true,
43
+ secretKey: true
44
+ });
45
+ var webhookConfigurationsQuerySchema = z.object({
46
+ entityClass: z.string().optional(),
47
+ events: z.union([webhookEventSchema, z.array(webhookEventSchema)]).optional(),
48
+ "order[createdAt]": sortDirSchema.optional(),
49
+ "order[updatedAt]": sortDirSchema.optional(),
50
+ page: z.coerce.number().optional()
51
+ }).extend(timestampsFilterSchema.shape);
52
+ var webhookLogSchema = z.object({
53
+ id: z.string(),
54
+ configuration: webhookConfigurationIriSchema,
55
+ entityClass: webhookEntitySchema,
56
+ externalEntityId: z.uuid(),
57
+ event: webhookEventSchema,
58
+ status: webhookLogStatusSchema,
59
+ requestS3Key: z.string().nullable(),
60
+ responseS3Key: z.string().nullable(),
61
+ httpStatusCode: z.coerce.number().nullable(),
62
+ errorMessage: z.string().nullable(),
63
+ responseTimeMs: z.coerce.number().nullable(),
64
+ requestFileUrl: z.url().nullable(),
65
+ responseFileUrl: z.url().nullable(),
66
+ createdAt: datetimeSchema,
67
+ completedAt: datetimeSchema.nullable()
68
+ });
69
+ var webhookLogListItemSchema = webhookLogSchema.omit({
70
+ configuration: true
71
+ });
72
+ var webhookLogsQuerySchema = z.object({
73
+ entityClass: z.string().optional(),
74
+ externalEntityId: z.string().optional(),
75
+ "exists[completedAt]": booleanSchema.optional(),
76
+ events: z.union([webhookEventSchema, z.array(webhookEventSchema)]).optional(),
77
+ status: z.union([webhookLogStatusSchema, z.array(webhookLogStatusSchema)]).optional(),
78
+ "order[createdAt]": sortDirSchema.optional(),
79
+ "order[completedAt]": sortDirSchema.optional(),
80
+ page: z.coerce.number().optional()
81
+ }).extend({
82
+ "createdAt[before]": z.string().optional(),
83
+ "createdAt[strictly_before]": z.string().optional(),
84
+ "createdAt[after]": z.string().optional(),
85
+ "createdAt[strictly_after]": z.string().optional(),
86
+ "completedAt[before]": z.string().optional(),
87
+ "completedAt[strictly_before]": z.string().optional(),
88
+ "completedAt[after]": z.string().optional(),
89
+ "completedAt[strictly_after]": z.string().optional()
90
+ });
91
+
92
+ // src/requests/webhook-configurations/CreateWebhookConfiguration.ts
93
+ import { AbstractApiRequest } from "@deliverart/sdk-js-core";
94
+ var createWebhookConfigurationInputSchema = webhookConfigurationSchema.pick({
95
+ pointOfSale: true,
96
+ entityClass: true,
97
+ events: true,
98
+ callbackUrl: true,
99
+ secretKey: true,
100
+ isActive: true,
101
+ description: true
102
+ }).required();
103
+ var createWebhookConfigurationResponseSchema = webhookConfigurationSchema;
104
+ var CreateWebhookConfiguration = class extends AbstractApiRequest {
105
+ constructor(input) {
106
+ super(input);
107
+ this.method = "POST";
108
+ this.contentType = "application/json";
109
+ this.accept = "application/json";
110
+ this.inputSchema = createWebhookConfigurationInputSchema;
111
+ this.outputSchema = createWebhookConfigurationResponseSchema;
112
+ this.querySchema = void 0;
113
+ this.headersSchema = void 0;
114
+ }
115
+ getPath() {
116
+ return "/webhooks/configurations";
117
+ }
118
+ };
119
+
120
+ // src/requests/webhook-configurations/DeleteWebhookConfiguration.ts
121
+ import { AbstractApiRequest as AbstractApiRequest2 } from "@deliverart/sdk-js-core";
122
+ import { emptyResponseSchema } from "@deliverart/sdk-js-global-types";
123
+ import { z as z2 } from "zod";
124
+ var deleteWebhookConfigurationInputSchema = z2.undefined();
125
+ var deleteWebhookConfigurationResponseSchema = emptyResponseSchema;
126
+ var DeleteWebhookConfiguration = class extends AbstractApiRequest2 {
127
+ constructor(webhookConfigurationId) {
128
+ super(void 0);
129
+ this.method = "DELETE";
130
+ this.contentType = "application/json";
131
+ this.accept = "application/json";
132
+ this.inputSchema = deleteWebhookConfigurationInputSchema;
133
+ this.outputSchema = deleteWebhookConfigurationResponseSchema;
134
+ this.querySchema = void 0;
135
+ this.headersSchema = void 0;
136
+ this.webhookConfigurationId = webhookConfigurationId;
137
+ }
138
+ getPath() {
139
+ return `/webhooks/configurations/${this.webhookConfigurationId}`;
140
+ }
141
+ };
142
+
143
+ // src/requests/webhook-configurations/GetWebhookConfigurationDetails.ts
144
+ import { AbstractApiRequest as AbstractApiRequest3 } from "@deliverart/sdk-js-core";
145
+ import { z as z3 } from "zod";
146
+ var getWebhookConfigurationDetailsInputSchema = z3.undefined();
147
+ var getWebhookConfigurationDetailsResponseSchema = webhookConfigurationSchema;
148
+ var GetWebhookConfigurationDetails = class extends AbstractApiRequest3 {
149
+ constructor(webhookConfigurationId) {
150
+ super(void 0);
151
+ this.method = "GET";
152
+ this.contentType = "application/json";
153
+ this.accept = "application/json";
154
+ this.inputSchema = getWebhookConfigurationDetailsInputSchema;
155
+ this.outputSchema = getWebhookConfigurationDetailsResponseSchema;
156
+ this.querySchema = void 0;
157
+ this.headersSchema = void 0;
158
+ this.webhookConfigurationId = webhookConfigurationId;
159
+ }
160
+ getPath() {
161
+ return `/webhooks/configurations/${this.webhookConfigurationId}`;
162
+ }
163
+ };
164
+
165
+ // src/requests/webhook-configurations/GetWebhookConfigurations.ts
166
+ import { AbstractApiRequest as AbstractApiRequest4 } from "@deliverart/sdk-js-core";
167
+ import { createPaginatedSchema } from "@deliverart/sdk-js-global-types";
168
+ import { z as z4 } from "zod";
169
+ var getWebhookConfigurationsQuerySchema = webhookConfigurationsQuerySchema;
170
+ var getWebhookConfigurationsInputSchema = z4.undefined();
171
+ var getWebhookConfigurationsResponseSchema = createPaginatedSchema(
172
+ webhookConfigurationListItemSchema
173
+ );
174
+ var GetWebhookConfigurations = class extends AbstractApiRequest4 {
175
+ constructor(options) {
176
+ super(void 0, options);
177
+ this.method = "GET";
178
+ this.contentType = "application/json";
179
+ this.accept = "application/json";
180
+ this.inputSchema = getWebhookConfigurationsInputSchema;
181
+ this.outputSchema = getWebhookConfigurationsResponseSchema;
182
+ this.querySchema = getWebhookConfigurationsQuerySchema;
183
+ this.headersSchema = void 0;
184
+ this.listItemSchema = webhookConfigurationListItemSchema;
185
+ this.paginationDefaultEnabled = true;
186
+ }
187
+ getPath() {
188
+ return "/webhooks/configurations";
189
+ }
190
+ };
191
+
192
+ // src/requests/webhook-configurations/GetWebhookConfigurationsFromPointOfSale.ts
193
+ import { AbstractApiRequest as AbstractApiRequest5 } from "@deliverart/sdk-js-core";
194
+ import { z as z5 } from "zod";
195
+ var getWebhookConfigurationsFromPointOfSaleQuerySchema = webhookConfigurationsQuerySchema;
196
+ var getWebhookConfigurationsFromPointOfSaleInputSchema = z5.undefined();
197
+ var getWebhookConfigurationsFromPointOfSaleResponseSchema = z5.array(
198
+ webhookConfigurationListItemSchema
199
+ );
200
+ var GetWebhookConfigurationsFromPointOfSale = class extends AbstractApiRequest5 {
201
+ constructor(pointOfSaleId, options) {
202
+ super(void 0, options);
203
+ this.method = "GET";
204
+ this.contentType = "application/json";
205
+ this.accept = "application/json";
206
+ this.inputSchema = getWebhookConfigurationsFromPointOfSaleInputSchema;
207
+ this.outputSchema = getWebhookConfigurationsFromPointOfSaleResponseSchema;
208
+ this.querySchema = getWebhookConfigurationsFromPointOfSaleQuerySchema;
209
+ this.headersSchema = void 0;
210
+ this.listItemSchema = webhookConfigurationListItemSchema;
211
+ this.paginationDefaultEnabled = false;
212
+ this.pointOfSaleId = pointOfSaleId;
213
+ }
214
+ getPath() {
215
+ return `/point_of_sales/${this.pointOfSaleId}/webhooks/configurations`;
216
+ }
217
+ };
218
+
219
+ // src/requests/webhook-configurations/UpdateWebhookConfiguration.ts
220
+ import { AbstractApiRequest as AbstractApiRequest6 } from "@deliverart/sdk-js-core";
221
+ var updateWebhookConfigurationInputSchema = webhookConfigurationSchema.pick({
222
+ entityClass: true,
223
+ events: true,
224
+ callbackUrl: true,
225
+ secretKey: true,
226
+ isActive: true,
227
+ description: true
228
+ }).partial();
229
+ var updateWebhookConfigurationResponseSchema = webhookConfigurationSchema;
230
+ var UpdateWebhookConfiguration = class extends AbstractApiRequest6 {
231
+ constructor(webhookConfigurationId, input) {
232
+ super(input);
233
+ this.method = "PATCH";
234
+ this.contentType = "application/merge-patch+json";
235
+ this.accept = "application/json";
236
+ this.inputSchema = updateWebhookConfigurationInputSchema;
237
+ this.outputSchema = updateWebhookConfigurationResponseSchema;
238
+ this.querySchema = void 0;
239
+ this.headersSchema = void 0;
240
+ this.webhookConfigurationId = webhookConfigurationId;
241
+ }
242
+ getPath() {
243
+ return `/webhooks/configurations/${this.webhookConfigurationId}`;
244
+ }
245
+ };
246
+
247
+ // src/requests/webhook-logs/GetWebhookLogDetails.ts
248
+ import { AbstractApiRequest as AbstractApiRequest7 } from "@deliverart/sdk-js-core";
249
+ import { z as z6 } from "zod";
250
+ var getWebhookLogDetailsInputSchema = z6.undefined();
251
+ var getWebhookLogDetailsResponseSchema = webhookLogSchema;
252
+ var GetWebhookLogDetails = class extends AbstractApiRequest7 {
253
+ constructor(webhookLogId) {
254
+ super(void 0);
255
+ this.method = "GET";
256
+ this.contentType = "application/json";
257
+ this.accept = "application/json";
258
+ this.inputSchema = getWebhookLogDetailsInputSchema;
259
+ this.outputSchema = getWebhookLogDetailsResponseSchema;
260
+ this.querySchema = void 0;
261
+ this.headersSchema = void 0;
262
+ this.webhookLogId = webhookLogId;
263
+ }
264
+ getPath() {
265
+ return `/webhooks/logs/${this.webhookLogId}`;
266
+ }
267
+ };
268
+
269
+ // src/requests/webhook-logs/GetWebhookLogs.ts
270
+ import { AbstractApiRequest as AbstractApiRequest8 } from "@deliverart/sdk-js-core";
271
+ import { createPaginatedSchema as createPaginatedSchema2 } from "@deliverart/sdk-js-global-types";
272
+ import { z as z7 } from "zod";
273
+ var getWebhookLogsQuerySchema = webhookLogsQuerySchema;
274
+ var getWebhookLogsInputSchema = z7.undefined();
275
+ var getWebhookLogsResponseSchema = createPaginatedSchema2(webhookLogListItemSchema);
276
+ var GetWebhookLogs = class extends AbstractApiRequest8 {
277
+ constructor(options) {
278
+ super(void 0, options);
279
+ this.method = "GET";
280
+ this.contentType = "application/json";
281
+ this.accept = "application/json";
282
+ this.inputSchema = getWebhookLogsInputSchema;
283
+ this.outputSchema = getWebhookLogsResponseSchema;
284
+ this.querySchema = getWebhookLogsQuerySchema;
285
+ this.headersSchema = void 0;
286
+ this.listItemSchema = webhookLogListItemSchema;
287
+ this.paginationDefaultEnabled = true;
288
+ }
289
+ getPath() {
290
+ return "/webhooks/logs";
291
+ }
292
+ };
293
+
294
+ // src/requests/webhook-logs/GetWebhookLogsFromWebhookConfiguration.ts
295
+ import { AbstractApiRequest as AbstractApiRequest9 } from "@deliverart/sdk-js-core";
296
+ import { createPaginatedSchema as createPaginatedSchema3 } from "@deliverart/sdk-js-global-types";
297
+ import { z as z8 } from "zod";
298
+ var getWebhookLogsFromWebhookConfigurationQuerySchema = webhookLogsQuerySchema;
299
+ var getWebhookLogsFromWebhookConfigurationInputSchema = z8.undefined();
300
+ var getWebhookLogsFromWebhookConfigurationResponseSchema = createPaginatedSchema3(webhookLogListItemSchema);
301
+ var GetWebhookLogsFromWebhookConfiguration = class extends AbstractApiRequest9 {
302
+ constructor(webhookConfigurationId, options) {
303
+ super(void 0, options);
304
+ this.method = "GET";
305
+ this.contentType = "application/json";
306
+ this.accept = "application/json";
307
+ this.inputSchema = getWebhookLogsFromWebhookConfigurationInputSchema;
308
+ this.outputSchema = getWebhookLogsFromWebhookConfigurationResponseSchema;
309
+ this.querySchema = getWebhookLogsFromWebhookConfigurationQuerySchema;
310
+ this.headersSchema = void 0;
311
+ this.listItemSchema = webhookLogListItemSchema;
312
+ this.paginationDefaultEnabled = true;
313
+ this.webhookConfigurationId = webhookConfigurationId;
314
+ }
315
+ getPath() {
316
+ return `/webhooks/configurations/${this.webhookConfigurationId}/logs`;
317
+ }
318
+ };
319
+ export {
320
+ CreateWebhookConfiguration,
321
+ DeleteWebhookConfiguration,
322
+ GetWebhookConfigurationDetails,
323
+ GetWebhookConfigurations,
324
+ GetWebhookConfigurationsFromPointOfSale,
325
+ GetWebhookLogDetails,
326
+ GetWebhookLogs,
327
+ GetWebhookLogsFromWebhookConfiguration,
328
+ UpdateWebhookConfiguration,
329
+ createWebhookConfigurationInputSchema,
330
+ createWebhookConfigurationResponseSchema,
331
+ deleteWebhookConfigurationInputSchema,
332
+ deleteWebhookConfigurationResponseSchema,
333
+ getWebhookConfigurationDetailsInputSchema,
334
+ getWebhookConfigurationDetailsResponseSchema,
335
+ getWebhookConfigurationsFromPointOfSaleInputSchema,
336
+ getWebhookConfigurationsFromPointOfSaleQuerySchema,
337
+ getWebhookConfigurationsFromPointOfSaleResponseSchema,
338
+ getWebhookConfigurationsInputSchema,
339
+ getWebhookConfigurationsQuerySchema,
340
+ getWebhookConfigurationsResponseSchema,
341
+ getWebhookLogDetailsInputSchema,
342
+ getWebhookLogDetailsResponseSchema,
343
+ getWebhookLogsFromWebhookConfigurationInputSchema,
344
+ getWebhookLogsFromWebhookConfigurationQuerySchema,
345
+ getWebhookLogsFromWebhookConfigurationResponseSchema,
346
+ getWebhookLogsInputSchema,
347
+ getWebhookLogsQuerySchema,
348
+ getWebhookLogsResponseSchema,
349
+ updateWebhookConfigurationInputSchema,
350
+ updateWebhookConfigurationResponseSchema,
351
+ webhookConfigurationIriSchema,
352
+ webhookConfigurationListItemSchema,
353
+ webhookConfigurationNullableIriSchema,
354
+ webhookConfigurationSchema,
355
+ webhookConfigurationsQuerySchema,
356
+ webhookEntities,
357
+ webhookEntitySchema,
358
+ webhookEventSchema,
359
+ webhookEvents,
360
+ webhookLogIriSchema,
361
+ webhookLogListItemSchema,
362
+ webhookLogNullableIriSchema,
363
+ webhookLogSchema,
364
+ webhookLogStatusSchema,
365
+ webhookLogStatuses,
366
+ webhookLogsQuerySchema
367
+ };
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@deliverart/sdk-js-webhook",
3
+ "description": "Deliverart JavaScript SDK for Webhook Management",
4
+ "version": "0.0.0-dev-20260721002647",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "tsup": {
9
+ "tsconfig": "./tsconfig.json"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "dependencies": {
21
+ "zod": "4.3.5",
22
+ "@deliverart/sdk-js-global-types": "0.0.0-dev-20260721002647",
23
+ "@deliverart/sdk-js-core": "0.0.0-dev-20260721002647",
24
+ "@deliverart/sdk-js-point-of-sale": "0.0.0-dev-20260721002647"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "scripts": {
30
+ "build": "tsup src/index.ts --dts --format esm,cjs",
31
+ "dev": "tsup src/index.ts --dts --watch"
32
+ }
33
+ }