@vertexvis/api-client-node 0.15.5 → 0.17.0
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 +895 -503
- package/dist/cjs/api.js +501 -344
- package/dist/cjs/base.d.ts +2 -2
- package/dist/cjs/client/helpers/exports.d.ts +15 -0
- package/dist/cjs/client/helpers/exports.js +39 -0
- package/dist/cjs/client/helpers/files.d.ts +3 -12
- package/dist/cjs/client/helpers/files.js +5 -8
- package/dist/cjs/client/helpers/index.d.ts +1 -0
- package/dist/cjs/client/helpers/index.js +1 -0
- 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/client/vertex-client.d.ts +2 -1
- package/dist/cjs/client/vertex-client.js +1 -0
- package/dist/cjs/common.d.ts +2 -2
- package/dist/esm/api.d.ts +895 -503
- package/dist/esm/api.js +494 -341
- package/dist/esm/base.d.ts +2 -2
- package/dist/esm/client/helpers/exports.d.ts +15 -0
- package/dist/esm/client/helpers/exports.js +35 -0
- package/dist/esm/client/helpers/files.d.ts +3 -12
- package/dist/esm/client/helpers/files.js +5 -8
- package/dist/esm/client/helpers/index.d.ts +1 -0
- package/dist/esm/client/helpers/index.js +1 -0
- 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/client/vertex-client.d.ts +2 -1
- package/dist/esm/client/vertex-client.js +2 -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
|
*
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CreateExportRequest, Export } from '../../index';
|
|
2
|
+
import { BaseReq } from '../index';
|
|
3
|
+
/**
|
|
4
|
+
* Create export arguments.
|
|
5
|
+
*/
|
|
6
|
+
export interface CreateExportReq extends BaseReq {
|
|
7
|
+
/** Function returning a {@link CreateExportRequest}. */
|
|
8
|
+
readonly createExportReq: () => CreateExportRequest;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create an export.
|
|
12
|
+
*
|
|
13
|
+
* @param args - The {@link CreateExportReq}.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createExport({ client, createExportReq, onMsg, verbose, }: CreateExportReq): Promise<Export>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createExport = void 0;
|
|
13
|
+
const index_1 = require("../index");
|
|
14
|
+
/**
|
|
15
|
+
* Create an export.
|
|
16
|
+
*
|
|
17
|
+
* @param args - The {@link CreateExportReq}.
|
|
18
|
+
*/
|
|
19
|
+
function createExport({ client, createExportReq, onMsg = console.log, verbose, }) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const res = yield client.exports.createExport({
|
|
22
|
+
createExportRequest: createExportReq(),
|
|
23
|
+
});
|
|
24
|
+
const queuedId = res.data.data.id;
|
|
25
|
+
if (verbose)
|
|
26
|
+
onMsg(`Created export with queued-export ${queuedId}`);
|
|
27
|
+
const pollRes = yield (0, index_1.pollQueuedJob)({
|
|
28
|
+
id: queuedId,
|
|
29
|
+
getQueuedJob: (id) => client.exports.getQueuedExport({ id }),
|
|
30
|
+
polling: { intervalMs: index_1.PollIntervalMs, maxAttempts: index_1.MaxAttempts },
|
|
31
|
+
});
|
|
32
|
+
if ((0, index_1.isPollError)(pollRes.res))
|
|
33
|
+
(0, index_1.throwOnError)(pollRes);
|
|
34
|
+
if (verbose)
|
|
35
|
+
onMsg(`Completed export ${pollRes.res.data.id}`);
|
|
36
|
+
return pollRes.res;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.createExport = createExport;
|
|
@@ -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;
|
|
@@ -10,6 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./exports"), exports);
|
|
13
14
|
__exportStar(require("./files"), exports);
|
|
14
15
|
__exportStar(require("./parts"), exports);
|
|
15
16
|
__exportStar(require("./scenes"), exports);
|
|
@@ -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.
|
|
1
|
+
export declare const version = "0.17.0";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { AccountsApi, ApplicationsApi, BatchesApi, Configuration, FilesApi, GeometrySetsApi, HitsApi, Oauth2Api, OAuth2Token, PartRevisionsApi, PartsApi, SceneAlterationsApi, SceneItemOverridesApi, SceneItemsApi, ScenesApi, SceneViewsApi, SceneViewStatesApi, StreamKeysApi, TranslationInspectionsApi, WebhookSubscriptionsApi } from '../index';
|
|
2
|
+
import { AccountsApi, ApplicationsApi, BatchesApi, Configuration, ExportsApi, FilesApi, GeometrySetsApi, HitsApi, Oauth2Api, OAuth2Token, PartRevisionsApi, PartsApi, SceneAlterationsApi, SceneItemOverridesApi, SceneItemsApi, ScenesApi, SceneViewsApi, SceneViewStatesApi, StreamKeysApi, TranslationInspectionsApi, WebhookSubscriptionsApi } from '../index';
|
|
3
3
|
import { BasePath } from './index';
|
|
4
4
|
/**
|
|
5
5
|
* Static `build` function arguments.
|
|
@@ -72,6 +72,7 @@ export declare class VertexClient {
|
|
|
72
72
|
accounts: AccountsApi;
|
|
73
73
|
applications: ApplicationsApi;
|
|
74
74
|
batches: BatchesApi;
|
|
75
|
+
exports: ExportsApi;
|
|
75
76
|
files: FilesApi;
|
|
76
77
|
geometrySets: GeometrySetsApi;
|
|
77
78
|
hits: HitsApi;
|
|
@@ -79,6 +79,7 @@ class VertexClient {
|
|
|
79
79
|
this.accounts = new index_1.AccountsApi(this.config, undefined, axiosInst);
|
|
80
80
|
this.applications = new index_1.ApplicationsApi(this.config, undefined, axiosInst);
|
|
81
81
|
this.batches = new index_1.BatchesApi(this.config, undefined, axiosInst);
|
|
82
|
+
this.exports = new index_1.ExportsApi(this.config, undefined, axiosInst);
|
|
82
83
|
this.files = new index_1.FilesApi(this.config, undefined, axiosInst);
|
|
83
84
|
this.geometrySets = new index_1.GeometrySetsApi(this.config, undefined, axiosInst);
|
|
84
85
|
this.hits = new index_1.HitsApi(this.config, undefined, axiosInst);
|
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>;
|