File tree Expand file tree Collapse file tree 7 files changed +29
-73
lines changed
typegraph/node/sdk/src/utils Expand file tree Collapse file tree 7 files changed +29
-73
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"version" : " 0" ,
3
- "platform" : " x86_64-linux " ,
3
+ "platform" : " aarch64-darwin " ,
4
4
"moduleEntries" : {
5
5
"ports" : {
6
6
"version" : " 0" ,
434
434
" dd83a99f49f3f0fba11cdd014ff718cc9539316b" ,
435
435
" 4d1916871a40b6ac730709f7721f740df192c84d" ,
436
436
" 4df902463d60efc5b8e760ea4899f6ab6df0f16e" ,
437
- " 88f6aa5ddb513712623d31a17096ea26286064da" ,
438
437
" 40d9babcd5c8e79379e58dbc2f2a967ef68fbb09" ,
439
438
" 5549508f1f5eddf9cb2465f07cf0c7603dc0c849" ,
440
439
" 5c041a4209ae50657ea5acacc26683688f2913a9" ,
849
848
},
850
849
"packageName" : " node-gyp"
851
850
},
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
- },
871
851
"40d9babcd5c8e79379e58dbc2f2a967ef68fbb09" : {
872
852
"version" : " 3.8.18" ,
873
853
"port" : {
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ const schema = {
42
42
sentry_dsn : z . string ( ) . optional ( ) ,
43
43
sentry_sample_rate : z . coerce . number ( ) . positive ( ) . min ( 0 ) . max ( 1 ) ,
44
44
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
+ */
45
48
redis_url_queue_expire_sec : z . coerce . number ( ) . positive ( ) ,
46
49
} ;
47
50
Original file line number Diff line number Diff line change @@ -24,7 +24,21 @@ export class ArtifactService {
24
24
headers : { "Content-Type" : "application/json" } ,
25
25
} ) ;
26
26
}
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
+
28
42
try {
29
43
const data = await this . #createUploadUrls(
30
44
metaList ,
Original file line number Diff line number Diff line change @@ -19,7 +19,12 @@ export interface UploadUrlStore {
19
19
expirationTimerId : number ;
20
20
}
21
21
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
+ */
22
26
function initUploadUrlStore ( ) {
27
+ // stores one to one mapping between upload URLs and
23
28
const mapToMeta = new Map < string , ArtifactMeta > ( ) ;
24
29
const expirationQueue : [ string , number ] [ ] = [ ] ;
25
30
const expirationTimerId = setInterval ( ( ) => {
Original file line number Diff line number Diff line change @@ -52,11 +52,7 @@ function serializeToRedisValue<T>(value: T): string {
52
52
}
53
53
54
54
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 ;
60
56
}
61
57
62
58
function resolveS3Key ( hash : string ) {
Original file line number Diff line number Diff line change @@ -112,6 +112,10 @@ export class MetaTest {
112
112
this . cleanups . push ( fn ) ;
113
113
}
114
114
115
+ get typegate ( ) {
116
+ return this . typegates . next ( ) ;
117
+ }
118
+
115
119
getTypegraphEngine ( name : string ) : QueryEngine | undefined {
116
120
return this . typegates . next ( ) . register . get ( name ) ;
117
121
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments