Skip to content

Commit

Permalink
chore(deps): update tooling and export types (#59)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: the exports have changed, bumping major version for safety
  • Loading branch information
mirceanis authored Jan 26, 2024
1 parent 1efb2ac commit 7235052
Show file tree
Hide file tree
Showing 6 changed files with 1,856 additions and 1,920 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ jobs:
- name: "Setup node with cache"
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 20
cache: 'yarn'

- run: yarn install --frozen-lockfile
- run: yarn run format
- run: yarn run build

- name: "Setup git coordinates"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- name: "Setup node with cache"
uses: actions/setup-node@v4
with:
node-version: 14
cache: 'yarn'
node-version: 20
cache: yarn

- run: yarn install --frozen-lockfile
- run: yarn run build
Expand All @@ -22,4 +22,5 @@ jobs:
- name: "Upload coverage reports"
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos but sometimes fails without :|
fail_ci_if_error: true
24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
"source": "src/index.ts",
"main": "./lib/index.cjs",
"module": "./lib/index.module.js",
"unpkg": "./lib/index.umd.js",
"types": "./lib/index.d.ts",
"umd:main": "./lib/index.umd.js",
"files": [
"lib",
"src",
"LICENSE"
],
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./lib/index.cjs",
"import": "./lib/index.module.js"
}
Expand Down Expand Up @@ -50,22 +49,21 @@
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@types/jest": "29.5.11",
"@types/node": "18.19.8",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"codecov": "3.8.3",
"@types/node": "20.11.7",
"@typescript-eslint/eslint-plugin": "6.19.1",
"@typescript-eslint/parser": "6.19.1",
"eslint": "8.56.0",
"eslint-config-prettier": "8.10.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "27.6.3",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-prettier": "5.1.3",
"jest": "29.7.0",
"microbundle": "0.15.1",
"prettier": "2.8.8",
"semantic-release": "19.0.5",
"typescript": "4.9.5"
"prettier": "3.2.4",
"semantic-release": "23.0.0",
"typescript": "5.3.3"
},
"dependencies": {
"did-jwt": "^6.3.0",
"did-resolver": "^4.0.0"
"did-jwt": "^8.0.0",
"did-resolver": "^4.1.0"
}
}
62 changes: 31 additions & 31 deletions src/__tests__/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('credential-status', () => {

const token = await createJWT(
{ credentialStatus: { type: 'CustomStatusChecker', id: 'something something' } },
{ issuer, signer }
{ issuer, signer },
)
const statusEntry = await checker.checkStatus(token, referenceDoc)
expect(statusEntry).toStrictEqual({ revoked: false })
Expand All @@ -69,10 +69,10 @@ describe('credential-status', () => {
const checker = new Status()
const token = await createJWT(
{ credentialStatus: { type: 'UnknownMethod', id: 'something something' } },
{ issuer, signer }
{ issuer, signer },
)
await expect(checker.checkStatus(token, referenceDoc)).rejects.toThrow(
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./,
)
})

Expand All @@ -81,10 +81,10 @@ describe('credential-status', () => {
const checker = new Status()
const token = await createJWT(
{ vc: { credentialStatus: { type: 'UnknownMethod', id: 'something something' } } },
{ issuer, signer }
{ issuer, signer },
)
await expect(checker.checkStatus(token, referenceDoc)).rejects.toThrow(
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./,
)
})

Expand All @@ -93,10 +93,10 @@ describe('credential-status', () => {
const checker = new Status()
const token = await createJWT(
{ vp: { credentialStatus: { type: 'UnknownMethod', id: 'something something' } } },
{ issuer, signer }
{ issuer, signer },
)
await expect(checker.checkStatus(token, referenceDoc)).rejects.toThrow(
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./,
)
})

Expand All @@ -111,10 +111,10 @@ describe('credential-status', () => {
id: 'something something',
},
},
referenceDoc
)
referenceDoc,
),
).rejects.toThrow(
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./,
)
})

