@deliverart/sdk-js-integration 0.0.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.
- package/.changeset/config.json +11 -0
- package/.github/workflows/workflow.yml +47 -0
- package/.prettierrc +7 -0
- package/README.md +3 -0
- package/dist/index.cjs +3660 -0
- package/dist/index.d.cts +32181 -0
- package/dist/index.d.ts +32181 -0
- package/dist/index.js +3385 -0
- package/eslint.config.js +37 -0
- package/package.json +48 -0
- package/src/activatable-integration-data-schemas.ts +50 -0
- package/src/activatable-integration-types.ts +17 -0
- package/src/activatable-integration.ts +86 -0
- package/src/activation-request.ts +53 -0
- package/src/cancellation-request-types.ts +34 -0
- package/src/cancellation-request.ts +21 -0
- package/src/index.ts +9 -0
- package/src/integration-schemas.ts +31 -0
- package/src/requests/DeleteIntegration.ts +27 -0
- package/src/requests/GetIntegrationDetails.ts +30 -0
- package/src/requests/GetIntegrations.ts +63 -0
- package/src/requests/UpdateIntegration.ts +36 -0
- package/src/requests/activation-requests/ActivateIntegrationActivationRequest.ts +38 -0
- package/src/requests/activation-requests/AnnotateIntegrationActivationRequest.ts +46 -0
- package/src/requests/activation-requests/CreateIntegrationActivationRequest.ts +80 -0
- package/src/requests/activation-requests/DeleteIntegrationActivationRequest.ts +27 -0
- package/src/requests/activation-requests/GetIntegrationActivationRequestDetails.ts +37 -0
- package/src/requests/activation-requests/GetIntegrationActivationRequests.ts +86 -0
- package/src/requests/activation-requests/RespondIntegrationActivationRequest.ts +58 -0
- package/src/requests/activation-requests/SendIntegrationActivationRequestToPartner.ts +38 -0
- package/src/requests/activation-requests/UpdateIntegrationActivationRequest.ts +91 -0
- package/src/requests/activation-requests/index.ts +9 -0
- package/src/requests/cancellation-requests/CancelIntegrationCancellationRequest.ts +38 -0
- package/src/requests/cancellation-requests/CreateIntegrationCancellationRequest.ts +41 -0
- package/src/requests/cancellation-requests/DeleteIntegrationCancellationRequest.ts +27 -0
- package/src/requests/cancellation-requests/GetIntegrationCancellationRequestDetails.ts +37 -0
- package/src/requests/cancellation-requests/GetIntegrationCancellationRequests.ts +72 -0
- package/src/requests/cancellation-requests/index.ts +5 -0
- package/src/requests/index.ts +7 -0
- package/src/requests/services/cassa_in_cloud/CreateIntegrationCassaInCloud.ts +42 -0
- package/src/requests/services/cassa_in_cloud/DeleteIntegrationCassaInCloud.ts +27 -0
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudClientLogRequestDetails.ts +40 -0
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudClientLogRequests.ts +64 -0
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudDetails.ts +36 -0
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudList.ts +61 -0
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudSyncMenuProcessDetails.ts +40 -0
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudSyncMenuProcesses.ts +69 -0
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudWebHookEventDetails.ts +40 -0
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudWebHookEvents.ts +69 -0
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncCustomers.ts +27 -0
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncOrganizations.ts +27 -0
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncProducts.ts +27 -0
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncSalesModes.ts +27 -0
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncStock.ts +27 -0
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncTimetables.ts +27 -0
- package/src/requests/services/cassa_in_cloud/UpdateIntegrationCassaInCloud.ts +39 -0
- package/src/requests/services/cassa_in_cloud/index.ts +17 -0
- package/src/requests/services/deliveroo/CreateIntegrationDeliveroo.ts +40 -0
- package/src/requests/services/deliveroo/DeleteIntegrationDeliveroo.ts +27 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooClientLogRequestDetails.ts +40 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooClientLogRequests.ts +64 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooDetails.ts +36 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooList.ts +61 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooMenuVersionDetails.ts +35 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooMenuVersions.ts +62 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooSyncMenuProcessDetails.ts +40 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooSyncMenuProcesses.ts +69 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooWebhookEventDetails.ts +40 -0
- package/src/requests/services/deliveroo/GetIntegrationDeliverooWebhookEvents.ts +69 -0
- package/src/requests/services/deliveroo/IntegrationDeliverooSyncMenu.ts +27 -0
- package/src/requests/services/deliveroo/IntegrationDeliverooSyncOpeningHours.ts +27 -0
- package/src/requests/services/deliveroo/UpdateIntegrationDeliveroo.ts +39 -0
- package/src/requests/services/deliveroo/UpdateIntegrationDeliverooSiteStatus.ts +43 -0
- package/src/requests/services/deliveroo/index.ts +16 -0
- package/src/requests/services/glovo/CreateIntegrationGlovo.ts +39 -0
- package/src/requests/services/glovo/DeleteIntegrationGlovo.ts +27 -0
- package/src/requests/services/glovo/GetIntegrationGlovoClientLogRequestDetails.ts +39 -0
- package/src/requests/services/glovo/GetIntegrationGlovoClientLogRequests.ts +64 -0
- package/src/requests/services/glovo/GetIntegrationGlovoDetails.ts +36 -0
- package/src/requests/services/glovo/GetIntegrationGlovoList.ts +55 -0
- package/src/requests/services/glovo/GetIntegrationGlovoMenuUpdateDetails.ts +39 -0
- package/src/requests/services/glovo/GetIntegrationGlovoMenuUpdates.ts +66 -0
- package/src/requests/services/glovo/GetIntegrationGlovoMenuVersionDetails.ts +35 -0
- package/src/requests/services/glovo/GetIntegrationGlovoMenuVersions.ts +62 -0
- package/src/requests/services/glovo/GetIntegrationGlovoWebhookEventDetails.ts +39 -0
- package/src/requests/services/glovo/GetIntegrationGlovoWebhookEvents.ts +68 -0
- package/src/requests/services/glovo/IntegrationGlovoSyncMenu.ts +27 -0
- package/src/requests/services/glovo/UpdateIntegrationGlovo.ts +39 -0
- package/src/requests/services/glovo/UpdateIntegrationGlovoStoreStatus.ts +43 -0
- package/src/requests/services/glovo/index.ts +15 -0
- package/src/requests/services/index.ts +4 -0
- package/src/requests/services/justeat/CreateIntegrationJustEat.ts +39 -0
- package/src/requests/services/justeat/DeleteIntegrationJustEat.ts +27 -0
- package/src/requests/services/justeat/GetIntegrationJustEatClientLogRequestDetails.ts +40 -0
- package/src/requests/services/justeat/GetIntegrationJustEatClientLogRequests.ts +64 -0
- package/src/requests/services/justeat/GetIntegrationJustEatDetails.ts +36 -0
- package/src/requests/services/justeat/GetIntegrationJustEatList.ts +60 -0
- package/src/requests/services/justeat/GetIntegrationJustEatMenuVersionDetails.ts +35 -0
- package/src/requests/services/justeat/GetIntegrationJustEatMenuVersions.ts +62 -0
- package/src/requests/services/justeat/GetIntegrationJustEatSyncMenuProcessDetails.ts +40 -0
- package/src/requests/services/justeat/GetIntegrationJustEatSyncMenuProcesses.ts +69 -0
- package/src/requests/services/justeat/IntegrationJustEatSyncMenu.ts +27 -0
- package/src/requests/services/justeat/IntegrationJustEatSyncOpeningTimes.ts +27 -0
- package/src/requests/services/justeat/UpdateIntegrationJustEat.ts +39 -0
- package/src/requests/services/justeat/UpdateIntegrationJustEatRestaurantStatus.ts +44 -0
- package/src/requests/services/justeat/index.ts +14 -0
- package/src/schemas.ts +97 -0
- package/src/service-schemas/cassa_in_cloud.ts +154 -0
- package/src/service-schemas/deliveroo.ts +159 -0
- package/src/service-schemas/glovo.ts +153 -0
- package/src/service-schemas/justeat.ts +121 -0
- package/src/types.ts +227 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
datetimeSchema,
|
|
3
|
+
sortDirSchema,
|
|
4
|
+
timestampsFilterSchema,
|
|
5
|
+
} from '@deliverart/sdk-js-global-types'
|
|
6
|
+
import { z } from 'zod'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
integrationBaseSchema,
|
|
10
|
+
integrationDeliveryProviderCommonSchema,
|
|
11
|
+
integrationDetailsFieldsSchema,
|
|
12
|
+
} from '../schemas'
|
|
13
|
+
import {
|
|
14
|
+
integrationDeliverooPathSchema,
|
|
15
|
+
integrationGlovoMenuUpdateStatusSchema,
|
|
16
|
+
integrationGlovoPathSchema,
|
|
17
|
+
integrationGlovoWebhookEventTypeSchema,
|
|
18
|
+
integrationServiceSchema,
|
|
19
|
+
integrationStatusSchema,
|
|
20
|
+
} from '../types'
|
|
21
|
+
|
|
22
|
+
export const integrationGlovoSchema = integrationBaseSchema
|
|
23
|
+
.omit({ service: true })
|
|
24
|
+
.extend(integrationDeliveryProviderCommonSchema.shape)
|
|
25
|
+
.extend({
|
|
26
|
+
storeId: z.string(),
|
|
27
|
+
locale: z.string(),
|
|
28
|
+
pendingMenuChanges: z.boolean(),
|
|
29
|
+
service: integrationServiceSchema.extract(['glovo']),
|
|
30
|
+
})
|
|
31
|
+
export type IntegrationGlovo = z.infer<typeof integrationGlovoSchema>
|
|
32
|
+
|
|
33
|
+
export const integrationGlovoDetailsSchema = integrationGlovoSchema.extend(
|
|
34
|
+
integrationDetailsFieldsSchema.shape,
|
|
35
|
+
)
|
|
36
|
+
export type IntegrationGlovoDetails = z.infer<typeof integrationGlovoDetailsSchema>
|
|
37
|
+
|
|
38
|
+
export const integrationGlovoEditableFieldsSchema = integrationGlovoSchema
|
|
39
|
+
.pick({
|
|
40
|
+
name: true,
|
|
41
|
+
storeId: true,
|
|
42
|
+
locale: true,
|
|
43
|
+
skipNegativePrices: true,
|
|
44
|
+
skipInvalidItem: true,
|
|
45
|
+
salesMode: true,
|
|
46
|
+
importTaggedItems: true,
|
|
47
|
+
tagsForImport: true,
|
|
48
|
+
provider: true,
|
|
49
|
+
})
|
|
50
|
+
.partial()
|
|
51
|
+
export type IntegrationGlovoEditableFields = z.infer<typeof integrationGlovoEditableFieldsSchema>
|
|
52
|
+
|
|
53
|
+
export const integrationsGlovoQuerySchema = z
|
|
54
|
+
.object({
|
|
55
|
+
'order[createdAt]': sortDirSchema.optional(),
|
|
56
|
+
'order[updatedAt]': sortDirSchema.optional(),
|
|
57
|
+
'order[latestMenuCheckAt]': sortDirSchema.optional(),
|
|
58
|
+
'order[latestMenuSyncAt]': sortDirSchema.optional(),
|
|
59
|
+
name: z.string().optional(),
|
|
60
|
+
storeId: z.string().optional(),
|
|
61
|
+
'storeId[]': z.array(z.string()).optional(),
|
|
62
|
+
status: integrationStatusSchema.optional(),
|
|
63
|
+
'status[]': z.array(integrationStatusSchema).optional(),
|
|
64
|
+
connectionId: z.string().optional(),
|
|
65
|
+
'connectionId[]': z.array(z.string()).optional(),
|
|
66
|
+
skipInvalidItem: z.coerce.boolean().optional(),
|
|
67
|
+
isValidMenu: z.coerce.boolean().optional(),
|
|
68
|
+
'latestMenuCheckAt[before]': z.string().optional(),
|
|
69
|
+
'latestMenuCheckAt[strictly_before]': z.string().optional(),
|
|
70
|
+
'latestMenuCheckAt[after]': z.string().optional(),
|
|
71
|
+
'latestMenuCheckAt[strictly_after]': z.string().optional(),
|
|
72
|
+
'latestMenuSyncAt[before]': z.string().optional(),
|
|
73
|
+
'latestMenuSyncAt[strictly_before]': z.string().optional(),
|
|
74
|
+
'latestMenuSyncAt[after]': z.string().optional(),
|
|
75
|
+
'latestMenuSyncAt[strictly_after]': z.string().optional(),
|
|
76
|
+
service: integrationServiceSchema.extract(['glovo']).optional(),
|
|
77
|
+
page: z.coerce.number().optional(),
|
|
78
|
+
})
|
|
79
|
+
.merge(timestampsFilterSchema)
|
|
80
|
+
export type IntegrationsGlovoQueryParams = z.infer<typeof integrationsGlovoQuerySchema>
|
|
81
|
+
|
|
82
|
+
export const integrationGlovoWebhookEventSchema = z.object({
|
|
83
|
+
id: z.string(),
|
|
84
|
+
event: integrationGlovoWebhookEventTypeSchema,
|
|
85
|
+
body: z.any(),
|
|
86
|
+
createdAt: datetimeSchema,
|
|
87
|
+
})
|
|
88
|
+
export type IntegrationGlovoWebhookEvent = z.infer<typeof integrationGlovoWebhookEventSchema>
|
|
89
|
+
export const integrationGlovoWebhookEventDetailsSchema = integrationGlovoWebhookEventSchema.extend({
|
|
90
|
+
integration: integrationGlovoPathSchema,
|
|
91
|
+
})
|
|
92
|
+
export type IntegrationGlovoWebhookEventDetails = z.infer<
|
|
93
|
+
typeof integrationGlovoWebhookEventDetailsSchema
|
|
94
|
+
>
|
|
95
|
+
|
|
96
|
+
export const integrationGlovoWebhookEventsQueryParamsSchema = z.object({
|
|
97
|
+
'order[createdAt]': sortDirSchema.optional(),
|
|
98
|
+
event: integrationGlovoWebhookEventTypeSchema.optional(),
|
|
99
|
+
'event[]': z.array(integrationGlovoWebhookEventTypeSchema).optional(),
|
|
100
|
+
'createdAt[before]': z.string().optional(),
|
|
101
|
+
'createdAt[strictly_before]': z.string().optional(),
|
|
102
|
+
'createdAt[after]': z.string().optional(),
|
|
103
|
+
'createdAt[strictly_after]': z.string().optional(),
|
|
104
|
+
page: z.coerce.number().optional(),
|
|
105
|
+
})
|
|
106
|
+
export type IntegrationGlovoWebhookEventsQueryParams = z.infer<
|
|
107
|
+
typeof integrationGlovoWebhookEventsQueryParamsSchema
|
|
108
|
+
>
|
|
109
|
+
|
|
110
|
+
export const integrationGlovoMenuUpdateSchema = z.object({
|
|
111
|
+
id: z.string(),
|
|
112
|
+
transactionId: z.string().nullable(),
|
|
113
|
+
status: integrationGlovoMenuUpdateStatusSchema.nullable(),
|
|
114
|
+
retryCompleted: z.boolean(),
|
|
115
|
+
createdAt: datetimeSchema,
|
|
116
|
+
responseAt: datetimeSchema.nullable(),
|
|
117
|
+
latestCheckAt: datetimeSchema.nullable(),
|
|
118
|
+
})
|
|
119
|
+
export type IntegrationGlovoMenuUpdate = z.infer<typeof integrationGlovoMenuUpdateSchema>
|
|
120
|
+
export const integrationGlovoMenuUpdateDetailsSchema = integrationGlovoMenuUpdateSchema.extend({
|
|
121
|
+
integration: integrationDeliverooPathSchema,
|
|
122
|
+
details: z.any().nullable(),
|
|
123
|
+
})
|
|
124
|
+
export type IntegrationGlovoMenuUpdateDetails = z.infer<
|
|
125
|
+
typeof integrationGlovoMenuUpdateDetailsSchema
|
|
126
|
+
>
|
|
127
|
+
|
|
128
|
+
export const integrationGlovoMenuUpdatesQuerySchema = z.object({
|
|
129
|
+
'order[createdAt]': sortDirSchema.optional(),
|
|
130
|
+
'order[responseAt]': sortDirSchema.optional(),
|
|
131
|
+
'order[latestCheckAt]': sortDirSchema.optional(),
|
|
132
|
+
retryCompleted: z.coerce.boolean().optional(),
|
|
133
|
+
transactionId: z.string().optional(),
|
|
134
|
+
'transactionId[]': z.array(z.string()).optional(),
|
|
135
|
+
status: integrationGlovoMenuUpdateStatusSchema.optional(),
|
|
136
|
+
'status[]': z.array(integrationGlovoMenuUpdateStatusSchema).optional(),
|
|
137
|
+
'createdAt[before]': z.string().optional(),
|
|
138
|
+
'createdAt[strictly_before]': z.string().optional(),
|
|
139
|
+
'createdAt[after]': z.string().optional(),
|
|
140
|
+
'createdAt[strictly_after]': z.string().optional(),
|
|
141
|
+
'responseAt[before]': z.string().optional(),
|
|
142
|
+
'responseAt[strictly_before]': z.string().optional(),
|
|
143
|
+
'responseAt[after]': z.string().optional(),
|
|
144
|
+
'responseAt[strictly_after]': z.string().optional(),
|
|
145
|
+
'latestCheckAt[before]': z.string().optional(),
|
|
146
|
+
'latestCheckAt[strictly_before]': z.string().optional(),
|
|
147
|
+
'latestCheckAt[after]': z.string().optional(),
|
|
148
|
+
'latestCheckAt[strictly_after]': z.string().optional(),
|
|
149
|
+
page: z.coerce.number().optional(),
|
|
150
|
+
})
|
|
151
|
+
export type IntegrationGlovoMenuUpdatesQueryParams = z.infer<
|
|
152
|
+
typeof integrationGlovoMenuUpdatesQuerySchema
|
|
153
|
+
>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
datetimeSchema,
|
|
3
|
+
sortDirSchema,
|
|
4
|
+
timestampsFilterSchema,
|
|
5
|
+
} from '@deliverart/sdk-js-global-types'
|
|
6
|
+
import { z } from 'zod'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
integrationBaseSchema,
|
|
10
|
+
integrationDeliveryProviderCommonSchema,
|
|
11
|
+
integrationDetailsFieldsSchema,
|
|
12
|
+
} from '../schemas'
|
|
13
|
+
import {
|
|
14
|
+
integrationJustEatPathSchema,
|
|
15
|
+
integrationJustEatSyncTypeSchema,
|
|
16
|
+
integrationServiceSchema,
|
|
17
|
+
integrationStatusSchema,
|
|
18
|
+
} from '../types'
|
|
19
|
+
|
|
20
|
+
export const integrationJustEatSchema = integrationBaseSchema
|
|
21
|
+
.omit({ service: true })
|
|
22
|
+
.extend(integrationDeliveryProviderCommonSchema.shape)
|
|
23
|
+
.extend({
|
|
24
|
+
syncType: integrationJustEatSyncTypeSchema,
|
|
25
|
+
defaultLanguage: z.string(),
|
|
26
|
+
restaurantId: z.string(),
|
|
27
|
+
latestOpeningTimesSyncAt: datetimeSchema,
|
|
28
|
+
service: integrationServiceSchema.extract(['justeat']),
|
|
29
|
+
autoAcceptOrders: z.boolean(),
|
|
30
|
+
nextSyncMenuScheduledAt: datetimeSchema.nullable(),
|
|
31
|
+
})
|
|
32
|
+
export type IntegrationJustEat = z.infer<typeof integrationJustEatSchema>
|
|
33
|
+
|
|
34
|
+
export const integrationJustEatDetailsSchema = integrationJustEatSchema.extend(
|
|
35
|
+
integrationDetailsFieldsSchema.shape,
|
|
36
|
+
)
|
|
37
|
+
export type IntegrationJustEatDetails = z.infer<typeof integrationJustEatDetailsSchema>
|
|
38
|
+
|
|
39
|
+
export const integrationJustEatEditableFieldsSchema = integrationJustEatSchema
|
|
40
|
+
.pick({
|
|
41
|
+
name: true,
|
|
42
|
+
provider: true,
|
|
43
|
+
syncType: true,
|
|
44
|
+
defaultLanguage: true,
|
|
45
|
+
restaurantId: true,
|
|
46
|
+
skipNegativePrices: true,
|
|
47
|
+
skipInvalidItem: true,
|
|
48
|
+
autoAcceptOrders: true,
|
|
49
|
+
importTaggedItems: true,
|
|
50
|
+
tagsForImport: true,
|
|
51
|
+
})
|
|
52
|
+
.partial()
|
|
53
|
+
export type IntegrationJustEatEditableFields = z.infer<
|
|
54
|
+
typeof integrationJustEatEditableFieldsSchema
|
|
55
|
+
>
|
|
56
|
+
|
|
57
|
+
export const integrationsJustEatQuerySchema = z
|
|
58
|
+
.object({
|
|
59
|
+
'order[createdAt]': sortDirSchema.optional(),
|
|
60
|
+
'order[updatedAt]': sortDirSchema.optional(),
|
|
61
|
+
'order[latestMenuCheckAt]': sortDirSchema.optional(),
|
|
62
|
+
'order[latestMenuSyncAt]': sortDirSchema.optional(),
|
|
63
|
+
'order[latestOpeningTimesSyncAt]': sortDirSchema.optional(),
|
|
64
|
+
'order[nextSyncMenuScheduledAt]': sortDirSchema.optional(),
|
|
65
|
+
name: z.string().optional(),
|
|
66
|
+
restaurantId: z.string().optional(),
|
|
67
|
+
'restaurantId[]': z.array(z.string()).optional(),
|
|
68
|
+
status: integrationStatusSchema.optional(),
|
|
69
|
+
'status[]': z.array(integrationStatusSchema).optional(),
|
|
70
|
+
syncType: integrationJustEatPathSchema.optional(),
|
|
71
|
+
'syncType[]': z.array(integrationJustEatPathSchema).optional(),
|
|
72
|
+
connectionId: z.string().optional(),
|
|
73
|
+
'connectionId[]': z.array(z.string()).optional(),
|
|
74
|
+
skipInvalidItem: z.coerce.boolean().optional(),
|
|
75
|
+
isValidMenu: z.coerce.boolean().optional(),
|
|
76
|
+
'latestMenuCheckAt[before]': z.string().optional(),
|
|
77
|
+
'latestMenuCheckAt[strictly_before]': z.string().optional(),
|
|
78
|
+
'latestMenuCheckAt[after]': z.string().optional(),
|
|
79
|
+
'latestMenuCheckAt[strictly_after]': z.string().optional(),
|
|
80
|
+
'latestMenuSyncAt[before]': z.string().optional(),
|
|
81
|
+
'latestMenuSyncAt[strictly_before]': z.string().optional(),
|
|
82
|
+
'latestMenuSyncAt[after]': z.string().optional(),
|
|
83
|
+
'latestMenuSyncAt[strictly_after]': z.string().optional(),
|
|
84
|
+
'latestOpeningTimesSyncAt[before]': z.string().optional(),
|
|
85
|
+
'latestOpeningTimesSyncAt[strictly_before]': z.string().optional(),
|
|
86
|
+
'latestOpeningTimesSyncAt[after]': z.string().optional(),
|
|
87
|
+
'latestOpeningTimesSyncAt[strictly_after]': z.string().optional(),
|
|
88
|
+
'nextSyncMenuScheduledAt[before]': z.string().optional(),
|
|
89
|
+
'nextSyncMenuScheduledAt[strictly_before]': z.string().optional(),
|
|
90
|
+
'nextSyncMenuScheduledAt[after]': z.string().optional(),
|
|
91
|
+
'nextSyncMenuScheduledAt[strictly_after]': z.string().optional(),
|
|
92
|
+
service: integrationServiceSchema.extract(['justeat']).optional(),
|
|
93
|
+
page: z.coerce.number().optional(),
|
|
94
|
+
})
|
|
95
|
+
.merge(timestampsFilterSchema)
|
|
96
|
+
export type IntegrationsJustEatQueryParams = z.infer<typeof integrationsJustEatQuerySchema>
|
|
97
|
+
|
|
98
|
+
export const integrationJustEatSyncMenuProcessSchema = z.object({
|
|
99
|
+
id: z.string(),
|
|
100
|
+
ingestionSucceeded: z.boolean().nullable(),
|
|
101
|
+
error: z.any().nullable(),
|
|
102
|
+
createdAt: datetimeSchema,
|
|
103
|
+
})
|
|
104
|
+
export type IntegrationJustEatSyncMenuProcess = z.infer<
|
|
105
|
+
typeof integrationJustEatSyncMenuProcessSchema
|
|
106
|
+
>
|
|
107
|
+
export const integrationJustEatSyncMenuProcessDetailsSchema =
|
|
108
|
+
integrationJustEatSyncMenuProcessSchema.extend({
|
|
109
|
+
integration: integrationJustEatPathSchema,
|
|
110
|
+
})
|
|
111
|
+
export type IntegrationJustEatSyncMenuProcessDetails = z.infer<
|
|
112
|
+
typeof integrationJustEatSyncMenuProcessDetailsSchema
|
|
113
|
+
>
|
|
114
|
+
|
|
115
|
+
export const integrationJustEatSyncMenuProcessesQuerySchema = z.object({
|
|
116
|
+
'order[createdAt]': sortDirSchema.optional(),
|
|
117
|
+
page: z.coerce.number().optional(),
|
|
118
|
+
})
|
|
119
|
+
export type IntegrationJustEatSyncMenuProcessesQueryParams = z.infer<
|
|
120
|
+
typeof integrationJustEatSyncMenuProcessesQuerySchema
|
|
121
|
+
>
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export const integrationStatuses = ['pending', 'active', 'deleting'] as const
|
|
4
|
+
export const integrationStatusSchema = z.enum(integrationStatuses)
|
|
5
|
+
export type IntegrationStatus = z.infer<typeof integrationStatusSchema>
|
|
6
|
+
|
|
7
|
+
export const integrationProviders = ['deliverart', 'cassa_in_cloud'] as const
|
|
8
|
+
export const integrationProviderSchema = z.enum(integrationProviders)
|
|
9
|
+
export type IntegrationProvider = z.infer<typeof integrationProviderSchema>
|
|
10
|
+
|
|
11
|
+
export const integrationServices = ['deliveroo', 'justeat', 'glovo', 'cassa_in_cloud'] as const
|
|
12
|
+
export const integrationServiceSchema = z.enum(integrationServices)
|
|
13
|
+
export type IntegrationService = z.infer<typeof integrationServiceSchema>
|
|
14
|
+
|
|
15
|
+
export const integrationClientLogRequestMethods = ['DELETE', 'GET', 'PATCH', 'POST', 'PUT'] as const
|
|
16
|
+
export const integrationClientLogRequestMethodSchema = z.enum(integrationClientLogRequestMethods)
|
|
17
|
+
export type IntegrationClientLogRequestMethod = z.infer<
|
|
18
|
+
typeof integrationClientLogRequestMethodSchema
|
|
19
|
+
>
|
|
20
|
+
|
|
21
|
+
export const integrationJustEatSyncTypes = ['ALL', 'DELIVERY', 'TAKE_AWAY'] as const
|
|
22
|
+
export const integrationJustEatSyncTypeSchema = z.enum(integrationJustEatSyncTypes)
|
|
23
|
+
export type IntegrationJustEatSyncType = z.infer<typeof integrationJustEatSyncTypeSchema>
|
|
24
|
+
|
|
25
|
+
export const integrationJustEatRestaurantStatuses = ['OPEN', 'CLOSED'] as const
|
|
26
|
+
export const integrationJustEatRestaurantStatusSchema = z.enum(integrationJustEatRestaurantStatuses)
|
|
27
|
+
export type IntegrationJustEatRestaurantStatus = z.infer<
|
|
28
|
+
typeof integrationJustEatRestaurantStatusSchema
|
|
29
|
+
>
|
|
30
|
+
|
|
31
|
+
export const integrationDeliverooSiteStatuses = ['OPEN', 'CLOSED'] as const
|
|
32
|
+
export const integrationDeliverooSiteStatusSchema = z.enum(integrationDeliverooSiteStatuses)
|
|
33
|
+
export type IntegrationDeliverooSiteStatus = z.infer<typeof integrationDeliverooSiteStatusSchema>
|
|
34
|
+
|
|
35
|
+
export const integrationDeliverooSyncMenuProcessModes = ['menu', 'item_availabilities'] as const
|
|
36
|
+
export const integrationDeliverooSyncMenuProcessModeSchema = z.enum(
|
|
37
|
+
integrationDeliverooSyncMenuProcessModes,
|
|
38
|
+
)
|
|
39
|
+
export type IntegrationDeliverooSyncMenuProcessMode = z.infer<
|
|
40
|
+
typeof integrationDeliverooSyncMenuProcessModeSchema
|
|
41
|
+
>
|
|
42
|
+
|
|
43
|
+
export const integrationDeliverooWebhookEventTypes = [
|
|
44
|
+
'order.new',
|
|
45
|
+
'order.status_update',
|
|
46
|
+
'rider.status_update',
|
|
47
|
+
'menu.upload_result',
|
|
48
|
+
] as const
|
|
49
|
+
export const integrationDeliverooWebhookEventTypeSchema = z.enum(
|
|
50
|
+
integrationDeliverooWebhookEventTypes,
|
|
51
|
+
)
|
|
52
|
+
export type IntegrationDeliverooWebhookEventType = z.infer<
|
|
53
|
+
typeof integrationDeliverooWebhookEventTypeSchema
|
|
54
|
+
>
|
|
55
|
+
|
|
56
|
+
export const integrationGlovoMenuUpdateStatuses = [
|
|
57
|
+
'SUCCESS',
|
|
58
|
+
'PROCESSING',
|
|
59
|
+
'FETCH_MENU_INVALID_PAYLOAD',
|
|
60
|
+
'FETCH_MENU_SERVER_ERROR',
|
|
61
|
+
'FETCH_MENU_UNAUTHORIZED',
|
|
62
|
+
'NOT_PROCESSED',
|
|
63
|
+
'LIMIT_EXCEEDED',
|
|
64
|
+
'GLOVO_ERROR',
|
|
65
|
+
'SCHEDULE_CATALOG_DISABLED',
|
|
66
|
+
] as const
|
|
67
|
+
export const integrationGlovoMenuUpdateStatusSchema = z.enum(integrationGlovoMenuUpdateStatuses)
|
|
68
|
+
export type IntegrationGlovoMenuUpdateStatus = z.infer<
|
|
69
|
+
typeof integrationGlovoMenuUpdateStatusSchema
|
|
70
|
+
>
|
|
71
|
+
|
|
72
|
+
export const integrationGlovoStoreStatuses = ['OPEN', 'CLOSED'] as const
|
|
73
|
+
export const integrationGlovoStoreStatusSchema = z.enum(integrationGlovoStoreStatuses)
|
|
74
|
+
export type IntegrationGlovoStoreStatus = z.infer<typeof integrationGlovoStoreStatusSchema>
|
|
75
|
+
|
|
76
|
+
export const integrationGlovoWebhookEventTypes = ['order.dispatched', 'order.cancelled'] as const
|
|
77
|
+
export const integrationGlovoWebhookEventTypeSchema = z.enum(integrationGlovoWebhookEventTypes)
|
|
78
|
+
export type IntegrationGlovoWebhookEventType = z.infer<
|
|
79
|
+
typeof integrationGlovoWebhookEventTypeSchema
|
|
80
|
+
>
|
|
81
|
+
|
|
82
|
+
export const integrationCassaInCloudDirections = [
|
|
83
|
+
'EXTERNAL_TO_INTERNAL',
|
|
84
|
+
'INTERNAL_TO_EXTERNAL',
|
|
85
|
+
] as const
|
|
86
|
+
export const integrationCassaInCloudDirectionSchema = z.enum(integrationCassaInCloudDirections)
|
|
87
|
+
export type IntegrationCassaInCloudDirection = z.infer<
|
|
88
|
+
typeof integrationCassaInCloudDirectionSchema
|
|
89
|
+
>
|
|
90
|
+
|
|
91
|
+
export const integrationCassaInCloudProductChannels = [
|
|
92
|
+
'RISTO',
|
|
93
|
+
'SALE',
|
|
94
|
+
'ECOMMERCE',
|
|
95
|
+
'MOBILE_COMMERCE',
|
|
96
|
+
'SELF_ORDER',
|
|
97
|
+
'KIOSK',
|
|
98
|
+
] as const
|
|
99
|
+
export const integrationCassaInCloudProductChannelSchema = z.enum(
|
|
100
|
+
integrationCassaInCloudProductChannels,
|
|
101
|
+
)
|
|
102
|
+
export type IntegrationCassaInCloudProductChannel = z.infer<
|
|
103
|
+
typeof integrationCassaInCloudProductChannelSchema
|
|
104
|
+
>
|
|
105
|
+
|
|
106
|
+
export const integrationCassaInCloudWebHookEventEntities = [
|
|
107
|
+
'BILL',
|
|
108
|
+
'RECEIPT',
|
|
109
|
+
'CREDIT_NOTE',
|
|
110
|
+
'INVOICE',
|
|
111
|
+
'DDT',
|
|
112
|
+
'ORDER',
|
|
113
|
+
'QUOTATION',
|
|
114
|
+
'RECONCILIATION',
|
|
115
|
+
'STOCK_MOVEMENT',
|
|
116
|
+
'CUSTOMER',
|
|
117
|
+
'ORGANIZATION',
|
|
118
|
+
] as const
|
|
119
|
+
export const integrationCassaInCloudWebHookEventEntitySchema = z.enum(
|
|
120
|
+
integrationCassaInCloudWebHookEventEntities,
|
|
121
|
+
)
|
|
122
|
+
export type IntegrationCassaInCloudWebHookEventEntity = z.infer<
|
|
123
|
+
typeof integrationCassaInCloudWebHookEventEntitySchema
|
|
124
|
+
>
|
|
125
|
+
|
|
126
|
+
export const integrationCassaInCloudWebHookEventEvents = ['CREATE', 'UPDATE', 'DELETE'] as const
|
|
127
|
+
export const integrationCassaInCloudWebHookEventEventSchema = z.enum(
|
|
128
|
+
integrationCassaInCloudWebHookEventEvents,
|
|
129
|
+
)
|
|
130
|
+
export type IntegrationCassaInCloudWebHookEventEvent = z.infer<
|
|
131
|
+
typeof integrationCassaInCloudWebHookEventEventSchema
|
|
132
|
+
>
|
|
133
|
+
|
|
134
|
+
function createIntegrationPathSchemas(service: IntegrationService) {
|
|
135
|
+
const regex = new RegExp(`^/integrations/${service}/[a-z_]+/[0-9a-fA-F-]{36}$`)
|
|
136
|
+
|
|
137
|
+
const pathSchema = z.string().refine(val => regex.test(val), {
|
|
138
|
+
message: `Invalid integration ${service} path format`,
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
const nullablePathSchema = z
|
|
142
|
+
.string()
|
|
143
|
+
.nullable()
|
|
144
|
+
.refine(val => val == null || regex.test(val), {
|
|
145
|
+
message: `Invalid integration ${service} path format`,
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
return { pathSchema, nullablePathSchema }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const integrationPathSchemas = Object.fromEntries(
|
|
152
|
+
integrationServices.map(service => [service, createIntegrationPathSchemas(service)]),
|
|
153
|
+
) as Record<IntegrationService, ReturnType<typeof createIntegrationPathSchemas>>
|
|
154
|
+
|
|
155
|
+
export const integrationDeliverooPathSchema = integrationPathSchemas.deliveroo.pathSchema
|
|
156
|
+
export const integrationDeliverooNullablePathSchema =
|
|
157
|
+
integrationPathSchemas.deliveroo.nullablePathSchema
|
|
158
|
+
export type IntegrationDeliverooPath = z.infer<typeof integrationDeliverooPathSchema>
|
|
159
|
+
export type IntegrationDeliverooNullablePath = z.infer<
|
|
160
|
+
typeof integrationDeliverooNullablePathSchema
|
|
161
|
+
>
|
|
162
|
+
|
|
163
|
+
export const integrationGlovoPathSchema = integrationPathSchemas.glovo.pathSchema
|
|
164
|
+
export const integrationGlovoNullablePathSchema = integrationPathSchemas.glovo.nullablePathSchema
|
|
165
|
+
export type IntegrationGlovoPath = z.infer<typeof integrationGlovoPathSchema>
|
|
166
|
+
export type IntegrationGlovoNullablePath = z.infer<typeof integrationGlovoNullablePathSchema>
|
|
167
|
+
|
|
168
|
+
export const integrationJustEatPathSchema = integrationPathSchemas.justeat.pathSchema
|
|
169
|
+
export const integrationJustEatNullablePathSchema =
|
|
170
|
+
integrationPathSchemas.justeat.nullablePathSchema
|
|
171
|
+
export type IntegrationJustEatPath = z.infer<typeof integrationJustEatPathSchema>
|
|
172
|
+
export type IntegrationJustEatNullablePath = z.infer<typeof integrationJustEatNullablePathSchema>
|
|
173
|
+
|
|
174
|
+
export const integrationCassaInCloudPathSchema = integrationPathSchemas.cassa_in_cloud.pathSchema
|
|
175
|
+
export const integrationCassaInCloudNullablePathSchema =
|
|
176
|
+
integrationPathSchemas.cassa_in_cloud.nullablePathSchema
|
|
177
|
+
export type IntegrationCassaInCloudPath = z.infer<typeof integrationCassaInCloudPathSchema>
|
|
178
|
+
export type IntegrationCassaInCloudNullablePath = z.infer<
|
|
179
|
+
typeof integrationCassaInCloudNullablePathSchema
|
|
180
|
+
>
|
|
181
|
+
|
|
182
|
+
export const integrationPathSchema = z
|
|
183
|
+
.string()
|
|
184
|
+
.refine(val => /^\/integrations\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
185
|
+
message: 'Invalid integration path format',
|
|
186
|
+
})
|
|
187
|
+
export type IntegrationPath = z.infer<typeof integrationPathSchema>
|
|
188
|
+
|
|
189
|
+
export const integrationNullablePathSchema = z
|
|
190
|
+
.string()
|
|
191
|
+
.nullable()
|
|
192
|
+
.refine(val => val == null || /^\/integrations\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
193
|
+
message: 'Invalid integration path format',
|
|
194
|
+
})
|
|
195
|
+
export type IntegrationNullablePath = z.infer<typeof integrationNullablePathSchema>
|
|
196
|
+
|
|
197
|
+
export const integrationCassaInCloudSyncMenuErrorLogPathSchema = z
|
|
198
|
+
.string()
|
|
199
|
+
.refine(
|
|
200
|
+
val =>
|
|
201
|
+
/^\/integrations\/cassa_in_cloud\/[a-z_]+\/[0-9a-fA-F-]{36}\/sync_menu_processes\/[a-z_]+\/[0-9a-fA-F-]{36}\/error_logs\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(
|
|
202
|
+
val,
|
|
203
|
+
),
|
|
204
|
+
{
|
|
205
|
+
message: 'Invalid integration path format',
|
|
206
|
+
},
|
|
207
|
+
)
|
|
208
|
+
export type IntegrationCassaInCloudSyncMenuErrorLogPath = z.infer<
|
|
209
|
+
typeof integrationCassaInCloudSyncMenuErrorLogPathSchema
|
|
210
|
+
>
|
|
211
|
+
|
|
212
|
+
export const integrationCassaInCloudSyncMenuErrorLogNullablePathSchema = z
|
|
213
|
+
.string()
|
|
214
|
+
.nullable()
|
|
215
|
+
.refine(
|
|
216
|
+
val =>
|
|
217
|
+
val == null ||
|
|
218
|
+
/^\/integrations\/cassa_in_cloud\/[a-z_]+\/[0-9a-fA-F-]{36}\/sync_menu_processes\/[a-z_]+\/[0-9a-fA-F-]{36}\/error_logs\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(
|
|
219
|
+
val,
|
|
220
|
+
),
|
|
221
|
+
{
|
|
222
|
+
message: 'Invalid integration path format',
|
|
223
|
+
},
|
|
224
|
+
)
|
|
225
|
+
export type IntegrationCassaInCloudSyncMenuErrorLogNullablePath = z.infer<
|
|
226
|
+
typeof integrationCassaInCloudSyncMenuErrorLogNullablePathSchema
|
|
227
|
+
>
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"outDir": "dist",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"declarationMap": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src"]
|
|
15
|
+
}
|