bruce-models 7.1.123 → 7.1.124
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 +90 -16
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +90 -16
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/api/abstract-api.js +7 -6
- package/dist/lib/api/abstract-api.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/plugin/plugin.js +82 -9
- package/dist/lib/plugin/plugin.js.map +1 -1
- package/dist/types/api/abstract-api.d.ts +2 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/plugin/plugin.d.ts +28 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -1227,8 +1227,9 @@ class AbstractApi {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
/**
|
|
1229
1229
|
* Injects auth header into the headers object.
|
|
1230
|
+
* Use this for a request made outside the GET/POST/PUT/DELETE/UPLOAD methods, such as a raw fetch.
|
|
1230
1231
|
*/
|
|
1231
|
-
|
|
1232
|
+
ApplyAuthHeader(headers) {
|
|
1232
1233
|
if (!this.ssidHeader) {
|
|
1233
1234
|
return;
|
|
1234
1235
|
}
|
|
@@ -1271,7 +1272,7 @@ class AbstractApi {
|
|
|
1271
1272
|
}
|
|
1272
1273
|
params.headers = params.headers || {};
|
|
1273
1274
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1274
|
-
this.
|
|
1275
|
+
this.ApplyAuthHeader(params.headers);
|
|
1275
1276
|
const res = yield fetch(url, {
|
|
1276
1277
|
headers: params.headers,
|
|
1277
1278
|
signal: params.abortSignal
|
|
@@ -1293,7 +1294,7 @@ class AbstractApi {
|
|
|
1293
1294
|
}
|
|
1294
1295
|
params.headers = params.headers || {};
|
|
1295
1296
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1296
|
-
this.
|
|
1297
|
+
this.ApplyAuthHeader(params.headers);
|
|
1297
1298
|
if (data != null && typeof data != "string") {
|
|
1298
1299
|
data = JSON.stringify(data);
|
|
1299
1300
|
}
|
|
@@ -1321,7 +1322,7 @@ class AbstractApi {
|
|
|
1321
1322
|
}
|
|
1322
1323
|
params.headers = params.headers || {};
|
|
1323
1324
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1324
|
-
this.
|
|
1325
|
+
this.ApplyAuthHeader(params.headers);
|
|
1325
1326
|
if (!data) {
|
|
1326
1327
|
data = {};
|
|
1327
1328
|
}
|
|
@@ -1352,7 +1353,7 @@ class AbstractApi {
|
|
|
1352
1353
|
}
|
|
1353
1354
|
params.headers = params.headers || {};
|
|
1354
1355
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1355
|
-
this.
|
|
1356
|
+
this.ApplyAuthHeader(params.headers);
|
|
1356
1357
|
if (!data) {
|
|
1357
1358
|
data = {};
|
|
1358
1359
|
}
|
|
@@ -1382,7 +1383,7 @@ class AbstractApi {
|
|
|
1382
1383
|
params = {};
|
|
1383
1384
|
}
|
|
1384
1385
|
params.headers = Object.assign({}, params.headers);
|
|
1385
|
-
this.
|
|
1386
|
+
this.ApplyAuthHeader(params.headers);
|
|
1386
1387
|
const formData = params.formData instanceof FormData ? params.formData : new FormData();
|
|
1387
1388
|
if (formData.has("file")) {
|
|
1388
1389
|
formData.delete("file");
|
|
@@ -20024,16 +20025,31 @@ var Plugin;
|
|
|
20024
20025
|
* @returns
|
|
20025
20026
|
*/
|
|
20026
20027
|
function GetLoadUrl(params) {
|
|
20027
|
-
|
|
20028
|
+
const { fileUrl } = GetFileUrl(Object.assign(Object.assign({}, params), { filePath: "index.jsc" }));
|
|
20029
|
+
return {
|
|
20030
|
+
indexFileUrl: fileUrl
|
|
20031
|
+
};
|
|
20032
|
+
}
|
|
20033
|
+
Plugin.GetLoadUrl = GetLoadUrl;
|
|
20034
|
+
/**
|
|
20035
|
+
* Returns a URL to a file within a plugin's ZIP.
|
|
20036
|
+
* @param params
|
|
20037
|
+
* @returns
|
|
20038
|
+
*/
|
|
20039
|
+
function GetFileUrl(params) {
|
|
20040
|
+
let { api, pluginId, filePath, cacheKey, viaCdn } = params;
|
|
20028
20041
|
if (!api) {
|
|
20029
20042
|
api = ENVIRONMENT.Api().GetBruceApi();
|
|
20030
20043
|
}
|
|
20031
20044
|
if (!cacheKey) {
|
|
20032
20045
|
cacheKey = 0;
|
|
20033
20046
|
}
|
|
20047
|
+
if (filePath.startsWith("/")) {
|
|
20048
|
+
filePath = filePath.substring(1);
|
|
20049
|
+
}
|
|
20034
20050
|
return {
|
|
20035
|
-
|
|
20036
|
-
url: `ui.plugin/${pluginId}/file
|
|
20051
|
+
fileUrl: api.ConstructUrl({
|
|
20052
|
+
url: `ui.plugin/${pluginId}/file/${filePath}`,
|
|
20037
20053
|
urlParams: {
|
|
20038
20054
|
"version": String(cacheKey)
|
|
20039
20055
|
},
|
|
@@ -20041,7 +20057,53 @@ var Plugin;
|
|
|
20041
20057
|
})
|
|
20042
20058
|
};
|
|
20043
20059
|
}
|
|
20044
|
-
Plugin.
|
|
20060
|
+
Plugin.GetFileUrl = GetFileUrl;
|
|
20061
|
+
/**
|
|
20062
|
+
* Fetches a file within a plugin's ZIP, with the session attached.
|
|
20063
|
+
* Read the returned response as text, blob or JSON depending on the file.
|
|
20064
|
+
* @param params
|
|
20065
|
+
* @returns
|
|
20066
|
+
*/
|
|
20067
|
+
function LoadFile(params) {
|
|
20068
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20069
|
+
let { api, pluginId, plugin, filePath, req } = params;
|
|
20070
|
+
if (!filePath) {
|
|
20071
|
+
throw ("File path is required.");
|
|
20072
|
+
}
|
|
20073
|
+
if (!api) {
|
|
20074
|
+
api = ENVIRONMENT.Api().GetBruceApi();
|
|
20075
|
+
}
|
|
20076
|
+
yield api.Loading;
|
|
20077
|
+
if (!plugin && pluginId) {
|
|
20078
|
+
plugin = (yield Plugin.Get({
|
|
20079
|
+
pluginId,
|
|
20080
|
+
api,
|
|
20081
|
+
req
|
|
20082
|
+
})).plugin;
|
|
20083
|
+
}
|
|
20084
|
+
if (plugin && !pluginId) {
|
|
20085
|
+
pluginId = plugin.ID;
|
|
20086
|
+
}
|
|
20087
|
+
const { fileUrl } = GetFileUrl({
|
|
20088
|
+
api,
|
|
20089
|
+
pluginId,
|
|
20090
|
+
filePath,
|
|
20091
|
+
cacheKey: plugin.Version,
|
|
20092
|
+
viaCdn: !plugin.IsLoginRequired
|
|
20093
|
+
});
|
|
20094
|
+
const headers = {};
|
|
20095
|
+
api.ApplyAuthHeader(headers);
|
|
20096
|
+
const res = yield fetch(fileUrl, {
|
|
20097
|
+
headers: headers,
|
|
20098
|
+
signal: req === null || req === void 0 ? void 0 : req.abortSignal
|
|
20099
|
+
});
|
|
20100
|
+
if (!res.ok) {
|
|
20101
|
+
throw new Error(`Failed to load "${filePath}" from plugin "${pluginId}" (${res.status}).`);
|
|
20102
|
+
}
|
|
20103
|
+
return res;
|
|
20104
|
+
});
|
|
20105
|
+
}
|
|
20106
|
+
Plugin.LoadFile = LoadFile;
|
|
20045
20107
|
/**
|
|
20046
20108
|
* Creates or updates a plugin.
|
|
20047
20109
|
* @param params
|
|
@@ -20151,9 +20213,7 @@ var Plugin;
|
|
|
20151
20213
|
}
|
|
20152
20214
|
else {
|
|
20153
20215
|
const headers = {};
|
|
20154
|
-
|
|
20155
|
-
headers[api.GetSessionHeader()] = api.GetSessionId();
|
|
20156
|
-
}
|
|
20216
|
+
api.ApplyAuthHeader(headers);
|
|
20157
20217
|
// A refusal must not be cached and run as if it were the plugin's code.
|
|
20158
20218
|
fileContentProm = fetch(indexFileUrl, {
|
|
20159
20219
|
headers: headers
|
|
@@ -20212,6 +20272,13 @@ var Plugin;
|
|
|
20212
20272
|
const paramsId = ObjectUtils.UId();
|
|
20213
20273
|
window[paramsId] = pluginParams ? pluginParams : {};
|
|
20214
20274
|
window["PLUGIN_" + pluginId] = plugin;
|
|
20275
|
+
const loadFileId = ObjectUtils.UId();
|
|
20276
|
+
window[loadFileId] = (filePath) => LoadFile({
|
|
20277
|
+
api: loaded.api,
|
|
20278
|
+
plugin,
|
|
20279
|
+
filePath,
|
|
20280
|
+
req
|
|
20281
|
+
});
|
|
20215
20282
|
const disposeId = ObjectUtils.UId();
|
|
20216
20283
|
const elementId = ObjectUtils.UId();
|
|
20217
20284
|
let script = `
|
|
@@ -20242,7 +20309,8 @@ var Plugin;
|
|
|
20242
20309
|
container: container,
|
|
20243
20310
|
pluginParams: params,
|
|
20244
20311
|
pluginId: "${pluginId}",
|
|
20245
|
-
plugin: plugin
|
|
20312
|
+
plugin: plugin,
|
|
20313
|
+
loadFile: window["${loadFileId}"]
|
|
20246
20314
|
});
|
|
20247
20315
|
}
|
|
20248
20316
|
run();
|
|
@@ -20277,6 +20345,7 @@ var Plugin;
|
|
|
20277
20345
|
}
|
|
20278
20346
|
}
|
|
20279
20347
|
callDispose();
|
|
20348
|
+
delete window[loadFileId];
|
|
20280
20349
|
};
|
|
20281
20350
|
}
|
|
20282
20351
|
};
|
|
@@ -20304,7 +20373,12 @@ var Plugin;
|
|
|
20304
20373
|
const contextId = "PLUGIN_CONTEXT_" + callId;
|
|
20305
20374
|
const resultId = "PLUGIN_RESULT_" + callId;
|
|
20306
20375
|
window[argsId] = args ? args : {};
|
|
20307
|
-
window[contextId] = Object.assign({ config: loaded.plugin.Settings ? loaded.plugin.Settings.config : undefined, plugin: loaded.plugin
|
|
20376
|
+
window[contextId] = Object.assign({ config: loaded.plugin.Settings ? loaded.plugin.Settings.config : undefined, plugin: loaded.plugin, loadFile: (filePath) => LoadFile({
|
|
20377
|
+
api: loaded.api,
|
|
20378
|
+
plugin: loaded.plugin,
|
|
20379
|
+
filePath,
|
|
20380
|
+
req
|
|
20381
|
+
}) }, (context ? context : {}));
|
|
20308
20382
|
const script = `
|
|
20309
20383
|
function invoke() {
|
|
20310
20384
|
"use strict";
|
|
@@ -25598,7 +25672,7 @@ function getFirstWrappedArray(data, wrapperKeys) {
|
|
|
25598
25672
|
}
|
|
25599
25673
|
|
|
25600
25674
|
// This is updated with the package.json version on build.
|
|
25601
|
-
const VERSION = "7.1.
|
|
25675
|
+
const VERSION = "7.1.124";
|
|
25602
25676
|
|
|
25603
25677
|
export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, ClientFileFolder, ClientFileValueMap, Bounds, BruceEvent, BruceVariable, CacheControl, Camera, Cartes, Carto, Color, DelayQueue, RequestLane, GeoJson, Geometry, LRUCache, UTC, CustomForm, DashboardView, DataFeed, DataLab, DataLabGroup, DataSource, DataTransform, Comment, Entity, EntityAttachment, EntityAttachmentType, EntityAttribute, EntityComment, EntityCoords, EntityHistoricData, EntityLink, EntityLod, EntityLodCategory, EntityRelation, EntityRelationType, EntitySource, EntityTableView, EntityTag, EntityType, EntityTypeRelation, EntityTypeSource, EntityTypeTrigger, Ontology, OntologyDocument, ENVIRONMENT, ExportBrz, ExportCsv, ExportNsx, ExportUsd, Hexbin, ImportAssembly, ImportCad, ImportCsv, ImportGeoJson, ImportJson, ImportKml, ImportLcc, ImportTif, ImportedFile, Uploader, Markup, UIMarkup, NAVIGATOR_CHAT_EVENT_ENTITY_HIGHLIGHT_APPLIED, NAVIGATOR_CHAT_EVENT_SCENE_CONTEXT_PREFETCHED, NavigatorChatClient, NavigatorMcpWebSocketClient, Plugin, PluginAiTool, ProgramKey, MenuItem, ProjectView, ProjectViewBookmark, ProjectViewBookmarkGroup, ProjectViewLegacy, ProjectViewLegacyBookmark, ProjectViewLegacyTile, ProjectViewTile, ZoomControl, Scenario, HostingLocation, MessageBroker, PendingAction, RecordChangeFeed, Style, Tileset, Tracking, Permission, Session, User, UserGroup, UserMfaMethod, EncryptUtils, MathUtils, ObjectUtils, PathUtils, UrlUtils, WorkflowItem, WorkflowSchedule, WorkflowType, WorkflowItemType };
|
|
25604
25678
|
//# sourceMappingURL=bruce-models.es5.js.map
|