bruce-models 7.1.117 → 7.1.118
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 +60 -1
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +60 -1
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/util/url-utils.js +59 -0
- package/dist/lib/util/url-utils.js.map +1 -1
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/util/url-utils.d.ts +21 -0
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -24381,6 +24381,8 @@ var EncryptUtils;
|
|
|
24381
24381
|
|
|
24382
24382
|
var UrlUtils;
|
|
24383
24383
|
(function (UrlUtils) {
|
|
24384
|
+
// The "S:{expires}.{signature}/" segment the API puts in the path of URLs it signs.
|
|
24385
|
+
const SIGNED_SEGMENT = /\/S:(\d+)\.[A-Za-z0-9_-]+\//;
|
|
24384
24386
|
/**
|
|
24385
24387
|
* Returns a url-safe string that is human readable.
|
|
24386
24388
|
* Eg: 'My Project View!' into 'My-Project-View'.
|
|
@@ -24410,6 +24412,52 @@ var UrlUtils;
|
|
|
24410
24412
|
return urlObj.toString();
|
|
24411
24413
|
}
|
|
24412
24414
|
UrlUtils.AddQueryParam = AddQueryParam;
|
|
24415
|
+
/**
|
|
24416
|
+
* Removes every occurrence of a query parameter from a url.
|
|
24417
|
+
* Eg: RemoveQueryParam('http://example.com/?key=value&other=1', 'key') => 'http://example.com/?other=1'
|
|
24418
|
+
* @param url absolute or relative url.
|
|
24419
|
+
* @param key decoded name of the parameter to remove.
|
|
24420
|
+
* @returns
|
|
24421
|
+
*/
|
|
24422
|
+
function RemoveQueryParam(url, key) {
|
|
24423
|
+
if (!url) {
|
|
24424
|
+
return url;
|
|
24425
|
+
}
|
|
24426
|
+
const hashStart = url.indexOf("#");
|
|
24427
|
+
const hash = hashStart === -1 ? "" : url.substring(hashStart);
|
|
24428
|
+
const beforeHash = hashStart === -1 ? url : url.substring(0, hashStart);
|
|
24429
|
+
const queryStart = beforeHash.indexOf("?");
|
|
24430
|
+
if (queryStart === -1) {
|
|
24431
|
+
return url;
|
|
24432
|
+
}
|
|
24433
|
+
// Works on the raw string so the parameters that stay keep their exact encoding, which a signed query depends on.
|
|
24434
|
+
const kept = beforeHash.substring(queryStart + 1).split("&").filter(pair => {
|
|
24435
|
+
return decodeQueryName(pair.split("=")[0]) !== key;
|
|
24436
|
+
});
|
|
24437
|
+
const query = kept.length ? "?" + kept.join("&") : "";
|
|
24438
|
+
return beforeHash.substring(0, queryStart) + query + hash;
|
|
24439
|
+
}
|
|
24440
|
+
UrlUtils.RemoveQueryParam = RemoveQueryParam;
|
|
24441
|
+
/**
|
|
24442
|
+
* Returns true when the url carries an API signature that has not expired, so it authorises itself.
|
|
24443
|
+
* @param url
|
|
24444
|
+
* @returns
|
|
24445
|
+
*/
|
|
24446
|
+
function IsSignedUrl(url) {
|
|
24447
|
+
const match = url === null || url === void 0 ? void 0 : url.match(SIGNED_SEGMENT);
|
|
24448
|
+
return !!match && Number(match[1]) * 1000 > Date.now();
|
|
24449
|
+
}
|
|
24450
|
+
UrlUtils.IsSignedUrl = IsSignedUrl;
|
|
24451
|
+
/**
|
|
24452
|
+
* Removes the API signature from a url.
|
|
24453
|
+
* Eg: comparing two urls for the same file that were signed at different times, or a link leaving the app that should grant no more than the reader's own access.
|
|
24454
|
+
* @param url
|
|
24455
|
+
* @returns
|
|
24456
|
+
*/
|
|
24457
|
+
function RemoveSignature(url) {
|
|
24458
|
+
return url ? url.replace(SIGNED_SEGMENT, "/") : url;
|
|
24459
|
+
}
|
|
24460
|
+
UrlUtils.RemoveSignature = RemoveSignature;
|
|
24413
24461
|
/**
|
|
24414
24462
|
* Returns a url with the provided url appended to the provided existing url.
|
|
24415
24463
|
* @param params
|
|
@@ -24462,6 +24510,17 @@ var UrlUtils;
|
|
|
24462
24510
|
return full;
|
|
24463
24511
|
}
|
|
24464
24512
|
UrlUtils.ConstructUrl = ConstructUrl;
|
|
24513
|
+
/**
|
|
24514
|
+
* Decodes a query parameter name the way URLSearchParams does, keeping the raw name when it is malformed.
|
|
24515
|
+
*/
|
|
24516
|
+
function decodeQueryName(name) {
|
|
24517
|
+
try {
|
|
24518
|
+
return decodeURIComponent(name.replace(/\+/g, " "));
|
|
24519
|
+
}
|
|
24520
|
+
catch (_a) {
|
|
24521
|
+
return name;
|
|
24522
|
+
}
|
|
24523
|
+
}
|
|
24465
24524
|
})(UrlUtils || (UrlUtils = {}));
|
|
24466
24525
|
|
|
24467
24526
|
var WorkflowItem;
|
|
@@ -25300,7 +25359,7 @@ function getFirstWrappedArray(data, wrapperKeys) {
|
|
|
25300
25359
|
}
|
|
25301
25360
|
|
|
25302
25361
|
// This is updated with the package.json version on build.
|
|
25303
|
-
const VERSION = "7.1.
|
|
25362
|
+
const VERSION = "7.1.118";
|
|
25304
25363
|
|
|
25305
25364
|
export { VERSION, Account, AccountAudit, AccountConcept, AccountFeatures, AccountInvite, AccountLimits, AccountTemplate, AccountType, AnnDocument, AbstractApi, Api, ApiGetters, BruceApi, GlobalApi, GuardianApi, Assembly, Calculator, ChangeSet, ClientFile, 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 };
|
|
25306
25365
|
//# sourceMappingURL=bruce-models.es5.js.map
|