From fa8d16a03c2d4f3f51a23c372983f965253bcfac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niclas=20Ro=C3=9Fberger?= Date: Mon, 7 Nov 2022 22:03:24 +0100 Subject: [PATCH] refactor: use ModifyTypeOfProperty of @nidomiro/ts-type-utils --- package-lock.json | 75 +++++++++++++++++-- package.json | 3 +- .../src/lib/relation-tuple-parser.ts | 6 +- packages/typescript/src/lib/util/type.util.ts | 1 - 4 files changed, 73 insertions(+), 12 deletions(-) delete mode 100644 packages/typescript/src/lib/util/type.util.ts diff --git a/package-lock.json b/package-lock.json index afb45c7..76ab42d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,13 +12,14 @@ "@nestjs/common": "^9.0.0", "@nestjs/core": "^9.0.0", "@nestjs/platform-express": "^9.0.0", + "@nidomiro/ts-type-utils": "^0.1.1", "@ory/keto-client": "^0.10.0-alpha.0", "@ory/keto-grpc-client": "^0.10.0-alpha.0", "assert-never": "^1.2.1", "defekt": "^9.3.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.0.0", - "tslib": "^2.3.0" + "tslib": "^2.4.1" }, "devDependencies": { "@nestjs/schematics": "^9.0.0", @@ -1551,6 +1552,11 @@ } } }, + "node_modules/@nestjs/common/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "node_modules/@nestjs/common/node_modules/uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", @@ -1602,6 +1608,11 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz", "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==" }, + "node_modules/@nestjs/core/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "node_modules/@nestjs/core/node_modules/uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", @@ -1630,6 +1641,11 @@ "@nestjs/core": "^9.0.0" } }, + "node_modules/@nestjs/platform-express/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "node_modules/@nestjs/schematics": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/@nestjs/schematics/-/schematics-9.0.3.tgz", @@ -1673,6 +1689,20 @@ } } }, + "node_modules/@nestjs/testing/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + }, + "node_modules/@nidomiro/ts-type-utils": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nidomiro/ts-type-utils/-/ts-type-utils-0.1.1.tgz", + "integrity": "sha512-IX3NhOSXRq3XtvRfJvntzJU/Rlr957giJM3RlCoeED2heD1pb7YR9TycdsmCQQnO5LyVyKqZmvfA8vy9FpWALQ==", + "peerDependencies": { + "tslib": "2.4.1" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -13036,9 +13066,9 @@ } }, "node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, "node_modules/tsutils": { "version": "3.21.0", @@ -15077,6 +15107,11 @@ "uuid": "9.0.0" }, "dependencies": { + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", @@ -15103,6 +15138,11 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz", "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==" }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, "uuid": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", @@ -15120,6 +15160,13 @@ "express": "4.18.2", "multer": "1.4.4-lts.1", "tslib": "2.4.0" + }, + "dependencies": { + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + } } }, "@nestjs/schematics": { @@ -15142,8 +15189,22 @@ "dev": true, "requires": { "tslib": "2.4.0" + }, + "dependencies": { + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==", + "dev": true + } } }, + "@nidomiro/ts-type-utils": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nidomiro/ts-type-utils/-/ts-type-utils-0.1.1.tgz", + "integrity": "sha512-IX3NhOSXRq3XtvRfJvntzJU/Rlr957giJM3RlCoeED2heD1pb7YR9TycdsmCQQnO5LyVyKqZmvfA8vy9FpWALQ==", + "requires": {} + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -23785,9 +23846,9 @@ } }, "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, "tsutils": { "version": "3.21.0", diff --git a/package.json b/package.json index 0a86633..ce09d8d 100644 --- a/package.json +++ b/package.json @@ -11,13 +11,14 @@ "@nestjs/common": "^9.0.0", "@nestjs/core": "^9.0.0", "@nestjs/platform-express": "^9.0.0", + "@nidomiro/ts-type-utils": "^0.1.1", "@ory/keto-client": "^0.10.0-alpha.0", "@ory/keto-grpc-client": "^0.10.0-alpha.0", "assert-never": "^1.2.1", "defekt": "^9.3.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.0.0", - "tslib": "^2.3.0" + "tslib": "^2.4.1" }, "devDependencies": { "@nestjs/schematics": "^9.0.0", diff --git a/packages/typescript/src/lib/relation-tuple-parser.ts b/packages/typescript/src/lib/relation-tuple-parser.ts index 9e2afb0..3acd442 100644 --- a/packages/typescript/src/lib/relation-tuple-parser.ts +++ b/packages/typescript/src/lib/relation-tuple-parser.ts @@ -1,19 +1,19 @@ import { defekt, error, Result, value } from 'defekt' import { RelationTuple, SubjectSet } from './relation-tuple' -import { type ModifyTypeOfAttribute } from './util/type.util' +import { ModifyTypeOfProperty } from '@nidomiro/ts-type-utils' export class RelationTupleSyntaxError extends defekt({ code: 'RelationTupleSyntaxError' }) {} const forbiddenValueCharacters = [':', '#', '@', '(', ')'] -type PartialRelationTuple = ModifyTypeOfAttribute< +type PartialRelationTuple = ModifyTypeOfProperty< Partial, { subjectIdOrSet?: Partial } > -type PartialRelationTupleWithSubjectSet = ModifyTypeOfAttribute< +type PartialRelationTupleWithSubjectSet = ModifyTypeOfProperty< Partial, { subjectIdOrSet: Partial diff --git a/packages/typescript/src/lib/util/type.util.ts b/packages/typescript/src/lib/util/type.util.ts deleted file mode 100644 index b907aaa..0000000 --- a/packages/typescript/src/lib/util/type.util.ts +++ /dev/null @@ -1 +0,0 @@ -export type ModifyTypeOfAttribute = Omit & R