bruce-models 0.7.8 → 0.8.0

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.
Files changed (92) hide show
  1. package/dist/bruce-models.es5.js +167 -8
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +165 -7
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account.js +244 -244
  6. package/dist/lib/ann-document/ann-document.js +116 -116
  7. package/dist/lib/api/abstract-api.js +269 -269
  8. package/dist/lib/api/api.js +85 -85
  9. package/dist/lib/api/bruce-api.js +243 -228
  10. package/dist/lib/api/bruce-api.js.map +1 -1
  11. package/dist/lib/api/cam-api.js +132 -132
  12. package/dist/lib/api/global-api.js +131 -131
  13. package/dist/lib/api/idm-api.js +132 -132
  14. package/dist/lib/bruce-models.js +85 -84
  15. package/dist/lib/bruce-models.js.map +1 -1
  16. package/dist/lib/calculator/calculator.js +159 -158
  17. package/dist/lib/calculator/calculator.js.map +1 -1
  18. package/dist/lib/client-file/client-file.js +188 -188
  19. package/dist/lib/common/bounds.js +2 -2
  20. package/dist/lib/common/bruce-event.js +48 -48
  21. package/dist/lib/common/bruce-variable.js +54 -54
  22. package/dist/lib/common/cache.js +86 -86
  23. package/dist/lib/common/camera.js +11 -11
  24. package/dist/lib/common/cartes.js +55 -55
  25. package/dist/lib/common/carto.js +60 -60
  26. package/dist/lib/common/color.js +86 -86
  27. package/dist/lib/common/delay-queue.js +60 -60
  28. package/dist/lib/common/dictionary.js +2 -2
  29. package/dist/lib/common/geometry.js +120 -120
  30. package/dist/lib/common/transform.js +2 -2
  31. package/dist/lib/common/utc.js +39 -39
  32. package/dist/lib/custom-form/custom-form.js +136 -136
  33. package/dist/lib/data-lab/data-lab.js +90 -90
  34. package/dist/lib/entity/entity-attachment-type.js +132 -132
  35. package/dist/lib/entity/entity-attachment.js +208 -208
  36. package/dist/lib/entity/entity-comment.js +132 -132
  37. package/dist/lib/entity/entity-coords.js +181 -181
  38. package/dist/lib/entity/entity-link.js +132 -132
  39. package/dist/lib/entity/entity-lod.js +189 -189
  40. package/dist/lib/entity/entity-relation-type.js +150 -150
  41. package/dist/lib/entity/entity-relation.js +189 -189
  42. package/dist/lib/entity/entity-source.js +176 -176
  43. package/dist/lib/entity/entity-tag.js +229 -229
  44. package/dist/lib/entity/entity-type.js +163 -163
  45. package/dist/lib/entity/entity.js +358 -358
  46. package/dist/lib/entity/getters/batched-data-getter.js +91 -91
  47. package/dist/lib/entity/getters/entity-filter-getter.js +344 -344
  48. package/dist/lib/entity/getters/entity-globe.js +135 -135
  49. package/dist/lib/entity/getters/view-monitor.js +2 -2
  50. package/dist/lib/import/import-cad.js +82 -82
  51. package/dist/lib/import/import-csv.js +51 -51
  52. package/dist/lib/import/import-json.js +51 -51
  53. package/dist/lib/import/import-kml.js +51 -51
  54. package/dist/lib/import/imported-file.js +121 -121
  55. package/dist/lib/import/imported-file.js.map +1 -1
  56. package/dist/lib/markup/markup.js +40 -40
  57. package/dist/lib/program-key/program-key.js +152 -152
  58. package/dist/lib/project/menu-item.js +115 -115
  59. package/dist/lib/project/project-view-bookmark.js +183 -183
  60. package/dist/lib/project/project-view-legacy-tile.js +115 -115
  61. package/dist/lib/project/project-view-tile.js +119 -119
  62. package/dist/lib/project/project-view-tile.js.map +1 -1
  63. package/dist/lib/project/project-view.js +177 -177
  64. package/dist/lib/project/zoom-control.js +17 -17
  65. package/dist/lib/server/message-broker.js +159 -0
  66. package/dist/lib/server/message-broker.js.map +1 -0
  67. package/dist/lib/server/pending-action.js +106 -106
  68. package/dist/lib/server/task.js +113 -113
  69. package/dist/lib/style/style.js +152 -152
  70. package/dist/lib/tileset/tileset-cad.js +2 -2
  71. package/dist/lib/tileset/tileset-entities-map-tiles.js +18 -18
  72. package/dist/lib/tileset/tileset-entities.js +2 -2
  73. package/dist/lib/tileset/tileset-ext-map-tiles.js +17 -17
  74. package/dist/lib/tileset/tileset-ext-terrain-tiles.js +2 -2
  75. package/dist/lib/tileset/tileset-map-tiles.js +2 -2
  76. package/dist/lib/tileset/tileset-pointcloud.js +2 -2
  77. package/dist/lib/tileset/tileset-terrain-tiles.js +2 -2
  78. package/dist/lib/tileset/tileset.js +403 -403
  79. package/dist/lib/user/permission.js +20 -20
  80. package/dist/lib/user/session.js +160 -160
  81. package/dist/lib/user/user-group.js +139 -139
  82. package/dist/lib/user/user.js +451 -451
  83. package/dist/lib/util/encrypt-utils.js +20 -20
  84. package/dist/lib/util/math-utils.js +41 -41
  85. package/dist/lib/util/object-utils.js +17 -17
  86. package/dist/lib/util/path-utils.js +61 -61
  87. package/dist/lib/util/url-utils.js +107 -107
  88. package/dist/types/api/bruce-api.d.ts +9 -1
  89. package/dist/types/bruce-models.d.ts +1 -0
  90. package/dist/types/project/project-view-tile.d.ts +2 -6
  91. package/dist/types/server/message-broker.d.ts +108 -0
  92. package/package.json +1 -1
