bruce-models 7.1.90 → 7.1.92

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.
@@ -2943,9 +2943,22 @@ var AccountInvite;
2943
2943
  EStatus["Denied"] = "Denied";
2944
2944
  EStatus["Cancelled"] = "Cancelled";
2945
2945
  EStatus["Sent"] = "Sent";
2946
- EStatus["NotSent"] = "NotSent";
2946
+ EStatus["NotSent"] = "Not sent";
2947
2947
  EStatus["Accepted"] = "Accepted";
2948
2948
  })(EStatus = AccountInvite.EStatus || (AccountInvite.EStatus = {}));
2949
+ /**
2950
+ * Returns whether an invite is still awaiting a response from its recipient.
2951
+ * Expiry is held as a timestamp rather than a status, so it is checked separately.
2952
+ * @param invite
2953
+ * @returns
2954
+ */
2955
+ function IsPending(invite) {
2956
+ if (!invite || invite.IsExpired) {
2957
+ return false;
2958
+ }
2959
+ return invite.Status === EStatus.Sent || invite.Status === EStatus.NotSent;
2960
+ }
2961
+ AccountInvite.IsPending = IsPending;
2949
2962
  /**
2950
2963
  * Possible invite methods.
2951
2964
  */
@@ -2990,22 +3003,61 @@ var AccountInvite;
2990
3003
  */
2991
3004
  function GetList(params) {
2992
3005
  return __awaiter(this, void 0, void 0, function* () {
2993
- let { api, accountId, userId, req } = params;
3006
+ let { api, accountId, userId, status, expired, expandUsers, expandGroups, pageSize, pageIndex, req } = params;
2994
3007
  if (!api) {
2995
3008
  api = ENVIRONMENT.Api().GetGuardianApi();
2996
3009
  }
2997
3010
  const urlParams = new URLSearchParams();
2998
3011
  if (accountId) {
2999
- urlParams.append("accountId", accountId);
3012
+ urlParams.append("Account", accountId);
3000
3013
  }
3001
3014
  if (userId) {
3002
- urlParams.append("userId", userId);
3015
+ urlParams.append("User", userId);
3003
3016
  }
3004
- const res = yield api.GET("invites?" + urlParams.toString(), Api.PrepReqParams(req));
3005
- return res;
3017
+ if (status === null || status === void 0 ? void 0 : status.length) {
3018
+ urlParams.append("Status", status.join(","));
3019
+ }
3020
+ if (expired !== undefined && expired !== null) {
3021
+ urlParams.append("Expired", expired ? "true" : "false");
3022
+ }
3023
+ const expand = [];
3024
+ if (expandUsers) {
3025
+ expand.push("user");
3026
+ }
3027
+ if (expandGroups) {
3028
+ expand.push("group");
3029
+ }
3030
+ if (expand.length) {
3031
+ urlParams.append("Expand", expand.join(","));
3032
+ }
3033
+ if (pageSize !== undefined && pageSize !== null) {
3034
+ urlParams.append("PageSize", String(pageSize));
3035
+ }
3036
+ if (pageIndex !== undefined && pageIndex !== null) {
3037
+ urlParams.append("PageIndex", String(pageIndex));
3038
+ }
3039
+ const res = yield api.GET("v3/accountInvites?" + urlParams.toString(), Api.PrepReqParams(req));
3040
+ return {
3041
+ invites: res.Items || [],
3042
+ totalCount: res.TotalCount,
3043
+ hasNextPage: res.HasNextPage,
3044
+ userGroups: res.UserGroup
3045
+ };
3006
3046
  });
3007
3047
  }
3008
3048
  AccountInvite.GetList = GetList;
3049
+ /**
3050
+ * Returns the number of invites matching the criteria, without fetching any.
3051
+ * @param params
3052
+ * @returns
3053
+ */
3054
+ function GetCount(params) {
3055
+ return __awaiter(this, void 0, void 0, function* () {
3056
+ const res = yield GetList(Object.assign(Object.assign({}, params), { pageSize: -1, pageIndex: -1 }));
3057
+ return res.totalCount || 0;
3058
+ });
3059
+ }
3060
+ AccountInvite.GetCount = GetCount;
3009
3061
  /**
3010
3062
  * Updates an invite's status.
3011
3063
  * Once an invite is accepted or denied it cannot be changed.
@@ -3014,19 +3066,37 @@ var AccountInvite;
3014
3066
  */
