Skip to content

Commit ad3d40d

Browse files
authored
Upgrades / Nest 11 (#3407)
2 parents 1576d44 + 3ed2476 commit ad3d40d

File tree

16 files changed

+4354
-4230
lines changed

16 files changed

+4354
-4230
lines changed

.yarn/patches/@whatwg-node-fetch-npm-0.9.22-a60314fb39.patch renamed to .yarn/patches/@whatwg-node-fetch-npm-0.10.6-bca79028fb.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/dist/index.d.ts b/dist/index.d.ts
2-
index d16ddf2f4e30e75c5b04044af34e8286b2e8b0a5..9f56feb61efa75a40c815fd56f11642719d41737 100644
2+
index f55c0838ebf3aee24ec547d21ec67dc709ab7c8f..b6606e35b73f3c985f18fe66e924ec2218e35a7b 100644
33
--- a/dist/index.d.ts
44
+++ b/dist/index.d.ts
55
@@ -1,5 +1,3 @@

package.json

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cord-api-v3",
33
"version": "3.0.0",
44
"license": "MIT",
5-
"packageManager": "yarn@4.5.1",
5+
"packageManager": "yarn@4.9.1",
66
"engines": {
77
"node": ">= 20.6"
88
},
@@ -33,28 +33,28 @@
3333
"dependencies": {
3434
"@aws-sdk/client-s3": "^3.440.0",
3535
"@aws-sdk/s3-request-presigner": "^3.440.0",
36-
"@faker-js/faker": "^8.2.0",
36+
"@faker-js/faker": "^9.7.0",
3737
"@fastify/compress": "^8.0.1",
3838
"@fastify/cookie": "^11.0.1",
39-
"@fastify/cors": "^10.0.1",
39+
"@fastify/cors": "^11.0.1",
4040
"@ffprobe-installer/ffprobe": "^2.1.2",
4141
"@golevelup/nestjs-discovery": "^4.0.0",
42-
"@graphql-hive/yoga": "^0.38.2",
42+
"@graphql-hive/yoga": ">=0.41.0",
4343
"@graphql-tools/utils": "^10.5.4",
4444
"@graphql-yoga/plugin-apq": "^3.7.0",
4545
"@leeoniya/ufuzzy": "^1.0.11",
46-
"@nestjs/common": "^10.2.7",
47-
"@nestjs/core": "^10.2.7",
48-
"@nestjs/graphql": "^12.0.9",
49-
"@nestjs/platform-fastify": "^10.4.3",
46+
"@nestjs/common": "^11.1.0",
47+
"@nestjs/core": "^11.1.0",
48+
"@nestjs/graphql": "^13.1.0",
49+
"@nestjs/platform-fastify": "^11.1.0",
5050
"@patarapolw/prettyprint": "^1.0.3",
5151
"@seedcompany/cache": "^3.0.2",
5252
"@seedcompany/common": ">=0.17 <1",
5353
"@seedcompany/data-loader": "^2.0.1",
5454
"@seedcompany/nest": "^1.4.0",
5555
"@seedcompany/nestjs-email": "^4.1.1",
5656
"@seedcompany/scripture": ">=0.8.0",
57-
"argon2": "^0.31.1",
57+
"argon2": "^0.43.0",
5858
"aws-xray-sdk-core": "^3.5.3",
5959
"chalk": "^5.3.0",
6060
"class-transformer": "^0.5.1",
@@ -64,23 +64,23 @@
6464
"common-tags": "^1.8.2",
6565
"cypher-query-builder": "patch:cypher-query-builder@npm%3A6.0.4#~/.yarn/patches/cypher-query-builder-npm-6.0.4-e8707a5e8e.patch",
6666
"dotenv": "^16.3.1",
67-
"dotenv-expand": "^10.0.0",
68-
"execa": "^8.0.1",
67+
"dotenv-expand": "^12.0.2",
68+
"execa": "^9.5.2",
6969
"extensionless": "^1.7.0",
7070
"fast-safe-stringify": "^2.1.1",
7171
"fastest-levenshtein": "^1.0.16",
7272
"fastify": "^5.0.0",
7373
"fastify-raw-body": "^5.0.0",
74-
"file-type": "^18.6.0",
74+
"file-type": "^20.5.0",
7575
"gel": "^2.1.0-canary.20250319T143140",
76-
"glob": "^10.3.10",
76+
"glob": "^11.0.2",
7777
"got": "^14.3.0",
7878
"graphql": "^16.9.0",
7979
"graphql-parse-resolve-info": "^4.14.0",
8080
"graphql-scalars": "^1.22.4",
81-
"graphql-yoga": "^5.7.0",
81+
"graphql-yoga": "^5.13.4",
8282
"human-format": "^1.2.0",
83-
"image-size": "^1.0.2",
83+
"image-size": "^2.0.2",
8484
"indent-string": "^5.0.0",
8585
"ioredis": "^5.3.2",
8686
"iso-3166-1": "^2.1.1",
@@ -90,48 +90,48 @@
9090
"lodash": "npm:lodash-es@^4.17.21",
9191
"lru-cache": "^11.0.1",
9292
"luxon": "^3.5.0",
93-
"mime": "beta",
94-
"nanoid": "^4.0.2",
93+
"mime": "^4.0.7",
94+
"nanoid": "^5.1.5",
9595
"neo4j-driver": "^5.28.1",
9696
"p-retry": "^6.2.1",
97-
"pkg-up": "^4.0.0",
9897
"plur": "^5.1.0",
9998
"prismjs-terminal": "^1.2.3",
10099
"react": "^18.2.0",
101100
"react-dom": "^18.2.0",
102-
"reflect-metadata": "^0.1.13",
103-
"rimraf": "^5.0.5",
101+
"read-package-up": "^11.0.0",
102+
"reflect-metadata": "^0.2.2",
103+
"rimraf": "^6.0.1",
104104
"rxjs": "^7.8.1",
105105
"sanitize-filename": "^1.6.3",
106106
"title-case": "^4.3.1",
107-
"ts-essentials": "^9.4.1",
107+
"ts-essentials": "^10.0.4",
108108
"urlpattern-polyfill": "^10.0.0",
109-
"uuid": "^10.0.0",
109+
"uuid": "^11.1.0",
110+
"validator": "^13.15.0",
110111
"winston": "^3.11.0",
111-
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz",
112+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
112113
"xregexp": "^5.1.1",
113114
"yaml": "^2.3.3"
114115
},
115116
"devDependencies": {
116117
"@gel/generate": "^0.7.0-canary.20250422T080308",
117-
"@graphql-hive/cli": "^0.44.2",
118-
"@nestjs/cli": "^10.2.1",
119-
"@nestjs/schematics": "^10.0.3",
120-
"@nestjs/testing": "^10.2.7",
118+
"@graphql-hive/cli": ">=0.44",
119+
"@nestjs/cli": "^11.0.7",
120+
"@nestjs/schematics": "^11.0.5",
121+
"@nestjs/testing": "^11.1.0",
121122
"@seedcompany/eslint-plugin": "^3.4.1",
122123
"@tsconfig/strictest": "^2.0.2",
123124
"@types/common-tags": "^1.8.3",
124125
"@types/ffprobe": "^1.1.7",
125126
"@types/jest": "^29.5.7",
126127
"@types/jsonwebtoken": "^9.0.4",
127128
"@types/lodash": "^4.14.200",
128-
"@types/luxon": "^3.4.2",
129+
"@types/luxon": "^3.6.2",
129130
"@types/node": "^22.7.8",
130131
"@types/prismjs": "^1.26.2",
131132
"@types/react": "^18.2.33",
132-
"@types/stack-trace": "^0.0.32",
133+
"@types/stack-trace": "^0.0.33",
133134
"@types/triple-beam": "^1.3.4",
134-
"@types/uuid": "^10.0.0",
135135
"@types/validator": "^13.11.5",
136136
"@typescript-eslint/parser": "^5.62.0",
137137
"debugger-is-attached": "^1.2.0",
@@ -140,28 +140,33 @@
140140
"eslint-plugin-typescript-sort-keys": "^2.3.0",
141141
"husky": "^4.3.8",
142142
"jest": "^29.7.0",
143-
"lint-staged": "^14.0.1",
143+
"lint-staged": "^15.5.1",
144+
"npm-check-updates": "^18.0.1",
144145
"ts-jest": "^29.1.1",
145-
"ts-morph": "^19.0.0",
146+
"ts-morph": "^25.0.1",
146147
"ts-node": "^10.9.1",
147148
"ts-patch": "^3.0.2",
148149
"ts-transformer-keys": "^0.4.4",
149150
"type-fest": "^4.15.0",
150-
"typescript": "^5.2.2",
151+
"typescript": "~5.2.2",
151152
"typescript-transform-paths": "^3.4.6"
152153
},
153154
"resolutions": {
154155
"cypher-query-builder/neo4j-driver": "^5",
156+
"@angular-devkit/core": "^19.2",
157+
"@angular-devkit/schematics": "^19.2",
155158
"@nestjs/cli/fork-ts-checker-webpack-plugin": "npm:empty-npm-package@*",
159+
"@nestjs/cli/glob": "^11",
156160
"@nestjs/cli/webpack": "npm:empty-npm-package@*",
157-
"@nestjs/cli/typescript": "^5.1.6",
158-
"@nestjs/graphql/graphql-ws": "^5",
159-
"@nestjs/platform-fastify/@fastify/cors": "^10",
160-
"@nestjs/platform-fastify/@fastify/formbody": "^8",
161-
"@nestjs/platform-fastify/@fastify/middie": "^9",
162-
"@nestjs/platform-fastify/fastify": "^5",
163-
"@nestjs/platform-fastify/light-my-request": "^6",
164-
"@whatwg-node/fetch": "patch:@whatwg-node/fetch@npm%3A0.9.22#~/.yarn/patches/@whatwg-node-fetch-npm-0.9.22-a60314fb39.patch",
161+
"@nestjs/cli/typescript": "~5.2.2",
162+
"@whatwg-node/fetch@npm:^0.10.0": "patch:@whatwg-node/fetch@npm%3A0.10.6#~/.yarn/patches/@whatwg-node-fetch-npm-0.10.6-bca79028fb.patch",
163+
"@whatwg-node/fetch@npm:^0.10.1": "patch:@whatwg-node/fetch@npm%3A0.10.6#~/.yarn/patches/@whatwg-node-fetch-npm-0.10.6-bca79028fb.patch",
164+
"@whatwg-node/fetch@npm:^0.10.4": "patch:@whatwg-node/fetch@npm%3A0.10.6#~/.yarn/patches/@whatwg-node-fetch-npm-0.10.6-bca79028fb.patch",
165+
"@whatwg-node/fetch@npm:^0.10.6": "patch:@whatwg-node/fetch@npm%3A0.10.6#~/.yarn/patches/@whatwg-node-fetch-npm-0.10.6-bca79028fb.patch",
166+
"logform": "2.6.1",
167+
"process-warning": "^5",
168+
"rxjs": "^7.8",
169+
"secure-json-parse": "^4",
165170
"subscriptions-transport-ws": "npm:empty-npm-package@*"
166171
},
167172
"dependenciesMeta": {

src/common/generate-id.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { customAlphabet } from 'nanoid/async';
1+
import { customAlphabet } from 'nanoid';
22
import { ID } from './id-field';
33

44
// 100 IDs / hour = 1k years to have 1% probability of a single collision

src/common/temporal/calendar-date.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { setInspectOnClass, setToStringTag } from '@seedcompany/common';
1+
import {
2+
type NonEmptyArray,
3+
setInspectOnClass,
4+
setToStringTag,
5+
} from '@seedcompany/common';
26
import {
37
DateObjectUnits,
48
DateTime,
@@ -160,13 +164,19 @@ export class CalendarDate<IsValid extends boolean = DefaultValidity>
160164
static max(): undefined;
161165
static max(...dateTimes: DateTime[]): CalendarDate;
162166
static max(...dateTimes: DateTime[]): CalendarDate | undefined {
163-
return CalendarDate.fromDateTime(super.max(...dateTimes));
167+
if (dateTimes.length === 0) return undefined;
168+
return CalendarDate.fromDateTime(
169+
super.max(...(dateTimes as unknown as NonEmptyArray<DateTime>)),
170+
);
164171
}
165172

166173
static min(): undefined;
167174
static min(...dateTimes: DateTime[]): CalendarDate;
168175
static min(...dateTimes: DateTime[]): CalendarDate | undefined {
169-
return CalendarDate.fromDateTime(super.min(...dateTimes));
176+
if (dateTimes.length === 0) return undefined;
177+
return CalendarDate.fromDateTime(
178+
super.min(...(dateTimes as unknown as NonEmptyArray<DateTime>)),
179+
);
170180
}
171181

172182
static utc(

src/common/url.field.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CustomScalar, Field, FieldOptions, Scalar } from '@nestjs/graphql';
33
import { IsUrl } from 'class-validator';
44
import { GraphQLError, Kind, ValueNode } from 'graphql';
55
import { URL } from 'url';
6-
import ValidatorJS from 'validator';
6+
import * as ValidatorJS from 'validator';
77

88
export const UrlField = ({
99
url,

src/common/validators/email.validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { isEmail, ValidationOptions } from 'class-validator';
2-
import ValidatorJS from 'validator';
2+
import * as ValidatorJS from 'validator';
33
import { ValidateBy } from './validateBy';
44

55
export const IsEmail = (
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Injectable } from '@nestjs/common';
22
import * as argon2 from 'argon2';
3-
import { pickBy } from 'lodash';
4-
import { Except } from 'type-fest';
53
import { ConfigService } from '~/core';
64

75
@Injectable()
@@ -17,12 +15,10 @@ export class CryptoService {
1715
}
1816

1917
private get argon2Options() {
20-
const options: Except<argon2.Options, 'raw'> = {
21-
secret: this.config.passwordSecret
22-
? Buffer.from(this.config.passwordSecret, 'utf-8')
23-
: undefined,
24-
};
25-
// argon doesn't like undefined values even though the types allow them
26-
return pickBy(options, (v) => v !== undefined);
18+
return {
19+
...(this.config.passwordSecret && {
20+
secret: Buffer.from(this.config.passwordSecret, 'utf-8'),
21+
}),
22+
} satisfies argon2.Options;
2723
}
2824
}

src/components/authorization/policy/policy.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Module } from '@nestjs/common';
2+
import { CoreModule } from '~/core';
23
import { RoleAndExpUnionOptimizer } from '../policies/conditions/role-and-exp-union.optimizer';
34
import { VariantAndExpUnionOptimizer } from '../policies/conditions/variant-and-exp-union.optimizer';
45
import { FlattenAggregateOptimizer } from './conditions/flatten-aggregate.optimizer';
@@ -11,6 +12,7 @@ import { GrantersFactory } from './granters.factory';
1112
import { PolicyFactory } from './policy.factory';
1213

1314
@Module({
15+
imports: [CoreModule],
1416
providers: [
1517
GrantersFactory,
1618
PolicyFactory,

src/components/file/media/media-detector.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { CachedByArg as Once } from '@seedcompany/common';
44
import { $, execa } from 'execa';
55
import { FFProbeResult } from 'ffprobe';
66
import { imageSize } from 'image-size';
7-
import { ISize as ImageSize } from 'image-size/dist/types/interface';
7+
import type { ISize as ImageSize } from 'image-size/types/interface';
88
import { Except } from 'type-fest';
99
import { retry } from '~/common/retry';
1010
import { ILogger, Logger } from '~/core';

src/core/config/version.service.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { OnModuleInit } from '@nestjs/common';
2-
import { execaCommand as command } from 'execa';
3-
import { promises as fs } from 'fs';
2+
import { $ } from 'execa';
43
import { LazyGetter } from 'lazy-get-decorator';
5-
import { pkgUp } from 'pkg-up';
6-
import { PackageJson } from 'type-fest';
4+
import { readPackageUp } from 'read-package-up';
75
import { ILogger, Logger } from '../logger';
86
import { ConfigService } from './config.service';
97
import { EnvironmentService } from './environment.service';
@@ -42,7 +40,7 @@ export class VersionService implements OnModuleInit {
4240
return env;
4341
}
4442
try {
45-
const res = await command('git symbolic-ref -q --short HEAD');
43+
const res = await $`git symbolic-ref -q --short HEAD`;
4644
return res.stdout;
4745
} catch (e) {
4846
return undefined;
@@ -55,22 +53,20 @@ export class VersionService implements OnModuleInit {
5553
return env;
5654
}
5755
try {
58-
const res = await command('git rev-parse -q --short HEAD');
56+
const res = await $`git rev-parse -q --short HEAD`;
5957
return res.stdout;
6058
} catch (e) {
6159
return undefined;
6260
}
6361
}
6462

6563
private async fromPackageJson() {
66-
const packageJson = await pkgUp();
67-
if (!packageJson) {
64+
const res = await readPackageUp();
65+
if (!res) {
6866
return undefined;
6967
}
7068
try {
71-
const str = await fs.readFile(packageJson, { encoding: 'utf8' });
72-
const json: PackageJson = JSON.parse(str);
73-
return json.version;
69+
return res.packageJson.version;
7470
} catch (e) {
7571
return undefined;
7672
}

0 commit comments

Comments
 (0)