bruce-models 7.1.96 → 7.1.97
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 +146 -33
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +146 -33
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account-concept.js +29 -4
- package/dist/lib/account/account-concept.js.map +1 -1
- package/dist/lib/account/account-invite.js +96 -3
- package/dist/lib/account/account-invite.js.map +1 -1
- package/dist/lib/bruce-models.js +1 -1
- package/dist/lib/user/user.js +20 -25
- package/dist/lib/user/user.js.map +1 -1
- package/dist/types/account/account-concept.d.ts +5 -1
- package/dist/types/account/account-invite.d.ts +84 -2
- package/dist/types/bruce-models.d.ts +1 -1
- package/dist/types/user/user.d.ts +4 -5
- package/package.json +1 -1
package/dist/bruce-models.es5.js
CHANGED
|
@@ -372,6 +372,9 @@ var AccountConcept;
|
|
|
372
372
|
// Manage own records only (eg: own draft bookmarks within a Project View).
|
|
373
373
|
// Only implemented for Bookmarks at the moment.
|
|
374
374
|
EAction["MANAGE_OWN"] = "MANAGE_OWN";
|
|
375
|
+
// Full CRUD over every record this one owns, and nothing on this record beyond reading it.
|
|
376
|
+
// Eg: "manage_content:et:<id>" manages that type's Entities without editing the type.
|
|
377
|
+
EAction["MANAGE_CONTENT"] = "MANAGE_CONTENT";
|
|
375
378
|
EAction["VIEW"] = "VIEW";
|
|
376
379
|
EAction["CREATE"] = "CREATE";
|
|
377
380
|
EAction["EDIT"] = "EDIT";
|
|
@@ -434,10 +437,16 @@ var AccountConcept;
|
|
|
434
437
|
* Builds a concept permission string.
|
|
435
438
|
* Omit recordId for an account-wide permission, eg: "view:pv".
|
|
436
439
|
* Pass recordId for a record-specific permission, eg: "view:pv:abc123".
|
|
440
|
+
* Pass ownedConcept to narrow it to one kind of record that record owns,
|
|
441
|
+
* eg: "edit:et:abc123:e" for that Entity Type's Entities and nothing else.
|
|
437
442
|
*/
|
|
438
|
-
function buildPermission(action, concept, recordId) {
|
|
443
|
+
function buildPermission(action, concept, recordId, ownedConcept) {
|
|
439
444
|
const base = `${action.toLowerCase()}:${concept}`;
|
|
440
|
-
|
|
445
|
+
if (!recordId) {
|
|
446
|
+
return base;
|
|
447
|
+
}
|
|
448
|
+
const record = `${base}:${recordId}`;
|
|
449
|
+
return ownedConcept ? `${record}:${ownedConcept}` : record;
|
|
441
450
|
}
|
|
442
451
|
AccountConcept.buildPermission = buildPermission;
|
|
443
452
|
/**
|
|
@@ -474,11 +483,27 @@ var AccountConcept;
|
|
|
474
483
|
if (!matchedConcept) {
|
|
475
484
|
return null;
|
|
476
485
|
}
|
|
477
|
-
const
|
|
486
|
+
const tail = rest.length > matchedLen ? rest.substring(matchedLen + 1) : undefined;
|
|
487
|
+
// A fourth segment narrows the grant to one kind of record the named record owns.
|
|
488
|
+
// Anything that is not a concept token stays part of the record ID.
|
|
489
|
+
let recordId = tail;
|
|
490
|
+
let ownedConcept;
|
|
491
|
+
if (tail) {
|
|
492
|
+
const lastColon = tail.lastIndexOf(":");
|
|
493
|
+
if (lastColon > 0) {
|
|
494
|
+
const candidate = tail.substring(lastColon + 1);
|
|
495
|
+
const matched = Object.values(EConcept).find(t => t === candidate);
|
|
496
|
+
if (matched) {
|
|
497
|
+
ownedConcept = matched;
|
|
498
|
+
recordId = tail.substring(0, lastColon);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
478
502
|
return {
|
|
479
503
|
action: matchedAction,
|
|
480
504
|
concept: matchedConcept,
|
|
481
|
-
recordId
|
|
505
|
+
recordId,
|
|
506
|
+
ownedConcept
|
|
482
507
|
};
|
|
483
508
|
}
|
|
484
509
|
AccountConcept.parsePermission = parsePermission;
|
|
@@ -2935,6 +2960,20 @@ var AccountFeatures;
|
|
|
2935
2960
|
*/
|
|
2936
2961
|
var AccountInvite;
|
|
2937
2962
|
(function (AccountInvite) {
|
|
2963
|
+
// Error type returned when inviting a user who already has access to the account.
|
|
2964
|
+
// Their group membership is changed directly rather than offered to them.
|
|
2965
|
+
AccountInvite.ERROR_ALREADY_MEMBER = "AlreadyMember";
|
|
2966
|
+
/**
|
|
2967
|
+
* Returns whether a failed Create was refused because the user is already in the account.
|
|
2968
|
+
* @param error the value thrown by Create.
|
|
2969
|
+
* @returns
|
|
2970
|
+
*/
|
|
2971
|
+
function IsAlreadyMemberError(error) {
|
|
2972
|
+
var _a, _b;
|
|
2973
|
+
const type = (_b = (_a = error === null || error === void 0 ? void 0 : error.ERROR) === null || _a === void 0 ? void 0 : _a.Type) !== null && _b !== void 0 ? _b : error === null || error === void 0 ? void 0 : error.Type;
|
|
2974
|
+
return type === AccountInvite.ERROR_ALREADY_MEMBER;
|
|
2975
|
+
}
|
|
2976
|
+
AccountInvite.IsAlreadyMemberError = IsAlreadyMemberError;
|
|
2938
2977
|
/**
|
|
2939
2978
|
* Possible invite statuses.
|
|
2940
2979
|
*/
|
|
@@ -2945,6 +2984,8 @@ var AccountInvite;
|
|
|
2945
2984
|
EStatus["Sent"] = "Sent";
|
|
2946
2985
|
EStatus["NotSent"] = "Not sent";
|
|
2947
2986
|
EStatus["Accepted"] = "Accepted";
|
|
2987
|
+
// Closed because the user accepted another invite to the same account.
|
|
2988
|
+
EStatus["Superseded"] = "Superseded";
|
|
2948
2989
|
})(EStatus = AccountInvite.EStatus || (AccountInvite.EStatus = {}));
|
|
2949
2990
|
/**
|
|
2950
2991
|
* Returns whether an invite is still awaiting a response from its recipient.
|
|
@@ -2959,6 +3000,16 @@ var AccountInvite;
|
|
|
2959
3000
|
return invite.Status === EStatus.Sent || invite.Status === EStatus.NotSent;
|
|
2960
3001
|
}
|
|
2961
3002
|
AccountInvite.IsPending = IsPending;
|
|
3003
|
+
/**
|
|
3004
|
+
* Ways an invited user can prove they are who the invitation was addressed to.
|
|
3005
|
+
*/
|
|
3006
|
+
let EIdentityProof;
|
|
3007
|
+
(function (EIdentityProof) {
|
|
3008
|
+
// Confirming the password they already hold.
|
|
3009
|
+
EIdentityProof["Password"] = "Password";
|
|
3010
|
+
// Signing in, by whichever method their account allows, and returning.
|
|
3011
|
+
EIdentityProof["Session"] = "Session";
|
|
3012
|
+
})(EIdentityProof = AccountInvite.EIdentityProof || (AccountInvite.EIdentityProof = {}));
|
|
2962
3013
|
/**
|
|
2963
3014
|
* Possible invite methods.
|
|
2964
3015
|
*/
|
|
@@ -2995,6 +3046,66 @@ var AccountInvite;
|
|
|
2995
3046
|
});
|
|
2996
3047
|
}
|
|
2997
3048
|
AccountInvite.GetByCode = GetByCode;
|
|
3049
|
+
/**
|
|
3050
|
+
* Returns one invite by its ID. Requires the session to be an account owner or admin.
|
|
3051
|
+
* @param params
|
|
3052
|
+
* @returns
|
|
3053
|
+
*/
|
|
3054
|
+
function GetByID(params) {
|
|
3055
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3056
|
+
let { api, id, req } = params;
|
|
3057
|
+
if (!api) {
|
|
3058
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
3059
|
+
}
|
|
3060
|
+
const invite = yield api.GET(`v3/accountInvite/${id}`, Api.PrepReqParams(req));
|
|
3061
|
+
return {
|
|
3062
|
+
invite: invite
|
|
3063
|
+
};
|
|
3064
|
+
});
|
|
3065
|
+
}
|
|
3066
|
+
AccountInvite.GetByID = GetByID;
|
|
3067
|
+
/**
|
|
3068
|
+
* Returns a list of invites grouped by the invited user.
|
|
3069
|
+
* Paging covers users rather than invites, so a user's invitations never straddle a page.
|
|
3070
|
+
* @param params
|
|
3071
|
+
* @returns
|
|
3072
|
+
*/
|
|
3073
|
+
function GetListByUser(params) {
|
|
3074
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3075
|
+
const res = yield GetList(Object.assign(Object.assign({}, params), { groupByUser: true }));
|
|
3076
|
+
return {
|
|
3077
|
+
users: res.invites,
|
|
3078
|
+
totalCount: res.totalCount,
|
|
3079
|
+
hasNextPage: res.hasNextPage,
|
|
3080
|
+
userGroups: res.userGroups
|
|
3081
|
+
};
|
|
3082
|
+
});
|
|
3083
|
+
}
|
|
3084
|
+
AccountInvite.GetListByUser = GetListByUser;
|
|
3085
|
+
/**
|
|
3086
|
+
* Re-delivers an invitation that is still open, renewing its code and expiry.
|
|
3087
|
+
* @param params
|
|
3088
|
+
* @returns
|
|
3089
|
+
*/
|
|
3090
|
+
function Resend(params) {
|
|
3091
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3092
|
+
let { api, id, emailTemplateKey, req } = params;
|
|
3093
|
+
if (!api) {
|
|
3094
|
+
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
3095
|
+
}
|
|
3096
|
+
if (!id) {
|
|
3097
|
+
throw new Error("An invite ID must be provided.");
|
|
3098
|
+
}
|
|
3099
|
+
const invite = yield api.POST("v3/resendAccountInvite", {
|
|
3100
|
+
ID: id,
|
|
3101
|
+
"Email.Template": emailTemplateKey
|
|
3102
|
+
}, Api.PrepReqParams(req));
|
|
3103
|
+
return {
|
|
3104
|
+
invite: invite
|
|
3105
|
+
};
|
|
3106
|
+
});
|
|
3107
|
+
}
|
|
3108
|
+
AccountInvite.Resend = Resend;
|
|
2998
3109
|
/**
|
|
2999
3110
|
* Returns a list of invites matching provided criteria.
|
|
3000
3111
|
* For example you can get a list of invites for a specific account or user (or both).
|
|
@@ -3003,7 +3114,7 @@ var AccountInvite;
|
|
|
3003
3114
|
*/
|
|
3004
3115
|
function GetList(params) {
|
|
3005
3116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3006
|
-
let { api, accountId, userId, status, expired, expandUsers, expandGroups, pageSize, pageIndex, req } = params;
|
|
3117
|
+
let { api, accountId, userId, status, expired, expandUsers, expandGroups, groupByUser, pageSize, pageIndex, req } = params;
|
|
3007
3118
|
if (!api) {
|
|
3008
3119
|
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
3009
3120
|
}
|
|
@@ -3030,6 +3141,9 @@ var AccountInvite;
|
|
|
3030
3141
|
if (expand.length) {
|
|
3031
3142
|
urlParams.append("Expand", expand.join(","));
|
|
3032
3143
|
}
|
|
3144
|
+
if (groupByUser) {
|
|
3145
|
+
urlParams.append("GroupBy", "User");
|
|
3146
|
+
}
|
|
3033
3147
|
if (pageSize !== undefined && pageSize !== null) {
|
|
3034
3148
|
urlParams.append("PageSize", String(pageSize));
|
|
3035
3149
|
}
|
|
@@ -3066,19 +3180,23 @@ var AccountInvite;
|
|
|
3066
3180
|
*/
|
|
3067
3181
|
function Update(params) {
|
|
3068
3182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3069
|
-
let { api, code, id, status, groupIds, user, req } = params;
|
|
3183
|
+
let { api, code, id, status, groupIds, user, password, req } = params;
|
|
3070
3184
|
if (!api) {
|
|
3071
3185
|
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
3072
3186
|
}
|
|
3073
3187
|
if (!code && !id) {
|
|
3074
3188
|
throw new Error("Either an invite ID or InviteCode must be provided.");
|
|
3075
3189
|
}
|
|
3190
|
+
if (!status && !groupIds) {
|
|
3191
|
+
throw new Error("Either a status or User Groups must be provided.");
|
|
3192
|
+
}
|
|
3076
3193
|
const invite = yield api.POST("v3/accountInvite", {
|
|
3077
3194
|
ID: id,
|
|
3078
3195
|
InviteCode: code,
|
|
3079
3196
|
Status: status,
|
|
3080
3197
|
"UserGroup.ID": groupIds,
|
|
3081
|
-
User: user
|
|
3198
|
+
User: user,
|
|
3199
|
+
Password: password
|
|
3082
3200
|
}, Api.PrepReqParams(req));
|
|
3083
3201
|
return {
|
|
3084
3202
|
invite: invite
|
|
@@ -22831,8 +22949,8 @@ var User;
|
|
|
22831
22949
|
function ForgotPassword(params) {
|
|
22832
22950
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22833
22951
|
let { api, accountId, email, req: reqParams } = params;
|
|
22834
|
-
if (!
|
|
22835
|
-
throw ("
|
|
22952
|
+
if (!email) {
|
|
22953
|
+
throw new Error("An email address is required.");
|
|
22836
22954
|
}
|
|
22837
22955
|
if (!api) {
|
|
22838
22956
|
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
@@ -22841,21 +22959,9 @@ var User;
|
|
|
22841
22959
|
if (accountId) {
|
|
22842
22960
|
url += "?Account=" + accountId;
|
|
22843
22961
|
}
|
|
22844
|
-
|
|
22962
|
+
yield api.POST(url, {
|
|
22845
22963
|
Email: email
|
|
22846
22964
|
}, reqParams);
|
|
22847
|
-
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
22848
|
-
try {
|
|
22849
|
-
const data = yield req;
|
|
22850
|
-
res({
|
|
22851
|
-
userId: data.ID
|
|
22852
|
-
});
|
|
22853
|
-
}
|
|
22854
|
-
catch (e) {
|
|
22855
|
-
rej(e);
|
|
22856
|
-
}
|
|
22857
|
-
}));
|
|
22858
|
-
return prom;
|
|
22859
22965
|
});
|
|
22860
22966
|
}
|
|
22861
22967
|
LoginUser.ForgotPassword = ForgotPassword;
|
|
@@ -22866,22 +22972,29 @@ var User;
|
|
|
22866
22972
|
*/
|
|
22867
22973
|
function ForgotPasswordComplete(params) {
|
|
22868
22974
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22869
|
-
let { api, code, userId, password, req: reqParams } = params;
|
|
22975
|
+
let { api, code, email, userId, password, req: reqParams } = params;
|
|
22870
22976
|
if (!api) {
|
|
22871
22977
|
api = ENVIRONMENT.Api().GetGuardianApi();
|
|
22872
22978
|
}
|
|
22873
|
-
|
|
22874
|
-
|
|
22875
|
-
|
|
22876
|
-
|
|
22877
|
-
|
|
22878
|
-
|
|
22979
|
+
if (!email && !userId) {
|
|
22980
|
+
throw new Error("Either an email or a user ID must be provided.");
|
|
22981
|
+
}
|
|
22982
|
+
// Callers holding only an ID still need the address resolved, but a caller that already
|
|
22983
|
+
// knows it should not have to read the user record back to reset a password.
|
|
22984
|
+
if (!email && userId) {
|
|
22985
|
+
const { user } = yield Get({
|
|
22986
|
+
api: api,
|
|
22987
|
+
userId: userId,
|
|
22988
|
+
accountId: "",
|
|
22989
|
+
req: reqParams
|
|
22990
|
+
});
|
|
22991
|
+
email = user.Email;
|
|
22992
|
+
}
|
|
22879
22993
|
const res = yield api.POST("v3/userForgotPassword/complete", {
|
|
22880
22994
|
ID: userId,
|
|
22881
|
-
Email:
|
|
22995
|
+
Email: email,
|
|
22882
22996
|
ActivationCode: code,
|
|
22883
|
-
Password: password
|
|
22884
|
-
FullName: user.FullName
|
|
22997
|
+
Password: password
|
|
22885
22998
|
}, reqParams);
|
|
22886
22999
|
return {
|
|
22887
23000
|
user: res
|
|
@@ -23536,7 +23649,7 @@ var UrlUtils;
|
|
|
23536
23649
|
})(UrlUtils || (UrlUtils = {}));
|
|
23537
23650
|
|
|
23538
23651
|
// This is updated with the package.json version on build.
|
|
23539
|
-
const VERSION = "7.1.
|
|
23652
|
+
const VERSION = "7.1.97";
|
|
23540
23653
|
|
|
23541
23654
|
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, 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, 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 };
|
|
23542
23655
|
//# sourceMappingURL=bruce-models.es5.js.map
|