bruce-models 1.9.7 → 1.9.8

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 (83) hide show
  1. package/dist/bruce-models.es5.js +9 -3
  2. package/dist/bruce-models.es5.js.map +1 -1
  3. package/dist/bruce-models.umd.js +9 -3
  4. package/dist/bruce-models.umd.js.map +1 -1
  5. package/dist/lib/account/account-settings.js +2 -2
  6. package/dist/lib/account/account.js +185 -185
  7. package/dist/lib/ann-document/ann-document.js +86 -86
  8. package/dist/lib/api/abstract-api.js +246 -246
  9. package/dist/lib/api/api-getters.js +134 -134
  10. package/dist/lib/api/api.js +93 -93
  11. package/dist/lib/api/bruce-api.js +216 -216
  12. package/dist/lib/api/cam-api.js +82 -82
  13. package/dist/lib/api/global-api.js +81 -81
  14. package/dist/lib/api/idm-api.js +82 -82
  15. package/dist/lib/bruce-models.js +86 -86
  16. package/dist/lib/calculator/calculator.js +341 -335
  17. package/dist/lib/calculator/calculator.js.map +1 -1
  18. package/dist/lib/client-file/client-file.js +245 -245
  19. package/dist/lib/common/bounds.js +61 -61
  20. package/dist/lib/common/bruce-event.js +46 -46
  21. package/dist/lib/common/bruce-variable.js +60 -60
  22. package/dist/lib/common/cache.js +165 -165
  23. package/dist/lib/common/camera.js +11 -11
  24. package/dist/lib/common/cartes.js +123 -123
  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 +56 -56
  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-content.js +26 -26
  33. package/dist/lib/custom-form/custom-form.js +106 -106
  34. package/dist/lib/data-lab/data-lab.js +49 -49
  35. package/dist/lib/entity/entity-attachment-type.js +83 -83
  36. package/dist/lib/entity/entity-attachment.js +122 -122
  37. package/dist/lib/entity/entity-attribute.js +29 -29
  38. package/dist/lib/entity/entity-comment.js +82 -82
  39. package/dist/lib/entity/entity-coords.js +149 -149
  40. package/dist/lib/entity/entity-link.js +82 -82
  41. package/dist/lib/entity/entity-lod-category.js +100 -100
  42. package/dist/lib/entity/entity-lod.js +185 -185
  43. package/dist/lib/entity/entity-relation-type.js +109 -109
  44. package/dist/lib/entity/entity-relation.js +132 -132
  45. package/dist/lib/entity/entity-source.js +136 -136
  46. package/dist/lib/entity/entity-tag.js +149 -149
  47. package/dist/lib/entity/entity-type-visual-settings.js +13 -13
  48. package/dist/lib/entity/entity-type.js +113 -113
  49. package/dist/lib/entity/entity.js +319 -319
  50. package/dist/lib/entity/getters/batched-data-getter.js +84 -84
  51. package/dist/lib/entity/getters/entity-filter-getter.js +303 -303
  52. package/dist/lib/entity/getters/entity-globe.js +211 -211
  53. package/dist/lib/entity/getters/view-monitor.js +2 -2
  54. package/dist/lib/import/import-cad.js +53 -53
  55. package/dist/lib/import/import-csv.js +23 -23
  56. package/dist/lib/import/import-json.js +23 -23
  57. package/dist/lib/import/import-kml.js +23 -23
  58. package/dist/lib/import/imported-file.js +91 -91
  59. package/dist/lib/internal/uploader.js +76 -76
  60. package/dist/lib/markup/markup.js +185 -185
  61. package/dist/lib/plugin/plugin.js +83 -83
  62. package/dist/lib/program-key/program-key.js +111 -111
  63. package/dist/lib/project/menu-item.js +121 -121
  64. package/dist/lib/project/project-view-bookmark.js +147 -147
  65. package/dist/lib/project/project-view-legacy-tile.js +77 -77
  66. package/dist/lib/project/project-view-tile.js +125 -125
  67. package/dist/lib/project/project-view.js +133 -133
  68. package/dist/lib/project/zoom-control.js +17 -17
  69. package/dist/lib/server/message-broker.js +142 -142
  70. package/dist/lib/server/pending-action.js +71 -71
  71. package/dist/lib/server/task.js +63 -63
  72. package/dist/lib/style/style.js +117 -117
  73. package/dist/lib/tileset/tileset.js +415 -415
  74. package/dist/lib/user/permission.js +20 -20
  75. package/dist/lib/user/session.js +137 -137
  76. package/dist/lib/user/user-group.js +94 -94
  77. package/dist/lib/user/user.js +446 -446
  78. package/dist/lib/util/encrypt-utils.js +19 -19
  79. package/dist/lib/util/math-utils.js +40 -40
  80. package/dist/lib/util/object-utils.js +17 -17
  81. package/dist/lib/util/path-utils.js +61 -61
  82. package/dist/lib/util/url-utils.js +94 -94
  83. package/package.json +1 -1
