Skip to content

Commit

Permalink
fix(gate): ensure all deps are defined in import_map.json (#768)
Browse files Browse the repository at this point in the history
Ensure that all deps are defined in `import_map.json` with a specific
version.
  • Loading branch information
Natoandro authored Jun 28, 2024
1 parent 1076dce commit 3ed6e1e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 12 deletions.
35 changes: 32 additions & 3 deletions typegate/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions typegate/import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"sentry": "npm:@sentry/[email protected]",
"dataloader": "npm:[email protected]",
"chance": "npm:[email protected]",
"validator": "npm:[email protected]",
"lodash": "npm:[email protected]",
"pg": "npm:[email protected]",
"swc": "https://deno.land/x/[email protected]/mod.ts",
"swc/types": "https://esm.sh/@swc/[email protected]/types.d.ts?pin=v131",
"zod": "https://deno.land/x/[email protected]/mod.ts",
Expand Down
19 changes: 11 additions & 8 deletions typegate/src/engine/typecheck/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -32,12 +32,15 @@ const formatValidators: Record<StringFormat, FormatValidator> = {
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,
Expand Down
2 changes: 1 addition & 1 deletion typegate/tests/utils/database.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit 3ed6e1e

Please sign in to comment.