-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeps.ts
86 lines (79 loc) · 1.92 KB
/
deps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
export {
buildSchema,
execute,
executeSync,
type ExecutionResult,
getOperationAST,
graphql,
type GraphQLArgs,
GraphQLError,
type GraphQLFieldResolver,
GraphQLSchema,
type GraphQLTypeResolver,
parse,
Source,
specifiedRules,
validate,
validateSchema,
} from "https://esm.sh/[email protected]";
export {
contentType,
parseMediaType,
} from "https://deno.land/[email protected]/media_types/mod.ts";
export { accepts } from "https://deno.land/[email protected]/http/negotiation.ts";
export {
isNil,
isNull,
isObject,
isString,
isUndefined,
} from "https://deno.land/x/[email protected]/mod.ts";
export {
JSON,
type json,
stringify,
} from "https://deno.land/x/[email protected]/mod.ts";
import { type json } from "https://deno.land/x/[email protected]/mod.ts";
export {
type RenderPageOptions,
renderPlaygroundPage,
} from "https://esm.sh/[email protected]";
export {
createHttpError,
HttpError,
Status,
} from "https://deno.land/[email protected]/http/mod.ts";
export type PartialBy<T, K = keyof T> =
Omit<T, K & keyof T> & Partial<Pick<T, K & keyof T>> extends infer U
? { [K in keyof U]: U[K] }
: never;
export type PickBy<T, K> = {
[k in keyof T as (K extends T[k] ? k : never)]: T[k];
};
export type PickRequired<T> = {
[k in keyof T as Record<never, never> extends Pick<T, k> ? never : k]: T[k];
};
export type PickPartial<T> = {
[k in keyof T as Record<never, never> extends Pick<T, k> ? k : never]: T[k];
};
export type jsonObject = {
[k: string]: json;
};
export function tryCatchSync<T>(
fn: () => T,
): [data: T, err: undefined] | [data: undefined, err: unknown] {
try {
return [fn(), undefined];
} catch (er) {
return [, er];
}
}
export async function tryCatch<T>(
fn: () => Promise<T> | T,
): Promise<[data: T, err: undefined] | [data: undefined, err: unknown]> {
try {
return [await fn(), undefined];
} catch (er) {
return [, er];
}
}