Skip to content

Commit

Permalink
chore: Bump typescript, tsx. (#898)
Browse files Browse the repository at this point in the history
* fix: Bump deps.

* Use jest-matchers-object lookup.

* Bump Jest for prettier v3/mjs support.

* Use toThrow.

* Fix outputDirectory.

* Add comment.

* Disable detectOpenHandles due to false positive.

jestjs/jest#14788

* Re-format.
  • Loading branch information
stephenh authored Dec 27, 2023
1 parent f916645 commit d112463
Show file tree
Hide file tree
Showing 42 changed files with 1,383 additions and 959 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.3",
"@tsconfig/docusaurus": "^2.0.2",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
},
"browserslist": {
"production": [
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@
],
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^11.0.0",
"@semantic-release/commit-analyzer": "^11.1.0",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^9.2.1",
"@semantic-release/release-notes-generator": "^12.0.0",
"@semantic-release/github": "^9.2.6",
"@semantic-release/release-notes-generator": "^12.1.0",
"@tsconfig/node20": "^20.1.2",
"env-cmd": "^10.1.0",
"semantic-release": "^22.0.5",
"ts-patch": "^3.0.2",
"semantic-release": "^22.0.12",
"ts-patch": "^3.1.1",
"typescript-transform-paths": "^3.4.6"
},
"dependencies": {
"typescript": "^5.2.2"
"typescript": "^5.3.3"
},
"packageManager": "yarn@3.6.3"
}
20 changes: 10 additions & 10 deletions packages/codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"dependencies": {
"@dprint/formatter": "^0.2.0",
"@dprint/json": "0.15.6",
"@types/pluralize": "0.0.32",
"@types/pluralize": "0.0.33",
"change-case": "^4.1.2",
"joist-utils": "workspace:*",
"knex": "^3.0.1",
"knex": "^3.1.0",
"pg": "^8.11.3",
"pg-structure": "^7.15.0",
"pluralize": "^8.0.0",
Expand All @@ -30,15 +30,15 @@
},
"devDependencies": {
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.6",
"@types/node": "^20.8.9",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.5",
"jest": "30.0.0-alpha.2",
"prettier": "^3.1.1",
"prettier-plugin-organize-imports": "^3.2.4",
"ts-node-dev": "^2.0.0",
"tsconfig-paths": "^4.2.0",
"tsx": "^4.1.1",
"typescript": "^5.2.2",
"zod-to-json-schema": "^3.21.4"
"tsx": "^4.7.0",
"typescript": "^5.3.3",
"zod-to-json-schema": "^3.22.3"
}
}
2 changes: 1 addition & 1 deletion packages/codegen/src/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("config", () => {
"shouldNotIgnore",
true,
),
).rejects.toThrowError(
).rejects.toThrow(
"notNull field Author.shouldNotIgnore cannot be ignored. Alter the column to be optional or have a default value prior to ignoring it.",
);
});
Expand Down
24 changes: 12 additions & 12 deletions packages/codegen/src/generateMetadataFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ function generateFields(config: Config, dbMetadata: EntityDbMetadata): Record<st
const serdeType = customSerde
? code`new ${CustomSerdeAdapter}("${fieldName}", "${columnName}", "${columnType}", ${customSerde})`
: superstruct
? code`new ${SuperstructSerde}("${fieldName}", "${columnName}", ${superstruct})`
: zodSchema
? code`new ${ZodSerde}("${fieldName}", "${columnName}", ${zodSchema})`
: columnType === "numeric"
? code`new ${DecimalToNumberSerde}("${fieldName}", "${columnName}")`
: columnType === "jsonb"
? code`new ${JsonSerde}("${fieldName}", "${columnName}")`
: fieldType === "bigint"
? code`new ${BigIntSerde}("${fieldName}", "${columnName}")`
: isArray
? code`new ${PrimitiveSerde}("${fieldName}", "${columnName}", "${columnType}[]", true)`
: code`new ${PrimitiveSerde}("${fieldName}", "${columnName}", "${columnType}")`;
? code`new ${SuperstructSerde}("${fieldName}", "${columnName}", ${superstruct})`
: zodSchema
? code`new ${ZodSerde}("${fieldName}", "${columnName}", ${zodSchema})`
: columnType === "numeric"
? code`new ${DecimalToNumberSerde}("${fieldName}", "${columnName}")`
: columnType === "jsonb"
? code`new ${JsonSerde}("${fieldName}", "${columnName}")`
: fieldType === "bigint"
? code`new ${BigIntSerde}("${fieldName}", "${columnName}")`
: isArray
? code`new ${PrimitiveSerde}("${fieldName}", "${columnName}", "${columnType}[]", true)`
: code`new ${PrimitiveSerde}("${fieldName}", "${columnName}", "${columnType}")`;
const extras = columnType === "citext" ? code`citext: true,` : "";
fields[fieldName] = code`
{
Expand Down
16 changes: 8 additions & 8 deletions packages/graphql-codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"types": "build/index.d.ts",
"scripts": {
"format": "prettier --write '{schema,migrations,src}/**/*.{ts,js,tsx,jsx,graphql}'",
"test": "jest"
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
"files": [
"build"
Expand All @@ -25,17 +25,17 @@
"joist-codegen": "workspace:*",
"joist-utils": "workspace:*",
"pluralize": "^8.0.0",
"prettier": "2.8.8",
"prettier": "3.1.1",
"ts-poet": "^6.6.0"
},
"devDependencies": {
"@swc/core": "^1.3.95",
"@swc/core": "^1.3.101",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.6",
"@types/node": "^20.8.9",
"jest": "^29.7.0",
"prettier-plugin-organize-imports": "^3.2.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.5",
"jest": "30.0.0-alpha.2",
"prettier-plugin-organize-imports": "^3.2.4",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
}
}
11 changes: 7 additions & 4 deletions packages/graphql-codegen/src/generateGraphqlCodegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ export function generateGraphqlCodegen(entities: EntityDbMetadata[], enums: Enum
function sortObject<T extends object>(obj: T): T {
return Object.keys(obj)
.sort()
.reduce((acc, key) => {
acc[key as keyof T] = obj[key as keyof T];
return acc;
}, {} as any as T) as T;
.reduce(
(acc, key) => {
acc[key as keyof T] = obj[key as keyof T];
return acc;
},
{} as any as T,
) as T;
}
6 changes: 3 additions & 3 deletions packages/graphql-codegen/src/generateGraphqlSchemaFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function generateGraphqlSchemaFiles(fs: Fs, entities: EntityDbMetad
await writeHistory(fs, history);
}

/** Make all of the fields for `type Author`, `type Book`, etc. */
/** Make all the fields for `type Author`, `type Book`, etc. */
function createPolymorphicUnions(entities: EntityDbMetadata[]): GqlUnion[] {
return entities.flatMap((e) => {
const file = fileName(e);
Expand All @@ -70,7 +70,7 @@ function createPolymorphicUnions(entities: EntityDbMetadata[]): GqlUnion[] {
});
}

/** Make all of the fields for `type Author`, `type Book`, etc. */
/** Make all the fields for `type Author`, `type Book`, etc. */
function createEntityFields(entities: EntityDbMetadata[]): GqlField[] {
return entities.flatMap((e) => {
const file = fileName(e);
Expand Down Expand Up @@ -147,7 +147,7 @@ function createSaveMutation(entities: EntityDbMetadata[]): GqlField[] {
});
}

/** Make all of the fields for `type SaveAuthorInput`, `type SaveBookBook`, etc. */
/** Make all the fields for `type SaveAuthorInput`, `type SaveBookBook`, etc. */
function createSaveEntityInputFields(entities: EntityDbMetadata[]): GqlField[] {
return entities.flatMap((e) => {
const file = fileName(e);
Expand Down
25 changes: 14 additions & 11 deletions packages/graphql-codegen/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ export function newFsImpl(prefix: string): Fs {
export function sortKeys<T extends object>(o: T): T {
return Object.keys(o)
.sort()
.reduce((acc, key) => {
const value = o[key as keyof T];
const newValue =
typeof value === "object" && isPlainObject(value)
? sortKeys(value as any as object)
: Array.isArray(value)
? (value as any[]).sort()
: value;
acc[key as keyof T] = newValue as any;
return acc;
}, {} as any as T);
.reduce(
(acc, key) => {
const value = o[key as keyof T];
const newValue =
typeof value === "object" && isPlainObject(value)
? sortKeys(value as any as object)
: Array.isArray(value)
? (value as any[]).sort()
: value;
acc[key as keyof T] = newValue as any;
return acc;
},
{} as any as T,
);
}
14 changes: 7 additions & 7 deletions packages/graphql-resolver-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"joist-test-utils": "workspace:*"
},
"devDependencies": {
"@swc/core": "^1.3.95",
"@swc/core": "^1.3.101",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.6",
"@types/node": "^20.8.9",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.5",
"jest": "30.0.0-alpha.2",
"prettier": "^3.1.1",
"prettier-plugin-organize-imports": "^3.2.4",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
}
}
28 changes: 14 additions & 14 deletions packages/graphql-resolver-utils/src/entityResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ export type EntityResolver<T extends Entity> = {
[P in keyof T]: P extends "id"
? Resolver<T, Record<string, any>, IdOf<T>>
: T[P] extends GraphQLPrimitive | GraphQLPrimitive[]
? Resolver<T, Record<string, any>, T[P]>
: T[P] extends Collection<T, infer U>
? Resolver<T, Record<string, any>, U[]>
: T[P] extends Reference<T, infer U, infer N>
? Resolver<T, Record<string, any>, U>
: T[P] extends AsyncProperty<T, infer V>
? Resolver<T, Record<string, any>, V>
: T[P] extends Promise<infer V>
? Resolver<T, Record<string, any>, V>
: T[P] extends () => Promise<infer V>
? Resolver<T, Record<string, any>, V>
: T[P] extends () => infer V
? Resolver<T, Record<string, any>, V>
: Resolver<T, Record<string, any>, T[P]>;
? Resolver<T, Record<string, any>, T[P]>
: T[P] extends Collection<T, infer U>
? Resolver<T, Record<string, any>, U[]>
: T[P] extends Reference<T, infer U, infer N>
? Resolver<T, Record<string, any>, U>
: T[P] extends AsyncProperty<T, infer V>
? Resolver<T, Record<string, any>, V>
: T[P] extends Promise<infer V>
? Resolver<T, Record<string, any>, V>
: T[P] extends () => Promise<infer V>
? Resolver<T, Record<string, any>, V>
: T[P] extends () => infer V
? Resolver<T, Record<string, any>, V>
: Resolver<T, Record<string, any>, T[P]>;
};

/**
Expand Down
16 changes: 8 additions & 8 deletions packages/migration-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
"build"
],
"dependencies": {
"@types/pluralize": "0.0.32",
"@types/pluralize": "0.0.33",
"joist-utils": "workspace:*",
"node-pg-migrate": "^6.2.2",
"pg": "^8.11.3",
"pg-structure": "^7.15.0",
"pluralize": "^8.0.0"
},
"devDependencies": {
"@swc/core": "^1.3.95",
"@swc/core": "^1.3.101",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.6",
"@types/node": "^20.8.9",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.5",
"jest": "30.0.0-alpha.2",
"prettier": "^3.1.1",
"prettier-plugin-organize-imports": "^3.2.4",
"ts-node-dev": "^2.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
}
}
18 changes: 9 additions & 9 deletions packages/orm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
"build"
],
"dependencies": {
"@types/object-hash": "^3.0.5",
"@types/object-hash": "^3.0.6",
"dataloader": "^2.2.2",
"joist-utils": "workspace:*",
"knex": "^3.0.1",
"knex": "^3.1.0",
"object-hash": "^3.0.0",
"pg": "^8.11.3"
},
"devDependencies": {
"@swc/core": "^1.3.95",
"@swc/core": "^1.3.101",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.6",
"@types/node": "^20.8.9",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.5",
"jest": "30.0.0-alpha.2",
"prettier": "^3.1.1",
"prettier-plugin-organize-imports": "^3.2.4",
"ts-node-dev": "^2.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
}
}
8 changes: 4 additions & 4 deletions packages/orm/src/Aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export type Alias<T extends Entity> = {
[P in keyof FieldsOf<T>]: FieldsOf<T>[P] extends { kind: "primitive" | "enum"; type: infer V; nullable: infer N }
? PrimitiveAlias<V, N extends undefined ? null : never>
: FieldsOf<T>[P] extends { kind: "m2o"; type: infer U }
? EntityAlias<U>
: FieldsOf<T>[P] extends { kind: "poly"; type: infer U extends Entity }
? PolyReferenceAlias<U>
: never;
? EntityAlias<U>
: FieldsOf<T>[P] extends { kind: "poly"; type: infer U extends Entity }
? PolyReferenceAlias<U>
: never;
};

export interface PrimitiveAlias<V, N extends null | never> {
Expand Down
8 changes: 4 additions & 4 deletions packages/orm/src/EntityFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export type SettableFields<F> = {
[K in keyof F]: F[K] extends { kind: "primitive"; derived: false }
? F[K]
: F[K] extends { kind: "enum" }
? F[K]
: F[K] extends { kind: "m2o"; derived: false }
? F[K]
: never;
? F[K]
: F[K] extends { kind: "m2o"; derived: false }
? F[K]
: never;
};
4 changes: 2 additions & 2 deletions packages/orm/src/EntityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,8 @@ export class EntityManager<C = unknown, Entity extends EntityW = EntityW> {
.filter((original) => entityToClone.has(original))
.map((original) => entityToClone.get(original) as Loaded<T, H>)
: clones[0]
? (clones[0][1] as Loaded<T, H>)
: fail("no entities were cloned given the provided options");
? (clones[0][1] as Loaded<T, H>)
: fail("no entities were cloned given the provided options");
}

/** Returns an instance of `type` for the given `id`, resolving to an existing instance if in our Unit of Work. */
Expand Down
4 changes: 2 additions & 2 deletions packages/orm/src/QueryParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,8 @@ function parseExpression(expression: ExpressionFilter): ParsedExpressionFilter |
"and" in expression && expression.and
? ["and" as const, expression.and]
: "or" in expression && expression.or
? ["or" as const, expression.or]
: fail(`Invalid expression ${expression}`);
? ["or" as const, expression.or]
: fail(`Invalid expression ${expression}`);
const conditions = expressions.map((exp) => (exp && ("and" in exp || "or" in exp) ? parseExpression(exp) : exp));
const [skip, valid] = partition(conditions, (cond) => cond === undefined || cond === skipCondition);
if ((skip.length > 0 && expression.pruneIfUndefined === "any") || valid.length === 0) {
Expand Down
Loading

0 comments on commit d112463

Please sign in to comment.