Skip to content

Commit e98e940

Browse files
chore: 🤖 bump dependencies
1 parent 45822a5 commit e98e940

34 files changed

+4904
-4601
lines changed

‎package.json‎

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -37,58 +37,58 @@
3737
"postgres:migration:run": "yarn postgres migration:run"
3838
},
3939
"dependencies": {
40-
"@golevelup/ts-jest": "^0.3.3",
41-
"@nestjs/axios": "^3.0.2",
42-
"@nestjs/common": "^10.3.7",
43-
"@nestjs/config": "^3.2.2",
44-
"@nestjs/core": "^10.3.7",
45-
"@nestjs/passport": "^10.0.3",
46-
"@nestjs/platform-express": "^10.3.7",
47-
"@nestjs/schedule": "^4.0.2",
48-
"@nestjs/swagger": "^7.3.1",
49-
"@nestjs/typeorm": "^10.0.2",
40+
"@nestjs/axios": "^4.0.1",
41+
"@nestjs/common": "^11.1.6",
42+
"@nestjs/config": "^4.0.2",
43+
"@nestjs/core": "^11.1.6",
44+
"@nestjs/passport": "^11.0.5",
45+
"@nestjs/platform-express": "^11.1.6",
46+
"@nestjs/schedule": "^6.0.1",
47+
"@nestjs/swagger": "^11.2.0",
48+
"@nestjs/typeorm": "^11.0.0",
5049
"@polymeshassociation/fireblocks-signing-manager": "^2.5.0",
51-
"@polymeshassociation/hashicorp-vault-signing-manager": "^3.4.0",
52-
"@polymeshassociation/local-signing-manager": "^3.3.0",
50+
"@polymeshassociation/hashicorp-vault-signing-manager": "^3.5.0",
51+
"@polymeshassociation/local-signing-manager": "^3.5.2",
5352
"@polymeshassociation/polymesh-sdk": "28.0.0",
5453
"@polymeshassociation/polymesh-types": "^6.2.0",
55-
"@polymeshassociation/signing-manager-types": "^3.2.0",
54+
"@polymeshassociation/signing-manager-types": "^3.4.2",
5655
"class-transformer": "0.5.1",
5756
"class-validator": "^0.14.0",
58-
"joi": "17.4.0",
59-
"json-stable-stringify": "^1.0.2",
57+
"joi": "18.0.1",
58+
"json-stable-stringify": "^1.3.0",
6059
"lodash": "4.17.21",
6160
"passport": "^0.7.0",
6261
"passport-custom": "^1.1.1",
6362
"passport-headerapikey": "^1.2.2",
64-
"pg": "^8.11.5",
63+
"pg": "^8.16.3",
6564
"reflect-metadata": "0.2.2",
6665
"rhea-promise": "^3.0.1",
6766
"rimraf": "3.0.2",
68-
"rxjs": "^7.5.7",
69-
"swagger-ui-express": "5.0.0",
70-
"typeorm": "^0.3.17"
67+
"rxjs": "^7.8.2",
68+
"swagger-ui-express": "5.0.1",
69+
"typeorm": "^0.3.27"
7170
},
7271
"devDependencies": {
7372
"@babel/plugin-transform-modules-commonjs": "7.22.11",
74-
"@commitlint/cli": "^17.7.1",
75-
"@commitlint/config-conventional": "^17.7.0",
76-
"@nestjs/cli": "^10.1.17",
77-
"@nestjs/schematics": "^10.0.2",
78-
"@nestjs/testing": "^10.2.4",
73+
"@commitlint/cli": "^20.1.0",
74+
"@commitlint/config-conventional": "^20.0.0",
75+
"@golevelup/ts-jest": "^0.3.3",
76+
"@nestjs/cli": "^11.0.10",
77+
"@nestjs/schematics": "^11.0.8",
78+
"@nestjs/testing": "^11.1.6",
7979
"@semantic-release/changelog": "^6.0.3",
80-
"@semantic-release/exec": "^6.0.3",
81-
"@semantic-release/npm": "^11.0.0",
82-
"@types/axios": "^0.14.0",
83-
"@types/cron": "^1.7.3",
84-
"@types/express": "4.17.17",
85-
"@types/jest": "29.5.4",
86-
"@types/jest-when": "^3.5.2",
87-
"@types/json-stable-stringify": "^1.0.34",
80+
"@semantic-release/exec": "^7.1.0",
81+
"@semantic-release/npm": "^12.0.2",
82+
"@types/axios": "^0.14.4",
83+
"@types/cron": "^2.4.3",
84+
"@types/express": "5.0.3",
85+
"@types/jest": "30.0.0",
86+
"@types/jest-when": "^3.5.5",
87+
"@types/json-stable-stringify": "^1.2.0",
8888
"@types/lodash": "^4.14.197",
8989
"@types/node": "^18.15.11",
90-
"@types/passport": "^1.0.11",
91-
"@types/supertest": "2.0.12",
90+
"@types/passport": "^1.0.17",
91+
"@types/supertest": "6.0.3",
9292
"@typescript-eslint/eslint-plugin": "6.9.1",
9393
"@typescript-eslint/parser": "6.9.1",
9494
"@zerollup/ts-transform-paths": "1.7.11",
@@ -104,16 +104,17 @@
104104
"eslint-plugin-simple-import-sort": "10.0.0",
105105
"husky": "8.0.3",
106106
"jest": "29.7.0",
107-
"jest-when": "^3.6.0",
107+
"jest-when": "^3.7.0",
108108
"lint-staged": "14.0.1",
109+
"path-to-regexp": "^8.3.0",
109110
"prettier": "2.8.8",
110111
"prettier-eslint": "15.0.1",
111112
"prettier-eslint-cli": "7.1.0",
112-
"semantic-release": "^22.0.0",
113-
"supertest": "6.1.3",
114-
"ts-jest": "29.1.1",
115-
"ts-loader": "9.4.4",
116-
"ts-node": "10.9.1",
113+
"semantic-release": "^24.2.9",
114+
"supertest": "7.1.4",
115+
"ts-jest": "29.4.4",
116+
"ts-loader": "9.5.4",
117+
"ts-node": "10.9.2",
117118
"tsconfig-paths": "^4.2.0",
118119
"typescript": "4.8.2"
119120
},

