@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/esm/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,35 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { isPollError, MaxAttempts, PollIntervalMs, pollQueuedJob, throwOnError, } from '../index';
|
|
11
|
+
/**
|
|
12
|
+
* Create an export.
|
|
13
|
+
*
|
|
14
|
+
* @param args - The {@link CreateExportReq}.
|
|
15
|
+
*/
|
|
16
|
+
export function createExport({ client, createExportReq, onMsg = console.log, verbose, }) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const res = yield client.exports.createExport({
|
|
19
|
+
createExportRequest: createExportReq(),
|
|
20
|
+
});
|
|
21
|
+
const queuedId = res.data.data.id;
|
|
22
|
+
if (verbose)
|
|
23
|
+
onMsg(`Created export with queued-export ${queuedId}`);
|
|
24
|
+
const pollRes = yield pollQueuedJob({
|
|
25
|
+
id: queuedId,
|
|
26
|
+
getQueuedJob: (id) => client.exports.getQueuedExport({ id }),
|
|
27
|
+
polling: { intervalMs: PollIntervalMs, maxAttempts: MaxAttempts },
|
|
28
|
+
});
|
|
29
|
+
if (isPollError(pollRes.res))
|
|
30
|
+
throwOnError(pollRes);
|
|
31
|
+
if (verbose)
|
|
32
|
+
onMsg(`Completed export ${pollRes.res.data.id}`);
|
|
33
|
+
return pollRes.res;
|
|
34
|
+
});
|
|
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>;
|
|
@@ -80,8 +80,7 @@ export function uploadFileIfNotExists(_a) {
|
|
|
80
80
|
*
|
|
81
81
|
* @param args - The {@link UploadFileReq}.
|
|
82
82
|
*/
|
|
83
|
-
export function uploadFile({ client, createFileReq, fileData,
|
|
84
|
-
var _a, _b;
|
|
83
|
+
export function uploadFile({ client, createFileReq, fileData, onMsg = console.log, verbose, }) {
|
|
85
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
85
|
const fileName = createFileReq.data.attributes.name;
|
|
87
86
|
const createRes = yield client.files.createFile({
|
|
@@ -90,9 +89,10 @@ export function uploadFile({ client, createFileReq, fileData, file, onMsg = cons
|
|
|
90
89
|
const fileId = createRes.data.data.id;
|
|
91
90
|
if (verbose)
|
|
92
91
|
onMsg(`Created file '${fileName}', ${fileId}`);
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
const uploadRes = yield client.files.uploadFile({
|
|
93
|
+
id: fileId,
|
|
94
|
+
body: fileData,
|
|
95
|
+
});
|
|
96
96
|
if (uploadRes.status !== 204) {
|
|
97
97
|
throw new Error(`Uploading file ${fileId} failed with status code ${uploadRes.status}`);
|
|
98
98
|
}
|
|
@@ -101,9 +101,6 @@ export function uploadFile({ client, createFileReq, fileData, file, onMsg = cons
|
|
|
101
101
|
if (status === 'error') {
|
|
102
102
|
throw new Error(`Uploading file ${fileId} failed with status ${status}`);
|
|
103
103
|
}
|
|
104
|
-
else if (size >= 0 && getRes.attributes.size !== size) {
|
|
105
|
-
onMsg(`File ${fileId} size mismatch, expected ${size} got ${getRes.attributes.size}`);
|
|
106
|
-
}
|
|
107
104
|
if (verbose)
|
|
108
105
|
onMsg(`Uploaded file ${fileId}, status ${status}`);
|
|
109
106
|
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. */
|
|
@@ -89,7 +89,7 @@ export function isPollError(r) {
|
|
|
89
89
|
}
|
|
90
90
|
export function isBatch(obj) {
|
|
91
91
|
const b = obj;
|
|
92
|
-
return defined(b) && defined(b
|
|
92
|
+
return defined(b) && defined(b['vertexvis/batch:results']);
|
|
93
93
|
}
|
|
94
94
|
export function throwOnError(r) {
|
|
95
95
|
throw new Error(isQueuedJobError(r.res) || isFailure(r.res)
|
|
@@ -174,7 +174,7 @@ export function createSceneAndSceneItemsEXPERIMENTAL({ client, createSceneItemRe
|
|
|
174
174
|
})).scene,
|
|
175
175
|
sceneItemErrors: batchRes
|
|
176
176
|
.flatMap((b, i) => isBatch(b.res)
|
|
177
|
-
? b.res.
|
|
177
|
+
? b.res['vertexvis/batch:results'].map((r, j) => isApiError(r)
|
|
178
178
|
? { req: queuedOps[i].ops[j].data, res: r }
|
|
179
179
|
: undefined)
|
|
180
180
|
: [])
|
|
@@ -203,16 +203,7 @@ export function createSceneItemsEXPERIMENTAL({ client, createSceneItemReqs, fail
|
|
|
203
203
|
let res;
|
|
204
204
|
try {
|
|
205
205
|
res = (yield client.batches.createBatch({
|
|
206
|
-
createBatchRequest: {
|
|
207
|
-
vertexvis_batchoperations: ops,
|
|
208
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
209
|
-
// @ts-ignore
|
|
210
|
-
toJSON() {
|
|
211
|
-
return {
|
|
212
|
-
'vertexvis/batch:operations': this.vertexvis_batchoperations,
|
|
213
|
-
};
|
|
214
|
-
},
|
|
215
|
-
},
|
|
206
|
+
createBatchRequest: { 'vertexvis/batch:operations': ops },
|
|
216
207
|
})).data;
|
|
217
208
|
}
|
|
218
209
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.17.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.
|
|
1
|
+
export 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;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
var _a;
|
|
11
11
|
import axios from 'axios';
|
|
12
|
-
import { AccountsApi, ApplicationsApi, BatchesApi, Configuration, FilesApi, GeometrySetsApi, HitsApi, Oauth2Api, PartRevisionsApi, PartsApi, SceneAlterationsApi, SceneItemOverridesApi, SceneItemsApi, ScenesApi, SceneViewsApi, SceneViewStatesApi, StreamKeysApi, TranslationInspectionsApi, WebhookSubscriptionsApi, } from '../index';
|
|
12
|
+
import { AccountsApi, ApplicationsApi, BatchesApi, Configuration, ExportsApi, FilesApi, GeometrySetsApi, HitsApi, Oauth2Api, PartRevisionsApi, PartsApi, SceneAlterationsApi, SceneItemOverridesApi, SceneItemsApi, ScenesApi, SceneViewsApi, SceneViewStatesApi, StreamKeysApi, TranslationInspectionsApi, WebhookSubscriptionsApi, } from '../index';
|
|
13
13
|
import { createToken, isFailure, nowEpochMs, prettyJson, } from './index';
|
|
14
14
|
import { version } from './version';
|
|
15
15
|
const TenMinsInMs = 600000;
|
|
@@ -73,6 +73,7 @@ export class VertexClient {
|
|
|
73
73
|
this.accounts = new AccountsApi(this.config, undefined, axiosInst);
|
|
74
74
|
this.applications = new ApplicationsApi(this.config, undefined, axiosInst);
|
|
75
75
|
this.batches = new BatchesApi(this.config, undefined, axiosInst);
|
|
76
|
+
this.exports = new ExportsApi(this.config, undefined, axiosInst);
|
|
76
77
|
this.files = new FilesApi(this.config, undefined, axiosInst);
|
|
77
78
|
this.geometrySets = new GeometrySetsApi(this.config, undefined, axiosInst);
|
|
78
79
|
this.hits = new HitsApi(this.config, undefined, axiosInst);
|
package/dist/esm/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>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertexvis/api-client-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "The Vertex REST API client for Node.js.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vertex Developers <support@vertexvis.com> (https://developer.vertexvis.com)",
|
|
@@ -32,6 +32,25 @@
|
|
|
32
32
|
"api-client",
|
|
33
33
|
"typescript"
|
|
34
34
|
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"axios": "^0.24",
|
|
37
|
+
"p-limit": "^3"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/jest": "^27.0",
|
|
41
|
+
"@types/node": "^16",
|
|
42
|
+
"@vertexvis/eslint-config-vertexvis-typescript": "^0.4",
|
|
43
|
+
"eslint": "^7",
|
|
44
|
+
"eslint-plugin-promise": "^5.2",
|
|
45
|
+
"eslint-plugin-simple-import-sort": "^7.0",
|
|
46
|
+
"eslint-plugin-tsdoc": "^0.2",
|
|
47
|
+
"jest": "^27.4",
|
|
48
|
+
"pinst": "^2.1",
|
|
49
|
+
"prettier": "^2.5",
|
|
50
|
+
"ts-jest": "^27.1",
|
|
51
|
+
"typedoc": "^0.22",
|
|
52
|
+
"typescript": "4.5.x"
|
|
53
|
+
},
|
|
35
54
|
"scripts": {
|
|
36
55
|
"build": "tsc --project tsconfig.json && tsc --project tsconfig-esm.json",
|
|
37
56
|
"clean": "rm -rf dist/",
|
|
@@ -49,24 +68,5 @@
|
|
|
49
68
|
"test:func": "yarn clean-build && node dist/functional-test.js",
|
|
50
69
|
"verify": "yarn clean-build && yarn test --coverage && node dist/cjs/verify.js",
|
|
51
70
|
"watch": "jest --watch"
|
|
52
|
-
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"axios": "^0.22",
|
|
55
|
-
"p-limit": "^3.1"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@types/jest": "^27.0",
|
|
59
|
-
"@types/node": "^16",
|
|
60
|
-
"@vertexvis/eslint-config-vertexvis-typescript": "^0.4",
|
|
61
|
-
"eslint": "^7.32",
|
|
62
|
-
"eslint-plugin-promise": "^5.1",
|
|
63
|
-
"eslint-plugin-simple-import-sort": "^7.0",
|
|
64
|
-
"eslint-plugin-tsdoc": "^0.2",
|
|
65
|
-
"jest": "^27.2",
|
|
66
|
-
"pinst": "^2.1",
|
|
67
|
-
"prettier": "^2.4",
|
|
68
|
-
"ts-jest": "^27.0",
|
|
69
|
-
"typedoc": "^0.22",
|
|
70
|
-
"typescript": "4.4.x"
|
|
71
71
|
}
|
|
72
72
|
}
|