Expand All @@ -129,10 +129,10 @@ describe('credential-status', () => {
id: 'something something',
},
}),
referenceDoc
)
referenceDoc,
),
).rejects.toThrow(
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./
/unknown_method: credentialStatus method UnknownMethod unknown. Validity can not be determined./,
)
})
})
Expand All @@ -147,21 +147,21 @@ describe('credential-status', () => {
{
credentialStatus: true,
} as any,
referenceDoc
)
referenceDoc,
),
).rejects.toThrow(
/bad_request: credentialStatus entry is not formatted correctly. Validity can not be determined./
/bad_request: credentialStatus entry is not formatted correctly. Validity can not be determined./,
)

await expect(
checker.checkStatus(
{
credentialStatus: 'this is not revoked, believe me',
} as any,
referenceDoc
)
referenceDoc,
),
).rejects.toThrow(
/bad_request: credentialStatus entry is not formatted correctly. Validity can not be determined./
/bad_request: credentialStatus entry is not formatted correctly. Validity can not be determined./,
)
})

Expand All @@ -176,10 +176,10 @@ describe('credential-status', () => {
message: 'believe me',
},
} as any,
referenceDoc
)
referenceDoc,
),
).rejects.toThrow(
/bad_request: credentialStatus entry is not formatted correctly. Validity can not be determined./
/bad_request: credentialStatus entry is not formatted correctly. Validity can not be determined./,
)
})

Expand All @@ -194,10 +194,10 @@ describe('credential-status', () => {
id: 'bar',
},
} as any,
referenceDoc
)
referenceDoc,
),
).rejects.toThrow(
/bad_request: credentialStatus entry is not formatted correctly. Validity can not be determined./
/bad_request: credentialStatus entry is not formatted correctly. Validity can not be determined./,
)
})
})
Expand All @@ -210,7 +210,7 @@ describe('credential-status', () => {
const checker = new Status({ CustomStatusChecker: checkStatus })
const token = await createJWT(
{ credentialStatus: { type: 'CustomStatusChecker', id: 'something something' } },
{ issuer, signer }
{ issuer, signer },
)
const statusEntry = await checker.checkStatus(token, referenceDoc)
expect(statusEntry).toStrictEqual({ revoked: false, 'custom method works': true })
Expand All @@ -223,7 +223,7 @@ describe('credential-status', () => {
const checker = new Status({ CustomStatusChecker: checkStatus })
const token = await createJWT(
{ vc: { credentialStatus: { type: 'CustomStatusChecker', id: 'something something' } } },
{ issuer, signer }
{ issuer, signer },
)
const statusEntry = await checker.checkStatus(token, referenceDoc)
expect(statusEntry).toStrictEqual({ revoked: false, 'custom method works': true })
Expand All @@ -236,7 +236,7 @@ describe('credential-status', () => {
const checker = new Status({ CustomStatusChecker: checkStatus })
const token = await createJWT(
{ vp: { credentialStatus: { type: 'CustomStatusChecker', id: 'something something' } } },
{ issuer, signer }
{ issuer, signer },
)
const statusEntry = await checker.checkStatus(token, referenceDoc)
expect(statusEntry).toStrictEqual({ revoked: false, 'custom method works': true })
Expand All @@ -254,7 +254,7 @@ describe('credential-status', () => {
id: 'something something',
},
},
referenceDoc
referenceDoc,
)
expect(statusEntry).toStrictEqual({ revoked: false, 'custom method works': true })
})
Expand All @@ -271,7 +271,7 @@ describe('credential-status', () => {
id: 'something something',
},
}),
referenceDoc
referenceDoc,
)
expect(statusEntry).toStrictEqual({ revoked: false, 'custom method works': true })
})
Expand All @@ -286,7 +286,7 @@ describe('credential-status', () => {
credentialStatus: { type: 'Unknown', id: 'nope' },
vc: { credentialStatus: { type: 'CustomStatusChecker', id: 'something something' } },
},
{ issuer, signer }
{ issuer, signer },
)
const statusEntry = await checker.checkStatus(token, referenceDoc)
expect(statusEntry).toStrictEqual({ revoked: false, 'custom method works': true })
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class Status implements StatusResolver {

if (!method) {
throw new Error(
`unknown_method: credentialStatus method ${statusEntry.type} unknown. Validity can not be determined.`
`unknown_method: credentialStatus method ${statusEntry.type} unknown. Validity can not be determined.`,
)
} else {
return method(credential, didDoc)
Expand Down
Loading

0 comments on commit 7235052

Please sign in to comment.