bruce-models 7.1.99 → 7.1.101

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.
@@ -364,6 +364,10 @@
364
364
  EConcept["UI_SLIDE"] = "pvs";
365
365
  EConcept["UI_SLIDE_GROUP"] = "sg";
366
366
  EConcept["UI_TABLE_VIEW"] = "tv";
367
+ EConcept["WORKFLOW_ITEM"] = "wi";
368
+ EConcept["WORKFLOW_ITEM_STATUS"] = "wis";
369
+ EConcept["WORKFLOW_ITEM_TYPE"] = "wit";
370
+ EConcept["WORKFLOW_QUEUE"] = "wq";
367
371
  })(EConcept = AccountConcept.EConcept || (AccountConcept.EConcept = {}));
368
372
  let EAction;
369
373
  (function (EAction) {
@@ -579,14 +583,17 @@
579
583
  };
580
584
  };
581
585
  /**
582
- * Returns true if the given Entity internal ID falls within the reported range string.
586
+ * Returns true if the given internal ID falls within the reported range string.
587
+ *
588
+ * Every concept whose records carry a numeric identity reports them this way, as runs rather than
589
+ * as one ID per record, so that a change touching thousands of rows is still a short message.
583
590
  *
584
591
  * @example
585
- * isEntityInternalIdInRangeString("100-200,305,400-450", 150) // true
586
- * isEntityInternalIdInRangeString("100-200,305,400-450", 301) // false
592
+ * isInternalIdInRangeString("100-200,305,400-450", 150) // true
593
+ * isInternalIdInRangeString("100-200,305,400-450", 301) // false
587
594
  */
