@vrplatform/api 1.3.1-1368 → 1.3.1-1419
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/cache.d.ts +2 -5
- package/build/main/cache.js.map +1 -1
- package/build/main/error.js +3 -3
- package/build/main/error.js.map +1 -1
- package/build/main/generated/v1.d.ts +21498 -15969
- package/build/main/generated/v1.js.map +1 -1
- package/build/main/types.d.ts +8 -13
- package/build/main/types.js.map +1 -1
- package/build/module/cache.d.ts +2 -5
- package/build/module/cache.js.map +1 -1
- package/build/module/error.js +3 -3
- package/build/module/error.js.map +1 -1
- package/build/module/generated/v1.d.ts +21498 -15969
- package/build/module/generated/v1.js.map +1 -1
- package/build/module/types.d.ts +8 -13
- package/build/module/types.js.map +1 -1
- package/package.json +1 -2
- package/src/cache.ts +2 -2
- package/src/error.ts +4 -3
- package/src/generated/v1.ts +21498 -15969
- package/src/types.ts +14 -14
package/build/module/types.d.ts
CHANGED
|
@@ -33,22 +33,17 @@ export type ResponseData<T extends ResponseCombinations> = T extends `${infer Me
|
|
|
33
33
|
} ? Data : never : never : never : never;
|
|
34
34
|
type RequestBodyCombinations = {
|
|
35
35
|
[Path in keyof paths]: {
|
|
36
|
-
[Method in keyof paths[Path]]: paths[Path][Method] extends never ? never : paths[Path][Method] extends {
|
|
37
|
-
requestBody: {
|
|
38
|
-
content: {
|
|
39
|
-
'application/json': unknown;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
} ? `${Method & string}:${Path}` : never;
|
|
36
|
+
[Method in keyof paths[Path]]: paths[Path][Method] extends never ? never : ExtractJsonRequestBody<paths[Path][Method]> extends never ? never : `${Method & string}:${Path}`;
|
|
43
37
|
}[keyof paths[Path]];
|
|
44
38
|
}[keyof paths];
|
|
45
|
-
|
|
46
|
-
requestBody
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
type ExtractJsonRequestBody<T> = T extends {
|
|
40
|
+
requestBody?: infer RequestBody;
|
|
41
|
+
} ? RequestBody extends {
|
|
42
|
+
content: {
|
|
43
|
+
'application/json': infer Data;
|
|
50
44
|
};
|
|
51
|
-
} ? Data : never : never
|
|
45
|
+
} ? Data : never : never;
|
|
46
|
+
export type RequestBody<T extends RequestBodyCombinations> = T extends `${infer Method}:${infer Path}` ? Path extends keyof paths ? Method extends keyof paths[Path] ? ExtractJsonRequestBody<paths[Path][Method]> : never : never : never;
|
|
52
47
|
type RequestParamCombinations = {
|
|
53
48
|
[Path in keyof paths]: {
|
|
54
49
|
[Method in keyof paths[Path]]: paths[Path][Method] extends never ? never : paths[Path][Method] extends {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type createClient from 'openapi-fetch';\nimport type { paths } from './generated/v1';\n\nexport type ApiClientAuth = {\n apiKey?: string;\n sec?: string;\n tenantId?: string;\n accessToken?: string;\n};\nexport type ApiClient = ReturnType<typeof createClient<paths>> & {\n sessionId: string;\n};\ntype ResponseCombinations = {\n [Path in keyof paths]: {\n [Method in keyof paths[Path]]: paths[Path][Method] extends never\n ? never\n : paths[Path][Method] extends {\n responses: {\n 200: { content: { 'application/json': unknown } };\n };\n }\n ? `${Method & string}:${Path}`\n : never;\n }[keyof paths[Path]];\n}[keyof paths];\n\nexport type ResponseData<T extends ResponseCombinations> =\n T extends `${infer Method}:${infer Path}`\n ? Path extends keyof paths\n ? Method extends keyof paths[Path]\n ? paths[Path][Method] extends {\n responses: {\n 200: { content: { 'application/json': infer Data } };\n };\n }\n ? Data\n : never\n : never\n : never\n : never;\n\ntype RequestBodyCombinations = {\n [Path in keyof paths]: {\n [Method in keyof paths[Path]]: paths[Path][Method] extends never\n ? never\n : paths[Path][Method] extends
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"src/","sources":["types.ts"],"names":[],"mappings":"","sourcesContent":["import type createClient from 'openapi-fetch';\nimport type { paths } from './generated/v1';\n\nexport type ApiClientAuth = {\n apiKey?: string;\n sec?: string;\n tenantId?: string;\n accessToken?: string;\n};\nexport type ApiClient = ReturnType<typeof createClient<paths>> & {\n sessionId: string;\n};\ntype ResponseCombinations = {\n [Path in keyof paths]: {\n [Method in keyof paths[Path]]: paths[Path][Method] extends never\n ? never\n : paths[Path][Method] extends {\n responses: {\n 200: { content: { 'application/json': unknown } };\n };\n }\n ? `${Method & string}:${Path}`\n : never;\n }[keyof paths[Path]];\n}[keyof paths];\n\nexport type ResponseData<T extends ResponseCombinations> =\n T extends `${infer Method}:${infer Path}`\n ? Path extends keyof paths\n ? Method extends keyof paths[Path]\n ? paths[Path][Method] extends {\n responses: {\n 200: { content: { 'application/json': infer Data } };\n };\n }\n ? Data\n : never\n : never\n : never\n : never;\n\ntype RequestBodyCombinations = {\n [Path in keyof paths]: {\n [Method in keyof paths[Path]]: paths[Path][Method] extends never\n ? never\n : ExtractJsonRequestBody<paths[Path][Method]> extends never\n ? never\n : `${Method & string}:${Path}`;\n }[keyof paths[Path]];\n}[keyof paths];\n\ntype ExtractJsonRequestBody<T> = T extends {\n requestBody?: infer RequestBody;\n}\n ? RequestBody extends {\n content: { 'application/json': infer Data };\n }\n ? Data\n : never\n : never;\n\nexport type RequestBody<T extends RequestBodyCombinations> =\n T extends `${infer Method}:${infer Path}`\n ? Path extends keyof paths\n ? Method extends keyof paths[Path]\n ? ExtractJsonRequestBody<paths[Path][Method]>\n : never\n : never\n : never;\n\ntype RequestParamCombinations = {\n [Path in keyof paths]: {\n [Method in keyof paths[Path]]: paths[Path][Method] extends never\n ? never\n : paths[Path][Method] extends {\n parameters: {\n query?: Record<string, unknown>;\n };\n }\n ? `${Method & string}:${Path}`\n : never;\n }[keyof paths[Path]];\n}[keyof paths];\n\nexport type RequestQuery<T extends RequestParamCombinations> =\n T extends `${infer Method}:${infer Path}`\n ? Path extends keyof paths\n ? Method extends keyof paths[Path]\n ? paths[Path][Method] extends {\n parameters: {\n query?: infer Data;\n };\n }\n ? Data\n : never\n : never\n : never\n : never;\n"]}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"typings": "build/main/index.d.ts",
|
|
7
7
|
"module": "build/module/index.js"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.3.1-
|
|
9
|
+
"version": "1.3.1-1419",
|
|
10
10
|
"description": "",
|
|
11
11
|
"main": "build/main/index.js",
|
|
12
12
|
"module": "build/module/index.js",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@vrplatform/kysely": "*",
|
|
41
|
-
"@vrplatform/repository": "*",
|
|
42
41
|
"@vrplatform/common": "*",
|
|
43
42
|
"@vrplatform/bin": "*"
|
|
44
43
|
},
|
package/src/cache.ts
CHANGED
package/src/error.ts
CHANGED
|
@@ -17,8 +17,9 @@ export class ApiClientError extends Error {
|
|
|
17
17
|
}[];
|
|
18
18
|
context: any;
|
|
19
19
|
constructor(public error: E) {
|
|
20
|
-
|
|
21
|
-
error.message
|
|
20
|
+
const message =
|
|
21
|
+
error.message ||
|
|
22
|
+
[
|
|
22
23
|
error.code,
|
|
23
24
|
error.issues
|
|
24
25
|
?.map((x) =>
|
|
@@ -30,7 +31,7 @@ export class ApiClientError extends Error {
|
|
|
30
31
|
]
|
|
31
32
|
.filter(hasValue)
|
|
32
33
|
.join(': ');
|
|
33
|
-
super(
|
|
34
|
+
super(message);
|
|
34
35
|
|
|
35
36
|
this.code = error.code;
|
|
36
37
|
this.issues = error.issues || [];
|