bruce-models 7.1.123 → 7.1.126
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 +103 -19
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +103 -19
- 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/entity/entity.js +13 -3
- package/dist/lib/entity/entity.js.map +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/entity/entity.d.ts +1 -0
- package/dist/types/plugin/plugin.d.ts +28 -0
- package/package.json +1 -1
package/dist/bruce-models.umd.js
CHANGED
|
@@ -1222,8 +1222,9 @@
|
|
|
1222
1222
|
}
|
|
1223
1223
|
/**
|
|
1224
1224
|
* Injects auth header into the headers object.
|
|
1225
|
+
* Use this for a request made outside the GET/POST/PUT/DELETE/UPLOAD methods, such as a raw fetch.
|
|
1225
1226
|
*/
|
|
1226
|
-
|
|
1227
|
+
ApplyAuthHeader(headers) {
|
|
1227
1228
|
if (!this.ssidHeader) {
|
|
1228
1229
|
return;
|
|
1229
1230
|
}
|
|
@@ -1266,7 +1267,7 @@
|
|
|
1266
1267
|
}
|
|
1267
1268
|
params.headers = params.headers || {};
|
|
1268
1269
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1269
|
-
this.
|
|
1270
|
+
this.ApplyAuthHeader(params.headers);
|
|
1270
1271
|
const res = yield fetch(url, {
|
|
1271
1272
|
headers: params.headers,
|
|
1272
1273
|
signal: params.abortSignal
|
|
@@ -1288,7 +1289,7 @@
|
|
|
1288
1289
|
}
|
|
1289
1290
|
params.headers = params.headers || {};
|
|
1290
1291
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1291
|
-
this.
|
|
1292
|
+
this.ApplyAuthHeader(params.headers);
|
|
1292
1293
|
if (data != null && typeof data != "string") {
|
|
1293
1294
|
data = JSON.stringify(data);
|
|
1294
1295
|
}
|
|
@@ -1316,7 +1317,7 @@
|
|
|
1316
1317
|
}
|
|
1317
1318
|
params.headers = params.headers || {};
|
|
1318
1319
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1319
|
-
this.
|
|
1320
|
+
this.ApplyAuthHeader(params.headers);
|
|
1320
1321
|
if (!data) {
|
|
1321
1322
|
data = {};
|
|
1322
1323
|
}
|
|
@@ -1347,7 +1348,7 @@
|
|
|
1347
1348
|
}
|
|
1348
1349
|
params.headers = params.headers || {};
|
|
1349
1350
|
params.headers = Object.assign({ "Content-Type": "application/json;" }, params.headers);
|
|
1350
|
-
this.
|
|
1351
|
+
this.ApplyAuthHeader(params.headers);
|
|
1351
1352
|
if (!data) {
|
|
1352
1353
|
data = {};
|
|
1353
1354
|
}
|
|
@@ -1377,7 +1378,7 @@
|
|
|
1377
1378
|
params = {};
|
|
1378
1379
|
}
|
|
1379
1380
|
params.headers = Object.assign({}, params.headers);
|
|
1380
|
-
this.
|
|
1381
|
+
this.ApplyAuthHeader(params.headers);
|
|
1381
1382
|
const formData = params.formData instanceof FormData ? params.formData : new FormData();
|
|
1382
1383
|
if (formData.has("file")) {
|
|
1383
1384
|
formData.delete("file");
|
|
@@ -7124,7 +7125,7 @@
|
|
|
7124
7125
|
function Update(params) {
|
|
7125
7126
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
7126
7127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7127
|
-
let { api, entity: data, entities, override, req: reqParams, migrated, skipSourcePush } = params;
|
|
7128
|
+
let { api, entity: data, entities, override, req: reqParams, migrated, skipSourcePush, expandLocation } = params;
|
|
7128
7129
|
if (migrated == null || migrated == undefined) {
|
|
7129
7130
|
// Changed to default = true. 18th April 2025.
|
|
7130
7131
|
migrated = true;
|
|
@@ -7150,9 +7151,16 @@
|
|
|
7150
7151
|
if (!api) {
|
|
7151
7152
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
7152
7153
|
}
|
|
7153
|
-
|
|
7154
|
+
const urlParams = new URLSearchParams();
|
|
7154
7155
|
if (skipSourcePushParam) {
|
|
7155
|
-
|
|
7156
|
+
urlParams.set("SkipSourcePush", skipSourcePushParam);
|
|
7157
|
+
}
|
|
7158
|
+
if (expandLocation) {
|
|
7159
|
+
urlParams.set("Expand", "location");
|
|
7160
|
+
}
|
|
7161
|
+
let reqUrl = "v3/entities";
|
|
7162
|
+
if (urlParams.toString()) {
|
|
7163
|
+
reqUrl += `?${urlParams.toString()}`;
|
|
7156
7164
|
}
|
|
7157
7165
|
const reqBody = {
|
|
7158
7166
|
Items: entities,
|
|
@@ -7216,6 +7224,9 @@
|
|
|
7216
7224
|
if (skipSourcePushParam) {
|
|
7217
7225
|
reqUrl += `&SkipSourcePush=${encodeURIComponent(skipSourcePushParam)}`;
|
|
7218
7226
|
}
|
|
7227
|
+
if (expandLocation) {
|
|
7228
|
+
reqUrl += "&Expand=location";
|
|
7229
|
+
}
|
|
7219
7230
|
const res = yield api.POST(reqUrl, data, exports.Api.PrepReqParams(reqParams));
|
|
7220
7231
|
api.Cache.RemoveByContains(GetContainsKey(data.Bruce.ID));
|
|
7221
7232
|
exports.EntityHistoricData.ClearCacheByEntityIds(api, [data.Bruce.ID]);
|
|
@@ -19735,16 +19746,31 @@
|
|
|
19735
19746
|
* @returns
|
|
19736
19747
|
*/
|
|
19737
19748
|
function GetLoadUrl(params) {
|
|
19738
|
-
|
|
19749
|
+
const { fileUrl } = GetFileUrl(Object.assign(Object.assign({}, params), { filePath: "index.jsc" }));
|
|
19750
|
+
return {
|
|
19751
|
+
indexFileUrl: fileUrl
|
|
19752
|
+
};
|
|
19753
|
+
}
|
|
19754
|
+
Plugin.GetLoadUrl = GetLoadUrl;
|
|
19755
|
+
/**
|
|
19756
|
+
* Returns a URL to a file within a plugin's ZIP.
|
|
19757
|
+
* @param params
|
|
19758
|
+
* @returns
|
|
19759
|
+
*/
|
|
19760
|
+
function GetFileUrl(params) {
|
|
19761
|
+
let { api, pluginId, filePath, cacheKey, viaCdn } = params;
|
|
19739
19762
|
if (!api) {
|
|
19740
19763
|
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
19741
19764
|
}
|
|
19742
19765
|
if (!cacheKey) {
|
|
19743
19766
|
cacheKey = 0;
|
|
19744
19767
|
}
|
|
19768
|
+
if (filePath.startsWith("/")) {
|
|
19769
|
+
filePath = filePath.substring(1);
|
|
19770
|
+
}
|
|
19745
19771
|
return {
|
|
19746
|
-
|
|
19747
|
-
url: `ui.plugin/${pluginId}/file
|
|
19772
|
+
fileUrl: api.ConstructUrl({
|
|
19773
|
+
url: `ui.plugin/${pluginId}/file/${filePath}`,
|
|
19748
19774
|
urlParams: {
|
|
19749
19775
|
"version": String(cacheKey)
|
|
19750
19776
|
},
|
|
@@ -19752,7 +19778,53 @@
|
|
|
19752
19778
|
})
|
|
19753
19779
|
};
|
|
19754
19780
|
}
|
|
19755
|
-
Plugin.
|
|
19781
|
+
Plugin.GetFileUrl = GetFileUrl;
|
|
19782
|
+
/**
|
|
19783
|
+
* Fetches a file within a plugin's ZIP, with the session attached.
|
|
19784
|
+
* Read the returned response as text, blob or JSON depending on the file.
|
|
19785
|
+
* @param params
|
|
19786
|
+
* @returns
|
|
19787
|
+
*/
|
|
19788
|
+
function LoadFile(params) {
|
|
19789
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19790
|
+
let { api, pluginId, plugin, filePath, req } = params;
|
|
19791
|
+
if (!filePath) {
|
|
19792
|
+
throw ("File path is required.");
|
|
19793
|
+
}
|
|
19794
|
+
if (!api) {
|
|
19795
|
+
api = exports.ENVIRONMENT.Api().GetBruceApi();
|
|
19796
|
+
}
|
|
19797
|
+
yield api.Loading;
|
|
19798
|
+
if (!plugin && pluginId) {
|
|
19799
|
+
plugin = (yield Plugin.Get({
|
|
19800
|
+
pluginId,
|
|
19801
|
+
api,
|
|
19802
|
+
req
|
|
19803
|
+
})).plugin;
|
|
19804
|
+
}
|
|
19805
|
+
if (plugin && !pluginId) {
|
|
19806
|
+
pluginId = plugin.ID;
|
|
19807
|
+
}
|
|
19808
|
+
const { fileUrl } = GetFileUrl({
|
|
19809
|
+
api,
|
|
19810
|
+
pluginId,
|
|
19811
|
+
filePath,
|
|
19812
|
+
cacheKey: plugin.Version,
|
|
19813
|
+
viaCdn: !plugin.IsLoginRequired
|
|
19814
|
+
});
|
|
19815
|
+
const headers = {};
|
|
19816
|
+
api.ApplyAuthHeader(headers);
|
|
19817
|
+
const res = yield fetch(fileUrl, {
|
|
19818
|
+
headers: headers,
|
|
19819
|
+
signal: req === null || req === void 0 ? void 0 : req.abortSignal
|
|
19820
|
+
});
|
|
19821
|
+
if (!res.ok) {
|
|
19822
|
+
throw new Error(`Failed to load "${filePath}" from plugin "${pluginId}" (${res.status}).`);
|
|
19823
|
+
}
|
|
19824
|
+
return res;
|
|
19825
|
+
});
|
|
19826
|
+
}
|
|
19827
|
+
Plugin.LoadFile = LoadFile;
|
|
19756
19828
|
/**
|
|
19757
19829
|
* Creates or updates a plugin.
|
|
19758
19830
|
* @param params
|
|
@@ -19862,9 +19934,7 @@
|
|
|
19862
19934
|
}
|
|
19863
19935
|
else {
|
|
19864
19936
|
const headers = {};
|
|
19865
|
-
|
|
19866
|
-
headers[api.GetSessionHeader()] = api.GetSessionId();
|
|
19867
|
-
}
|
|
19937
|
+
api.ApplyAuthHeader(headers);
|
|
19868
19938
|
// A refusal must not be cached and run as if it were the plugin's code.
|
|
19869
19939
|
fileContentProm = fetch(indexFileUrl, {
|
|
19870
19940
|
headers: headers
|
|
@@ -19923,6 +19993,13 @@
|
|
|
19923
19993
|
const paramsId = exports.ObjectUtils.UId();
|
|
19924
19994
|
window[paramsId] = pluginParams ? pluginParams : {};
|
|
19925
19995
|
window["PLUGIN_" + pluginId] = plugin;
|
|
19996
|
+
const loadFileId = exports.ObjectUtils.UId();
|
|
19997
|
+
window[loadFileId] = (filePath) => LoadFile({
|
|
19998
|
+
api: loaded.api,
|
|
19999
|
+
plugin,
|
|
20000
|
+
filePath,
|
|
20001
|
+
req
|
|
20002
|
+
});
|
|
19926
20003
|
const disposeId = exports.ObjectUtils.UId();
|
|
19927
20004
|
const elementId = exports.ObjectUtils.UId();
|
|
19928
20005
|
let script = `
|
|
@@ -19953,7 +20030,8 @@
|
|
|
19953
20030
|
container: container,
|
|
19954
20031
|
pluginParams: params,
|
|
19955
20032
|
pluginId: "${pluginId}",
|
|
19956
|
-
plugin: plugin
|
|
20033
|
+
plugin: plugin,
|
|
20034
|
+
loadFile: window["${loadFileId}"]
|
|
19957
20035
|
});
|
|
19958
20036
|
}
|
|
19959
20037
|
run();
|
|
@@ -19988,6 +20066,7 @@
|
|
|
19988
20066
|
}
|
|
19989
20067
|
}
|
|
19990
20068
|
callDispose();
|
|
20069
|
+
delete window[loadFileId];
|
|
19991
20070
|
};
|
|
19992
20071
|
}
|
|
19993
20072
|
};
|
|
@@ -20015,7 +20094,12 @@
|
|
|
20015
20094
|
const contextId = "PLUGIN_CONTEXT_" + callId;
|
|
20016
20095
|
const resultId = "PLUGIN_RESULT_" + callId;
|
|
20017
20096
|
window[argsId] = args ? args : {};
|
|
20018
|
-
window[contextId] = Object.assign({ config: loaded.plugin.Settings ? loaded.plugin.Settings.config : undefined, plugin: loaded.plugin
|
|
20097
|
+
window[contextId] = Object.assign({ config: loaded.plugin.Settings ? loaded.plugin.Settings.config : undefined, plugin: loaded.plugin, loadFile: (filePath) => LoadFile({
|
|
20098
|
+
api: loaded.api,
|
|
20099
|
+
plugin: loaded.plugin,
|
|
20100
|
+
filePath,
|
|
20101
|
+
req
|
|
20102
|
+
}) }, (context ? context : {}));
|
|
20019
20103
|
const script = `
|
|
20020
20104
|
function invoke() {
|
|
20021
20105
|
"use strict";
|
|
@@ -25205,7 +25289,7 @@
|
|
|
25205
25289
|
}
|
|
25206
25290
|
|
|
25207
25291
|
// This is updated with the package.json version on build.
|
|
25208
|
-
const VERSION = "7.1.
|
|
25292
|
+
const VERSION = "7.1.126";
|
|
25209
25293
|
|
|
25210
25294
|
exports.VERSION = VERSION;
|
|
25211
25295
|
exports.AbstractApi = AbstractApi;
|