588
- RecordChangeFeed.isEntityInternalIdInRangeString = (rangeString, entityInternalId) => {
589
- if (!rangeString || !Number.isInteger(entityInternalId)) {
595
+ RecordChangeFeed.isInternalIdInRangeString = (rangeString, internalId) => {
596
+ if (!rangeString || !Number.isInteger(internalId)) {
590
597
  return false;
591
598
  }
592
599
  for (const part of rangeString.split(",")) {
@@ -602,12 +609,20 @@
602
609
  }
603
610
  const min = Math.min(start, end);
604
611
  const max = Math.max(start, end);
605
- if (entityInternalId >= min && entityInternalId <= max) {
612
+ if (internalId >= min && internalId <= max) {
606
613
  return true;
607
614
  }
608
615
  }
609
616
  return false;
610
617
  };
618
+ /**
619
+ * Returns true if the given Entity internal ID falls within the reported range string.
620
+ *
621
+ * The Entity-named form of {@link isInternalIdInRangeString}, kept because it is what the Entity
622
+ * callers already read as. Ranges are not an Entity idea: a Workflow Item reports its own IDs the
623
+ * same way.
624
+ */
625
+ RecordChangeFeed.isEntityInternalIdInRangeString = (rangeString, entityInternalId) => RecordChangeFeed.isInternalIdInRangeString(rangeString, entityInternalId);
611
626
  /**
612
627
  * Returns true if the given record ID appears in a comma-separated list string.
613
628
  *
@@ -815,8 +830,23 @@
815
830
  }
816
831
  const isEntityConcept = event.concept === ENTITY_CONCEPT;
817
832
  if (!isEntityConcept && params.recordId !== undefined) {
818
- const list = typeof event.data === "string" ? event.data : "";
819
- if (!RecordChangeFeed.isRecordIdInListString(list, params.recordId)) {
833
+ const data = typeof event.data === "string" ? event.data : "";
834
+ const numericId = Number(params.recordId);
835
+ const isNumericIdentity = Number.isInteger(numericId)
836
+ && String(params.recordId).trim() === String(numericId);
837
+ /*
838
+ * A NUMERIC identity is reported as runs, so it is matched against the runs: a Workflow
839
+ * Item asking about ID 7 has to see itself in "5-9" and not only in a list that spells
840
+ * out every ID. Matching runs still finds a plain numeric ID, since one ID is a run of
841
+ * one, so this is what every numeric concept wants.
842
+ *
843
+ * A STRING identity (a Bookmark, a Project View) has no runs to fall inside and arrives
844
+ * as a plain list, which is matched as one.
845
+ */
846
+ const matched = isNumericIdentity
847
+ ? RecordChangeFeed.isInternalIdInRangeString(data, numericId)
848
+ : RecordChangeFeed.isRecordIdInListString(data, params.recordId);
849
+ if (!matched) {
820
850
  return false;
821
851
  }
822
852
  }
@@ -1042,7 +1072,7 @@
1042
1072
  else if (encoding === "iso-8859-1") {
1043
1073
  encoding = "utf-8";
1044
1074
  }
1045
- if (type == "application/octet-stream" || type == "model/gltf-binary") {
1075
+ if (type == "application/octet-stream" || type == "model/gltf-binary" || type == "application/nsx") {
1046
1076
  if (encoding !== "utf-8") {
1047
1077
  console.warn("Binary data is being returned with an unexpected encoding:", encoding);
1048
1078
  }
@@ -17350,14 +17380,101 @@
17350
17380
  */
17351
17381
  function AccountBackup(params) {
17352
17382
  return __awaiter(this, void 0, void 0, function* () {
17353
- let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
17383
+ let { api, backup, req: reqParams } = params !== null && params !== void 0 ? params : {};
17354
17384
  if (!api) {
17355
17385
  api = exports.ENVIRONMENT.Api().GetBruceApi();
17356
17386
  }
17357
- return api.POST("export/nsx/accountBackup", {}, exports.Api.PrepReqParams(reqParams));
17387
+ return api.POST("export/nsx/accountBackup", backup !== null && backup !== void 0 ? backup : {}, exports.Api.PrepReqParams(reqParams));
17358
17388
  });
17359
17389
  }
17360
17390
  ExportNsx.AccountBackup = AccountBackup;
17391
+ /**
17392
+ * Returns available account backup files, including whole-account NSX backups.
17393
+ */
17394
+ function GetAccountBackupList(params) {
17395
+ return __awaiter(this, void 0, void 0, function* () {
17396
+ let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
17397
+ if (!api) {
17398
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
17399
+ }
17400
+ return api.GET("account/restoreList", exports.Api.PrepReqParams(reqParams));
17401
+ });
17402
+ }
17403
+ ExportNsx.GetAccountBackupList = GetAccountBackupList;
17404
+ /**
17405
+ * Downloads a saved whole-account NSX backup file.
17406
+ */
17407
+ function DownloadAccountBackup(params) {
17408
+ return __awaiter(this, void 0, void 0, function* () {
17409
+ let { api, fileName, req: reqParams } = params;
17410
+ if (!fileName) {
17411
+ throw ("fileName is required.");
17412
+ }
17413
+ if (!api) {
17414
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
17415
+ }
17416
+ return api.GET(`account/backup/nsx/${encodeURIComponent(fileName)}`, exports.Api.PrepReqParams(reqParams));
17417
+ });
17418
+ }
17419
+ ExportNsx.DownloadAccountBackup = DownloadAccountBackup;
17420
+ /**
17421
+ * Deletes a saved whole-account NSX backup file.
17422
+ */
17423
+ function DeleteAccountBackup(params) {
17424
+ return __awaiter(this, void 0, void 0, function* () {
17425
+ let { api, fileName, req: reqParams } = params;
17426
+ if (!fileName) {
17427
+ throw ("fileName is required.");
17428
+ }
17429
+ if (!api) {
17430
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
17431
+ }
17432
+ return api.DELETE(`account/backup/nsx/${encodeURIComponent(fileName)}`, exports.Api.PrepReqParams(reqParams));
17433
+ });
17434
+ }
17435
+ ExportNsx.DeleteAccountBackup = DeleteAccountBackup;
17436
+ /**
17437
+ * Parses the completed Pending Action result from running AccountBackup.
17438
+ */
17439
+ function ParseAccountBackupResult(paResult) {
17440
+ var _a, _b, _c, _d, _e, _f, _g, _h;
17441
+ const parsed = parseObject(paResult);
17442
+ if (!parsed) {
17443
+ return {
17444
+ raw: null
17445
+ };
17446
+ }
17447
+ const resultSource = (parsed === null || parsed === void 0 ? void 0 : parsed.Result) != null ? parsed.Result : parsed;
17448
+ const rawResult = (_a = parseObject(resultSource)) !== null && _a !== void 0 ? _a : (typeof resultSource == "object" ? resultSource : null);
17449
+ const report = rawResult === null || rawResult === void 0 ? void 0 : rawResult.Report;
17450
+ return {
17451
+ accountId: (_b = rawResult === null || rawResult === void 0 ? void 0 : rawResult["Account.ID"]) !== null && _b !== void 0 ? _b : report === null || report === void 0 ? void 0 : report["Account.ID"],
17452
+ createdUtc: (_c = rawResult === null || rawResult === void 0 ? void 0 : rawResult["Created.UTC"]) !== null && _c !== void 0 ? _c : report === null || report === void 0 ? void 0 : report["Created.UTC"],
17453
+ fileName: (_d = rawResult === null || rawResult === void 0 ? void 0 : rawResult.FileName) !== null && _d !== void 0 ? _d : report === null || report === void 0 ? void 0 : report.FileName,
17454
+ storePath: (_e = rawResult === null || rawResult === void 0 ? void 0 : rawResult.StorePath) !== null && _e !== void 0 ? _e : report === null || report === void 0 ? void 0 : report.StorePath,
17455
+ sizeBytes: (_f = rawResult === null || rawResult === void 0 ? void 0 : rawResult["Size.Bytes"]) !== null && _f !== void 0 ? _f : report === null || report === void 0 ? void 0 : report["Size.Bytes"],
17456
+ downloadUrl: (_g = rawResult === null || rawResult === void 0 ? void 0 : rawResult["Download.URL"]) !== null && _g !== void 0 ? _g : report === null || report === void 0 ? void 0 : report["Download.URL"],
17457
+ message: (_h = rawResult === null || rawResult === void 0 ? void 0 : rawResult.Message) !== null && _h !== void 0 ? _h : report === null || report === void 0 ? void 0 : report.Message,
17458
+ report: report,
17459
+ stats: rawResult === null || rawResult === void 0 ? void 0 : rawResult.Stats,
17460
+ raw: rawResult
17461
+ };
17462
+ }
17463
+ ExportNsx.ParseAccountBackupResult = ParseAccountBackupResult;
17464
+ function parseObject(data) {
17465
+ if (data == null || data == undefined) {
17466
+ return null;
17467
+ }
17468
+ if (typeof data == "string") {
17469
+ try {
17470
+ return JSON.parse(data);
17471
+ }
17472
+ catch (_a) {
17473
+ return null;
17474
+ }
17475
+ }
17476
+ return data;
17477
+ }
17361
17478
  })(exports.ExportNsx || (exports.ExportNsx = {}));
17362
17479
 
17363
17480
  (function (ExportUsd) {
@@ -21578,6 +21695,13 @@
21578
21695
  EStatus["Complete"] = "COMPLETE";
21579
21696
  EStatus["Failed"] = "FAILED";
21580
21697
  })(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
21698
+ /**
21699
+ * Available server-side Pending Action result encodings.
21700
+ */
21701
+ let EResultFormat;
21702
+ (function (EResultFormat) {
21703
+ EResultFormat["JSON"] = "JSON";
21704
+ })(EResultFormat = PendingAction.EResultFormat || (PendingAction.EResultFormat = {}));
21581
21705
  /**
21582
21706
  * Available message types.
21583
21707
  */
@@ -21595,14 +21719,20 @@
21595
21719
  */
21596
21720
  function Get(params) {
21597
21721
  return __awaiter(this, void 0, void 0, function* () {
21598
- let { api, actionId, req: reqParams } = params;
21722
+ let { api, actionId, result, req: reqParams } = params;
21599
21723
  if (!actionId) {
21600
21724
  throw ("Action ID is required.");
21601
21725
  }
21602
21726
  if (!api) {
21603
21727
  api = exports.ENVIRONMENT.Api().GetBruceApi();
21604
21728
  }
21605
- const data = yield api.GET(`pendingAction/${actionId}`, exports.Api.PrepReqParams(reqParams));
21729
+ let url = `pendingAction/${actionId}`;
21730
+ if (result) {
21731
+ const urlParams = new URLSearchParams();
21732
+ urlParams.append("Result", result);
21733
+ url += `?${urlParams.toString()}`;
21734
+ }
21735
+ const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
21606
21736
  return {
21607
21737
  action: data
21608
21738
  };
@@ -21749,7 +21879,7 @@
21749
21879
  */
21750
21880
  function OnCompletion(params) {
21751
21881
  return __awaiter(this, void 0, void 0, function* () {
21752
- let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage } = params;
21882
+ let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage, result } = params;
21753
21883
  if (!actionId) {
21754
21884
  throw ("Action ID is required.");
21755
21885
  }
@@ -21802,6 +21932,7 @@
21802
21932
  const { action } = yield Get({
21803
21933
  api,
21804
21934
  actionId,
21935
+ result,
21805
21936
  req: reqParams
21806
21937
  });
21807
21938
  if (action.Status !== EStatus.InProgress) {
@@ -23584,7 +23715,7 @@
23584
23715
  }
23585
23716
 
23586
23717
  // This is updated with the package.json version on build.
23587
- const VERSION = "7.1.99";
23718
+ const VERSION = "7.1.101";
23588
23719
 
23589
23720
  exports.VERSION = VERSION;
23590
23721
  exports.AbstractApi = AbstractApi;