@@ -1,217 +1,217 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BruceApi = void 0;
13
- const account_1 = require("../account/account");
14
- const abstract_api_1 = require("./abstract-api");
15
- const api_1 = require("./api");
16
- const cam_api_1 = require("./cam-api");
17
- const message_broker_1 = require("../server/message-broker");
18
- var BruceApi;
19
- (function (BruceApi) {
20
- /**
21
- * This is the request handler for Bruce Api,
22
- * it should be passed to any method that wants to communicate with this particular api.
23
- */
24
- class Api extends abstract_api_1.AbstractApi {
25
- /**
26
- * @param params
27
- */
28
- constructor(params) {
29
- super({
30
- ssidHeader: "x-sessionid"
31
- });
32
- this.loadCancelled = false;
33
- let { accountId, env, cam, loadRegionalBaseUrl, loadConfig } = params;
34
- this.accountId = accountId;
35
- this.env = env !== null && env !== void 0 ? env : api_1.Api.EEnv.PROD;
36
- if (loadRegionalBaseUrl) {
37
- loadConfig = true;
38
- }
39
- if (!cam && loadConfig) {
40
- cam = new cam_api_1.CamApi.Api({
41
- env: this.env
42
- });
43
- }
44
- this.loadProm = this.init(cam, loadConfig);
45
- }
46
- get MessageBroker() {
47
- return this.messageBroker;
48
- }
49
- // Indicates if the init process has finished loading.
50
- // This means the regional base url has been set and message broker is ready.
51
- get Loading() {
52
- return this.loadProm;
53
- }
54
- /**
55
- * Loads regional base url and sets up message broker.
56
- * @param cam Required for loading regional base url.
57
- * @param loadConfig
58
- * @returns
59
- */
60
- init(cam, loadConfig) {
61
- var _a, _b, _c;
62
- return __awaiter(this, void 0, void 0, function* () {
63
- if (!this.accountId) {
64
- throw ("accountId is required.");
65
- }
66
- // Set using a stable default.
67
- const prefix = `https://${this.accountId}.api.nextspace`;
68
- let url;
69
- const env = this.env.toUpperCase();
70
- switch (env) {
71
- case api_1.Api.EEnv.DEV:
72
- url = prefix + "-dev.net/";
73
- break;
74
- case api_1.Api.EEnv.STG:
75
- url = prefix + "-stg.net/";
76
- break;
77
- case api_1.Api.EEnv.UAT:
78
- url = prefix + "-uat.net/";
79
- break;
80
- case api_1.Api.EEnv.PROD:
81
- url = prefix + ".host/";
82
- break;
83
- default:
84
- throw ("Specified Environment is not valid. SuppliedEnv=" + env);
85
- }
86
- this.baseUrl = url;
87
- if (cam && loadConfig) {
88
- // Attempt to load an account specific base url.
89
- // This could be one with a region specific endpoint.
90
- try {
91
- const settings = (yield account_1.Account.GetAppSettings({
92
- api: cam,
93
- accountId: this.accountId,
94
- appId: account_1.Account.EAppId.BruceApi
95
- })).settings;
96
- if (this.loadCancelled) {
97
- console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
98
- return;
99
- }
100
- let endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
101
- if (typeof endpoint == "string") {
102
- if (!endpoint.endsWith("/")) {
103
- endpoint += "/";
104
- }
105
- this.baseUrl = endpoint;
106
- }
107
- const api = new BruceApi.Api({
108
- accountId: this.accountId,
109
- cam: cam,
110
- env: this.env,
111
- // Must be false.
112
- // Else we get stuck in nested init loop.
113
- loadConfig: false
114
- });
115
- // CDN urls.
116
- const region = (yield account_1.Account.GetDbRegions({
117
- api,
118
- key: settings.DBServer
119
- })).regions[0];
120
- if (region === null || region === void 0 ? void 0 : region.CDN) {
121
- this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
122
- // We need to fix our configs.
123
- if (this.EntityCdnUrl) {
124
- if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
125
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
126
- }
127
- else {
128
- this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
129
- }
130
- }
131
- this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
132
- }
133
- }
134
- catch (e) {
135
- console.error(e);
136
- }
137
- }
138
- try {
139
- this.messageBroker = new message_broker_1.MessageBroker.WebSocketBroker(this.baseUrl, this.env);
140
- }
141
- catch (e) {
142
- console.warn("BruceApi: Failed to create message broker.", e);
143
- }
144
- });
145
- }
146
- /**
147
- * Warning: This method does not wait for init to finish loading.
148
- * This means the url could be changed once fully initialized.
149
- * The url will be valid either way, but the loaded one may be faster as it is region specific.
150
- * Await the "Loading" promise if you care about this.
151
- * @returns
152
- */
153
- GetBaseUrl() {
154
- return this.baseUrl;
155
- }
156
- /**
157
- * Warning: This will cancel the init process.
158
- * The init process loads a region specific endpoint.
159
- * Setting a base url will stop that process from completing.
160
- * @param url
161
- */
162
- SetBaseUrl(url) {
163
- this.baseUrl = url;
164
- if (!this.baseUrl.endsWith("/")) {
165
- this.baseUrl += "/";
166
- }
167
- this.loadCancelled = true;
168
- }
169
- GET(url, params) {
170
- return __awaiter(this, void 0, void 0, function* () {
171
- return new Promise((res, rej) => {
172
- this.loadProm.then(() => {
173
- this.get(this.baseUrl + url, params).then(res).catch(rej);
174
- }).catch(rej);
175
- });
176
- });
177
- }
178
- DELETE(url, params) {
179
- return __awaiter(this, void 0, void 0, function* () {
180
- return new Promise((res, rej) => {
181
- this.loadProm.then(() => {
182
- this.delete(this.baseUrl + url, params).then(res).catch(rej);
183
- }).catch(rej);
184
- });
185
- });
186
- }
187
- POST(url, data, params) {
188
- return __awaiter(this, void 0, void 0, function* () {
189
- return new Promise((res, rej) => {
190
- this.loadProm.then(() => {
191
- this.post(this.baseUrl + url, data, params).then(res).catch(rej);
192
- }).catch(rej);
193
- });
194
- });
195
- }
196
- PUT(url, data, params) {
197
- return __awaiter(this, void 0, void 0, function* () {
198
- return new Promise((res, rej) => {
199
- this.loadProm.then(() => {
200
- this.put(this.baseUrl + url, data, params).then(res).catch(rej);
201
- }).catch(rej);
202
- });
203
- });
204
- }
205
- UPLOAD(url, blob, params) {
206
- return __awaiter(this, void 0, void 0, function* () {
207
- return new Promise((res, rej) => {
208
- this.loadProm.then(() => {
209
- this.upload(this.baseUrl + url, blob, params).then(res).catch(rej);
210
- }).catch(rej);
211
- });
212
- });
213
- }
214
- }
215
- BruceApi.Api = Api;
216
- })(BruceApi = exports.BruceApi || (exports.BruceApi = {}));
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BruceApi = void 0;
13
+ const account_1 = require("../account/account");
14
+ const abstract_api_1 = require("./abstract-api");
15
+ const api_1 = require("./api");
16
+ const cam_api_1 = require("./cam-api");
17
+ const message_broker_1 = require("../server/message-broker");
18
+ var BruceApi;
19
+ (function (BruceApi) {
20
+ /**
21
+ * This is the request handler for Bruce Api,
22
+ * it should be passed to any method that wants to communicate with this particular api.
23
+ */
24
+ class Api extends abstract_api_1.AbstractApi {
25
+ /**
26
+ * @param params
27
+ */
28
+ constructor(params) {
29
+ super({
30
+ ssidHeader: "x-sessionid"
31
+ });
32
+ this.loadCancelled = false;
33
+ let { accountId, env, cam, loadRegionalBaseUrl, loadConfig } = params;
34
+ this.accountId = accountId;
35
+ this.env = env !== null && env !== void 0 ? env : api_1.Api.EEnv.PROD;
36
+ if (loadRegionalBaseUrl) {
37
+ loadConfig = true;
38
+ }
39
+ if (!cam && loadConfig) {
40
+ cam = new cam_api_1.CamApi.Api({
41
+ env: this.env
42
+ });
43
+ }
44
+ this.loadProm = this.init(cam, loadConfig);
45
+ }
46
+ get MessageBroker() {
47
+ return this.messageBroker;
48
+ }
49
+ // Indicates if the init process has finished loading.
50
+ // This means the regional base url has been set and message broker is ready.
51
+ get Loading() {
52
+ return this.loadProm;
53
+ }
54
+ /**
55
+ * Loads regional base url and sets up message broker.
56
+ * @param cam Required for loading regional base url.
57
+ * @param loadConfig
58
+ * @returns
59
+ */
60
+ init(cam, loadConfig) {
61
+ var _a, _b, _c;
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ if (!this.accountId) {
64
+ throw ("accountId is required.");
65
+ }
66
+ // Set using a stable default.
67
+ const prefix = `https://${this.accountId}.api.nextspace`;
68
+ let url;
69
+ const env = this.env.toUpperCase();
70
+ switch (env) {
71
+ case api_1.Api.EEnv.DEV:
72
+ url = prefix + "-dev.net/";
73
+ break;
74
+ case api_1.Api.EEnv.STG:
75
+ url = prefix + "-stg.net/";
76
+ break;
77
+ case api_1.Api.EEnv.UAT:
78
+ url = prefix + "-uat.net/";
79
+ break;
80
+ case api_1.Api.EEnv.PROD:
81
+ url = prefix + ".host/";
82
+ break;
83
+ default:
84
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
85
+ }
86
+ this.baseUrl = url;
87
+ if (cam && loadConfig) {
88
+ // Attempt to load an account specific base url.
89
+ // This could be one with a region specific endpoint.
90
+ try {
91
+ const settings = (yield account_1.Account.GetAppSettings({
92
+ api: cam,
93
+ accountId: this.accountId,
94
+ appId: account_1.Account.EAppId.BruceApi
95
+ })).settings;
96
+ if (this.loadCancelled) {
97
+ console.warn("BruceApi: Loading was cancelled due to SetBaseUrl being called, not setting regional base url.");
98
+ return;
99
+ }
100
+ let endpoint = (_a = settings.BruceAPIURL) === null || _a === void 0 ? void 0 : _a[env];
101
+ if (typeof endpoint == "string") {
102
+ if (!endpoint.endsWith("/")) {
103
+ endpoint += "/";
104
+ }
105
+ this.baseUrl = endpoint;
106
+ }
107
+ const api = new BruceApi.Api({
108
+ accountId: this.accountId,
109
+ cam: cam,
110
+ env: this.env,
111
+ // Must be false.
112
+ // Else we get stuck in nested init loop.
113
+ loadConfig: false
114
+ });
115
+ // CDN urls.
116
+ const region = (yield account_1.Account.GetDbRegions({
117
+ api,
118
+ key: settings.DBServer
119
+ })).regions[0];
120
+ if (region === null || region === void 0 ? void 0 : region.CDN) {
121
+ this.EntityCdnUrl = (_b = region.CDN.entityURL) === null || _b === void 0 ? void 0 : _b[env];
122
+ // We need to fix our configs.
123
+ if (this.EntityCdnUrl) {
124
+ if (this.EntityCdnUrl.includes("entitiesListForCDN")) {
125
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", this.accountId);
126
+ }
127
+ else {
128
+ this.EntityCdnUrl = this.EntityCdnUrl.replace("<ACCOUNT>", "entitiesListForCDN/" + this.accountId);
129
+ }
130
+ }
131
+ this.LegacyTilesetCdnUrl = (_c = region.CDN.legacyTilesetURL) === null || _c === void 0 ? void 0 : _c[env];
132
+ }
133
+ }
134
+ catch (e) {
135
+ console.error(e);
136
+ }
137
+ }
138
+ try {
139
+ this.messageBroker = new message_broker_1.MessageBroker.WebSocketBroker(this.baseUrl, this.env);
140
+ }
141
+ catch (e) {
142
+ console.warn("BruceApi: Failed to create message broker.", e);
143
+ }
144
+ });
145
+ }
146
+ /**
147
+ * Warning: This method does not wait for init to finish loading.
148
+ * This means the url could be changed once fully initialized.
149
+ * The url will be valid either way, but the loaded one may be faster as it is region specific.
150
+ * Await the "Loading" promise if you care about this.
151
+ * @returns
152
+ */
153
+ GetBaseUrl() {
154
+ return this.baseUrl;
155
+ }
156
+ /**
157
+ * Warning: This will cancel the init process.
158
+ * The init process loads a region specific endpoint.
159
+ * Setting a base url will stop that process from completing.
160
+ * @param url
161
+ */
162
+ SetBaseUrl(url) {
163
+ this.baseUrl = url;
164
+ if (!this.baseUrl.endsWith("/")) {
165
+ this.baseUrl += "/";
166
+ }
167
+ this.loadCancelled = true;
168
+ }
169
+ GET(url, params) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ return new Promise((res, rej) => {
172
+ this.loadProm.then(() => {
173
+ this.get(this.baseUrl + url, params).then(res).catch(rej);
174
+ }).catch(rej);
175
+ });
176
+ });
177
+ }
178
+ DELETE(url, params) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ return new Promise((res, rej) => {
181
+ this.loadProm.then(() => {
182
+ this.delete(this.baseUrl + url, params).then(res).catch(rej);
183
+ }).catch(rej);
184
+ });
185
+ });
186
+ }
187
+ POST(url, data, params) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ return new Promise((res, rej) => {
190
+ this.loadProm.then(() => {
191
+ this.post(this.baseUrl + url, data, params).then(res).catch(rej);
192
+ }).catch(rej);
193
+ });
194
+ });
195
+ }
196
+ PUT(url, data, params) {
197
+ return __awaiter(this, void 0, void 0, function* () {
198
+ return new Promise((res, rej) => {
199
+ this.loadProm.then(() => {
200
+ this.put(this.baseUrl + url, data, params).then(res).catch(rej);
201
+ }).catch(rej);
202
+ });
203
+ });
204
+ }
205
+ UPLOAD(url, blob, params) {
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ return new Promise((res, rej) => {
208
+ this.loadProm.then(() => {
209
+ this.upload(this.baseUrl + url, blob, params).then(res).catch(rej);
210
+ }).catch(rej);
211
+ });
212
+ });
213
+ }
214
+ }
215
+ BruceApi.Api = Api;
216
+ })(BruceApi = exports.BruceApi || (exports.BruceApi = {}));
217
217
  //# sourceMappingURL=bruce-api.js.map
