Skip to content

Commit

Permalink
fix: update to @myparcel/constants to get new constants
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Mar 20, 2024
1 parent dbeb674 commit db3bc6f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
"bugs": {
"url": "https://github.com/myparcelnl/developer/issues"
},
"type": "module",
"repository": "github:myparcelnl/developer",
"license": "MIT",
"author": "Edie Lemoine <[email protected]>",
"type": "module",
"scripts": {
"build": "yarn optimize:svg -q && vuepress build src",
"dev": "vuepress dev src",
"postinstall": "yarn translations:init && (is-ci || husky install)",
"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'"
Expand Down Expand Up @@ -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",
Expand Down
25 changes: 20 additions & 5 deletions src/.vuepress/theme/client/composables/useDataTypes.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -18,6 +23,16 @@ export interface DataTypeGroup {
children: (DataTypeWithId | DataTypeWithName)[];
}

const objectToArray = (obj: Record<string, string>): 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[] => [
{
Expand Down Expand Up @@ -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',
Expand Down
37 changes: 32 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:."
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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"
Expand Down

0 comments on commit db3bc6f

Please sign in to comment.