From 369ace01ba43fd94c426568d56c955e78d92adb8 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 26 Apr 2023 12:36:57 -0700 Subject: [PATCH 01/17] stash --- ts/.swcrc | 14 + ts/jest.config.js | 4 +- ts/package-lock.json | 408 ++++- ts/package.json | 4 +- ts/src/graphql/graphql.test.ts | 2005 +++++++++++----------- ts/src/graphql/graphql.ts | 157 +- ts/src/graphql/graphql_custom.test.ts | 926 +++++----- ts/src/imports/dataz/example1/_auth.ts | 5 +- ts/src/imports/dataz/example1/_viewer.ts | 13 +- 9 files changed, 2000 insertions(+), 1536 deletions(-) create mode 100644 ts/.swcrc diff --git a/ts/.swcrc b/ts/.swcrc new file mode 100644 index 000000000..2dc2311e5 --- /dev/null +++ b/ts/.swcrc @@ -0,0 +1,14 @@ +{ + "jsc": { + "parser": { + "syntax": "typescript", + "decorators": true, + "target": "es2020" + }, + "transform": { + "decoratorVersion": "2022-03" + // "legacyDecorator": true, + // "decoratorMetadata": true + } + } +} \ No newline at end of file diff --git a/ts/jest.config.js b/ts/jest.config.js index 7294b0cd4..68b0fac32 100644 --- a/ts/jest.config.js +++ b/ts/jest.config.js @@ -1,8 +1,8 @@ module.exports = { - preset: "ts-jest", + // preset: "ts-jest", testEnvironment: "node", transform: { - "^.+\\.tsx?$": "ts-jest", + "^.+\\.tsx?$": "@swc/jest", }, testRegex: "(/tests/.*|(\\.|/)(test|spec))\\.(tsx?)$", moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], diff --git a/ts/package-lock.json b/ts/package-lock.json index fc535f211..3daeff3a6 100644 --- a/ts/package-lock.json +++ b/ts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@snowtop/ent", - "version": "0.1.0-alpha101", + "version": "0.1.0-alpha119", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@snowtop/ent", - "version": "0.1.0-alpha101", + "version": "0.1.0-alpha119", "license": "MIT", "dependencies": { "@types/node": "^18.11.18", @@ -36,6 +36,8 @@ "ent-custom-graphql": "scripts/custom_graphql.js" }, "devDependencies": { + "@swc/core": "^1.3.53", + "@swc/jest": "^0.2.26", "@types/bcryptjs": "^2.4.2", "@types/better-sqlite3": "^5.4.1", "@types/express": "^4.17.15", @@ -68,7 +70,7 @@ "object-path": "^0.11.8", "pluralize": "^8.0.0", "supertest": "^6.3.3", - "ts-jest": "^29.0.3" + "ts-jest": "^29.1.0" }, "engines": { "node": ">=14.0" @@ -844,6 +846,43 @@ } } }, + "node_modules/@jest/create-cache-key-function": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-27.5.1.tgz", + "integrity": "sha512-dmH1yW+makpTSURTy8VzdUwFnfQh1G8R+DxO2Ho2FFmBbKFEVm+3jWdvFhE2VqB/LATCTokkP0dotjyQyw5/AQ==", + "dev": true, + "dependencies": { + "@jest/types": "^27.5.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/create-cache-key-function/node_modules/@jest/types": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", + "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^16.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@jest/create-cache-key-function/node_modules/@types/yargs": { + "version": "16.0.5", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.5.tgz", + "integrity": "sha512-AxO/ADJOBFJScHbWhq2xAhlWP24rY4aCEG/NFaMvbT3X2MgRsLjhjQwsn0Zi5zn0LG9jUhCCZMeX9Dkuw6k+vQ==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, "node_modules/@jest/environment": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.3.1.tgz", @@ -1169,6 +1208,206 @@ "@sinonjs/commons": "^1.7.0" } }, + "node_modules/@swc/core": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.53.tgz", + "integrity": "sha512-OM5nCfKDZXr1HjxD072Jlx5463tPX7xeY7NDSRE3X4KFlkRDFdyMWAyV3pet1oouOfUNrzzoVTAR4XSU8ytO6Q==", + "devOptional": true, + "hasInstallScript": true, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/swc" + }, + "optionalDependencies": { + "@swc/core-darwin-arm64": "1.3.53", + "@swc/core-darwin-x64": "1.3.53", + "@swc/core-linux-arm-gnueabihf": "1.3.53", + "@swc/core-linux-arm64-gnu": "1.3.53", + "@swc/core-linux-arm64-musl": "1.3.53", + "@swc/core-linux-x64-gnu": "1.3.53", + "@swc/core-linux-x64-musl": "1.3.53", + "@swc/core-win32-arm64-msvc": "1.3.53", + "@swc/core-win32-ia32-msvc": "1.3.53", + "@swc/core-win32-x64-msvc": "1.3.53" + }, + "peerDependencies": { + "@swc/helpers": "^0.5.0" + }, + "peerDependenciesMeta": { + "@swc/helpers": { + "optional": true + } + } + }, + "node_modules/@swc/core-darwin-arm64": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.53.tgz", + "integrity": "sha512-JvWwV/duzdQ60iwWYceDhDk75LmdrLoPC7myX3Src3gl/bJtETMq7uHS9uY8m0GQOqbct7XGR3q5Ff21YxkSzg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-darwin-x64": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.53.tgz", + "integrity": "sha512-UuIGZtCfUPJM2Q01bRIFzmucOMg8UZ+mY3kh5xB8kl/VrLltBlraSWGjjJzYmUeUxiF8+CtMfeSYav5QfU2v3g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm-gnueabihf": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.53.tgz", + "integrity": "sha512-LupAjTErteyLmowYIfiQeTz3uVh7/SPYv/EuG1PYrajNoUYomt7WA0rQUoyglF9VtwVyNqxptWEO5So32ApTHA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-gnu": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.53.tgz", + "integrity": "sha512-kREfZdiJH/O8GtJJ22wVN9DVzz/+CPAkw5Mn5te2KQg0xJHMWaESU5XeYMWvtwyOQVmb31b6zCGFy3pnBWWfGw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-musl": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.53.tgz", + "integrity": "sha512-VeAgomBr6BVuBRjZjRHmvp5gKp1nZgbbd441ca1AvsPd2c+ZyhyHLxTWeHOzBDa/vYnmi9BCwx3QJzFqbAFPVw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-gnu": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.53.tgz", + "integrity": "sha512-LFX5+QpQkESPkmx860C40pIiYf1utEqoA+WDtmKnUz3DucYvw3eGlXCBdyklP7UBWwJktKIcPlIqr7yROY5VlQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-musl": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.53.tgz", + "integrity": "sha512-O0lbJgeaM0VEsG8wFYvpF+Iuf0IENv+LnXHoygkAsv67sVW54+gFxav2sEdkftD5qYe9ku4tmtTVYRZlFgC84Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.53.tgz", + "integrity": "sha512-7PgvPl0aNLaFZSK+rIi4DB1g0aW2qOsTIJQSJGRszsCP8pze/traXymyuSG2I3y9Hx7Z+bP5ycJydyAgCw88WA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-ia32-msvc": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.53.tgz", + "integrity": "sha512-T+OacGm69t8+1mt1sHlwhREiFiFgSeIGL3h11FIs8o2zKnOr5z2H9myzR432X8WuHGVQAOCMvDu53LCMBD0ZzQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-x64-msvc": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.53.tgz", + "integrity": "sha512-uV1/GhROJ/SXzj+f+kKcVtR2GuAiggvbqepzZS46+G47okf6229hr2T1fjmiwYyA75w9R3Bj/wil4UhodohOLg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/jest": { + "version": "0.2.26", + "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.26.tgz", + "integrity": "sha512-7lAi7q7ShTO3E5Gt1Xqf3pIhRbERxR1DUxvtVa9WKzIB+HGQ7wZP5sYx86zqnaEoKKGhmOoZ7gyW0IRu8Br5+A==", + "dev": true, + "dependencies": { + "@jest/create-cache-key-function": "^27.4.2", + "jsonc-parser": "^3.2.0" + }, + "engines": { + "npm": ">= 7.0.0" + }, + "peerDependencies": { + "@swc/core": "*" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -4273,9 +4512,9 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "node_modules/json5": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz", - "integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "bin": { "json5": "lib/cli.js" }, @@ -4283,6 +4522,12 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -5979,15 +6224,15 @@ } }, "node_modules/ts-jest": { - "version": "29.0.3", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.3.tgz", - "integrity": "sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==", + "version": "29.1.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.0.tgz", + "integrity": "sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==", "dev": true, "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", "jest-util": "^29.0.0", - "json5": "^2.2.1", + "json5": "^2.2.3", "lodash.memoize": "4.x", "make-error": "1.x", "semver": "7.x", @@ -6004,7 +6249,7 @@ "@jest/types": "^29.0.0", "babel-jest": "^29.0.0", "jest": "^29.0.0", - "typescript": ">=4.3" + "typescript": ">=4.3 <6" }, "peerDependenciesMeta": { "@babel/core": { @@ -6997,6 +7242,39 @@ "strip-ansi": "^6.0.0" } }, + "@jest/create-cache-key-function": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-27.5.1.tgz", + "integrity": "sha512-dmH1yW+makpTSURTy8VzdUwFnfQh1G8R+DxO2Ho2FFmBbKFEVm+3jWdvFhE2VqB/LATCTokkP0dotjyQyw5/AQ==", + "dev": true, + "requires": { + "@jest/types": "^27.5.1" + }, + "dependencies": { + "@jest/types": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", + "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^16.0.0", + "chalk": "^4.0.0" + } + }, + "@types/yargs": { + "version": "16.0.5", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.5.tgz", + "integrity": "sha512-AxO/ADJOBFJScHbWhq2xAhlWP24rY4aCEG/NFaMvbT3X2MgRsLjhjQwsn0Zi5zn0LG9jUhCCZMeX9Dkuw6k+vQ==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + } + } + }, "@jest/environment": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.3.1.tgz", @@ -7262,6 +7540,94 @@ "@sinonjs/commons": "^1.7.0" } }, + "@swc/core": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.53.tgz", + "integrity": "sha512-OM5nCfKDZXr1HjxD072Jlx5463tPX7xeY7NDSRE3X4KFlkRDFdyMWAyV3pet1oouOfUNrzzoVTAR4XSU8ytO6Q==", + "devOptional": true, + "requires": { + "@swc/core-darwin-arm64": "1.3.53", + "@swc/core-darwin-x64": "1.3.53", + "@swc/core-linux-arm-gnueabihf": "1.3.53", + "@swc/core-linux-arm64-gnu": "1.3.53", + "@swc/core-linux-arm64-musl": "1.3.53", + "@swc/core-linux-x64-gnu": "1.3.53", + "@swc/core-linux-x64-musl": "1.3.53", + "@swc/core-win32-arm64-msvc": "1.3.53", + "@swc/core-win32-ia32-msvc": "1.3.53", + "@swc/core-win32-x64-msvc": "1.3.53" + } + }, + "@swc/core-darwin-arm64": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.53.tgz", + "integrity": "sha512-JvWwV/duzdQ60iwWYceDhDk75LmdrLoPC7myX3Src3gl/bJtETMq7uHS9uY8m0GQOqbct7XGR3q5Ff21YxkSzg==", + "optional": true + }, + "@swc/core-darwin-x64": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.53.tgz", + "integrity": "sha512-UuIGZtCfUPJM2Q01bRIFzmucOMg8UZ+mY3kh5xB8kl/VrLltBlraSWGjjJzYmUeUxiF8+CtMfeSYav5QfU2v3g==", + "optional": true + }, + "@swc/core-linux-arm-gnueabihf": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.53.tgz", + "integrity": "sha512-LupAjTErteyLmowYIfiQeTz3uVh7/SPYv/EuG1PYrajNoUYomt7WA0rQUoyglF9VtwVyNqxptWEO5So32ApTHA==", + "optional": true + }, + "@swc/core-linux-arm64-gnu": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.53.tgz", + "integrity": "sha512-kREfZdiJH/O8GtJJ22wVN9DVzz/+CPAkw5Mn5te2KQg0xJHMWaESU5XeYMWvtwyOQVmb31b6zCGFy3pnBWWfGw==", + "optional": true + }, + "@swc/core-linux-arm64-musl": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.53.tgz", + "integrity": "sha512-VeAgomBr6BVuBRjZjRHmvp5gKp1nZgbbd441ca1AvsPd2c+ZyhyHLxTWeHOzBDa/vYnmi9BCwx3QJzFqbAFPVw==", + "optional": true + }, + "@swc/core-linux-x64-gnu": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.53.tgz", + "integrity": "sha512-LFX5+QpQkESPkmx860C40pIiYf1utEqoA+WDtmKnUz3DucYvw3eGlXCBdyklP7UBWwJktKIcPlIqr7yROY5VlQ==", + "optional": true + }, + "@swc/core-linux-x64-musl": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.53.tgz", + "integrity": "sha512-O0lbJgeaM0VEsG8wFYvpF+Iuf0IENv+LnXHoygkAsv67sVW54+gFxav2sEdkftD5qYe9ku4tmtTVYRZlFgC84Q==", + "optional": true + }, + "@swc/core-win32-arm64-msvc": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.53.tgz", + "integrity": "sha512-7PgvPl0aNLaFZSK+rIi4DB1g0aW2qOsTIJQSJGRszsCP8pze/traXymyuSG2I3y9Hx7Z+bP5ycJydyAgCw88WA==", + "optional": true + }, + "@swc/core-win32-ia32-msvc": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.53.tgz", + "integrity": "sha512-T+OacGm69t8+1mt1sHlwhREiFiFgSeIGL3h11FIs8o2zKnOr5z2H9myzR432X8WuHGVQAOCMvDu53LCMBD0ZzQ==", + "optional": true + }, + "@swc/core-win32-x64-msvc": { + "version": "1.3.53", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.53.tgz", + "integrity": "sha512-uV1/GhROJ/SXzj+f+kKcVtR2GuAiggvbqepzZS46+G47okf6229hr2T1fjmiwYyA75w9R3Bj/wil4UhodohOLg==", + "optional": true + }, + "@swc/jest": { + "version": "0.2.26", + "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.26.tgz", + "integrity": "sha512-7lAi7q7ShTO3E5Gt1Xqf3pIhRbERxR1DUxvtVa9WKzIB+HGQ7wZP5sYx86zqnaEoKKGhmOoZ7gyW0IRu8Br5+A==", + "dev": true, + "requires": { + "@jest/create-cache-key-function": "^27.4.2", + "jsonc-parser": "^3.2.0" + } + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -9745,9 +10111,15 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "json5": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.2.tgz", - "integrity": "sha512-46Tk9JiOL2z7ytNQWFLpj99RZkVgeHf87yGQKsIkaPz1qSH9UczKH1rO7K3wgRselo0tYMUNfecYpm/p1vC7tQ==" + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" + }, + "jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true }, "kleur": { "version": "3.0.3", @@ -11060,15 +11432,15 @@ "dev": true }, "ts-jest": { - "version": "29.0.3", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.3.tgz", - "integrity": "sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==", + "version": "29.1.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.0.tgz", + "integrity": "sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==", "dev": true, "requires": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", "jest-util": "^29.0.0", - "json5": "^2.2.1", + "json5": "^2.2.3", "lodash.memoize": "4.x", "make-error": "1.x", "semver": "7.x", diff --git a/ts/package.json b/ts/package.json index 55a922863..1939c20e2 100644 --- a/ts/package.json +++ b/ts/package.json @@ -43,6 +43,8 @@ "node": ">=14.0" }, "devDependencies": { + "@swc/core": "^1.3.53", + "@swc/jest": "^0.2.26", "@types/bcryptjs": "^2.4.2", "@types/better-sqlite3": "^5.4.1", "@types/express": "^4.17.15", @@ -75,7 +77,7 @@ "object-path": "^0.11.8", "pluralize": "^8.0.0", "supertest": "^6.3.3", - "ts-jest": "^29.0.3" + "ts-jest": "^29.1.0" }, "scripts": { "compile": "tsc", diff --git a/ts/src/graphql/graphql.test.ts b/ts/src/graphql/graphql.test.ts index 88d7482f7..e5e8e428f 100644 --- a/ts/src/graphql/graphql.test.ts +++ b/ts/src/graphql/graphql.test.ts @@ -5,6 +5,8 @@ import { gqlArgType, CustomFieldType, gqlConnection, + gqlObjectType, + gqlObjectWithFields, } from "./graphql"; import { GraphQLInt, @@ -28,482 +30,482 @@ beforeEach(() => { GQLCapture.enable(true); }); -describe("accessor", () => { - test("disabled", () => { - GQLCapture.enable(false); - class User { - @gqlField() - get fullName(): string { - return "fullName"; - } - } - validateNoCustom(); - }); - - test("enabled. string", () => { - class User { - @gqlField() - get fullName(): string { - return "fullName"; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "fullName", - gqlName: "fullName", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "String", - name: "", - tsType: "string", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. nullable string", () => { - class User { - @gqlField({ - type: GraphQLString, - nullable: true, - description: "first + last name", - }) - // boo when it's nullable, we need to indicate type and nullable: true - get fullName(): string | null { - return "fullName"; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "fullName", - gqlName: "fullName", - fieldType: CustomFieldType.Accessor, - description: "first + last name", - results: [ - { - type: "String", - name: "", - nullable: true, - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. int", () => { - class User { - @gqlField({ type: GraphQLInt }) - get age(): number { - return 3.2; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "age", - gqlName: "age", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "Int", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. float", () => { - class User { - @gqlField({ type: GraphQLFloat }) - get age(): number { - return 3.2; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "age", - gqlName: "age", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "Float", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. returns float with implicit number", () => { - class User { - @gqlField({ type: GraphQLFloat }) - get age() { - return 3.2; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "age", - gqlName: "age", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "Float", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. returns int with implicit number", () => { - class User { - @gqlField({ type: GraphQLInt }) - get age() { - return 3.2; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "age", - gqlName: "age", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "Int", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. throws with number and no type", () => { - try { - class User { - @gqlField() - get age(): number { - return 3.2; - } - } - throw new Error("should not get here"); - } catch (e) { - expect(e.message).toMatch(/^type is required (.)+/); - } - validateNoCustom(); - }); - - test("enabled. throws with implicit type and no passed in type", () => { - try { - class User { - @gqlField() - get age() { - return 3.2; - } - } - throw new Error("should not get here"); - } catch (e) { - expect(e.message).toMatch(/^type is required (.)+/); - } - validateNoCustom(); - }); - - test("enabled. list of strings", () => { - class User { - @gqlField({ type: [String] }) - get names(): string[] { - return ["firstName", "lastName", "fullName"]; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "names", - gqlName: "names", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "String", - list: true, - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. list of strings", () => { - class User { - @gqlField({ type: [String] }) - get names(): string[] { - return ["firstName", "lastName", "fullName"]; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "names", - gqlName: "names", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "String", - list: true, - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. nullable list of strings", () => { - class User { - @gqlField({ type: [String], nullable: true }) - get names(): string[] | null { - return null; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "names", - gqlName: "names", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "String", - list: true, - nullable: true, - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. nullable contents of strings", () => { - class User { - @gqlField({ type: [String], nullable: "contents" }) - get names(): (string | null)[] { - return ["firstName", "lastName", "fullName", null]; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "names", - gqlName: "names", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "String", - list: true, - name: "", - nullable: "contents", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. nullable contents and list of strings", () => { - class User { - // all nullable - @gqlField({ type: [String], nullable: "contentsAndList" }) - get names(): (string | null)[] | null { - return null; - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "names", - gqlName: "names", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "String", - list: true, - name: "", - nullable: "contentsAndList", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); -}); - -describe("property", () => { - test("disabled", () => { - GQLCapture.enable(false); - class User { - @gqlField() - fullName: string; - } - validateNoCustom(); - }); - - test("enabled. string", () => { - class User { - @gqlField() - fullName: string; - } - validateOneCustomField({ - nodeName: "User", - functionName: "fullName", - gqlName: "fullName", - fieldType: CustomFieldType.Field, - results: [ - { - type: "String", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. int", () => { - class User { - @gqlField({ type: GraphQLInt }) - age: number; - } - validateOneCustomField({ - nodeName: "User", - functionName: "age", - gqlName: "age", - fieldType: CustomFieldType.Field, - results: [ - { - type: "Int", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. float", () => { - class User { - @gqlField({ type: GraphQLFloat }) - age: number; - } - validateOneCustomField({ - nodeName: "User", - functionName: "age", - gqlName: "age", - fieldType: CustomFieldType.Field, - results: [ - { - type: "Float", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. with implicit type. explicit graphql type", () => { - class User { - @gqlField({ type: GraphQLFloat }) - // lol but why? - age; - } - validateOneCustomField({ - nodeName: "User", - functionName: "age", - gqlName: "age", - fieldType: CustomFieldType.Field, - results: [ - { - type: "Float", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. with implicit type. no graphql type", () => { - try { - class User { - @gqlField() - // lol but why? - age; - } - throw new Error("should not have gotten here"); - } catch (e) { - expect(e.message).toMatch(/^type is required (.)+/); - } - validateNoCustom(); - }); - - test("enabled. custom scalar", () => { - class Point { - constructor(private x: number, private y: number) {} - - serialize(): string { - return `${this.x},${this.y}`; - } - } - - const GraphQLPoint = new GraphQLScalarType({ - name: "Point", - description: "Point scalar type", - serialize: (outputValue: Point) => { - return outputValue.serialize(); - }, - parseValue: (input: any) => { - if (typeof input !== "string") { - throw new GraphQLError(`invalid input value ${input}`); - } - const parts = input.split(","); - if (parts.length !== 2) { - throw new GraphQLError(`invalid input value ${input}`); - } - return new Point(parseInt(parts[0], 10), parseInt(parts[1], 10)); - }, - parseLiteral: (ast: ValueNode) => { - if (ast.kind === Kind.STRING) { - const parts = ast.value.split(","); - if (parts.length !== 2) { - throw new GraphQLError(`invalid input value ${ast.value}`); - } - return new Point(parseInt(parts[0], 10), parseInt(parts[1], 10)); - } - throw new GraphQLError(`Time cannot represent literal value ${ast}`); - }, - }); - - try { - class User { - @gqlField({ type: GraphQLPoint }) - point: Point; - } - throw new Error("should not get here"); - } catch (e) { - expect(e.message).toMatch( - /custom scalar type Point is not supported this way. use CustomType syntax/, - ); - } - - validateNoCustom(); - }); -}); +// describe("accessor", () => { +// test.only("disabled", () => { +// GQLCapture.enable(false); +// class User { +// @gqlField() +// get fullName(): string { +// return "fullName"; +// } +// } +// validateNoCustom(); +// }); + +// test("enabled. string", () => { +// class User { +// @gqlField() +// get fullName(): string { +// return "fullName"; +// } +// } + +// validateOneCustomField({ +// nodeName: "User", +// functionName: "fullName", +// gqlName: "fullName", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "String", +// name: "", +// tsType: "string", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. nullable string", () => { +// class User { +// @gqlField({ +// type: GraphQLString, +// nullable: true, +// description: "first + last name", +// }) +// // boo when it's nullable, we need to indicate type and nullable: true +// get fullName(): string | null { +// return "fullName"; +// } +// } + +// validateOneCustomField({ +// nodeName: "User", +// functionName: "fullName", +// gqlName: "fullName", +// fieldType: CustomFieldType.Accessor, +// description: "first + last name", +// results: [ +// { +// type: "String", +// name: "", +// nullable: true, +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. int", () => { +// class User { +// @gqlField({ type: GraphQLInt }) +// get age(): number { +// return 3.2; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "age", +// gqlName: "age", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "Int", +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. float", () => { +// class User { +// @gqlField({ type: GraphQLFloat }) +// get age(): number { +// return 3.2; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "age", +// gqlName: "age", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "Float", +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. returns float with implicit number", () => { +// class User { +// @gqlField({ type: GraphQLFloat }) +// get age() { +// return 3.2; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "age", +// gqlName: "age", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "Float", +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. returns int with implicit number", () => { +// class User { +// @gqlField({ type: GraphQLInt }) +// get age() { +// return 3.2; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "age", +// gqlName: "age", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "Int", +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. throws with number and no type", () => { +// try { +// class User { +// @gqlField() +// get age(): number { +// return 3.2; +// } +// } +// throw new Error("should not get here"); +// } catch (e) { +// expect(e.message).toMatch(/^type is required (.)+/); +// } +// validateNoCustom(); +// }); + +// test("enabled. throws with implicit type and no passed in type", () => { +// try { +// class User { +// @gqlField() +// get age() { +// return 3.2; +// } +// } +// throw new Error("should not get here"); +// } catch (e) { +// expect(e.message).toMatch(/^type is required (.)+/); +// } +// validateNoCustom(); +// }); + +// test("enabled. list of strings", () => { +// class User { +// @gqlField({ type: [String] }) +// get names(): string[] { +// return ["firstName", "lastName", "fullName"]; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "names", +// gqlName: "names", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "String", +// list: true, +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. list of strings", () => { +// class User { +// @gqlField({ type: [String] }) +// get names(): string[] { +// return ["firstName", "lastName", "fullName"]; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "names", +// gqlName: "names", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "String", +// list: true, +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. nullable list of strings", () => { +// class User { +// @gqlField({ type: [String], nullable: true }) +// get names(): string[] | null { +// return null; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "names", +// gqlName: "names", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "String", +// list: true, +// nullable: true, +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. nullable contents of strings", () => { +// class User { +// @gqlField({ type: [String], nullable: "contents" }) +// get names(): (string | null)[] { +// return ["firstName", "lastName", "fullName", null]; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "names", +// gqlName: "names", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "String", +// list: true, +// name: "", +// nullable: "contents", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. nullable contents and list of strings", () => { +// class User { +// // all nullable +// @gqlField({ type: [String], nullable: "contentsAndList" }) +// get names(): (string | null)[] | null { +// return null; +// } +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "names", +// gqlName: "names", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "String", +// list: true, +// name: "", +// nullable: "contentsAndList", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); +// }); + +// describe("property", () => { +// test.only("disabled", () => { +// GQLCapture.enable(false); +// class User { +// @gqlField() +// fullName: string; +// } +// validateNoCustom(); +// }); + +// test("enabled. string", () => { +// class User { +// @gqlField() +// fullName: string; +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "fullName", +// gqlName: "fullName", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "String", +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. int", () => { +// class User { +// @gqlField({ type: GraphQLInt }) +// age: number; +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "age", +// gqlName: "age", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "Int", +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. float", () => { +// class User { +// @gqlField({ type: GraphQLFloat }) +// age: number; +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "age", +// gqlName: "age", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "Float", +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. with implicit type. explicit graphql type", () => { +// class User { +// @gqlField({ type: GraphQLFloat }) +// // lol but why? +// age; +// } +// validateOneCustomField({ +// nodeName: "User", +// functionName: "age", +// gqlName: "age", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "Float", +// name: "", +// }, +// ], +// args: [], +// }); +// validateNoCustom(CustomObjectTypes.Field); +// }); + +// test("enabled. with implicit type. no graphql type", () => { +// try { +// class User { +// @gqlField() +// // lol but why? +// age; +// } +// throw new Error("should not have gotten here"); +// } catch (e) { +// expect(e.message).toMatch(/^type is required (.)+/); +// } +// validateNoCustom(); +// }); + +// test("enabled. custom scalar", () => { +// class Point { +// constructor(private x: number, private y: number) {} + +// serialize(): string { +// return `${this.x},${this.y}`; +// } +// } + +// const GraphQLPoint = new GraphQLScalarType({ +// name: "Point", +// description: "Point scalar type", +// serialize: (outputValue: Point) => { +// return outputValue.serialize(); +// }, +// parseValue: (input: any) => { +// if (typeof input !== "string") { +// throw new GraphQLError(`invalid input value ${input}`); +// } +// const parts = input.split(","); +// if (parts.length !== 2) { +// throw new GraphQLError(`invalid input value ${input}`); +// } +// return new Point(parseInt(parts[0], 10), parseInt(parts[1], 10)); +// }, +// parseLiteral: (ast: ValueNode) => { +// if (ast.kind === Kind.STRING) { +// const parts = ast.value.split(","); +// if (parts.length !== 2) { +// throw new GraphQLError(`invalid input value ${ast.value}`); +// } +// return new Point(parseInt(parts[0], 10), parseInt(parts[1], 10)); +// } +// throw new GraphQLError(`Time cannot represent literal value ${ast}`); +// }, +// }); + +// try { +// class User { +// @gqlField({ type: GraphQLPoint }) +// point: Point; +// } +// throw new Error("should not get here"); +// } catch (e) { +// expect(e.message).toMatch( +// /custom scalar type Point is not supported this way. use CustomType syntax/, +// ); +// } + +// validateNoCustom(); +// }); +// }); describe("function", () => { test("disabled", () => { @@ -517,7 +519,8 @@ describe("function", () => { validateNoCustom(); }); - test("enabled, returns string", () => { + test.only("enabled, returns string", () => { + @gqlObjectWithFields() class User { @gqlField() username(): string { @@ -541,528 +544,528 @@ describe("function", () => { validateNoCustom(CustomObjectTypes.Field); }); - test("enabled, returns int", () => { - class User { - @gqlField({ type: GraphQLInt }) - age(): number { - return 32; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "age", - gqlName: "age", - fieldType: CustomFieldType.Function, - results: [ - { - type: "Int", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled, returns float", () => { - class User { - @gqlField({ type: GraphQLFloat }) - pi(): number { - return 3.14; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "pi", - gqlName: "pi", - fieldType: CustomFieldType.Function, - results: [ - { - type: "Float", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled, returns float for implicit return type", () => { - class User { - @gqlField({ type: GraphQLFloat }) - pi() { - return 3.14; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "pi", - gqlName: "pi", - fieldType: CustomFieldType.Function, - results: [ - { - type: "Float", - name: "", - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled, throws for implicit return type", () => { - try { - class User { - @gqlField() - pi() { - return 3.14; - } - } - } catch (err) { - expect(err.message).toMatch(/^Function isn't a valid type/); - } - validateNoCustom(); - }); - - test("enabled, one param", () => { - class User { - @gqlField({ type: GraphQLInt }) - add(@gqlArg("base", { type: GraphQLInt }) base: number): number { - return 1 + base; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "add", - gqlName: "add", - fieldType: CustomFieldType.Function, - results: [ - { - type: "Int", - name: "", - }, - ], - args: [ - { - type: "Int", - name: "base", - }, - ], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled, multiple param", () => { - class User { - @gqlField() - find( - @gqlArg("pos", { type: GraphQLInt }) pos: number, - @gqlArg("cursor") cursor: string, - ): string { - return `${cursor}:${pos}`; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "find", - gqlName: "find", - fieldType: CustomFieldType.Function, - results: [ - { - type: "String", - name: "", - }, - ], - args: [ - { - type: "Int", - name: "pos", - }, - { - type: "String", - name: "cursor", - }, - ], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled, nullable arg", () => { - class User { - @gqlField({ name: "find" }) - findFromPos( - @gqlArg("pos", { type: GraphQLInt, nullable: true }) - pos: number, - ): string { - return `${pos}`; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "findFromPos", - gqlName: "find", - fieldType: CustomFieldType.Function, - results: [ - { - type: "String", - name: "", - }, - ], - args: [ - { - type: "Int", - name: "pos", - nullable: true, - }, - ], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled, no arg decorator", () => { - try { - class User { - @gqlField() - find(pos: number, @gqlArg("cursor") cursor: string): string { - return `${cursor}:${pos}`; - } - } - throw new Error("should not get here"); - } catch (e) { - expect(e.message).toMatch(/^args were not captured correctly/); - } - validateNoCustom(); - }); - - test("enabled. arg class", () => { - // TODO need to ensure no params for these since not valid graphql i believe - @gqlArgType() - class SearchArgs { - @gqlField() - startCursor: string; - - @gqlField({ type: GraphQLInt }) - start: number; - - @gqlField({ type: GraphQLInt, nullable: true }) - end: number; - } - class User { - // search to return count - // TODO need - @gqlField({ type: GraphQLInt }) - search(@gqlArg("searchArgs") arg: SearchArgs): number { - return 0; - } - } - - validateCustomFields([ - { - nodeName: "SearchArgs", - functionName: "startCursor", - gqlName: "startCursor", - fieldType: CustomFieldType.Field, - results: [ - { - type: "String", - name: "", - }, - ], - args: [], - }, - { - nodeName: "SearchArgs", - functionName: "start", - gqlName: "start", - fieldType: CustomFieldType.Field, - - results: [ - { - type: "Int", - name: "", - }, - ], - args: [], - }, - { - nodeName: "SearchArgs", - functionName: "end", - gqlName: "end", - fieldType: CustomFieldType.Field, - - results: [ - { - type: "Int", - name: "", - nullable: true, - }, - ], - args: [], - }, - { - nodeName: "User", - functionName: "search", - gqlName: "search", - fieldType: CustomFieldType.Function, - args: [ - { - type: "SearchArgs", - name: "searchArgs", - needsResolving: true, // TODO do we still need this? - }, - ], - results: [ - { - type: "Int", - name: "", - }, - ], - }, - ]); - validateCustomArgs([ - { - nodeName: "SearchArgs", - className: "SearchArgs", - }, - ]); - validateNoCustom(CustomObjectTypes.Field, CustomObjectTypes.Arg); - }); - - test("enabled. referencing non-arg class", () => { - try { - class SearchArgs { - startCursor: string; - - start: number; - - end: number; - } - class User { - @gqlField({ type: GraphQLInt }) - search(@gqlArg("searchArgs") arg: SearchArgs): number { - return 0; - } - } - GQLCapture.resolve([]); - throw new Error("should throw"); - } catch (error) { - // TODO need a better message here - expect(error.message).toMatch( - /arg searchArgs of field search needs resolving. should not be possible/, - ); - } - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. resolve return types", () => { - // graphql object - class Contact {} - - class User { - @gqlField({ type: Contact }) - selfContact(): Contact { - return new Contact(); - } - } - - expect(GQLCapture.getCustomArgs().size).toBe(0); - expect(GQLCapture.getCustomFields().size).toBe(1); - // no errors! - GQLCapture.resolve(["User", "Contact"]); - }); - - test("enabled. resolve return types", () => { - // graphql object - class Contact {} - - class User { - @gqlField({ type: Contact }) - selfContact(): Contact { - return new Contact(); - } - } - - validateNoCustom(CustomObjectTypes.Field); - try { - GQLCapture.resolve(["User"]); - throw new Error("shouldn't get here"); - } catch (error) { - expect(error.message).toMatch(/^field selfContact references Contact/); - } - }); - - test("enabled. async response", () => { - try { - class User { - @gqlField({}) - async load(): Promise { - return new User(); - } - } - throw new Error("shouldn't have gotten here"); - } catch (e) { - expect(e.message).toMatch(/^Promise isn't a valid type/); - } - validateNoCustom(); - }); - - test("enabled. async response with type hint", () => { - class User { - @gqlField({ type: User, name: "self" }) - async loadSelf(): Promise { - return new User(); - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "loadSelf", - gqlName: "self", - fieldType: CustomFieldType.AsyncFunction, - results: [ - { - type: "User", - name: "", - needsResolving: true, - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. implied async response with type hint", () => { - class User { - @gqlField({ type: User, name: "self" }) - async loadSelf() { - return new User(); - } - } - validateOneCustomField({ - nodeName: "User", - functionName: "loadSelf", - gqlName: "self", - fieldType: CustomFieldType.AsyncFunction, - results: [ - { - type: "User", - name: "", - needsResolving: true, - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. object type string because 'circular dependencies'", () => { - class User { - @gqlField({ type: "User", name: "self" }) - async loadSelf() { - return new User(); - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "loadSelf", - gqlName: "self", - fieldType: CustomFieldType.AsyncFunction, - results: [ - { - type: "User", - name: "", - needsResolving: true, - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("enabled. object type string list because 'circular dependencies'", () => { - class User { - @gqlField({ type: "[User]", name: "self" }) - async loadSelf() { - return [new User()]; - } - } - - validateOneCustomField({ - nodeName: "User", - functionName: "loadSelf", - gqlName: "self", - fieldType: CustomFieldType.AsyncFunction, - results: [ - { - type: "User", - name: "", - list: true, - needsResolving: true, - }, - ], - args: [], - }); - validateNoCustom(CustomObjectTypes.Field); - }); - - test("connection", async () => { - class User { - @gqlField({ - type: gqlConnection("User"), - name: "userToSelves", - }) - loadSelves() { - // ignore - return [new User()]; - } - } - - validateCustomFields([ - { - nodeName: "User", - functionName: "loadSelves", - gqlName: "userToSelves", - fieldType: CustomFieldType.Function, - results: [ - { - type: "User", - name: "", - connection: true, - needsResolving: true, - }, - ], - args: [], - }, - ]); - - validateNoCustom(CustomObjectTypes.Field); - }); - - test("connection with async", async () => { - try { - class User { - @gqlField({ - type: gqlConnection("User"), - name: "userToSelves", - }) - async loadSelves() { - // ignore - return [new User()]; - } - } - throw new Error("should have thrown"); - } catch (e) { - expect(e.message).toBe( - "async function not currently supported for GraphQLConnection", - ); - } - - validateNoCustom(); - }); + // test("enabled, returns int", () => { + // class User { + // @gqlField({ type: GraphQLInt }) + // age(): number { + // return 32; + // } + // } + + // validateOneCustomField({ + // nodeName: "User", + // functionName: "age", + // gqlName: "age", + // fieldType: CustomFieldType.Function, + // results: [ + // { + // type: "Int", + // name: "", + // }, + // ], + // args: [], + // }); + // validateNoCustom(CustomObjectTypes.Field); + // }); + + // test("enabled, returns float", () => { + // class User { + // @gqlField({ type: GraphQLFloat }) + // pi(): number { + // return 3.14; + // } + // } + + // validateOneCustomField({ + // nodeName: "User", + // functionName: "pi", + // gqlName: "pi", + // fieldType: CustomFieldType.Function, + // results: [ + // { + // type: "Float", + // name: "", + // }, + // ], + // args: [], + // }); + // validateNoCustom(CustomObjectTypes.Field); + // }); + + // test("enabled, returns float for implicit return type", () => { + // class User { + // @gqlField({ type: GraphQLFloat }) + // pi() { + // return 3.14; + // } + // } + + // validateOneCustomField({ + // nodeName: "User", + // functionName: "pi", + // gqlName: "pi", + // fieldType: CustomFieldType.Function, + // results: [ + // { + // type: "Float", + // name: "", + // }, + // ], + // args: [], + // }); + // validateNoCustom(CustomObjectTypes.Field); + // }); + + // test("enabled, throws for implicit return type", () => { + // try { + // class User { + // @gqlField() + // pi() { + // return 3.14; + // } + // } + // } catch (err) { + // expect(err.message).toMatch(/^Function isn't a valid type/); + // } + // validateNoCustom(); + // }); + + // // test("enabled, one param", () => { + // // class User { + // // @gqlField({ type: GraphQLInt }) + // // add(@gqlArg("base", { type: GraphQLInt }) base: number): number { + // // return 1 + base; + // // } + // // } + + // // validateOneCustomField({ + // // nodeName: "User", + // // functionName: "add", + // // gqlName: "add", + // // fieldType: CustomFieldType.Function, + // // results: [ + // // { + // // type: "Int", + // // name: "", + // // }, + // // ], + // // args: [ + // // { + // // type: "Int", + // // name: "base", + // // }, + // // ], + // // }); + // // validateNoCustom(CustomObjectTypes.Field); + // // }); + + // // test("enabled, multiple param", () => { + // // class User { + // // @gqlField() + // // find( + // // @gqlArg("pos", { type: GraphQLInt }) pos: number, + // // @gqlArg("cursor") cursor: string, + // // ): string { + // // return `${cursor}:${pos}`; + // // } + // // } + + // // validateOneCustomField({ + // // nodeName: "User", + // // functionName: "find", + // // gqlName: "find", + // // fieldType: CustomFieldType.Function, + // // results: [ + // // { + // // type: "String", + // // name: "", + // // }, + // // ], + // // args: [ + // // { + // // type: "Int", + // // name: "pos", + // // }, + // // { + // // type: "String", + // // name: "cursor", + // // }, + // // ], + // // }); + // // validateNoCustom(CustomObjectTypes.Field); + // // }); + + // // test("enabled, nullable arg", () => { + // // class User { + // // @gqlField({ name: "find" }) + // // findFromPos( + // // @gqlArg("pos", { type: GraphQLInt, nullable: true }) + // // pos: number, + // // ): string { + // // return `${pos}`; + // // } + // // } + + // // validateOneCustomField({ + // // nodeName: "User", + // // functionName: "findFromPos", + // // gqlName: "find", + // // fieldType: CustomFieldType.Function, + // // results: [ + // // { + // // type: "String", + // // name: "", + // // }, + // // ], + // // args: [ + // // { + // // type: "Int", + // // name: "pos", + // // nullable: true, + // // }, + // // ], + // // }); + // // validateNoCustom(CustomObjectTypes.Field); + // // }); + + // // test("enabled, no arg decorator", () => { + // // try { + // // class User { + // // @gqlField() + // // find(pos: number, @gqlArg("cursor") cursor: string): string { + // // return `${cursor}:${pos}`; + // // } + // // } + // // throw new Error("should not get here"); + // // } catch (e) { + // // expect(e.message).toMatch(/^args were not captured correctly/); + // // } + // // validateNoCustom(); + // // }); + + // // test("enabled. arg class", () => { + // // // TODO need to ensure no params for these since not valid graphql i believe + // // @gqlArgType() + // // class SearchArgs { + // // @gqlField() + // // startCursor: string; + + // // @gqlField({ type: GraphQLInt }) + // // start: number; + + // // @gqlField({ type: GraphQLInt, nullable: true }) + // // end: number; + // // } + // // class User { + // // // search to return count + // // // TODO need + // // @gqlField({ type: GraphQLInt }) + // // search(@gqlArg("searchArgs") arg: SearchArgs): number { + // // return 0; + // // } + // // } + + // // validateCustomFields([ + // // { + // // nodeName: "SearchArgs", + // // functionName: "startCursor", + // // gqlName: "startCursor", + // // fieldType: CustomFieldType.Field, + // // results: [ + // // { + // // type: "String", + // // name: "", + // // }, + // // ], + // // args: [], + // // }, + // // { + // // nodeName: "SearchArgs", + // // functionName: "start", + // // gqlName: "start", + // // fieldType: CustomFieldType.Field, + + // // results: [ + // // { + // // type: "Int", + // // name: "", + // // }, + // // ], + // // args: [], + // // }, + // // { + // // nodeName: "SearchArgs", + // // functionName: "end", + // // gqlName: "end", + // // fieldType: CustomFieldType.Field, + + // // results: [ + // // { + // // type: "Int", + // // name: "", + // // nullable: true, + // // }, + // // ], + // // args: [], + // // }, + // // { + // // nodeName: "User", + // // functionName: "search", + // // gqlName: "search", + // // fieldType: CustomFieldType.Function, + // // args: [ + // // { + // // type: "SearchArgs", + // // name: "searchArgs", + // // needsResolving: true, // TODO do we still need this? + // // }, + // // ], + // // results: [ + // // { + // // type: "Int", + // // name: "", + // // }, + // // ], + // // }, + // // ]); + // // validateCustomArgs([ + // // { + // // nodeName: "SearchArgs", + // // className: "SearchArgs", + // // }, + // // ]); + // // validateNoCustom(CustomObjectTypes.Field, CustomObjectTypes.Arg); + // // }); + + // // test("enabled. referencing non-arg class", () => { + // // try { + // // class SearchArgs { + // // startCursor: string; + + // // start: number; + + // // end: number; + // // } + // // class User { + // // @gqlField({ type: GraphQLInt }) + // // search(@gqlArg("searchArgs") arg: SearchArgs): number { + // // return 0; + // // } + // // } + // // GQLCapture.resolve([]); + // // throw new Error("should throw"); + // // } catch (error) { + // // // TODO need a better message here + // // expect(error.message).toMatch( + // // /arg searchArgs of field search needs resolving. should not be possible/, + // // ); + // // } + // // validateNoCustom(CustomObjectTypes.Field); + // // }); + + // test("enabled. resolve return types", () => { + // // graphql object + // class Contact {} + + // class User { + // @gqlField({ type: Contact }) + // selfContact(): Contact { + // return new Contact(); + // } + // } + + // expect(GQLCapture.getCustomArgs().size).toBe(0); + // expect(GQLCapture.getCustomFields().size).toBe(1); + // // no errors! + // GQLCapture.resolve(["User", "Contact"]); + // }); + + // test("enabled. resolve return types", () => { + // // graphql object + // class Contact {} + + // class User { + // @gqlField({ type: Contact }) + // selfContact(): Contact { + // return new Contact(); + // } + // } + + // validateNoCustom(CustomObjectTypes.Field); + // try { + // GQLCapture.resolve(["User"]); + // throw new Error("shouldn't get here"); + // } catch (error) { + // expect(error.message).toMatch(/^field selfContact references Contact/); + // } + // }); + + // test("enabled. async response", () => { + // try { + // class User { + // @gqlField({}) + // async load(): Promise { + // return new User(); + // } + // } + // throw new Error("shouldn't have gotten here"); + // } catch (e) { + // expect(e.message).toMatch(/^Promise isn't a valid type/); + // } + // validateNoCustom(); + // }); + + // test("enabled. async response with type hint", () => { + // class User { + // @gqlField({ type: User, name: "self" }) + // async loadSelf(): Promise { + // return new User(); + // } + // } + // validateOneCustomField({ + // nodeName: "User", + // functionName: "loadSelf", + // gqlName: "self", + // fieldType: CustomFieldType.AsyncFunction, + // results: [ + // { + // type: "User", + // name: "", + // needsResolving: true, + // }, + // ], + // args: [], + // }); + // validateNoCustom(CustomObjectTypes.Field); + // }); + + // test("enabled. implied async response with type hint", () => { + // class User { + // @gqlField({ type: User, name: "self" }) + // async loadSelf() { + // return new User(); + // } + // } + // validateOneCustomField({ + // nodeName: "User", + // functionName: "loadSelf", + // gqlName: "self", + // fieldType: CustomFieldType.AsyncFunction, + // results: [ + // { + // type: "User", + // name: "", + // needsResolving: true, + // }, + // ], + // args: [], + // }); + // validateNoCustom(CustomObjectTypes.Field); + // }); + + // test("enabled. object type string because 'circular dependencies'", () => { + // class User { + // @gqlField({ type: "User", name: "self" }) + // async loadSelf() { + // return new User(); + // } + // } + + // validateOneCustomField({ + // nodeName: "User", + // functionName: "loadSelf", + // gqlName: "self", + // fieldType: CustomFieldType.AsyncFunction, + // results: [ + // { + // type: "User", + // name: "", + // needsResolving: true, + // }, + // ], + // args: [], + // }); + // validateNoCustom(CustomObjectTypes.Field); + // }); + + // test("enabled. object type string list because 'circular dependencies'", () => { + // class User { + // @gqlField({ type: "[User]", name: "self" }) + // async loadSelf() { + // return [new User()]; + // } + // } + + // validateOneCustomField({ + // nodeName: "User", + // functionName: "loadSelf", + // gqlName: "self", + // fieldType: CustomFieldType.AsyncFunction, + // results: [ + // { + // type: "User", + // name: "", + // list: true, + // needsResolving: true, + // }, + // ], + // args: [], + // }); + // validateNoCustom(CustomObjectTypes.Field); + // }); + + // test("connection", async () => { + // class User { + // @gqlField({ + // type: gqlConnection("User"), + // name: "userToSelves", + // }) + // loadSelves() { + // // ignore + // return [new User()]; + // } + // } + + // validateCustomFields([ + // { + // nodeName: "User", + // functionName: "loadSelves", + // gqlName: "userToSelves", + // fieldType: CustomFieldType.Function, + // results: [ + // { + // type: "User", + // name: "", + // connection: true, + // needsResolving: true, + // }, + // ], + // args: [], + // }, + // ]); + + // validateNoCustom(CustomObjectTypes.Field); + // }); + + // test("connection with async", async () => { + // try { + // class User { + // @gqlField({ + // type: gqlConnection("User"), + // name: "userToSelves", + // }) + // async loadSelves() { + // // ignore + // return [new User()]; + // } + // } + // throw new Error("should have thrown"); + // } catch (e) { + // expect(e.message).toBe( + // "async function not currently supported for GraphQLConnection", + // ); + // } + + // validateNoCustom(); + // }); }); diff --git a/ts/src/graphql/graphql.ts b/ts/src/graphql/graphql.ts index a37736042..c8740a05a 100644 --- a/ts/src/graphql/graphql.ts +++ b/ts/src/graphql/graphql.ts @@ -452,55 +452,127 @@ export class GQLCapture { return result; } - static gqlField(options?: gqlFieldOptions): any { - return function ( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - ): void { - if (!GQLCapture.isEnabled()) { + // ToDO this doesn't work... + static gqlObjectWithFields() { + return function (val, ctx: ClassDecoratorContext) { + if (!GQLCapture.isEnabled() || ctx.kind !== "class") { return; } + console.log("gsfsf", val.prototype); + + let typeMetadata: metadataIsh | null = Reflect.getMetadata( + "design:type", + val.prototype, + "username", + // "method", + // ctx.name, + ); - let customField = GQLCapture.getCustomField( - target, - propertyKey, - descriptor, - options, + let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( + "design:returntype", + val.prototype, + "username", + // "method", + // ctx.name, ); - if (!customField) { + console.log(val, val.prototype, typeMetadata, returnTypeMetadata); + }; + } + static gqlField(options?: gqlFieldOptions): any { + // hah, arguments change in 2.0 + return function ( + originalMethod: any, + ctx: ClassMemberDecoratorContext, + // propertyKey: string, + // descriptor: PropertyDescriptor, + ) { + if ( + !GQLCapture.isEnabled() + // ctx.kind !== "method" || + // ctx.static || + // ctx.private + ) { return; } - const connections = customField.results.filter( - (result) => result.connection, + console.log(originalMethod, ctx.access); + + // console.log( + // originalMethod, + // "propertyKey", + // propertyKey, + // "descriptior", + // descriptor, + // ); + + // this isn't helpful because we don't have access to ars... + // return function (this: any, ...args: any[]) { + // console.log("gqlField", originalMethod, ctx, args); + // return originalMethod.call(this, args); + // }; + + // let typeMetadata: metadataIsh | null = Reflect.getMetadata( + // "design:type", + // originalMethod, + // propertyKey, + // // "method", + // // ctx.name, + // ); + // let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( + // "design:returntype", + // originalMethod, + // propertyKey, + // // "method", + // // ctx.name, + // ); + + console.log( + "enabled", + // originalMethod.arguments, + // typeof originalMethod, + // ctx.name, + // ctx.kind, + // typeMetadata, + // returnTypeMetadata, ); - if (connections.length > 1) { - throw new Error(`if using a connection, need to only return one item`); - } - if (connections.length === 1) { - const conn = connections[0]; - if (conn.list) { - throw new Error("GraphQLConnection result cannot be a list"); - } - if (conn.nullable) { - throw new Error("GraphQLConnection result cannot be nullable"); - } - if (conn.isContextArg) { - throw new Error("GraphQLConnection result cannot be contextArg"); - } - - if (customField.fieldType === CustomFieldType.AsyncFunction) { - throw new Error( - `async function not currently supported for GraphQLConnection`, - ); - } - } - let list = GQLCapture.customFields.get(customField.nodeName); - if (list === undefined) { - list = []; - } - list.push(customField); - GQLCapture.customFields.set(customField.nodeName, list); + // let customField = GQLCapture.getCustomField( + // target, + // propertyKey, + // descriptor, + // options, + // ); + // if (!customField) { + // return; + // } + // const connections = customField.results.filter( + // (result) => result.connection, + // ); + // if (connections.length > 1) { + // throw new Error(`if using a connection, need to only return one item`); + // } + // if (connections.length === 1) { + // const conn = connections[0]; + // if (conn.list) { + // throw new Error("GraphQLConnection result cannot be a list"); + // } + // if (conn.nullable) { + // throw new Error("GraphQLConnection result cannot be nullable"); + // } + // if (conn.isContextArg) { + // throw new Error("GraphQLConnection result cannot be contextArg"); + // } + + // if (customField.fieldType === CustomFieldType.AsyncFunction) { + // throw new Error( + // `async function not currently supported for GraphQLConnection`, + // ); + // } + // } + // let list = GQLCapture.customFields.get(customField.nodeName); + // if (list === undefined) { + // list = []; + // } + // list.push(customField); + // GQLCapture.customFields.set(customField.nodeName, list); }; } @@ -816,6 +888,7 @@ export const gqlQuery = GQLCapture.gqlQuery; export const gqlMutation = GQLCapture.gqlMutation; export const gqlContextType = GQLCapture.gqlContextType; export const gqlConnection = GQLCapture.gqlConnection; +export const gqlObjectWithFields = GQLCapture.gqlObjectWithFields; // this requires the developer to npm-install "graphql-upload on their own" const gqlFileUpload: CustomType = { diff --git a/ts/src/graphql/graphql_custom.test.ts b/ts/src/graphql/graphql_custom.test.ts index 827dabf48..871e9d6f2 100644 --- a/ts/src/graphql/graphql_custom.test.ts +++ b/ts/src/graphql/graphql_custom.test.ts @@ -33,233 +33,233 @@ beforeEach(() => { GQLCapture.enable(true); }); -test("mutation with input type", async () => { - @gqlInputObjectType({ - name: "UserAuthInput", - }) - class UserAuthInput { - @gqlField() - emailAddress: string; - - @gqlField() - password: string; - } - - @gqlObjectType({ - name: "UserAuthResponse", - }) - class UserAuthResponse { - @gqlField() - token: string; - - @gqlField({ type: GraphQLID }) - viewerID: ID; - } - - class UserAuth { - // can't have decorator on a top-level function :( - @gqlMutation({ name: "userAuth", type: UserAuthResponse }) - async userAuth( - @gqlArg("input") input: UserAuthInput, - ): Promise { - console.log(input.emailAddress); - console.log(input.password); - return new UserAuthResponse(); - } - } - validateCustomFields([ - { - nodeName: "UserAuthInput", - functionName: "emailAddress", - gqlName: "emailAddress", - fieldType: CustomFieldType.Field, - results: [ - { - type: "String", - name: "", - }, - ], - args: [], - }, - { - nodeName: "UserAuthInput", - functionName: "password", - gqlName: "password", - fieldType: CustomFieldType.Field, - results: [ - { - type: "String", - name: "", - }, - ], - args: [], - }, - { - nodeName: "UserAuthResponse", - functionName: "token", - gqlName: "token", - fieldType: CustomFieldType.Field, - results: [ - { - type: "String", - name: "", - }, - ], - args: [], - }, - { - nodeName: "UserAuthResponse", - functionName: "viewerID", - gqlName: "viewerID", - fieldType: CustomFieldType.Field, - results: [ - { - type: "ID", - name: "", - }, - ], - args: [], - }, - ]); - - validateCustomInputObjects([ - { - nodeName: "UserAuthInput", - className: "UserAuthInput", - }, - ]); - - validateCustomObjects([ - { - nodeName: "UserAuthResponse", - className: "UserAuthResponse", - }, - ]); - - validateCustomMutations([ - { - nodeName: "UserAuth", - functionName: "userAuth", - gqlName: "userAuth", - fieldType: CustomFieldType.AsyncFunction, - results: [ - { - type: "UserAuthResponse", - name: "", - needsResolving: true, - }, - ], - args: [ - { - type: "UserAuthInput", - name: "input", - needsResolving: true, - }, - ], - }, - ]); - validateNoCustomArgs(); - validateNoCustomQueries(); - - GQLCapture.resolve([]); -}); - -test("mutation with different types", async () => { - @gqlObjectType({ - name: "UserAuthResponse", - }) - class UserAuthResponse { - @gqlField() - token: string; - - @gqlField({ type: GraphQLID }) - viewerID: ID; - } - - // wow this needs to be a different class name - class UserAuth { - // can't have decorator on a top-level function :( - @gqlMutation({ name: "userAuth", type: UserAuthResponse }) - // This needs to be named differently because metadata :( - async userAuthDiff( - @gqlArg("emailAddress") emailAddress: string, - @gqlArg("password") password: string, - ): Promise { - console.log(emailAddress); - console.log(password); - return new UserAuthResponse(); - } - } - validateCustomFields([ - { - nodeName: "UserAuthResponse", - functionName: "token", - gqlName: "token", - fieldType: CustomFieldType.Field, - results: [ - { - type: "String", - name: "", - }, - ], - args: [], - }, - { - nodeName: "UserAuthResponse", - functionName: "viewerID", - gqlName: "viewerID", - fieldType: CustomFieldType.Field, - results: [ - { - type: "ID", - name: "", - }, - ], - args: [], - }, - ]); - - validateCustomObjects([ - { - nodeName: "UserAuthResponse", - className: "UserAuthResponse", - }, - ]); - - validateCustomMutations([ - { - nodeName: "UserAuth", - functionName: "userAuthDiff", - gqlName: "userAuth", - fieldType: CustomFieldType.AsyncFunction, - results: [ - { - type: "UserAuthResponse", - name: "", - needsResolving: true, - }, - ], - args: [ - { - type: "String", - name: "emailAddress", - }, - { - type: "String", - name: "password", - }, - ], - }, - ]); - - validateNoCustom( - CustomObjectTypes.Field, - CustomObjectTypes.Mutation, - CustomObjectTypes.Object, - ); - - GQLCapture.resolve([]); -}); +// test("mutation with input type", async () => { +// @gqlInputObjectType({ +// name: "UserAuthInput", +// }) +// class UserAuthInput { +// @gqlField() +// emailAddress: string; + +// @gqlField() +// password: string; +// } + +// @gqlObjectType({ +// name: "UserAuthResponse", +// }) +// class UserAuthResponse { +// @gqlField() +// token: string; + +// @gqlField({ type: GraphQLID }) +// viewerID: ID; +// } + +// class UserAuth { +// // can't have decorator on a top-level function :( +// @gqlMutation({ name: "userAuth", type: UserAuthResponse }) +// async userAuth( +// @gqlArg("input") input: UserAuthInput, +// ): Promise { +// console.log(input.emailAddress); +// console.log(input.password); +// return new UserAuthResponse(); +// } +// } +// validateCustomFields([ +// { +// nodeName: "UserAuthInput", +// functionName: "emailAddress", +// gqlName: "emailAddress", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "String", +// name: "", +// }, +// ], +// args: [], +// }, +// { +// nodeName: "UserAuthInput", +// functionName: "password", +// gqlName: "password", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "String", +// name: "", +// }, +// ], +// args: [], +// }, +// { +// nodeName: "UserAuthResponse", +// functionName: "token", +// gqlName: "token", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "String", +// name: "", +// }, +// ], +// args: [], +// }, +// { +// nodeName: "UserAuthResponse", +// functionName: "viewerID", +// gqlName: "viewerID", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "ID", +// name: "", +// }, +// ], +// args: [], +// }, +// ]); + +// validateCustomInputObjects([ +// { +// nodeName: "UserAuthInput", +// className: "UserAuthInput", +// }, +// ]); + +// validateCustomObjects([ +// { +// nodeName: "UserAuthResponse", +// className: "UserAuthResponse", +// }, +// ]); + +// validateCustomMutations([ +// { +// nodeName: "UserAuth", +// functionName: "userAuth", +// gqlName: "userAuth", +// fieldType: CustomFieldType.AsyncFunction, +// results: [ +// { +// type: "UserAuthResponse", +// name: "", +// needsResolving: true, +// }, +// ], +// args: [ +// { +// type: "UserAuthInput", +// name: "input", +// needsResolving: true, +// }, +// ], +// }, +// ]); +// validateNoCustomArgs(); +// validateNoCustomQueries(); + +// GQLCapture.resolve([]); +// }); + +// test("mutation with different types", async () => { +// @gqlObjectType({ +// name: "UserAuthResponse", +// }) +// class UserAuthResponse { +// @gqlField() +// token: string; + +// @gqlField({ type: GraphQLID }) +// viewerID: ID; +// } + +// // wow this needs to be a different class name +// class UserAuth { +// // can't have decorator on a top-level function :( +// @gqlMutation({ name: "userAuth", type: UserAuthResponse }) +// // This needs to be named differently because metadata :( +// async userAuthDiff( +// @gqlArg("emailAddress") emailAddress: string, +// @gqlArg("password") password: string, +// ): Promise { +// console.log(emailAddress); +// console.log(password); +// return new UserAuthResponse(); +// } +// } +// validateCustomFields([ +// { +// nodeName: "UserAuthResponse", +// functionName: "token", +// gqlName: "token", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "String", +// name: "", +// }, +// ], +// args: [], +// }, +// { +// nodeName: "UserAuthResponse", +// functionName: "viewerID", +// gqlName: "viewerID", +// fieldType: CustomFieldType.Field, +// results: [ +// { +// type: "ID", +// name: "", +// }, +// ], +// args: [], +// }, +// ]); + +// validateCustomObjects([ +// { +// nodeName: "UserAuthResponse", +// className: "UserAuthResponse", +// }, +// ]); + +// validateCustomMutations([ +// { +// nodeName: "UserAuth", +// functionName: "userAuthDiff", +// gqlName: "userAuth", +// fieldType: CustomFieldType.AsyncFunction, +// results: [ +// { +// type: "UserAuthResponse", +// name: "", +// needsResolving: true, +// }, +// ], +// args: [ +// { +// type: "String", +// name: "emailAddress", +// }, +// { +// type: "String", +// name: "password", +// }, +// ], +// }, +// ]); + +// validateNoCustom( +// CustomObjectTypes.Field, +// CustomObjectTypes.Mutation, +// CustomObjectTypes.Object, +// ); + +// GQLCapture.resolve([]); +// }); test("mutation with no args", () => { class Logger { @@ -281,154 +281,154 @@ test("mutation with no args", () => { GQLCapture.resolve([]); }); -test("query with return type", () => { - @gqlObjectType({ name: "Viewer" }) - class ViewerType { - constructor(private viewer: Viewer) {} - @gqlField({ type: GraphQLID, nullable: true }) - get viewerID() { - return this.viewer.viewerID; - } - } - - class ViewerResolver { - @gqlQuery({ type: ViewerType }) - viewer(@gqlContextType() context: RequestContext): ViewerType { - return new ViewerType(context.getViewer()); - } - } - - validateCustomQueries([ - { - nodeName: "ViewerResolver", - functionName: "viewer", - gqlName: "viewer", - fieldType: CustomFieldType.Function, - results: [ - { - type: "ViewerType", // there needs to be something else that does the translation to Viewer - needsResolving: true, - name: "", - }, - ], - args: [ - { - type: "Context", - name: "context", - needsResolving: true, - isContextArg: true, - }, - ], - }, - ]); - - validateCustomObjects([ - { - nodeName: "Viewer", - className: "ViewerType", - }, - ]); - - validateCustomFields([ - { - nodeName: "ViewerType", - functionName: "viewerID", - gqlName: "viewerID", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "ID", - name: "", - nullable: true, - }, - ], - args: [], - }, - ]); - - validateNoCustom( - CustomObjectTypes.Field, - CustomObjectTypes.Object, - CustomObjectTypes.Query, - ); - - GQLCapture.resolve([]); -}); - -test("query with list return type", () => { - @gqlObjectType({ name: "Viewer" }) - class ViewerType { - constructor(private viewer: Viewer) {} - @gqlField({ type: GraphQLID, nullable: true }) - get viewerID() { - return this.viewer.viewerID; - } - } - - class ViewerResolver { - @gqlQuery({ type: "[ViewerType]" }) - viewer(@gqlContextType() context: RequestContext): [ViewerType] { - return [new ViewerType(context.getViewer())]; - } - } - - validateCustomQueries([ - { - nodeName: "ViewerResolver", - functionName: "viewer", - gqlName: "viewer", - fieldType: CustomFieldType.Function, - results: [ - { - type: "ViewerType", // there needs to be something else that does the translation to Viewer - needsResolving: true, - name: "", - list: true, - }, - ], - args: [ - { - type: "Context", - name: "context", - needsResolving: true, - isContextArg: true, - }, - ], - }, - ]); - - validateCustomObjects([ - { - nodeName: "Viewer", - className: "ViewerType", - }, - ]); - - validateCustomFields([ - { - nodeName: "ViewerType", - functionName: "viewerID", - gqlName: "viewerID", - fieldType: CustomFieldType.Accessor, - results: [ - { - type: "ID", - name: "", - nullable: true, - }, - ], - args: [], - }, - ]); - - validateNoCustom( - CustomObjectTypes.Field, - CustomObjectTypes.Object, - CustomObjectTypes.Query, - ); - - GQLCapture.resolve([]); -}); +// test("query with return type", () => { +// @gqlObjectType({ name: "Viewer" }) +// class ViewerType { +// constructor(private viewer: Viewer) {} +// @gqlField({ type: GraphQLID, nullable: true }) +// get viewerID() { +// return this.viewer.viewerID; +// } +// } + +// class ViewerResolver { +// @gqlQuery({ type: ViewerType }) +// viewer(@gqlContextType() context: RequestContext): ViewerType { +// return new ViewerType(context.getViewer()); +// } +// } + +// validateCustomQueries([ +// { +// nodeName: "ViewerResolver", +// functionName: "viewer", +// gqlName: "viewer", +// fieldType: CustomFieldType.Function, +// results: [ +// { +// type: "ViewerType", // there needs to be something else that does the translation to Viewer +// needsResolving: true, +// name: "", +// }, +// ], +// args: [ +// { +// type: "Context", +// name: "context", +// needsResolving: true, +// isContextArg: true, +// }, +// ], +// }, +// ]); + +// validateCustomObjects([ +// { +// nodeName: "Viewer", +// className: "ViewerType", +// }, +// ]); + +// validateCustomFields([ +// { +// nodeName: "ViewerType", +// functionName: "viewerID", +// gqlName: "viewerID", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "ID", +// name: "", +// nullable: true, +// }, +// ], +// args: [], +// }, +// ]); + +// validateNoCustom( +// CustomObjectTypes.Field, +// CustomObjectTypes.Object, +// CustomObjectTypes.Query, +// ); + +// GQLCapture.resolve([]); +// }); + +// test("query with list return type", () => { +// @gqlObjectType({ name: "Viewer" }) +// class ViewerType { +// constructor(private viewer: Viewer) {} +// @gqlField({ type: GraphQLID, nullable: true }) +// get viewerID() { +// return this.viewer.viewerID; +// } +// } + +// class ViewerResolver { +// @gqlQuery({ type: "[ViewerType]" }) +// viewer(@gqlContextType() context: RequestContext): [ViewerType] { +// return [new ViewerType(context.getViewer())]; +// } +// } + +// validateCustomQueries([ +// { +// nodeName: "ViewerResolver", +// functionName: "viewer", +// gqlName: "viewer", +// fieldType: CustomFieldType.Function, +// results: [ +// { +// type: "ViewerType", // there needs to be something else that does the translation to Viewer +// needsResolving: true, +// name: "", +// list: true, +// }, +// ], +// args: [ +// { +// type: "Context", +// name: "context", +// needsResolving: true, +// isContextArg: true, +// }, +// ], +// }, +// ]); + +// validateCustomObjects([ +// { +// nodeName: "Viewer", +// className: "ViewerType", +// }, +// ]); + +// validateCustomFields([ +// { +// nodeName: "ViewerType", +// functionName: "viewerID", +// gqlName: "viewerID", +// fieldType: CustomFieldType.Accessor, +// results: [ +// { +// type: "ID", +// name: "", +// nullable: true, +// }, +// ], +// args: [], +// }, +// ]); + +// validateNoCustom( +// CustomObjectTypes.Field, +// CustomObjectTypes.Object, +// CustomObjectTypes.Query, +// ); + +// GQLCapture.resolve([]); +// }); test("query which returns connection", async () => { class ViewerResolver { @@ -463,91 +463,91 @@ test("query which returns connection", async () => { validateNoCustom(CustomObjectTypes.Query); }); -test("query with args which returns connection", async () => { - class ViewerResolver { - @gqlQuery({ - type: gqlConnection("User"), - name: "peopleYouMayKnow", - }) - pymk( - @gqlContextType() context: RequestContext, - @gqlArg("id", { type: GraphQLID }) id: ID, - ) { - return 1; - } - } - - validateCustomQueries([ - { - nodeName: "ViewerResolver", - functionName: "pymk", - gqlName: "peopleYouMayKnow", - fieldType: CustomFieldType.Function, - results: [ - { - type: "User", - needsResolving: true, - connection: true, - name: "", - }, - ], - args: [ - { - type: "Context", - isContextArg: true, - name: "context", - needsResolving: true, - }, - { - type: "ID", - name: "id", - }, - ], - }, - ]); - - GQLCapture.resolve(["User"]); - validateNoCustom(CustomObjectTypes.Query); -}); - -test("custom type", () => { - class ProfilePictureUploadResolver { - @gqlMutation({ name: "profilePictureUpload", type: GraphQLBoolean }) - profilePictureUpload( - @gqlContextType() context: RequestContext, - @gqlArg("file", { type: gqlFileUpload }) file, - ) { - // yay successful upload - return true; - } - } - - validateCustomMutations([ - { - nodeName: "ProfilePictureUploadResolver", - functionName: "profilePictureUpload", - gqlName: "profilePictureUpload", - fieldType: CustomFieldType.Function, - results: [], - args: [ - { - type: "Context", - name: "context", - needsResolving: true, - isContextArg: true, - }, - { - type: "GraphQLUpload", - name: "file", - needsResolving: true, - tsType: "FileUpload", - }, - ], - }, - ]); - - validateCustomTypes([gqlFileUpload]); - - validateNoCustom(CustomObjectTypes.Mutation, CustomObjectTypes.CustomTypes); - GQLCapture.resolve([]); -}); +// test("query with args which returns connection", async () => { +// class ViewerResolver { +// @gqlQuery({ +// type: gqlConnection("User"), +// name: "peopleYouMayKnow", +// }) +// pymk( +// @gqlContextType() context: RequestContext, +// @gqlArg("id", { type: GraphQLID }) id: ID, +// ) { +// return 1; +// } +// } + +// validateCustomQueries([ +// { +// nodeName: "ViewerResolver", +// functionName: "pymk", +// gqlName: "peopleYouMayKnow", +// fieldType: CustomFieldType.Function, +// results: [ +// { +// type: "User", +// needsResolving: true, +// connection: true, +// name: "", +// }, +// ], +// args: [ +// { +// type: "Context", +// isContextArg: true, +// name: "context", +// needsResolving: true, +// }, +// { +// type: "ID", +// name: "id", +// }, +// ], +// }, +// ]); + +// GQLCapture.resolve(["User"]); +// validateNoCustom(CustomObjectTypes.Query); +// }); + +// test("custom type", () => { +// class ProfilePictureUploadResolver { +// @gqlMutation({ name: "profilePictureUpload", type: GraphQLBoolean }) +// profilePictureUpload( +// @gqlContextType() context: RequestContext, +// @gqlArg("file", { type: gqlFileUpload }) file, +// ) { +// // yay successful upload +// return true; +// } +// } + +// validateCustomMutations([ +// { +// nodeName: "ProfilePictureUploadResolver", +// functionName: "profilePictureUpload", +// gqlName: "profilePictureUpload", +// fieldType: CustomFieldType.Function, +// results: [], +// args: [ +// { +// type: "Context", +// name: "context", +// needsResolving: true, +// isContextArg: true, +// }, +// { +// type: "GraphQLUpload", +// name: "file", +// needsResolving: true, +// tsType: "FileUpload", +// }, +// ], +// }, +// ]); + +// validateCustomTypes([gqlFileUpload]); + +// validateNoCustom(CustomObjectTypes.Mutation, CustomObjectTypes.CustomTypes); +// GQLCapture.resolve([]); +// }); diff --git a/ts/src/imports/dataz/example1/_auth.ts b/ts/src/imports/dataz/example1/_auth.ts index d9c89fc0e..10cb01e56 100644 --- a/ts/src/imports/dataz/example1/_auth.ts +++ b/ts/src/imports/dataz/example1/_auth.ts @@ -27,9 +27,8 @@ class UserAuthResponse { class AuthResolver { @gqlMutation({ name: "userAuth", type: UserAuthResponse }) - async userAuth( - @gqlArg("input") input: UserAuthInput, - ): Promise { + async userAuth(): // @gqlArg("input") input: UserAuthInput, + Promise { throw new Error("not implemented"); } } diff --git a/ts/src/imports/dataz/example1/_viewer.ts b/ts/src/imports/dataz/example1/_viewer.ts index e2922bfc4..58147583d 100644 --- a/ts/src/imports/dataz/example1/_viewer.ts +++ b/ts/src/imports/dataz/example1/_viewer.ts @@ -18,9 +18,10 @@ class ViewerType { } } -export default class ViewerResolver { - @gqlQuery({ name: "viewer", type: ViewerType }) - viewer(@gqlContextType() context: RequestContext): ViewerType { - return new ViewerType(context.getViewer()); - } -} +// export default class ViewerResolver { +// @gqlQuery({ name: "viewer", type: ViewerType }) +// viewer(): // @gqlContextType() context: RequestContext +// ViewerType { +// return new ViewerType(context.getViewer()); +// } +// } From 074159877bba97116d65b67e1046b0a1da028bfe Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 15:53:33 -0700 Subject: [PATCH 02/17] stash. mostly working --- ts/.swcrc | 14 - ts/jest.config.js | 4 +- ts/package-lock.json | 30 +- ts/package.json | 4 +- ts/src/graphql/graphql.test.ts | 2089 ++++++++++++----------- ts/src/graphql/graphql.ts | 491 ++++-- ts/src/graphql/graphql_custom.test.ts | 1010 ++++++----- ts/src/graphql/graphql_field_helpers.ts | 1 + ts/tsconfig.json | 6 +- 9 files changed, 2005 insertions(+), 1644 deletions(-) delete mode 100644 ts/.swcrc diff --git a/ts/.swcrc b/ts/.swcrc deleted file mode 100644 index 2dc2311e5..000000000 --- a/ts/.swcrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "jsc": { - "parser": { - "syntax": "typescript", - "decorators": true, - "target": "es2020" - }, - "transform": { - "decoratorVersion": "2022-03" - // "legacyDecorator": true, - // "decoratorMetadata": true - } - } -} \ No newline at end of file diff --git a/ts/jest.config.js b/ts/jest.config.js index 68b0fac32..7294b0cd4 100644 --- a/ts/jest.config.js +++ b/ts/jest.config.js @@ -1,8 +1,8 @@ module.exports = { - // preset: "ts-jest", + preset: "ts-jest", testEnvironment: "node", transform: { - "^.+\\.tsx?$": "@swc/jest", + "^.+\\.tsx?$": "ts-jest", }, testRegex: "(/tests/.*|(\\.|/)(test|spec))\\.(tsx?)$", moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], diff --git a/ts/package-lock.json b/ts/package-lock.json index 3daeff3a6..741e8305a 100644 --- a/ts/package-lock.json +++ b/ts/package-lock.json @@ -27,8 +27,8 @@ "snake-case": "^3.0.4", "ts-node": "^10.9.1", "tsconfig-paths": "^4.1.1", - "tslib": "^2.4.1", - "typescript": "^4.9.4", + "tslib": "^2.5.0", + "typescript": "^5.0.4", "uuid": "^9.0.0" }, "bin": { @@ -6363,9 +6363,9 @@ } }, "node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, "node_modules/tunnel-agent": { "version": "0.6.0", @@ -6419,15 +6419,15 @@ } }, "node_modules/typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/unpipe": { @@ -11511,9 +11511,9 @@ } }, "tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" }, "tunnel-agent": { "version": "0.6.0", @@ -11552,9 +11552,9 @@ } }, "typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==" + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==" }, "unpipe": { "version": "1.0.0", diff --git a/ts/package.json b/ts/package.json index 1939c20e2..7c158277e 100644 --- a/ts/package.json +++ b/ts/package.json @@ -26,8 +26,8 @@ "snake-case": "^3.0.4", "ts-node": "^10.9.1", "tsconfig-paths": "^4.1.1", - "tslib": "^2.4.1", - "typescript": "^4.9.4", + "tslib": "^2.5.0", + "typescript": "^5.0.4", "uuid": "^9.0.0" }, "peerDependencies": { diff --git a/ts/src/graphql/graphql.test.ts b/ts/src/graphql/graphql.test.ts index e5e8e428f..f35ec3ebf 100644 --- a/ts/src/graphql/graphql.test.ts +++ b/ts/src/graphql/graphql.test.ts @@ -1,11 +1,9 @@ import { gqlField, - gqlArg, GQLCapture, gqlArgType, CustomFieldType, gqlConnection, - gqlObjectType, gqlObjectWithFields, } from "./graphql"; import { @@ -30,488 +28,523 @@ beforeEach(() => { GQLCapture.enable(true); }); -// describe("accessor", () => { -// test.only("disabled", () => { -// GQLCapture.enable(false); -// class User { -// @gqlField() -// get fullName(): string { -// return "fullName"; -// } -// } -// validateNoCustom(); -// }); - -// test("enabled. string", () => { -// class User { -// @gqlField() -// get fullName(): string { -// return "fullName"; -// } -// } - -// validateOneCustomField({ -// nodeName: "User", -// functionName: "fullName", -// gqlName: "fullName", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "String", -// name: "", -// tsType: "string", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. nullable string", () => { -// class User { -// @gqlField({ -// type: GraphQLString, -// nullable: true, -// description: "first + last name", -// }) -// // boo when it's nullable, we need to indicate type and nullable: true -// get fullName(): string | null { -// return "fullName"; -// } -// } - -// validateOneCustomField({ -// nodeName: "User", -// functionName: "fullName", -// gqlName: "fullName", -// fieldType: CustomFieldType.Accessor, -// description: "first + last name", -// results: [ -// { -// type: "String", -// name: "", -// nullable: true, -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. int", () => { -// class User { -// @gqlField({ type: GraphQLInt }) -// get age(): number { -// return 3.2; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "age", -// gqlName: "age", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "Int", -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. float", () => { -// class User { -// @gqlField({ type: GraphQLFloat }) -// get age(): number { -// return 3.2; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "age", -// gqlName: "age", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "Float", -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. returns float with implicit number", () => { -// class User { -// @gqlField({ type: GraphQLFloat }) -// get age() { -// return 3.2; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "age", -// gqlName: "age", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "Float", -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. returns int with implicit number", () => { -// class User { -// @gqlField({ type: GraphQLInt }) -// get age() { -// return 3.2; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "age", -// gqlName: "age", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "Int", -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. throws with number and no type", () => { -// try { -// class User { -// @gqlField() -// get age(): number { -// return 3.2; -// } -// } -// throw new Error("should not get here"); -// } catch (e) { -// expect(e.message).toMatch(/^type is required (.)+/); -// } -// validateNoCustom(); -// }); - -// test("enabled. throws with implicit type and no passed in type", () => { -// try { -// class User { -// @gqlField() -// get age() { -// return 3.2; -// } -// } -// throw new Error("should not get here"); -// } catch (e) { -// expect(e.message).toMatch(/^type is required (.)+/); -// } -// validateNoCustom(); -// }); - -// test("enabled. list of strings", () => { -// class User { -// @gqlField({ type: [String] }) -// get names(): string[] { -// return ["firstName", "lastName", "fullName"]; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "names", -// gqlName: "names", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "String", -// list: true, -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. list of strings", () => { -// class User { -// @gqlField({ type: [String] }) -// get names(): string[] { -// return ["firstName", "lastName", "fullName"]; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "names", -// gqlName: "names", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "String", -// list: true, -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. nullable list of strings", () => { -// class User { -// @gqlField({ type: [String], nullable: true }) -// get names(): string[] | null { -// return null; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "names", -// gqlName: "names", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "String", -// list: true, -// nullable: true, -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. nullable contents of strings", () => { -// class User { -// @gqlField({ type: [String], nullable: "contents" }) -// get names(): (string | null)[] { -// return ["firstName", "lastName", "fullName", null]; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "names", -// gqlName: "names", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "String", -// list: true, -// name: "", -// nullable: "contents", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. nullable contents and list of strings", () => { -// class User { -// // all nullable -// @gqlField({ type: [String], nullable: "contentsAndList" }) -// get names(): (string | null)[] | null { -// return null; -// } -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "names", -// gqlName: "names", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "String", -// list: true, -// name: "", -// nullable: "contentsAndList", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); -// }); - -// describe("property", () => { -// test.only("disabled", () => { -// GQLCapture.enable(false); -// class User { -// @gqlField() -// fullName: string; -// } -// validateNoCustom(); -// }); - -// test("enabled. string", () => { -// class User { -// @gqlField() -// fullName: string; -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "fullName", -// gqlName: "fullName", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "String", -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. int", () => { -// class User { -// @gqlField({ type: GraphQLInt }) -// age: number; -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "age", -// gqlName: "age", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "Int", -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. float", () => { -// class User { -// @gqlField({ type: GraphQLFloat }) -// age: number; -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "age", -// gqlName: "age", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "Float", -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. with implicit type. explicit graphql type", () => { -// class User { -// @gqlField({ type: GraphQLFloat }) -// // lol but why? -// age; -// } -// validateOneCustomField({ -// nodeName: "User", -// functionName: "age", -// gqlName: "age", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "Float", -// name: "", -// }, -// ], -// args: [], -// }); -// validateNoCustom(CustomObjectTypes.Field); -// }); - -// test("enabled. with implicit type. no graphql type", () => { -// try { -// class User { -// @gqlField() -// // lol but why? -// age; -// } -// throw new Error("should not have gotten here"); -// } catch (e) { -// expect(e.message).toMatch(/^type is required (.)+/); -// } -// validateNoCustom(); -// }); - -// test("enabled. custom scalar", () => { -// class Point { -// constructor(private x: number, private y: number) {} - -// serialize(): string { -// return `${this.x},${this.y}`; -// } -// } - -// const GraphQLPoint = new GraphQLScalarType({ -// name: "Point", -// description: "Point scalar type", -// serialize: (outputValue: Point) => { -// return outputValue.serialize(); -// }, -// parseValue: (input: any) => { -// if (typeof input !== "string") { -// throw new GraphQLError(`invalid input value ${input}`); -// } -// const parts = input.split(","); -// if (parts.length !== 2) { -// throw new GraphQLError(`invalid input value ${input}`); -// } -// return new Point(parseInt(parts[0], 10), parseInt(parts[1], 10)); -// }, -// parseLiteral: (ast: ValueNode) => { -// if (ast.kind === Kind.STRING) { -// const parts = ast.value.split(","); -// if (parts.length !== 2) { -// throw new GraphQLError(`invalid input value ${ast.value}`); -// } -// return new Point(parseInt(parts[0], 10), parseInt(parts[1], 10)); -// } -// throw new GraphQLError(`Time cannot represent literal value ${ast}`); -// }, -// }); - -// try { -// class User { -// @gqlField({ type: GraphQLPoint }) -// point: Point; -// } -// throw new Error("should not get here"); -// } catch (e) { -// expect(e.message).toMatch( -// /custom scalar type Point is not supported this way. use CustomType syntax/, -// ); -// } - -// validateNoCustom(); -// }); -// }); +describe("accessor", () => { + test("disabled", () => { + GQLCapture.enable(false); + class User { + @gqlField({ + nodeName: "User", + }) + get fullName(): string { + return "fullName"; + } + } + validateNoCustom(); + }); + + test("enabled. string", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLString, + }) + get fullName(): string { + return "fullName"; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "fullName", + gqlName: "fullName", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "String", + name: "", + tsType: "string", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. nullable string", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLString, + nullable: true, + description: "first + last name", + }) + get fullName(): string | null { + return "fullName"; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "fullName", + gqlName: "fullName", + fieldType: CustomFieldType.Accessor, + description: "first + last name", + results: [ + { + type: "String", + name: "", + nullable: true, + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. int", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLInt, + }) + get age(): number { + return 3.2; + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "age", + gqlName: "age", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "Int", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. float", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLFloat, + }) + get age(): number { + return 3.2; + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "age", + gqlName: "age", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "Float", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. returns float with implicit number", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLFloat, + }) + get age() { + return 3.2; + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "age", + gqlName: "age", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "Float", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. returns int with implicit number", () => { + class User { + @gqlField({ nodeName: "User", type: GraphQLInt }) + get age() { + return 3.2; + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "age", + gqlName: "age", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "Int", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. throws with number and no type", () => { + // TODO more type required and this goes way + try { + class User { + @gqlField({ + nodeName: "User", + }) + get age(): number { + return 3.2; + } + } + throw new Error("should not get here"); + } catch (e) { + expect(e.message).toMatch(/^type is required (.)+/); + } + validateNoCustom(); + }); + + test("enabled. throws with implicit type and no passed in type", () => { + // TODO more type required and this goes way + try { + class User { + @gqlField({ + nodeName: "User", + }) + get age() { + return 3.2; + } + } + throw new Error("should not get here"); + } catch (e) { + expect(e.message).toMatch(/^type is required (.)+/); + } + validateNoCustom(); + }); + + test("enabled. list of strings", () => { + class User { + @gqlField({ + nodeName: "User", + type: [String], + }) + get names(): string[] { + return ["firstName", "lastName", "fullName"]; + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "names", + gqlName: "names", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "String", + list: true, + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. nullable list of strings", () => { + class User { + @gqlField({ + nodeName: "User", + type: [String], + nullable: true, + }) + get names(): string[] | null { + return null; + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "names", + gqlName: "names", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "String", + list: true, + nullable: true, + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. nullable contents of strings", () => { + class User { + @gqlField({ + nodeName: "User", + type: [String], + nullable: "contents", + }) + get names(): (string | null)[] { + return ["firstName", "lastName", "fullName", null]; + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "names", + gqlName: "names", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "String", + list: true, + name: "", + nullable: "contents", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. nullable contents and list of strings", () => { + class User { + // all nullable + @gqlField({ + nodeName: "User", + type: [String], + nullable: "contentsAndList", + }) + get names(): (string | null)[] | null { + return null; + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "names", + gqlName: "names", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "String", + list: true, + name: "", + nullable: "contentsAndList", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); +}); + +describe("property", () => { + test("disabled", () => { + GQLCapture.enable(false); + class User { + @gqlField({ + nodeName: "User", + type: GraphQLString, + }) + fullName: string; + } + validateNoCustom(); + }); + + test("enabled. string", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLString, + }) + fullName: string; + } + validateOneCustomField({ + nodeName: "User", + functionName: "fullName", + gqlName: "fullName", + fieldType: CustomFieldType.Field, + results: [ + { + type: "String", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. int", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLInt, + }) + age: number; + } + validateOneCustomField({ + nodeName: "User", + functionName: "age", + gqlName: "age", + fieldType: CustomFieldType.Field, + results: [ + { + type: "Int", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. float", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLFloat, + }) + age: number; + } + validateOneCustomField({ + nodeName: "User", + functionName: "age", + gqlName: "age", + fieldType: CustomFieldType.Field, + results: [ + { + type: "Float", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. with implicit type. explicit graphql type", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLFloat, + }) + // lol but why? + age; + } + validateOneCustomField({ + nodeName: "User", + functionName: "age", + gqlName: "age", + fieldType: CustomFieldType.Field, + results: [ + { + type: "Float", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. with implicit type. no graphql type", () => { + // TODO may disappear once we have type required + try { + class User { + @gqlField({ + nodeName: "User", + }) + // lol but why? + age; + } + throw new Error("should not have gotten here"); + } catch (e) { + expect(e.message).toMatch(/^type is required (.)+/); + } + validateNoCustom(); + }); + + test("enabled. custom scalar", () => { + class Point { + constructor(private x: number, private y: number) {} + + serialize(): string { + return `${this.x},${this.y}`; + } + } + + const GraphQLPoint = new GraphQLScalarType({ + name: "Point", + description: "Point scalar type", + serialize: (outputValue: Point) => { + return outputValue.serialize(); + }, + parseValue: (input: any) => { + if (typeof input !== "string") { + throw new GraphQLError(`invalid input value ${input}`); + } + const parts = input.split(","); + if (parts.length !== 2) { + throw new GraphQLError(`invalid input value ${input}`); + } + return new Point(parseInt(parts[0], 10), parseInt(parts[1], 10)); + }, + parseLiteral: (ast: ValueNode) => { + if (ast.kind === Kind.STRING) { + const parts = ast.value.split(","); + if (parts.length !== 2) { + throw new GraphQLError(`invalid input value ${ast.value}`); + } + return new Point(parseInt(parts[0], 10), parseInt(parts[1], 10)); + } + throw new GraphQLError(`Time cannot represent literal value ${ast}`); + }, + }); + + try { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLPoint, + }) + point: Point; + } + throw new Error("should not get here"); + } catch (e) { + // TODO have we confirmed it works with CustomType syntax? + expect(e.message).toMatch( + /custom scalar type Point is not supported this way. use CustomType syntax/, + ); + } + + validateNoCustom(); + }); +}); describe("function", () => { test("disabled", () => { GQLCapture.enable(false); class User { - @gqlField() + @gqlField({ + nodeName: "User", + }) username(): string { return "ola"; } @@ -519,14 +552,20 @@ describe("function", () => { validateNoCustom(); }); - test.only("enabled, returns string", () => { + test("enabled, returns string", () => { @gqlObjectWithFields() class User { - @gqlField() + @gqlField({ + nodeName: "User", + type: GraphQLString, + }) username(): string { return "ola"; } } + // console.log("new User"); + // const user = new User(); + // const user2 = new User(); validateOneCustomField({ nodeName: "User", @@ -544,528 +583,568 @@ describe("function", () => { validateNoCustom(CustomObjectTypes.Field); }); - // test("enabled, returns int", () => { - // class User { - // @gqlField({ type: GraphQLInt }) - // age(): number { - // return 32; - // } - // } - - // validateOneCustomField({ - // nodeName: "User", - // functionName: "age", - // gqlName: "age", - // fieldType: CustomFieldType.Function, - // results: [ - // { - // type: "Int", - // name: "", - // }, - // ], - // args: [], - // }); - // validateNoCustom(CustomObjectTypes.Field); - // }); - - // test("enabled, returns float", () => { - // class User { - // @gqlField({ type: GraphQLFloat }) - // pi(): number { - // return 3.14; - // } - // } - - // validateOneCustomField({ - // nodeName: "User", - // functionName: "pi", - // gqlName: "pi", - // fieldType: CustomFieldType.Function, - // results: [ - // { - // type: "Float", - // name: "", - // }, - // ], - // args: [], - // }); - // validateNoCustom(CustomObjectTypes.Field); - // }); - - // test("enabled, returns float for implicit return type", () => { - // class User { - // @gqlField({ type: GraphQLFloat }) - // pi() { - // return 3.14; - // } - // } - - // validateOneCustomField({ - // nodeName: "User", - // functionName: "pi", - // gqlName: "pi", - // fieldType: CustomFieldType.Function, - // results: [ - // { - // type: "Float", - // name: "", - // }, - // ], - // args: [], - // }); - // validateNoCustom(CustomObjectTypes.Field); - // }); - - // test("enabled, throws for implicit return type", () => { - // try { - // class User { - // @gqlField() - // pi() { - // return 3.14; - // } - // } - // } catch (err) { - // expect(err.message).toMatch(/^Function isn't a valid type/); - // } - // validateNoCustom(); - // }); - - // // test("enabled, one param", () => { - // // class User { - // // @gqlField({ type: GraphQLInt }) - // // add(@gqlArg("base", { type: GraphQLInt }) base: number): number { - // // return 1 + base; - // // } - // // } - - // // validateOneCustomField({ - // // nodeName: "User", - // // functionName: "add", - // // gqlName: "add", - // // fieldType: CustomFieldType.Function, - // // results: [ - // // { - // // type: "Int", - // // name: "", - // // }, - // // ], - // // args: [ - // // { - // // type: "Int", - // // name: "base", - // // }, - // // ], - // // }); - // // validateNoCustom(CustomObjectTypes.Field); - // // }); - - // // test("enabled, multiple param", () => { - // // class User { - // // @gqlField() - // // find( - // // @gqlArg("pos", { type: GraphQLInt }) pos: number, - // // @gqlArg("cursor") cursor: string, - // // ): string { - // // return `${cursor}:${pos}`; - // // } - // // } - - // // validateOneCustomField({ - // // nodeName: "User", - // // functionName: "find", - // // gqlName: "find", - // // fieldType: CustomFieldType.Function, - // // results: [ - // // { - // // type: "String", - // // name: "", - // // }, - // // ], - // // args: [ - // // { - // // type: "Int", - // // name: "pos", - // // }, - // // { - // // type: "String", - // // name: "cursor", - // // }, - // // ], - // // }); - // // validateNoCustom(CustomObjectTypes.Field); - // // }); - - // // test("enabled, nullable arg", () => { - // // class User { - // // @gqlField({ name: "find" }) - // // findFromPos( - // // @gqlArg("pos", { type: GraphQLInt, nullable: true }) - // // pos: number, - // // ): string { - // // return `${pos}`; - // // } - // // } - - // // validateOneCustomField({ - // // nodeName: "User", - // // functionName: "findFromPos", - // // gqlName: "find", - // // fieldType: CustomFieldType.Function, - // // results: [ - // // { - // // type: "String", - // // name: "", - // // }, - // // ], - // // args: [ - // // { - // // type: "Int", - // // name: "pos", - // // nullable: true, - // // }, - // // ], - // // }); - // // validateNoCustom(CustomObjectTypes.Field); - // // }); - - // // test("enabled, no arg decorator", () => { - // // try { - // // class User { - // // @gqlField() - // // find(pos: number, @gqlArg("cursor") cursor: string): string { - // // return `${cursor}:${pos}`; - // // } - // // } - // // throw new Error("should not get here"); - // // } catch (e) { - // // expect(e.message).toMatch(/^args were not captured correctly/); - // // } - // // validateNoCustom(); - // // }); - - // // test("enabled. arg class", () => { - // // // TODO need to ensure no params for these since not valid graphql i believe - // // @gqlArgType() - // // class SearchArgs { - // // @gqlField() - // // startCursor: string; - - // // @gqlField({ type: GraphQLInt }) - // // start: number; - - // // @gqlField({ type: GraphQLInt, nullable: true }) - // // end: number; - // // } - // // class User { - // // // search to return count - // // // TODO need - // // @gqlField({ type: GraphQLInt }) - // // search(@gqlArg("searchArgs") arg: SearchArgs): number { - // // return 0; - // // } - // // } - - // // validateCustomFields([ - // // { - // // nodeName: "SearchArgs", - // // functionName: "startCursor", - // // gqlName: "startCursor", - // // fieldType: CustomFieldType.Field, - // // results: [ - // // { - // // type: "String", - // // name: "", - // // }, - // // ], - // // args: [], - // // }, - // // { - // // nodeName: "SearchArgs", - // // functionName: "start", - // // gqlName: "start", - // // fieldType: CustomFieldType.Field, - - // // results: [ - // // { - // // type: "Int", - // // name: "", - // // }, - // // ], - // // args: [], - // // }, - // // { - // // nodeName: "SearchArgs", - // // functionName: "end", - // // gqlName: "end", - // // fieldType: CustomFieldType.Field, - - // // results: [ - // // { - // // type: "Int", - // // name: "", - // // nullable: true, - // // }, - // // ], - // // args: [], - // // }, - // // { - // // nodeName: "User", - // // functionName: "search", - // // gqlName: "search", - // // fieldType: CustomFieldType.Function, - // // args: [ - // // { - // // type: "SearchArgs", - // // name: "searchArgs", - // // needsResolving: true, // TODO do we still need this? - // // }, - // // ], - // // results: [ - // // { - // // type: "Int", - // // name: "", - // // }, - // // ], - // // }, - // // ]); - // // validateCustomArgs([ - // // { - // // nodeName: "SearchArgs", - // // className: "SearchArgs", - // // }, - // // ]); - // // validateNoCustom(CustomObjectTypes.Field, CustomObjectTypes.Arg); - // // }); - - // // test("enabled. referencing non-arg class", () => { - // // try { - // // class SearchArgs { - // // startCursor: string; - - // // start: number; - - // // end: number; - // // } - // // class User { - // // @gqlField({ type: GraphQLInt }) - // // search(@gqlArg("searchArgs") arg: SearchArgs): number { - // // return 0; - // // } - // // } - // // GQLCapture.resolve([]); - // // throw new Error("should throw"); - // // } catch (error) { - // // // TODO need a better message here - // // expect(error.message).toMatch( - // // /arg searchArgs of field search needs resolving. should not be possible/, - // // ); - // // } - // // validateNoCustom(CustomObjectTypes.Field); - // // }); - - // test("enabled. resolve return types", () => { - // // graphql object - // class Contact {} - - // class User { - // @gqlField({ type: Contact }) - // selfContact(): Contact { - // return new Contact(); - // } - // } - - // expect(GQLCapture.getCustomArgs().size).toBe(0); - // expect(GQLCapture.getCustomFields().size).toBe(1); - // // no errors! - // GQLCapture.resolve(["User", "Contact"]); - // }); - - // test("enabled. resolve return types", () => { - // // graphql object - // class Contact {} - - // class User { - // @gqlField({ type: Contact }) - // selfContact(): Contact { - // return new Contact(); - // } - // } - - // validateNoCustom(CustomObjectTypes.Field); - // try { - // GQLCapture.resolve(["User"]); - // throw new Error("shouldn't get here"); - // } catch (error) { - // expect(error.message).toMatch(/^field selfContact references Contact/); - // } - // }); - - // test("enabled. async response", () => { - // try { - // class User { - // @gqlField({}) - // async load(): Promise { - // return new User(); - // } - // } - // throw new Error("shouldn't have gotten here"); - // } catch (e) { - // expect(e.message).toMatch(/^Promise isn't a valid type/); - // } - // validateNoCustom(); - // }); - - // test("enabled. async response with type hint", () => { - // class User { - // @gqlField({ type: User, name: "self" }) - // async loadSelf(): Promise { - // return new User(); - // } - // } - // validateOneCustomField({ - // nodeName: "User", - // functionName: "loadSelf", - // gqlName: "self", - // fieldType: CustomFieldType.AsyncFunction, - // results: [ - // { - // type: "User", - // name: "", - // needsResolving: true, - // }, - // ], - // args: [], - // }); - // validateNoCustom(CustomObjectTypes.Field); - // }); - - // test("enabled. implied async response with type hint", () => { - // class User { - // @gqlField({ type: User, name: "self" }) - // async loadSelf() { - // return new User(); - // } - // } - // validateOneCustomField({ - // nodeName: "User", - // functionName: "loadSelf", - // gqlName: "self", - // fieldType: CustomFieldType.AsyncFunction, - // results: [ - // { - // type: "User", - // name: "", - // needsResolving: true, - // }, - // ], - // args: [], - // }); - // validateNoCustom(CustomObjectTypes.Field); - // }); - - // test("enabled. object type string because 'circular dependencies'", () => { - // class User { - // @gqlField({ type: "User", name: "self" }) - // async loadSelf() { - // return new User(); - // } - // } - - // validateOneCustomField({ - // nodeName: "User", - // functionName: "loadSelf", - // gqlName: "self", - // fieldType: CustomFieldType.AsyncFunction, - // results: [ - // { - // type: "User", - // name: "", - // needsResolving: true, - // }, - // ], - // args: [], - // }); - // validateNoCustom(CustomObjectTypes.Field); - // }); - - // test("enabled. object type string list because 'circular dependencies'", () => { - // class User { - // @gqlField({ type: "[User]", name: "self" }) - // async loadSelf() { - // return [new User()]; - // } - // } - - // validateOneCustomField({ - // nodeName: "User", - // functionName: "loadSelf", - // gqlName: "self", - // fieldType: CustomFieldType.AsyncFunction, - // results: [ - // { - // type: "User", - // name: "", - // list: true, - // needsResolving: true, - // }, - // ], - // args: [], - // }); - // validateNoCustom(CustomObjectTypes.Field); - // }); - - // test("connection", async () => { - // class User { - // @gqlField({ - // type: gqlConnection("User"), - // name: "userToSelves", - // }) - // loadSelves() { - // // ignore - // return [new User()]; - // } - // } - - // validateCustomFields([ - // { - // nodeName: "User", - // functionName: "loadSelves", - // gqlName: "userToSelves", - // fieldType: CustomFieldType.Function, - // results: [ - // { - // type: "User", - // name: "", - // connection: true, - // needsResolving: true, - // }, - // ], - // args: [], - // }, - // ]); - - // validateNoCustom(CustomObjectTypes.Field); - // }); - - // test("connection with async", async () => { - // try { - // class User { - // @gqlField({ - // type: gqlConnection("User"), - // name: "userToSelves", - // }) - // async loadSelves() { - // // ignore - // return [new User()]; - // } - // } - // throw new Error("should have thrown"); - // } catch (e) { - // expect(e.message).toBe( - // "async function not currently supported for GraphQLConnection", - // ); - // } - - // validateNoCustom(); - // }); + test("enabled, returns int", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLInt, + }) + age(): number { + return 32; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "age", + gqlName: "age", + fieldType: CustomFieldType.Function, + results: [ + { + type: "Int", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled, returns float", () => { + class User { + @gqlField({ nodeName: "User", type: GraphQLFloat }) + pi(): number { + return 3.14; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "pi", + gqlName: "pi", + fieldType: CustomFieldType.Function, + results: [ + { + type: "Float", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled, returns float. implicit return type", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLFloat, + }) + pi() { + return 3.14; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "pi", + gqlName: "pi", + fieldType: CustomFieldType.Function, + results: [ + { + type: "Float", + name: "", + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled, throws for implicit return type", () => { + // TODO there's probably no need for this if type becomes required + try { + class User { + @gqlField({ + nodeName: "User", + }) + pi() { + return 3.14; + } + } + } catch (err) { + expect(err.message).toMatch(/^type is required/); + } + validateNoCustom(); + }); + + test("enabled, one param", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLInt, + args: [ + { + name: "base", + type: GraphQLInt, + }, + ], + }) + add(base: number): number { + return 1 + base; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "add", + gqlName: "add", + fieldType: CustomFieldType.Function, + results: [ + { + type: "Int", + name: "", + }, + ], + args: [ + { + type: "Int", + name: "base", + }, + ], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled, multiple param", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLString, + args: [ + { + name: "pos", + type: GraphQLInt, + }, + { + name: "cursor", + type: GraphQLString, + }, + ], + }) + find(pos: number, cursor: string): string { + return `${cursor}:${pos}`; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "find", + gqlName: "find", + fieldType: CustomFieldType.Function, + results: [ + { + type: "String", + name: "", + }, + ], + args: [ + { + type: "Int", + name: "pos", + }, + { + type: "String", + name: "cursor", + }, + ], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled, nullable arg", () => { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLString, + name: "find", + args: [ + { + name: "pos", + type: GraphQLInt, + nullable: true, + }, + ], + }) + findFromPos(pos: number): string { + return `${pos}`; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "findFromPos", + gqlName: "find", + fieldType: CustomFieldType.Function, + results: [ + { + type: "String", + name: "", + }, + ], + args: [ + { + type: "Int", + name: "pos", + nullable: true, + }, + ], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. arg class", () => { + // TODO need to ensure no params for these since not valid graphql i believe + @gqlArgType() + class SearchArgs { + @gqlField({ + nodeName: "SearchArgs", + type: GraphQLString, + }) + startCursor: string; + + @gqlField({ + nodeName: "SearchArgs", + type: GraphQLInt, + }) + start: number; + + @gqlField({ + nodeName: "SearchArgs", + type: GraphQLInt, + nullable: true, + }) + end: number; + } + class User { + // search to return count + // TODO need + @gqlField({ + nodeName: "User", + type: GraphQLInt, + args: [ + { + name: "searchArgs", + type: SearchArgs, + }, + ], + }) + search(arg: SearchArgs): number { + return 0; + } + } + + validateCustomFields([ + { + nodeName: "SearchArgs", + functionName: "startCursor", + gqlName: "startCursor", + fieldType: CustomFieldType.Field, + results: [ + { + type: "String", + name: "", + }, + ], + args: [], + }, + { + nodeName: "SearchArgs", + functionName: "start", + gqlName: "start", + fieldType: CustomFieldType.Field, + + results: [ + { + type: "Int", + name: "", + }, + ], + args: [], + }, + { + nodeName: "SearchArgs", + functionName: "end", + gqlName: "end", + fieldType: CustomFieldType.Field, + + results: [ + { + type: "Int", + name: "", + nullable: true, + }, + ], + args: [], + }, + { + nodeName: "User", + functionName: "search", + gqlName: "search", + fieldType: CustomFieldType.Function, + args: [ + { + type: "SearchArgs", + name: "searchArgs", + needsResolving: true, // TODO do we still need this? + }, + ], + results: [ + { + type: "Int", + name: "", + }, + ], + }, + ]); + validateCustomArgs([ + { + nodeName: "SearchArgs", + className: "SearchArgs", + }, + ]); + validateNoCustom(CustomObjectTypes.Field, CustomObjectTypes.Arg); + }); + + test("enabled. referencing non-arg class", () => { + try { + class SearchArgs { + startCursor: string; + + start: number; + + end: number; + } + class User { + @gqlField({ + nodeName: "User", + type: GraphQLInt, + args: [{ name: "searchArgs", type: SearchArgs }], + }) + search(arg: SearchArgs): number { + return 0; + } + } + GQLCapture.resolve([]); + throw new Error("should throw"); + } catch (error) { + // TODO need a better message here + expect(error.message).toMatch( + /arg searchArgs of field search needs resolving. should not be possible/, + ); + } + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. resolve return types", () => { + // graphql object + class Contact {} + + class User { + @gqlField({ nodeName: "User", type: Contact }) + selfContact(): Contact { + return new Contact(); + } + } + + expect(GQLCapture.getCustomArgs().size).toBe(0); + expect(GQLCapture.getCustomFields().size).toBe(1); + // no errors! + GQLCapture.resolve(["User", "Contact"]); + }); + + test("enabled. resolve return types", () => { + // graphql object + class Contact {} + + class User { + @gqlField({ + nodeName: "User", + type: Contact, + }) + selfContact(): Contact { + return new Contact(); + } + } + + validateNoCustom(CustomObjectTypes.Field); + try { + GQLCapture.resolve(["User"]); + throw new Error("shouldn't get here"); + } catch (error) { + expect(error.message).toMatch(/^field selfContact references Contact/); + } + }); + + test("enabled. async response", () => { + // TODO more type is required bye + try { + class User { + @gqlField({ + nodeName: "User", + }) + async load(): Promise { + return new User(); + } + } + throw new Error("shouldn't have gotten here"); + } catch (e) { + expect(e.message).toMatch(/^type is required/); + } + validateNoCustom(); + }); + + // these next two are 'User' because of circular dependencies + test("enabled. async response with type hint", () => { + class User { + @gqlField({ + nodeName: "User", + type: "User", + name: "self", + async: true, + }) + async loadSelf(): Promise { + return new User(); + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "loadSelf", + gqlName: "self", + fieldType: CustomFieldType.AsyncFunction, + results: [ + { + type: "User", + name: "", + needsResolving: true, + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. implied async response with type hint", () => { + class User { + @gqlField({ nodeName: "User", type: "User", name: "self", async: true }) + async loadSelf() { + return new User(); + } + } + validateOneCustomField({ + nodeName: "User", + functionName: "loadSelf", + gqlName: "self", + fieldType: CustomFieldType.AsyncFunction, + results: [ + { + type: "User", + name: "", + needsResolving: true, + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("enabled. object type string list because 'circular dependencies'", () => { + class User { + @gqlField({ + nodeName: "User", + type: "[User]", + name: "self", + async: true, + }) + async loadSelf() { + return [new User()]; + } + } + + validateOneCustomField({ + nodeName: "User", + functionName: "loadSelf", + gqlName: "self", + fieldType: CustomFieldType.AsyncFunction, + results: [ + { + type: "User", + name: "", + list: true, + needsResolving: true, + }, + ], + args: [], + }); + validateNoCustom(CustomObjectTypes.Field); + }); + + test("connection", async () => { + class User { + @gqlField({ + nodeName: "User", + type: gqlConnection("User"), + name: "userToSelves", + }) + loadSelves() { + // ignore + return [new User()]; + } + } + + validateCustomFields([ + { + nodeName: "User", + functionName: "loadSelves", + gqlName: "userToSelves", + fieldType: CustomFieldType.Function, + results: [ + { + type: "User", + name: "", + connection: true, + needsResolving: true, + }, + ], + args: [], + }, + ]); + + validateNoCustom(CustomObjectTypes.Field); + }); + + test("connection with async", async () => { + try { + class User { + @gqlField({ + nodeName: "User", + type: gqlConnection("User"), + name: "userToSelves", + async: true, + }) + async loadSelves() { + // ignore + return [new User()]; + } + } + throw new Error("should have thrown"); + } catch (e) { + expect(e.message).toBe( + // TODO is this still true... + "async function not currently supported for GraphQLConnection", + ); + } + + validateNoCustom(); + }); }); diff --git a/ts/src/graphql/graphql.ts b/ts/src/graphql/graphql.ts index c8740a05a..9334a908a 100644 --- a/ts/src/graphql/graphql.ts +++ b/ts/src/graphql/graphql.ts @@ -1,3 +1,4 @@ +// TODO delete import "reflect-metadata"; import { GraphQLScalarType } from "graphql"; import { Data } from "../core/base"; @@ -29,6 +30,7 @@ type Type = GraphQLScalarType | ClassType | string | CustomType; // node in a connection export type GraphQLConnection = { node: T }; +// TODO replace and deprecate export interface gqlFieldOptions { name?: string; nullable?: boolean | NullableListOptions; @@ -36,6 +38,28 @@ export interface gqlFieldOptions { type?: Type | Array | GraphQLConnection; // types or lists of types } +interface gqlFieldOptions2Basics { + name?: string; + nullable?: boolean | NullableListOptions; + description?: string; + // TODO this is probably required now... + type?: Type | Array | GraphQLConnection; // types or lists of types +} + +interface gqlFieldArg extends gqlFieldOptions2Basics { + isContextArg?: boolean; +} + +export interface gqlFieldOptions2 extends gqlFieldOptions2Basics { + nodeName: string; + + args?: gqlFieldOptions2Basics[]; + result?: Field; + // defaults to Function if not provided + // fieldType?: CustomFieldType; + async?: boolean; +} + interface fieldOptions extends gqlFieldOptions { // implies no return type... allowFunctionType?: boolean; @@ -46,7 +70,10 @@ export interface gqlObjectOptions { description?: string; } -type gqlTopLevelOptions = Exclude; +type gqlTopLevelOptions = Exclude & { + args?: gqlFieldArg[]; +}; + // export interface gqlTopLevelOptions // name?: string; // type?: Type | Array; @@ -55,9 +82,9 @@ type gqlTopLevelOptions = Exclude; export enum CustomFieldType { Accessor = "ACCESSOR", - Field = "FIELD", // or property + Field = "FIELD", Function = "FUNCTION", - AsyncFunction = "ASYNC_FUNCTION", // do we care about this? + AsyncFunction = "ASYNC_FUNCTION", } interface CustomFieldImpl { @@ -452,49 +479,139 @@ export class GQLCapture { return result; } + // TODO rename + private static getResultFromMetadata2( + // target: Function, + // metadata: metadataIsh, + // options?: gqlFieldOptions2, + // field?: Field, + field: gqlFieldOptions2Basics | gqlFieldArg, + ): Field { + // let type = metadata.name; + // if ((type === "Number" || type === "Object") && !options?.type) { + // throw new Error( + // `type is required when accessor/function/property returns a ${type}`, + // ); + // } + + let list: boolean | undefined; + let scalarType = false; + let connection: boolean | undefined; + let type = ""; + + if (field?.type) { + let r: typeInfo = { type: "" }; + getType(field.type, r); + list = r.list; + scalarType = r.scalarType || false; + connection = r.connection; + type = r.type; + } + + if (!type) { + throw new Error(`type is required for accessor/function/property`); + } + if (knownDisAllowedNames.has(type)) { + throw new Error( + `${type} isn't a valid type for accessor/function/property`, + ); + } + + let result: Field = { + name: field?.name || "", + type: type, + tsType: knownAllowedNames.get(type) || this.customTypes.get(type)?.tsType, + nullable: field?.nullable, + list: list, + connection: connection, + // @ts-ignore + isContextArg: field?.isContextArg, + }; + + // unknown type. we need to flag that this field needs to eventually be resolved + if (!knownAllowedNames.has(type)) { + if (scalarType) { + throw new Error( + `custom scalar type ${type} is not supported this way. use CustomType syntax. see \`gqlFileUpload\` as an example`, + ); + } + result.needsResolving = true; + } + return result; + } + // ToDO this doesn't work... static gqlObjectWithFields() { return function (val, ctx: ClassDecoratorContext) { if (!GQLCapture.isEnabled() || ctx.kind !== "class") { return; } - console.log("gsfsf", val.prototype); - - let typeMetadata: metadataIsh | null = Reflect.getMetadata( - "design:type", - val.prototype, - "username", - // "method", - // ctx.name, - ); + ctx.addInitializer(function () { + // console.log("initializer"); + }); + // console.log("gsfsf", val.prototype, ctx); - let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( - "design:returntype", - val.prototype, - "username", - // "method", - // ctx.name, - ); - console.log(val, val.prototype, typeMetadata, returnTypeMetadata); + // let typeMetadata: metadataIsh | null = Reflect.getMetadata( + // "design:type", + // val.prototype, + // "username", + // // "method", + // // ctx.name, + // ); + + // let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( + // "design:returntype", + // val.prototype, + // "username", + // // "method", + // // ctx.name, + // ); + // console.log(val, val.prototype); }; } - static gqlField(options?: gqlFieldOptions): any { + static gqlField(options: gqlFieldOptions2): any { // hah, arguments change in 2.0 return function ( - originalMethod: any, - ctx: ClassMemberDecoratorContext, - // propertyKey: string, - // descriptor: PropertyDescriptor, + target: any, + ctx: + | ClassMethodDecoratorContext + | ClassFieldDecoratorContext + | ClassGetterDecoratorContext, ) { + // console.log(ctx.kind); if ( - !GQLCapture.isEnabled() - // ctx.kind !== "method" || - // ctx.static || - // ctx.private + !GQLCapture.isEnabled() || + (ctx.kind !== "method" && + ctx.kind !== "field" && + ctx.kind !== "getter") || + ctx.static || + ctx.private ) { return; } - console.log(originalMethod, ctx.access); + + // ok, have to specify the type info + // CANNOT get the name of the class without some magic or instantiating... + + // console.log(target, ctx.access.get(target)); + // for (const k in target) { + // console.log("prop", k, target[k]); + // } + + ctx.addInitializer(function () { + console.log("function initializer"); + // @ts-ignore + if (!this.collectedMethodKeys) { + // @ts-ignore + this.collectedMethodKeys = new Set(); + } + // @ts-ignore + this.collectedMethodKeys.add(ctx.name); + + // this in here is the class instance + console.log(this); + console.log(target, ctx.access.get(this)); + }); // console.log( // originalMethod, @@ -510,69 +627,56 @@ export class GQLCapture { // return originalMethod.call(this, args); // }; - // let typeMetadata: metadataIsh | null = Reflect.getMetadata( - // "design:type", - // originalMethod, - // propertyKey, - // // "method", - // // ctx.name, - // ); - // let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( - // "design:returntype", - // originalMethod, - // propertyKey, - // // "method", + // console.log( + // "enabled", + // // originalMethod.arguments, + // // typeof originalMethod, // // ctx.name, + // // ctx.kind, + // // typeMetadata, + // // returnTypeMetadata, // ); - - console.log( - "enabled", - // originalMethod.arguments, - // typeof originalMethod, - // ctx.name, - // ctx.kind, - // typeMetadata, - // returnTypeMetadata, + let customField = GQLCapture.getCustomField2( + ctx, + options, + // propertyKey, + // descriptor, + // options, ); - // let customField = GQLCapture.getCustomField( - // target, - // propertyKey, - // descriptor, - // options, - // ); - // if (!customField) { - // return; - // } - // const connections = customField.results.filter( - // (result) => result.connection, - // ); - // if (connections.length > 1) { - // throw new Error(`if using a connection, need to only return one item`); - // } - // if (connections.length === 1) { - // const conn = connections[0]; - // if (conn.list) { - // throw new Error("GraphQLConnection result cannot be a list"); - // } - // if (conn.nullable) { - // throw new Error("GraphQLConnection result cannot be nullable"); - // } - // if (conn.isContextArg) { - // throw new Error("GraphQLConnection result cannot be contextArg"); - // } - - // if (customField.fieldType === CustomFieldType.AsyncFunction) { - // throw new Error( - // `async function not currently supported for GraphQLConnection`, - // ); - // } - // } - // let list = GQLCapture.customFields.get(customField.nodeName); - // if (list === undefined) { - // list = []; - // } - // list.push(customField); - // GQLCapture.customFields.set(customField.nodeName, list); + // console.log(customField); + if (!customField) { + return; + } + const connections = customField.results.filter( + (result) => result.connection, + ); + if (connections.length > 1) { + throw new Error(`if using a connection, need to only return one item`); + } + if (connections.length === 1) { + const conn = connections[0]; + if (conn.list) { + throw new Error("GraphQLConnection result cannot be a list"); + } + if (conn.nullable) { + throw new Error("GraphQLConnection result cannot be nullable"); + } + if (conn.isContextArg) { + throw new Error("GraphQLConnection result cannot be contextArg"); + } + + if (customField.fieldType === CustomFieldType.AsyncFunction) { + throw new Error( + `async function not currently supported for GraphQLConnection`, + ); + } + } + let list = GQLCapture.customFields.get(customField.nodeName); + if (list === undefined) { + list = []; + } + list.push(customField); + GQLCapture.customFields.set(customField.nodeName, list); }; } @@ -674,6 +778,138 @@ export class GQLCapture { }; } + private static getCustomField2( + ctx: + | ClassMethodDecoratorContext + | ClassFieldDecoratorContext + | ClassGetterDecoratorContext, + options: gqlFieldOptions2, + allowNoReturnType?: boolean, + // propertyKey: string, + // descriptor: PropertyDescriptor, + // options?: fieldOptions, + ): CustomField { + let fieldType: CustomFieldType; + // let nodeName = target.constructor.name as string; + + let args: Field[] = []; + let results: Field[] = []; + + // let typeMetadata: metadataIsh | null = Reflect.getMetadata( + // "design:type", + // target, + // propertyKey, + // ); + // let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( + // "design:returntype", + // target, + // propertyKey, + // ); + + // TODO other types + switch (ctx.kind) { + case "method": + fieldType = CustomFieldType.Function; + if (options.async) { + fieldType = CustomFieldType.AsyncFunction; + } + break; + + case "field": + fieldType = CustomFieldType.Field; + break; + + case "getter": + fieldType = CustomFieldType.Accessor; + break; + } + + if (options.type) { + // override name property passed down so we return '' as name + results.push(GQLCapture.getResultFromMetadata2({ ...options, name: "" })); + } + + // if (returnTypeMetadata) { + // // function... + // if (returnTypeMetadata.name === "Promise") { + // fieldType = CustomFieldType.AsyncFunction; + // } else { + // fieldType = CustomFieldType.Function; + // } + + // results.push( + // GQLCapture.getResultFromMetadata(returnTypeMetadata, options), + // ); + // } else if (typeMetadata) { + // if (descriptor && descriptor.get) { + // fieldType = CustomFieldType.Accessor; + // } else if (descriptor && descriptor.value) { + // // could be implicit async + // fieldType = CustomFieldType.Function; + // } else { + // fieldType = CustomFieldType.Field; + // } + + // if ( + // !( + // options?.allowFunctionType && + // fieldType === CustomFieldType.Function && + // typeMetadata.name === "Function" + // ) + // ) { + // results.push(GQLCapture.getResultFromMetadata(typeMetadata, options)); + // } + // } + + // let params: metadataIsh[] | null = Reflect.getMetadata( + // "design:paramtypes", + // target, + // propertyKey, + // ); + + if (options.args && options.args.length) { + options.args.forEach((arg) => { + args.push(GQLCapture.getResultFromMetadata2(arg)); + }); + } + // no args for now + // if (params && params.length > 0) { + // let parsedArgs = GQLCapture.argMap.get(nodeName)?.get(propertyKey) || []; + // if (params.length !== parsedArgs.length) { + // throw new Error( + // `args were not captured correctly, ${params.length}, ${parsedArgs.length}`, + // ); + // } + // parsedArgs.forEach((arg) => { + // let param = params![arg.index]; + // let paramName = arg.name; + // let field = GQLCapture.getResultFromMetadata( + // { + // name: param.name, + // paramName, + // isContextArg: arg.isContextArg, + // }, + // arg.options, + // ); + + // // TODO this may not be the right order... + // args.push(field); + // }); + // TODO this is deterministically (so far) coming in reverse order so reverse (for now) + // args = args.reverse(); + // } + + return { + nodeName: options.nodeName, + gqlName: options?.name || ctx.name.toString(), + functionName: ctx.name.toString(), + args: args, + results: results, + fieldType: fieldType!, + description: options?.description, + }; + } + // User -> add -> [{name, options}, {}, {}] private static argMap: Map> = new Map(); @@ -718,29 +954,24 @@ export class GQLCapture { return GQLCapture.argImpl(name, undefined, options); } - static gqlContextType(): any { - // hardcoded? - return GQLCapture.argImpl("context", true, { type: "Context" }); + static gqlContextType(): gqlFieldArg { + return { + name: "context", + isContextArg: true, + type: "Context", + }; } static gqlArgType(options?: gqlObjectOptions): any { - return function ( - target: Function, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ): void { - return GQLCapture.customGQLObject(target, GQLCapture.customArgs, options); + return function (target: any, ctx: ClassDecoratorContext): void { + return GQLCapture.customGQLObject(ctx, GQLCapture.customArgs, options); }; } static gqlInputObjectType(options?: gqlObjectOptions): any { - return function ( - target: Function, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ): void { + return function (target: any, ctx: ClassDecoratorContext): void { return GQLCapture.customGQLObject( - target, + ctx, GQLCapture.customInputObjects, options, ); @@ -748,29 +979,21 @@ export class GQLCapture { } static gqlObjectType(options?: gqlObjectOptions): any { - return function ( - target: Function, - _propertyKey: string, - _descriptor: PropertyDescriptor, - ): void { - return GQLCapture.customGQLObject( - target, - GQLCapture.customObjects, - options, - ); + return function (target: any, ctx: ClassDecoratorContext): void { + return GQLCapture.customGQLObject(ctx, GQLCapture.customObjects, options); }; } private static customGQLObject( - target: Function, + ctx: ClassDecoratorContext, map: Map, options?: gqlObjectOptions, ) { - if (!GQLCapture.isEnabled()) { + if (!GQLCapture.isEnabled() || ctx.kind !== "class" || !ctx.name) { return; } - let className = target.name as string; + let className = ctx.name.toString(); let nodeName = options?.name || className; map.set(className, { @@ -782,39 +1005,30 @@ export class GQLCapture { // TODO query and mutation // we want to specify args if any, name, response if any - static gqlQuery(options?: gqlTopLevelOptions): any { - return function ( - target: Function, - propertyKey: string, - descriptor: PropertyDescriptor, - ): void { + static gqlQuery(options: gqlTopLevelOptions): any { + return function (target: Function, ctx: ClassMethodDecoratorContext): void { if (!GQLCapture.isEnabled()) { return; } - GQLCapture.customQueries.push( - GQLCapture.getCustomField(target, propertyKey, descriptor, options), - ); + GQLCapture.customQueries.push(GQLCapture.getCustomField2(ctx, options)); }; } // we want to specify inputs (required), name, response // input is via gqlArg // should it be gqlInputArg? - static gqlMutation(options?: gqlTopLevelOptions): any { - return function ( - target: Function, - propertyKey: string, - descriptor: PropertyDescriptor, - ): void { + + // type optional for this one + // but not gqlField... + static gqlMutation(options: gqlTopLevelOptions): any { + return function (target: Function, ctx: ClassMethodDecoratorContext): void { if (!GQLCapture.isEnabled()) { return; } + // TODO allowFunctionType: true... GQLCapture.customMutations.push( - GQLCapture.getCustomField(target, propertyKey, descriptor, { - ...options, - allowFunctionType: true, - }), + GQLCapture.getCustomField2(ctx, options, true), ); }; } @@ -880,7 +1094,10 @@ export class GQLCapture { // why is this a static class lol? // TODO make all these just plain functions export const gqlField = GQLCapture.gqlField; + +// TODO kill export const gqlArg = GQLCapture.gqlArg; + export const gqlArgType = GQLCapture.gqlArgType; export const gqlInputObjectType = GQLCapture.gqlInputObjectType; export const gqlObjectType = GQLCapture.gqlObjectType; diff --git a/ts/src/graphql/graphql_custom.test.ts b/ts/src/graphql/graphql_custom.test.ts index 871e9d6f2..7fd2446cb 100644 --- a/ts/src/graphql/graphql_custom.test.ts +++ b/ts/src/graphql/graphql_custom.test.ts @@ -11,7 +11,12 @@ import { gqlFileUpload, gqlConnection, } from "./graphql"; -import { GraphQLBoolean, GraphQLID } from "graphql"; +import { + GraphQLBoolean, + GraphQLID, + GraphQLScalarType, + GraphQLString, +} from "graphql"; import { ID, Viewer } from "../core/base"; import { @@ -33,237 +38,281 @@ beforeEach(() => { GQLCapture.enable(true); }); -// test("mutation with input type", async () => { -// @gqlInputObjectType({ -// name: "UserAuthInput", -// }) -// class UserAuthInput { -// @gqlField() -// emailAddress: string; - -// @gqlField() -// password: string; -// } - -// @gqlObjectType({ -// name: "UserAuthResponse", -// }) -// class UserAuthResponse { -// @gqlField() -// token: string; - -// @gqlField({ type: GraphQLID }) -// viewerID: ID; -// } - -// class UserAuth { -// // can't have decorator on a top-level function :( -// @gqlMutation({ name: "userAuth", type: UserAuthResponse }) -// async userAuth( -// @gqlArg("input") input: UserAuthInput, -// ): Promise { -// console.log(input.emailAddress); -// console.log(input.password); -// return new UserAuthResponse(); -// } -// } -// validateCustomFields([ -// { -// nodeName: "UserAuthInput", -// functionName: "emailAddress", -// gqlName: "emailAddress", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "String", -// name: "", -// }, -// ], -// args: [], -// }, -// { -// nodeName: "UserAuthInput", -// functionName: "password", -// gqlName: "password", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "String", -// name: "", -// }, -// ], -// args: [], -// }, -// { -// nodeName: "UserAuthResponse", -// functionName: "token", -// gqlName: "token", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "String", -// name: "", -// }, -// ], -// args: [], -// }, -// { -// nodeName: "UserAuthResponse", -// functionName: "viewerID", -// gqlName: "viewerID", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "ID", -// name: "", -// }, -// ], -// args: [], -// }, -// ]); - -// validateCustomInputObjects([ -// { -// nodeName: "UserAuthInput", -// className: "UserAuthInput", -// }, -// ]); - -// validateCustomObjects([ -// { -// nodeName: "UserAuthResponse", -// className: "UserAuthResponse", -// }, -// ]); - -// validateCustomMutations([ -// { -// nodeName: "UserAuth", -// functionName: "userAuth", -// gqlName: "userAuth", -// fieldType: CustomFieldType.AsyncFunction, -// results: [ -// { -// type: "UserAuthResponse", -// name: "", -// needsResolving: true, -// }, -// ], -// args: [ -// { -// type: "UserAuthInput", -// name: "input", -// needsResolving: true, -// }, -// ], -// }, -// ]); -// validateNoCustomArgs(); -// validateNoCustomQueries(); - -// GQLCapture.resolve([]); -// }); - -// test("mutation with different types", async () => { -// @gqlObjectType({ -// name: "UserAuthResponse", -// }) -// class UserAuthResponse { -// @gqlField() -// token: string; - -// @gqlField({ type: GraphQLID }) -// viewerID: ID; -// } - -// // wow this needs to be a different class name -// class UserAuth { -// // can't have decorator on a top-level function :( -// @gqlMutation({ name: "userAuth", type: UserAuthResponse }) -// // This needs to be named differently because metadata :( -// async userAuthDiff( -// @gqlArg("emailAddress") emailAddress: string, -// @gqlArg("password") password: string, -// ): Promise { -// console.log(emailAddress); -// console.log(password); -// return new UserAuthResponse(); -// } -// } -// validateCustomFields([ -// { -// nodeName: "UserAuthResponse", -// functionName: "token", -// gqlName: "token", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "String", -// name: "", -// }, -// ], -// args: [], -// }, -// { -// nodeName: "UserAuthResponse", -// functionName: "viewerID", -// gqlName: "viewerID", -// fieldType: CustomFieldType.Field, -// results: [ -// { -// type: "ID", -// name: "", -// }, -// ], -// args: [], -// }, -// ]); - -// validateCustomObjects([ -// { -// nodeName: "UserAuthResponse", -// className: "UserAuthResponse", -// }, -// ]); - -// validateCustomMutations([ -// { -// nodeName: "UserAuth", -// functionName: "userAuthDiff", -// gqlName: "userAuth", -// fieldType: CustomFieldType.AsyncFunction, -// results: [ -// { -// type: "UserAuthResponse", -// name: "", -// needsResolving: true, -// }, -// ], -// args: [ -// { -// type: "String", -// name: "emailAddress", -// }, -// { -// type: "String", -// name: "password", -// }, -// ], -// }, -// ]); - -// validateNoCustom( -// CustomObjectTypes.Field, -// CustomObjectTypes.Mutation, -// CustomObjectTypes.Object, -// ); - -// GQLCapture.resolve([]); -// }); +test("mutation with input type", async () => { + @gqlInputObjectType({ + name: "UserAuthInput", + }) + class UserAuthInput { + @gqlField({ + nodeName: "UserAuthInput", + type: GraphQLString, + }) + emailAddress: string; + + @gqlField({ + nodeName: "UserAuthInput", + type: GraphQLString, + }) + password: string; + } + + @gqlObjectType({ + name: "UserAuthResponse", + }) + class UserAuthResponse { + @gqlField({ + nodeName: "UserAuthResponse", + type: GraphQLString, + }) + token: string; + + @gqlField({ + nodeName: "UserAuthResponse", + type: GraphQLID, + }) + viewerID: ID; + } + + class UserAuth { + // can't have decorator on a top-level function :( + @gqlMutation({ + nodeName: "UserAuth", + name: "userAuth", + type: UserAuthResponse, + async: true, + args: [ + { + name: "input", + type: UserAuthInput, + }, + ], + }) + async userAuth(input: UserAuthInput): Promise { + console.log(input.emailAddress); + console.log(input.password); + return new UserAuthResponse(); + } + } + validateCustomFields([ + { + nodeName: "UserAuthInput", + functionName: "emailAddress", + gqlName: "emailAddress", + fieldType: CustomFieldType.Field, + results: [ + { + type: "String", + name: "", + }, + ], + args: [], + }, + { + nodeName: "UserAuthInput", + functionName: "password", + gqlName: "password", + fieldType: CustomFieldType.Field, + results: [ + { + type: "String", + name: "", + }, + ], + args: [], + }, + { + nodeName: "UserAuthResponse", + functionName: "token", + gqlName: "token", + fieldType: CustomFieldType.Field, + results: [ + { + type: "String", + name: "", + }, + ], + args: [], + }, + { + nodeName: "UserAuthResponse", + functionName: "viewerID", + gqlName: "viewerID", + fieldType: CustomFieldType.Field, + results: [ + { + type: "ID", + name: "", + }, + ], + args: [], + }, + ]); + + validateCustomInputObjects([ + { + nodeName: "UserAuthInput", + className: "UserAuthInput", + }, + ]); + + validateCustomObjects([ + { + nodeName: "UserAuthResponse", + className: "UserAuthResponse", + }, + ]); + + validateCustomMutations([ + { + nodeName: "UserAuth", + functionName: "userAuth", + gqlName: "userAuth", + fieldType: CustomFieldType.AsyncFunction, + results: [ + { + type: "UserAuthResponse", + name: "", + needsResolving: true, + }, + ], + args: [ + { + type: "UserAuthInput", + name: "input", + needsResolving: true, + }, + ], + }, + ]); + validateNoCustomArgs(); + validateNoCustomQueries(); + + GQLCapture.resolve([]); +}); + +test("mutation with different types", async () => { + @gqlObjectType({ + name: "UserAuthResponse", + }) + class UserAuthResponse { + @gqlField({ + nodeName: "UserAuthResponse", + type: GraphQLString, + }) + token: string; + + @gqlField({ + nodeName: "UserAuthResponse", + type: GraphQLID, + }) + viewerID: ID; + } + + // wow this needs to be a different class name + class UserAuth { + // can't have decorator on a top-level function :( + @gqlMutation({ + nodeName: "UserAuth", + name: "userAuth", + type: UserAuthResponse, + async: true, + args: [ + { + name: "emailAddress", + type: GraphQLString, + }, + { + name: "password", + type: GraphQLString, + }, + ], + }) + // This needs to be named differently because metadata :( + async userAuthDiff( + emailAddress: string, + password: string, + ): Promise { + console.log(emailAddress); + console.log(password); + return new UserAuthResponse(); + } + } + validateCustomFields([ + { + nodeName: "UserAuthResponse", + functionName: "token", + gqlName: "token", + fieldType: CustomFieldType.Field, + results: [ + { + type: "String", + name: "", + }, + ], + args: [], + }, + { + nodeName: "UserAuthResponse", + functionName: "viewerID", + gqlName: "viewerID", + fieldType: CustomFieldType.Field, + results: [ + { + type: "ID", + name: "", + }, + ], + args: [], + }, + ]); + + validateCustomObjects([ + { + nodeName: "UserAuthResponse", + className: "UserAuthResponse", + }, + ]); + + validateCustomMutations([ + { + nodeName: "UserAuth", + functionName: "userAuthDiff", + gqlName: "userAuth", + fieldType: CustomFieldType.AsyncFunction, + results: [ + { + type: "UserAuthResponse", + name: "", + needsResolving: true, + }, + ], + args: [ + { + type: "String", + name: "emailAddress", + }, + { + type: "String", + name: "password", + }, + ], + }, + ]); + + validateNoCustom( + CustomObjectTypes.Field, + CustomObjectTypes.Mutation, + CustomObjectTypes.Object, + ); + + GQLCapture.resolve([]); +}); test("mutation with no args", () => { class Logger { - @gqlMutation() + @gqlMutation({ + nodeName: "Logger", + }) logActiveUser() {} } @@ -281,158 +330,175 @@ test("mutation with no args", () => { GQLCapture.resolve([]); }); -// test("query with return type", () => { -// @gqlObjectType({ name: "Viewer" }) -// class ViewerType { -// constructor(private viewer: Viewer) {} -// @gqlField({ type: GraphQLID, nullable: true }) -// get viewerID() { -// return this.viewer.viewerID; -// } -// } - -// class ViewerResolver { -// @gqlQuery({ type: ViewerType }) -// viewer(@gqlContextType() context: RequestContext): ViewerType { -// return new ViewerType(context.getViewer()); -// } -// } - -// validateCustomQueries([ -// { -// nodeName: "ViewerResolver", -// functionName: "viewer", -// gqlName: "viewer", -// fieldType: CustomFieldType.Function, -// results: [ -// { -// type: "ViewerType", // there needs to be something else that does the translation to Viewer -// needsResolving: true, -// name: "", -// }, -// ], -// args: [ -// { -// type: "Context", -// name: "context", -// needsResolving: true, -// isContextArg: true, -// }, -// ], -// }, -// ]); - -// validateCustomObjects([ -// { -// nodeName: "Viewer", -// className: "ViewerType", -// }, -// ]); - -// validateCustomFields([ -// { -// nodeName: "ViewerType", -// functionName: "viewerID", -// gqlName: "viewerID", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "ID", -// name: "", -// nullable: true, -// }, -// ], -// args: [], -// }, -// ]); - -// validateNoCustom( -// CustomObjectTypes.Field, -// CustomObjectTypes.Object, -// CustomObjectTypes.Query, -// ); - -// GQLCapture.resolve([]); -// }); - -// test("query with list return type", () => { -// @gqlObjectType({ name: "Viewer" }) -// class ViewerType { -// constructor(private viewer: Viewer) {} -// @gqlField({ type: GraphQLID, nullable: true }) -// get viewerID() { -// return this.viewer.viewerID; -// } -// } - -// class ViewerResolver { -// @gqlQuery({ type: "[ViewerType]" }) -// viewer(@gqlContextType() context: RequestContext): [ViewerType] { -// return [new ViewerType(context.getViewer())]; -// } -// } - -// validateCustomQueries([ -// { -// nodeName: "ViewerResolver", -// functionName: "viewer", -// gqlName: "viewer", -// fieldType: CustomFieldType.Function, -// results: [ -// { -// type: "ViewerType", // there needs to be something else that does the translation to Viewer -// needsResolving: true, -// name: "", -// list: true, -// }, -// ], -// args: [ -// { -// type: "Context", -// name: "context", -// needsResolving: true, -// isContextArg: true, -// }, -// ], -// }, -// ]); - -// validateCustomObjects([ -// { -// nodeName: "Viewer", -// className: "ViewerType", -// }, -// ]); - -// validateCustomFields([ -// { -// nodeName: "ViewerType", -// functionName: "viewerID", -// gqlName: "viewerID", -// fieldType: CustomFieldType.Accessor, -// results: [ -// { -// type: "ID", -// name: "", -// nullable: true, -// }, -// ], -// args: [], -// }, -// ]); - -// validateNoCustom( -// CustomObjectTypes.Field, -// CustomObjectTypes.Object, -// CustomObjectTypes.Query, -// ); - -// GQLCapture.resolve([]); -// }); +test("query with return type", () => { + @gqlObjectType({ name: "Viewer" }) + class ViewerType { + constructor(private viewer: Viewer) {} + @gqlField({ + nodeName: "ViewerType", + type: GraphQLID, + nullable: true, + }) + get viewerID() { + return this.viewer.viewerID; + } + } + + class ViewerResolver { + @gqlQuery({ + nodeName: "ViewerResolver", + type: ViewerType, + args: [gqlContextType()], + }) + viewer(context: RequestContext): ViewerType { + return new ViewerType(context.getViewer()); + } + } + + validateCustomQueries([ + { + nodeName: "ViewerResolver", + functionName: "viewer", + gqlName: "viewer", + fieldType: CustomFieldType.Function, + results: [ + { + type: "ViewerType", // there needs to be something else that does the translation to Viewer + needsResolving: true, + name: "", + }, + ], + args: [ + { + type: "Context", + name: "context", + needsResolving: true, + isContextArg: true, + }, + ], + }, + ]); + + validateCustomObjects([ + { + nodeName: "Viewer", + className: "ViewerType", + }, + ]); + + validateCustomFields([ + { + nodeName: "ViewerType", + functionName: "viewerID", + gqlName: "viewerID", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "ID", + name: "", + nullable: true, + }, + ], + args: [], + }, + ]); + + validateNoCustom( + CustomObjectTypes.Field, + CustomObjectTypes.Object, + CustomObjectTypes.Query, + ); + + GQLCapture.resolve([]); +}); + +test("query with list return type", () => { + @gqlObjectType({ name: "Viewer" }) + class ViewerType { + constructor(private viewer: Viewer) {} + @gqlField({ + nodeName: "ViewerType", + type: GraphQLID, + nullable: true, + }) + get viewerID() { + return this.viewer.viewerID; + } + } + + class ViewerResolver { + @gqlQuery({ + nodeName: "ViewerResolver", + type: "[ViewerType]", + args: [gqlContextType()], + }) + viewer(context: RequestContext): [ViewerType] { + return [new ViewerType(context.getViewer())]; + } + } + + validateCustomQueries([ + { + nodeName: "ViewerResolver", + functionName: "viewer", + gqlName: "viewer", + fieldType: CustomFieldType.Function, + results: [ + { + type: "ViewerType", // there needs to be something else that does the translation to Viewer + needsResolving: true, + name: "", + list: true, + }, + ], + args: [ + { + type: "Context", + name: "context", + needsResolving: true, + isContextArg: true, + }, + ], + }, + ]); + + validateCustomObjects([ + { + nodeName: "Viewer", + className: "ViewerType", + }, + ]); + + validateCustomFields([ + { + nodeName: "ViewerType", + functionName: "viewerID", + gqlName: "viewerID", + fieldType: CustomFieldType.Accessor, + results: [ + { + type: "ID", + name: "", + nullable: true, + }, + ], + args: [], + }, + ]); + + validateNoCustom( + CustomObjectTypes.Field, + CustomObjectTypes.Object, + CustomObjectTypes.Query, + ); + + GQLCapture.resolve([]); +}); test("query which returns connection", async () => { class ViewerResolver { @gqlQuery({ + nodeName: "ViewerResolver", type: gqlConnection("User"), name: "peopleYouMayKnow", }) @@ -463,91 +529,105 @@ test("query which returns connection", async () => { validateNoCustom(CustomObjectTypes.Query); }); -// test("query with args which returns connection", async () => { -// class ViewerResolver { -// @gqlQuery({ -// type: gqlConnection("User"), -// name: "peopleYouMayKnow", -// }) -// pymk( -// @gqlContextType() context: RequestContext, -// @gqlArg("id", { type: GraphQLID }) id: ID, -// ) { -// return 1; -// } -// } - -// validateCustomQueries([ -// { -// nodeName: "ViewerResolver", -// functionName: "pymk", -// gqlName: "peopleYouMayKnow", -// fieldType: CustomFieldType.Function, -// results: [ -// { -// type: "User", -// needsResolving: true, -// connection: true, -// name: "", -// }, -// ], -// args: [ -// { -// type: "Context", -// isContextArg: true, -// name: "context", -// needsResolving: true, -// }, -// { -// type: "ID", -// name: "id", -// }, -// ], -// }, -// ]); - -// GQLCapture.resolve(["User"]); -// validateNoCustom(CustomObjectTypes.Query); -// }); - -// test("custom type", () => { -// class ProfilePictureUploadResolver { -// @gqlMutation({ name: "profilePictureUpload", type: GraphQLBoolean }) -// profilePictureUpload( -// @gqlContextType() context: RequestContext, -// @gqlArg("file", { type: gqlFileUpload }) file, -// ) { -// // yay successful upload -// return true; -// } -// } - -// validateCustomMutations([ -// { -// nodeName: "ProfilePictureUploadResolver", -// functionName: "profilePictureUpload", -// gqlName: "profilePictureUpload", -// fieldType: CustomFieldType.Function, -// results: [], -// args: [ -// { -// type: "Context", -// name: "context", -// needsResolving: true, -// isContextArg: true, -// }, -// { -// type: "GraphQLUpload", -// name: "file", -// needsResolving: true, -// tsType: "FileUpload", -// }, -// ], -// }, -// ]); - -// validateCustomTypes([gqlFileUpload]); - -// validateNoCustom(CustomObjectTypes.Mutation, CustomObjectTypes.CustomTypes); -// GQLCapture.resolve([]); -// }); +test("query with args which returns connection", async () => { + class ViewerResolver { + @gqlQuery({ + nodeName: "ViewerResolver", + type: gqlConnection("User"), + name: "peopleYouMayKnow", + args: [ + gqlContextType(), + { + name: "id", + type: GraphQLID, + }, + ], + }) + pymk(context: RequestContext, id: ID) { + return 1; + } + } + + validateCustomQueries([ + { + nodeName: "ViewerResolver", + functionName: "pymk", + gqlName: "peopleYouMayKnow", + fieldType: CustomFieldType.Function, + results: [ + { + type: "User", + needsResolving: true, + connection: true, + name: "", + }, + ], + args: [ + { + type: "Context", + isContextArg: true, + name: "context", + needsResolving: true, + }, + { + type: "ID", + name: "id", + }, + ], + }, + ]); + + GQLCapture.resolve(["User"]); + validateNoCustom(CustomObjectTypes.Query); +}); + +// TODO... +test.only("custom type", () => { + class ProfilePictureUploadResolver { + @gqlMutation({ + nodeName: "ProfilePictureUploadResolver", + name: "profilePictureUpload", + type: GraphQLBoolean, + args: [ + gqlContextType(), + { + name: "file", + type: gqlFileUpload, + }, + ], + }) + profilePictureUpload(context: RequestContext, file) { + // yay successful upload + return true; + } + } + + validateCustomMutations([ + { + nodeName: "ProfilePictureUploadResolver", + functionName: "profilePictureUpload", + gqlName: "profilePictureUpload", + fieldType: CustomFieldType.Function, + results: [], + args: [ + { + type: "Context", + name: "context", + needsResolving: true, + isContextArg: true, + }, + { + type: "GraphQLUpload", + name: "file", + needsResolving: true, + tsType: "FileUpload", + }, + ], + }, + ]); + + validateCustomTypes([gqlFileUpload]); + + validateNoCustom(CustomObjectTypes.Mutation, CustomObjectTypes.CustomTypes); + GQLCapture.resolve([]); +}); diff --git a/ts/src/graphql/graphql_field_helpers.ts b/ts/src/graphql/graphql_field_helpers.ts index 88aabcb66..42c8ed51b 100644 --- a/ts/src/graphql/graphql_field_helpers.ts +++ b/ts/src/graphql/graphql_field_helpers.ts @@ -39,6 +39,7 @@ function validateCustomFieldImpl( expect(customField.gqlName).toBe(expectedCustomField.gqlName); expect(customField.fieldType).toBe(expectedCustomField.fieldType); + console.log(customField.results, expectedCustomField.results); validateFields(customField.results, expectedCustomField.results); validateFields(customField.args, expectedCustomField.args); diff --git a/ts/tsconfig.json b/ts/tsconfig.json index eaad37497..778982ea1 100644 --- a/ts/tsconfig.json +++ b/ts/tsconfig.json @@ -1,18 +1,16 @@ { // TODO "compilerOptions": { - "lib": ["es2018", "esnext.asynciterable", "ES2020.String"], + "lib": ["es6", "esnext.asynciterable", "ES2020.String"], "module": "commonjs", "rootDir": "src", "outDir": "./dist", - "target": "es2020", + "target": "es6", "strictNullChecks": true, "downlevelIteration": true, "moduleResolution": "node", "baseUrl": ".", "esModuleInterop": true, - "experimentalDecorators":true, - "emitDecoratorMetadata": true, "declaration": true, "skipLibCheck": true }, From dccb6eb93109965468c0ad35a9ba35f1c301b13f Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 17:47:03 -0700 Subject: [PATCH 03/17] cleanup --- ts/src/graphql/graphql.test.ts | 95 +----- ts/src/graphql/graphql.ts | 415 +----------------------- ts/src/graphql/graphql_custom.test.ts | 19 +- ts/src/graphql/graphql_field_helpers.ts | 1 - 4 files changed, 28 insertions(+), 502 deletions(-) diff --git a/ts/src/graphql/graphql.test.ts b/ts/src/graphql/graphql.test.ts index f35ec3ebf..c045b370c 100644 --- a/ts/src/graphql/graphql.test.ts +++ b/ts/src/graphql/graphql.test.ts @@ -4,7 +4,6 @@ import { gqlArgType, CustomFieldType, gqlConnection, - gqlObjectWithFields, } from "./graphql"; import { GraphQLInt, @@ -34,6 +33,7 @@ describe("accessor", () => { class User { @gqlField({ nodeName: "User", + type: GraphQLString, }) get fullName(): string { return "fullName"; @@ -202,42 +202,6 @@ describe("accessor", () => { validateNoCustom(CustomObjectTypes.Field); }); - test("enabled. throws with number and no type", () => { - // TODO more type required and this goes way - try { - class User { - @gqlField({ - nodeName: "User", - }) - get age(): number { - return 3.2; - } - } - throw new Error("should not get here"); - } catch (e) { - expect(e.message).toMatch(/^type is required (.)+/); - } - validateNoCustom(); - }); - - test("enabled. throws with implicit type and no passed in type", () => { - // TODO more type required and this goes way - try { - class User { - @gqlField({ - nodeName: "User", - }) - get age() { - return 3.2; - } - } - throw new Error("should not get here"); - } catch (e) { - expect(e.message).toMatch(/^type is required (.)+/); - } - validateNoCustom(); - }); - test("enabled. list of strings", () => { class User { @gqlField({ @@ -464,23 +428,6 @@ describe("property", () => { validateNoCustom(CustomObjectTypes.Field); }); - test("enabled. with implicit type. no graphql type", () => { - // TODO may disappear once we have type required - try { - class User { - @gqlField({ - nodeName: "User", - }) - // lol but why? - age; - } - throw new Error("should not have gotten here"); - } catch (e) { - expect(e.message).toMatch(/^type is required (.)+/); - } - validateNoCustom(); - }); - test("enabled. custom scalar", () => { class Point { constructor(private x: number, private y: number) {} @@ -544,6 +491,7 @@ describe("function", () => { class User { @gqlField({ nodeName: "User", + type: GraphQLString, }) username(): string { return "ola"; @@ -553,7 +501,6 @@ describe("function", () => { }); test("enabled, returns string", () => { - @gqlObjectWithFields() class User { @gqlField({ nodeName: "User", @@ -563,9 +510,6 @@ describe("function", () => { return "ola"; } } - // console.log("new User"); - // const user = new User(); - // const user2 = new User(); validateOneCustomField({ nodeName: "User", @@ -661,23 +605,6 @@ describe("function", () => { validateNoCustom(CustomObjectTypes.Field); }); - test("enabled, throws for implicit return type", () => { - // TODO there's probably no need for this if type becomes required - try { - class User { - @gqlField({ - nodeName: "User", - }) - pi() { - return 3.14; - } - } - } catch (err) { - expect(err.message).toMatch(/^type is required/); - } - validateNoCustom(); - }); - test("enabled, one param", () => { class User { @gqlField({ @@ -986,24 +913,6 @@ describe("function", () => { } }); - test("enabled. async response", () => { - // TODO more type is required bye - try { - class User { - @gqlField({ - nodeName: "User", - }) - async load(): Promise { - return new User(); - } - } - throw new Error("shouldn't have gotten here"); - } catch (e) { - expect(e.message).toMatch(/^type is required/); - } - validateNoCustom(); - }); - // these next two are 'User' because of circular dependencies test("enabled. async response with type hint", () => { class User { diff --git a/ts/src/graphql/graphql.ts b/ts/src/graphql/graphql.ts index 9334a908a..76224484f 100644 --- a/ts/src/graphql/graphql.ts +++ b/ts/src/graphql/graphql.ts @@ -1,5 +1,3 @@ -// TODO delete -import "reflect-metadata"; import { GraphQLScalarType } from "graphql"; import { Data } from "../core/base"; @@ -42,7 +40,6 @@ interface gqlFieldOptions2Basics { name?: string; nullable?: boolean | NullableListOptions; description?: string; - // TODO this is probably required now... type?: Type | Array | GraphQLConnection; // types or lists of types } @@ -55,9 +52,10 @@ export interface gqlFieldOptions2 extends gqlFieldOptions2Basics { args?: gqlFieldOptions2Basics[]; result?: Field; - // defaults to Function if not provided - // fieldType?: CustomFieldType; async?: boolean; + + // required for @gqlField + type: NonNullable; } interface fieldOptions extends gqlFieldOptions { @@ -70,15 +68,11 @@ export interface gqlObjectOptions { description?: string; } -type gqlTopLevelOptions = Exclude & { - args?: gqlFieldArg[]; +type gqlMutationOptions = Omit & { + type?: gqlFieldOptions2Basics["type"]; }; -// export interface gqlTopLevelOptions -// name?: string; -// type?: Type | Array; -// description?: string; -// } +type gqlQueryOptions = Omit; export enum CustomFieldType { Accessor = "ACCESSOR", @@ -351,7 +345,6 @@ export class GQLCapture { this.customInputObjects.clear(); this.customObjects.clear(); this.customTypes.clear(); - this.argMap.clear(); } static getCustomFields(): Map { @@ -428,72 +421,7 @@ export class GQLCapture { }); } - private static getResultFromMetadata( - metadata: metadataIsh, - options?: fieldOptions, - ): Field { - let type = metadata.name; - if ((type === "Number" || type === "Object") && !options?.type) { - throw new Error( - `type is required when accessor/function/property returns a ${type}`, - ); - } - - let list: boolean | undefined; - let scalarType = false; - let connection: boolean | undefined; - - if (options?.type) { - let r: typeInfo = { type: "" }; - getType(options.type, r); - list = r.list; - scalarType = r.scalarType || false; - connection = r.connection; - type = r.type; - } - - if (knownDisAllowedNames.has(type)) { - throw new Error( - `${type} isn't a valid type for accessor/function/property`, - ); - } - - let result: Field = { - name: metadata.paramName || "", - type, - tsType: knownAllowedNames.get(type) || this.customTypes.get(type)?.tsType, - nullable: options?.nullable, - list: list, - connection: connection, - isContextArg: metadata.isContextArg, - }; - // unknown type. we need to flag that this field needs to eventually be resolved - if (!knownAllowedNames.has(type)) { - if (scalarType) { - throw new Error( - `custom scalar type ${type} is not supported this way. use CustomType syntax. see \`gqlFileUpload\` as an example`, - ); - } - result.needsResolving = true; - } - return result; - } - - // TODO rename - private static getResultFromMetadata2( - // target: Function, - // metadata: metadataIsh, - // options?: gqlFieldOptions2, - // field?: Field, - field: gqlFieldOptions2Basics | gqlFieldArg, - ): Field { - // let type = metadata.name; - // if ((type === "Number" || type === "Object") && !options?.type) { - // throw new Error( - // `type is required when accessor/function/property returns a ${type}`, - // ); - // } - + private static getField(field: gqlFieldOptions2Basics | gqlFieldArg): Field { let list: boolean | undefined; let scalarType = false; let connection: boolean | undefined; @@ -540,45 +468,14 @@ export class GQLCapture { return result; } - // ToDO this doesn't work... - static gqlObjectWithFields() { - return function (val, ctx: ClassDecoratorContext) { - if (!GQLCapture.isEnabled() || ctx.kind !== "class") { - return; - } - ctx.addInitializer(function () { - // console.log("initializer"); - }); - // console.log("gsfsf", val.prototype, ctx); - - // let typeMetadata: metadataIsh | null = Reflect.getMetadata( - // "design:type", - // val.prototype, - // "username", - // // "method", - // // ctx.name, - // ); - - // let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( - // "design:returntype", - // val.prototype, - // "username", - // // "method", - // // ctx.name, - // ); - // console.log(val, val.prototype); - }; - } static gqlField(options: gqlFieldOptions2): any { - // hah, arguments change in 2.0 return function ( - target: any, + _target: any, ctx: | ClassMethodDecoratorContext | ClassFieldDecoratorContext | ClassGetterDecoratorContext, ) { - // console.log(ctx.kind); if ( !GQLCapture.isEnabled() || (ctx.kind !== "method" && @@ -590,60 +487,7 @@ export class GQLCapture { return; } - // ok, have to specify the type info - // CANNOT get the name of the class without some magic or instantiating... - - // console.log(target, ctx.access.get(target)); - // for (const k in target) { - // console.log("prop", k, target[k]); - // } - - ctx.addInitializer(function () { - console.log("function initializer"); - // @ts-ignore - if (!this.collectedMethodKeys) { - // @ts-ignore - this.collectedMethodKeys = new Set(); - } - // @ts-ignore - this.collectedMethodKeys.add(ctx.name); - - // this in here is the class instance - console.log(this); - console.log(target, ctx.access.get(this)); - }); - - // console.log( - // originalMethod, - // "propertyKey", - // propertyKey, - // "descriptior", - // descriptor, - // ); - - // this isn't helpful because we don't have access to ars... - // return function (this: any, ...args: any[]) { - // console.log("gqlField", originalMethod, ctx, args); - // return originalMethod.call(this, args); - // }; - - // console.log( - // "enabled", - // // originalMethod.arguments, - // // typeof originalMethod, - // // ctx.name, - // // ctx.kind, - // // typeMetadata, - // // returnTypeMetadata, - // ); - let customField = GQLCapture.getCustomField2( - ctx, - options, - // propertyKey, - // descriptor, - // options, - ); - // console.log(customField); + let customField = GQLCapture.getCustomField(ctx, options); if (!customField) { return; } @@ -681,132 +525,19 @@ export class GQLCapture { } private static getCustomField( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - options?: fieldOptions, - ): CustomField { - let fieldType: CustomFieldType; - let nodeName = target.constructor.name as string; - - let args: Field[] = []; - let results: Field[] = []; - - let typeMetadata: metadataIsh | null = Reflect.getMetadata( - "design:type", - target, - propertyKey, - ); - let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( - "design:returntype", - target, - propertyKey, - ); - - if (returnTypeMetadata) { - // function... - if (returnTypeMetadata.name === "Promise") { - fieldType = CustomFieldType.AsyncFunction; - } else { - fieldType = CustomFieldType.Function; - } - - results.push( - GQLCapture.getResultFromMetadata(returnTypeMetadata, options), - ); - } else if (typeMetadata) { - if (descriptor && descriptor.get) { - fieldType = CustomFieldType.Accessor; - } else if (descriptor && descriptor.value) { - // could be implicit async - fieldType = CustomFieldType.Function; - } else { - fieldType = CustomFieldType.Field; - } - - if ( - !( - options?.allowFunctionType && - fieldType === CustomFieldType.Function && - typeMetadata.name === "Function" - ) - ) { - results.push(GQLCapture.getResultFromMetadata(typeMetadata, options)); - } - } - - let params: metadataIsh[] | null = Reflect.getMetadata( - "design:paramtypes", - target, - propertyKey, - ); - - if (params && params.length > 0) { - let parsedArgs = GQLCapture.argMap.get(nodeName)?.get(propertyKey) || []; - if (params.length !== parsedArgs.length) { - throw new Error( - `args were not captured correctly, ${params.length}, ${parsedArgs.length}`, - ); - } - parsedArgs.forEach((arg) => { - let param = params![arg.index]; - let paramName = arg.name; - let field = GQLCapture.getResultFromMetadata( - { - name: param.name, - paramName, - isContextArg: arg.isContextArg, - }, - arg.options, - ); - - // TODO this may not be the right order... - args.push(field); - }); - // TODO this is deterministically (so far) coming in reverse order so reverse (for now) - args = args.reverse(); - } - - return { - nodeName: nodeName, - gqlName: options?.name || propertyKey, - functionName: propertyKey, - args: args, - results: results, - fieldType: fieldType!, - description: options?.description, - }; - } - - private static getCustomField2( ctx: | ClassMethodDecoratorContext | ClassFieldDecoratorContext | ClassGetterDecoratorContext, - options: gqlFieldOptions2, + options: gqlFieldOptions2 | gqlMutationOptions | gqlQueryOptions, + // TODO use this and throw if type-system is bypassed with no type allowNoReturnType?: boolean, - // propertyKey: string, - // descriptor: PropertyDescriptor, - // options?: fieldOptions, ): CustomField { let fieldType: CustomFieldType; - // let nodeName = target.constructor.name as string; let args: Field[] = []; let results: Field[] = []; - // let typeMetadata: metadataIsh | null = Reflect.getMetadata( - // "design:type", - // target, - // propertyKey, - // ); - // let returnTypeMetadata: metadataIsh | null = Reflect.getMetadata( - // "design:returntype", - // target, - // propertyKey, - // ); - - // TODO other types switch (ctx.kind) { case "method": fieldType = CustomFieldType.Function; @@ -826,78 +557,14 @@ export class GQLCapture { if (options.type) { // override name property passed down so we return '' as name - results.push(GQLCapture.getResultFromMetadata2({ ...options, name: "" })); + results.push(GQLCapture.getField({ ...options, name: "" })); } - // if (returnTypeMetadata) { - // // function... - // if (returnTypeMetadata.name === "Promise") { - // fieldType = CustomFieldType.AsyncFunction; - // } else { - // fieldType = CustomFieldType.Function; - // } - - // results.push( - // GQLCapture.getResultFromMetadata(returnTypeMetadata, options), - // ); - // } else if (typeMetadata) { - // if (descriptor && descriptor.get) { - // fieldType = CustomFieldType.Accessor; - // } else if (descriptor && descriptor.value) { - // // could be implicit async - // fieldType = CustomFieldType.Function; - // } else { - // fieldType = CustomFieldType.Field; - // } - - // if ( - // !( - // options?.allowFunctionType && - // fieldType === CustomFieldType.Function && - // typeMetadata.name === "Function" - // ) - // ) { - // results.push(GQLCapture.getResultFromMetadata(typeMetadata, options)); - // } - // } - - // let params: metadataIsh[] | null = Reflect.getMetadata( - // "design:paramtypes", - // target, - // propertyKey, - // ); - if (options.args && options.args.length) { options.args.forEach((arg) => { - args.push(GQLCapture.getResultFromMetadata2(arg)); + args.push(GQLCapture.getField(arg)); }); } - // no args for now - // if (params && params.length > 0) { - // let parsedArgs = GQLCapture.argMap.get(nodeName)?.get(propertyKey) || []; - // if (params.length !== parsedArgs.length) { - // throw new Error( - // `args were not captured correctly, ${params.length}, ${parsedArgs.length}`, - // ); - // } - // parsedArgs.forEach((arg) => { - // let param = params![arg.index]; - // let paramName = arg.name; - // let field = GQLCapture.getResultFromMetadata( - // { - // name: param.name, - // paramName, - // isContextArg: arg.isContextArg, - // }, - // arg.options, - // ); - - // // TODO this may not be the right order... - // args.push(field); - // }); - // TODO this is deterministically (so far) coming in reverse order so reverse (for now) - // args = args.reverse(); - // } return { nodeName: options.nodeName, @@ -910,50 +577,6 @@ export class GQLCapture { }; } - // User -> add -> [{name, options}, {}, {}] - private static argMap: Map> = new Map(); - - private static argImpl( - name: string, - isContextArg?: boolean, - options?: gqlFieldOptions, - ): any { - return function ( - target: any, - propertyKey: string, - index: number, // not PropertyKeyDescriptor? - ): void { - if (!GQLCapture.isEnabled()) { - return; - } - - let nodeName = target.constructor.name as string; - let m = GQLCapture.argMap.get(nodeName); - if (!m) { - m = new Map(); - GQLCapture.argMap.set(nodeName, m); - } - let propertyMap = m.get(propertyKey); - if (!propertyMap) { - propertyMap = []; - m.set(propertyKey, propertyMap); - } - propertyMap.push({ - name: name, - index: index, - options: options, - isContextArg, - }); - - // console.log("arg", name, target, propertyKey, index); - }; - } - - // TODO custom args because for example name doesn't make sense here. - static gqlArg(name: string, options?: gqlFieldOptions): any { - return GQLCapture.argImpl(name, undefined, options); - } - static gqlContextType(): gqlFieldArg { return { name: "context", @@ -1005,13 +628,13 @@ export class GQLCapture { // TODO query and mutation // we want to specify args if any, name, response if any - static gqlQuery(options: gqlTopLevelOptions): any { + static gqlQuery(options: gqlQueryOptions): any { return function (target: Function, ctx: ClassMethodDecoratorContext): void { if (!GQLCapture.isEnabled()) { return; } - GQLCapture.customQueries.push(GQLCapture.getCustomField2(ctx, options)); + GQLCapture.customQueries.push(GQLCapture.getCustomField(ctx, options)); }; } // we want to specify inputs (required), name, response @@ -1020,7 +643,7 @@ export class GQLCapture { // type optional for this one // but not gqlField... - static gqlMutation(options: gqlTopLevelOptions): any { + static gqlMutation(options: gqlMutationOptions): any { return function (target: Function, ctx: ClassMethodDecoratorContext): void { if (!GQLCapture.isEnabled()) { return; @@ -1028,7 +651,7 @@ export class GQLCapture { // TODO allowFunctionType: true... GQLCapture.customMutations.push( - GQLCapture.getCustomField2(ctx, options, true), + GQLCapture.getCustomField(ctx, options, true), ); }; } @@ -1095,9 +718,6 @@ export class GQLCapture { // TODO make all these just plain functions export const gqlField = GQLCapture.gqlField; -// TODO kill -export const gqlArg = GQLCapture.gqlArg; - export const gqlArgType = GQLCapture.gqlArgType; export const gqlInputObjectType = GQLCapture.gqlInputObjectType; export const gqlObjectType = GQLCapture.gqlObjectType; @@ -1105,7 +725,6 @@ export const gqlQuery = GQLCapture.gqlQuery; export const gqlMutation = GQLCapture.gqlMutation; export const gqlContextType = GQLCapture.gqlContextType; export const gqlConnection = GQLCapture.gqlConnection; -export const gqlObjectWithFields = GQLCapture.gqlObjectWithFields; // this requires the developer to npm-install "graphql-upload on their own" const gqlFileUpload: CustomType = { diff --git a/ts/src/graphql/graphql_custom.test.ts b/ts/src/graphql/graphql_custom.test.ts index 7fd2446cb..7025c7c51 100644 --- a/ts/src/graphql/graphql_custom.test.ts +++ b/ts/src/graphql/graphql_custom.test.ts @@ -1,6 +1,5 @@ import { gqlField, - gqlArg, GQLCapture, CustomFieldType, gqlMutation, @@ -11,12 +10,7 @@ import { gqlFileUpload, gqlConnection, } from "./graphql"; -import { - GraphQLBoolean, - GraphQLID, - GraphQLScalarType, - GraphQLString, -} from "graphql"; +import { GraphQLBoolean, GraphQLID, GraphQLString } from "graphql"; import { ID, Viewer } from "../core/base"; import { @@ -581,8 +575,7 @@ test("query with args which returns connection", async () => { validateNoCustom(CustomObjectTypes.Query); }); -// TODO... -test.only("custom type", () => { +test("custom type", () => { class ProfilePictureUploadResolver { @gqlMutation({ nodeName: "ProfilePictureUploadResolver", @@ -608,7 +601,13 @@ test.only("custom type", () => { functionName: "profilePictureUpload", gqlName: "profilePictureUpload", fieldType: CustomFieldType.Function, - results: [], + results: [ + { + type: "Boolean", + name: "", + tsType: "boolean", + }, + ], args: [ { type: "Context", diff --git a/ts/src/graphql/graphql_field_helpers.ts b/ts/src/graphql/graphql_field_helpers.ts index 42c8ed51b..88aabcb66 100644 --- a/ts/src/graphql/graphql_field_helpers.ts +++ b/ts/src/graphql/graphql_field_helpers.ts @@ -39,7 +39,6 @@ function validateCustomFieldImpl( expect(customField.gqlName).toBe(expectedCustomField.gqlName); expect(customField.fieldType).toBe(expectedCustomField.fieldType); - console.log(customField.results, expectedCustomField.results); validateFields(customField.results, expectedCustomField.results); validateFields(customField.args, expectedCustomField.args); From 795e7ae09d18fb59760d49bd8a1ebbd2cee0a463 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 17:52:10 -0700 Subject: [PATCH 04/17] . --- ts/src/graphql/index.ts | 1 - ts/src/imports/dataz/example1/_auth.ts | 35 ++++++++++++++++++------ ts/src/imports/dataz/example1/_viewer.ts | 6 +++- ts/tsconfig.json | 4 +-- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/ts/src/graphql/index.ts b/ts/src/graphql/index.ts index 097151e01..1e6c920f7 100644 --- a/ts/src/graphql/index.ts +++ b/ts/src/graphql/index.ts @@ -2,7 +2,6 @@ export { gqlFieldOptions, gqlObjectOptions, gqlField, - gqlArg, gqlArgType, gqlInputObjectType, gqlObjectType, diff --git a/ts/src/imports/dataz/example1/_auth.ts b/ts/src/imports/dataz/example1/_auth.ts index 10cb01e56..217fb4959 100644 --- a/ts/src/imports/dataz/example1/_auth.ts +++ b/ts/src/imports/dataz/example1/_auth.ts @@ -2,33 +2,50 @@ import { gqlInputObjectType, gqlField, gqlMutation, - gqlArg, gqlObjectType, } from "../../../graphql/graphql"; import { ID } from "../../../core/base"; -import { GraphQLID } from "graphql"; +import { GraphQLID, GraphQLString } from "graphql"; @gqlInputObjectType() class UserAuthInput { - @gqlField() + @gqlField({ + nodeName: "UserAuthInput", + type: GraphQLString, + }) emailAddress: string; - @gqlField() + @gqlField({ + nodeName: "UserAuthInput", + type: GraphQLString, + }) password: string; } @gqlObjectType() class UserAuthResponse { - @gqlField() + @gqlField({ + nodeName: "UserAuthResponse", + type: GraphQLString, + }) token: string; - @gqlField({ type: GraphQLID }) + @gqlField({ nodeName: "UserAuthResponses", type: GraphQLID }) viewerID: ID; } class AuthResolver { - @gqlMutation({ name: "userAuth", type: UserAuthResponse }) - async userAuth(): // @gqlArg("input") input: UserAuthInput, - Promise { + @gqlMutation({ + nodeName: "AuthResolver", + name: "userAuth", + type: UserAuthResponse, + args: [ + { + name: "input", + type: UserAuthInput, + }, + ], + }) + async userAuth(input: UserAuthInput): Promise { throw new Error("not implemented"); } } diff --git a/ts/src/imports/dataz/example1/_viewer.ts b/ts/src/imports/dataz/example1/_viewer.ts index 58147583d..e1a92483e 100644 --- a/ts/src/imports/dataz/example1/_viewer.ts +++ b/ts/src/imports/dataz/example1/_viewer.ts @@ -12,7 +12,11 @@ import { RequestContext } from "../../../core/context"; class ViewerType { constructor(private viewer: Viewer) {} - @gqlField({ type: GraphQLID, nullable: true }) + @gqlField({ + nodeName: "ViewerType", + type: GraphQLID, + nullable: true, + }) get viewerID() { return this.viewer.viewerID; } diff --git a/ts/tsconfig.json b/ts/tsconfig.json index 778982ea1..009065f4b 100644 --- a/ts/tsconfig.json +++ b/ts/tsconfig.json @@ -1,11 +1,11 @@ { // TODO "compilerOptions": { - "lib": ["es6", "esnext.asynciterable", "ES2020.String"], + "lib": ["es2018", "esnext.asynciterable", "ES2020.String"], "module": "commonjs", "rootDir": "src", "outDir": "./dist", - "target": "es6", + "target": "es2020", "strictNullChecks": true, "downlevelIteration": true, "moduleResolution": "node", From 815db3dcd37990bc3bf8413c0c54a995d5bd1cb9 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 18:24:27 -0700 Subject: [PATCH 05/17] typescript API breaking changes --- ts/src/scripts/custom_compiler.ts | 7 +++---- ts/src/scripts/move_types.ts | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ts/src/scripts/custom_compiler.ts b/ts/src/scripts/custom_compiler.ts index 079a73255..493a0a8aa 100644 --- a/ts/src/scripts/custom_compiler.ts +++ b/ts/src/scripts/custom_compiler.ts @@ -270,7 +270,6 @@ class Compiler { // update the node... return ts.factory.updateImportDeclaration( importNode, - importNode.decorators, importNode.modifiers, importNode.importClause, ts.factory.createStringLiteral(relPath), @@ -287,13 +286,13 @@ class Compiler { let relPath = checkPath(paths, text); if (relPath) { // update the node... - return ts.updateExportDeclaration( + return ts.factory.updateExportDeclaration( exportNode, - exportNode.decorators, exportNode.modifiers, + exportNode.isTypeOnly, exportNode.exportClause, ts.factory.createStringLiteral(relPath), - exportNode.isTypeOnly, + exportNode.assertClause, ); } } diff --git a/ts/src/scripts/move_types.ts b/ts/src/scripts/move_types.ts index a0e4d4518..a36440679 100644 --- a/ts/src/scripts/move_types.ts +++ b/ts/src/scripts/move_types.ts @@ -17,7 +17,11 @@ class GatherExportsInGeneratedTypes implements TransformFile { file: string, node: ts.Node, ) { - const exported = node.modifiers?.filter( + const modifiers = ts.canHaveModifiers(node) + ? ts.getModifiers(node) + : undefined; + + const exported = modifiers?.filter( (mod) => mod.getText(sourceFile) === "export", ); From 99f3617391d04d266793280a431f40ec01e8adb5 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 18:27:26 -0700 Subject: [PATCH 06/17] broken test --- ts/src/imports/dataz/example1/_viewer.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ts/src/imports/dataz/example1/_viewer.ts b/ts/src/imports/dataz/example1/_viewer.ts index e1a92483e..283b9a53b 100644 --- a/ts/src/imports/dataz/example1/_viewer.ts +++ b/ts/src/imports/dataz/example1/_viewer.ts @@ -22,10 +22,14 @@ class ViewerType { } } -// export default class ViewerResolver { -// @gqlQuery({ name: "viewer", type: ViewerType }) -// viewer(): // @gqlContextType() context: RequestContext -// ViewerType { -// return new ViewerType(context.getViewer()); -// } -// } +export default class ViewerResolver { + @gqlQuery({ + nodeName: "ViewerResolver", + name: "viewer", + type: ViewerType, + args: [gqlContextType()], + }) + viewer(context: RequestContext): ViewerType { + return new ViewerType(context.getViewer()); + } +} From 381f81dc011505bb01cc8055628a600883b88651 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 18:28:54 -0700 Subject: [PATCH 07/17] update --- ts/package-lock.json | 11 ----------- ts/package.json | 1 - 2 files changed, 12 deletions(-) diff --git a/ts/package-lock.json b/ts/package-lock.json index 741e8305a..57160bbd3 100644 --- a/ts/package-lock.json +++ b/ts/package-lock.json @@ -23,7 +23,6 @@ "pascal-case": "^3.1.2", "pg": "^8.8.0", "prettier": "^2.8.1", - "reflect-metadata": "^0.1.13", "snake-case": "^3.0.4", "ts-node": "^10.9.1", "tsconfig-paths": "^4.1.1", @@ -5521,11 +5520,6 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -10887,11 +10881,6 @@ } } }, - "reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", diff --git a/ts/package.json b/ts/package.json index 7c158277e..16bfd30ec 100644 --- a/ts/package.json +++ b/ts/package.json @@ -22,7 +22,6 @@ "pascal-case": "^3.1.2", "pg": "^8.8.0", "prettier": "^2.8.1", - "reflect-metadata": "^0.1.13", "snake-case": "^3.0.4", "ts-node": "^10.9.1", "tsconfig-paths": "^4.1.1", From 0338f401334b56a1324cae0e85d59d313235b19f Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 21:36:39 -0700 Subject: [PATCH 08/17] cleanup --- ts/src/graphql/graphql.ts | 67 +++++++-------------------------------- 1 file changed, 12 insertions(+), 55 deletions(-) diff --git a/ts/src/graphql/graphql.ts b/ts/src/graphql/graphql.ts index 76224484f..172ba5c1a 100644 --- a/ts/src/graphql/graphql.ts +++ b/ts/src/graphql/graphql.ts @@ -28,39 +28,25 @@ type Type = GraphQLScalarType | ClassType | string | CustomType; // node in a connection export type GraphQLConnection = { node: T }; -// TODO replace and deprecate -export interface gqlFieldOptions { +interface gqlFieldOptionsBase { name?: string; nullable?: boolean | NullableListOptions; description?: string; type?: Type | Array | GraphQLConnection; // types or lists of types } -interface gqlFieldOptions2Basics { - name?: string; - nullable?: boolean | NullableListOptions; - description?: string; - type?: Type | Array | GraphQLConnection; // types or lists of types -} - -interface gqlFieldArg extends gqlFieldOptions2Basics { +interface gqlFieldArg extends gqlFieldOptionsBase { isContextArg?: boolean; } -export interface gqlFieldOptions2 extends gqlFieldOptions2Basics { +export interface gqlFieldOptions extends gqlFieldOptionsBase { nodeName: string; - args?: gqlFieldOptions2Basics[]; - result?: Field; + args?: gqlFieldArg[]; async?: boolean; // required for @gqlField - type: NonNullable; -} - -interface fieldOptions extends gqlFieldOptions { - // implies no return type... - allowFunctionType?: boolean; + type: NonNullable; } export interface gqlObjectOptions { @@ -68,11 +54,11 @@ export interface gqlObjectOptions { description?: string; } -type gqlMutationOptions = Omit & { - type?: gqlFieldOptions2Basics["type"]; +type gqlMutationOptions = Omit & { + type?: gqlFieldOptionsBase["type"]; }; -type gqlQueryOptions = Omit; +type gqlQueryOptions = Omit; export enum CustomFieldType { Accessor = "ACCESSOR", @@ -120,16 +106,6 @@ export interface CustomObject { description?: string; } -// export interface CustomArg { -// nodeName: string; -// className: string; // TODO both the same right now... -// } - -// export interface CustomInputObject { -// nodeName: string; -// className: string; // TODO both the same right now -// } - type NullableListOptions = "contents" | "contentsAndList"; interface FieldImpl { @@ -162,19 +138,6 @@ enum NullableResult { ITEM = "true", // nullable = true } -interface arg { - name: string; - index: number; - options?: gqlFieldOptions; - isContextArg?: boolean; -} - -interface metadataIsh { - name: string; // the type - paramName?: string; - isContextArg?: boolean; -} - export const knownAllowedNames: Map = new Map([ ["Date", "Date"], ["Boolean", "boolean"], @@ -421,7 +384,7 @@ export class GQLCapture { }); } - private static getField(field: gqlFieldOptions2Basics | gqlFieldArg): Field { + private static getField(field: gqlFieldOptionsBase | gqlFieldArg): Field { let list: boolean | undefined; let scalarType = false; let connection: boolean | undefined; @@ -468,7 +431,7 @@ export class GQLCapture { return result; } - static gqlField(options: gqlFieldOptions2): any { + static gqlField(options: gqlFieldOptions): any { return function ( _target: any, ctx: @@ -529,7 +492,7 @@ export class GQLCapture { | ClassMethodDecoratorContext | ClassFieldDecoratorContext | ClassGetterDecoratorContext, - options: gqlFieldOptions2 | gqlMutationOptions | gqlQueryOptions, + options: gqlFieldOptions | gqlMutationOptions | gqlQueryOptions, // TODO use this and throw if type-system is bypassed with no type allowNoReturnType?: boolean, ): CustomField { @@ -560,7 +523,7 @@ export class GQLCapture { results.push(GQLCapture.getField({ ...options, name: "" })); } - if (options.args && options.args.length) { + if (options.args?.length) { options.args.forEach((arg) => { args.push(GQLCapture.getField(arg)); }); @@ -626,7 +589,6 @@ export class GQLCapture { }); } - // TODO query and mutation // we want to specify args if any, name, response if any static gqlQuery(options: gqlQueryOptions): any { return function (target: Function, ctx: ClassMethodDecoratorContext): void { @@ -637,12 +599,7 @@ export class GQLCapture { GQLCapture.customQueries.push(GQLCapture.getCustomField(ctx, options)); }; } - // we want to specify inputs (required), name, response - // input is via gqlArg - // should it be gqlInputArg? - // type optional for this one - // but not gqlField... static gqlMutation(options: gqlMutationOptions): any { return function (target: Function, ctx: ClassMethodDecoratorContext): void { if (!GQLCapture.isEnabled()) { From 947b5c3d8c665bf5d9ee91d6e88bf8759a86f256 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 21:42:19 -0700 Subject: [PATCH 09/17] . --- ts/src/graphql/graphql.test.ts | 64 ++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/ts/src/graphql/graphql.test.ts b/ts/src/graphql/graphql.test.ts index c045b370c..33ee86662 100644 --- a/ts/src/graphql/graphql.test.ts +++ b/ts/src/graphql/graphql.test.ts @@ -20,6 +20,7 @@ import { validateCustomFields, validateNoCustom, validateCustomArgs, + validateCustomTypes, } from "./graphql_field_helpers"; beforeEach(() => { @@ -428,7 +429,7 @@ describe("property", () => { validateNoCustom(CustomObjectTypes.Field); }); - test("enabled. custom scalar", () => { + describe("enabled. custom scalar", () => { class Point { constructor(private x: number, private y: number) {} @@ -465,23 +466,64 @@ describe("property", () => { }, }); - try { + test("enabled. custom scalar used incorrectly", () => { + try { + class User { + @gqlField({ + nodeName: "User", + type: GraphQLPoint, + }) + point: Point; + } + throw new Error("should not get here"); + } catch (e) { + expect(e.message).toMatch( + /custom scalar type Point is not supported this way. use CustomType syntax/, + ); + } + + validateNoCustom(); + }); + + test("enabled. custom scalar used correctly", () => { class User { @gqlField({ nodeName: "User", - type: GraphQLPoint, + type: { + type: "GraphQLPoint", + importPath: "", + tsType: "Point", + tsImportPath: "", + }, }) point: Point; } - throw new Error("should not get here"); - } catch (e) { - // TODO have we confirmed it works with CustomType syntax? - expect(e.message).toMatch( - /custom scalar type Point is not supported this way. use CustomType syntax/, - ); - } - validateNoCustom(); + validateOneCustomField({ + nodeName: "User", + functionName: "point", + gqlName: "point", + fieldType: CustomFieldType.Field, + results: [ + { + type: "GraphQLPoint", + name: "", + tsType: "Point", + needsResolving: true, + }, + ], + args: [], + }); + + validateCustomTypes([ + { + type: "GraphQLPoint", + importPath: "", + tsType: "Point", + tsImportPath: "", + }, + ]); + }); }); }); From efd60ae377c327d926ae6bde13b636e8e7c78ec5 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Wed, 3 May 2023 21:44:13 -0700 Subject: [PATCH 10/17] . --- ts/src/graphql/graphql.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ts/src/graphql/graphql.ts b/ts/src/graphql/graphql.ts index 172ba5c1a..db633dc57 100644 --- a/ts/src/graphql/graphql.ts +++ b/ts/src/graphql/graphql.ts @@ -493,7 +493,6 @@ export class GQLCapture { | ClassFieldDecoratorContext | ClassGetterDecoratorContext, options: gqlFieldOptions | gqlMutationOptions | gqlQueryOptions, - // TODO use this and throw if type-system is bypassed with no type allowNoReturnType?: boolean, ): CustomField { let fieldType: CustomFieldType; @@ -518,6 +517,9 @@ export class GQLCapture { break; } + if (!allowNoReturnType && !options.type) { + throw new Error(`type is required for ${fieldType}`); + } if (options.type) { // override name property passed down so we return '' as name results.push(GQLCapture.getField({ ...options, name: "" })); @@ -606,7 +608,6 @@ export class GQLCapture { return; } - // TODO allowFunctionType: true... GQLCapture.customMutations.push( GQLCapture.getCustomField(ctx, options, true), ); From 952a3824fdde715af9e3a3ca8a988c022a9a1ffb Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Thu, 4 May 2023 10:10:37 -0700 Subject: [PATCH 11/17] publish + use in example --- examples/simple/ent.yml | 1 - examples/simple/package-lock.json | 2059 ++--------------- examples/simple/package.json | 6 +- examples/simple/src/ent/contact.ts | 12 +- examples/simple/src/ent/user.ts | 42 +- .../src/ent/user/query/user_to_likes_query.ts | 9 +- .../user/user_to_likes_connection_type.ts | 10 +- .../simple/src/graphql/generated/schema.gql | 2 +- examples/simple/src/graphql/mutations/auth.ts | 74 +- .../src/graphql/mutations/import_contact.ts | 24 +- .../simple/src/graphql/resolvers/viewer.ts | 40 +- .../simple/src/schema/custom_graphql.json | 285 --- examples/simple/tsconfig.json | 2 - internal/codegen/codegen_processor.go | 11 +- internal/graphql/generate_ts_code.go | 1 + internal/schema/compare_schema.go | 2 +- ts/package-lock.json | 22 +- ts/package.json | 4 +- ts/src/graphql/graphql.ts | 1 + 19 files changed, 437 insertions(+), 2170 deletions(-) delete mode 100644 examples/simple/src/schema/custom_graphql.json diff --git a/examples/simple/ent.yml b/examples/simple/ent.yml index 292863c4d..e090f0bce 100644 --- a/examples/simple/ent.yml +++ b/examples/simple/ent.yml @@ -11,7 +11,6 @@ # defaultActionPolicy: # path: '@snowtop/ent' # policyName: 'AlwaysAllowPrivacyPolicy' -customGraphQLJSONPath: "src/schema/custom_graphql.json" dynamicScriptCustomGraphQLJSONPath: 'src/scripts/custom_queries.ts' codegen: relativeImports: true diff --git a/examples/simple/package-lock.json b/examples/simple/package-lock.json index 9378784f7..e1410125b 100644 --- a/examples/simple/package-lock.json +++ b/examples/simple/package-lock.json @@ -9,11 +9,12 @@ "version": "0.0.1", "license": "ISC", "dependencies": { - "@snowtop/ent": "^0.1.0-alpha117", + "@snowtop/ent": "^0.1.0-alpha126", "@snowtop/ent-email": "^0.1.0-alpha1", "@snowtop/ent-passport": "^0.1.0-alpha3", "@snowtop/ent-password": "^0.1.0-alpha1", "@snowtop/ent-phonenumber": "^0.1.0-alpha1", + "@swc/core": "^1.3.56", "@types/express-session": "^1.17.3", "@types/graphql-upload": "^8.0.11", "@types/luxon": "^3.2.0", @@ -37,7 +38,6 @@ "passport-jwt": "^4.0.0", "passport-local": "^1.0.0", "passport-strategy": "^1.0.0", - "swc": "^1.0.11", "uuid": "^8.3.2" }, "devDependencies": { @@ -52,7 +52,7 @@ "jest-date-mock": "^1.0.8", "jest-expect-message": "^1.1.3", "supertest": "^6.1.3", - "ts-jest": "^29.0.3", + "ts-jest": "^29.1.0", "tsconfig-paths": "^3.11.0" } }, @@ -1108,73 +1108,12 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, - "node_modules/@mole-inc/bin-wrapper": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@mole-inc/bin-wrapper/-/bin-wrapper-8.0.1.tgz", - "integrity": "sha512-sTGoeZnjI8N4KS+sW2AN95gDBErhAguvkw/tWdCjeM8bvxpz5lqrnd0vOJABA1A+Ic3zED7PYoLP/RANLgVotA==", - "dependencies": { - "bin-check": "^4.1.0", - "bin-version-check": "^5.0.0", - "content-disposition": "^0.5.4", - "ext-name": "^5.0.0", - "file-type": "^17.1.6", - "filenamify": "^5.0.2", - "got": "^11.8.5", - "os-filter-obj": "^2.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/@sinclair/typebox": { "version": "0.24.51", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", "integrity": "sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA==", "dev": true }, - "node_modules/@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" - } - }, "node_modules/@sinonjs/commons": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.5.tgz", @@ -1194,9 +1133,9 @@ } }, "node_modules/@snowtop/ent": { - "version": "0.1.0-alpha117", - "resolved": "https://registry.npmjs.org/@snowtop/ent/-/ent-0.1.0-alpha117.tgz", - "integrity": "sha512-Khr+C4RPHNt28VcAIvGGSNbJsKSe037NlRlG7CL+70fOAxLh4LnIv6dkQWMAwAE2y85/6/E0hO+sFmEyeoWOsg==", + "version": "0.1.0-alpha126", + "resolved": "https://registry.npmjs.org/@snowtop/ent/-/ent-0.1.0-alpha126.tgz", + "integrity": "sha512-bK8Qrx5ZWpF3pn1MMjuRGRYahBqkRd2dK8EsTyajKH4jjtQea0PSwwIs0kLI5lMtCCLMtPJ3DaZbFI6BPff72g==", "dependencies": { "@types/node": "^18.11.18", "camel-case": "^4.1.2", @@ -1212,12 +1151,11 @@ "pascal-case": "^3.1.2", "pg": "^8.8.0", "prettier": "^2.8.1", - "reflect-metadata": "^0.1.13", "snake-case": "^3.0.4", "ts-node": "^10.9.1", - "tsconfig-paths": "^4.1.1", - "tslib": "^2.4.1", - "typescript": "^4.9.4", + "tsconfig-paths": "^4.2.0", + "tslib": "^2.5.0", + "typescript": "^5.0.4", "uuid": "^9.0.0" }, "bin": { @@ -1316,9 +1254,9 @@ } }, "node_modules/@snowtop/ent/node_modules/tsconfig-paths": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.1.2.tgz", - "integrity": "sha512-uhxiMgnXQp1IR622dUXI+9Ehnws7i/y6xvpZB9IbUVOPy0muvdvgXeZOn88UcGPiT98Vp3rJPTa8bFoalZ3Qhw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", "dependencies": { "json5": "^2.2.2", "minimist": "^1.2.6", @@ -1336,62 +1274,10 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/@swc/cli": { - "version": "0.1.61", - "resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.1.61.tgz", - "integrity": "sha512-HeYMJ+8gKfJzM9xgcZqTpAHJYAJVGSljBSmWRUx2B6UiGraLsLjEcqxITwi6/t6Af+QboBMiQX5Wwll89oPK7g==", - "dependencies": { - "@mole-inc/bin-wrapper": "^8.0.1", - "commander": "^7.1.0", - "fast-glob": "^3.2.5", - "semver": "^7.3.8", - "slash": "3.0.0", - "source-map": "^0.7.3" - }, - "bin": { - "spack": "bin/spack.js", - "swc": "bin/swc.js", - "swcx": "bin/swcx.js" - }, - "engines": { - "node": ">= 12.13" - }, - "peerDependencies": { - "@swc/core": "^1.2.66", - "chokidar": "^3.5.1" - }, - "peerDependenciesMeta": { - "chokidar": { - "optional": true - } - } - }, - "node_modules/@swc/cli/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/cli/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "engines": { - "node": ">= 8" - } - }, "node_modules/@swc/core": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.34.tgz", - "integrity": "sha512-kaOCGRpciMEs2FpCUFaPJSNHgggFteOGZToM88uL5k/CEy0nU/6wzl8kUO5J+rI/8/8vN7qyhM1Ajhyj3WCSsw==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.56.tgz", + "integrity": "sha512-yz/EeXT+PMZucUNrYceRUaTfuNS4IIu5EDZSOlvCEvm4jAmZi7CYH1B/kvzEzoAOzr7zkQiDPNJftcQXLkjbjA==", "hasInstallScript": true, "engines": { "node": ">=10" @@ -1401,22 +1287,30 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.3.34", - "@swc/core-darwin-x64": "1.3.34", - "@swc/core-linux-arm-gnueabihf": "1.3.34", - "@swc/core-linux-arm64-gnu": "1.3.34", - "@swc/core-linux-arm64-musl": "1.3.34", - "@swc/core-linux-x64-gnu": "1.3.34", - "@swc/core-linux-x64-musl": "1.3.34", - "@swc/core-win32-arm64-msvc": "1.3.34", - "@swc/core-win32-ia32-msvc": "1.3.34", - "@swc/core-win32-x64-msvc": "1.3.34" + "@swc/core-darwin-arm64": "1.3.56", + "@swc/core-darwin-x64": "1.3.56", + "@swc/core-linux-arm-gnueabihf": "1.3.56", + "@swc/core-linux-arm64-gnu": "1.3.56", + "@swc/core-linux-arm64-musl": "1.3.56", + "@swc/core-linux-x64-gnu": "1.3.56", + "@swc/core-linux-x64-musl": "1.3.56", + "@swc/core-win32-arm64-msvc": "1.3.56", + "@swc/core-win32-ia32-msvc": "1.3.56", + "@swc/core-win32-x64-msvc": "1.3.56" + }, + "peerDependencies": { + "@swc/helpers": "^0.5.0" + }, + "peerDependenciesMeta": { + "@swc/helpers": { + "optional": true + } } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.34.tgz", - "integrity": "sha512-m7+kybVLO9uo/TiGBlf/ISmpmm27I/NrFEBGOVBF2xNOs5BY1XHHM6ddbPPckQa38C19nWeAzdJPwGzJw+qO3A==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.56.tgz", + "integrity": "sha512-DZcu7BzDaLEdWHabz9DRTP0yEBLqkrWmskFcD5BX0lGAvoIvE4duMnAqi5F2B3X7630QioHRCYFoRw2WkeE3Cw==", "cpu": [ "arm64" ], @@ -1429,9 +1323,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.34.tgz", - "integrity": "sha512-arH7LtcOhuC1wy88qgbCO/E5NnBThbxv9HhjScDfoUPRunyvT9whEvSK0eXCXxGvDAiAtXIrW3blIrteOsQaOQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.56.tgz", + "integrity": "sha512-VH5saqYFasdRXJy6RAT+MXm0+IjkMZvOkohJwUei+oA65cKJofQwrJ1jZro8yOJFYvUSI3jgNRGsdBkmo/4hMw==", "cpu": [ "x64" ], @@ -1444,9 +1338,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.34.tgz", - "integrity": "sha512-+pvjXsXTBzSxEL3U9869y3Am/3yo6kQfU6VGVAebgLv+pjM+mIHywbgo1Uxw+pgpTuD38BsrtYcaPNeBICN/wA==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.56.tgz", + "integrity": "sha512-LWwPo6NnJkH01+ukqvkoNIOpMdw+Zundm4vBeicwyVrkP+mC3kwVfi03TUFpQUz3kRKdw/QEnxGTj+MouCPbtw==", "cpu": [ "arm" ], @@ -1459,9 +1353,9 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.34.tgz", - "integrity": "sha512-hOV1n1j+mDAgp19J+aeAnW4itMTWbaPbSbhEvLsNbVB00LoL6q6pUkWvCi+UbrejV6BIyyE9t7F5fU26SdKR8A==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.56.tgz", + "integrity": "sha512-GzsUy/4egJ4cMlxbM+Ub7AMi5CKAc+pxBxrh8MUPQbyStW8jGgnQsJouTnGy0LHawtdEnsCOl6PcO6OgvktXuQ==", "cpu": [ "arm64" ], @@ -1474,9 +1368,9 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.34.tgz", - "integrity": "sha512-r2/Hegp1DRSzG+kg36Tujdn+WX+gO/2wQpVj/g6RPxIPdjy53OOf+UwvJ23Ecn5ZbyJcgKhhTN6H6/ZNHQPqjQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.56.tgz", + "integrity": "sha512-9gxL09BIiAv8zY0DjfnFf19bo8+P4T9tdhzPwcm+1yPJcY5yr1+YFWLNFzz01agtOj6VlZ2/wUJTaOfdjjtc+A==", "cpu": [ "arm64" ], @@ -1489,9 +1383,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.34.tgz", - "integrity": "sha512-jPxxAo7XlAT7bdIi49PtYN/K1TAxvpVS7otteJLhThOPPTVblIDg63U94ivp3mVQJb3WFH4KNYatEXypyvXppQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.56.tgz", + "integrity": "sha512-n0ORNknl50vMRkll3BDO1E4WOqY6iISlPV1ZQCRLWQ6YQ2q8/WAryBxc2OAybcGHBUFkxyACpJukeU1QZ/9tNw==", "cpu": [ "x64" ], @@ -1504,9 +1398,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.34.tgz", - "integrity": "sha512-eJaUuhvnNtcwpK9Mil4hZTSYZqG519gX5AQQ2VZOhrWBEBJi+jM0RXAvWdESsaXpS7W0CRtbmEXqeUff6UEgpQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.56.tgz", + "integrity": "sha512-r+D34WLAOAlJtfw1gaVWpHRwCncU9nzW9i7w9kSw4HpWYnHJOz54jLGSEmNsrhdTCz1VK2ar+V2ktFUsrlGlDA==", "cpu": [ "x64" ], @@ -1519,9 +1413,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.34.tgz", - "integrity": "sha512-KFdeC5bXDcxIQ/1J5Pjj8BOblRFjh89TTJxujxAhKdoD1k0NV9BKEZACja2cTBz0hWD4cYlBX0cESVdL2rkm3w==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.56.tgz", + "integrity": "sha512-29Yt75Is6X24z3x8h/xZC1HnDPkPpyLH9mDQiM6Cuc0I9mVr1XSriPEUB2N/awf5IE4SA8c+3IVq1DtKWbkJIw==", "cpu": [ "arm64" ], @@ -1534,9 +1428,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.34.tgz", - "integrity": "sha512-MgWkAQDiWIHfJL5b5aoogenGIt3qcqBSvwLnDQqSWEhkodZjHyCWpQFuaa7Y6ER3pKUIZ5kR8O9aAkDmF39awQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.56.tgz", + "integrity": "sha512-mplp0zbYDrcHtfvkniXlXdB04e2qIjz2Gq/XHKr4Rnc6xVORJjjXF91IemXKpavx2oZYJws+LNJL7UFQ8jyCdQ==", "cpu": [ "ia32" ], @@ -1549,9 +1443,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.34.tgz", - "integrity": "sha512-UhaikgVRYBZZdMI7Zo4/eUyYLnjGrC6QAn9aggt1+PiFIM9tXpX8aONUL3LoLkhQhd+6iWygfQ298RRxjKAKuw==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.56.tgz", + "integrity": "sha512-zp8MBnrw/bjdLenO/ifYzHrImSjKunqL0C2IF4LXYNRfcbYFh2NwobsVQMZ20IT0474lKRdlP8Oxdt+bHuXrzA==", "cpu": [ "x64" ], @@ -1563,22 +1457,6 @@ "node": ">=10" } }, - "node_modules/@szmarczak/http-timer": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", - "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", - "dependencies": { - "defer-to-connect": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@tokenizer/token": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", - "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" - }, "node_modules/@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", @@ -1663,17 +1541,6 @@ "@types/node": "*" } }, - "node_modules/@types/cacheable-request": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", - "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", - "dependencies": { - "@types/http-cache-semantics": "*", - "@types/keyv": "^3.1.4", - "@types/node": "*", - "@types/responselike": "^1.0.0" - } - }, "node_modules/@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -1766,11 +1633,6 @@ "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz", "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==" }, - "node_modules/@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" - }, "node_modules/@types/http-errors": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.1.tgz", @@ -1829,14 +1691,6 @@ "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==" }, - "node_modules/@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/koa": { "version": "2.13.4", "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz", @@ -1938,14 +1792,6 @@ "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" }, - "node_modules/@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/serve-static": { "version": "1.13.10", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", @@ -2075,25 +1921,6 @@ "node": ">= 8" } }, - "node_modules/arch": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", - "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -2216,169 +2043,6 @@ "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" }, - "node_modules/bin-check": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bin-check/-/bin-check-4.1.0.tgz", - "integrity": "sha512-b6weQyEUKsDGFlACWSIOfveEnImkJyK/FGW6FAG42loyoquvjdtOIqO6yBFzHyqyVVhNgNkQxxx09SFLK28YnA==", - "dependencies": { - "execa": "^0.7.0", - "executable": "^4.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/bin-check/node_modules/cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==", - "dependencies": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "node_modules/bin-check/node_modules/execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha512-RztN09XglpYI7aBBrJCPW95jEH7YF1UEPOoX9yDhUTPdp7mK+CQvnLTuD10BNXZ3byLTu2uehZ8EcKT/4CGiFw==", - "dependencies": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/bin-check/node_modules/get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==", - "engines": { - "node": ">=4" - } - }, - "node_modules/bin-check/node_modules/is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/bin-check/node_modules/lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "node_modules/bin-check/node_modules/npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/bin-check/node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/bin-check/node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/bin-check/node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/bin-check/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/bin-check/node_modules/yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" - }, - "node_modules/bin-version": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/bin-version/-/bin-version-6.0.0.tgz", - "integrity": "sha512-nk5wEsP4RiKjG+vF+uG8lFsEn4d7Y6FVDamzzftSunXOoOcOOkzcWdKVlGgFFwlUQCj63SgnUkLLGF8v7lufhw==", - "dependencies": { - "execa": "^5.0.0", - "find-versions": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/bin-version-check": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bin-version-check/-/bin-version-check-5.0.0.tgz", - "integrity": "sha512-Q3FMQnS5eZmrBGqmDXLs4dbAn/f+52voP6ykJYmweSA60t6DyH4UTSwZhtbK5UH+LBoWvDljILUQMLRUtsynsA==", - "dependencies": { - "bin-version": "^6.0.0", - "semver": "^7.3.5", - "semver-truncate": "^2.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/bin-version-check/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -2445,6 +2109,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "dependencies": { "fill-range": "^7.0.1" }, @@ -2539,45 +2204,6 @@ "node": ">= 0.8" } }, - "node_modules/cacheable-lookup": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", - "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", - "engines": { - "node": ">=10.6.0" - } - }, - "node_modules/cacheable-request": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", - "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cacheable-request/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -2686,17 +2312,6 @@ "node": ">=12" } }, - "node_modules/clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "dependencies": { - "mimic-response": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -2743,14 +2358,6 @@ "node": ">= 0.8" } }, - "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "engines": { - "node": ">= 10" - } - }, "node_modules/component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -2863,6 +2470,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -2899,31 +2507,6 @@ "ms": "2.0.0" } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decompress-response/node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -2939,14 +2522,6 @@ "node": ">=0.10.0" } }, - "node_modules/defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", - "engines": { - "node": ">=10" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -3069,14 +2644,6 @@ "node": ">= 0.8" } }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -3186,6 +2753,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -3204,17 +2772,6 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/executable": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz", - "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==", - "dependencies": { - "pify": "^2.2.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -3400,49 +2957,11 @@ "type": "^2.7.2" } }, - "node_modules/ext-list": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", - "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", - "dependencies": { - "mime-db": "^1.28.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ext-name": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", - "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", - "dependencies": { - "ext-list": "^2.0.0", - "sort-keys-length": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/ext/node_modules/type": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" }, - "node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -3455,14 +2974,6 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "dev": true }, - "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dependencies": { - "reusify": "^1.0.4" - } - }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -3472,53 +2983,11 @@ "bser": "2.1.1" } }, - "node_modules/file-type": { - "version": "17.1.6", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz", - "integrity": "sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==", - "dependencies": { - "readable-web-to-node-stream": "^3.0.2", - "strtok3": "^7.0.0-alpha.9", - "token-types": "^5.0.0-alpha.2" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/file-type?sponsor=1" - } - }, - "node_modules/filename-reserved-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-3.0.0.tgz", - "integrity": "sha512-hn4cQfU6GOT/7cFHXBqeBg2TbrMBgdD0kcjLhvSQYYwm3s4B6cjvBfb7nBALJLAXqmU5xajSa7X2NnUud/VCdw==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/filenamify": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-5.1.1.tgz", - "integrity": "sha512-M45CbrJLGACfrPOkrTp3j2EcO9OBkKUYME0eiqOCa7i2poaklU0jhlIaMlr8ijLorT0uLAzrn3qXOp5684CkfA==", - "dependencies": { - "filename-reserved-regex": "^3.0.0", - "strip-outer": "^2.0.0", - "trim-repeated": "^2.0.0" - }, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -3564,20 +3033,6 @@ "node": ">=8" } }, - "node_modules/find-versions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-5.1.0.tgz", - "integrity": "sha512-+iwzCJ7C5v5KgcBuueqVoNiHVoQpwiUK5XFLjf0affFTep+Wcw93tPvmb8tqujDNmzhBDPddnWV/qgWSXgq+Hg==", - "dependencies": { - "semver-regex": "^4.0.5" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/form-data": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", @@ -3693,6 +3148,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, "engines": { "node": ">=10" }, @@ -3718,17 +3174,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -3738,30 +3183,6 @@ "node": ">=4" } }, - "node_modules/got": { - "version": "11.8.6", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", - "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", - "dependencies": { - "@sindresorhus/is": "^4.0.0", - "@szmarczak/http-timer": "^4.0.5", - "@types/cacheable-request": "^6.0.1", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "http2-wrapper": "^1.0.0-beta.5.2", - "lowercase-keys": "^2.0.0", - "p-cancelable": "^2.0.0", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=10.19.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" - } - }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -3855,11 +3276,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "node_modules/http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" - }, "node_modules/http-errors": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", @@ -3875,22 +3291,11 @@ "node": ">= 0.6" } }, - "node_modules/http2-wrapper": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", - "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", - "dependencies": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.0.0" - }, - "engines": { - "node": ">=10.19.0" - } - }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, "engines": { "node": ">=10.17.0" } @@ -3906,25 +3311,6 @@ "node": ">=0.10.0" } }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -4015,14 +3401,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -4041,33 +3419,15 @@ "node": ">=6" } }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "engines": { "node": ">=0.12.0" } }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-promise": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", @@ -4077,6 +3437,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, "engines": { "node": ">=8" }, @@ -4087,7 +3448,8 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", @@ -4875,11 +4237,6 @@ "node": ">=4" } }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" - }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -4949,14 +4306,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/keyv": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", - "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", - "dependencies": { - "json-buffer": "3.0.1" - } - }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -5016,14 +4365,6 @@ "tslib": "^2.0.3" } }, - "node_modules/lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "engines": { - "node": ">=8" - } - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -5111,15 +4452,8 @@ "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "engines": { - "node": ">= 8" - } + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true }, "node_modules/methods": { "version": "1.1.2", @@ -5133,6 +4467,7 @@ "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, "dependencies": { "braces": "^3.0.2", "picomatch": "^2.3.1" @@ -5175,18 +4510,11 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, "engines": { "node": ">=6" } }, - "node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "engines": { - "node": ">=4" - } - }, "node_modules/minimatch": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", @@ -5260,21 +4588,11 @@ "node": ">=0.10.0" } }, - "node_modules/normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, "dependencies": { "path-key": "^3.0.0" }, @@ -5329,6 +4647,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "dependencies": { "mimic-fn": "^2.1.0" }, @@ -5339,33 +4658,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/os-filter-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/os-filter-obj/-/os-filter-obj-2.0.0.tgz", - "integrity": "sha512-uksVLsqG3pVdzzPvmAHpBK0wKxYItuzZr7SziusRPoz67tGV8rL1szZ6IdeUrbqLjGDwApBtN29eEE3IqGHOjg==", - "dependencies": { - "arch": "^2.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/p-cancelable": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", - "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", - "engines": { - "node": ">=4" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -5534,6 +4826,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, "engines": { "node": ">=8" } @@ -5562,18 +4855,6 @@ "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==" }, - "node_modules/peek-readable": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", - "integrity": "sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A==", - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, "node_modules/pg": { "version": "8.9.0", "resolved": "https://registry.npmjs.org/pg/-/pg-8.9.0.tgz", @@ -5658,6 +4939,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "engines": { "node": ">=8.6" }, @@ -5665,14 +4947,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/pirates": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", @@ -5794,20 +5068,6 @@ "node": ">= 0.10" } }, - "node_modules/pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==" - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -5822,36 +5082,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/random-bytes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", @@ -5923,6 +5153,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -5932,26 +5163,6 @@ "node": ">= 6" } }, - "node_modules/readable-web-to-node-stream": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", - "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", - "dependencies": { - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -5978,11 +5189,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" - }, "node_modules/resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -6013,48 +5219,6 @@ "node": ">=10" } }, - "node_modules/responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", - "dependencies": { - "lowercase-keys": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -6069,32 +5233,11 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, "bin": { "semver": "bin/semver.js" } }, - "node_modules/semver-regex": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", - "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/semver-truncate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-truncate/-/semver-truncate-2.0.0.tgz", - "integrity": "sha512-Rh266MLDYNeML5h90ttdMwfXe1+Nc4LAWd9X1KdJe8pPHP4kFmvLZALtsMNHNdvTyQygbEC0D59sIz47DIaq8w==", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -6177,6 +5320,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, "dependencies": { "shebang-regex": "^3.0.0" }, @@ -6188,6 +5332,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, "engines": { "node": ">=8" } @@ -6208,7 +5353,8 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "node_modules/sisteransi": { "version": "1.0.5", @@ -6220,6 +5366,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, "engines": { "node": ">=8" } @@ -6233,28 +5380,6 @@ "tslib": "^2.0.3" } }, - "node_modules/sort-keys": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", - "integrity": "sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg==", - "dependencies": { - "is-plain-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sort-keys-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", - "integrity": "sha512-GRbEOUqCxemTAk/b32F2xa8wDTs+Z1QHOkbhJDQTvv/6G3ZkbJ+frYWsTcc7cBB3Fu4wy4XlLCuNtJuMn7Gsvw==", - "dependencies": { - "sort-keys": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -6320,6 +5445,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -6328,6 +5454,7 @@ "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, "funding": [ { "type": "github", @@ -6391,18 +5518,11 @@ "node": ">=8" } }, - "node_modules/strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, "engines": { "node": ">=6" } @@ -6419,33 +5539,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/strip-outer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-2.0.0.tgz", - "integrity": "sha512-A21Xsm1XzUkK0qK1ZrytDUvqsQWict2Cykhvi0fBQntGG5JSprESasEyV1EZ/4CiR5WB5KjzLTrP/bO37B0wPg==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strtok3": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", - "integrity": "sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ==", - "dependencies": { - "@tokenizer/token": "^0.3.0", - "peek-readable": "^5.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, "node_modules/superagent": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", @@ -6555,15 +5648,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/swc": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/swc/-/swc-1.0.11.tgz", - "integrity": "sha512-YbG4eija7g/ajQ0lu4P2WPgKt5zCm743VgKn+buBrXXo1IETftO2r/8VdBPhv8wpTyg3CO+VU1z2wHuL4iohmw==", - "dependencies": { - "@swc/cli": "^0.1.26", - "@swc/core": "^1.2.12" - } - }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -6648,6 +5732,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -6663,54 +5748,16 @@ "node": ">=0.6" } }, - "node_modules/token-types": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", - "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", - "dependencies": { - "@tokenizer/token": "^0.3.0", - "ieee754": "^1.2.1" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Borewit" - } - }, - "node_modules/trim-repeated": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-2.0.0.tgz", - "integrity": "sha512-QUHBFTJGdOwmp0tbOG505xAgOp/YliZP/6UgafFXYZ26WT1bvQmSMJUvkeVSASuJJHbqsFbynTvkd5W8RBTipg==", - "dependencies": { - "escape-string-regexp": "^5.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/trim-repeated/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ts-jest": { - "version": "29.0.3", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.3.tgz", - "integrity": "sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==", + "version": "29.1.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.0.tgz", + "integrity": "sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==", "dev": true, "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", "jest-util": "^29.0.0", - "json5": "^2.2.1", + "json5": "^2.2.3", "lodash.memoize": "4.x", "make-error": "1.x", "semver": "7.x", @@ -6727,7 +5774,7 @@ "@jest/types": "^29.0.0", "babel-jest": "^29.0.0", "jest": "^29.0.0", - "typescript": ">=4.3" + "typescript": ">=4.3 <6" }, "peerDependenciesMeta": { "@babel/core": { @@ -6886,15 +5933,15 @@ } }, "node_modules/typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/uid-safe": { @@ -6945,7 +5992,8 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "node_modules/utils-merge": { "version": "1.0.1", @@ -7009,6 +6057,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "dependencies": { "isexe": "^2.0.0" }, @@ -7939,55 +6988,12 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, - "@mole-inc/bin-wrapper": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@mole-inc/bin-wrapper/-/bin-wrapper-8.0.1.tgz", - "integrity": "sha512-sTGoeZnjI8N4KS+sW2AN95gDBErhAguvkw/tWdCjeM8bvxpz5lqrnd0vOJABA1A+Ic3zED7PYoLP/RANLgVotA==", - "requires": { - "bin-check": "^4.1.0", - "bin-version-check": "^5.0.0", - "content-disposition": "^0.5.4", - "ext-name": "^5.0.0", - "file-type": "^17.1.6", - "filenamify": "^5.0.2", - "got": "^11.8.5", - "os-filter-obj": "^2.0.0" - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, "@sinclair/typebox": { "version": "0.24.51", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", "integrity": "sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA==", "dev": true }, - "@sindresorhus/is": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", - "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" - }, "@sinonjs/commons": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.5.tgz", @@ -8007,9 +7013,9 @@ } }, "@snowtop/ent": { - "version": "0.1.0-alpha117", - "resolved": "https://registry.npmjs.org/@snowtop/ent/-/ent-0.1.0-alpha117.tgz", - "integrity": "sha512-Khr+C4RPHNt28VcAIvGGSNbJsKSe037NlRlG7CL+70fOAxLh4LnIv6dkQWMAwAE2y85/6/E0hO+sFmEyeoWOsg==", + "version": "0.1.0-alpha126", + "resolved": "https://registry.npmjs.org/@snowtop/ent/-/ent-0.1.0-alpha126.tgz", + "integrity": "sha512-bK8Qrx5ZWpF3pn1MMjuRGRYahBqkRd2dK8EsTyajKH4jjtQea0PSwwIs0kLI5lMtCCLMtPJ3DaZbFI6BPff72g==", "requires": { "@types/node": "^18.11.18", "camel-case": "^4.1.2", @@ -8025,12 +7031,11 @@ "pascal-case": "^3.1.2", "pg": "^8.8.0", "prettier": "^2.8.1", - "reflect-metadata": "^0.1.13", "snake-case": "^3.0.4", "ts-node": "^10.9.1", - "tsconfig-paths": "^4.1.1", - "tslib": "^2.4.1", - "typescript": "^4.9.4", + "tsconfig-paths": "^4.2.0", + "tslib": "^2.5.0", + "typescript": "^5.0.4", "uuid": "^9.0.0" }, "dependencies": { @@ -8045,9 +7050,9 @@ "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==" }, "tsconfig-paths": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.1.2.tgz", - "integrity": "sha512-uhxiMgnXQp1IR622dUXI+9Ehnws7i/y6xvpZB9IbUVOPy0muvdvgXeZOn88UcGPiT98Vp3rJPTa8bFoalZ3Qhw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", "requires": { "json5": "^2.2.2", "minimist": "^1.2.6", @@ -8109,124 +7114,83 @@ "libphonenumber-js": "^1.9.17" } }, - "@swc/cli": { - "version": "0.1.61", - "resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.1.61.tgz", - "integrity": "sha512-HeYMJ+8gKfJzM9xgcZqTpAHJYAJVGSljBSmWRUx2B6UiGraLsLjEcqxITwi6/t6Af+QboBMiQX5Wwll89oPK7g==", - "requires": { - "@mole-inc/bin-wrapper": "^8.0.1", - "commander": "^7.1.0", - "fast-glob": "^3.2.5", - "semver": "^7.3.8", - "slash": "3.0.0", - "source-map": "^0.7.3" - }, - "dependencies": { - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "requires": { - "lru-cache": "^6.0.0" - } - }, - "source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==" - } - } - }, "@swc/core": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.34.tgz", - "integrity": "sha512-kaOCGRpciMEs2FpCUFaPJSNHgggFteOGZToM88uL5k/CEy0nU/6wzl8kUO5J+rI/8/8vN7qyhM1Ajhyj3WCSsw==", - "requires": { - "@swc/core-darwin-arm64": "1.3.34", - "@swc/core-darwin-x64": "1.3.34", - "@swc/core-linux-arm-gnueabihf": "1.3.34", - "@swc/core-linux-arm64-gnu": "1.3.34", - "@swc/core-linux-arm64-musl": "1.3.34", - "@swc/core-linux-x64-gnu": "1.3.34", - "@swc/core-linux-x64-musl": "1.3.34", - "@swc/core-win32-arm64-msvc": "1.3.34", - "@swc/core-win32-ia32-msvc": "1.3.34", - "@swc/core-win32-x64-msvc": "1.3.34" + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.56.tgz", + "integrity": "sha512-yz/EeXT+PMZucUNrYceRUaTfuNS4IIu5EDZSOlvCEvm4jAmZi7CYH1B/kvzEzoAOzr7zkQiDPNJftcQXLkjbjA==", + "requires": { + "@swc/core-darwin-arm64": "1.3.56", + "@swc/core-darwin-x64": "1.3.56", + "@swc/core-linux-arm-gnueabihf": "1.3.56", + "@swc/core-linux-arm64-gnu": "1.3.56", + "@swc/core-linux-arm64-musl": "1.3.56", + "@swc/core-linux-x64-gnu": "1.3.56", + "@swc/core-linux-x64-musl": "1.3.56", + "@swc/core-win32-arm64-msvc": "1.3.56", + "@swc/core-win32-ia32-msvc": "1.3.56", + "@swc/core-win32-x64-msvc": "1.3.56" } }, "@swc/core-darwin-arm64": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.34.tgz", - "integrity": "sha512-m7+kybVLO9uo/TiGBlf/ISmpmm27I/NrFEBGOVBF2xNOs5BY1XHHM6ddbPPckQa38C19nWeAzdJPwGzJw+qO3A==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.56.tgz", + "integrity": "sha512-DZcu7BzDaLEdWHabz9DRTP0yEBLqkrWmskFcD5BX0lGAvoIvE4duMnAqi5F2B3X7630QioHRCYFoRw2WkeE3Cw==", "optional": true }, "@swc/core-darwin-x64": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.34.tgz", - "integrity": "sha512-arH7LtcOhuC1wy88qgbCO/E5NnBThbxv9HhjScDfoUPRunyvT9whEvSK0eXCXxGvDAiAtXIrW3blIrteOsQaOQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.56.tgz", + "integrity": "sha512-VH5saqYFasdRXJy6RAT+MXm0+IjkMZvOkohJwUei+oA65cKJofQwrJ1jZro8yOJFYvUSI3jgNRGsdBkmo/4hMw==", "optional": true }, "@swc/core-linux-arm-gnueabihf": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.34.tgz", - "integrity": "sha512-+pvjXsXTBzSxEL3U9869y3Am/3yo6kQfU6VGVAebgLv+pjM+mIHywbgo1Uxw+pgpTuD38BsrtYcaPNeBICN/wA==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.56.tgz", + "integrity": "sha512-LWwPo6NnJkH01+ukqvkoNIOpMdw+Zundm4vBeicwyVrkP+mC3kwVfi03TUFpQUz3kRKdw/QEnxGTj+MouCPbtw==", "optional": true }, "@swc/core-linux-arm64-gnu": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.34.tgz", - "integrity": "sha512-hOV1n1j+mDAgp19J+aeAnW4itMTWbaPbSbhEvLsNbVB00LoL6q6pUkWvCi+UbrejV6BIyyE9t7F5fU26SdKR8A==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.56.tgz", + "integrity": "sha512-GzsUy/4egJ4cMlxbM+Ub7AMi5CKAc+pxBxrh8MUPQbyStW8jGgnQsJouTnGy0LHawtdEnsCOl6PcO6OgvktXuQ==", "optional": true }, "@swc/core-linux-arm64-musl": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.34.tgz", - "integrity": "sha512-r2/Hegp1DRSzG+kg36Tujdn+WX+gO/2wQpVj/g6RPxIPdjy53OOf+UwvJ23Ecn5ZbyJcgKhhTN6H6/ZNHQPqjQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.56.tgz", + "integrity": "sha512-9gxL09BIiAv8zY0DjfnFf19bo8+P4T9tdhzPwcm+1yPJcY5yr1+YFWLNFzz01agtOj6VlZ2/wUJTaOfdjjtc+A==", "optional": true }, "@swc/core-linux-x64-gnu": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.34.tgz", - "integrity": "sha512-jPxxAo7XlAT7bdIi49PtYN/K1TAxvpVS7otteJLhThOPPTVblIDg63U94ivp3mVQJb3WFH4KNYatEXypyvXppQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.56.tgz", + "integrity": "sha512-n0ORNknl50vMRkll3BDO1E4WOqY6iISlPV1ZQCRLWQ6YQ2q8/WAryBxc2OAybcGHBUFkxyACpJukeU1QZ/9tNw==", "optional": true }, "@swc/core-linux-x64-musl": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.34.tgz", - "integrity": "sha512-eJaUuhvnNtcwpK9Mil4hZTSYZqG519gX5AQQ2VZOhrWBEBJi+jM0RXAvWdESsaXpS7W0CRtbmEXqeUff6UEgpQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.56.tgz", + "integrity": "sha512-r+D34WLAOAlJtfw1gaVWpHRwCncU9nzW9i7w9kSw4HpWYnHJOz54jLGSEmNsrhdTCz1VK2ar+V2ktFUsrlGlDA==", "optional": true }, "@swc/core-win32-arm64-msvc": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.34.tgz", - "integrity": "sha512-KFdeC5bXDcxIQ/1J5Pjj8BOblRFjh89TTJxujxAhKdoD1k0NV9BKEZACja2cTBz0hWD4cYlBX0cESVdL2rkm3w==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.56.tgz", + "integrity": "sha512-29Yt75Is6X24z3x8h/xZC1HnDPkPpyLH9mDQiM6Cuc0I9mVr1XSriPEUB2N/awf5IE4SA8c+3IVq1DtKWbkJIw==", "optional": true }, "@swc/core-win32-ia32-msvc": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.34.tgz", - "integrity": "sha512-MgWkAQDiWIHfJL5b5aoogenGIt3qcqBSvwLnDQqSWEhkodZjHyCWpQFuaa7Y6ER3pKUIZ5kR8O9aAkDmF39awQ==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.56.tgz", + "integrity": "sha512-mplp0zbYDrcHtfvkniXlXdB04e2qIjz2Gq/XHKr4Rnc6xVORJjjXF91IemXKpavx2oZYJws+LNJL7UFQ8jyCdQ==", "optional": true }, "@swc/core-win32-x64-msvc": { - "version": "1.3.34", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.34.tgz", - "integrity": "sha512-UhaikgVRYBZZdMI7Zo4/eUyYLnjGrC6QAn9aggt1+PiFIM9tXpX8aONUL3LoLkhQhd+6iWygfQ298RRxjKAKuw==", + "version": "1.3.56", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.56.tgz", + "integrity": "sha512-zp8MBnrw/bjdLenO/ifYzHrImSjKunqL0C2IF4LXYNRfcbYFh2NwobsVQMZ20IT0474lKRdlP8Oxdt+bHuXrzA==", "optional": true }, - "@szmarczak/http-timer": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", - "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", - "requires": { - "defer-to-connect": "^2.0.0" - } - }, - "@tokenizer/token": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", - "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" - }, "@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", @@ -8311,17 +7275,6 @@ "@types/node": "*" } }, - "@types/cacheable-request": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", - "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", - "requires": { - "@types/http-cache-semantics": "*", - "@types/keyv": "^3.1.4", - "@types/node": "*", - "@types/responselike": "^1.0.0" - } - }, "@types/connect": { "version": "3.4.35", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", @@ -8414,11 +7367,6 @@ "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.3.tgz", "integrity": "sha512-FyAOrDuQmBi8/or3ns4rwPno7/9tJTijVW6aQQjK02+kOQ8zmoNg2XJtAuQhvQcy1ASJq38wirX5//9J1EqoUA==" }, - "@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" - }, "@types/http-errors": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-1.8.1.tgz", @@ -8477,14 +7425,6 @@ "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz", "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==" }, - "@types/keyv": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", - "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", - "requires": { - "@types/node": "*" - } - }, "@types/koa": { "version": "2.13.4", "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.13.4.tgz", @@ -8586,14 +7526,6 @@ "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" }, - "@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", - "requires": { - "@types/node": "*" - } - }, "@types/serve-static": { "version": "1.13.10", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.10.tgz", @@ -8696,11 +7628,6 @@ "picomatch": "^2.0.4" } }, - "arch": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", - "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==" - }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -8766,164 +7693,42 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", - "dev": true, - "requires": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - } - }, - "babel-preset-jest": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.2.0.tgz", - "integrity": "sha512-z9JmMJppMxNv8N7fNRHvhMg9cvIkMxQBXgFkane3yKVEvEOP+kB50lk8DFRvF9PGqbyXxlmebKWhuDORO8RgdA==", - "dev": true, - "requires": { - "babel-plugin-jest-hoist": "^29.2.0", - "babel-preset-current-node-syntax": "^1.0.0" - } - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "bcryptjs": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", - "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" - }, - "bin-check": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bin-check/-/bin-check-4.1.0.tgz", - "integrity": "sha512-b6weQyEUKsDGFlACWSIOfveEnImkJyK/FGW6FAG42loyoquvjdtOIqO6yBFzHyqyVVhNgNkQxxx09SFLK28YnA==", - "requires": { - "execa": "^0.7.0", - "executable": "^4.1.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==", - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha512-RztN09XglpYI7aBBrJCPW95jEH7YF1UEPOoX9yDhUTPdp7mK+CQvnLTuD10BNXZ3byLTu2uehZ8EcKT/4CGiFw==", - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==" - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==" - }, - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", - "requires": { - "path-key": "^2.0.0" - } - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==" - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==" - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "requires": { - "isexe": "^2.0.0" - } - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" - } - } - }, - "bin-version": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/bin-version/-/bin-version-6.0.0.tgz", - "integrity": "sha512-nk5wEsP4RiKjG+vF+uG8lFsEn4d7Y6FVDamzzftSunXOoOcOOkzcWdKVlGgFFwlUQCj63SgnUkLLGF8v7lufhw==", + "dev": true, "requires": { - "execa": "^5.0.0", - "find-versions": "^5.0.0" + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" } }, - "bin-version-check": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bin-version-check/-/bin-version-check-5.0.0.tgz", - "integrity": "sha512-Q3FMQnS5eZmrBGqmDXLs4dbAn/f+52voP6ykJYmweSA60t6DyH4UTSwZhtbK5UH+LBoWvDljILUQMLRUtsynsA==", + "babel-preset-jest": { + "version": "29.2.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.2.0.tgz", + "integrity": "sha512-z9JmMJppMxNv8N7fNRHvhMg9cvIkMxQBXgFkane3yKVEvEOP+kB50lk8DFRvF9PGqbyXxlmebKWhuDORO8RgdA==", + "dev": true, "requires": { - "bin-version": "^6.0.0", - "semver": "^7.3.5", - "semver-truncate": "^2.0.0" - }, - "dependencies": { - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "requires": { - "lru-cache": "^6.0.0" - } - } + "babel-plugin-jest-hoist": "^29.2.0", + "babel-preset-current-node-syntax": "^1.0.0" } }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "bcryptjs": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", + "integrity": "sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms=" + }, "body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -8979,6 +7784,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "requires": { "fill-range": "^7.0.1" } @@ -9042,35 +7848,6 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" }, - "cacheable-lookup": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", - "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==" - }, - "cacheable-request": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", - "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - }, - "dependencies": { - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "requires": { - "pump": "^3.0.0" - } - } - } - }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -9145,14 +7922,6 @@ "wrap-ansi": "^7.0.0" } }, - "clone-response": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", - "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", - "requires": { - "mimic-response": "^1.0.0" - } - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -9189,11 +7958,6 @@ "delayed-stream": "~1.0.0" } }, - "commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==" - }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -9279,6 +8043,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -9312,21 +8077,6 @@ "ms": "2.0.0" } }, - "decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "requires": { - "mimic-response": "^3.1.0" - }, - "dependencies": { - "mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==" - } - } - }, "dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -9339,11 +8089,6 @@ "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", "dev": true }, - "defer-to-connect": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", - "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==" - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -9435,14 +8180,6 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "requires": { - "once": "^1.4.0" - } - }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -9532,6 +8269,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, "requires": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -9544,14 +8282,6 @@ "strip-final-newline": "^2.0.0" } }, - "executable": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz", - "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==", - "requires": { - "pify": "^2.2.0" - } - }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -9690,35 +8420,6 @@ } } }, - "ext-list": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", - "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", - "requires": { - "mime-db": "^1.28.0" - } - }, - "ext-name": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", - "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", - "requires": { - "ext-list": "^2.0.0", - "sort-keys-length": "^1.0.0" - } - }, - "fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - } - }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -9731,14 +8432,6 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "dev": true }, - "fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "requires": { - "reusify": "^1.0.4" - } - }, "fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -9748,35 +8441,11 @@ "bser": "2.1.1" } }, - "file-type": { - "version": "17.1.6", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.6.tgz", - "integrity": "sha512-hlDw5Ev+9e883s0pwUsuuYNu4tD7GgpUnOvykjv1Gya0ZIjuKumthDRua90VUn6/nlRKAjcxLUnHNTIUWwWIiw==", - "requires": { - "readable-web-to-node-stream": "^3.0.2", - "strtok3": "^7.0.0-alpha.9", - "token-types": "^5.0.0-alpha.2" - } - }, - "filename-reserved-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-3.0.0.tgz", - "integrity": "sha512-hn4cQfU6GOT/7cFHXBqeBg2TbrMBgdD0kcjLhvSQYYwm3s4B6cjvBfb7nBALJLAXqmU5xajSa7X2NnUud/VCdw==" - }, - "filenamify": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-5.1.1.tgz", - "integrity": "sha512-M45CbrJLGACfrPOkrTp3j2EcO9OBkKUYME0eiqOCa7i2poaklU0jhlIaMlr8ijLorT0uLAzrn3qXOp5684CkfA==", - "requires": { - "filename-reserved-regex": "^3.0.0", - "strip-outer": "^2.0.0", - "trim-repeated": "^2.0.0" - } - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, "requires": { "to-regex-range": "^5.0.1" } @@ -9812,14 +8481,6 @@ "path-exists": "^4.0.0" } }, - "find-versions": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-5.1.0.tgz", - "integrity": "sha512-+iwzCJ7C5v5KgcBuueqVoNiHVoQpwiUK5XFLjf0affFTep+Wcw93tPvmb8tqujDNmzhBDPddnWV/qgWSXgq+Hg==", - "requires": { - "semver-regex": "^4.0.5" - } - }, "form-data": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", @@ -9900,7 +8561,8 @@ "get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true }, "glob": { "version": "8.0.3", @@ -9914,38 +8576,12 @@ "once": "^1.3.0" } }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "requires": { - "is-glob": "^4.0.1" - } - }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, - "got": { - "version": "11.8.6", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", - "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", - "requires": { - "@sindresorhus/is": "^4.0.0", - "@szmarczak/http-timer": "^4.0.5", - "@types/cacheable-request": "^6.0.1", - "@types/responselike": "^1.0.0", - "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.2", - "decompress-response": "^6.0.0", - "http2-wrapper": "^1.0.0-beta.5.2", - "lowercase-keys": "^2.0.0", - "p-cancelable": "^2.0.0", - "responselike": "^2.0.0" - } - }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -10011,11 +8647,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" - }, "http-errors": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", @@ -10028,19 +8659,11 @@ "toidentifier": "1.0.1" } }, - "http2-wrapper": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", - "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", - "requires": { - "quick-lru": "^5.1.1", - "resolve-alpn": "^1.0.0" - } - }, "human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true }, "iconv-lite": { "version": "0.4.24", @@ -10050,11 +8673,6 @@ "safer-buffer": ">= 2.1.2 < 3" } }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -10120,11 +8738,6 @@ "has": "^1.0.3" } }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" - }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -10137,23 +8750,11 @@ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "requires": { - "is-extglob": "^2.1.1" - } - }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==" + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true }, "is-promise": { "version": "2.2.2", @@ -10163,12 +8764,14 @@ "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true }, "istanbul-lib-coverage": { "version": "3.2.0", @@ -10779,11 +9382,6 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, - "json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" - }, "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -10839,14 +9437,6 @@ "safe-buffer": "^5.0.1" } }, - "keyv": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", - "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", - "requires": { - "json-buffer": "3.0.1" - } - }, "kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -10897,11 +9487,6 @@ "tslib": "^2.0.3" } }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -10974,12 +9559,8 @@ "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true }, "methods": { "version": "1.1.2", @@ -10990,6 +9571,7 @@ "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, "requires": { "braces": "^3.0.2", "picomatch": "^2.3.1" @@ -11016,12 +9598,8 @@ "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" - }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true }, "minimatch": { "version": "5.1.0", @@ -11084,15 +9662,11 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, - "normalize-url": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", - "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==" - }, "npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, "requires": { "path-key": "^3.0.0" } @@ -11132,28 +9706,11 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "requires": { "mimic-fn": "^2.1.0" } }, - "os-filter-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/os-filter-obj/-/os-filter-obj-2.0.0.tgz", - "integrity": "sha512-uksVLsqG3pVdzzPvmAHpBK0wKxYItuzZr7SziusRPoz67tGV8rL1szZ6IdeUrbqLjGDwApBtN29eEE3IqGHOjg==", - "requires": { - "arch": "^2.1.0" - } - }, - "p-cancelable": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", - "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==" - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==" - }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -11274,7 +9831,8 @@ "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true }, "path-parse": { "version": "1.0.7", @@ -11297,11 +9855,6 @@ "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", "integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==" }, - "peek-readable": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", - "integrity": "sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A==" - }, "pg": { "version": "8.9.0", "resolved": "https://registry.npmjs.org/pg/-/pg-8.9.0.tgz", @@ -11366,12 +9919,8 @@ "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==" + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true }, "pirates": { "version": "4.0.5", @@ -11454,20 +10003,6 @@ "ipaddr.js": "1.9.1" } }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==" - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -11476,16 +10011,6 @@ "side-channel": "^1.0.4" } }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" - }, - "quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==" - }, "random-bytes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", @@ -11541,25 +10066,13 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, - "readable-web-to-node-stream": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", - "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", - "requires": { - "readable-stream": "^3.6.0" - } - }, - "reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -11577,11 +10090,6 @@ "supports-preserve-symlinks-flag": "^1.0.0" } }, - "resolve-alpn": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", - "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==" - }, "resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -11603,27 +10111,6 @@ "integrity": "sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ==", "dev": true }, - "responselike": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", - "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", - "requires": { - "lowercase-keys": "^2.0.0" - } - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "requires": { - "queue-microtask": "^1.2.2" - } - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -11637,20 +10124,8 @@ "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - }, - "semver-regex": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", - "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==" - }, - "semver-truncate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-truncate/-/semver-truncate-2.0.0.tgz", - "integrity": "sha512-Rh266MLDYNeML5h90ttdMwfXe1+Nc4LAWd9X1KdJe8pPHP4kFmvLZALtsMNHNdvTyQygbEC0D59sIz47DIaq8w==", - "requires": { - "semver": "^6.0.0" - } + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true }, "send": { "version": "0.18.0", @@ -11721,6 +10196,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, "requires": { "shebang-regex": "^3.0.0" } @@ -11728,7 +10204,8 @@ "shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true }, "side-channel": { "version": "1.0.4", @@ -11743,7 +10220,8 @@ "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "sisteransi": { "version": "1.0.5", @@ -11754,7 +10232,8 @@ "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true }, "snake-case": { "version": "3.0.4", @@ -11765,22 +10244,6 @@ "tslib": "^2.0.3" } }, - "sort-keys": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", - "integrity": "sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg==", - "requires": { - "is-plain-obj": "^1.0.0" - } - }, - "sort-keys-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", - "integrity": "sha512-GRbEOUqCxemTAk/b32F2xa8wDTs+Z1QHOkbhJDQTvv/6G3ZkbJ+frYWsTcc7cBB3Fu4wy4XlLCuNtJuMn7Gsvw==", - "requires": { - "sort-keys": "^1.0.0" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -11831,6 +10294,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, "requires": { "safe-buffer": "~5.2.0" }, @@ -11838,7 +10302,8 @@ "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true } } }, @@ -11878,15 +10343,11 @@ "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", "dev": true }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==" - }, "strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true }, "strip-json-comments": { "version": "3.1.1", @@ -11894,20 +10355,6 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, - "strip-outer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-2.0.0.tgz", - "integrity": "sha512-A21Xsm1XzUkK0qK1ZrytDUvqsQWict2Cykhvi0fBQntGG5JSprESasEyV1EZ/4CiR5WB5KjzLTrP/bO37B0wPg==" - }, - "strtok3": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", - "integrity": "sha512-pQ+V+nYQdC5H3Q7qBZAz/MO6lwGhoC2gOAjuouGf/VO0m7vQRh8QNMl2Uf6SwAtzZ9bOw3UIeBukEGNJl5dtXQ==", - "requires": { - "@tokenizer/token": "^0.3.0", - "peek-readable": "^5.0.0" - } - }, "superagent": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", @@ -11984,15 +10431,6 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, - "swc": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/swc/-/swc-1.0.11.tgz", - "integrity": "sha512-YbG4eija7g/ajQ0lu4P2WPgKt5zCm743VgKn+buBrXXo1IETftO2r/8VdBPhv8wpTyg3CO+VU1z2wHuL4iohmw==", - "requires": { - "@swc/cli": "^0.1.26", - "@swc/core": "^1.2.12" - } - }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -12064,6 +10502,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "requires": { "is-number": "^7.0.0" } @@ -12073,40 +10512,16 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, - "token-types": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", - "integrity": "sha512-Y2fmSnZjQdDb9W4w4r1tswlMHylzWIeOKpx0aZH9BgGtACHhrk3OkT52AzwcuqTRBZtvvnTjDBh8eynMulu8Vg==", - "requires": { - "@tokenizer/token": "^0.3.0", - "ieee754": "^1.2.1" - } - }, - "trim-repeated": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-2.0.0.tgz", - "integrity": "sha512-QUHBFTJGdOwmp0tbOG505xAgOp/YliZP/6UgafFXYZ26WT1bvQmSMJUvkeVSASuJJHbqsFbynTvkd5W8RBTipg==", - "requires": { - "escape-string-regexp": "^5.0.0" - }, - "dependencies": { - "escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==" - } - } - }, "ts-jest": { - "version": "29.0.3", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.3.tgz", - "integrity": "sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==", + "version": "29.1.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.0.tgz", + "integrity": "sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==", "dev": true, "requires": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", "jest-util": "^29.0.0", - "json5": "^2.2.1", + "json5": "^2.2.3", "lodash.memoize": "4.x", "make-error": "1.x", "semver": "7.x", @@ -12212,9 +10627,9 @@ } }, "typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==" + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==" }, "uid-safe": { "version": "2.1.5", @@ -12242,7 +10657,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "utils-merge": { "version": "1.0.1", @@ -12296,6 +10712,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "requires": { "isexe": "^2.0.0" } diff --git a/examples/simple/package.json b/examples/simple/package.json index daeb6d1c9..4d8a1ec00 100644 --- a/examples/simple/package.json +++ b/examples/simple/package.json @@ -29,15 +29,16 @@ "jest-date-mock": "^1.0.8", "jest-expect-message": "^1.1.3", "supertest": "^6.1.3", - "ts-jest": "^29.0.3", + "ts-jest": "^29.1.0", "tsconfig-paths": "^3.11.0" }, "dependencies": { - "@snowtop/ent": "^0.1.0-alpha117", + "@snowtop/ent": "^0.1.0-alpha126", "@snowtop/ent-email": "^0.1.0-alpha1", "@snowtop/ent-passport": "^0.1.0-alpha3", "@snowtop/ent-password": "^0.1.0-alpha1", "@snowtop/ent-phonenumber": "^0.1.0-alpha1", + "@swc/core": "^1.3.56", "@types/express-session": "^1.17.3", "@types/graphql-upload": "^8.0.11", "@types/luxon": "^3.2.0", @@ -61,7 +62,6 @@ "passport-jwt": "^4.0.0", "passport-local": "^1.0.0", "passport-strategy": "^1.0.0", - "swc": "^1.0.11", "uuid": "^8.3.2" } } diff --git a/examples/simple/src/ent/contact.ts b/examples/simple/src/ent/contact.ts index bf69e516d..7922d187b 100644 --- a/examples/simple/src/ent/contact.ts +++ b/examples/simple/src/ent/contact.ts @@ -10,10 +10,13 @@ import { ContactEmail } from "."; @gqlObjectType() export class EmailInfo { - @gqlField({ type: "[ContactEmail]" }) + @gqlField({ + nodeName: "EmailInfo", + type: "[ContactEmail]", + }) emails: ContactEmail[]; - @gqlField({ type: GraphQLString }) + @gqlField({ nodeName: "EmailInfo", type: GraphQLString }) firstEmail: string; constructor(emails: ContactEmail[], firstEmail: string) { @@ -30,6 +33,7 @@ export class Contact extends ContactBase { } @gqlField({ + nodeName: "Contact", type: GraphQLString, name: "fullName", }) @@ -38,8 +42,10 @@ export class Contact extends ContactBase { } @gqlField({ - type: EmailInfo, + nodeName: "Contact", + type: "EmailInfo", name: "plusEmails", + async: true, }) async queryPlusEmails(): Promise { const emails = await this.loadEmails(); diff --git a/examples/simple/src/ent/user.ts b/examples/simple/src/ent/user.ts index 2681a0c17..a9b676358 100644 --- a/examples/simple/src/ent/user.ts +++ b/examples/simple/src/ent/user.ts @@ -10,7 +10,7 @@ import { } from "@snowtop/ent"; import { AllowIfOmniRule } from "./../privacy/omni"; import { GraphQLString } from "graphql"; -import { gqlArg, gqlConnection, gqlField } from "@snowtop/ent/graphql"; +import { gqlConnection, gqlField } from "@snowtop/ent/graphql"; import * as bcrypt from "bcryptjs"; import { CustomEdgeQueryBase } from "@snowtop/ent"; import { ExampleViewer } from "src/viewer/viewer"; @@ -47,6 +47,7 @@ export class User extends UserBase { } @gqlField({ + nodeName: "User", type: GraphQLString, name: "fullName", }) @@ -55,6 +56,7 @@ export class User extends UserBase { } @gqlField({ + nodeName: "User", type: GraphQLString, nullable: true, name: "bar", @@ -88,10 +90,12 @@ export class User extends UserBase { } @gqlField({ + nodeName: "User", type: "Contact", nullable: true, name: "contactSameDomain", description: "contacts same domain...", + async: true, }) async getFirstContactSameDomain(): Promise { let domain = this.getDomainFromEmail(this.emailAddress); @@ -114,7 +118,12 @@ export class User extends UserBase { return null; } - @gqlField({ type: "[Contact]", name: "contactsSameDomain" }) + @gqlField({ + nodeName: "User", + type: "[Contact]", + name: "contactsSameDomain", + async: true, + }) async getContactsSameDomain(): Promise { // the behavior here is inconsistent but meh let domain = this.getDomainFromEmail(this.emailAddress); @@ -131,10 +140,19 @@ export class User extends UserBase { }); } - @gqlField({ type: "[Contact]", name: "contactsGivenDomain" }) - async getContactsGivenDomain( - @gqlArg("domain", { type: GraphQLString }) domain: string, - ): Promise { + @gqlField({ + nodeName: "User", + type: "[Contact]", + name: "contactsGivenDomain", + args: [ + { + name: "domain", + type: GraphQLString, + }, + ], + async: true, + }) + async getContactsGivenDomain(domain: string): Promise { const contactInfos = await this.queryContactInfos(); return contactInfos.filterMap((info) => { return { @@ -146,9 +164,11 @@ export class User extends UserBase { } @gqlField({ + nodeName: "User", type: "[Contact]", name: "contactsSameDomainNullable", nullable: true, + async: true, }) async getContactsSameDomainNullable(): Promise { // the behavior here is inconsistent but meh @@ -174,9 +194,11 @@ export class User extends UserBase { } @gqlField({ + nodeName: "User", type: "[Contact]", name: "contactsSameDomainNullableContents", nullable: "contents", + async: true, }) async getContactsSameDomainNullableContents(): Promise<(Contact | null)[]> { // the behavior here is inconsistent but meh @@ -195,9 +217,11 @@ export class User extends UserBase { } @gqlField({ + nodeName: "User", type: "[Contact]", name: "contactsSameDomainNullableContentsAndList", nullable: "contentsAndList", + async: true, }) async getContactsSameDomainNullableContentsAndList(): Promise< (Contact | null)[] | null @@ -217,7 +241,11 @@ export class User extends UserBase { }); } - @gqlField({ name: "commentsAuthored", type: gqlConnection("Comment") }) + @gqlField({ + nodeName: "User", + name: "commentsAuthored", + type: gqlConnection("Comment"), + }) getCommentsAuthored(): UserToCommentsAuthoredQuery { return new UserToCommentsAuthoredQuery(this.viewer, this); } diff --git a/examples/simple/src/ent/user/query/user_to_likes_query.ts b/examples/simple/src/ent/user/query/user_to_likes_query.ts index 8bf7614c7..f72c033b2 100644 --- a/examples/simple/src/ent/user/query/user_to_likes_query.ts +++ b/examples/simple/src/ent/user/query/user_to_likes_query.ts @@ -4,6 +4,13 @@ import { AssocEdge } from "@snowtop/ent"; import { UserToLikesQueryBase } from "../../internal"; -export class UserToLikesEdge extends AssocEdge {} +import { gqlField } from "@snowtop/ent/graphql"; + +export class UserToLikesEdge extends AssocEdge { + @gqlField({ nodeName: "UserToLikesEdge", type: "Date", name: "time" }) + getTime(): Date { + return this.time; + } +} export class UserToLikesQuery extends UserToLikesQueryBase {} diff --git a/examples/simple/src/graphql/generated/resolvers/user/user_to_likes_connection_type.ts b/examples/simple/src/graphql/generated/resolvers/user/user_to_likes_connection_type.ts index 49bd981fc..dd7429c94 100644 --- a/examples/simple/src/graphql/generated/resolvers/user/user_to_likes_connection_type.ts +++ b/examples/simple/src/graphql/generated/resolvers/user/user_to_likes_connection_type.ts @@ -3,7 +3,11 @@ * Generated by github.com/lolopinto/ent/ent, DO NOT EDIT. */ -import { GraphQLFieldConfigMap, GraphQLObjectType } from "graphql"; +import { + GraphQLFieldConfigMap, + GraphQLNonNull, + GraphQLObjectType, +} from "graphql"; import { RequestContext } from "@snowtop/ent"; import { GraphQLConnectionType, @@ -28,13 +32,13 @@ export const UserToLikesConnectionType = () => { RequestContext > => ({ time: { - type: GraphQLTime, + type: new GraphQLNonNull(GraphQLTime), resolve: ( edge: GraphQLEdge, args: {}, context: RequestContext, ) => { - return edge.edge.time; + return edge.edge.getTime(); }, }, }), diff --git a/examples/simple/src/graphql/generated/schema.gql b/examples/simple/src/graphql/generated/schema.gql index 874388ae1..3e19786f8 100644 --- a/examples/simple/src/graphql/generated/schema.gql +++ b/examples/simple/src/graphql/generated/schema.gql @@ -788,7 +788,7 @@ type UserToLikersConnection implements Connection { type UserToLikesEdge implements Edge { node: Node! cursor: String! - time: Time + time: Time! } type UserToLikesConnection implements Connection { diff --git a/examples/simple/src/graphql/mutations/auth.ts b/examples/simple/src/graphql/mutations/auth.ts index e9f4e43da..1e6da50ea 100644 --- a/examples/simple/src/graphql/mutations/auth.ts +++ b/examples/simple/src/graphql/mutations/auth.ts @@ -3,12 +3,11 @@ import { gqlField, gqlMutation, gqlContextType, - gqlArg, gqlObjectType, encodeGQLID, } from "@snowtop/ent/graphql"; import { ID, RequestContext } from "@snowtop/ent"; -import { GraphQLID } from "graphql"; +import { GraphQLID, GraphQLString } from "graphql"; import { useAndVerifyAuth, useAndVerifyAuthJWT } from "@snowtop/ent-passport"; import { User } from "../../ent"; @@ -16,23 +15,38 @@ import { User } from "../../ent"; // we're going to test exporting UserAuthInput types // and not exporting JWT versions export class UserAuthInput { - @gqlField() + @gqlField({ + nodeName: "UserAuthInput", + type: GraphQLString, + }) emailAddress: string = ""; - @gqlField() + @gqlField({ + nodeName: "UserAuthInput", + type: GraphQLString, + }) password: string = ""; } @gqlInputObjectType() class UserAuthJWTInput { - @gqlField() + @gqlField({ + nodeName: "UserAuthJWTInput", + type: GraphQLString, + }) emailAddress: string = ""; - @gqlField() + @gqlField({ + nodeName: "UserAuthJWTInput", + type: GraphQLString, + }) password: string = ""; } @gqlObjectType() export class UserAuthPayload { - @gqlField({ type: GraphQLID }) + @gqlField({ + nodeName: "UserAuthPayload", + type: GraphQLID, + }) viewerID: ID = ""; } @@ -40,18 +54,36 @@ export class UserAuthPayload { @gqlObjectType() class UserAuthJWTPayload { - @gqlField() + @gqlField({ + nodeName: "UserAuthJWTPayload", + type: GraphQLString, + }) token: string = ""; - @gqlField({ type: GraphQLID }) + @gqlField({ + nodeName: "UserAuthJWTPayload", + type: GraphQLID, + }) viewerID: ID = ""; } export class AuthResolver { - @gqlMutation({ name: "userAuth", type: UserAuthPayload }) + @gqlMutation({ + nodeName: "AuthResolver", + name: "userAuth", + type: "UserAuthPayload", + async: true, + args: [ + gqlContextType(), + { + name: "input", + type: "UserAuthInput", + }, + ], + }) async userAuth( - @gqlContextType() context: RequestContext, - @gqlArg("input") input: UserAuthInput, + context: RequestContext, + input: UserAuthInput, ): Promise { const viewer = await useAndVerifyAuth( context, @@ -77,10 +109,22 @@ export class AuthResolver { }; } - @gqlMutation({ name: "userAuthJWT", type: UserAuthJWTPayload }) + @gqlMutation({ + nodeName: "AuthResolver", + name: "userAuthJWT", + type: "UserAuthJWTPayload", + async: true, + args: [ + gqlContextType(), + { + name: "input", + type: "UserAuthJWTInput", + }, + ], + }) async userAuthJWT( - @gqlContextType() context: RequestContext, - @gqlArg("input") input: UserAuthJWTInput, + context: RequestContext, + input: UserAuthJWTInput, ): Promise { const [viewer, token] = await useAndVerifyAuthJWT( context, diff --git a/examples/simple/src/graphql/mutations/import_contact.ts b/examples/simple/src/graphql/mutations/import_contact.ts index 61ab1a9e1..13d6e8810 100644 --- a/examples/simple/src/graphql/mutations/import_contact.ts +++ b/examples/simple/src/graphql/mutations/import_contact.ts @@ -1,6 +1,5 @@ import { ID, RequestContext } from "@snowtop/ent"; import { - gqlArg, gqlContextType, gqlMutation, gqlFileUpload, @@ -19,11 +18,26 @@ import { ExampleViewer } from "../../viewer/viewer"; import { ContactEmailLabel } from "src/ent/generated/types"; export class ImportContactResolver { - @gqlMutation({ type: User }) + @gqlMutation({ + nodeName: "ImportContactResolver", + type: User, + args: [ + gqlContextType(), + { + name: "userID", + type: GraphQLID, + }, + { + name: "file", + type: gqlFileUpload, + }, + ], + async: true, + }) async bulkUploadContact( - @gqlContextType() context: RequestContext, - @gqlArg("userID", { type: GraphQLID }) userID: ID, - @gqlArg("file", { type: gqlFileUpload }) file: Promise, + context: RequestContext, + userID: ID, + file: Promise, ) { const file2 = await file; diff --git a/examples/simple/src/graphql/resolvers/viewer.ts b/examples/simple/src/graphql/resolvers/viewer.ts index ccf2831cb..3d310078d 100644 --- a/examples/simple/src/graphql/resolvers/viewer.ts +++ b/examples/simple/src/graphql/resolvers/viewer.ts @@ -5,7 +5,7 @@ import { gqlQuery, encodeGQLID, } from "@snowtop/ent/graphql"; -import { GraphQLID } from "graphql"; +import { GraphQLID, GraphQLString } from "graphql"; import { RequestContext } from "@snowtop/ent"; import { User } from "../../ent"; @@ -18,7 +18,12 @@ import { DateTime } from "luxon"; export class GQLViewer { constructor(private viewer: ExampleViewer) {} - @gqlField({ type: GraphQLID, nullable: true }) + @gqlField({ + nodeName: "GQLViewer", + type: GraphQLID, + nullable: true, + async: true, + }) async viewerID() { const user = await this.user(); if (!user) { @@ -27,7 +32,12 @@ export class GQLViewer { return encodeGQLID(user); } - @gqlField({ type: User, nullable: true }) + @gqlField({ + nodeName: "GQLViewer", + type: User, + nullable: true, + async: true, + }) async user(): Promise { const v = this.viewer.viewerID; if (!v) { @@ -38,11 +48,31 @@ export class GQLViewer { } export class ViewerResolver { - @gqlQuery({ name: "viewer", type: GQLViewer }) - viewer(@gqlContextType() context: RequestContext): GQLViewer { + @gqlQuery({ + nodeName: "ViewerResolver", + name: "viewer", + type: "GQLViewer", + args: [gqlContextType()], + }) + viewer(context: RequestContext): GQLViewer { return new GQLViewer(context.getViewer()); } + @gqlQuery({ + nodeName: "ViewerResolver", + name: "timeDiff", + type: GraphQLString, + args: [ + { + name: "time", + type: "Date", + }, + { + name: "log", + type: "JSON", + }, + ], + }) timeDiff(time: Date, _log: any) { const diff = DateTime.now().diff(DateTime.fromJSDate(time)); return diff.toString(); diff --git a/examples/simple/src/schema/custom_graphql.json b/examples/simple/src/schema/custom_graphql.json deleted file mode 100644 index f909befb5..000000000 --- a/examples/simple/src/schema/custom_graphql.json +++ /dev/null @@ -1,285 +0,0 @@ -{ - "queries":[ - { - "class": "ViewerResolver", - "name": "viewer", - "args":[ - { - "name": "context", - "type": "Context", - "isContextArg": true - } - ], - "resultType": "GQLViewer", - "fieldType": "FUNCTION" - }, - { - "class": "ViewerResolver", - "name": "timeDiff", - "args":[ - { - "name": "time", - "type": "Date" - }, - { - "name": "log", - "type": "JSON" - } - ], - "resultType": "String", - "fieldType": "FUNCTION" - } - ], - "mutations":[ - { - "class": "AuthResolver", - "name": "userAuth", - "args":[ - { - "name": "context", - "type": "Context", - "isContextArg": true - }, - { - "name": "input", - "type": "UserAuthInput" - } - ], - "resultType": "UserAuthPayload", - "fieldType": "ASYNC_FUNCTION" - }, - { - "class": "AuthResolver", - "name": "userAuthJWT", - "args":[ - { - "name": "context", - "type": "Context", - "isContextArg": true - }, - { - "name": "input", - "type": "UserAuthJWTInput" - } - ], - "resultType": "UserAuthJWTPayload", - "fieldType": "ASYNC_FUNCTION" - }, - { - "class": "ImportContactResolver", - "name": "bulkUploadContact", - "args": [ - { - "name": "context", - "type": "Context", - "isContextArg": true - }, - { - "name": "userID", - "type": "ID" - }, - { - "name": "file", - "type": { - "type": "GraphQLUpload", - "importPath": "graphql-upload", - "tsType": "FileUpload", - "tsImportPath": "graphql-upload" - } - } - ], - "resultType": "User" - } - ], - "inputs":[ - { - "name": "UserAuthInput", - "fields":[ - { - "name": "emailAddress", - "fieldType": "FIELD", - "resultType": "String" - }, - { - "name": "password", - "fieldType": "FIELD", - "resultType": "String" - } - ] - }, - { - "name": "UserAuthJWTInput", - "fields":[ - { - "name": "emailAddress", - "fieldType": "FIELD", - "resultType": "String" - }, - { - "name": "password", - "fieldType": "FIELD", - "resultType": "String" - } - ] - } - ], - "objects":[ - { - "name": "UserAuthPayload", - "fields":[ - { - "name": "viewerID", - "fieldType": "FIELD", - "resultType": "ID" - } - ] - }, - { - "name": "UserAuthJWTPayload", - "fields":[ - { - "name": "token", - "fieldType": "FIELD", - "resultType": "String" - }, - { - "name": "viewerID", - "fieldType": "FIELD", - "resultType": "ID" - } - ] - }, - { - "name": "GQLViewer", - "graphQLName": "Viewer", - "fields":[ - { - "name": "viewerID", - "fieldType": "ASYNC_FUNCTION", - "resultType": "ID", - "nullable": true - }, - { - "name": "user", - "fieldType": "ASYNC_FUNCTION", - "resultType": "User", - "nullable": true - } - ] - }, - { - "name": "EmailInfo", - "graphQLName": "EmailInfo", - "fields": [ - { - "name": "emails", - "fieldType": "FIELD", - "resultType": "ContactEmail", - "list": true - }, - { - "name": "firstEmail", - "fieldType": "FIELD", - "resultType": "String" - } - ] - } - ], - "fields":{ - "Contact": [ - { - "name": "fullName", - "resultType": "String", - "fieldType": "ACCESSOR" - }, - { - "name": "plusEmails", - "functionName": "queryPlusEmails", - "resultType": "EmailInfo", - "fieldType": "ASYNC_FUNCTION" - } - ], - "User": [ - { - "name": "fullName", - "resultType": "String", - "fieldType": "ACCESSOR" - }, - { - "name": "bar", - "functionName": "getUserBar", - "resultType": "String", - "nullable": true, - "fieldType": "FUNCTION" - }, - { - "name": "contactSameDomain", - "functionName": "getFirstContactSameDomain", - "resultType": "Contact", - "nullable": true, - "fieldType": "ASYNC_FUNCTION", - "description": "contacts same domain..." - }, - { - "name": "contactsSameDomain", - "functionName": "getContactsSameDomain", - "resultType": "Contact", - "list": true, - "fieldType": "ASYNC_FUNCTION" - }, - { - "name": "contactsGivenDomain", - "functionName": "getContactsGivenDomain", - "resultType": "Contact", - "list": true, - "fieldType": "ASYNC_FUNCTION", - "args": [ - { - "name": "domain", - "type": "String" - } - ] - }, - { - "name": "contactsSameDomainNullable", - "functionName": "getContactsSameDomainNullable", - "resultType": "Contact", - "list": true, - "fieldType": "ASYNC_FUNCTION", - "nullable": true - }, - { - "name": "contactsSameDomainNullableContents", - "functionName": "getContactsSameDomainNullableContents", - "resultType": "Contact", - "list": true, - "fieldType": "ASYNC_FUNCTION", - "nullable": "contents" - }, - { - "name": "contactsSameDomainNullableContentsAndList", - "functionName": "getContactsSameDomainNullableContentsAndList", - "resultType": "Contact", - "list": true, - "fieldType": "ASYNC_FUNCTION", - "nullable": "contentsAndList" - }, - { - "name": "commentsAuthored", - "functionName": "getCommentsAuthored", - "resultType": "Comment", - "connection": true, - "fieldType": "ASYNC_FUNCTION" - } - ], - "UserToLikesEdge": [ - { - "name": "time", - "functionName": "time", - "resultType": "Date", - "fieldType": "ACCESSOR", - "nullable": false - } - ] - } -} \ No newline at end of file diff --git a/examples/simple/tsconfig.json b/examples/simple/tsconfig.json index 03ee04e39..438369276 100644 --- a/examples/simple/tsconfig.json +++ b/examples/simple/tsconfig.json @@ -10,8 +10,6 @@ "baseUrl": ".", "moduleResolution": "node", "esModuleInterop": true, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, "strict": true, "noUnusedLocals": true, "skipLibCheck": true diff --git a/internal/codegen/codegen_processor.go b/internal/codegen/codegen_processor.go index 070cb00ef..27408428c 100644 --- a/internal/codegen/codegen_processor.go +++ b/internal/codegen/codegen_processor.go @@ -450,6 +450,7 @@ func NewCodegenProcessor(currentSchema *schema.Schema, configPath string, option existingSchema := parseExistingSchema(cfg, opt.buildInfo) changes, err := schema.CompareSchemas(existingSchema, currentSchema) + if err != nil { return nil, err } @@ -500,15 +501,17 @@ func NewTestCodegenProcessor(configPath string, s *schema.Schema, codegenCfg *Co return nil, err } return &Processor{ - Config: cfg, - Schema: s, - opt: &option{}, + Config: cfg, + Schema: s, + opt: &option{}, + ChangeMap: make(change.ChangeMap), }, nil } func FormatTS(cfg *Config) error { p := &Processor{ - Config: cfg, + Config: cfg, + ChangeMap: make(change.ChangeMap), } return p.FormatTS() } diff --git a/internal/graphql/generate_ts_code.go b/internal/graphql/generate_ts_code.go index d64d19340..d76ab81f2 100644 --- a/internal/graphql/generate_ts_code.go +++ b/internal/graphql/generate_ts_code.go @@ -59,6 +59,7 @@ var knownTypes = map[string]*tsimport.ImportPath{ "Connection": tsimport.NewEntGraphQLImportPath("GraphQLConnectionInterface"), } +// this should be somewhat kept in touch with knownAllowedNams in src/graphql/graphql.ts var knownTsTypes = map[string]string{ "String": "string", "Date": "Date", diff --git a/internal/schema/compare_schema.go b/internal/schema/compare_schema.go index c1588f02d..696a1c0c6 100644 --- a/internal/schema/compare_schema.go +++ b/internal/schema/compare_schema.go @@ -20,7 +20,7 @@ func CompareSchemas(s1, s2 *Schema) (change.ChangeMap, error) { // if don't have either schema, just get out and we'll handle that elsewhere if s1 == nil || s2 == nil { - return nil, nil + return m, nil } if err := comparePatterns(s1.Patterns, s2.Patterns, &m); err != nil { diff --git a/ts/package-lock.json b/ts/package-lock.json index 57160bbd3..bf6b56b12 100644 --- a/ts/package-lock.json +++ b/ts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@snowtop/ent", - "version": "0.1.0-alpha119", + "version": "0.1.0-alpha125", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@snowtop/ent", - "version": "0.1.0-alpha119", + "version": "0.1.0-alpha125", "license": "MIT", "dependencies": { "@types/node": "^18.11.18", @@ -25,7 +25,7 @@ "prettier": "^2.8.1", "snake-case": "^3.0.4", "ts-node": "^10.9.1", - "tsconfig-paths": "^4.1.1", + "tsconfig-paths": "^4.2.0", "tslib": "^2.5.0", "typescript": "^5.0.4", "uuid": "^9.0.0" @@ -6336,11 +6336,11 @@ } }, "node_modules/tsconfig-paths": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.1.1.tgz", - "integrity": "sha512-VgPrtLKpRgEAJsMj5Q/I/mXouC6A/7eJ/X4Nuk6o0cRPwBtznYxTCU4FodbexbzH9somBPEXYi0ZkUViUpJ21Q==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", "dependencies": { - "json5": "^2.2.1", + "json5": "^2.2.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" }, @@ -11483,11 +11483,11 @@ } }, "tsconfig-paths": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.1.1.tgz", - "integrity": "sha512-VgPrtLKpRgEAJsMj5Q/I/mXouC6A/7eJ/X4Nuk6o0cRPwBtznYxTCU4FodbexbzH9somBPEXYi0ZkUViUpJ21Q==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", "requires": { - "json5": "^2.2.1", + "json5": "^2.2.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" }, diff --git a/ts/package.json b/ts/package.json index 16bfd30ec..212d133e6 100644 --- a/ts/package.json +++ b/ts/package.json @@ -1,6 +1,6 @@ { "name": "@snowtop/ent", - "version": "0.1.0-alpha119", + "version": "0.1.0-alpha126", "description": "snowtop ent framework", "main": "index.js", "types": "index.d.ts", @@ -24,7 +24,7 @@ "prettier": "^2.8.1", "snake-case": "^3.0.4", "ts-node": "^10.9.1", - "tsconfig-paths": "^4.1.1", + "tsconfig-paths": "^4.2.0", "tslib": "^2.5.0", "typescript": "^5.0.4", "uuid": "^9.0.0" diff --git a/ts/src/graphql/graphql.ts b/ts/src/graphql/graphql.ts index db633dc57..90fe0c60c 100644 --- a/ts/src/graphql/graphql.ts +++ b/ts/src/graphql/graphql.ts @@ -147,6 +147,7 @@ export const knownAllowedNames: Map = new Map([ ["Int", "number"], ["Float", "number"], ["ID", "ID"], + ["JSON", "any"], ]); export const knownDisAllowedNames: Map = new Map([ From 007bdfcd00dee959838964881f24cd688fdae6c4 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Thu, 4 May 2023 11:25:29 -0700 Subject: [PATCH 12/17] some tests --- internal/field/field_info.go | 3 + internal/graphql/custom_ts_test.go | 86 +++++++++++++++++++---- internal/graphql/generate_ts_code.go | 1 - internal/testingutils/compiler_options.go | 10 ++- 4 files changed, 78 insertions(+), 22 deletions(-) diff --git a/internal/field/field_info.go b/internal/field/field_info.go index 62fadf446..35d8b70f0 100644 --- a/internal/field/field_info.go +++ b/internal/field/field_info.go @@ -126,6 +126,9 @@ func (fieldInfo *FieldInfo) SingleFieldPrimaryKey() string { func (fieldInfo *FieldInfo) addField(f *Field) error { name := NormalizedField(f.FieldName) + if name == "" { + return fmt.Errorf("invalid db col `%s` for Field `%s`", name, f.FieldName) + } if fieldInfo.cols[f.dbName] != nil { return fmt.Errorf("field with column %s already exists", f.dbName) } diff --git a/internal/graphql/custom_ts_test.go b/internal/graphql/custom_ts_test.go index 5355c5e4c..02de1d002 100644 --- a/internal/graphql/custom_ts_test.go +++ b/internal/graphql/custom_ts_test.go @@ -74,11 +74,22 @@ func TestCustomMutation(t *testing.T) { code := testhelper.GetCodeWithSchema(` import {RequestContext} from "{root}"; - import {gqlMutation, gqlArg} from "{graphql}"; + import {gqlMutation} from "{graphql}"; export class AuthResolver { - @gqlMutation({ name: "emailAvailable", type: Boolean }) - async emailAvailableMutation(@gqlArg("email") email: string) { + @gqlMutation({ + nodeName: "AuthResolver", + name: "emailAvailable", + type: Boolean, + async: true, + args: [ + { + name: "email", + type: 'String', + }, + ], + }) + async emailAvailableMutation(email: string) { return false; } } @@ -206,11 +217,22 @@ func TestCustomQuery(t *testing.T) { code := testhelper.GetCodeWithSchema(` import {RequestContext} from "{root}"; - import {gqlQuery, gqlArg} from "{graphql}"; + import {gqlQuery} from "{graphql}"; export class AuthResolver { - @gqlQuery({ name: "emailAvailable", type: Boolean }) - async emailAvailable(@gqlArg("email") email: string) { + @gqlQuery({ + nodeName: "AuthResolver", + name: "emailAvailable", + type: Boolean, + async: true, + args: [ + { + name: "email", + type: 'String', + }, + ], + }) + async emailAvailable(email: string) { return false; } } @@ -326,11 +348,22 @@ func TestCustomListQuery(t *testing.T) { code := testhelper.GetCodeWithSchema(` import {RequestContext} from "{root}"; - import {gqlQuery, gqlArg} from "{graphql}"; + import {gqlQuery} from "{graphql}"; export class AuthResolver { - @gqlQuery({ name: "emailsAvailable", type: [Boolean] }) - async emailsAvailable(@gqlArg("emails", {type: [String]}) emails: string[]) { + @gqlQuery({ + nodeName: 'AuthResolver', + name: "emailsAvailable", + type: [Boolean], + async: true, + args: [ + { + name: 'emails', + type: [String], + }, + ], + }) + async emailsAvailable(emails: string[]) { const arr = new Array(emails.length); return arr.fill(false); } @@ -478,11 +511,23 @@ func TestCustomQueryReferencesExistingObject(t *testing.T) { code := testhelper.GetCodeWithSchema(` import {RequestContext} from "{root}"; - import {gqlQuery, gqlArg} from "{graphql}"; + import {gqlQuery} from "{graphql}"; export class UsernameResolver { - @gqlQuery({ name: "username", type: "User", nullable:true }) - async username(@gqlArg("username") username: string) { + @gqlQuery({ + nodeName: 'UsernameResolver', + name: "username", + type: "User", + nullable:true, + args: [ + { + name: "username", + type: 'String', + } + ], + async: true + }) + async username(username: string) { // not actually typed here so fine return null; } @@ -601,12 +646,23 @@ func TestCustomUploadType(t *testing.T) { code := testhelper.GetCodeWithSchema(` import {RequestContext} from "{root}"; - import {gqlMutation, gqlArg, gqlFileUpload} from "{graphql}"; + import {gqlMutation, gqlFileUpload} from "{graphql}"; export class ProfilePicResolver { - @gqlMutation({ name: "profilePicUpload", type: Boolean }) + @gqlMutation({ + nodeName: 'ProfilePicResolver', + name: "profilePicUpload", + type: Boolean, + async: true, + args: [ + { + name: "file", + type: gqlFileUpload, + }, + ], + }) // TODO TS type - async profilePicUpload(@gqlArg("file", {type: gqlFileUpload}) file) { + async profilePicUpload(file) { return true; } } diff --git a/internal/graphql/generate_ts_code.go b/internal/graphql/generate_ts_code.go index d76ab81f2..f3120ac7d 100644 --- a/internal/graphql/generate_ts_code.go +++ b/internal/graphql/generate_ts_code.go @@ -556,7 +556,6 @@ func getFilePathForCustomQuery(cfg *codegen.Config, name string) string { var searchFor = []string{ "@gqlField", - "@gqlArg", "@gqlArgType", "@gqlInputObjectType", "@gqlObjectType", diff --git a/internal/testingutils/compiler_options.go b/internal/testingutils/compiler_options.go index a7beba377..aa9eeb380 100644 --- a/internal/testingutils/compiler_options.go +++ b/internal/testingutils/compiler_options.go @@ -8,12 +8,10 @@ import ( func DefaultCompilerOptions() string { opts, err := json.Marshal(map[string]interface{}{ - "lib": []string{"esnext", "dom"}, - "moduleResolution": "node", - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "downlevelIteration": true, - "esModuleInterop": true, + "lib": []string{"esnext", "dom"}, + "moduleResolution": "node", + "downlevelIteration": true, + "esModuleInterop": true, }) if err != nil { panic(errors.Wrap(err, "error creating json compiler options")) From 6cc715d98d9a7df5e20517586326c8a462a15760 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Thu, 4 May 2023 11:26:27 -0700 Subject: [PATCH 13/17] disable swc for tests --- .github/workflows/go_ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/go_ci.yml b/.github/workflows/go_ci.yml index 363889d62..12d9fb1f5 100644 --- a/.github/workflows/go_ci.yml +++ b/.github/workflows/go_ci.yml @@ -86,3 +86,5 @@ jobs: DB_CONNECTION_STRING: 'postgres://postgres:postgres@localhost:5432/postgres' POSTGRES_PASSWORD: 'postgres' POSTGRES_USER: 'postgres' + # TODO https://github.com/lolopinto/ent/issues/1384 + DISABLE_SWC: 'true' From 78fee1ef73a21f1064d1f1012e42d156b8ce81d9 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Thu, 4 May 2023 12:28:19 -0700 Subject: [PATCH 14/17] gqlQueryOptions more flexible --- ts/src/graphql/graphql.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/src/graphql/graphql.ts b/ts/src/graphql/graphql.ts index 90fe0c60c..5e61bd4dd 100644 --- a/ts/src/graphql/graphql.ts +++ b/ts/src/graphql/graphql.ts @@ -58,7 +58,8 @@ type gqlMutationOptions = Omit & { type?: gqlFieldOptionsBase["type"]; }; -type gqlQueryOptions = Omit; +// nullable allowed in query. why was it previously not allowed?? +type gqlQueryOptions = gqlFieldOptions; export enum CustomFieldType { Accessor = "ACCESSOR", From b0ed5fd8e0069e51808dae388097b080da463ee8 Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Thu, 4 May 2023 12:56:09 -0700 Subject: [PATCH 15/17] . --- internal/codegen/codegen_processor.go | 4 ++++ internal/schema/compare_schema.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/codegen/codegen_processor.go b/internal/codegen/codegen_processor.go index 27408428c..318ee820b 100644 --- a/internal/codegen/codegen_processor.go +++ b/internal/codegen/codegen_processor.go @@ -456,6 +456,10 @@ func NewCodegenProcessor(currentSchema *schema.Schema, configPath string, option } // if changes == nil, don't use changes useChanges := changes != nil + if !useChanges { + // now set changes to empty map + changes = make(change.ChangeMap) + } writeAll := !useChanges // this is different if opt.writeAll { diff --git a/internal/schema/compare_schema.go b/internal/schema/compare_schema.go index 696a1c0c6..c1588f02d 100644 --- a/internal/schema/compare_schema.go +++ b/internal/schema/compare_schema.go @@ -20,7 +20,7 @@ func CompareSchemas(s1, s2 *Schema) (change.ChangeMap, error) { // if don't have either schema, just get out and we'll handle that elsewhere if s1 == nil || s2 == nil { - return m, nil + return nil, nil } if err := comparePatterns(s1.Patterns, s2.Patterns, &m); err != nil { From 23ba41d0f11918c0dadf132304d914ea5185180f Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Thu, 4 May 2023 13:25:31 -0700 Subject: [PATCH 16/17] . --- examples/simple/package-lock.json | 14 +++++++------- examples/simple/package.json | 2 +- ts/package.json | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/simple/package-lock.json b/examples/simple/package-lock.json index e1410125b..3bf6c28df 100644 --- a/examples/simple/package-lock.json +++ b/examples/simple/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.1", "license": "ISC", "dependencies": { - "@snowtop/ent": "^0.1.0-alpha126", + "@snowtop/ent": "^0.1.0-alpha127", "@snowtop/ent-email": "^0.1.0-alpha1", "@snowtop/ent-passport": "^0.1.0-alpha3", "@snowtop/ent-password": "^0.1.0-alpha1", @@ -1133,9 +1133,9 @@ } }, "node_modules/@snowtop/ent": { - "version": "0.1.0-alpha126", - "resolved": "https://registry.npmjs.org/@snowtop/ent/-/ent-0.1.0-alpha126.tgz", - "integrity": "sha512-bK8Qrx5ZWpF3pn1MMjuRGRYahBqkRd2dK8EsTyajKH4jjtQea0PSwwIs0kLI5lMtCCLMtPJ3DaZbFI6BPff72g==", + "version": "0.1.0-alpha127", + "resolved": "https://registry.npmjs.org/@snowtop/ent/-/ent-0.1.0-alpha127.tgz", + "integrity": "sha512-LleGd6fsK+EHNyUuihPEcBnljsWLEjTS52PPKJxYwyugH8JLQQwguwg1t1CGDXU/on7gv050iGPQD7eKa/Ur7A==", "dependencies": { "@types/node": "^18.11.18", "camel-case": "^4.1.2", @@ -7013,9 +7013,9 @@ } }, "@snowtop/ent": { - "version": "0.1.0-alpha126", - "resolved": "https://registry.npmjs.org/@snowtop/ent/-/ent-0.1.0-alpha126.tgz", - "integrity": "sha512-bK8Qrx5ZWpF3pn1MMjuRGRYahBqkRd2dK8EsTyajKH4jjtQea0PSwwIs0kLI5lMtCCLMtPJ3DaZbFI6BPff72g==", + "version": "0.1.0-alpha127", + "resolved": "https://registry.npmjs.org/@snowtop/ent/-/ent-0.1.0-alpha127.tgz", + "integrity": "sha512-LleGd6fsK+EHNyUuihPEcBnljsWLEjTS52PPKJxYwyugH8JLQQwguwg1t1CGDXU/on7gv050iGPQD7eKa/Ur7A==", "requires": { "@types/node": "^18.11.18", "camel-case": "^4.1.2", diff --git a/examples/simple/package.json b/examples/simple/package.json index 4d8a1ec00..7e8294b1d 100644 --- a/examples/simple/package.json +++ b/examples/simple/package.json @@ -33,7 +33,7 @@ "tsconfig-paths": "^3.11.0" }, "dependencies": { - "@snowtop/ent": "^0.1.0-alpha126", + "@snowtop/ent": "^0.1.0-alpha127", "@snowtop/ent-email": "^0.1.0-alpha1", "@snowtop/ent-passport": "^0.1.0-alpha3", "@snowtop/ent-password": "^0.1.0-alpha1", diff --git a/ts/package.json b/ts/package.json index 212d133e6..a7559b35e 100644 --- a/ts/package.json +++ b/ts/package.json @@ -1,6 +1,6 @@ { "name": "@snowtop/ent", - "version": "0.1.0-alpha126", + "version": "0.1.0-alpha127", "description": "snowtop ent framework", "main": "index.js", "types": "index.d.ts", From a301c9cc09e9da062a7852baf045336c7d81b4bf Mon Sep 17 00:00:00 2001 From: Ola Okelola Date: Thu, 4 May 2023 13:34:08 -0700 Subject: [PATCH 17/17] update for test --- .github/testdata/user.ts.example | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/testdata/user.ts.example b/.github/testdata/user.ts.example index 275e6340c..96dff8ce9 100644 --- a/.github/testdata/user.ts.example +++ b/.github/testdata/user.ts.example @@ -5,6 +5,7 @@ import { gqlField } from "@snowtop/ent/graphql"; export class User extends UserBase { @gqlField({ + nodeName: 'User', type: GraphQLInt, }) howLong() {