@vertexvis/api-client-node 0.15.5 → 0.15.6
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/dist/cjs/api.d.ts +275 -257
- package/dist/cjs/api.js +108 -96
- package/dist/cjs/base.d.ts +2 -2
- package/dist/cjs/client/helpers/files.d.ts +3 -12
- package/dist/cjs/client/helpers/files.js +5 -8
- package/dist/cjs/client/helpers/parts.d.ts +4 -6
- package/dist/cjs/client/helpers/queued-jobs.js +1 -1
- package/dist/cjs/client/helpers/scenes.d.ts +1 -1
- package/dist/cjs/client/helpers/scenes.js +2 -11
- package/dist/cjs/client/version.d.ts +1 -1
- package/dist/cjs/client/version.js +1 -1
- package/dist/cjs/common.d.ts +2 -2
- package/dist/esm/api.d.ts +275 -257
- package/dist/esm/api.js +108 -96
- package/dist/esm/base.d.ts +2 -2
- package/dist/esm/client/helpers/files.d.ts +3 -12
- package/dist/esm/client/helpers/files.js +5 -8
- package/dist/esm/client/helpers/parts.d.ts +4 -6
- package/dist/esm/client/helpers/queued-jobs.js +1 -1
- package/dist/esm/client/helpers/scenes.d.ts +1 -1
- package/dist/esm/client/helpers/scenes.js +2 -11
- package/dist/esm/client/version.d.ts +1 -1
- package/dist/esm/client/version.js +1 -1
- package/dist/esm/common.d.ts +2 -2
- package/package.json +20 -20
package/dist/cjs/base.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import { Configuration } from './configuration';
|
|
13
|
-
import { AxiosInstance } from 'axios';
|
|
13
|
+
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
14
14
|
export declare const BASE_PATH: string;
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
@@ -29,7 +29,7 @@ export declare const COLLECTION_FORMATS: {
|
|
|
29
29
|
*/
|
|
30
30
|
export interface RequestArgs {
|
|
31
31
|
url: string;
|
|
32
|
-
options:
|
|
32
|
+
options: AxiosRequestConfig;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
*
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { BaseReq, DeleteReq } from '../../client/index';
|
|
3
3
|
import { CreateFileRequest, FileMetadataData } from '../../index';
|
|
4
|
-
export interface File {
|
|
5
|
-
/** File data. */
|
|
6
|
-
readonly data: Buffer;
|
|
7
|
-
/** File size. */
|
|
8
|
-
readonly size: number;
|
|
9
|
-
}
|
|
10
4
|
/** Upload file arguments. */
|
|
11
5
|
export interface UploadFileReq extends BaseReq {
|
|
12
6
|
/** A {@link CreateFileRequest}. */
|
|
13
7
|
readonly createFileReq: CreateFileRequest;
|
|
14
|
-
/** File data.
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
readonly fileData?: unknown;
|
|
18
|
-
readonly file?: File;
|
|
8
|
+
/** File data. */
|
|
9
|
+
readonly fileData: Buffer;
|
|
19
10
|
}
|
|
20
11
|
/**
|
|
21
12
|
* Delete all files.
|
|
@@ -34,4 +25,4 @@ export declare function uploadFileIfNotExists({ client, createFileReq, onMsg, ve
|
|
|
34
25
|
*
|
|
35
26
|
* @param args - The {@link UploadFileReq}.
|
|
36
27
|
*/
|
|
37
|
-
export declare function uploadFile({ client, createFileReq, fileData,
|
|
28
|
+
export declare function uploadFile({ client, createFileReq, fileData, onMsg, verbose, }: UploadFileReq): Promise<FileMetadataData>;
|
|
@@ -85,8 +85,7 @@ exports.uploadFileIfNotExists = uploadFileIfNotExists;
|
|
|
85
85
|
*
|
|
86
86
|
* @param args - The {@link UploadFileReq}.
|
|
87
87
|
*/
|
|
88
|
-
function uploadFile({ client, createFileReq, fileData,
|
|
89
|
-
var _a, _b;
|
|
88
|
+
function uploadFile({ client, createFileReq, fileData, onMsg = console.log, verbose, }) {
|
|
90
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
90
|
const fileName = createFileReq.data.attributes.name;
|
|
92
91
|
const createRes = yield client.files.createFile({
|
|
@@ -95,9 +94,10 @@ function uploadFile({ client, createFileReq, fileData, file, onMsg = console.log
|
|
|
95
94
|
const fileId = createRes.data.data.id;
|
|
96
95
|
if (verbose)
|
|
97
96
|
onMsg(`Created file '${fileName}', ${fileId}`);
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const uploadRes = yield client.files.uploadFile({
|
|
98
|
+
id: fileId,
|
|
99
|
+
body: fileData,
|
|
100
|
+
});
|
|
101
101
|
if (uploadRes.status !== 204) {
|
|
102
102
|
throw new Error(`Uploading file ${fileId} failed with status code ${uploadRes.status}`);
|
|
103
103
|
}
|
|
@@ -106,9 +106,6 @@ function uploadFile({ client, createFileReq, fileData, file, onMsg = console.log
|
|
|
106
106
|
if (status === 'error') {
|
|
107
107
|
throw new Error(`Uploading file ${fileId} failed with status ${status}`);
|
|
108
108
|
}
|
|
109
|
-
else if (size >= 0 && getRes.attributes.size !== size) {
|
|
110
|
-
onMsg(`File ${fileId} size mismatch, expected ${size} got ${getRes.attributes.size}`);
|
|
111
|
-
}
|
|
112
109
|
if (verbose)
|
|
113
110
|
onMsg(`Uploaded file ${fileId}, status ${status}`);
|
|
114
111
|
return getRes;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { AxiosResponse } from 'axios';
|
|
2
3
|
import { CreateFileRequest, CreateGeometrySetRequest, CreatePartRequest, Failure, PartData, PartRevisionData, QueuedJob } from '../../index';
|
|
3
|
-
import { BaseReq, DeleteReq,
|
|
4
|
+
import { BaseReq, DeleteReq, Polling, RenderImageReq } from '../index';
|
|
4
5
|
/** Create parts from file arguments. */
|
|
5
6
|
export interface CreatePartFromFileReq extends BaseReq {
|
|
6
7
|
/** A {@link CreateFileRequest}. */
|
|
7
8
|
readonly createFileReq: CreateFileRequest;
|
|
8
9
|
/** Function returning a {@link CreatePartRequest}. */
|
|
9
10
|
readonly createPartReq: (fileId: string) => CreatePartRequest;
|
|
10
|
-
/** File data.
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
readonly fileData?: unknown;
|
|
14
|
-
readonly file?: File;
|
|
11
|
+
/** File data. */
|
|
12
|
+
readonly fileData: Buffer;
|
|
15
13
|
/** {@link Polling} */
|
|
16
14
|
readonly polling?: Polling;
|
|
17
15
|
/** Whether or not to return queued translation. */
|
|
@@ -97,7 +97,7 @@ function isPollError(r) {
|
|
|
97
97
|
exports.isPollError = isPollError;
|
|
98
98
|
function isBatch(obj) {
|
|
99
99
|
const b = obj;
|
|
100
|
-
return (0, utils_1.defined)(b) && (0, utils_1.defined)(b
|
|
100
|
+
return (0, utils_1.defined)(b) && (0, utils_1.defined)(b['vertexvis/batch:results']);
|
|
101
101
|
}
|
|
102
102
|
exports.isBatch = isBatch;
|
|
103
103
|
function throwOnError(r) {
|
|
@@ -182,7 +182,7 @@ function createSceneAndSceneItemsEXPERIMENTAL({ client, createSceneItemReqs, cre
|
|
|
182
182
|
})).scene,
|
|
183
183
|
sceneItemErrors: batchRes
|
|
184
184
|
.flatMap((b, i) => (0, queued_jobs_1.isBatch)(b.res)
|
|
185
|
-
? b.res.
|
|
185
|
+
? b.res['vertexvis/batch:results'].map((r, j) => (0, utils_1.isApiError)(r)
|
|
186
186
|
? { req: queuedOps[i].ops[j].data, res: r }
|
|
187
187
|
: undefined)
|
|
188
188
|
: [])
|
|
@@ -212,16 +212,7 @@ function createSceneItemsEXPERIMENTAL({ client, createSceneItemReqs, failFast, o
|
|
|
212
212
|
let res;
|
|
213
213
|
try {
|
|
214
214
|
res = (yield client.batches.createBatch({
|
|
215
|
-
createBatchRequest: {
|
|
216
|
-
vertexvis_batchoperations: ops,
|
|
217
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
218
|
-
// @ts-ignore
|
|
219
|
-
toJSON() {
|
|
220
|
-
return {
|
|
221
|
-
'vertexvis/batch:operations': this.vertexvis_batchoperations,
|
|
222
|
-
};
|
|
223
|
-
},
|
|
224
|
-
},
|
|
215
|
+
createBatchRequest: { 'vertexvis/batch:operations': ops },
|
|
225
216
|
})).data;
|
|
226
217
|
}
|
|
227
218
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.15.
|
|
1
|
+
export declare const version = "0.15.6";
|
package/dist/cjs/common.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { Configuration } from './configuration';
|
|
13
13
|
import { RequestArgs } from './base';
|
|
14
|
-
import { AxiosInstance } from 'axios';
|
|
14
|
+
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
17
|
* @export
|
|
@@ -62,4 +62,4 @@ export declare const toPathString: (url: URL) => string;
|
|
|
62
62
|
*
|
|
63
63
|
* @export
|
|
64
64
|
*/
|
|
65
|
-
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration | undefined) => (axios?: AxiosInstance, basePath?: string) => Promise<
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration | undefined) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|