@deliverart/sdk-js-integration 0.0.5 → 1.2.0
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.cjs +12484 -1553
- package/dist/index.d.cts +8214 -25471
- package/dist/index.d.ts +8214 -25471
- package/dist/index.js +12344 -1407
- package/package.json +12 -27
- package/.changeset/config.json +0 -11
- package/.github/workflows/workflow.yml +0 -47
- package/.prettierrc +0 -7
- package/CHANGELOG.md +0 -25
- package/README.md +0 -3
- package/eslint.config.js +0 -37
- package/src/activatable-integration-data-schemas.ts +0 -50
- package/src/activatable-integration-types.ts +0 -17
- package/src/activatable-integration.ts +0 -86
- package/src/activation-request.ts +0 -53
- package/src/cancellation-request-types.ts +0 -42
- package/src/cancellation-request.ts +0 -21
- package/src/index.ts +0 -9
- package/src/integration-schemas.ts +0 -31
- package/src/requests/DeleteIntegration.ts +0 -27
- package/src/requests/GetIntegrationDetails.ts +0 -30
- package/src/requests/GetIntegrations.ts +0 -63
- package/src/requests/UpdateIntegration.ts +0 -36
- package/src/requests/activation-requests/ActivateIntegrationActivationRequest.ts +0 -38
- package/src/requests/activation-requests/AnnotateIntegrationActivationRequest.ts +0 -46
- package/src/requests/activation-requests/CreateIntegrationActivationRequest.ts +0 -80
- package/src/requests/activation-requests/DeleteIntegrationActivationRequest.ts +0 -27
- package/src/requests/activation-requests/GetIntegrationActivationRequestDetails.ts +0 -37
- package/src/requests/activation-requests/GetIntegrationActivationRequests.ts +0 -86
- package/src/requests/activation-requests/RespondIntegrationActivationRequest.ts +0 -58
- package/src/requests/activation-requests/SendIntegrationActivationRequestToPartner.ts +0 -38
- package/src/requests/activation-requests/UpdateIntegrationActivationRequest.ts +0 -91
- package/src/requests/activation-requests/index.ts +0 -9
- package/src/requests/cancellation-requests/CancelIntegrationCancellationRequest.ts +0 -38
- package/src/requests/cancellation-requests/CreateIntegrationCancellationRequest.ts +0 -41
- package/src/requests/cancellation-requests/DeleteIntegrationCancellationRequest.ts +0 -27
- package/src/requests/cancellation-requests/GetIntegrationCancellationRequestDetails.ts +0 -37
- package/src/requests/cancellation-requests/GetIntegrationCancellationRequests.ts +0 -72
- package/src/requests/cancellation-requests/index.ts +0 -5
- package/src/requests/index.ts +0 -7
- package/src/requests/services/cassa_in_cloud/CreateIntegrationCassaInCloud.ts +0 -42
- package/src/requests/services/cassa_in_cloud/DeleteIntegrationCassaInCloud.ts +0 -27
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudClientLogRequestDetails.ts +0 -40
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudClientLogRequests.ts +0 -64
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudDetails.ts +0 -36
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudList.ts +0 -61
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudSyncMenuProcessDetails.ts +0 -40
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudSyncMenuProcesses.ts +0 -69
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudWebHookEventDetails.ts +0 -40
- package/src/requests/services/cassa_in_cloud/GetIntegrationCassaInCloudWebHookEvents.ts +0 -69
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncCustomers.ts +0 -27
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncOrganizations.ts +0 -27
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncProducts.ts +0 -27
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncSalesModes.ts +0 -27
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncStock.ts +0 -27
- package/src/requests/services/cassa_in_cloud/IntegrationCassaInCloudSyncTimetables.ts +0 -27
- package/src/requests/services/cassa_in_cloud/UpdateIntegrationCassaInCloud.ts +0 -39
- package/src/requests/services/cassa_in_cloud/index.ts +0 -17
- package/src/requests/services/deliveroo/CreateIntegrationDeliveroo.ts +0 -40
- package/src/requests/services/deliveroo/DeleteIntegrationDeliveroo.ts +0 -27
- package/src/requests/services/deliveroo/GetIntegrationDeliverooClientLogRequestDetails.ts +0 -40
- package/src/requests/services/deliveroo/GetIntegrationDeliverooClientLogRequests.ts +0 -64
- package/src/requests/services/deliveroo/GetIntegrationDeliverooDetails.ts +0 -36
- package/src/requests/services/deliveroo/GetIntegrationDeliverooList.ts +0 -61
- package/src/requests/services/deliveroo/GetIntegrationDeliverooMenuVersionDetails.ts +0 -35
- package/src/requests/services/deliveroo/GetIntegrationDeliverooMenuVersions.ts +0 -62
- package/src/requests/services/deliveroo/GetIntegrationDeliverooSyncMenuProcessDetails.ts +0 -40
- package/src/requests/services/deliveroo/GetIntegrationDeliverooSyncMenuProcesses.ts +0 -69
- package/src/requests/services/deliveroo/GetIntegrationDeliverooWebhookEventDetails.ts +0 -40
- package/src/requests/services/deliveroo/GetIntegrationDeliverooWebhookEvents.ts +0 -69
- package/src/requests/services/deliveroo/IntegrationDeliverooSyncMenu.ts +0 -27
- package/src/requests/services/deliveroo/IntegrationDeliverooSyncOpeningHours.ts +0 -27
- package/src/requests/services/deliveroo/UpdateIntegrationDeliveroo.ts +0 -39
- package/src/requests/services/deliveroo/UpdateIntegrationDeliverooSiteStatus.ts +0 -43
- package/src/requests/services/deliveroo/index.ts +0 -16
- package/src/requests/services/glovo/CreateIntegrationGlovo.ts +0 -39
- package/src/requests/services/glovo/DeleteIntegrationGlovo.ts +0 -27
- package/src/requests/services/glovo/GetIntegrationGlovoClientLogRequestDetails.ts +0 -39
- package/src/requests/services/glovo/GetIntegrationGlovoClientLogRequests.ts +0 -64
- package/src/requests/services/glovo/GetIntegrationGlovoDetails.ts +0 -36
- package/src/requests/services/glovo/GetIntegrationGlovoList.ts +0 -55
- package/src/requests/services/glovo/GetIntegrationGlovoMenuUpdateDetails.ts +0 -39
- package/src/requests/services/glovo/GetIntegrationGlovoMenuUpdates.ts +0 -66
- package/src/requests/services/glovo/GetIntegrationGlovoMenuVersionDetails.ts +0 -35
- package/src/requests/services/glovo/GetIntegrationGlovoMenuVersions.ts +0 -62
- package/src/requests/services/glovo/GetIntegrationGlovoWebhookEventDetails.ts +0 -39
- package/src/requests/services/glovo/GetIntegrationGlovoWebhookEvents.ts +0 -68
- package/src/requests/services/glovo/IntegrationGlovoSyncMenu.ts +0 -27
- package/src/requests/services/glovo/UpdateIntegrationGlovo.ts +0 -39
- package/src/requests/services/glovo/UpdateIntegrationGlovoStoreStatus.ts +0 -43
- package/src/requests/services/glovo/index.ts +0 -15
- package/src/requests/services/index.ts +0 -4
- package/src/requests/services/justeat/CreateIntegrationJustEat.ts +0 -39
- package/src/requests/services/justeat/DeleteIntegrationJustEat.ts +0 -27
- package/src/requests/services/justeat/GetIntegrationJustEatClientLogRequestDetails.ts +0 -40
- package/src/requests/services/justeat/GetIntegrationJustEatClientLogRequests.ts +0 -64
- package/src/requests/services/justeat/GetIntegrationJustEatDetails.ts +0 -36
- package/src/requests/services/justeat/GetIntegrationJustEatList.ts +0 -60
- package/src/requests/services/justeat/GetIntegrationJustEatMenuVersionDetails.ts +0 -35
- package/src/requests/services/justeat/GetIntegrationJustEatMenuVersions.ts +0 -62
- package/src/requests/services/justeat/GetIntegrationJustEatSyncMenuProcessDetails.ts +0 -40
- package/src/requests/services/justeat/GetIntegrationJustEatSyncMenuProcesses.ts +0 -69
- package/src/requests/services/justeat/IntegrationJustEatSyncMenu.ts +0 -27
- package/src/requests/services/justeat/IntegrationJustEatSyncOpeningTimes.ts +0 -27
- package/src/requests/services/justeat/UpdateIntegrationJustEat.ts +0 -39
- package/src/requests/services/justeat/UpdateIntegrationJustEatRestaurantStatus.ts +0 -44
- package/src/requests/services/justeat/index.ts +0 -14
- package/src/schemas.ts +0 -104
- package/src/service-schemas/cassa_in_cloud.ts +0 -154
- package/src/service-schemas/deliveroo.ts +0 -159
- package/src/service-schemas/glovo.ts +0 -153
- package/src/service-schemas/justeat.ts +0 -121
- package/src/types.ts +0 -296
- package/tsconfig.json +0 -15
package/package.json
CHANGED
|
@@ -1,48 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deliverart/sdk-js-integration",
|
|
3
3
|
"description": "Deliverart JavaScript SDK for Integration Management",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"tsup": {
|
|
9
|
+
"tsconfig": "./tsconfig.json"
|
|
10
|
+
},
|
|
8
11
|
"exports": {
|
|
9
12
|
".": {
|
|
10
13
|
"import": "./dist/index.js",
|
|
11
14
|
"require": "./dist/index.cjs"
|
|
12
15
|
}
|
|
13
16
|
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
14
20
|
"dependencies": {
|
|
15
|
-
"@deliverart/sdk-js-core": "
|
|
16
|
-
"@deliverart/sdk-js-global-types": "
|
|
17
|
-
"@deliverart/sdk-js-point-of-sale": "
|
|
18
|
-
"@deliverart/sdk-js-sales-mode": "
|
|
19
|
-
"axios": "1.9.0",
|
|
20
|
-
"zod": "3.25.67"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@changesets/cli": "^2.29.4",
|
|
24
|
-
"@eslint/js": "9.28.0",
|
|
25
|
-
"@types/node": "22.15.30",
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "8.33.1",
|
|
27
|
-
"@typescript-eslint/parser": "8.33.1",
|
|
28
|
-
"eslint": "9.28.0",
|
|
29
|
-
"eslint-config-prettier": "10.1.5",
|
|
30
|
-
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
31
|
-
"prettier": "3.5.3",
|
|
32
|
-
"tsup": "8.5.0",
|
|
33
|
-
"typescript": "5.8.3"
|
|
21
|
+
"@deliverart/sdk-js-core": "1.2.0",
|
|
22
|
+
"@deliverart/sdk-js-global-types": "1.2.0",
|
|
23
|
+
"@deliverart/sdk-js-point-of-sale": "1.2.0",
|
|
24
|
+
"@deliverart/sdk-js-sales-mode": "1.2.0"
|
|
34
25
|
},
|
|
35
26
|
"publishConfig": {
|
|
36
27
|
"access": "public"
|
|
37
28
|
},
|
|
38
29
|
"scripts": {
|
|
39
30
|
"build": "tsup src/index.ts --dts --format esm,cjs",
|
|
40
|
-
"dev": "tsup src/index.ts --dts --watch"
|
|
41
|
-
"lint": "eslint .",
|
|
42
|
-
"lint:fix": "eslint . --fix",
|
|
43
|
-
"prettier": "prettier --check .",
|
|
44
|
-
"prettier:fix": "prettier --write .",
|
|
45
|
-
"version": "@changesets/cli version",
|
|
46
|
-
"release": "@changesets/cli publish"
|
|
31
|
+
"dev": "tsup src/index.ts --dts --watch"
|
|
47
32
|
}
|
|
48
33
|
}
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "restricted",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: write
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
release:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- uses: pnpm/action-setup@v2
|
|
18
|
-
with:
|
|
19
|
-
version: 8
|
|
20
|
-
|
|
21
|
-
- uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: '20'
|
|
24
|
-
registry-url: 'https://registry.npmjs.org'
|
|
25
|
-
always-auth: true
|
|
26
|
-
env:
|
|
27
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
28
|
-
|
|
29
|
-
- name: Install deps
|
|
30
|
-
run: pnpm install
|
|
31
|
-
|
|
32
|
-
- name: Build
|
|
33
|
-
run: pnpm build
|
|
34
|
-
|
|
35
|
-
- name: Create version and changelog
|
|
36
|
-
run: pnpx @changesets/cli version
|
|
37
|
-
|
|
38
|
-
- name: Publish to NPM
|
|
39
|
-
run: pnpx @changesets/cli publish
|
|
40
|
-
env:
|
|
41
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
42
|
-
|
|
43
|
-
- name: Push updated versions and changelogs
|
|
44
|
-
uses: EndBug/add-and-commit@v9
|
|
45
|
-
with:
|
|
46
|
-
message: 'chore(release): version bump'
|
|
47
|
-
add: '.'
|
package/.prettierrc
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# @deliverart/sdk-js-integration
|
|
2
|
-
|
|
3
|
-
## 0.0.5
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 35e263a: fix uuid version
|
|
8
|
-
|
|
9
|
-
## 0.0.4
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- 62f0a75: fix types
|
|
14
|
-
|
|
15
|
-
## 0.0.3
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- 30f93b7: fix types
|
|
20
|
-
|
|
21
|
-
## 0.0.2
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- 10b3f20: fix uuid version
|
package/README.md
DELETED
package/eslint.config.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// eslint.config.js per @typescript-eslint v8
|
|
3
|
-
import js from '@eslint/js'
|
|
4
|
-
import prettier from 'eslint-config-prettier'
|
|
5
|
-
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort'
|
|
6
|
-
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
7
|
-
import tsParser from '@typescript-eslint/parser'
|
|
8
|
-
|
|
9
|
-
export default [
|
|
10
|
-
js.configs.recommended,
|
|
11
|
-
{
|
|
12
|
-
files: ['**/*.ts'],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
parser: tsParser,
|
|
15
|
-
globals: {
|
|
16
|
-
process: 'readonly',
|
|
17
|
-
},
|
|
18
|
-
parserOptions: {
|
|
19
|
-
project: ['./tsconfig.json'],
|
|
20
|
-
tsconfigRootDir: process.cwd(),
|
|
21
|
-
sourceType: 'module',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
plugins: {
|
|
25
|
-
'@typescript-eslint': tsPlugin,
|
|
26
|
-
'simple-import-sort': simpleImportSortPlugin,
|
|
27
|
-
},
|
|
28
|
-
rules: {
|
|
29
|
-
'simple-import-sort/imports': 'error',
|
|
30
|
-
'simple-import-sort/exports': 'error',
|
|
31
|
-
'@typescript-eslint/no-unused-vars': 'warn',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
prettier,
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
export const ignores = ['dist', 'node_modules']
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
import { integrationCassaInCloudDirectionSchema } from './types'
|
|
4
|
-
|
|
5
|
-
export const integrationDeliverooDataSchema = z.object({
|
|
6
|
-
brandId: z.string(),
|
|
7
|
-
siteId: z.string(),
|
|
8
|
-
salesModeId: z.string().nullable(),
|
|
9
|
-
})
|
|
10
|
-
export type IntegrationDeliverooData = z.infer<typeof integrationDeliverooDataSchema>
|
|
11
|
-
|
|
12
|
-
export const integrationGlovoDataSchema = z.object({
|
|
13
|
-
storeId: z.string(),
|
|
14
|
-
salesModeId: z.string().nullable(),
|
|
15
|
-
})
|
|
16
|
-
export type IntegrationGlovoData = z.infer<typeof integrationGlovoDataSchema>
|
|
17
|
-
|
|
18
|
-
export const integrationJustEatDataSchema = z.object({
|
|
19
|
-
restaurantId: z.string(),
|
|
20
|
-
salesModeId: z.string().nullable(),
|
|
21
|
-
})
|
|
22
|
-
export type IntegrationJustEatData = z.infer<typeof integrationJustEatDataSchema>
|
|
23
|
-
|
|
24
|
-
export const integrationCassaInCloudDataSchema = z.object({
|
|
25
|
-
apiKey: z.string(),
|
|
26
|
-
idSalesPoint: z.number(),
|
|
27
|
-
direction: integrationCassaInCloudDirectionSchema,
|
|
28
|
-
locale: z.string(),
|
|
29
|
-
})
|
|
30
|
-
export type IntegrationCassaInCloudData = z.infer<typeof integrationCassaInCloudDataSchema>
|
|
31
|
-
|
|
32
|
-
export const integrationServiceDataSchema = z.discriminatedUnion('service', [
|
|
33
|
-
z.object({
|
|
34
|
-
service: z.literal('deliveroo'),
|
|
35
|
-
data: integrationDeliverooDataSchema,
|
|
36
|
-
}),
|
|
37
|
-
z.object({
|
|
38
|
-
service: z.literal('glovo'),
|
|
39
|
-
data: integrationGlovoDataSchema,
|
|
40
|
-
}),
|
|
41
|
-
z.object({
|
|
42
|
-
service: z.literal('justeat'),
|
|
43
|
-
data: integrationJustEatDataSchema,
|
|
44
|
-
}),
|
|
45
|
-
z.object({
|
|
46
|
-
service: z.literal('cassa_in_cloud'),
|
|
47
|
-
data: integrationCassaInCloudDataSchema,
|
|
48
|
-
}),
|
|
49
|
-
])
|
|
50
|
-
export type IntegrationServiceData = z.infer<typeof integrationServiceDataSchema>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
export const activatableIntegrationStatuses = [
|
|
4
|
-
'waiting_for_user',
|
|
5
|
-
'waiting_for_admin',
|
|
6
|
-
'request_sent_partner',
|
|
7
|
-
'active',
|
|
8
|
-
'failed',
|
|
9
|
-
] as const
|
|
10
|
-
export const activatableIntegrationStatusSchema = z.enum(activatableIntegrationStatuses)
|
|
11
|
-
export type ActivatableIntegrationStatus = z.infer<typeof activatableIntegrationStatusSchema>
|
|
12
|
-
|
|
13
|
-
export const activatableIntegrationHealthStatuses = ['success', 'waiting', 'error'] as const
|
|
14
|
-
export const activatableIntegrationHealthStatusSchema = z.enum(activatableIntegrationHealthStatuses)
|
|
15
|
-
export type ActivatableIntegrationHealthStatus = z.infer<
|
|
16
|
-
typeof activatableIntegrationHealthStatusSchema
|
|
17
|
-
>
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { datetimeSchema } from '@deliverart/sdk-js-global-types'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
integrationCassaInCloudDataSchema,
|
|
6
|
-
integrationDeliverooDataSchema,
|
|
7
|
-
integrationGlovoDataSchema,
|
|
8
|
-
integrationJustEatDataSchema,
|
|
9
|
-
} from './activatable-integration-data-schemas'
|
|
10
|
-
import {
|
|
11
|
-
activatableIntegrationHealthStatusSchema,
|
|
12
|
-
activatableIntegrationStatusSchema,
|
|
13
|
-
} from './activatable-integration-types'
|
|
14
|
-
import {
|
|
15
|
-
integrationCassaInCloudNullablePathSchema,
|
|
16
|
-
integrationCassaInCloudPathSchema,
|
|
17
|
-
integrationDeliverooNullablePathSchema,
|
|
18
|
-
integrationDeliverooPathSchema,
|
|
19
|
-
integrationGlovoNullablePathSchema,
|
|
20
|
-
integrationGlovoPathSchema,
|
|
21
|
-
integrationJustEatNullablePathSchema,
|
|
22
|
-
integrationJustEatPathSchema,
|
|
23
|
-
integrationProviderSchema,
|
|
24
|
-
} from './types'
|
|
25
|
-
|
|
26
|
-
export const activatableIntegrationBaseSchema = z.object({
|
|
27
|
-
id: z.string(),
|
|
28
|
-
connectionId: z.string().nullable(),
|
|
29
|
-
integration: z
|
|
30
|
-
.union([
|
|
31
|
-
integrationDeliverooPathSchema,
|
|
32
|
-
integrationGlovoPathSchema,
|
|
33
|
-
integrationJustEatPathSchema,
|
|
34
|
-
integrationCassaInCloudPathSchema,
|
|
35
|
-
])
|
|
36
|
-
.nullable(),
|
|
37
|
-
status: activatableIntegrationStatusSchema,
|
|
38
|
-
healthStatus: activatableIntegrationHealthStatusSchema,
|
|
39
|
-
provider: integrationProviderSchema,
|
|
40
|
-
name: z.string(),
|
|
41
|
-
message: z.string().nullable(),
|
|
42
|
-
internalNotes: z.string().nullable(),
|
|
43
|
-
createdAt: datetimeSchema,
|
|
44
|
-
updatedAt: datetimeSchema,
|
|
45
|
-
updates: z.array(
|
|
46
|
-
z.object({
|
|
47
|
-
status: activatableIntegrationStatusSchema,
|
|
48
|
-
message: z.string(),
|
|
49
|
-
updatedAt: datetimeSchema,
|
|
50
|
-
}),
|
|
51
|
-
),
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
function createIntegrationSchema<T extends string, D extends z.ZodTypeAny, I extends z.ZodTypeAny>(
|
|
55
|
-
service: T,
|
|
56
|
-
dataSchema: D,
|
|
57
|
-
integrationPathSchema: I,
|
|
58
|
-
) {
|
|
59
|
-
return z
|
|
60
|
-
.object({
|
|
61
|
-
service: z.literal(service),
|
|
62
|
-
data: dataSchema,
|
|
63
|
-
integration: integrationPathSchema.nullable(),
|
|
64
|
-
})
|
|
65
|
-
.merge(activatableIntegrationBaseSchema.omit({ integration: true }))
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const activatableIntegrationSchema = z.discriminatedUnion('service', [
|
|
69
|
-
createIntegrationSchema(
|
|
70
|
-
'deliveroo',
|
|
71
|
-
integrationDeliverooDataSchema,
|
|
72
|
-
integrationDeliverooNullablePathSchema,
|
|
73
|
-
),
|
|
74
|
-
createIntegrationSchema('glovo', integrationGlovoDataSchema, integrationGlovoNullablePathSchema),
|
|
75
|
-
createIntegrationSchema(
|
|
76
|
-
'justeat',
|
|
77
|
-
integrationJustEatDataSchema,
|
|
78
|
-
integrationJustEatNullablePathSchema,
|
|
79
|
-
),
|
|
80
|
-
createIntegrationSchema(
|
|
81
|
-
'cassa_in_cloud',
|
|
82
|
-
integrationCassaInCloudDataSchema,
|
|
83
|
-
integrationCassaInCloudNullablePathSchema,
|
|
84
|
-
),
|
|
85
|
-
])
|
|
86
|
-
export type ActivatableIntegration = z.infer<typeof activatableIntegrationSchema>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { pointOfSaleSchema } from '@deliverart/sdk-js-point-of-sale'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
activatableIntegrationBaseSchema,
|
|
6
|
-
activatableIntegrationSchema,
|
|
7
|
-
} from './activatable-integration'
|
|
8
|
-
import {
|
|
9
|
-
integrationCassaInCloudDataSchema,
|
|
10
|
-
integrationDeliverooDataSchema,
|
|
11
|
-
integrationGlovoDataSchema,
|
|
12
|
-
integrationJustEatDataSchema,
|
|
13
|
-
} from './activatable-integration-data-schemas'
|
|
14
|
-
|
|
15
|
-
export const integrationActivationRequestSchema = activatableIntegrationSchema
|
|
16
|
-
export type IntegrationActivationRequest = z.infer<typeof integrationActivationRequestSchema>
|
|
17
|
-
|
|
18
|
-
export const integrationActivationRequestDetailsSchema = z.discriminatedUnion('service', [
|
|
19
|
-
z
|
|
20
|
-
.object({
|
|
21
|
-
pointOfSale: pointOfSaleSchema,
|
|
22
|
-
service: z.literal('deliveroo'),
|
|
23
|
-
data: integrationDeliverooDataSchema,
|
|
24
|
-
})
|
|
25
|
-
.merge(activatableIntegrationBaseSchema),
|
|
26
|
-
|
|
27
|
-
z
|
|
28
|
-
.object({
|
|
29
|
-
pointOfSale: pointOfSaleSchema,
|
|
30
|
-
service: z.literal('glovo'),
|
|
31
|
-
data: integrationGlovoDataSchema,
|
|
32
|
-
})
|
|
33
|
-
.merge(activatableIntegrationBaseSchema),
|
|
34
|
-
|
|
35
|
-
z
|
|
36
|
-
.object({
|
|
37
|
-
pointOfSale: pointOfSaleSchema,
|
|
38
|
-
service: z.literal('justeat'),
|
|
39
|
-
data: integrationJustEatDataSchema,
|
|
40
|
-
})
|
|
41
|
-
.merge(activatableIntegrationBaseSchema),
|
|
42
|
-
|
|
43
|
-
z
|
|
44
|
-
.object({
|
|
45
|
-
pointOfSale: pointOfSaleSchema,
|
|
46
|
-
service: z.literal('cassa_in_cloud'),
|
|
47
|
-
data: integrationCassaInCloudDataSchema,
|
|
48
|
-
})
|
|
49
|
-
.merge(activatableIntegrationBaseSchema),
|
|
50
|
-
])
|
|
51
|
-
export type IntegrationActivationRequestDetails = z.infer<
|
|
52
|
-
typeof integrationActivationRequestDetailsSchema
|
|
53
|
-
>
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
export const integrationCancellationRequestStatuses = ['pending', 'aborted', 'completed'] as const
|
|
4
|
-
export const integrationCancellationRequestStatusSchema = z.enum(
|
|
5
|
-
integrationCancellationRequestStatuses,
|
|
6
|
-
)
|
|
7
|
-
export type IntegrationCancellationRequestStatus = z.infer<
|
|
8
|
-
typeof integrationCancellationRequestStatusSchema
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
export const integrationCancellationRequestPathSchema = z
|
|
12
|
-
.string()
|
|
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
|
-
)
|
|
22
|
-
export type IntegrationCancellationRequestPath = z.infer<
|
|
23
|
-
typeof integrationCancellationRequestPathSchema
|
|
24
|
-
>
|
|
25
|
-
|
|
26
|
-
export const integrationCancellationRequestNullablePathSchema = z
|
|
27
|
-
.string()
|
|
28
|
-
.nullable()
|
|
29
|
-
.refine(
|
|
30
|
-
val => {
|
|
31
|
-
if (!val) return true
|
|
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
|
-
)
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
message: 'Invalid integration cancellation request path format',
|
|
38
|
-
},
|
|
39
|
-
)
|
|
40
|
-
export type IntegrationCancellationRequestNullablePath = z.infer<
|
|
41
|
-
typeof integrationCancellationRequestNullablePathSchema
|
|
42
|
-
>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { datetimeSchema } from '@deliverart/sdk-js-global-types'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { integrationCancellationRequestStatusSchema } from './cancellation-request-types'
|
|
5
|
-
import { integrationNullablePathSchema } from './types'
|
|
6
|
-
|
|
7
|
-
export const integrationCancellationRequestSchema = z.object({
|
|
8
|
-
id: z.string(),
|
|
9
|
-
status: integrationCancellationRequestStatusSchema,
|
|
10
|
-
createdAt: datetimeSchema,
|
|
11
|
-
updatedAt: datetimeSchema,
|
|
12
|
-
})
|
|
13
|
-
export type IntegrationCancellationRequest = z.infer<typeof integrationCancellationRequestSchema>
|
|
14
|
-
|
|
15
|
-
export const integrationCancellationRequestDetailsSchema =
|
|
16
|
-
integrationCancellationRequestSchema.extend({
|
|
17
|
-
integration: integrationNullablePathSchema,
|
|
18
|
-
})
|
|
19
|
-
export type IntegrationCancellationRequestDetails = z.infer<
|
|
20
|
-
typeof integrationCancellationRequestDetailsSchema
|
|
21
|
-
>
|
package/src/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './activatable-integration'
|
|
2
|
-
export * from './activatable-integration-data-schemas'
|
|
3
|
-
export * from './activatable-integration-types'
|
|
4
|
-
export * from './activation-request'
|
|
5
|
-
export * from './cancellation-request'
|
|
6
|
-
export * from './cancellation-request-types'
|
|
7
|
-
export * from './requests'
|
|
8
|
-
export * from './schemas'
|
|
9
|
-
export * from './types'
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
integrationCassaInCloudDetailsSchema,
|
|
5
|
-
integrationCassaInCloudSchema,
|
|
6
|
-
} from './service-schemas/cassa_in_cloud'
|
|
7
|
-
import {
|
|
8
|
-
integrationDeliverooDetailsSchema,
|
|
9
|
-
integrationDeliverooSchema,
|
|
10
|
-
} from './service-schemas/deliveroo'
|
|
11
|
-
import { integrationGlovoDetailsSchema, integrationGlovoSchema } from './service-schemas/glovo'
|
|
12
|
-
import {
|
|
13
|
-
integrationJustEatDetailsSchema,
|
|
14
|
-
integrationJustEatSchema,
|
|
15
|
-
} from './service-schemas/justeat'
|
|
16
|
-
|
|
17
|
-
export const integrationSchema = z.discriminatedUnion('service', [
|
|
18
|
-
integrationJustEatSchema,
|
|
19
|
-
integrationDeliverooSchema,
|
|
20
|
-
integrationGlovoSchema,
|
|
21
|
-
integrationCassaInCloudSchema,
|
|
22
|
-
])
|
|
23
|
-
export type Integration = z.infer<typeof integrationSchema>
|
|
24
|
-
|
|
25
|
-
export const integrationDetailsSchema = z.discriminatedUnion('service', [
|
|
26
|
-
integrationJustEatDetailsSchema,
|
|
27
|
-
integrationDeliverooDetailsSchema,
|
|
28
|
-
integrationGlovoDetailsSchema,
|
|
29
|
-
integrationCassaInCloudDetailsSchema,
|
|
30
|
-
])
|
|
31
|
-
export type IntegrationDetails = z.infer<typeof integrationDetailsSchema>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
export const deleteIntegrationInputSchema = z.undefined()
|
|
5
|
-
export const deleteIntegrationResponseSchema = z.undefined()
|
|
6
|
-
|
|
7
|
-
export class DeleteIntegration extends AbstractApiRequest<void, void> {
|
|
8
|
-
readonly method = 'DELETE'
|
|
9
|
-
readonly contentType = 'application/json'
|
|
10
|
-
readonly accept = 'application/json'
|
|
11
|
-
|
|
12
|
-
readonly inputSchema = deleteIntegrationInputSchema
|
|
13
|
-
readonly outputSchema = deleteIntegrationResponseSchema
|
|
14
|
-
readonly querySchema = undefined
|
|
15
|
-
readonly headersSchema = undefined
|
|
16
|
-
|
|
17
|
-
private readonly integrationId: string
|
|
18
|
-
|
|
19
|
-
constructor(integrationId: string) {
|
|
20
|
-
super()
|
|
21
|
-
this.integrationId = integrationId
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getPath(): string {
|
|
25
|
-
return `/integrations/${this.integrationId}`
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { IntegrationDetails, integrationDetailsSchema } from '../integration-schemas'
|
|
5
|
-
|
|
6
|
-
export const getIntegrationDetailsInputSchema = z.undefined()
|
|
7
|
-
|
|
8
|
-
export const getIntegrationDetailsResponseSchema = integrationDetailsSchema
|
|
9
|
-
export type GetIntegrationDetailsResponse = IntegrationDetails
|
|
10
|
-
|
|
11
|
-
export class GetIntegrationDetails extends AbstractApiRequest<void, GetIntegrationDetailsResponse> {
|
|
12
|
-
readonly method = 'GET'
|
|
13
|
-
readonly contentType = 'application/json'
|
|
14
|
-
readonly accept = 'application/json'
|
|
15
|
-
readonly inputSchema = getIntegrationDetailsInputSchema
|
|
16
|
-
readonly outputSchema = getIntegrationDetailsResponseSchema
|
|
17
|
-
readonly querySchema = undefined
|
|
18
|
-
readonly headersSchema = undefined
|
|
19
|
-
|
|
20
|
-
private readonly integrationId: string
|
|
21
|
-
|
|
22
|
-
constructor(integrationId: string) {
|
|
23
|
-
super()
|
|
24
|
-
this.integrationId = integrationId
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getPath(): string {
|
|
28
|
-
return `/integrations/${this.integrationId}`
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import {
|
|
3
|
-
createPaginatedSchema,
|
|
4
|
-
Paginated,
|
|
5
|
-
responseToPagination,
|
|
6
|
-
sortDirSchema,
|
|
7
|
-
timestampsFilterSchema,
|
|
8
|
-
} from '@deliverart/sdk-js-global-types'
|
|
9
|
-
import { AxiosResponse } from 'axios'
|
|
10
|
-
import { z } from 'zod'
|
|
11
|
-
|
|
12
|
-
import { Integration, integrationSchema } from '../integration-schemas'
|
|
13
|
-
import { integrationServiceSchema, integrationStatusSchema } from '../types'
|
|
14
|
-
|
|
15
|
-
export const getIntegrationsQuerySchema = z
|
|
16
|
-
.object({
|
|
17
|
-
status: integrationStatusSchema.optional(),
|
|
18
|
-
'status[]': z.array(integrationStatusSchema).optional(),
|
|
19
|
-
connectionId: z.string().optional(),
|
|
20
|
-
'connectionId[]': z.array(z.string()).optional(),
|
|
21
|
-
service: integrationServiceSchema.optional(),
|
|
22
|
-
'order[createdAt]': sortDirSchema.optional(),
|
|
23
|
-
'order[updatedAt]': sortDirSchema.optional(),
|
|
24
|
-
page: z.coerce.number().optional(),
|
|
25
|
-
})
|
|
26
|
-
.merge(timestampsFilterSchema)
|
|
27
|
-
export type GetIntegrationsQueryParams = z.infer<typeof getIntegrationsQuerySchema>
|
|
28
|
-
|
|
29
|
-
export const getIntegrationsResponseSchema = createPaginatedSchema(integrationSchema)
|
|
30
|
-
export type GetIntegrationsResponse = z.infer<typeof getIntegrationsResponseSchema>
|
|
31
|
-
|
|
32
|
-
export const getIntegrationsInputSchema = z.undefined()
|
|
33
|
-
|
|
34
|
-
export class GetIntegrations extends AbstractApiRequest<
|
|
35
|
-
void,
|
|
36
|
-
GetIntegrationsResponse,
|
|
37
|
-
GetIntegrationsQueryParams
|
|
38
|
-
> {
|
|
39
|
-
readonly method = 'GET'
|
|
40
|
-
readonly contentType = 'application/json'
|
|
41
|
-
readonly accept = 'application/json'
|
|
42
|
-
|
|
43
|
-
readonly inputSchema = getIntegrationsInputSchema
|
|
44
|
-
readonly outputSchema = getIntegrationsResponseSchema
|
|
45
|
-
readonly querySchema = getIntegrationsQuerySchema
|
|
46
|
-
readonly headersSchema = undefined
|
|
47
|
-
|
|
48
|
-
constructor(options?: { query?: GetIntegrationsQueryParams }) {
|
|
49
|
-
super(undefined, options)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
getPath(): string {
|
|
53
|
-
return '/integrations'
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
parseResponse(data: unknown, rawResponse: AxiosResponse): Paginated<Integration> {
|
|
57
|
-
const integrations = z.array(integrationSchema).parse(data)
|
|
58
|
-
return this.validateOutput({
|
|
59
|
-
data: integrations,
|
|
60
|
-
pagination: responseToPagination(rawResponse),
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { IntegrationDetails, integrationDetailsSchema } from '../integration-schemas'
|
|
5
|
-
import { writableIntegrationSchema } from '../schemas'
|
|
6
|
-
|
|
7
|
-
export const updateIntegrationInputSchema = writableIntegrationSchema.partial()
|
|
8
|
-
export type UpdateIntegrationInput = z.infer<typeof updateIntegrationInputSchema>
|
|
9
|
-
|
|
10
|
-
export const updateIntegrationResponseSchema = integrationDetailsSchema
|
|
11
|
-
export type UpdateIntegrationResponse = IntegrationDetails
|
|
12
|
-
|
|
13
|
-
export class UpdateIntegration extends AbstractApiRequest<
|
|
14
|
-
UpdateIntegrationInput,
|
|
15
|
-
UpdateIntegrationResponse
|
|
16
|
-
> {
|
|
17
|
-
readonly method = 'PATCH'
|
|
18
|
-
readonly contentType = 'application/merge-patch+json'
|
|
19
|
-
readonly accept = 'application/json'
|
|
20
|
-
|
|
21
|
-
readonly inputSchema = updateIntegrationInputSchema
|
|
22
|
-
readonly outputSchema = updateIntegrationResponseSchema
|
|
23
|
-
readonly querySchema = undefined
|
|
24
|
-
readonly headersSchema = undefined
|
|
25
|
-
|
|
26
|
-
private readonly integrationId: string
|
|
27
|
-
|
|
28
|
-
constructor(integrationId: string, input: UpdateIntegrationInput) {
|
|
29
|
-
super(input)
|
|
30
|
-
this.integrationId = integrationId
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getPath(): string {
|
|
34
|
-
return `/integrations/${this.integrationId}`
|
|
35
|
-
}
|
|
36
|
-
}
|