@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/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,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>;
|
|
@@ -8,16 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
13
21
|
};
|
|
14
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
23
|
exports.uploadFile = exports.uploadFileIfNotExists = exports.deleteAllFiles = void 0;
|
|
16
|
-
const fs_1 = __importDefault(require("fs"));
|
|
17
|
-
const util_1 = require("util");
|
|
18
24
|
const index_1 = require("../../client/index");
|
|
19
|
-
const readFile = (0, util_1.promisify)(fs_1.default.readFile);
|
|
20
|
-
const stat = (0, util_1.promisify)(fs_1.default.stat);
|
|
21
25
|
/**
|
|
22
26
|
* Delete all files.
|
|
23
27
|
*
|
|
@@ -47,7 +51,8 @@ exports.deleteAllFiles = deleteAllFiles;
|
|
|
47
51
|
*
|
|
48
52
|
* @param args - The {@link UploadFileReq}.
|
|
49
53
|
*/
|
|
50
|
-
function uploadFileIfNotExists(
|
|
54
|
+
function uploadFileIfNotExists(_a) {
|
|
55
|
+
var { client, createFileReq, onMsg = console.log, verbose } = _a, rest = __rest(_a, ["client", "createFileReq", "onMsg", "verbose"]);
|
|
51
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
57
|
const suppliedId = createFileReq.data.attributes.suppliedId;
|
|
53
58
|
const existingFile = suppliedId
|
|
@@ -71,14 +76,7 @@ function uploadFileIfNotExists({ client, createFileReq, fileData, filePath, onMs
|
|
|
71
76
|
yield client.files.deleteFile({ id: fileId });
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
|
-
return uploadFile({
|
|
75
|
-
client,
|
|
76
|
-
createFileReq,
|
|
77
|
-
fileData,
|
|
78
|
-
filePath,
|
|
79
|
-
onMsg,
|
|
80
|
-
verbose,
|
|
81
|
-
});
|
|
79
|
+
return uploadFile(Object.assign({ client, createFileReq, onMsg, verbose }, rest));
|
|
82
80
|
});
|
|
83
81
|
}
|
|
84
82
|
exports.uploadFileIfNotExists = uploadFileIfNotExists;
|
|
@@ -87,7 +85,7 @@ exports.uploadFileIfNotExists = uploadFileIfNotExists;
|
|
|
87
85
|
*
|
|
88
86
|
* @param args - The {@link UploadFileReq}.
|
|
89
87
|
*/
|
|
90
|
-
function uploadFile({ client, createFileReq, fileData,
|
|
88
|
+
function uploadFile({ client, createFileReq, fileData, onMsg = console.log, verbose, }) {
|
|
91
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
92
90
|
const fileName = createFileReq.data.attributes.name;
|
|
93
91
|
const createRes = yield client.files.createFile({
|
|
@@ -96,26 +94,21 @@ function uploadFile({ client, createFileReq, fileData, filePath, onMsg = console
|
|
|
96
94
|
const fileId = createRes.data.data.id;
|
|
97
95
|
if (verbose)
|
|
98
96
|
onMsg(`Created file '${fileName}', ${fileId}`);
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
:
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
const updated = (yield client.files.getFile({ id: fileId })).data.data;
|
|
106
|
-
if (size >= 0 && updated.attributes.size !== size) {
|
|
107
|
-
onMsg(`File ${fileId} size mismatch, expected ${size} got ${updated.attributes.size}`);
|
|
97
|
+
const uploadRes = yield client.files.uploadFile({
|
|
98
|
+
id: fileId,
|
|
99
|
+
body: fileData,
|
|
100
|
+
});
|
|
101
|
+
if (uploadRes.status !== 204) {
|
|
102
|
+
throw new Error(`Uploading file ${fileId} failed with status code ${uploadRes.status}`);
|
|
108
103
|
}
|
|
109
|
-
const
|
|
110
|
-
|
|
104
|
+
const getRes = (yield client.files.getFile({ id: fileId })).data.data;
|
|
105
|
+
const status = getRes.attributes.status;
|
|
106
|
+
if (status === 'error') {
|
|
111
107
|
throw new Error(`Uploading file ${fileId} failed with status ${status}`);
|
|
112
|
-
// Sanity check
|
|
113
|
-
if (status !== 'complete') {
|
|
114
|
-
if (verbose)
|
|
115
|
-
onMsg(`File ${fileId} in status ${status}, waiting...`);
|
|
116
|
-
yield (0, index_1.delay)(1000);
|
|
117
108
|
}
|
|
118
|
-
|
|
109
|
+
if (verbose)
|
|
110
|
+
onMsg(`Uploaded file ${fileId}, status ${status}`);
|
|
111
|
+
return getRes;
|
|
119
112
|
});
|
|
120
113
|
}
|
|
121
114
|
exports.uploadFile = uploadFile;
|
|
@@ -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
|
*
|
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.renderPartRevision = exports.getPartRevisionBySuppliedId = exports.deleteAllParts = exports.createPartFromFileIfNotExists = exports.createPartFromFile = void 0;
|
|
13
24
|
const index_1 = require("../index");
|
|
@@ -17,17 +28,11 @@ const queued_jobs_1 = require("./queued-jobs");
|
|
|
17
28
|
*
|
|
18
29
|
* @param args - The {@link CreatePartFromFileReq}.
|
|
19
30
|
*/
|
|
20
|
-
function createPartFromFile(
|
|
21
|
-
var
|
|
31
|
+
function createPartFromFile(_a) {
|
|
32
|
+
var _b, _c;
|
|
33
|
+
var { client, createPartReq, onMsg = console.log, polling = { intervalMs: index_1.PollIntervalMs, maxAttempts: index_1.MaxAttempts }, returnQueued = false, verbose } = _a, rest = __rest(_a, ["client", "createPartReq", "onMsg", "polling", "returnQueued", "verbose"]);
|
|
22
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const file = yield (0, index_1.uploadFileIfNotExists)({
|
|
24
|
-
client,
|
|
25
|
-
verbose,
|
|
26
|
-
fileData,
|
|
27
|
-
filePath,
|
|
28
|
-
createFileReq,
|
|
29
|
-
onMsg,
|
|
30
|
-
});
|
|
35
|
+
const file = yield (0, index_1.uploadFileIfNotExists)(Object.assign({ client, verbose, onMsg }, rest));
|
|
31
36
|
const createPartRequest = createPartReq(file.id);
|
|
32
37
|
const suppliedPartId = createPartRequest.data.attributes.suppliedId;
|
|
33
38
|
const suppliedRevisionId = createPartRequest.data.attributes.suppliedRevisionId;
|
|
@@ -64,11 +69,11 @@ function createPartFromFile({ client, createFileReq, createPartReq, fileData, fi
|
|
|
64
69
|
});
|
|
65
70
|
if ((0, queued_jobs_1.isPollError)(pollRes.res))
|
|
66
71
|
(0, queued_jobs_1.throwOnError)(pollRes);
|
|
67
|
-
const partRevision = (0, index_1.head)((
|
|
72
|
+
const partRevision = (0, index_1.head)((_b = pollRes.res.included) === null || _b === void 0 ? void 0 : _b.filter((pr) => pr.attributes.suppliedId === suppliedRevisionId));
|
|
68
73
|
if (!partRevision)
|
|
69
74
|
throw new Error(`Error creating part revision.\nRes: ${(0, index_1.prettyJson)(pollRes)}`);
|
|
70
75
|
if (verbose) {
|
|
71
|
-
onMsg(`Created part ${(
|
|
76
|
+
onMsg(`Created part ${(_c = pollRes.res) === null || _c === void 0 ? void 0 : _c.data.id}, part-revision ${partRevision.id}`);
|
|
72
77
|
}
|
|
73
78
|
return { partRevision, queued };
|
|
74
79
|
});
|
|
@@ -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) {
|
|
@@ -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/cjs/client/utils.js
CHANGED
|
@@ -132,9 +132,14 @@ function getErrorMessage(error) {
|
|
|
132
132
|
const ve = error.vertexErrorMessage;
|
|
133
133
|
return ve && !ve.startsWith(UnableToStringify) ? ve : error.message;
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
:
|
|
135
|
+
const ae = error;
|
|
136
|
+
if (ae.isAxiosError) {
|
|
137
|
+
return defined((_a = ae.response) === null || _a === void 0 ? void 0 : _a.data)
|
|
138
|
+
? prettyJson((_b = ae.response) === null || _b === void 0 ? void 0 : _b.data)
|
|
139
|
+
: ae.message;
|
|
140
|
+
}
|
|
141
|
+
const e = error;
|
|
142
|
+
return defined(e.message) ? e.message : e.toString();
|
|
138
143
|
}
|
|
139
144
|
exports.getErrorMessage = getErrorMessage;
|
|
140
145
|
/**
|
|
@@ -163,7 +168,6 @@ exports.getPage = getPage;
|
|
|
163
168
|
* @param getKey - Function returning key to group the array by.
|
|
164
169
|
* @returns A 2D array.
|
|
165
170
|
*/
|
|
166
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
171
|
const groupBy = (items, getKey) => items.reduce((acc, cur) => {
|
|
168
172
|
var _a;
|
|
169
173
|
const group = getKey(cur);
|
|
@@ -206,13 +210,11 @@ function isEncoded(s) {
|
|
|
206
210
|
return s !== decodeURIComponent(s);
|
|
207
211
|
}
|
|
208
212
|
exports.isEncoded = isEncoded;
|
|
209
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
210
213
|
function isApiError(error) {
|
|
211
214
|
const ae = error;
|
|
212
215
|
return defined(ae.id) && defined(ae.status) && defined(ae.code);
|
|
213
216
|
}
|
|
214
217
|
exports.isApiError = isApiError;
|
|
215
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
216
218
|
function isFailure(obj) {
|
|
217
219
|
const f = obj;
|
|
218
220
|
return !defined(f.errors) || f.errors.size === 0
|
|
@@ -220,7 +222,6 @@ function isFailure(obj) {
|
|
|
220
222
|
: isApiError(head([...f.errors.values()]));
|
|
221
223
|
}
|
|
222
224
|
exports.isFailure = isFailure;
|
|
223
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
224
225
|
function isQueuedJob(obj) {
|
|
225
226
|
var _a, _b;
|
|
226
227
|
const qj = obj;
|
|
@@ -230,13 +231,11 @@ function isQueuedJob(obj) {
|
|
|
230
231
|
qj.data.type.startsWith('queued-'));
|
|
231
232
|
}
|
|
232
233
|
exports.isQueuedJob = isQueuedJob;
|
|
233
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
234
234
|
function hasVertexError(error) {
|
|
235
235
|
const ve = error;
|
|
236
236
|
return defined(ve.vertexError);
|
|
237
237
|
}
|
|
238
238
|
exports.hasVertexError = hasVertexError;
|
|
239
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
240
239
|
function hasVertexErrorMessage(error) {
|
|
241
240
|
const ve = error;
|
|
242
241
|
return defined(ve.vertexErrorMessage);
|
|
@@ -394,6 +393,7 @@ function tryStream(fn) {
|
|
|
394
393
|
return yield fn();
|
|
395
394
|
}
|
|
396
395
|
catch (error) {
|
|
396
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
397
397
|
const ae = error;
|
|
398
398
|
// eslint-disable-next-line promise/param-names
|
|
399
399
|
return new Promise((_resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.15.
|
|
1
|
+
export declare 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
|
/**
|
|
@@ -64,11 +64,11 @@ class VertexClient {
|
|
|
64
64
|
if (tokenValid)
|
|
65
65
|
return this.token.access_token;
|
|
66
66
|
console.log('Refreshing access token');
|
|
67
|
-
this.token = yield (0, index_2.createToken)(this.
|
|
67
|
+
this.token = yield (0, index_2.createToken)(this.oAuth2);
|
|
68
68
|
this.tokenFetchedEpochMs = (0, index_2.nowEpochMs)();
|
|
69
69
|
return this.token.access_token;
|
|
70
70
|
});
|
|
71
|
-
this.
|
|
71
|
+
this.oAuth2 = auth;
|
|
72
72
|
this.token = token;
|
|
73
73
|
this.tokenFetchedEpochMs = (0, index_2.nowEpochMs)();
|
|
74
74
|
this.config = new index_1.Configuration({
|
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>;
|