Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install node v20
- name: install node v22
uses: actions/setup-node@v1
with:
node-version: 20
node-version: 22
- uses: actions/cache@v4
with:
path: '**/node_modules'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}
- run: yarn install --frozen-lockfile
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"lib"
],
"devDependencies": {
"@tsconfig/recommended": "^1.0.8",
"@tsconfig/node22": "^22.0.2",
"@types/jest": "^29.5.14",
"@types/lodash": "^4.17.15",
"@typescript-eslint/eslint-plugin": "^8.23.0",
Expand All @@ -31,10 +31,13 @@
"jest": "^29.7.0",
"prettier": "^3.4.2",
"ts-jest": "^29.2.5",
"typescript": "^5.7.3"
"typescript": "^5.7.3",
"zod": "^4.1.11"
},
"dependencies": {
"lodash": "^4.17.21",
"zod": "^3.24.1"
"lodash": "^4.17.21"
},
"peerDependencies": {
"zod": "^4.1.11"
}
}
2 changes: 1 addition & 1 deletion src/error-response.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import {z} from 'zod/v4';

/** https://github.com/AtB-AS/amp-rs/blob/main/amp-http/src/lib.rs */
export const HttpError = z.object({
Expand Down
4 changes: 2 additions & 2 deletions src/fare-contract/__tests__/fixtures/carnet-farecontact.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FareContractType} from '../../types';
import {FareContractType, TravelRightType} from '../../types';
import {carnetTravelRight} from './carnet-travelright';

export const carnetFareContract: FareContractType = {
Expand All @@ -13,6 +13,6 @@ export const carnetFareContract: FareContractType = {
customerAccountId: 'ATB:CustomerAccount:Qw3fhcJudvgCYR7yHScbFd1mPtP2',
orderId: 'E69J9NJH',
created: new Date(Date.now() - 1000 * 60 * 60 * 10), // 10 hours ago
travelRights: [carnetTravelRight],
travelRights: [carnetTravelRight as unknown as TravelRightType],
totalTaxAmount: '46.07',
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FareContractType} from '../../types';
import {FareContractType, TravelRightType} from '../../types';
import {periodBoatTravelRight} from './period-boat-travelright';

export const periodBoatFareContract: FareContractType = {
Expand All @@ -13,6 +13,6 @@ export const periodBoatFareContract: FareContractType = {
customerAccountId: 'ATB:CustomerAccount:Qw3fhcJudvgCYR7yHScbFd1mPtP2',
orderId: '8MTTWRI4',
created: new Date(Date.now() - 1000 * 60 * 60 * 10), // 10 hours ago
travelRights: [periodBoatTravelRight],
travelRights: [periodBoatTravelRight as unknown as TravelRightType],
totalTaxAmount: '895.82',
};
10 changes: 6 additions & 4 deletions src/fare-contract/__tests__/travelrights.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ describe('Travelright type', () => {
expect(TravelRightType.safeParse(nightTravelRight).success).toBe(true);
expect(TravelRightType.safeParse(periodTravelRight).success).toBe(true);
expect(
TravelRightType.safeParse(periodBoatTravelRight as TravelRightType)
.success,
TravelRightType.safeParse(
periodBoatTravelRight as unknown as TravelRightType,
).success,
).toBe(true);
expect(TravelRightType.safeParse(singleTravelRight).success).toBe(true);
expect(
TravelRightType.safeParse(singleBoatTravelRight as TravelRightType)
.success,
TravelRightType.safeParse(
singleBoatTravelRight as unknown as TravelRightType,
).success,
).toBe(true);
expect(TravelRightType.safeParse(youthTravelRight).success).toBe(true);
expect(TravelRightType.safeParse(carnetTravelRight).success).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion src/fare-contract/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import {z} from 'zod/v4';
import {nullishToOptional} from '../utils';

export enum TravelRightStatus {
Expand Down
2 changes: 1 addition & 1 deletion src/offers/ticket-offer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {z} from 'zod';
import {z} from 'zod/v4';
import {nullishToOptional} from '../utils';

/**
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@tsconfig/recommended/tsconfig.json",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"outDir": "./lib",
"declaration": true
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,10 @@
dependencies:
"@sinonjs/commons" "^3.0.0"

"@tsconfig/recommended@^1.0.8":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@tsconfig/recommended/-/recommended-1.0.8.tgz#16483d57b56bbbd32b8c3af0eff1a40c32d006fa"
integrity sha512-TotjFaaXveVUdsrXCdalyF6E5RyG6+7hHHQVZonQtdlk1rJZ1myDIvPUUKPhoYv+JAzThb2lQJh9+9ZfF46hsA==
"@tsconfig/node22@^22.0.2":
version "22.0.2"
resolved "https://registry.yarnpkg.com/@tsconfig/node22/-/node22-22.0.2.tgz#1e04e2c5cc946dac787d69bb502462a851ae51b6"
integrity sha512-Kmwj4u8sDRDrMYRoN9FDEcXD8UpBSaPQQ24Gz+Gamqfm7xxn+GBR7ge/Z7pK8OXNGyUzbSwJj+TH6B+DS/epyA==

"@types/babel__core@^7.1.14":
version "7.20.5"
Expand Down Expand Up @@ -3704,7 +3704,7 @@ yocto-queue@^0.1.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==

zod@^3.24.1:
version "3.24.1"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.24.1.tgz#27445c912738c8ad1e9de1bea0359fa44d9d35ee"
integrity sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==
zod@^4.1.11:
version "4.1.11"
resolved "https://registry.yarnpkg.com/zod/-/zod-4.1.11.tgz#4aab62f76cfd45e6c6166519ba31b2ea019f75f5"
integrity sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==