bruce-models 7.1.99 → 7.1.100

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.
@@ -1042,7 +1042,7 @@
1042
1042
  else if (encoding === "iso-8859-1") {
1043
1043
  encoding = "utf-8";
1044
1044
  }
1045
- if (type == "application/octet-stream" || type == "model/gltf-binary") {
1045
+ if (type == "application/octet-stream" || type == "model/gltf-binary" || type == "application/nsx") {
1046
1046
  if (encoding !== "utf-8") {
1047
1047
  console.warn("Binary data is being returned with an unexpected encoding:", encoding);
1048
1048
  }
@@ -17350,14 +17350,101 @@
17350
17350
  */
17351
17351
  function AccountBackup(params) {
17352
17352
  return __awaiter(this, void 0, void 0, function* () {
17353
- let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
17353
+ let { api, backup, req: reqParams } = params !== null && params !== void 0 ? params : {};
17354
17354
  if (!api) {
17355
17355
  api = exports.ENVIRONMENT.Api().GetBruceApi();
17356
17356
  }
17357
- return api.POST("export/nsx/accountBackup", {}, exports.Api.PrepReqParams(reqParams));
17357
+ return api.POST("export/nsx/accountBackup", backup !== null && backup !== void 0 ? backup : {}, exports.Api.PrepReqParams(reqParams));
17358
17358
  });
17359
17359
  }
17360
17360
  ExportNsx.AccountBackup = AccountBackup;
17361
+ /**
17362
+ * Returns available account backup files, including whole-account NSX backups.
17363
+ */
17364
+ function GetAccountBackupList(params) {
17365
+ return __awaiter(this, void 0, void 0, function* () {
17366
+ let { api, req: reqParams } = params !== null && params !== void 0 ? params : {};
17367
+ if (!api) {
17368
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
17369
+ }
17370
+ return api.GET("account/restoreList", exports.Api.PrepReqParams(reqParams));
17371
+ });
17372
+ }
17373
+ ExportNsx.GetAccountBackupList = GetAccountBackupList;
17374
+ /**
17375
+ * Downloads a saved whole-account NSX backup file.
17376
+ */
17377
+ function DownloadAccountBackup(params) {
17378
+ return __awaiter(this, void 0, void 0, function* () {
17379
+ let { api, fileName, req: reqParams } = params;
17380
+ if (!fileName) {
17381
+ throw ("fileName is required.");
17382
+ }
17383
+ if (!api) {
17384
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
17385
+ }
17386
+ return api.GET(`account/backup/nsx/${encodeURIComponent(fileName)}`, exports.Api.PrepReqParams(reqParams));
17387
+ });
17388
+ }
17389
+ ExportNsx.DownloadAccountBackup = DownloadAccountBackup;
17390
+ /**
17391
+ * Deletes a saved whole-account NSX backup file.
17392
+ */
17393
+ function DeleteAccountBackup(params) {
17394
+ return __awaiter(this, void 0, void 0, function* () {
17395
+ let { api, fileName, req: reqParams } = params;
17396
+ if (!fileName) {
17397
+ throw ("fileName is required.");
17398
+ }
17399
+ if (!api) {
17400
+ api = exports.ENVIRONMENT.Api().GetBruceApi();
17401
+ }
17402
+ return api.DELETE(`account/backup/nsx/${encodeURIComponent(fileName)}`, exports.Api.PrepReqParams(reqParams));
17403
+ });
17404
+ }
17405
+ ExportNsx.DeleteAccountBackup = DeleteAccountBackup;
17406
+ /**
17407
+ * Parses the completed Pending Action result from running AccountBackup.
17408
+ */
17409
+ function ParseAccountBackupResult(paResult) {
17410
+ var _a, _b, _c, _d, _e, _f, _g, _h;
17411
+ const parsed = parseObject(paResult);
17412
+ if (!parsed) {
17413
+ return {
17414
+ raw: null
17415
+ };
17416
+ }
17417
+ const resultSource = (parsed === null || parsed === void 0 ? void 0 : parsed.Result) != null ? parsed.Result : parsed;
17418
+ const rawResult = (_a = parseObject(resultSource)) !== null && _a !== void 0 ? _a : (typeof resultSource == "object" ? resultSource : null);
17419
+ const report = rawResult === null || rawResult === void 0 ? void 0 : rawResult.Report;
17420
+ return {
17421
+ 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"],
17422
+ 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"],
17423
+ 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,
17424
+ 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,
17425
+ 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"],
17426
+ 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"],
17427
+ 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,
17428
+ report: report,
17429
+ stats: rawResult === null || rawResult === void 0 ? void 0 : rawResult.Stats,
17430
+ raw: rawResult
17431
+ };
17432
+ }
17433
+ ExportNsx.ParseAccountBackupResult = ParseAccountBackupResult;
17434
+ function parseObject(data) {
17435
+ if (data == null || data == undefined) {
17436
+ return null;
17437
+ }
17438
+ if (typeof data == "string") {
17439
+ try {
17440
+ return JSON.parse(data);
17441
+ }
17442
+ catch (_a) {
17443
+ return null;
17444
+ }
17445
+ }
17446
+ return data;
17447
+ }
17361
17448
  })(exports.ExportNsx || (exports.ExportNsx = {}));
