@deliverart/sdk-js-integration 0.0.3 → 0.0.5
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +54 -6
- package/dist/index.d.cts +264 -2311
- package/dist/index.d.ts +264 -2311
- package/dist/index.js +47 -6
- package/package.json +1 -1
- package/src/cancellation-request-types.ts +12 -4
- package/src/schemas.ts +8 -1
- package/src/types.ts +57 -1
package/dist/index.js
CHANGED
|
@@ -87,7 +87,9 @@ var integrationCassaInCloudWebHookEventEventSchema = z.enum(
|
|
|
87
87
|
integrationCassaInCloudWebHookEventEvents
|
|
88
88
|
);
|
|
89
89
|
function createIntegrationPathSchemas(service) {
|
|
90
|
-
const regex = new RegExp(
|
|
90
|
+
const regex = new RegExp(
|
|
91
|
+
`^/integrations/${service}/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`
|
|
92
|
+
);
|
|
91
93
|
const pathSchema = z.string().refine((val) => regex.test(val), {
|
|
92
94
|
message: `Invalid integration ${service} path format`
|
|
93
95
|
});
|
|
@@ -96,15 +98,36 @@ function createIntegrationPathSchemas(service) {
|
|
|
96
98
|
});
|
|
97
99
|
return { pathSchema, nullablePathSchema };
|
|
98
100
|
}
|
|
101
|
+
function createIntegrationMenuVersionPathSchemas(service) {
|
|
102
|
+
const regex = new RegExp(
|
|
103
|
+
`^/integrations/${service}/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/menu_versions/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`
|
|
104
|
+
);
|
|
105
|
+
const pathSchema = z.string().refine((val) => regex.test(val), {
|
|
106
|
+
message: `Invalid integration ${service} menu version path format`
|
|
107
|
+
});
|
|
108
|
+
const nullablePathSchema = z.string().nullable().refine((val) => val == null || regex.test(val), {
|
|
109
|
+
message: `Invalid integration ${service} menu version path format`
|
|
110
|
+
});
|
|
111
|
+
return { pathSchema, nullablePathSchema };
|
|
112
|
+
}
|
|
99
113
|
var integrationPathSchemas = Object.fromEntries(
|
|
100
114
|
integrationServices.map((service) => [service, createIntegrationPathSchemas(service)])
|
|
101
115
|
);
|
|
116
|
+
var integrationMenuVersionPathSchemas = Object.fromEntries(
|
|
117
|
+
integrationServices.map((service) => [service, createIntegrationMenuVersionPathSchemas(service)])
|
|
118
|
+
);
|
|
102
119
|
var integrationDeliverooPathSchema = integrationPathSchemas.deliveroo.pathSchema;
|
|
103
120
|
var integrationDeliverooNullablePathSchema = integrationPathSchemas.deliveroo.nullablePathSchema;
|
|
121
|
+
var integrationDeliverooMenuVersionPathSchema = integrationMenuVersionPathSchemas.deliveroo.pathSchema;
|
|
122
|
+
var integrationDeliverooMenuVersionNullablePathSchema = integrationMenuVersionPathSchemas.deliveroo.nullablePathSchema;
|
|
104
123
|
var integrationGlovoPathSchema = integrationPathSchemas.glovo.pathSchema;
|
|
105
124
|
var integrationGlovoNullablePathSchema = integrationPathSchemas.glovo.nullablePathSchema;
|
|
125
|
+
var integrationGlovoMenuVersionPathSchema = integrationMenuVersionPathSchemas.glovo.pathSchema;
|
|
126
|
+
var integrationGlovoMenuVersionNullablePathSchema = integrationMenuVersionPathSchemas.glovo.nullablePathSchema;
|
|
106
127
|
var integrationJustEatPathSchema = integrationPathSchemas.justeat.pathSchema;
|
|
107
128
|
var integrationJustEatNullablePathSchema = integrationPathSchemas.justeat.nullablePathSchema;
|
|
129
|
+
var integrationJustEatMenuVersionPathSchema = integrationMenuVersionPathSchemas.justeat.pathSchema;
|
|
130
|
+
var integrationJustEatMenuVersionNullablePathSchema = integrationMenuVersionPathSchemas.justeat.nullablePathSchema;
|
|
108
131
|
var integrationCassaInCloudPathSchema = integrationPathSchemas.cassa_in_cloud.pathSchema;
|
|
109
132
|
var integrationCassaInCloudNullablePathSchema = integrationPathSchemas.cassa_in_cloud.nullablePathSchema;
|
|
110
133
|
var integrationPathSchema = z.string().refine(
|
|
@@ -281,13 +304,20 @@ var integrationCancellationRequestStatuses = ["pending", "aborted", "completed"]
|
|
|
281
304
|
var integrationCancellationRequestStatusSchema = z6.enum(
|
|
282
305
|
integrationCancellationRequestStatuses
|
|
283
306
|
);
|
|
284
|
-
var integrationCancellationRequestPathSchema = z6.string().refine(
|
|
285
|
-
|
|
286
|
-
|
|
307
|
+
var integrationCancellationRequestPathSchema = z6.string().refine(
|
|
308
|
+
(val) => /^\/integrations\/cancellation_requests\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
309
|
+
val
|
|
310
|
+
),
|
|
311
|
+
{
|
|
312
|
+
message: "Invalid integration cancellation request path format"
|
|
313
|
+
}
|
|
314
|
+
);
|
|
287
315
|
var integrationCancellationRequestNullablePathSchema = z6.string().nullable().refine(
|
|
288
316
|
(val) => {
|
|
289
317
|
if (!val) return true;
|
|
290
|
-
return /^\/integrations\/cancellation_requests\/[
|
|
318
|
+
return /^\/integrations\/cancellation_requests\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
319
|
+
val
|
|
320
|
+
);
|
|
291
321
|
},
|
|
292
322
|
{
|
|
293
323
|
message: "Invalid integration cancellation request path format"
|
|
@@ -813,7 +843,11 @@ var integrationDeliveryProviderCommonSchema = z23.object({
|
|
|
813
843
|
isValidMenu: z23.boolean(),
|
|
814
844
|
latestMenuSyncAt: datetimeSchema3.nullable(),
|
|
815
845
|
latestMenuCheckAt: datetimeSchema3.nullable(),
|
|
816
|
-
currentMenuVersion:
|
|
846
|
+
currentMenuVersion: z23.union([
|
|
847
|
+
integrationDeliverooMenuVersionNullablePathSchema,
|
|
848
|
+
integrationGlovoMenuVersionNullablePathSchema,
|
|
849
|
+
integrationJustEatMenuVersionNullablePathSchema
|
|
850
|
+
]),
|
|
817
851
|
salesMode: salesModeNullablePathSchema
|
|
818
852
|
});
|
|
819
853
|
var integrationClientLogRequestSchema = z23.object({
|
|
@@ -3321,6 +3355,8 @@ export {
|
|
|
3321
3355
|
integrationClientLogRequestMethods,
|
|
3322
3356
|
integrationClientLogRequestSchema,
|
|
3323
3357
|
integrationDeliverooDataSchema,
|
|
3358
|
+
integrationDeliverooMenuVersionNullablePathSchema,
|
|
3359
|
+
integrationDeliverooMenuVersionPathSchema,
|
|
3324
3360
|
integrationDeliverooNullablePathSchema,
|
|
3325
3361
|
integrationDeliverooPathSchema,
|
|
3326
3362
|
integrationDeliverooSiteStatusSchema,
|
|
@@ -3338,6 +3374,8 @@ export {
|
|
|
3338
3374
|
integrationGlovoDataSchema,
|
|
3339
3375
|
integrationGlovoMenuUpdateStatusSchema,
|
|
3340
3376
|
integrationGlovoMenuUpdateStatuses,
|
|
3377
|
+
integrationGlovoMenuVersionNullablePathSchema,
|
|
3378
|
+
integrationGlovoMenuVersionPathSchema,
|
|
3341
3379
|
integrationGlovoNullablePathSchema,
|
|
3342
3380
|
integrationGlovoPathSchema,
|
|
3343
3381
|
integrationGlovoStoreStatusSchema,
|
|
@@ -3347,6 +3385,8 @@ export {
|
|
|
3347
3385
|
integrationGlovoWebhookEventTypeSchema,
|
|
3348
3386
|
integrationGlovoWebhookEventTypes,
|
|
3349
3387
|
integrationJustEatDataSchema,
|
|
3388
|
+
integrationJustEatMenuVersionNullablePathSchema,
|
|
3389
|
+
integrationJustEatMenuVersionPathSchema,
|
|
3350
3390
|
integrationJustEatNullablePathSchema,
|
|
3351
3391
|
integrationJustEatPathSchema,
|
|
3352
3392
|
integrationJustEatRestaurantStatusSchema,
|
|
@@ -3357,6 +3397,7 @@ export {
|
|
|
3357
3397
|
integrationJustEatSyncOpeningHoursResponseSchema,
|
|
3358
3398
|
integrationJustEatSyncTypeSchema,
|
|
3359
3399
|
integrationJustEatSyncTypes,
|
|
3400
|
+
integrationMenuVersionPathSchemas,
|
|
3360
3401
|
integrationNullablePathSchema,
|
|
3361
3402
|
integrationPathSchema,
|
|
3362
3403
|
integrationPathSchemas,
|
package/package.json
CHANGED
|
@@ -10,9 +10,15 @@ export type IntegrationCancellationRequestStatus = z.infer<
|
|
|
10
10
|
|
|
11
11
|
export const integrationCancellationRequestPathSchema = z
|
|
12
12
|
.string()
|
|
13
|
-
.refine(
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
.refine(
|
|
14
|
+
val =>
|
|
15
|
+
/^\/integrations\/cancellation_requests\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
16
|
+
val,
|
|
17
|
+
),
|
|
18
|
+
{
|
|
19
|
+
message: 'Invalid integration cancellation request path format',
|
|
20
|
+
},
|
|
21
|
+
)
|
|
16
22
|
export type IntegrationCancellationRequestPath = z.infer<
|
|
17
23
|
typeof integrationCancellationRequestPathSchema
|
|
18
24
|
>
|
|
@@ -23,7 +29,9 @@ export const integrationCancellationRequestNullablePathSchema = z
|
|
|
23
29
|
.refine(
|
|
24
30
|
val => {
|
|
25
31
|
if (!val) return true
|
|
26
|
-
return /^\/integrations\/cancellation_requests\/[
|
|
32
|
+
return /^\/integrations\/cancellation_requests\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
|
|
33
|
+
val,
|
|
34
|
+
)
|
|
27
35
|
},
|
|
28
36
|
{
|
|
29
37
|
message: 'Invalid integration cancellation request path format',
|
package/src/schemas.ts
CHANGED
|
@@ -6,6 +6,9 @@ import { z } from 'zod'
|
|
|
6
6
|
import { integrationCancellationRequestNullablePathSchema } from './cancellation-request-types'
|
|
7
7
|
import {
|
|
8
8
|
integrationClientLogRequestMethodSchema,
|
|
9
|
+
integrationDeliverooMenuVersionNullablePathSchema,
|
|
10
|
+
integrationGlovoMenuVersionNullablePathSchema,
|
|
11
|
+
integrationJustEatMenuVersionNullablePathSchema,
|
|
9
12
|
integrationPathSchema,
|
|
10
13
|
integrationProviderSchema,
|
|
11
14
|
integrationServiceSchema,
|
|
@@ -55,7 +58,11 @@ export const integrationDeliveryProviderCommonSchema = z.object({
|
|
|
55
58
|
isValidMenu: z.boolean(),
|
|
56
59
|
latestMenuSyncAt: datetimeSchema.nullable(),
|
|
57
60
|
latestMenuCheckAt: datetimeSchema.nullable(),
|
|
58
|
-
currentMenuVersion:
|
|
61
|
+
currentMenuVersion: z.union([
|
|
62
|
+
integrationDeliverooMenuVersionNullablePathSchema,
|
|
63
|
+
integrationGlovoMenuVersionNullablePathSchema,
|
|
64
|
+
integrationJustEatMenuVersionNullablePathSchema,
|
|
65
|
+
]),
|
|
59
66
|
salesMode: salesModeNullablePathSchema,
|
|
60
67
|
})
|
|
61
68
|
|
package/src/types.ts
CHANGED
|
@@ -132,7 +132,9 @@ export type IntegrationCassaInCloudWebHookEventEvent = z.infer<
|
|
|
132
132
|
>
|
|
133
133
|
|
|
134
134
|
function createIntegrationPathSchemas(service: IntegrationService) {
|
|
135
|
-
const regex = new RegExp(
|
|
135
|
+
const regex = new RegExp(
|
|
136
|
+
`^/integrations/${service}/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`,
|
|
137
|
+
)
|
|
136
138
|
|
|
137
139
|
const pathSchema = z.string().refine(val => regex.test(val), {
|
|
138
140
|
message: `Invalid integration ${service} path format`,
|
|
@@ -148,10 +150,33 @@ function createIntegrationPathSchemas(service: IntegrationService) {
|
|
|
148
150
|
return { pathSchema, nullablePathSchema }
|
|
149
151
|
}
|
|
150
152
|
|
|
153
|
+
function createIntegrationMenuVersionPathSchemas(service: IntegrationService) {
|
|
154
|
+
const regex = new RegExp(
|
|
155
|
+
`^/integrations/${service}/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/menu_versions/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
const pathSchema = z.string().refine(val => regex.test(val), {
|
|
159
|
+
message: `Invalid integration ${service} menu version path format`,
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const nullablePathSchema = z
|
|
163
|
+
.string()
|
|
164
|
+
.nullable()
|
|
165
|
+
.refine(val => val == null || regex.test(val), {
|
|
166
|
+
message: `Invalid integration ${service} menu version path format`,
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
return { pathSchema, nullablePathSchema }
|
|
170
|
+
}
|
|
171
|
+
|
|
151
172
|
export const integrationPathSchemas = Object.fromEntries(
|
|
152
173
|
integrationServices.map(service => [service, createIntegrationPathSchemas(service)]),
|
|
153
174
|
) as Record<IntegrationService, ReturnType<typeof createIntegrationPathSchemas>>
|
|
154
175
|
|
|
176
|
+
export const integrationMenuVersionPathSchemas = Object.fromEntries(
|
|
177
|
+
integrationServices.map(service => [service, createIntegrationMenuVersionPathSchemas(service)]),
|
|
178
|
+
) as Record<IntegrationService, ReturnType<typeof createIntegrationMenuVersionPathSchemas>>
|
|
179
|
+
|
|
155
180
|
export const integrationDeliverooPathSchema = integrationPathSchemas.deliveroo.pathSchema
|
|
156
181
|
export const integrationDeliverooNullablePathSchema =
|
|
157
182
|
integrationPathSchemas.deliveroo.nullablePathSchema
|
|
@@ -160,17 +185,48 @@ export type IntegrationDeliverooNullablePath = z.infer<
|
|
|
160
185
|
typeof integrationDeliverooNullablePathSchema
|
|
161
186
|
>
|
|
162
187
|
|
|
188
|
+
export const integrationDeliverooMenuVersionPathSchema =
|
|
189
|
+
integrationMenuVersionPathSchemas.deliveroo.pathSchema
|
|
190
|
+
export const integrationDeliverooMenuVersionNullablePathSchema =
|
|
191
|
+
integrationMenuVersionPathSchemas.deliveroo.nullablePathSchema
|
|
192
|
+
export type IntegrationDeliverooMenuVersionPath = z.infer<
|
|
193
|
+
typeof integrationDeliverooMenuVersionPathSchema
|
|
194
|
+
>
|
|
195
|
+
export type IntegrationDeliverooMenuVersionNullablePath = z.infer<
|
|
196
|
+
typeof integrationDeliverooMenuVersionNullablePathSchema
|
|
197
|
+
>
|
|
198
|
+
|
|
163
199
|
export const integrationGlovoPathSchema = integrationPathSchemas.glovo.pathSchema
|
|
164
200
|
export const integrationGlovoNullablePathSchema = integrationPathSchemas.glovo.nullablePathSchema
|
|
165
201
|
export type IntegrationGlovoPath = z.infer<typeof integrationGlovoPathSchema>
|
|
166
202
|
export type IntegrationGlovoNullablePath = z.infer<typeof integrationGlovoNullablePathSchema>
|
|
167
203
|
|
|
204
|
+
export const integrationGlovoMenuVersionPathSchema =
|
|
205
|
+
integrationMenuVersionPathSchemas.glovo.pathSchema
|
|
206
|
+
export const integrationGlovoMenuVersionNullablePathSchema =
|
|
207
|
+
integrationMenuVersionPathSchemas.glovo.nullablePathSchema
|
|
208
|
+
export type IntegrationGlovoMenuVersionPath = z.infer<typeof integrationGlovoMenuVersionPathSchema>
|
|
209
|
+
export type IntegrationGlovoMenuVersionNullablePath = z.infer<
|
|
210
|
+
typeof integrationGlovoMenuVersionNullablePathSchema
|
|
211
|
+
>
|
|
212
|
+
|
|
168
213
|
export const integrationJustEatPathSchema = integrationPathSchemas.justeat.pathSchema
|
|
169
214
|
export const integrationJustEatNullablePathSchema =
|
|
170
215
|
integrationPathSchemas.justeat.nullablePathSchema
|
|
171
216
|
export type IntegrationJustEatPath = z.infer<typeof integrationJustEatPathSchema>
|
|
172
217
|
export type IntegrationJustEatNullablePath = z.infer<typeof integrationJustEatNullablePathSchema>
|
|
173
218
|
|
|
219
|
+
export const integrationJustEatMenuVersionPathSchema =
|
|
220
|
+
integrationMenuVersionPathSchemas.justeat.pathSchema
|
|
221
|
+
export const integrationJustEatMenuVersionNullablePathSchema =
|
|
222
|
+
integrationMenuVersionPathSchemas.justeat.nullablePathSchema
|
|
223
|
+
export type IntegrationJustEatMenuVersionPath = z.infer<
|
|
224
|
+
typeof integrationJustEatMenuVersionPathSchema
|
|
225
|
+
>
|
|
226
|
+
export type IntegrationJustEatMenuVersionNullablePath = z.infer<
|
|
227
|
+
typeof integrationJustEatMenuVersionNullablePathSchema
|
|
228
|
+
>
|
|
229
|
+
|
|
174
230
|
export const integrationCassaInCloudPathSchema = integrationPathSchemas.cassa_in_cloud.pathSchema
|
|
175
231
|
export const integrationCassaInCloudNullablePathSchema =
|
|
176
232
|
integrationPathSchemas.cassa_in_cloud.nullablePathSchema
|