Skip to content

Commit 855310f

Browse files
committed
chore: address comments
1 parent e123736 commit 855310f

File tree

7 files changed

+29
-73
lines changed

7 files changed

+29
-73
lines changed

.ghjk/lock.json

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": "0",
3-
"platform": "x86_64-linux",
3+
"platform": "aarch64-darwin",
44
"moduleEntries": {
55
"ports": {
66
"version": "0",
@@ -434,7 +434,6 @@
434434
"dd83a99f49f3f0fba11cdd014ff718cc9539316b",
435435
"4d1916871a40b6ac730709f7721f740df192c84d",
436436
"4df902463d60efc5b8e760ea4899f6ab6df0f16e",
437-
"88f6aa5ddb513712623d31a17096ea26286064da",
438437
"40d9babcd5c8e79379e58dbc2f2a967ef68fbb09",
439438
"5549508f1f5eddf9cb2465f07cf0c7603dc0c849",
440439
"5c041a4209ae50657ea5acacc26683688f2913a9",
@@ -849,25 +848,6 @@
849848
},
850849
"packageName": "node-gyp"
851850
},
852-
"88f6aa5ddb513712623d31a17096ea26286064da": {
853-
"version": "v2.4.0",
854-
"port": {
855-
"ty": "denoWorker@v1",
856-
"name": "mold_ghrel",
857-
"platforms": [
858-
"aarch64-linux",
859-
"x86_64-linux"
860-
],
861-
"version": "0.1.0",
862-
"deps": [
863-
{
864-
"name": "tar_aa"
865-
}
866-
],
867-
"moduleSpecifier": "https://raw.githubusercontent.com/metatypedev/ghjk/423d38e/ports/mold.ts"
868-
},
869-
"replaceLd": false
870-
},
871851
"40d9babcd5c8e79379e58dbc2f2a967ef68fbb09": {
872852
"version": "3.8.18",
873853
"port": {

typegate/src/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const schema = {
4242
sentry_dsn: z.string().optional(),
4343
sentry_sample_rate: z.coerce.number().positive().min(0).max(1),
4444
sentry_traces_sample_rate: z.coerce.number().positive().min(0).max(1),
45+
/**
46+
* Time in seconds in which a URL expires after being pushed to Redis
47+
*/
4548
redis_url_queue_expire_sec: z.coerce.number().positive(),
4649
};
4750

typegate/src/services/artifact_service.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,21 @@ export class ArtifactService {
2424
headers: { "Content-Type": "application/json" },
2525
});
2626
}
27-
const metaList = getUploadUrlBodySchema.parse(await request.json());
27+
28+
let metaList;
29+
try {
30+
metaList = getUploadUrlBodySchema.parse(await request.json());
31+
} catch (error) {
32+
console.error("Failed to parse data:", error);
33+
return new Response(
34+
JSON.stringify({ error: `Invalid Request Body: ${error.message}` }),
35+
{
36+
status: 400,
37+
headers: { "Content-Type": "application/json" },
38+
},
39+
);
40+
}
41+
2842
try {
2943
const data = await this.#createUploadUrls(
3044
metaList,

typegate/src/typegate/artifacts/local.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ export interface UploadUrlStore {
1919
expirationTimerId: number;
2020
}
2121

22+
/**
23+
* Initialize Upload URLs store. The URL store holds the upload URLs used for persisiting artifacts. Each URL is mapped to the Artifact Meta to be uploaded. The store uses an Expiration Queue to keep track of expiration status of URLs and discards the URLs upon expiration.
24+
* @returns URL to Artifact Meta map, URL expiration queue and expiration timer Id
25+
*/
2226
function initUploadUrlStore() {
27+
// stores one to one mapping between upload URLs and
2328
const mapToMeta = new Map<string, ArtifactMeta>();
2429
const expirationQueue: [string, number][] = [];
2530
const expirationTimerId = setInterval(() => {

typegate/src/typegate/artifacts/shared.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ function serializeToRedisValue<T>(value: T): string {
5252
}
5353

5454
function deserializeToCustom<T>(value: string): T {
55-
try {
56-
return JSON.parse(value) as T;
57-
} catch (error) {
58-
throw error;
59-
}
55+
return JSON.parse(value) as T;
6056
}
6157

6258
function resolveS3Key(hash: string) {

typegate/tests/utils/test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ export class MetaTest {
112112
this.cleanups.push(fn);
113113
}
114114

115+
get typegate() {
116+
return this.typegates.next();
117+
}
118+
115119
getTypegraphEngine(name: string): QueryEngine | undefined {
116120
return this.typegates.next().register.get(name);
117121
}

typegraph/node/sdk/src/utils/file_utils.ts

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)