17362
17449
 
17363
17450
  (function (ExportUsd) {
@@ -21578,6 +21665,13 @@
21578
21665
  EStatus["Complete"] = "COMPLETE";
21579
21666
  EStatus["Failed"] = "FAILED";
21580
21667
  })(EStatus = PendingAction.EStatus || (PendingAction.EStatus = {}));
21668
+ /**
21669
+ * Available server-side Pending Action result encodings.
21670
+ */
21671
+ let EResultFormat;
21672
+ (function (EResultFormat) {
21673
+ EResultFormat["JSON"] = "JSON";
21674
+ })(EResultFormat = PendingAction.EResultFormat || (PendingAction.EResultFormat = {}));
21581
21675
  /**
21582
21676
  * Available message types.
21583
21677
  */
@@ -21595,14 +21689,20 @@
21595
21689
  */
21596
21690
  function Get(params) {
21597
21691
  return __awaiter(this, void 0, void 0, function* () {
21598
- let { api, actionId, req: reqParams } = params;
21692
+ let { api, actionId, result, req: reqParams } = params;
21599
21693
  if (!actionId) {
21600
21694
  throw ("Action ID is required.");
21601
21695
  }
21602
21696
  if (!api) {
21603
21697
  api = exports.ENVIRONMENT.Api().GetBruceApi();
21604
21698
  }
21605
- const data = yield api.GET(`pendingAction/${actionId}`, exports.Api.PrepReqParams(reqParams));
21699
+ let url = `pendingAction/${actionId}`;
21700
+ if (result) {
21701
+ const urlParams = new URLSearchParams();
21702
+ urlParams.append("Result", result);
21703
+ url += `?${urlParams.toString()}`;
21704
+ }
21705
+ const data = yield api.GET(url, exports.Api.PrepReqParams(reqParams));
21606
21706
  return {
21607
21707
  action: data
21608
21708
  };
@@ -21749,7 +21849,7 @@
21749
21849
  */
21750
21850
  function OnCompletion(params) {
21751
21851
  return __awaiter(this, void 0, void 0, function* () {
21752
- let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage } = params;
21852
+ let { api, actionId, req: reqParams, interval: intMs, isDisposed, onMessage, result } = params;
21753
21853
  if (!actionId) {
21754
21854
  throw ("Action ID is required.");
21755
21855
  }
@@ -21802,6 +21902,7 @@
21802
21902
  const { action } = yield Get({
21803
21903
  api,
21804
21904
  actionId,
21905
+ result,
21805
21906
  req: reqParams
21806
21907
  });
21807
21908
  if (action.Status !== EStatus.InProgress) {
@@ -23584,7 +23685,7 @@
23584
23685
  }
23585
23686
 
23586
23687
  // This is updated with the package.json version on build.
23587
- const VERSION = "7.1.99";
23688
+ const VERSION = "7.1.100";
23588
23689
 
23589
23690
  exports.VERSION = VERSION;
23590
23691
  exports.AbstractApi = AbstractApi;