@@ -1,133 +1,133 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- };
24
- var __generator = (this && this.__generator) || function (thisArg, body) {
25
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
- function verb(n) { return function (v) { return step([n, v]); }; }
28
- function step(op) {
29
- if (f) throw new TypeError("Generator is already executing.");
30
- while (_) try {
31
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
- if (y = 0, t) op = [op[0] & 2, t.value];
33
- switch (op[0]) {
34
- case 0: case 1: t = op; break;
35
- case 4: _.label++; return { value: op[1], done: false };
36
- case 5: _.label++; y = op[1]; op = [0]; continue;
37
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
- default:
39
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
- if (t[2]) _.ops.pop();
44
- _.trys.pop(); continue;
45
- }
46
- op = body.call(thisArg, _);
47
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
- }
50
- };
51
- Object.defineProperty(exports, "__esModule", { value: true });
52
- exports.CamApi = void 0;
53
- var abstract_api_1 = require("./abstract-api");
54
- var api_1 = require("./api");
55
- /**
56
- * This is the request handler for Cam Api,
57
- * it should be passed to any method that wants to communicate with this particular api.
58
- */
59
- var CamApi;
60
- (function (CamApi) {
61
- var Api = /** @class */ (function (_super) {
62
- __extends(Api, _super);
63
- function Api(env) {
64
- var _this = _super.call(this, "SSID") || this;
65
- _this.baseUrl = "";
66
- _this.env = env !== null && env !== void 0 ? env : api_1.Api.EEnv.PROD;
67
- _this.setBaseUrl();
68
- return _this;
69
- }
70
- Api.prototype.setBaseUrl = function () {
71
- var prefix = "https://cam.nextspace";
72
- var url;
73
- var env = this.env.toUpperCase();
74
- switch (env) {
75
- case api_1.Api.EEnv.DEV:
76
- url = prefix + "-dev.net/";
77
- break;
78
- case api_1.Api.EEnv.STG:
79
- url = prefix + "-stg.net/";
80
- break;
81
- case api_1.Api.EEnv.UAT:
82
- url = prefix + "-uat.net/";
83
- break;
84
- case api_1.Api.EEnv.PROD:
85
- url = prefix + ".host/";
86
- break;
87
- default:
88
- throw ("Specified Environment is not valid. SuppliedEnv=" + env);
89
- }
90
- this.baseUrl = url;
91
- };
92
- Api.prototype.GetBaseUrl = function () {
93
- return this.baseUrl;
94
- };
95
- Api.prototype.SetBaseUrl = function (url) {
96
- this.baseUrl = url;
97
- if (!this.baseUrl.endsWith("/")) {
98
- this.baseUrl += "/";
99
- }
100
- };
101
- Api.prototype.GET = function (url, params) {
102
- return __awaiter(this, void 0, void 0, function () {
103
- return __generator(this, function (_a) {
104
- return [2 /*return*/, this.get(this.baseUrl + url, params)];
105
- });
106
- });
107
- };
108
- Api.prototype.DELETE = function (url, params) {
109
- return __awaiter(this, void 0, void 0, function () {
110
- return __generator(this, function (_a) {
111
- return [2 /*return*/, this.delete(this.baseUrl + url, params)];
112
- });
113
- });
114
- };
115
- Api.prototype.POST = function (url, data, params) {
116
- return __awaiter(this, void 0, void 0, function () {
117
- return __generator(this, function (_a) {
118
- return [2 /*return*/, this.post(this.baseUrl + url, data, params)];
119
- });
120
- });
121
- };
122
- Api.prototype.UPLOAD = function (url, blob, params) {
123
- return __awaiter(this, void 0, void 0, function () {
124
- return __generator(this, function (_a) {
125
- return [2 /*return*/, this.upload(this.baseUrl + url, blob, params)];
126
- });
127
- });
128
- };
129
- return Api;
130
- }(abstract_api_1.AbstractApi));
131
- CamApi.Api = Api;
132
- })(CamApi = exports.CamApi || (exports.CamApi = {}));
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __generator = (this && this.__generator) || function (thisArg, body) {
25
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ function verb(n) { return function (v) { return step([n, v]); }; }
28
+ function step(op) {
29
+ if (f) throw new TypeError("Generator is already executing.");
30
+ while (_) try {
31
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
+ if (y = 0, t) op = [op[0] & 2, t.value];
33
+ switch (op[0]) {
34
+ case 0: case 1: t = op; break;
35
+ case 4: _.label++; return { value: op[1], done: false };
36
+ case 5: _.label++; y = op[1]; op = [0]; continue;
37
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
+ default:
39
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
+ if (t[2]) _.ops.pop();
44
+ _.trys.pop(); continue;
45
+ }
46
+ op = body.call(thisArg, _);
47
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
+ }
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.CamApi = void 0;
53
+ var abstract_api_1 = require("./abstract-api");
54
+ var api_1 = require("./api");
55
+ /**
56
+ * This is the request handler for Cam Api,
57
+ * it should be passed to any method that wants to communicate with this particular api.
58
+ */
59
+ var CamApi;
60
+ (function (CamApi) {
61
+ var Api = /** @class */ (function (_super) {
62
+ __extends(Api, _super);
63
+ function Api(env) {
64
+ var _this = _super.call(this, "SSID") || this;
65
+ _this.baseUrl = "";
66
+ _this.env = env !== null && env !== void 0 ? env : api_1.Api.EEnv.PROD;
67
+ _this.setBaseUrl();
68
+ return _this;
69
+ }
70
+ Api.prototype.setBaseUrl = function () {
71
+ var prefix = "https://cam.nextspace";
72
+ var url;
73
+ var env = this.env.toUpperCase();
74
+ switch (env) {
75
+ case api_1.Api.EEnv.DEV:
76
+ url = prefix + "-dev.net/";
77
+ break;
78
+ case api_1.Api.EEnv.STG:
79
+ url = prefix + "-stg.net/";
80
+ break;
81
+ case api_1.Api.EEnv.UAT:
82
+ url = prefix + "-uat.net/";
83
+ break;
84
+ case api_1.Api.EEnv.PROD:
85
+ url = prefix + ".host/";
86
+ break;
87
+ default:
88
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
89
+ }
90
+ this.baseUrl = url;
91
+ };
92
+ Api.prototype.GetBaseUrl = function () {
93
+ return this.baseUrl;
94
+ };
95
+ Api.prototype.SetBaseUrl = function (url) {
96
+ this.baseUrl = url;
97
+ if (!this.baseUrl.endsWith("/")) {
98
+ this.baseUrl += "/";
99
+ }
100
+ };
101
+ Api.prototype.GET = function (url, params) {
102
+ return __awaiter(this, void 0, void 0, function () {
103
+ return __generator(this, function (_a) {
104
+ return [2 /*return*/, this.get(this.baseUrl + url, params)];
105
+ });
106
+ });
107
+ };
108
+ Api.prototype.DELETE = function (url, params) {
109
+ return __awaiter(this, void 0, void 0, function () {
110
+ return __generator(this, function (_a) {
111
+ return [2 /*return*/, this.delete(this.baseUrl + url, params)];
112
+ });
113
+ });
114
+ };
115
+ Api.prototype.POST = function (url, data, params) {
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ return __generator(this, function (_a) {
118
+ return [2 /*return*/, this.post(this.baseUrl + url, data, params)];
119
+ });
120
+ });
121
+ };
122
+ Api.prototype.UPLOAD = function (url, blob, params) {
123
+ return __awaiter(this, void 0, void 0, function () {
124
+ return __generator(this, function (_a) {
125
+ return [2 /*return*/, this.upload(this.baseUrl + url, blob, params)];
126
+ });
127
+ });
128
+ };
129
+ return Api;
130
+ }(abstract_api_1.AbstractApi));
131
+ CamApi.Api = Api;
132
+ })(CamApi = exports.CamApi || (exports.CamApi = {}));
133
133
  //# sourceMappingURL=cam-api.js.map
@@ -1,132 +1,132 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- };
24
- var __generator = (this && this.__generator) || function (thisArg, body) {
25
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
- function verb(n) { return function (v) { return step([n, v]); }; }
28
- function step(op) {
29
- if (f) throw new TypeError("Generator is already executing.");
30
- while (_) try {
31
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
- if (y = 0, t) op = [op[0] & 2, t.value];
33
- switch (op[0]) {
34
- case 0: case 1: t = op; break;
35
- case 4: _.label++; return { value: op[1], done: false };
36
- case 5: _.label++; y = op[1]; op = [0]; continue;
37
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
- default:
39
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
- if (t[2]) _.ops.pop();
44
- _.trys.pop(); continue;
45
- }
46
- op = body.call(thisArg, _);
47
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
- }
50
- };
51
- Object.defineProperty(exports, "__esModule", { value: true });
52
- exports.GlobalApi = void 0;
53
- var abstract_api_1 = require("./abstract-api");
54
- var api_1 = require("./api");
55
- var GlobalApi;
56
- (function (GlobalApi) {
57
- /**
58
- * This is the request handler for Global Api,
59
- * it should be passed to any method that wants to communicate with this particular api.
60
- */
61
- var Api = /** @class */ (function (_super) {
62
- __extends(Api, _super);
63
- function Api(env) {
64
- var _this = _super.call(this, "SSID") || this;
65
- _this.baseUrl = "";
66
- _this.env = env !== null && env !== void 0 ? env : api_1.Api.EEnv.PROD;
67
- _this.setBaseUrl();
68
- return _this;
69
- }
70
- Api.prototype.setBaseUrl = function () {
71
- var url;
72
- var env = this.env.toUpperCase();
73
- switch (env) {
74
- case api_1.Api.EEnv.DEV:
75
- url = "https://bruceglobal.nextspace-dev.net/";
76
- break;
77
- case api_1.Api.EEnv.STG:
78
- url = "https://bruceglobal.nextspace-stg.net/";
79
- break;
80
- case api_1.Api.EEnv.UAT:
81
- url = "https://bruceglobal.api.nextspace-uat.net/";
82
- break;
83
- case api_1.Api.EEnv.PROD:
84
- url = "https://bruceglobal.api.nextspace.host/";
85
- break;
86
- default:
87
- throw ("Specified Environment is not valid. SuppliedEnv=" + env);
88
- }
89
- this.baseUrl = url;
90
- };
91
- Api.prototype.GetBaseUrl = function () {
92
- return this.baseUrl;
93
- };
94
- Api.prototype.SetBaseUrl = function (url) {
95
- this.baseUrl = url;
96
- if (!this.baseUrl.endsWith("/")) {
97
- this.baseUrl += "/";
98
- }
99
- };
100
- Api.prototype.GET = function (url, params) {
101
- return __awaiter(this, void 0, void 0, function () {
102
- return __generator(this, function (_a) {
103
- return [2 /*return*/, this.get(this.baseUrl + url, params)];
104
- });
105
- });
106
- };
107
- Api.prototype.DELETE = function (url, params) {
108
- return __awaiter(this, void 0, void 0, function () {
109
- return __generator(this, function (_a) {
110
- return [2 /*return*/, this.delete(this.baseUrl + url, params)];
111
- });
112
- });
113
- };
114
- Api.prototype.POST = function (url, data, params) {
115
- return __awaiter(this, void 0, void 0, function () {
116
- return __generator(this, function (_a) {
117
- return [2 /*return*/, this.post(this.baseUrl + url, data, params)];
118
- });
119
- });
120
- };
121
- Api.prototype.UPLOAD = function (url, blob, params) {
122
- return __awaiter(this, void 0, void 0, function () {
123
- return __generator(this, function (_a) {
124
- return [2 /*return*/, this.upload(this.baseUrl + url, blob, params)];
125
- });
126
- });
127
- };
128
- return Api;
129
- }(abstract_api_1.AbstractApi));
130
- GlobalApi.Api = Api;
131
- })(GlobalApi = exports.GlobalApi || (exports.GlobalApi = {}));
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __generator = (this && this.__generator) || function (thisArg, body) {
25
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ function verb(n) { return function (v) { return step([n, v]); }; }
28
+ function step(op) {
29
+ if (f) throw new TypeError("Generator is already executing.");
30
+ while (_) try {
31
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
+ if (y = 0, t) op = [op[0] & 2, t.value];
33
+ switch (op[0]) {
34
+ case 0: case 1: t = op; break;
35
+ case 4: _.label++; return { value: op[1], done: false };
36
+ case 5: _.label++; y = op[1]; op = [0]; continue;
37
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
+ default:
39
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
+ if (t[2]) _.ops.pop();
44
+ _.trys.pop(); continue;
45
+ }
46
+ op = body.call(thisArg, _);
47
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
+ }
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.GlobalApi = void 0;
53
+ var abstract_api_1 = require("./abstract-api");
54
+ var api_1 = require("./api");
55
+ var GlobalApi;
56
+ (function (GlobalApi) {
57
+ /**
58
+ * This is the request handler for Global Api,
59
+ * it should be passed to any method that wants to communicate with this particular api.
60
+ */
61
+ var Api = /** @class */ (function (_super) {
62
+ __extends(Api, _super);
63
+ function Api(env) {
64
+ var _this = _super.call(this, "SSID") || this;
65
+ _this.baseUrl = "";
66
+ _this.env = env !== null && env !== void 0 ? env : api_1.Api.EEnv.PROD;
67
+ _this.setBaseUrl();
68
+ return _this;
69
+ }
70
+ Api.prototype.setBaseUrl = function () {
71
+ var url;
72
+ var env = this.env.toUpperCase();
73
+ switch (env) {
74
+ case api_1.Api.EEnv.DEV:
75
+ url = "https://bruceglobal.nextspace-dev.net/";
76
+ break;
77
+ case api_1.Api.EEnv.STG:
78
+ url = "https://bruceglobal.nextspace-stg.net/";
79
+ break;
80
+ case api_1.Api.EEnv.UAT:
81
+ url = "https://bruceglobal.api.nextspace-uat.net/";
82
+ break;
83
+ case api_1.Api.EEnv.PROD:
84
+ url = "https://bruceglobal.api.nextspace.host/";
85
+ break;
86
+ default:
87
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
88
+ }
89
+ this.baseUrl = url;
90
+ };
91
+ Api.prototype.GetBaseUrl = function () {
92
+ return this.baseUrl;
93
+ };
94
+ Api.prototype.SetBaseUrl = function (url) {
95
+ this.baseUrl = url;
96
+ if (!this.baseUrl.endsWith("/")) {
97
+ this.baseUrl += "/";
98
+ }
99
+ };
100
+ Api.prototype.GET = function (url, params) {
101
+ return __awaiter(this, void 0, void 0, function () {
102
+ return __generator(this, function (_a) {
103
+ return [2 /*return*/, this.get(this.baseUrl + url, params)];
104
+ });
105
+ });
106
+ };
107
+ Api.prototype.DELETE = function (url, params) {
108
+ return __awaiter(this, void 0, void 0, function () {
109
+ return __generator(this, function (_a) {
110
+ return [2 /*return*/, this.delete(this.baseUrl + url, params)];
111
+ });
112
+ });
113
+ };
114
+ Api.prototype.POST = function (url, data, params) {
115
+ return __awaiter(this, void 0, void 0, function () {
116
+ return __generator(this, function (_a) {
117
+ return [2 /*return*/, this.post(this.baseUrl + url, data, params)];
118
+ });
119
+ });
120
+ };
121
+ Api.prototype.UPLOAD = function (url, blob, params) {
122
+ return __awaiter(this, void 0, void 0, function () {
123
+ return __generator(this, function (_a) {
124
+ return [2 /*return*/, this.upload(this.baseUrl + url, blob, params)];
125
+ });
126
+ });
127
+ };
128
+ return Api;
129
+ }(abstract_api_1.AbstractApi));
130
+ GlobalApi.Api = Api;
131
+ })(GlobalApi = exports.GlobalApi || (exports.GlobalApi = {}));
132
132
  //# sourceMappingURL=global-api.js.map