@vertexvis/api-client-node 0.15.2 → 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 +5 -7
- package/dist/cjs/client/helpers/files.js +26 -33
- package/dist/cjs/client/helpers/parts.d.ts +5 -6
- package/dist/cjs/client/helpers/parts.js +17 -12
- 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/utils.d.ts +8 -8
- package/dist/cjs/client/utils.js +9 -9
- 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 +3 -3
- package/dist/cjs/client/vertex-client.js +2 -2
- 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 +5 -7
- package/dist/esm/client/helpers/files.js +28 -32
- package/dist/esm/client/helpers/parts.d.ts +5 -6
- package/dist/esm/client/helpers/parts.js +17 -12
- 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/utils.d.ts +8 -8
- package/dist/esm/client/utils.js +9 -9
- 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 +3 -3
- package/dist/esm/client/vertex-client.js +2 -2
- 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
|
*
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { BaseReq, DeleteReq } from '../../client/index';
|
|
2
3
|
import { CreateFileRequest, FileMetadataData } from '../../index';
|
|
3
4
|
/** Upload file arguments. */
|
|
4
5
|
export interface UploadFileReq extends BaseReq {
|
|
5
6
|
/** A {@link CreateFileRequest}. */
|
|
6
7
|
readonly createFileReq: CreateFileRequest;
|
|
7
|
-
/** File data.
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
readonly fileData?: unknown;
|
|
11
|
-
readonly filePath?: string;
|
|
8
|
+
/** File data. */
|
|
9
|
+
readonly fileData: Buffer;
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
12
|
* Delete all files.
|
|
@@ -21,10 +19,10 @@ export declare function deleteAllFiles({ client, pageSize, exceptions, }: Delete
|
|
|
21
19
|
*
|
|
22
20
|
* @param args - The {@link UploadFileReq}.
|
|
23
21
|
*/
|
|
24
|
-
export declare function uploadFileIfNotExists({ client, createFileReq,
|
|
22
|
+
export declare function uploadFileIfNotExists({ client, createFileReq, onMsg, verbose, ...rest }: UploadFileReq): Promise<FileMetadataData>;
|
|
25
23
|
/**
|
|
26
24
|
* Create a file resource and upload a file.
|
|
27
25
|
*
|
|
28
26
|
* @param args - The {@link UploadFileReq}.
|
|
29
27
|
*/
|
|
30
|
-
export declare function uploadFile({ client, createFileReq, fileData,
|
|
28
|
+
export declare function uploadFile({ client, createFileReq, fileData, onMsg, verbose, }: UploadFileReq): Promise<FileMetadataData>;
|
|
@@ -7,11 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import { encodeIfNotEncoded, getBySuppliedId, getPage, } from '../../client/index';
|
|
15
22
|
/**
|
|
16
23
|
* Delete all files.
|
|
17
24
|
*
|
|
@@ -40,7 +47,8 @@ export function deleteAllFiles({ client, pageSize = 100, exceptions = new Set(),
|
|
|
40
47
|
*
|
|
41
48
|
* @param args - The {@link UploadFileReq}.
|
|
42
49
|
*/
|
|
43
|
-
export function uploadFileIfNotExists(
|
|
50
|
+
export function uploadFileIfNotExists(_a) {
|
|
51
|
+
var { client, createFileReq, onMsg = console.log, verbose } = _a, rest = __rest(_a, ["client", "createFileReq", "onMsg", "verbose"]);
|
|
44
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
53
|
const suppliedId = createFileReq.data.attributes.suppliedId;
|
|
46
54
|
const existingFile = suppliedId
|
|
@@ -64,14 +72,7 @@ export function uploadFileIfNotExists({ client, createFileReq, fileData, filePat
|
|
|
64
72
|
yield client.files.deleteFile({ id: fileId });
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
return uploadFile({
|
|
68
|
-
client,
|
|
69
|
-
createFileReq,
|
|
70
|
-
fileData,
|
|
71
|
-
filePath,
|
|
72
|
-
onMsg,
|
|
73
|
-
verbose,
|
|
74
|
-
});
|
|
75
|
+
return uploadFile(Object.assign({ client, createFileReq, onMsg, verbose }, rest));
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
@@ -79,7 +80,7 @@ export function uploadFileIfNotExists({ client, createFileReq, fileData, filePat
|
|
|
79
80
|
*
|
|
80
81
|
* @param args - The {@link UploadFileReq}.
|
|
81
82
|
*/
|
|
82
|
-
export function uploadFile({ client, createFileReq, fileData,
|
|
83
|
+
export function uploadFile({ client, createFileReq, fileData, onMsg = console.log, verbose, }) {
|
|
83
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
85
|
const fileName = createFileReq.data.attributes.name;
|
|
85
86
|
const createRes = yield client.files.createFile({
|
|
@@ -88,25 +89,20 @@ export function uploadFile({ client, createFileReq, fileData, filePath, onMsg =
|
|
|
88
89
|
const fileId = createRes.data.data.id;
|
|
89
90
|
if (verbose)
|
|
90
91
|
onMsg(`Created file '${fileName}', ${fileId}`);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
:
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
const updated = (yield client.files.getFile({ id: fileId })).data.data;
|
|
98
|
-
if (size >= 0 && updated.attributes.size !== size) {
|
|
99
|
-
onMsg(`File ${fileId} size mismatch, expected ${size} got ${updated.attributes.size}`);
|
|
92
|
+
const uploadRes = yield client.files.uploadFile({
|
|
93
|
+
id: fileId,
|
|
94
|
+
body: fileData,
|
|
95
|
+
});
|
|
96
|
+
if (uploadRes.status !== 204) {
|
|
97
|
+
throw new Error(`Uploading file ${fileId} failed with status code ${uploadRes.status}`);
|
|
100
98
|
}
|
|
101
|
-
const
|
|
102
|
-
|
|
99
|
+
const getRes = (yield client.files.getFile({ id: fileId })).data.data;
|
|
100
|
+
const status = getRes.attributes.status;
|
|
101
|
+
if (status === 'error') {
|
|
103
102
|
throw new Error(`Uploading file ${fileId} failed with status ${status}`);
|
|
104
|
-
// Sanity check
|
|
105
|
-
if (status !== 'complete') {
|
|
106
|
-
if (verbose)
|
|
107
|
-
onMsg(`File ${fileId} in status ${status}, waiting...`);
|
|
108
|
-
yield delay(1000);
|
|
109
103
|
}
|
|
110
|
-
|
|
104
|
+
if (verbose)
|
|
105
|
+
onMsg(`Uploaded file ${fileId}, status ${status}`);
|
|
106
|
+
return getRes;
|
|
111
107
|
});
|
|
112
108
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { AxiosResponse } from 'axios';
|
|
2
3
|
import { CreateFileRequest, CreateGeometrySetRequest, CreatePartRequest, Failure, PartData, PartRevisionData, QueuedJob } from '../../index';
|
|
3
4
|
import { BaseReq, DeleteReq, Polling, RenderImageReq } from '../index';
|
|
@@ -7,15 +8,13 @@ export interface CreatePartFromFileReq extends BaseReq {
|
|
|
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 filePath?: string;
|
|
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. */
|
|
18
16
|
readonly returnQueued?: boolean;
|
|
17
|
+
readonly bypassAxiosEXPERIMENTAL?: boolean;
|
|
19
18
|
}
|
|
20
19
|
export interface CreatePartFromFileRes {
|
|
21
20
|
/** A {@link PartRevisionData}. */
|
|
@@ -39,7 +38,7 @@ export interface GetPartRevisionBySuppliedIdReq extends BaseReq {
|
|
|
39
38
|
*
|
|
40
39
|
* @param args - The {@link CreatePartFromFileReq}.
|
|
41
40
|
*/
|
|
42
|
-
export declare function createPartFromFile({ client,
|
|
41
|
+
export declare function createPartFromFile({ client, createPartReq, onMsg, polling, returnQueued, verbose, ...rest }: CreatePartFromFileReq): Promise<CreatePartFromFileRes>;
|
|
43
42
|
/**
|
|
44
43
|
* Create part and file resources if they don't already exist.
|
|
45
44
|
*
|
|
@@ -7,6 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
10
21
|
import { encodeIfNotEncoded, getBySuppliedId, getPage, head, MaxAttempts, PollIntervalMs, prettyJson, toAccept, tryStream, uploadFileIfNotExists, } from '../index';
|
|
11
22
|
import { isPollError, pollQueuedJob, throwOnError } from './queued-jobs';
|
|
12
23
|
/**
|
|
@@ -14,17 +25,11 @@ import { isPollError, pollQueuedJob, throwOnError } from './queued-jobs';
|
|
|
14
25
|
*
|
|
15
26
|
* @param args - The {@link CreatePartFromFileReq}.
|
|
16
27
|
*/
|
|
17
|
-
export function createPartFromFile(
|
|
18
|
-
var
|
|
28
|
+
export function createPartFromFile(_a) {
|
|
29
|
+
var _b, _c;
|
|
30
|
+
var { client, createPartReq, onMsg = console.log, polling = { intervalMs: PollIntervalMs, maxAttempts: MaxAttempts }, returnQueued = false, verbose } = _a, rest = __rest(_a, ["client", "createPartReq", "onMsg", "polling", "returnQueued", "verbose"]);
|
|
19
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const file = yield uploadFileIfNotExists({
|
|
21
|
-
client,
|
|
22
|
-
verbose,
|
|
23
|
-
fileData,
|
|
24
|
-
filePath,
|
|
25
|
-
createFileReq,
|
|
26
|
-
onMsg,
|
|
27
|
-
});
|
|
32
|
+
const file = yield uploadFileIfNotExists(Object.assign({ client, verbose, onMsg }, rest));
|
|
28
33
|
const createPartRequest = createPartReq(file.id);
|
|
29
34
|
const suppliedPartId = createPartRequest.data.attributes.suppliedId;
|
|
30
35
|
const suppliedRevisionId = createPartRequest.data.attributes.suppliedRevisionId;
|
|
@@ -61,11 +66,11 @@ export function createPartFromFile({ client, createFileReq, createPartReq, fileD
|
|
|
61
66
|
});
|
|
62
67
|
if (isPollError(pollRes.res))
|
|
63
68
|
throwOnError(pollRes);
|
|
64
|
-
const partRevision = head((
|
|
69
|
+
const partRevision = head((_b = pollRes.res.included) === null || _b === void 0 ? void 0 : _b.filter((pr) => pr.attributes.suppliedId === suppliedRevisionId));
|
|
65
70
|
if (!partRevision)
|
|
66
71
|
throw new Error(`Error creating part revision.\nRes: ${prettyJson(pollRes)}`);
|
|
67
72
|
if (verbose) {
|
|
68
|
-
onMsg(`Created part ${(
|
|
73
|
+
onMsg(`Created part ${(_c = pollRes.res) === null || _c === void 0 ? void 0 : _c.data.id}, part-revision ${partRevision.id}`);
|
|
69
74
|
}
|
|
70
75
|
return { partRevision, queued };
|
|
71
76
|
});
|
|
@@ -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) {
|
|
@@ -84,7 +84,7 @@ export declare function getBySuppliedId<T extends {
|
|
|
84
84
|
*
|
|
85
85
|
* @param error: The error.
|
|
86
86
|
*/
|
|
87
|
-
export declare function getErrorMessage(error: VertexError | AxiosError): string;
|
|
87
|
+
export declare function getErrorMessage(error: VertexError | AxiosError | unknown): Error | string;
|
|
88
88
|
/**
|
|
89
89
|
* Get a page of results from a listing.
|
|
90
90
|
*
|
|
@@ -113,7 +113,7 @@ export declare function getPage<T extends {
|
|
|
113
113
|
* @param getKey - Function returning key to group the array by.
|
|
114
114
|
* @returns A 2D array.
|
|
115
115
|
*/
|
|
116
|
-
export declare const groupBy: <T, K extends
|
|
116
|
+
export declare const groupBy: <T, K extends never>(items: T[], getKey: (item: T) => K) => Record<K, T[]>;
|
|
117
117
|
/**
|
|
118
118
|
* Return the first item in an array.
|
|
119
119
|
*
|
|
@@ -135,18 +135,18 @@ export declare function is4x4Identity(transform: number[][]): boolean;
|
|
|
135
135
|
* @returns `true` if URI encoded.
|
|
136
136
|
*/
|
|
137
137
|
export declare function isEncoded(s: string): boolean;
|
|
138
|
-
export declare function isApiError(error:
|
|
139
|
-
export declare function isFailure(obj:
|
|
140
|
-
export declare function isQueuedJob(obj:
|
|
141
|
-
export declare function hasVertexError(error:
|
|
142
|
-
export declare function hasVertexErrorMessage(error:
|
|
138
|
+
export declare function isApiError(error: unknown): error is ApiError;
|
|
139
|
+
export declare function isFailure(obj: unknown): obj is Failure;
|
|
140
|
+
export declare function isQueuedJob(obj: unknown): obj is QueuedJob;
|
|
141
|
+
export declare function hasVertexError(error: unknown): error is VertexError;
|
|
142
|
+
export declare function hasVertexErrorMessage(error: unknown): error is VertexError;
|
|
143
143
|
/**
|
|
144
144
|
* Log an Error produced by {@link VertexClient}.
|
|
145
145
|
*
|
|
146
146
|
* @param error: The error to log.
|
|
147
147
|
* @param logger: The logger to use.
|
|
148
148
|
*/
|
|
149
|
-
export declare function logError(error: VertexError | AxiosError, logger?: (input: Error | string) => void): void;
|
|
149
|
+
export declare function logError(error: VertexError | AxiosError | unknown, logger?: (input: Error | string) => void): void;
|
|
150
150
|
/**
|
|
151
151
|
* Matrix multiply two 2D arrays.
|
|
152
152
|
*
|
package/dist/esm/client/utils.js
CHANGED
|
@@ -121,9 +121,14 @@ export function getErrorMessage(error) {
|
|
|
121
121
|
const ve = error.vertexErrorMessage;
|
|
122
122
|
return ve && !ve.startsWith(UnableToStringify) ? ve : error.message;
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
:
|
|
124
|
+
const ae = error;
|
|
125
|
+
if (ae.isAxiosError) {
|
|
126
|
+
return defined((_a = ae.response) === null || _a === void 0 ? void 0 : _a.data)
|
|
127
|
+
? prettyJson((_b = ae.response) === null || _b === void 0 ? void 0 : _b.data)
|
|
128
|
+
: ae.message;
|
|
129
|
+
}
|
|
130
|
+
const e = error;
|
|
131
|
+
return defined(e.message) ? e.message : e.toString();
|
|
127
132
|
}
|
|
128
133
|
/**
|
|
129
134
|
* Get a page of results from a listing.
|
|
@@ -150,7 +155,6 @@ export function getPage(getListing) {
|
|
|
150
155
|
* @param getKey - Function returning key to group the array by.
|
|
151
156
|
* @returns A 2D array.
|
|
152
157
|
*/
|
|
153
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
158
|
export const groupBy = (items, getKey) => items.reduce((acc, cur) => {
|
|
155
159
|
var _a;
|
|
156
160
|
const group = getKey(cur);
|
|
@@ -189,19 +193,16 @@ export function is4x4Identity(transform) {
|
|
|
189
193
|
export function isEncoded(s) {
|
|
190
194
|
return s !== decodeURIComponent(s);
|
|
191
195
|
}
|
|
192
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
193
196
|
export function isApiError(error) {
|
|
194
197
|
const ae = error;
|
|
195
198
|
return defined(ae.id) && defined(ae.status) && defined(ae.code);
|
|
196
199
|
}
|
|
197
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
198
200
|
export function isFailure(obj) {
|
|
199
201
|
const f = obj;
|
|
200
202
|
return !defined(f.errors) || f.errors.size === 0
|
|
201
203
|
? false
|
|
202
204
|
: isApiError(head([...f.errors.values()]));
|
|
203
205
|
}
|
|
204
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
205
206
|
export function isQueuedJob(obj) {
|
|
206
207
|
var _a, _b;
|
|
207
208
|
const qj = obj;
|
|
@@ -210,12 +211,10 @@ export function isQueuedJob(obj) {
|
|
|
210
211
|
defined((_b = qj.data) === null || _b === void 0 ? void 0 : _b.type) &&
|
|
211
212
|
qj.data.type.startsWith('queued-'));
|
|
212
213
|
}
|
|
213
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
214
214
|
export function hasVertexError(error) {
|
|
215
215
|
const ve = error;
|
|
216
216
|
return defined(ve.vertexError);
|
|
217
217
|
}
|
|
218
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
219
218
|
export function hasVertexErrorMessage(error) {
|
|
220
219
|
const ve = error;
|
|
221
220
|
return defined(ve.vertexErrorMessage);
|
|
@@ -359,6 +358,7 @@ export function tryStream(fn) {
|
|
|
359
358
|
return yield fn();
|
|
360
359
|
}
|
|
361
360
|
catch (error) {
|
|
361
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
362
362
|
const ae = error;
|
|
363
363
|
// eslint-disable-next-line promise/param-names
|
|
364
364
|
return new Promise((_resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.15.
|
|
1
|
+
export declare const version = "0.15.6";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.15.
|
|
1
|
+
export const version = '0.15.6';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { AccountsApi, ApplicationsApi, BatchesApi, Configuration, FilesApi, GeometrySetsApi, HitsApi, OAuth2Token, PartRevisionsApi, PartsApi, SceneAlterationsApi, SceneItemOverridesApi, SceneItemsApi, ScenesApi, SceneViewsApi, SceneViewStatesApi, StreamKeysApi, TranslationInspectionsApi, WebhookSubscriptionsApi } from '../index';
|
|
2
|
+
import { AccountsApi, ApplicationsApi, BatchesApi, Configuration, 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.
|
|
@@ -75,6 +75,7 @@ export declare class VertexClient {
|
|
|
75
75
|
files: FilesApi;
|
|
76
76
|
geometrySets: GeometrySetsApi;
|
|
77
77
|
hits: HitsApi;
|
|
78
|
+
oAuth2: Oauth2Api;
|
|
78
79
|
partRevisions: PartRevisionsApi;
|
|
79
80
|
parts: PartsApi;
|
|
80
81
|
sceneAlterations: SceneAlterationsApi;
|
|
@@ -88,8 +89,7 @@ export declare class VertexClient {
|
|
|
88
89
|
webhookSubscriptions: WebhookSubscriptionsApi;
|
|
89
90
|
axiosInstance: AxiosInstance;
|
|
90
91
|
config: Configuration;
|
|
91
|
-
|
|
92
|
-
private token;
|
|
92
|
+
token: OAuth2Token;
|
|
93
93
|
private tokenFetchedEpochMs;
|
|
94
94
|
private constructor();
|
|
95
95
|
/**
|
|
@@ -58,11 +58,11 @@ export class VertexClient {
|
|
|
58
58
|
if (tokenValid)
|
|
59
59
|
return this.token.access_token;
|
|
60
60
|
console.log('Refreshing access token');
|
|
61
|
-
this.token = yield createToken(this.
|
|
61
|
+
this.token = yield createToken(this.oAuth2);
|
|
62
62
|
this.tokenFetchedEpochMs = nowEpochMs();
|
|
63
63
|
return this.token.access_token;
|
|
64
64
|
});
|
|
65
|
-
this.
|
|
65
|
+
this.oAuth2 = auth;
|
|
66
66
|
this.token = token;
|
|
67
67
|
this.tokenFetchedEpochMs = nowEpochMs();
|
|
68
68
|
this.config = new Configuration({
|
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.15.
|
|
3
|
+
"version": "0.15.6",
|
|
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.21",
|
|
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
|
}
|