‎src/accounts/accounts.service.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('AccountsService', () => {
8686

8787
const address = 'address';
8888

89-
await expect(() => service.findOne(address)).rejects.toThrowError();
89+
await expect(() => service.findOne(address)).rejects.toThrow();
9090

9191
expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError);
9292
});
@@ -217,7 +217,7 @@ describe('AccountsService', () => {
217217

218218
const handleSdkErrorSpy = jest.spyOn(transactionsUtilModule, 'handleSdkError');
219219

220-
await expect(() => service.getPermissions('address')).rejects.toThrowError();
220+
await expect(() => service.getPermissions('address')).rejects.toThrow();
221221

222222
expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError);
223223
});

‎src/assets/assets.service.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('AssetsService', () => {
116116

117117
const address = 'address';
118118

119-
await expect(() => service.findOne(address)).rejects.toThrowError();
119+
await expect(() => service.findOne(address)).rejects.toThrow();
120120

121121
expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError);
122122
});
@@ -143,7 +143,7 @@ describe('AssetsService', () => {
143143

144144
const address = 'address';
145145

146-
await expect(() => service.findFungible(address)).rejects.toThrowError();
146+
await expect(() => service.findFungible(address)).rejects.toThrow();
147147

148148
expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError);
149149
});

‎src/assets/models/transfer-restriction-claim-value.model.ts‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,25 @@ import { StatAccreditedClaimModel } from '~/assets/models/stat-claim-accredited.
1414
import { StatAffiliateClaimModel } from '~/assets/models/stat-claim-affiliate.model';
1515
import { StatJurisdictionClaimModel } from '~/assets/models/stat-claim-jurisdiction.model';
1616
import { ApiPropertyOneOf } from '~/common/decorators';
17-
import { FromEntity } from '~/common/decorators/transformation';
17+
import { FromBigNumber, FromEntity } from '~/common/decorators/transformation';
1818

