@vrplatform/api 1.3.1-stage.1561 → 1.3.1-stage.1562
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main/error.js +4 -1
- package/build/main/error.js.map +1 -1
- package/build/main/generated/v1.d.ts +21 -0
- package/build/main/generated/v1.js.map +1 -1
- package/build/module/error.js +4 -1
- package/build/module/error.js.map +1 -1
- package/build/module/generated/v1.d.ts +21 -0
- package/build/module/generated/v1.js.map +1 -1
- package/package.json +1 -1
- package/src/error.ts +4 -1
- package/src/generated/v1.ts +21 -0
package/build/main/error.js
CHANGED
|
@@ -30,7 +30,10 @@ function throwIfError(response) {
|
|
|
30
30
|
if (response instanceof Promise) {
|
|
31
31
|
return response.then((response) => {
|
|
32
32
|
if (response.response.status === 503) {
|
|
33
|
-
throw new
|
|
33
|
+
throw new ApiClientError({
|
|
34
|
+
code: 'SERVICE_UNAVAILABLE',
|
|
35
|
+
message: 'Worker resources exceeded.',
|
|
36
|
+
});
|
|
34
37
|
}
|
|
35
38
|
const error = response.error;
|
|
36
39
|
if (error)
|
package/build/main/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"src/","sources":["error.ts"],"names":[],"mappings":";;;AA+CA,
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"src/","sources":["error.ts"],"names":[],"mappings":";;;AA+CA,oCAuBC;AAtED,6CAA6C;AAY7C,MAAa,cAAe,SAAQ,KAAK;IAMvC,YAAmB,KAAQ;QACzB,MAAM,OAAO,GACX,KAAK,CAAC,OAAO;YACb;gBACE,KAAK,CAAC,IAAI;gBACV,KAAK,CAAC,MAAM;oBACV,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACV,CAAC,CAAC,CAAC,OAAO,EAAG,CAAS,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;qBACrC,MAAM,CAAC,gBAAQ,CAAC;qBAChB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etchResponse } from './generated/openapi-fetch';\n\ntype E = {\n code: string;\n message: string;\n issues?: {\n message: string;\n }[];\n context?: any;\n stack?: any;\n};\nexport class ApiClientError extends Error {\n code: string;\n issues: {\n message: string;\n }[];\n context: any;\n constructor(public error: E) {\n const message =\n error.message ||\n [\n error.code,\n error.issues\n ?.map((x) =>\n [x.message, (x as any).path?.join('->')]\n .filter(hasValue)\n .join(' on ')\n )\n .join(', '),\n ]\n .filter(hasValue)\n .join(': ');\n super(message);\n\n this.code = error.code;\n this.issues = error.issues || [];\n this.context = error.context || {};\n if (error.stack) this.stack = error.stack;\n }\n}\nexport function throwIfError<T extends FetchResponse<any, any, any>>(\n response: T\n): NonNullable<T['data']>;\nexport function throwIfError<T extends FetchResponse<any, any, any>>(\n response: Promise<T>\n): Promise<NonNullable<T['data']>>;\nexport function throwIfError<T extends FetchResponse<any, any, any>>(\n response: Promise<T> | T\n): Promise<NonNullable<T['data']>> | NonNullable<T['data']> {\n if (response instanceof Promise) {\n return response.then((response) => {\n if (response.response.status === 503) {\n throw new ApiClientError({\n code: 'SERVICE_UNAVAILABLE',\n message: 'Worker resources exceeded.',\n });\n }\n\n const error: E = response.error;\n\n if (error) throw new ApiClientError(error);\n return response.data;\n });\n }\n\n const error: E = response.error;\n\n if (error) throw new ApiClientError(error);\n return response.data;\n}\n"]}
|
|
@@ -3841,6 +3841,9 @@ export interface operations {
|
|
|
3841
3841
|
ref: string;
|
|
3842
3842
|
sourceId?: string | null;
|
|
3843
3843
|
message: string;
|
|
3844
|
+
/** @enum {string} */
|
|
3845
|
+
code?: "USER_ERROR" | "NOT_FOUND" | "FORBIDDEN" | "INTERNAL_VALIDATION_ERROR" | "INTERNAL_ERROR";
|
|
3846
|
+
context?: unknown;
|
|
3844
3847
|
}[];
|
|
3845
3848
|
};
|
|
3846
3849
|
};
|
|
@@ -4336,6 +4339,9 @@ export interface operations {
|
|
|
4336
4339
|
ref: string;
|
|
4337
4340
|
sourceId?: string | null;
|
|
4338
4341
|
message: string;
|
|
4342
|
+
/** @enum {string} */
|
|
4343
|
+
code?: "USER_ERROR" | "NOT_FOUND" | "FORBIDDEN" | "INTERNAL_VALIDATION_ERROR" | "INTERNAL_ERROR";
|
|
4344
|
+
context?: unknown;
|
|
4339
4345
|
}[];
|
|
4340
4346
|
};
|
|
4341
4347
|
};
|
|
@@ -6419,6 +6425,9 @@ export interface operations {
|
|
|
6419
6425
|
ref: string;
|
|
6420
6426
|
sourceId?: string | null;
|
|
6421
6427
|
message: string;
|
|
6428
|
+
/** @enum {string} */
|
|
6429
|
+
code?: "USER_ERROR" | "NOT_FOUND" | "FORBIDDEN" | "INTERNAL_VALIDATION_ERROR" | "INTERNAL_ERROR";
|
|
6430
|
+
context?: unknown;
|
|
6422
6431
|
}[];
|
|
6423
6432
|
};
|
|
6424
6433
|
};
|
|
@@ -10217,6 +10226,9 @@ export interface operations {
|
|
|
10217
10226
|
ref: string;
|
|
10218
10227
|
sourceId?: string | null;
|
|
10219
10228
|
message: string;
|
|
10229
|
+
/** @enum {string} */
|
|
10230
|
+
code?: "USER_ERROR" | "NOT_FOUND" | "FORBIDDEN" | "INTERNAL_VALIDATION_ERROR" | "INTERNAL_ERROR";
|
|
10231
|
+
context?: unknown;
|
|
10220
10232
|
}[];
|
|
10221
10233
|
};
|
|
10222
10234
|
};
|
|
@@ -11977,6 +11989,9 @@ export interface operations {
|
|
|
11977
11989
|
ref: string;
|
|
11978
11990
|
sourceId?: string | null;
|
|
11979
11991
|
message: string;
|
|
11992
|
+
/** @enum {string} */
|
|
11993
|
+
code?: "USER_ERROR" | "NOT_FOUND" | "FORBIDDEN" | "INTERNAL_VALIDATION_ERROR" | "INTERNAL_ERROR";
|
|
11994
|
+
context?: unknown;
|
|
11980
11995
|
}[];
|
|
11981
11996
|
};
|
|
11982
11997
|
};
|
|
@@ -18972,6 +18987,9 @@ export interface operations {
|
|
|
18972
18987
|
ref: string;
|
|
18973
18988
|
sourceId?: string | null;
|
|
18974
18989
|
message: string;
|
|
18990
|
+
/** @enum {string} */
|
|
18991
|
+
code?: "USER_ERROR" | "NOT_FOUND" | "FORBIDDEN" | "INTERNAL_VALIDATION_ERROR" | "INTERNAL_ERROR";
|
|
18992
|
+
context?: unknown;
|
|
18975
18993
|
}[];
|
|
18976
18994
|
};
|
|
18977
18995
|
};
|
|
@@ -30022,6 +30040,9 @@ export interface operations {
|
|
|
30022
30040
|
ref: string;
|
|
30023
30041
|
sourceId?: string | null;
|
|
30024
30042
|
message: string;
|
|
30043
|
+
/** @enum {string} */
|
|
30044
|
+
code?: "USER_ERROR" | "NOT_FOUND" | "FORBIDDEN" | "INTERNAL_VALIDATION_ERROR" | "INTERNAL_ERROR";
|
|
30045
|
+
context?: unknown;
|
|
30025
30046
|
}[];
|
|
30026
30047
|
};
|
|
30027
30048
|
};
|