bruce-models 1.9.8 → 1.9.9
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/bruce-models.es5.js +20 -14
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +20 -14
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account-settings.js +2 -2
- package/dist/lib/account/account.js +185 -185
- package/dist/lib/ann-document/ann-document.js +86 -86
- package/dist/lib/api/abstract-api.js +246 -246
- package/dist/lib/api/api-getters.js +134 -134
- package/dist/lib/api/api.js +93 -93
- package/dist/lib/api/bruce-api.js +216 -216
- package/dist/lib/api/cam-api.js +85 -82
- package/dist/lib/api/cam-api.js.map +1 -1
- package/dist/lib/api/global-api.js +81 -81
- package/dist/lib/api/idm-api.js +85 -82
- package/dist/lib/api/idm-api.js.map +1 -1
- package/dist/lib/bruce-models.js +86 -86
- package/dist/lib/calculator/calculator.js +341 -341
- package/dist/lib/client-file/client-file.js +245 -245
- package/dist/lib/common/bounds.js +61 -61
- package/dist/lib/common/bruce-event.js +46 -46
- package/dist/lib/common/bruce-variable.js +60 -60
- package/dist/lib/common/cache.js +165 -165
- package/dist/lib/common/camera.js +11 -11
- package/dist/lib/common/cartes.js +123 -123
- package/dist/lib/common/carto.js +60 -60
- package/dist/lib/common/color.js +86 -86
- package/dist/lib/common/delay-queue.js +56 -56
- package/dist/lib/common/dictionary.js +2 -2
- package/dist/lib/common/geometry.js +120 -120
- package/dist/lib/common/transform.js +2 -2
- package/dist/lib/common/utc.js +39 -39
- package/dist/lib/custom-form/custom-form-content.js +26 -26
- package/dist/lib/custom-form/custom-form.js +106 -106
- package/dist/lib/data-lab/data-lab.js +49 -49
- package/dist/lib/entity/entity-attachment-type.js +83 -83
- package/dist/lib/entity/entity-attachment.js +122 -122
- package/dist/lib/entity/entity-attribute.js +29 -29
- package/dist/lib/entity/entity-comment.js +82 -82
- package/dist/lib/entity/entity-coords.js +149 -149
- package/dist/lib/entity/entity-link.js +82 -82
- package/dist/lib/entity/entity-lod-category.js +100 -100
- package/dist/lib/entity/entity-lod.js +185 -185
- package/dist/lib/entity/entity-relation-type.js +109 -109
- package/dist/lib/entity/entity-relation.js +132 -132
- package/dist/lib/entity/entity-source.js +136 -136
- package/dist/lib/entity/entity-tag.js +149 -149
- package/dist/lib/entity/entity-type-visual-settings.js +13 -13
- package/dist/lib/entity/entity-type.js +113 -113
- package/dist/lib/entity/entity.js +319 -319
- package/dist/lib/entity/getters/batched-data-getter.js +84 -84
- package/dist/lib/entity/getters/entity-filter-getter.js +303 -303
- package/dist/lib/entity/getters/entity-globe.js +211 -211
- package/dist/lib/entity/getters/view-monitor.js +2 -2
- package/dist/lib/import/import-cad.js +53 -53
- package/dist/lib/import/import-csv.js +23 -23
- package/dist/lib/import/import-json.js +23 -23
- package/dist/lib/import/import-kml.js +23 -23
- package/dist/lib/import/imported-file.js +91 -91
- package/dist/lib/internal/uploader.js +76 -76
- package/dist/lib/markup/markup.js +185 -185
- package/dist/lib/plugin/plugin.js +83 -83
- package/dist/lib/program-key/program-key.js +111 -111
- package/dist/lib/project/menu-item.js +121 -121
- package/dist/lib/project/project-view-bookmark.js +147 -147
- package/dist/lib/project/project-view-legacy-tile.js +77 -77
- package/dist/lib/project/project-view-tile.js +125 -125
- package/dist/lib/project/project-view.js +133 -133
- package/dist/lib/project/zoom-control.js +17 -17
- package/dist/lib/server/message-broker.js +142 -142
- package/dist/lib/server/pending-action.js +71 -71
- package/dist/lib/server/task.js +63 -63
- package/dist/lib/style/style.js +117 -117
- package/dist/lib/tileset/tileset.js +415 -415
- package/dist/lib/user/permission.js +20 -20
- package/dist/lib/user/session.js +137 -137
- package/dist/lib/user/user-group.js +94 -94
- package/dist/lib/user/user.js +446 -446
- package/dist/lib/util/encrypt-utils.js +19 -19
- package/dist/lib/util/math-utils.js +40 -40
- package/dist/lib/util/object-utils.js +17 -17
- package/dist/lib/util/path-utils.js +61 -61
- package/dist/lib/util/url-utils.js +94 -94
- package/package.json +3 -2
|
@@ -1,246 +1,246 @@
|
|
|
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.ClientFile = void 0;
|
|
13
|
-
const api_1 = require("../api/api");
|
|
14
|
-
const uploader_1 = require("../internal/uploader");
|
|
15
|
-
/**
|
|
16
|
-
* Describes the "Client File" concept within Bruce.
|
|
17
|
-
* A client file is a record of a file uploaded to Bruce.
|
|
18
|
-
*/
|
|
19
|
-
var ClientFile;
|
|
20
|
-
(function (ClientFile) {
|
|
21
|
-
function GetCacheKey(fileId) {
|
|
22
|
-
return `${api_1.Api.ECacheKey.ClientFile}${api_1.Api.ECacheKey.Id}${fileId}`;
|
|
23
|
-
}
|
|
24
|
-
ClientFile.GetCacheKey = GetCacheKey;
|
|
25
|
-
function GetUrl(params) {
|
|
26
|
-
const { api, fileId } = params;
|
|
27
|
-
return `${api.GetBaseUrl()}file/${fileId}`;
|
|
28
|
-
}
|
|
29
|
-
ClientFile.GetUrl = GetUrl;
|
|
30
|
-
function GetUrlWithExt(params) {
|
|
31
|
-
const { api, file } = params;
|
|
32
|
-
return `${api.GetBaseUrl()}file/${file.ID}${file.FileExt ? file.FileExt : ""}`;
|
|
33
|
-
}
|
|
34
|
-
ClientFile.GetUrlWithExt = GetUrlWithExt;
|
|
35
|
-
function Get(params) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const { api, fileId, req: reqParams } = params;
|
|
38
|
-
if (!fileId) {
|
|
39
|
-
throw ("File ID is required.");
|
|
40
|
-
}
|
|
41
|
-
const key = GetCacheKey(fileId);
|
|
42
|
-
const cacheData = api.GetCacheItem(key, reqParams);
|
|
43
|
-
if (cacheData) {
|
|
44
|
-
return cacheData;
|
|
45
|
-
}
|
|
46
|
-
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
try {
|
|
48
|
-
const data = yield api.GET(`file/${fileId}/details`, api_1.Api.PrepReqParams(reqParams));
|
|
49
|
-
res({
|
|
50
|
-
clientFile: data
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
rej(e);
|
|
55
|
-
}
|
|
56
|
-
}));
|
|
57
|
-
api.Cache.Set(key, prom, api_1.Api.DEFAULT_CACHE_DURATION);
|
|
58
|
-
return prom;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
ClientFile.Get = Get;
|
|
62
|
-
function Delete(params) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const { api, fileIds, req: reqParams } = params;
|
|
65
|
-
if (!fileIds.length) {
|
|
66
|
-
throw ("File IDs are required.");
|
|
67
|
-
}
|
|
68
|
-
const data = {
|
|
69
|
-
Items: fileIds
|
|
70
|
-
};
|
|
71
|
-
yield api.POST("deleteFiles", data, api_1.Api.PrepReqParams(reqParams));
|
|
72
|
-
for (let i = 0; i < fileIds.length; i++) {
|
|
73
|
-
const key = GetCacheKey(fileIds[i]);
|
|
74
|
-
api.Cache.Remove(key);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
ClientFile.Delete = Delete;
|
|
79
|
-
function Upload(params) {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
let { api, file, purpose, req, onProgress } = params;
|
|
82
|
-
if (!file) {
|
|
83
|
-
throw ("File is required.");
|
|
84
|
-
}
|
|
85
|
-
const size = file === null || file === void 0 ? void 0 : file.size;
|
|
86
|
-
if (!size) {
|
|
87
|
-
throw ("You cannot upload a 0byte sized file.");
|
|
88
|
-
}
|
|
89
|
-
req = api_1.Api.PrepReqParams(req);
|
|
90
|
-
let clientFile;
|
|
91
|
-
if (size > uploader_1.Uploader.MIN_LARGE_FILE_SIZE) {
|
|
92
|
-
clientFile = yield uploader_1.Uploader.DoMultiPartUpload({
|
|
93
|
-
api,
|
|
94
|
-
file,
|
|
95
|
-
urlSuffix: "fileUpload",
|
|
96
|
-
req,
|
|
97
|
-
onProgress
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
req.onProgress = (progress) => {
|
|
102
|
-
const percent = Math.round((progress.loaded / file.size) * 100);
|
|
103
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
104
|
-
percent: percent,
|
|
105
|
-
uploaded: false
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
clientFile = yield api.UPLOAD("file/uploadNew", file, req);
|
|
109
|
-
}
|
|
110
|
-
if ((clientFile === null || clientFile === void 0 ? void 0 : clientFile.ID) && purpose) {
|
|
111
|
-
yield UpdatePurpose({
|
|
112
|
-
api,
|
|
113
|
-
fileId: clientFile.ID,
|
|
114
|
-
purpose,
|
|
115
|
-
req
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
119
|
-
percent: 100,
|
|
120
|
-
uploaded: true
|
|
121
|
-
});
|
|
122
|
-
return {
|
|
123
|
-
clientFile
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
ClientFile.Upload = Upload;
|
|
128
|
-
function UpdatePurpose(params) {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
let { api, fileId, purpose, req: reqParams } = params;
|
|
131
|
-
if (!purpose) {
|
|
132
|
-
purpose = "";
|
|
133
|
-
}
|
|
134
|
-
yield api.POST("file/updatepurpose/" + fileId + "/?Purpose=" + purpose, {
|
|
135
|
-
Purpose: purpose
|
|
136
|
-
}, api_1.Api.PrepReqParams(reqParams));
|
|
137
|
-
const cacheKey = GetCacheKey(fileId);
|
|
138
|
-
api.Cache.RemoveByContains(cacheKey);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
ClientFile.UpdatePurpose = UpdatePurpose;
|
|
142
|
-
/**
|
|
143
|
-
* Uploads a temp file.
|
|
144
|
-
* This will return a temp file id which can be used in various endpoints.
|
|
145
|
-
* @param params
|
|
146
|
-
* @returns
|
|
147
|
-
*/
|
|
148
|
-
function UploadTemp(params) {
|
|
149
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
let { api, file, req, onProgress } = params;
|
|
151
|
-
if (!file) {
|
|
152
|
-
throw ("File is required.");
|
|
153
|
-
}
|
|
154
|
-
const size = file === null || file === void 0 ? void 0 : file.size;
|
|
155
|
-
if (!size) {
|
|
156
|
-
throw ("You cannot upload a 0byte sized file.");
|
|
157
|
-
}
|
|
158
|
-
req = api_1.Api.PrepReqParams(req);
|
|
159
|
-
let tempFile;
|
|
160
|
-
if (size > uploader_1.Uploader.MIN_LARGE_FILE_SIZE) {
|
|
161
|
-
tempFile = yield uploader_1.Uploader.DoMultiPartUpload({
|
|
162
|
-
api,
|
|
163
|
-
file,
|
|
164
|
-
urlSuffix: "tempFileUpload",
|
|
165
|
-
req,
|
|
166
|
-
onProgress
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
req.onProgress = (progress) => {
|
|
171
|
-
const percent = Math.round((progress.loaded / file.size) * 100);
|
|
172
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
173
|
-
percent: percent,
|
|
174
|
-
uploaded: false
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
|
-
tempFile = yield api.UPLOAD("file/uploadTemp", file, req);
|
|
178
|
-
}
|
|
179
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
180
|
-
percent: 100,
|
|
181
|
-
uploaded: true
|
|
182
|
-
});
|
|
183
|
-
return {
|
|
184
|
-
tempFileId: tempFile["TempFile.ID"]
|
|
185
|
-
};
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
ClientFile.UploadTemp = UploadTemp;
|
|
189
|
-
let Filter;
|
|
190
|
-
(function (Filter) {
|
|
191
|
-
let EColumn;
|
|
192
|
-
(function (EColumn) {
|
|
193
|
-
EColumn["ID"] = "id";
|
|
194
|
-
EColumn["Name"] = "name";
|
|
195
|
-
EColumn["DateTime"] = "datetime";
|
|
196
|
-
EColumn["MIMEType"] = "mimeType";
|
|
197
|
-
EColumn["Size"] = "size";
|
|
198
|
-
EColumn["User"] = "user";
|
|
199
|
-
EColumn["Extension"] = "extension";
|
|
200
|
-
})(EColumn = Filter.EColumn || (Filter.EColumn = {}));
|
|
201
|
-
let ESortOrder;
|
|
202
|
-
(function (ESortOrder) {
|
|
203
|
-
ESortOrder["ASC"] = "asc";
|
|
204
|
-
ESortOrder["DEC"] = "desc";
|
|
205
|
-
})(ESortOrder = Filter.ESortOrder || (Filter.ESortOrder = {}));
|
|
206
|
-
let ERowOperator;
|
|
207
|
-
(function (ERowOperator) {
|
|
208
|
-
ERowOperator["AND"] = "AND";
|
|
209
|
-
ERowOperator["OR"] = "OR";
|
|
210
|
-
})(ERowOperator = Filter.ERowOperator || (Filter.ERowOperator = {}));
|
|
211
|
-
})(Filter = ClientFile.Filter || (ClientFile.Filter = {}));
|
|
212
|
-
function GetList(params) {
|
|
213
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
-
const { api, filter, req: reqParams } = params;
|
|
215
|
-
const data = yield api.POST("files/filtered", filter, api_1.Api.PrepReqParams(reqParams));
|
|
216
|
-
return {
|
|
217
|
-
clientFiles: data.Items,
|
|
218
|
-
totalCount: data.TotalCount
|
|
219
|
-
};
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
ClientFile.GetList = GetList;
|
|
223
|
-
let Processor;
|
|
224
|
-
(function (Processor) {
|
|
225
|
-
let EConvertExt;
|
|
226
|
-
(function (EConvertExt) {
|
|
227
|
-
EConvertExt["GLB"] = ".glb";
|
|
228
|
-
EConvertExt["SKP"] = ".skp";
|
|
229
|
-
})(EConvertExt = Processor.EConvertExt || (Processor.EConvertExt = {}));
|
|
230
|
-
function ConvertFormat(params) {
|
|
231
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
-
const { api, fileId: clientFileId, ext, req: reqParams } = params;
|
|
233
|
-
if (!clientFileId || !ext) {
|
|
234
|
-
throw ("Client File ID and extension are required.");
|
|
235
|
-
}
|
|
236
|
-
return api.POST("convertFileToFile", {
|
|
237
|
-
clientFileId: clientFileId,
|
|
238
|
-
destinationFormat: ext,
|
|
239
|
-
operations: []
|
|
240
|
-
}, reqParams);
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
Processor.ConvertFormat = ConvertFormat;
|
|
244
|
-
})(Processor = ClientFile.Processor || (ClientFile.Processor = {}));
|
|
245
|
-
})(ClientFile = exports.ClientFile || (exports.ClientFile = {}));
|
|
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.ClientFile = void 0;
|
|
13
|
+
const api_1 = require("../api/api");
|
|
14
|
+
const uploader_1 = require("../internal/uploader");
|
|
15
|
+
/**
|
|
16
|
+
* Describes the "Client File" concept within Bruce.
|
|
17
|
+
* A client file is a record of a file uploaded to Bruce.
|
|
18
|
+
*/
|
|
19
|
+
var ClientFile;
|
|
20
|
+
(function (ClientFile) {
|
|
21
|
+
function GetCacheKey(fileId) {
|
|
22
|
+
return `${api_1.Api.ECacheKey.ClientFile}${api_1.Api.ECacheKey.Id}${fileId}`;
|
|
23
|
+
}
|
|
24
|
+
ClientFile.GetCacheKey = GetCacheKey;
|
|
25
|
+
function GetUrl(params) {
|
|
26
|
+
const { api, fileId } = params;
|
|
27
|
+
return `${api.GetBaseUrl()}file/${fileId}`;
|
|
28
|
+
}
|
|
29
|
+
ClientFile.GetUrl = GetUrl;
|
|
30
|
+
function GetUrlWithExt(params) {
|
|
31
|
+
const { api, file } = params;
|
|
32
|
+
return `${api.GetBaseUrl()}file/${file.ID}${file.FileExt ? file.FileExt : ""}`;
|
|
33
|
+
}
|
|
34
|
+
ClientFile.GetUrlWithExt = GetUrlWithExt;
|
|
35
|
+
function Get(params) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const { api, fileId, req: reqParams } = params;
|
|
38
|
+
if (!fileId) {
|
|
39
|
+
throw ("File ID is required.");
|
|
40
|
+
}
|
|
41
|
+
const key = GetCacheKey(fileId);
|
|
42
|
+
const cacheData = api.GetCacheItem(key, reqParams);
|
|
43
|
+
if (cacheData) {
|
|
44
|
+
return cacheData;
|
|
45
|
+
}
|
|
46
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
try {
|
|
48
|
+
const data = yield api.GET(`file/${fileId}/details`, api_1.Api.PrepReqParams(reqParams));
|
|
49
|
+
res({
|
|
50
|
+
clientFile: data
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
rej(e);
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
api.Cache.Set(key, prom, api_1.Api.DEFAULT_CACHE_DURATION);
|
|
58
|
+
return prom;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
ClientFile.Get = Get;
|
|
62
|
+
function Delete(params) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const { api, fileIds, req: reqParams } = params;
|
|
65
|
+
if (!fileIds.length) {
|
|
66
|
+
throw ("File IDs are required.");
|
|
67
|
+
}
|
|
68
|
+
const data = {
|
|
69
|
+
Items: fileIds
|
|
70
|
+
};
|
|
71
|
+
yield api.POST("deleteFiles", data, api_1.Api.PrepReqParams(reqParams));
|
|
72
|
+
for (let i = 0; i < fileIds.length; i++) {
|
|
73
|
+
const key = GetCacheKey(fileIds[i]);
|
|
74
|
+
api.Cache.Remove(key);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
ClientFile.Delete = Delete;
|
|
79
|
+
function Upload(params) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
let { api, file, purpose, req, onProgress } = params;
|
|
82
|
+
if (!file) {
|
|
83
|
+
throw ("File is required.");
|
|
84
|
+
}
|
|
85
|
+
const size = file === null || file === void 0 ? void 0 : file.size;
|
|
86
|
+
if (!size) {
|
|
87
|
+
throw ("You cannot upload a 0byte sized file.");
|
|
88
|
+
}
|
|
89
|
+
req = api_1.Api.PrepReqParams(req);
|
|
90
|
+
let clientFile;
|
|
91
|
+
if (size > uploader_1.Uploader.MIN_LARGE_FILE_SIZE) {
|
|
92
|
+
clientFile = yield uploader_1.Uploader.DoMultiPartUpload({
|
|
93
|
+
api,
|
|
94
|
+
file,
|
|
95
|
+
urlSuffix: "fileUpload",
|
|
96
|
+
req,
|
|
97
|
+
onProgress
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
req.onProgress = (progress) => {
|
|
102
|
+
const percent = Math.round((progress.loaded / file.size) * 100);
|
|
103
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
104
|
+
percent: percent,
|
|
105
|
+
uploaded: false
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
clientFile = yield api.UPLOAD("file/uploadNew", file, req);
|
|
109
|
+
}
|
|
110
|
+
if ((clientFile === null || clientFile === void 0 ? void 0 : clientFile.ID) && purpose) {
|
|
111
|
+
yield UpdatePurpose({
|
|
112
|
+
api,
|
|
113
|
+
fileId: clientFile.ID,
|
|
114
|
+
purpose,
|
|
115
|
+
req
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
119
|
+
percent: 100,
|
|
120
|
+
uploaded: true
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
clientFile
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
ClientFile.Upload = Upload;
|
|
128
|
+
function UpdatePurpose(params) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
let { api, fileId, purpose, req: reqParams } = params;
|
|
131
|
+
if (!purpose) {
|
|
132
|
+
purpose = "";
|
|
133
|
+
}
|
|
134
|
+
yield api.POST("file/updatepurpose/" + fileId + "/?Purpose=" + purpose, {
|
|
135
|
+
Purpose: purpose
|
|
136
|
+
}, api_1.Api.PrepReqParams(reqParams));
|
|
137
|
+
const cacheKey = GetCacheKey(fileId);
|
|
138
|
+
api.Cache.RemoveByContains(cacheKey);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
ClientFile.UpdatePurpose = UpdatePurpose;
|
|
142
|
+
/**
|
|
143
|
+
* Uploads a temp file.
|
|
144
|
+
* This will return a temp file id which can be used in various endpoints.
|
|
145
|
+
* @param params
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
function UploadTemp(params) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
let { api, file, req, onProgress } = params;
|
|
151
|
+
if (!file) {
|
|
152
|
+
throw ("File is required.");
|
|
153
|
+
}
|
|
154
|
+
const size = file === null || file === void 0 ? void 0 : file.size;
|
|
155
|
+
if (!size) {
|
|
156
|
+
throw ("You cannot upload a 0byte sized file.");
|
|
157
|
+
}
|
|
158
|
+
req = api_1.Api.PrepReqParams(req);
|
|
159
|
+
let tempFile;
|
|
160
|
+
if (size > uploader_1.Uploader.MIN_LARGE_FILE_SIZE) {
|
|
161
|
+
tempFile = yield uploader_1.Uploader.DoMultiPartUpload({
|
|
162
|
+
api,
|
|
163
|
+
file,
|
|
164
|
+
urlSuffix: "tempFileUpload",
|
|
165
|
+
req,
|
|
166
|
+
onProgress
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
req.onProgress = (progress) => {
|
|
171
|
+
const percent = Math.round((progress.loaded / file.size) * 100);
|
|
172
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
173
|
+
percent: percent,
|
|
174
|
+
uploaded: false
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
tempFile = yield api.UPLOAD("file/uploadTemp", file, req);
|
|
178
|
+
}
|
|
179
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
180
|
+
percent: 100,
|
|
181
|
+
uploaded: true
|
|
182
|
+
});
|
|
183
|
+
return {
|
|
184
|
+
tempFileId: tempFile["TempFile.ID"]
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
ClientFile.UploadTemp = UploadTemp;
|
|
189
|
+
let Filter;
|
|
190
|
+
(function (Filter) {
|
|
191
|
+
let EColumn;
|
|
192
|
+
(function (EColumn) {
|
|
193
|
+
EColumn["ID"] = "id";
|
|
194
|
+
EColumn["Name"] = "name";
|
|
195
|
+
EColumn["DateTime"] = "datetime";
|
|
196
|
+
EColumn["MIMEType"] = "mimeType";
|
|
197
|
+
EColumn["Size"] = "size";
|
|
198
|
+
EColumn["User"] = "user";
|
|
199
|
+
EColumn["Extension"] = "extension";
|
|
200
|
+
})(EColumn = Filter.EColumn || (Filter.EColumn = {}));
|
|
201
|
+
let ESortOrder;
|
|
202
|
+
(function (ESortOrder) {
|
|
203
|
+
ESortOrder["ASC"] = "asc";
|
|
204
|
+
ESortOrder["DEC"] = "desc";
|
|
205
|
+
})(ESortOrder = Filter.ESortOrder || (Filter.ESortOrder = {}));
|
|
206
|
+
let ERowOperator;
|
|
207
|
+
(function (ERowOperator) {
|
|
208
|
+
ERowOperator["AND"] = "AND";
|
|
209
|
+
ERowOperator["OR"] = "OR";
|
|
210
|
+
})(ERowOperator = Filter.ERowOperator || (Filter.ERowOperator = {}));
|
|
211
|
+
})(Filter = ClientFile.Filter || (ClientFile.Filter = {}));
|
|
212
|
+
function GetList(params) {
|
|
213
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
+
const { api, filter, req: reqParams } = params;
|
|
215
|
+
const data = yield api.POST("files/filtered", filter, api_1.Api.PrepReqParams(reqParams));
|
|
216
|
+
return {
|
|
217
|
+
clientFiles: data.Items,
|
|
218
|
+
totalCount: data.TotalCount
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
ClientFile.GetList = GetList;
|
|
223
|
+
let Processor;
|
|
224
|
+
(function (Processor) {
|
|
225
|
+
let EConvertExt;
|
|
226
|
+
(function (EConvertExt) {
|
|
227
|
+
EConvertExt["GLB"] = ".glb";
|
|
228
|
+
EConvertExt["SKP"] = ".skp";
|
|
229
|
+
})(EConvertExt = Processor.EConvertExt || (Processor.EConvertExt = {}));
|
|
230
|
+
function ConvertFormat(params) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
const { api, fileId: clientFileId, ext, req: reqParams } = params;
|
|
233
|
+
if (!clientFileId || !ext) {
|
|
234
|
+
throw ("Client File ID and extension are required.");
|
|
235
|
+
}
|
|
236
|
+
return api.POST("convertFileToFile", {
|
|
237
|
+
clientFileId: clientFileId,
|
|
238
|
+
destinationFormat: ext,
|
|
239
|
+
operations: []
|
|
240
|
+
}, reqParams);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
Processor.ConvertFormat = ConvertFormat;
|
|
244
|
+
})(Processor = ClientFile.Processor || (ClientFile.Processor = {}));
|
|
245
|
+
})(ClientFile = exports.ClientFile || (exports.ClientFile = {}));
|
|
246
246
|
//# sourceMappingURL=client-file.js.map
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Bounds = void 0;
|
|
4
|
-
const geometry_1 = require("./geometry");
|
|
5
|
-
var Bounds;
|
|
6
|
-
(function (Bounds) {
|
|
7
|
-
/**
|
|
8
|
-
* Calculates boundaries from entity.
|
|
9
|
-
* This will not use the set entity boundaries and instead calculate from geometry and location.
|
|
10
|
-
* @param entity
|
|
11
|
-
*/
|
|
12
|
-
function FromEntity(entity) {
|
|
13
|
-
const bounds = {
|
|
14
|
-
maxAltitude: null,
|
|
15
|
-
maxLatitude: null,
|
|
16
|
-
maxLongitude: null,
|
|
17
|
-
minAltitude: null,
|
|
18
|
-
minLatitude: null,
|
|
19
|
-
minLongitude: null
|
|
20
|
-
};
|
|
21
|
-
const points = [];
|
|
22
|
-
if (entity.location) {
|
|
23
|
-
points.push(entity.location);
|
|
24
|
-
}
|
|
25
|
-
if (entity.geometry) {
|
|
26
|
-
if (entity.geometry.Point) {
|
|
27
|
-
points.push(...geometry_1.Geometry.ParsePoints(entity.geometry.Point));
|
|
28
|
-
}
|
|
29
|
-
if (entity.geometry.LineString) {
|
|
30
|
-
points.push(...geometry_1.Geometry.ParsePoints(entity.geometry.LineString));
|
|
31
|
-
}
|
|
32
|
-
if (entity.geometry.Polygon) {
|
|
33
|
-
for (const ring of entity.geometry.Polygon) {
|
|
34
|
-
points.push(...geometry_1.Geometry.ParsePoints(ring.LinearRing));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
for (const point of points) {
|
|
39
|
-
if (bounds.maxLatitude == null || point.latitude > bounds.maxLatitude) {
|
|
40
|
-
bounds.maxLatitude = point.latitude;
|
|
41
|
-
}
|
|
42
|
-
if (bounds.maxLongitude == null || point.longitude > bounds.maxLongitude) {
|
|
43
|
-
bounds.maxLongitude = point.longitude;
|
|
44
|
-
}
|
|
45
|
-
if (bounds.maxAltitude == null || point.altitude > bounds.maxAltitude) {
|
|
46
|
-
bounds.maxAltitude = point.altitude;
|
|
47
|
-
}
|
|
48
|
-
if (bounds.minLatitude == null || point.latitude < bounds.minLatitude) {
|
|
49
|
-
bounds.minLatitude = point.latitude;
|
|
50
|
-
}
|
|
51
|
-
if (bounds.minLongitude == null || point.longitude < bounds.minLongitude) {
|
|
52
|
-
bounds.minLongitude = point.longitude;
|
|
53
|
-
}
|
|
54
|
-
if (bounds.minAltitude == null || point.altitude < bounds.minAltitude) {
|
|
55
|
-
bounds.minAltitude = point.altitude;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return bounds;
|
|
59
|
-
}
|
|
60
|
-
Bounds.FromEntity = FromEntity;
|
|
61
|
-
})(Bounds = exports.Bounds || (exports.Bounds = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bounds = void 0;
|
|
4
|
+
const geometry_1 = require("./geometry");
|
|
5
|
+
var Bounds;
|
|
6
|
+
(function (Bounds) {
|
|
7
|
+
/**
|
|
8
|
+
* Calculates boundaries from entity.
|
|
9
|
+
* This will not use the set entity boundaries and instead calculate from geometry and location.
|
|
10
|
+
* @param entity
|
|
11
|
+
*/
|
|
12
|
+
function FromEntity(entity) {
|
|
13
|
+
const bounds = {
|
|
14
|
+
maxAltitude: null,
|
|
15
|
+
maxLatitude: null,
|
|
16
|
+
maxLongitude: null,
|
|
17
|
+
minAltitude: null,
|
|
18
|
+
minLatitude: null,
|
|
19
|
+
minLongitude: null
|
|
20
|
+
};
|
|
21
|
+
const points = [];
|
|
22
|
+
if (entity.location) {
|
|
23
|
+
points.push(entity.location);
|
|
24
|
+
}
|
|
25
|
+
if (entity.geometry) {
|
|
26
|
+
if (entity.geometry.Point) {
|
|
27
|
+
points.push(...geometry_1.Geometry.ParsePoints(entity.geometry.Point));
|
|
28
|
+
}
|
|
29
|
+
if (entity.geometry.LineString) {
|
|
30
|
+
points.push(...geometry_1.Geometry.ParsePoints(entity.geometry.LineString));
|
|
31
|
+
}
|
|
32
|
+
if (entity.geometry.Polygon) {
|
|
33
|
+
for (const ring of entity.geometry.Polygon) {
|
|
34
|
+
points.push(...geometry_1.Geometry.ParsePoints(ring.LinearRing));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (const point of points) {
|
|
39
|
+
if (bounds.maxLatitude == null || point.latitude > bounds.maxLatitude) {
|
|
40
|
+
bounds.maxLatitude = point.latitude;
|
|
41
|
+
}
|
|
42
|
+
if (bounds.maxLongitude == null || point.longitude > bounds.maxLongitude) {
|
|
43
|
+
bounds.maxLongitude = point.longitude;
|
|
44
|
+
}
|
|
45
|
+
if (bounds.maxAltitude == null || point.altitude > bounds.maxAltitude) {
|
|
46
|
+
bounds.maxAltitude = point.altitude;
|
|
47
|
+
}
|
|
48
|
+
if (bounds.minLatitude == null || point.latitude < bounds.minLatitude) {
|
|
49
|
+
bounds.minLatitude = point.latitude;
|
|
50
|
+
}
|
|
51
|
+
if (bounds.minLongitude == null || point.longitude < bounds.minLongitude) {
|
|
52
|
+
bounds.minLongitude = point.longitude;
|
|
53
|
+
}
|
|
54
|
+
if (bounds.minAltitude == null || point.altitude < bounds.minAltitude) {
|
|
55
|
+
bounds.minAltitude = point.altitude;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return bounds;
|
|
59
|
+
}
|
|
60
|
+
Bounds.FromEntity = FromEntity;
|
|
61
|
+
})(Bounds = exports.Bounds || (exports.Bounds = {}));
|
|
62
62
|
//# sourceMappingURL=bounds.js.map
|