1919
export class TransferRestrictionClaimValueModel {
2020
declare readonly type: TransferRestrictionType.ClaimCount;
2121

2222
@ApiProperty({
2323
description: 'The claim count/percentage restriction value',
2424
example: '10',
25-
type: 'object',
25+
type: 'string',
2626
})
27+
@FromBigNumber()
2728
readonly min: BigNumber;
2829

2930
@ApiProperty({
3031
description: 'The maximum claim count/percentage restriction value',
3132
example: '40',
32-
type: 'object',
33+
type: 'string',
3334
})
35+
@FromBigNumber()
3436
readonly max: BigNumber;
3537

3638
@ApiProperty({
@@ -43,11 +45,7 @@ export class TransferRestrictionClaimValueModel {
4345

4446
@ApiPropertyOneOf({
4547
description: 'The claim associated with the transfer restriction',
46-
union: [
47-
StatAccreditedClaimModel,
48-
StatAffiliateClaimModel,
49-
StatJurisdictionClaimModel,
50-
],
48+
union: [StatAccreditedClaimModel, StatAffiliateClaimModel, StatJurisdictionClaimModel],
5149
})
5250
@Type(() => StatClaimModel, {
5351
keepDiscriminatorProperty: true,

‎src/auth/auth.service.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('AuthService', () => {
7676

7777
await service.deleteApiKey({ apiKey: testApiKey });
7878

79-
expect(mockApiKeyRepo.deleteApiKey).toBeCalledWith(testApiKey);
79+
expect(mockApiKeyRepo.deleteApiKey).toHaveBeenCalledWith(testApiKey);
8080
});
8181
});
8282
});
Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { Test, TestingModule } from '@nestjs/testing';
22
import { when } from 'jest-when';
3-
import passport from 'passport';
43

54
import { ApiKeyStrategy } from '~/auth/strategies/api-key.strategy';
6-
import { AuthStrategy } from '~/auth/strategies/strategies.consts';
75
import { MockAuthService, mockAuthServiceProvider } from '~/test-utils/service-mocks';
86

97
describe('ApiKeyStrategy', () => {
@@ -26,42 +24,15 @@ describe('ApiKeyStrategy', () => {
2624
});
2725

2826
it('should verify with the user when given a valid api key', async () => {
29-
const mockRequest = {
30-
headers: {
31-
'x-api-key': mockApiKey,
32-
},
33-
};
27+
when(authService.validateApiKey).calledWith(mockApiKey).mockResolvedValue(mockedUser);
3428

35-
when(authService.validateApiKey).calledWith(mockApiKey).mockReturnValue(mockedUser);
36-
37-
let authorizedUser;
38-
passport.authenticate(
39-
AuthStrategy.ApiKey,
40-
(request: unknown, user: Express.User | false | null) => {
41-
authorizedUser = user;
42-
}
43-
)(mockRequest, {}, {});
44-
45-
expect(authorizedUser).toEqual(mockedUser);
29+
const result = await strategy.validate(mockApiKey);
30+
expect(result).toEqual(mockedUser);
4631
});
4732

4833
it('should return an Unauthorized response if the key is not found', async () => {
49-
const mockRequest = {
50-
headers: {
51-
'x-api-key': 'not-a-secret',
52-
},
53-
};
54-
55-
when(authService.validateApiKey).calledWith(mockApiKey).mockReturnValue(mockedUser);
56-
57-
let authorizedUser;
58-
passport.authenticate(
59-
AuthStrategy.ApiKey,
60-
(request: unknown, user: Express.User | false | null) => {
61-
authorizedUser = user;
62-
}
63-
)(mockRequest, {}, {});
34+
when(authService.validateApiKey).calledWith('not-a-secret').mockResolvedValue(null);
6435

65-
expect(authorizedUser).toBeFalsy();
36+
await expect(strategy.validate('not-a-secret')).rejects.toThrow('API key not found');
6637
});
6738
});

‎src/auth/strategies/api-key.strategy.ts‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@ import { HeaderAPIKeyStrategy } from 'passport-headerapikey';
55
import { AuthService } from '~/auth/auth.service';
66
import { AuthStrategy } from '~/auth/strategies/strategies.consts';
77
import { AppUnauthorizedError } from '~/common/errors';
8+
import { UserModel } from '~/users/model/user.model';
89

910
export const apiKeyHeader = 'x-api-key';
1011

11-
// eslint-disable-next-line @typescript-eslint/ban-types
12-
type Callback = (err: Error | null, user?: Object, info?: Object) => void;
13-
1412
/**
1513
* authenticate with an API key
1614
*/
1715
@Injectable()
1816
export class ApiKeyStrategy extends PassportStrategy(HeaderAPIKeyStrategy, AuthStrategy.ApiKey) {
19-
constructor(private authService: AuthService) {
20-
super({ header: apiKeyHeader }, false, (apiKey: string, done: Callback) => {
21-
const user = this.authService.validateApiKey(apiKey);
22-
if (!user) {
23-
return done(new AppUnauthorizedError('API key not found'), undefined);
24-
}
25-
return done(null, user);
26-
});
17+
constructor(private readonly authService: AuthService) {
18+
super({ header: apiKeyHeader, prefix: '' }, false);
19+
}
20+
21+
public async validate(apiKey: string): Promise<UserModel> {
22+
const user = await this.authService.validateApiKey(apiKey);
23+
24+
if (!user) {
25+
throw new AppUnauthorizedError('API key not found');
26+
}
27+
28+
return user;
2729
}
2830
}
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Test, TestingModule } from '@nestjs/testing';
2-
import passport from 'passport';
32

43
import { OpenStrategy } from '~/auth/strategies/open.strategy';
5-
import { AuthStrategy } from '~/auth/strategies/strategies.consts';
64
import { defaultUser } from '~/users/user.consts';
75

86
describe('OpenStrategy', () => {
@@ -21,14 +19,8 @@ describe('OpenStrategy', () => {
2119
});
2220

2321
it('should verify with the open user', async () => {
24-
let authorizedUser;
25-
passport.authenticate(
26-
AuthStrategy.Open,
27-
(request: unknown, user: Express.User | false | null) => {
28-
authorizedUser = user;
29-
}
30-
)({}, {}, {});
31-
32-
expect(authorizedUser).toEqual(defaultUser);
22+
// Test the validate method directly
23+
const result = strategy.validate();
24+
expect(result).toEqual(defaultUser);
3325
});
3426
});
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@nestjs/common';
22
import { PassportStrategy } from '@nestjs/passport';
3-
import { Strategy, VerifyCallback } from 'passport-custom';
3+
import { Strategy } from 'passport-custom';
44

55
import { AuthStrategy } from '~/auth/strategies/strategies.consts';
66
import { defaultUser } from '~/users/user.consts';
@@ -12,9 +12,7 @@ import { defaultUser } from '~/users/user.consts';
1212
*/
1313
@Injectable()
1414
export class OpenStrategy extends PassportStrategy(Strategy, AuthStrategy.Open) {
15-
constructor() {
16-
const verifyEveryone: VerifyCallback = (req, done) => done(null, defaultUser);
17-
18-
super(verifyEveryone);
15+
public validate(): Express.User {
16+
return defaultUser;
1917
}
2018
}

‎src/authorizations/authorizations.service.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ describe('AuthorizationsService', () => {
178178
await expect(() =>
179179
// eslint-disable-next-line @typescript-eslint/no-explicit-any
180180
service.findOne(mockAccount as any, new BigNumber(1))
181-
).rejects.toThrowError();
181+
).rejects.toThrow();
182182

183183
expect(handleSdkErrorSpy).toHaveBeenCalledWith(mockError);
184184
});
@@ -226,7 +226,7 @@ describe('AuthorizationsService', () => {
226226
.calledWith(mockIdentity as any, id)
227227
.mockRejectedValue(mockError);
228228

229-
await expect(() => service.getAuthRequest(address, id)).rejects.toThrowError(mockError);
229+
await expect(() => service.getAuthRequest(address, id)).rejects.toThrow(mockError);
230230

231231
when(findOneSpy)
232232
// eslint-disable-next-line @typescript-eslint/no-explicit-any

0 commit comments

Comments
 (0)