3015
3067
  function Update(params) {
3016
3068
  return __awaiter(this, void 0, void 0, function* () {
3017
- let { api, code, status, user, req } = params;
3069
+ let { api, code, id, status, groupIds, user, req } = params;
3018
3070
  if (!api) {
3019
3071
  api = ENVIRONMENT.Api().GetGuardianApi();
3020
3072
  }
3021
- const res = yield api.POST("invite/update", {
3073
+ if (!code && !id) {
3074
+ throw new Error("Either an invite ID or InviteCode must be provided.");
3075
+ }
3076
+ const invite = yield api.POST("v3/accountInvite", {
3077
+ ID: id,
3022
3078
  InviteCode: code,
3023
3079
  Status: status,
3080
+ "UserGroup.ID": groupIds,
3024
3081
  User: user
3025
3082
  }, Api.PrepReqParams(req));
3026
- return res;
3083
+ return {
3084
+ invite: invite
3085
+ };
3027
3086
  });
3028
3087
  }
3029
3088
  AccountInvite.Update = Update;
3089
+ /**
3090
+ * Cancels a pending invite. Requires the session to be an account owner or admin.
3091
+ * @param params
3092
+ * @returns
3093
+ */
3094
+ function Cancel(params) {
3095
+ return __awaiter(this, void 0, void 0, function* () {
3096
+ return Update(Object.assign(Object.assign({}, params), { status: EStatus.Cancelled }));
3097
+ });
3098
+ }
3099
+ AccountInvite.Cancel = Cancel;
3030
3100
  /**
3031
3101
  * Creates a new invite.
3032
3102
  * Please validate the response invitation records to ensure the desired contact method was used and worked.
@@ -3036,13 +3106,31 @@ var AccountInvite;
3036
3106
  */
3037
3107
  function Create(params) {
3038
3108
  return __awaiter(this, void 0, void 0, function* () {
3039
- let { api, accountId, login, userId, email, mobile, emailTemplateKey, groupIds, req, inviteMethod } = params;
3109
+ let { api, accountId, login, userId, email, mobile, emailTemplateKey, groupIds, req, inviteMethod, pending } = params;
3040
3110
  if (!api) {
3041
3111
  api = ENVIRONMENT.Api().GetGuardianApi();
3042
3112
  }
3043
3113
  if (!(groupIds === null || groupIds === void 0 ? void 0 : groupIds.length)) {
3044
3114
  throw new Error("At least one User Group ID must be provided.");
3045
3115
  }
3116
+ if (pending) {
3117
+ const res = yield api.POST("v3/createAccountInvite", {
3118
+ Account: accountId,
3119
+ Username: login,
3120
+ Email: email,
3121
+ Mobile: mobile,
3122
+ "User.ID": userId,
3123
+ "UserGroup.ID": groupIds,
3124
+ "Email.Template": emailTemplateKey,
3125
+ Method: inviteMethod
3126
+ }, Api.PrepReqParams(req));
3127
+ return {
3128
+ warnings: res.Warning,
3129
+ user: res["Invited.User"],
3130
+ invite: res,
3131
+ manualInviteCode: res.InviteCode
3132
+ };
3133
+ }
3046
3134
  const res = yield api.POST("invite/new", {
3047
3135
  accountId,
3048
3136
  login,
@@ -17708,6 +17796,100 @@ var ImportLcc;
17708
17796
  ImportLcc$$1.ImportEntities = ImportEntities;
17709
17797
  })(ImportLcc || (ImportLcc = {}));
17710
17798
 
17799
+ /**
17800
+ * Analyse-then-import for GeoTIFF sources.
17801
+ */
17802
+ var ImportTif;
17803
+ (function (ImportTif$$1) {
17804
+ /**
17805
+ * A few vertical CRSs a user is likely to be choosing between. Any EPSG vertical code is
17806
+ * accepted, so this is a convenience rather than the permitted set.
17807
+ */
17808
+ let EVerticalDatum;
17809
+ (function (EVerticalDatum) {
17810
+ // Heights are already on the ellipsoid, or the source is not elevation.
17811
+ EVerticalDatum[EVerticalDatum["None"] = 0] = "None";
17812
+ EVerticalDatum[EVerticalDatum["NAVD88"] = 5703] = "NAVD88";
17813
+ EVerticalDatum[EVerticalDatum["EGM96"] = 5773] = "EGM96";
17814
+ EVerticalDatum[EVerticalDatum["EGM2008"] = 3855] = "EGM2008";
17815
+ EVerticalDatum[EVerticalDatum["NZVD2016"] = 7839] = "NZVD2016";
17816
+ })(EVerticalDatum = ImportTif$$1.EVerticalDatum || (ImportTif$$1.EVerticalDatum = {}));
17817
+ /**
17818
+ * Reads an analysis out of a completed Pending Action.
17819
+ * @param action the completed analyze action
17820
+ * @returns the result, or null when the action carries none
17821
+ */
17822
+ function ReadAnalysis(action) {
17823
+ if (!(action === null || action === void 0 ? void 0 : action.Result)) {
17824
+ return null;
17825
+ }
17826
+ try {
17827
+ const parsed = typeof action.Result === "string" ? JSON.parse(action.Result) : action.Result;
17828
+ // A successful action wraps its answer; older ones returned it bare.
17829
+ const result = (parsed === null || parsed === void 0 ? void 0 : parsed.success) && (parsed === null || parsed === void 0 ? void 0 : parsed.result) ? parsed.result : parsed;
17830
+ return result && typeof result === "object" ? result : null;
17831
+ }
17832
+ catch (_a) {
17833
+ return null;
17834
+ }
17835
+ }
17836
+ ImportTif$$1.ReadAnalysis = ReadAnalysis;
17837
+ /**
17838
+ * Whether the user has to be asked what the heights are referenced to.
17839
+ * @param analysis the analysis result
17840
+ * @returns true for elevation that declares no vertical CRS
17841
+ */
17842
+ function NeedsVerticalDatum(analysis) {
17843
+ if (!analysis) {
17844
+ return false;
17845
+ }
17846
+ return (analysis.type === Tileset.EType.Terrain) && (analysis.verticalDeclared !== true);
17847
+ }
17848
+ ImportTif$$1.NeedsVerticalDatum = NeedsVerticalDatum;
17849
+ /**
17850
+ * Whether the user has to be asked which CRS the source is in.
17851
+ * @param analysis the analysis result
17852
+ * @returns true when no horizontal CRS could be resolved at all
17853
+ */
17854
+ function NeedsHorizontalCrs(analysis) {
17855
+ if (!analysis) {
17856
+ return false;
17857
+ }
17858
+ return !(analysis.epsg && analysis.epsg > 0);
17859
+ }
17860
+ ImportTif$$1.NeedsHorizontalCrs = NeedsHorizontalCrs;
17861
+ /**
17862
+ * Starts an analysis of an uploaded raster.
17863
+ * @param params
17864
+ * @returns the Pending Action to poll
17865
+ */
17866
+ function Analyze(params) {
17867
+ return __awaiter(this, void 0, void 0, function* () {
17868
+ let { api, analyze, req: reqParams } = params;
17869
+ if (!api) {
17870
+ api = ENVIRONMENT.Api().GetBruceApi();
17871
+ }
17872
+ return api.POST("import/analyze/tif", analyze, Api.PrepReqParams(reqParams));
17873
+ });
17874
+ }
17875
+ ImportTif$$1.Analyze = Analyze;
17876
+ /**
17877
+ * Imports an analysed raster: the API creates the tileset and starts generating it.
17878
+ * @param params
17879
+ * @returns the created tileset and the Pending Action to poll
17880
+ */
17881
+ function Import(params) {
17882
+ return __awaiter(this, void 0, void 0, function* () {
17883
+ let { api, fileImport, req: reqParams } = params;
17884
+ if (!api) {
17885
+ api = ENVIRONMENT.Api().GetBruceApi();
17886
+ }
17887
+ return api.POST("import/tif", fileImport, Api.PrepReqParams(reqParams));
17888
+ });
17889
+ }
17890
+ ImportTif$$1.Import = Import;
17891
+ })(ImportTif || (ImportTif = {}));
17892
+
17711
17893
  /**
17712
17894
  * Imported file records are created when a file is imported into Nextspace.
17713
17895
  * The associated file may be attached to the record.
@@ -18991,7 +19173,13 @@ var Plugin;
18991
19173
 
18992
19174
  window["${resultId}"] = Invoke(window["${argsId}"], window["${contextId}"]);
18993
19175
  }
18994
- invoke();
19176
+ // Called with a receiver, not bare. The API builds index.jsc by
19177
+ // wrapping the plugin's index.js in a controller shell that
19178
+ // assigns 'this.Init = ...', and under "use strict" a bare call
19179
+ // leaves 'this' undefined, so every plugin would die on that
19180
+ // line before its own code ran. A throwaway object satisfies
19181
+ // the shell without giving the plugin the global scope back.
19182
+ invoke.call({});
18995
19183
  `;
18996
19184
  try {
18997
19185
  // 'eval2 = eval' stops the linter from complaining about using eval.
@@ -19071,6 +19259,24 @@ var PluginAiTool;
19071
19259
  * and nothing downstream reports that it happened.
19072
19260
  */
19073
19261
  const STRICT_INCOMPATIBLE_KEYWORDS = ["$ref", "$defs", "allOf", "not"];
19262
+ /** Depth beyond which a schema is refused as unverifiable rather than assumed clean. */
19263
+ const MAX_SCHEMA_DEPTH = 32;
19264
+ /**
19265
+ * Keys whose values are author-named property maps rather than schemas.
19266
+ *
19267
+ * Everything under them is a name the author chose, so a property legitimately
19268
+ * called "not" or "allOf" is not a keyword and must not be matched as one.
19269
+ */
19270
+ const PROPERTY_NAME_HOLDERS = ["properties", "patternProperties", "definitions", "dependentSchemas"];
19271
+ /**
19272
+ * Shortest timeout the host can actually apply.
19273
+ *
19274
+ * It converts the declared value to seconds by integer division, so anything
19275
+ * below this truncates to zero.
19276
+ */
19277
+ const MIN_TIMEOUT_MS = 1000;
19278
+ /** Longest timeout an account may declare. */
19279
+ const MAX_TIMEOUT_MS = 120000;
19074
19280
  /**
19075
19281
  * Side effects an AI Tool may declare.
19076
19282
  *
@@ -19086,9 +19292,14 @@ var PluginAiTool;
19086
19292
  * @returns the offending keyword, or null
19087
19293
  */
19088
19294
  function findStrictModeViolation(node, depth = 0) {
19089
- if (!node || typeof node !== "object" || depth > 32) {
19295
+ if (!node || typeof node !== "object") {
19090
19296
  return null;
19091
19297
  }
19298
+ if (depth > MAX_SCHEMA_DEPTH) {
19299
+ // Returning "clean" here would let a $ref nested past the cap through
19300
+ // as verified, which is the exact thing this walk exists to catch.
19301
+ return `a schema nested deeper than ${MAX_SCHEMA_DEPTH} levels, which cannot be checked`;
19302
+ }
19092
19303
  if (Array.isArray(node)) {
19093
19304
  for (const child of node) {
19094
19305
  const nested = findStrictModeViolation(child, depth + 1);
@@ -19098,11 +19309,28 @@ var PluginAiTool;
19098
19309
  }
19099
19310
  return null;
19100
19311
  }
19312
+ // A keyword only counts at a schema position. Under "properties" and
19313
+ // friends the field names are chosen by the author, so a property
19314
+ // legitimately called "not" or "allOf" is a name, not a keyword.
19101
19315
  for (const key of Object.keys(node)) {
19102
19316
  if (STRICT_INCOMPATIBLE_KEYWORDS.includes(key)) {
19103
19317
  return key;
19104
19318
  }
19105
- const nested = findStrictModeViolation(node[key], depth + 1);
19319
+ }
19320
+ for (const key of Object.keys(node)) {
19321
+ const child = node[key];
19322
+ if (PROPERTY_NAME_HOLDERS.includes(key)) {
19323
+ if (child && typeof child === "object" && !Array.isArray(child)) {
19324
+ for (const name of Object.keys(child)) {
19325
+ const nested = findStrictModeViolation(child[name], depth + 2);
19326
+ if (nested) {
19327
+ return nested;
19328
+ }
19329
+ }
19330
+ }
19331
+ continue;
19332
+ }
19333
+ const nested = findStrictModeViolation(child, depth + 1);
19106
19334
  if (nested) {
19107
19335
  return nested;
19108
19336
  }
@@ -19142,9 +19370,14 @@ var PluginAiTool;
19142
19370
  // tool does. The description is the only thing the agent can select on:
19143
19371
  // without one it is registered but never chosen, and nothing reports that.
19144
19372
  const description = typeof tool.description === "string" ? tool.description.trim() : "";
19145
- if (!description && !((_c = plugin.Name) !== null && _c !== void 0 ? _c : "").trim()) {
19146
- return "An AI Tool needs a description. Set Settings.tool.description, or fill in the plugin's "
19147
- + "Name and Description the agent has nothing else to choose the tool on.";
19373
+ // The fallback is "Name: Description", so a plugin with only a Name yields
19374
+ // a description of a few words. That satisfied the old check while leaving
19375
+ // the agent almost nothing to select on -- and since Save is disabled while
19376
+ // Name is empty, the old check could never fire at all.
19377
+ if (!description && !((_c = plugin.Description) !== null && _c !== void 0 ? _c : "").trim()) {
19378
+ return "An AI Tool needs a description saying what it does and when to use it. Set "
19379
+ + "Settings.tool.description, or fill in the plugin's Description — the tool name is "
19380
+ + "an opaque ID, so this is the only thing the agent can choose it on.";
19148
19381
  }
19149
19382
  if (!isPlainObject(tool.inputSchema)) {
19150
19383
  return "Settings.tool.inputSchema is missing or is not an object.";
@@ -19169,6 +19402,21 @@ var PluginAiTool;
19169
19402
  }
19170
19403
  }
19171
19404
  if (annotations.timeoutMs !== undefined) {
19405
+ if (typeof annotations.timeoutMs === "number"
19406
+ && isFinite(annotations.timeoutMs)
19407
+ && annotations.timeoutMs > 0
19408
+ && annotations.timeoutMs < MIN_TIMEOUT_MS) {
19409
+ // The host converts this to seconds by integer division, so
19410
+ // anything under a second becomes no wait at all -- the opposite
19411
+ // of a short timeout, and the tool then fails on every call.
19412
+ return `timeoutMs is ${annotations.timeoutMs}ms, but the shortest timeout the host can `
19413
+ + `apply is ${MIN_TIMEOUT_MS}ms. A smaller value would be rounded down to no wait at all.`;
19414
+ }
19415
+ if (typeof annotations.timeoutMs === "number"
19416
+ && isFinite(annotations.timeoutMs)
19417
+ && annotations.timeoutMs > MAX_TIMEOUT_MS) {
19418
+ return `timeoutMs is ${annotations.timeoutMs}ms, above the maximum of ${MAX_TIMEOUT_MS}ms.`;
19419
+ }
19172
19420
  if (typeof annotations.timeoutMs !== "number"
19173
19421
  || !isFinite(annotations.timeoutMs)
19174
19422
  || annotations.timeoutMs <= 0) {
@@ -23268,7 +23516,7 @@ var UrlUtils;
23268
23516
  })(UrlUtils || (UrlUtils = {}));
23269
23517
 
23270
23518
  // This is updated with the package.json version on build.
23271
- const VERSION = "7.1.90";
23519
+ const VERSION = "7.1.92";
23272
23520
 
23273
- 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, 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 };
23521
+ 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 };
23274
23522
  //# sourceMappingURL=bruce-models.es5.js.map