From 7e9b7784d3834ab1a8de1e9aa80f11302c66c8ff Mon Sep 17 00:00:00 2001 From: Natoandro Date: Thu, 27 Jun 2024 09:18:33 +0300 Subject: [PATCH 1/2] ensure all deps are defined in import_map.json --- typegate/import_map.json | 3 +++ typegate/src/engine/typecheck/common.ts | 19 +++++++++++-------- typegate/tests/utils/database.ts | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/typegate/import_map.json b/typegate/import_map.json index ac11c2c8b1..f7b834795a 100644 --- a/typegate/import_map.json +++ b/typegate/import_map.json @@ -9,6 +9,9 @@ "sentry": "npm:@sentry/node@7.70.0", "dataloader": "npm:dataloader@2.2.2", "chance": "npm:chance@1.1.11", + "validator": "npm:validator@13.12.0", + "lodash": "npm:lodash@4.17.21", + "pg": "npm:pg@8.12.0", "swc": "https://deno.land/x/swc@0.2.1/mod.ts", "swc/types": "https://esm.sh/@swc/core@1.3.87/types.d.ts?pin=v131", "zod": "https://deno.land/x/zod@v3.22.2/mod.ts", diff --git a/typegate/src/engine/typecheck/common.ts b/typegate/src/engine/typecheck/common.ts index e892f268b0..c259898ec1 100644 --- a/typegate/src/engine/typecheck/common.ts +++ b/typegate/src/engine/typecheck/common.ts @@ -3,8 +3,8 @@ import { StringFormat } from "../../typegraph/types.ts"; import * as uuid from "std/uuid/mod.ts"; -import validator from "npm:validator"; -import lodash from "npm:lodash"; +import validator from "validator"; +import lodash from "lodash"; export type ErrorEntry = [path: string, message: string]; @@ -32,12 +32,15 @@ const formatValidators: Record = { email: validator.isEmail, // TODO validatorjs does not have a URI validator, so this is stricter than expected uri: (value: string) => { - return validator.isDataURI(value) || validator.isURL(value, { - require_protocol: true, - require_valid_protocol: false, - require_host: true, - require_tld: false, - }); + return ( + validator.isDataURI(value) || + validator.isURL(value, { + require_protocol: true, + require_valid_protocol: false, + require_host: true, + require_tld: false, + }) + ); }, // TODO hostname: validator.isFQDN, diff --git a/typegate/tests/utils/database.ts b/typegate/tests/utils/database.ts index d23a94d93a..74dc7d57d3 100644 --- a/typegate/tests/utils/database.ts +++ b/typegate/tests/utils/database.ts @@ -1,7 +1,7 @@ // Copyright Metatype OÜ, licensed under the Elastic License 2.0. // SPDX-License-Identifier: Elastic-2.0 -import pg from "npm:pg"; +import pg from "pg"; import { removeMigrations } from "test-utils/migrations.ts"; export async function dropSchema(schema: string) { From f03e8578ef48af4e80e353eb90d1633447b649e7 Mon Sep 17 00:00:00 2001 From: Natoandro Date: Thu, 27 Jun 2024 09:49:01 +0300 Subject: [PATCH 2/2] update deno.lock --- typegate/deno.lock | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/typegate/deno.lock b/typegate/deno.lock index b981a310f1..dbde8c549b 100644 --- a/typegate/deno.lock +++ b/typegate/deno.lock @@ -19,11 +19,11 @@ "npm:chance@1.1.11": "npm:chance@1.1.11", "npm:graphql@16.8.1": "npm:graphql@16.8.1", "npm:json-schema-faker@0.5.3": "npm:json-schema-faker@0.5.3", - "npm:lodash": "npm:lodash@4.17.21", + "npm:lodash@4.17.21": "npm:lodash@4.17.21", "npm:mathjs@11.11.1": "npm:mathjs@11.11.1", "npm:multiformats@13.1.0": "npm:multiformats@13.1.0", - "npm:pg": "npm:pg@8.11.3", - "npm:validator": "npm:validator@13.11.0", + "npm:pg@8.12.0": "npm:pg@8.12.0", + "npm:validator@13.12.0": "npm:validator@13.12.0", "npm:zod-validation-error@3.3.0": "npm:zod-validation-error@3.3.0_zod@3.23.8", "npm:zod@3.23.8": "npm:zod@3.23.8" }, @@ -411,6 +411,10 @@ "integrity": "sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==", "dependencies": {} }, + "pg-connection-string@2.6.4": { + "integrity": "sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA==", + "dependencies": {} + }, "pg-int8@1.0.1": { "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", "dependencies": {} @@ -421,10 +425,20 @@ "pg": "pg@8.11.3" } }, + "pg-pool@3.6.2_pg@8.12.0": { + "integrity": "sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==", + "dependencies": { + "pg": "pg@8.12.0" + } + }, "pg-protocol@1.6.0": { "integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==", "dependencies": {} }, + "pg-protocol@1.6.1": { + "integrity": "sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==", + "dependencies": {} + }, "pg-types@2.2.0": { "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", "dependencies": { @@ -448,6 +462,17 @@ "pgpass": "pgpass@1.0.5" } }, + "pg@8.12.0": { + "integrity": "sha512-A+LHUSnwnxrnL/tZ+OLfqR1SxLN3c/pgDztZ47Rpbsd4jUytsTtwQo/TLPRzPJMp/1pbhYVhH9cuSZLAajNfjQ==", + "dependencies": { + "pg-cloudflare": "pg-cloudflare@1.1.1", + "pg-connection-string": "pg-connection-string@2.6.4", + "pg-pool": "pg-pool@3.6.2_pg@8.12.0", + "pg-protocol": "pg-protocol@1.6.1", + "pg-types": "pg-types@2.2.0", + "pgpass": "pgpass@1.0.5" + } + }, "pgpass@1.0.5": { "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", "dependencies": { @@ -546,6 +571,10 @@ "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", "dependencies": {} }, + "validator@13.12.0": { + "integrity": "sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==", + "dependencies": {} + }, "which@2.0.2": { "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dependencies": {