From db3bc6fd192af912be5078847fb6c1633e95ecaa Mon Sep 17 00:00:00 2001 From: Edie Lemoine Date: Wed, 20 Mar 2024 11:15:22 +0100 Subject: [PATCH] fix: update to @myparcel/constants to get new constants --- package.json | 8 ++-- .../theme/client/composables/useDataTypes.ts | 25 ++++++++++--- yarn.lock | 37 ++++++++++++++++--- 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 53667096..519e2972 100755 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "bugs": { "url": "https://github.com/myparcelnl/developer/issues" }, - "type": "module", "repository": "github:myparcelnl/developer", "license": "MIT", "author": "Edie Lemoine ", + "type": "module", "scripts": { "build": "yarn optimize:svg -q && vuepress build src", "dev": "vuepress dev src", @@ -18,10 +18,10 @@ "optimize:svg": "svgo -r --multipass --final-newline --folder src/.vuepress/public", "preview": "http-server src/.vuepress/dist -s --port 9599", "test": "concurrently test:vitest:run yarn:test:links", - "test:vitest": "vitest", - "test:vitest:run": "vitest run", "test:links": "WAIT_ON_TIMEOUT=30000 start-server-and-test preview http://127.0.0.1:9599 test:links:run", "test:links:run": "hyperlink -ir --root src/.vuepress/dist http://127.0.0.1:9599", + "test:vitest": "vitest", + "test:vitest:run": "vitest run", "translations:import": "echo 'Importing translations...' && google-docs-importer -d 1q_las2AW8vZqhyiymXnPtrCsNQsye9W0Aqi3aWymjuU -o src/.vuepress/public/translations && echo 'Done!'", "translations:init": "test -f src/.vuepress/public/translations/en.json || yarn translations:import", "watch": "nodemon --ext ts,vue,md --watch src --exec 'vuepress build src --debug'" @@ -57,7 +57,7 @@ "@myparcel-eslint/eslint-config-prettier": "^1.2.3", "@myparcel-eslint/eslint-config-prettier-typescript": "^1.2.4", "@myparcel-eslint/eslint-config-prettier-typescript-vue": "^1.2.6", - "@myparcel/sdk": "^2.10.1", + "@myparcel/constants": "^2.0.0", "@tsconfig/node18": "^18.2.2", "@types/flat": "^5.0.2", "@types/lodash-es": "^4.17.6", diff --git a/src/.vuepress/theme/client/composables/useDataTypes.ts b/src/.vuepress/theme/client/composables/useDataTypes.ts index 9896b817..a81ae9af 100644 --- a/src/.vuepress/theme/client/composables/useDataTypes.ts +++ b/src/.vuepress/theme/client/composables/useDataTypes.ts @@ -1,5 +1,10 @@ /* eslint-disable no-magic-numbers,@typescript-eslint/no-magic-numbers */ -import {CARRIERS, DELIVERY_TYPES, PACKAGE_TYPES, PLATFORMS} from '@myparcel/sdk'; +import { + CARRIER_IDS_TO_NAMES, + DELIVERY_TYPE_IDS_TO_NAMES, + PACKAGE_TYPE_IDS_TO_NAMES, + PLATFORM_IDS_TO_NAMES, +} from '@myparcel/constants'; interface BaseDataType { HUMAN?: string; @@ -18,6 +23,16 @@ export interface DataTypeGroup { children: (DataTypeWithId | DataTypeWithName)[]; } +const objectToArray = (obj: Record): DataTypeWithName[] => { + return Object.entries(obj).map(([id, name]) => { + return { + ID: Number(id), + NAME: name, + HUMAN: name, + }; + }); +}; + // eslint-disable-next-line max-lines-per-function export const useDataTypes = (): DataTypeGroup[] => [ { @@ -50,19 +65,19 @@ export const useDataTypes = (): DataTypeGroup[] => [ }, { name: 'package-type', - children: PACKAGE_TYPES.ALL, + children: objectToArray(PACKAGE_TYPE_IDS_TO_NAMES), }, { name: 'delivery-type', - children: DELIVERY_TYPES.ALL, + children: objectToArray(DELIVERY_TYPE_IDS_TO_NAMES), }, { name: 'carrier', - children: CARRIERS.ALL, + children: objectToArray(CARRIER_IDS_TO_NAMES), }, { name: 'platform', - children: PLATFORMS.ALL, + children: objectToArray(PLATFORM_IDS_TO_NAMES), }, { name: 'order-status', diff --git a/yarn.lock b/yarn.lock index bbf14eb9..c8d847a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -951,6 +951,24 @@ __metadata: languageName: node linkType: hard +"@myparcel/constants@npm:^1.0.0": + version: 1.2.0 + resolution: "@myparcel/constants@npm:1.2.0" + dependencies: + "@myparcel/ts-utils": ^1.7.0 + checksum: 808b2bb62f8f9b92637736b2bee3eabfe857ba4ce9aeb0a945a5950d06077c6d4629e4b06def40c6b83bb1f9e2d9c0c0f81784dcb1a4eb133aebba09d4542879 + languageName: node + linkType: hard + +"@myparcel/constants@npm:^2.0.0": + version: 2.0.0 + resolution: "@myparcel/constants@npm:2.0.0" + dependencies: + "@myparcel/ts-utils": ^1.7.0 + checksum: 7a70ae1749ebf6eaa6bb63d9afd7e2b314686bbec664f91bd921d38f72ab0635644acd2b41c1f5867111c2a912a83ddfbfb9a1c73a7885f6289eb6300c61d384 + languageName: node + linkType: hard + "@myparcel/developer-portal@workspace:.": version: 0.0.0-use.local resolution: "@myparcel/developer-portal@workspace:." @@ -962,7 +980,8 @@ __metadata: "@myparcel-eslint/eslint-config-prettier": ^1.2.3 "@myparcel-eslint/eslint-config-prettier-typescript": ^1.2.4 "@myparcel-eslint/eslint-config-prettier-typescript-vue": ^1.2.6 - "@myparcel/sdk": ^2.10.1 + "@myparcel/constants": ^2.0.0 + "@myparcel/sdk": ^3.8.1 "@tsconfig/node18": ^18.2.2 "@types/flat": ^5.0.2 "@types/lodash-es": ^4.17.6 @@ -1016,12 +1035,13 @@ __metadata: languageName: node linkType: hard -"@myparcel/sdk@npm:^2.10.1": - version: 2.11.0 - resolution: "@myparcel/sdk@npm:2.11.0" +"@myparcel/sdk@npm:^3.8.1": + version: 3.8.1 + resolution: "@myparcel/sdk@npm:3.8.1" dependencies: + "@myparcel/constants": ^1.0.0 "@myparcel/ts-utils": ^1.6.0 - checksum: cb5786cd9a03bd35aa27ba57375b096ed87d5fb3aa4733f8f614b721ce7affe3b9d155b425e1515b9ef5ae0ca0c459a679ebf988e2387ecd6d9f5b31940d47f4 + checksum: 7f8166cd401ef0c2d21ff61b1997fa4919790e295f222d3b325db276c1c9b7948fa880aeacaa696f995e2b077d7621cae9e0935a42d358675d274cbd29c63c8a languageName: node linkType: hard @@ -1032,6 +1052,13 @@ __metadata: languageName: node linkType: hard +"@myparcel/ts-utils@npm:^1.7.0": + version: 1.14.0 + resolution: "@myparcel/ts-utils@npm:1.14.0" + checksum: 3fa2be8b8514bada03f55910dca89435a99ab79345e658f9f9241e36687e671afaf3b17c0787d4887fd330197565a04ab51cd16310dc14915f7c7e43415e2c52 + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5"