@@ -1,83 +1,83 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CamApi = void 0;
13
- const abstract_api_1 = require("./abstract-api");
14
- const api_1 = require("./api");
15
- /**
16
- * This is the request handler for Cam Api,
17
- * it should be passed to any method that wants to communicate with this particular api.
18
- */
19
- var CamApi;
20
- (function (CamApi) {
21
- class Api extends abstract_api_1.AbstractApi {
22
- constructor(params) {
23
- super({
24
- ssidHeader: "x-sessionid"
25
- });
26
- this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : api_1.Api.EEnv.PROD;
27
- this.setBaseUrl();
28
- }
29
- setBaseUrl() {
30
- const prefix = "https://cam.nextspace";
31
- let url;
32
- const env = this.env.toUpperCase();
33
- switch (env) {
34
- case api_1.Api.EEnv.DEV:
35
- url = prefix + "-dev.net/";
36
- break;
37
- case api_1.Api.EEnv.STG:
38
- url = prefix + "-stg.net/";
39
- break;
40
- case api_1.Api.EEnv.UAT:
41
- url = prefix + "-uat.net/";
42
- break;
43
- case api_1.Api.EEnv.PROD:
44
- url = prefix + ".host/";
45
- break;
46
- default:
47
- throw ("Specified Environment is not valid. SuppliedEnv=" + env);
48
- }
49
- this.baseUrl = url;
50
- }
51
- GetBaseUrl() {
52
- return this.baseUrl;
53
- }
54
- SetBaseUrl(url) {
55
- this.baseUrl = url;
56
- if (!this.baseUrl.endsWith("/")) {
57
- this.baseUrl += "/";
58
- }
59
- }
60
- GET(url, params) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- return this.get(this.baseUrl + url, params);
63
- });
64
- }
65
- DELETE(url, params) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- return this.delete(this.baseUrl + url, params);
68
- });
69
- }
70
- POST(url, data, params) {
71
- return __awaiter(this, void 0, void 0, function* () {
72
- return this.post(this.baseUrl + url, data, params);
73
- });
74
- }
75
- UPLOAD(url, blob, params) {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- return this.upload(this.baseUrl + url, blob, params);
78
- });
79
- }
80
- }
81
- CamApi.Api = Api;
82
- })(CamApi = exports.CamApi || (exports.CamApi = {}));
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CamApi = void 0;
13
+ const abstract_api_1 = require("./abstract-api");
14
+ const api_1 = require("./api");
15
+ /**
16
+ * This is the request handler for Cam Api,
17
+ * it should be passed to any method that wants to communicate with this particular api.
18
+ */
19
+ var CamApi;
20
+ (function (CamApi) {
21
+ class Api extends abstract_api_1.AbstractApi {
22
+ constructor(params) {
23
+ super({
24
+ ssidHeader: "x-sessionid"
25
+ });
26
+ this.env = (params === null || params === void 0 ? void 0 : params.env) ? params.env : api_1.Api.EEnv.PROD;
27
+ this.setBaseUrl();
28
+ }
29
+ setBaseUrl() {
30
+ const prefix = "https://cam.nextspace";
31
+ let url;
32
+ const env = this.env.toUpperCase();
33
+ switch (env) {
34
+ case api_1.Api.EEnv.DEV:
35
+ url = prefix + "-dev.net/";
36
+ break;
37
+ case api_1.Api.EEnv.STG:
38
+ url = prefix + "-stg.net/";
39
+ break;
40
+ case api_1.Api.EEnv.UAT:
41
+ url = prefix + "-uat.net/";
42
+ break;
43
+ case api_1.Api.EEnv.PROD:
44
+ url = prefix + ".host/";
45
+ break;
46
+ default:
47
+ throw ("Specified Environment is not valid. SuppliedEnv=" + env);
48
+ }
49
+ this.baseUrl = url;
50
+ }
51
+ GetBaseUrl() {
52
+ return this.baseUrl;
53
+ }
54
+ SetBaseUrl(url) {
55
+ this.baseUrl = url;
56
+ if (!this.baseUrl.endsWith("/")) {
57
+ this.baseUrl += "/";
58
+ }
59
+ }
60
+ GET(url, params) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ return this.get(this.baseUrl + url, params);
63
+ });
64
+ }
65
+ DELETE(url, params) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ return this.delete(this.baseUrl + url, params);
68
+ });
69
+ }
70
+ POST(url, data, params) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ return this.post(this.baseUrl + url, data, params);
73
+ });
74
+ }
75
+ UPLOAD(url, blob, params) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ return this.upload(this.baseUrl + url, blob, params);
78
+ });
79
+ }
80
+ }
81
+ CamApi.Api = Api;
82
+ })(CamApi = exports.CamApi || (exports.CamApi = {}));
83
83
  //# sourceMappingURL=cam-api.js.map