@sonoransoftware/sonoran.js 1.0.19 → 1.0.20

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 (89) hide show
  1. package/.eslintrc.js +10 -10
  2. package/.github/workflows/npm-publish.yml +34 -34
  3. package/.prettierrc.js +6 -6
  4. package/dist/builders/cad/DispatchCall.d.ts +92 -92
  5. package/dist/builders/cad/DispatchCall.js +144 -144
  6. package/dist/builders/cad/index.d.ts +1 -1
  7. package/dist/builders/cad/index.js +17 -17
  8. package/dist/builders/index.d.ts +1 -1
  9. package/dist/builders/index.js +19 -19
  10. package/dist/constants.d.ts +230 -230
  11. package/dist/constants.js +27 -27
  12. package/dist/errors/LibraryErrors.d.ts +19 -19
  13. package/dist/errors/LibraryErrors.js +47 -47
  14. package/dist/errors/Messages.d.ts +1 -1
  15. package/dist/errors/Messages.js +8 -8
  16. package/dist/errors/index.d.ts +2 -2
  17. package/dist/errors/index.js +18 -18
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +24 -24
  20. package/dist/instance/Instance.d.ts +24 -24
  21. package/dist/instance/Instance.js +139 -139
  22. package/dist/instance/instance.types.d.ts +17 -17
  23. package/dist/instance/instance.types.js +2 -2
  24. package/dist/libs/rest/src/index.d.ts +6 -6
  25. package/dist/libs/rest/src/index.js +22 -22
  26. package/dist/libs/rest/src/lib/REST.d.ts +101 -101
  27. package/dist/libs/rest/src/lib/REST.js +136 -129
  28. package/dist/libs/rest/src/lib/RequestManager.d.ts +59 -59
  29. package/dist/libs/rest/src/lib/RequestManager.js +191 -191
  30. package/dist/libs/rest/src/lib/errors/APIError.d.ts +9 -9
  31. package/dist/libs/rest/src/lib/errors/APIError.js +17 -17
  32. package/dist/libs/rest/src/lib/errors/HTTPError.d.ts +17 -17
  33. package/dist/libs/rest/src/lib/errors/HTTPError.js +23 -23
  34. package/dist/libs/rest/src/lib/errors/RateLimitError.d.ts +13 -13
  35. package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -19
  36. package/dist/libs/rest/src/lib/errors/index.d.ts +4 -4
  37. package/dist/libs/rest/src/lib/errors/index.js +20 -20
  38. package/dist/libs/rest/src/lib/handlers/IHandler.d.ts +7 -7
  39. package/dist/libs/rest/src/lib/handlers/IHandler.js +2 -2
  40. package/dist/libs/rest/src/lib/handlers/SequentialHandler.d.ts +45 -45
  41. package/dist/libs/rest/src/lib/handlers/SequentialHandler.js +143 -143
  42. package/dist/libs/rest/src/lib/utils/constants.d.ts +533 -527
  43. package/dist/libs/rest/src/lib/utils/constants.js +463 -455
  44. package/dist/libs/rest/src/lib/utils/utils.d.ts +1 -1
  45. package/dist/libs/rest/src/lib/utils/utils.js +22 -22
  46. package/dist/managers/BaseManager.d.ts +14 -14
  47. package/dist/managers/BaseManager.js +18 -18
  48. package/dist/managers/CADActiveUnitsManager.d.ts +15 -15
  49. package/dist/managers/CADActiveUnitsManager.js +38 -38
  50. package/dist/managers/CADManager.d.ts +29 -29
  51. package/dist/managers/CADManager.js +86 -86
  52. package/dist/managers/CADServerManager.d.ts +8 -8
  53. package/dist/managers/CADServerManager.js +28 -28
  54. package/dist/managers/CMSManager.d.ts +101 -101
  55. package/dist/managers/CMSManager.js +266 -266
  56. package/dist/managers/CMSServerManager.d.ts +8 -8
  57. package/dist/managers/CMSServerManager.js +34 -34
  58. package/dist/managers/CacheManager.d.ts +10 -10
  59. package/dist/managers/CacheManager.js +36 -36
  60. package/dist/managers/DataManager.d.ts +31 -31
  61. package/dist/managers/DataManager.js +58 -58
  62. package/dist/structures/Base.d.ts +9 -9
  63. package/dist/structures/Base.js +24 -24
  64. package/dist/structures/CADActiveUnit.d.ts +47 -47
  65. package/dist/structures/CADActiveUnit.js +66 -66
  66. package/dist/structures/CADServer.d.ts +26 -26
  67. package/dist/structures/CADServer.js +15 -15
  68. package/dist/structures/CMSServer.d.ts +18 -18
  69. package/dist/structures/CMSServer.js +12 -12
  70. package/dist/utils/index.d.ts +1 -1
  71. package/dist/utils/index.js +17 -17
  72. package/dist/utils/utils.d.ts +13 -13
  73. package/dist/utils/utils.js +79 -79
  74. package/docs/CAD-Methods-and-Usage.md +58 -58
  75. package/docs/CMS-Methods-and-Usage.md +211 -211
  76. package/docs/REST-Methods-and-Usage.md +46 -46
  77. package/package.json +48 -48
  78. package/readme.md +53 -53
  79. package/src/constants.ts +248 -248
  80. package/src/instance/Instance.ts +121 -121
  81. package/src/instance/instance.types.ts +17 -17
  82. package/src/libs/rest/src/lib/REST.ts +241 -234
  83. package/src/libs/rest/src/lib/RequestManager.ts +260 -260
  84. package/src/libs/rest/src/lib/handlers/SequentialHandler.ts +160 -160
  85. package/src/libs/rest/src/lib/utils/constants.ts +1012 -997
  86. package/src/managers/CADManager.ts +63 -63
  87. package/src/managers/CMSManager.ts +226 -226
  88. package/src/managers/CMSServerManager.ts +32 -32
  89. package/tsconfig.json +71 -71
@@ -1,2 +1,2 @@
1
- export * from './LibraryErrors';
2
- export * from './Messages';
1
+ export * from './LibraryErrors';
2
+ export * from './Messages';
@@ -1,18 +1,18 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./LibraryErrors"), exports);
18
- __exportStar(require("./Messages"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./LibraryErrors"), exports);
18
+ __exportStar(require("./Messages"), exports);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './instance/Instance';
2
- export * from './builders';
3
- export * from './libs/rest/src';
4
- export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum } from './constants';
1
+ export * from './instance/Instance';
2
+ export * from './builders';
3
+ export * from './libs/rest/src';
4
+ export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum } from './constants';
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.CMSSubscriptionVersionEnum = exports.CADSubscriptionVersionEnum = exports.productEnums = void 0;
18
- __exportStar(require("./instance/Instance"), exports);
19
- __exportStar(require("./builders"), exports);
20
- __exportStar(require("./libs/rest/src"), exports);
21
- var constants_1 = require("./constants");
22
- Object.defineProperty(exports, "productEnums", { enumerable: true, get: function () { return constants_1.productEnums; } });
23
- Object.defineProperty(exports, "CADSubscriptionVersionEnum", { enumerable: true, get: function () { return constants_1.CADSubscriptionVersionEnum; } });
24
- Object.defineProperty(exports, "CMSSubscriptionVersionEnum", { enumerable: true, get: function () { return constants_1.CMSSubscriptionVersionEnum; } });
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.CMSSubscriptionVersionEnum = exports.CADSubscriptionVersionEnum = exports.productEnums = void 0;
18
+ __exportStar(require("./instance/Instance"), exports);
19
+ __exportStar(require("./builders"), exports);
20
+ __exportStar(require("./libs/rest/src"), exports);
21
+ var constants_1 = require("./constants");
22
+ Object.defineProperty(exports, "productEnums", { enumerable: true, get: function () { return constants_1.productEnums; } });
23
+ Object.defineProperty(exports, "CADSubscriptionVersionEnum", { enumerable: true, get: function () { return constants_1.CADSubscriptionVersionEnum; } });
24
+ Object.defineProperty(exports, "CMSSubscriptionVersionEnum", { enumerable: true, get: function () { return constants_1.CMSSubscriptionVersionEnum; } });
@@ -1,24 +1,24 @@
1
- /// <reference types="node" />
2
- import EventEmitter from 'events';
3
- import * as InstanceTypes from './instance.types';
4
- import { CADManager } from '../managers/CADManager';
5
- import { CMSManager } from '../managers/CMSManager';
6
- export declare class Instance extends EventEmitter {
7
- cadCommunityId: string | undefined;
8
- cadApiKey: string | undefined;
9
- cadApiUrl: string;
10
- cadDefaultServerId: number;
11
- isCADSuccessful: boolean;
12
- cmsCommunityId: string | undefined;
13
- cmsApiKey: string | undefined;
14
- cmsApiUrl: string;
15
- cmsDefaultServerId: number;
16
- isCMSSuccessful: boolean;
17
- cad: CADManager | undefined;
18
- cms: CMSManager | undefined;
19
- debug: boolean;
20
- apiHeaders: HeadersInit;
21
- constructor(options: InstanceTypes.InstanceOptions);
22
- private initialize;
23
- _debugLog(message: string): void;
24
- }
1
+ /// <reference types="node" />
2
+ import EventEmitter from 'events';
3
+ import * as InstanceTypes from './instance.types';
4
+ import { CADManager } from '../managers/CADManager';
5
+ import { CMSManager } from '../managers/CMSManager';
6
+ export declare class Instance extends EventEmitter {
7
+ cadCommunityId: string | undefined;
8
+ cadApiKey: string | undefined;
9
+ cadApiUrl: string;
10
+ cadDefaultServerId: number;
11
+ isCADSuccessful: boolean;
12
+ cmsCommunityId: string | undefined;
13
+ cmsApiKey: string | undefined;
14
+ cmsApiUrl: string;
15
+ cmsDefaultServerId: number;
16
+ isCMSSuccessful: boolean;
17
+ cad: CADManager | undefined;
18
+ cms: CMSManager | undefined;
19
+ debug: boolean;
20
+ apiHeaders: HeadersInit;
21
+ constructor(options: InstanceTypes.InstanceOptions);
22
+ private initialize;
23
+ _debugLog(message: string): void;
24
+ }
@@ -1,139 +1,139 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Instance = void 0;
30
- const events_1 = __importDefault(require("events"));
31
- const globalTypes = __importStar(require("../constants"));
32
- const CADManager_1 = require("../managers/CADManager");
33
- const CMSManager_1 = require("../managers/CMSManager");
34
- const utils_1 = require("../utils");
35
- class Instance extends events_1.default {
36
- constructor(options) {
37
- super({ captureRejections: true });
38
- this.cadApiUrl = 'https://api.sonorancad.com';
39
- this.cadDefaultServerId = 1;
40
- this.isCADSuccessful = false;
41
- this.cmsApiUrl = 'https://api.sonorancms.com';
42
- this.cmsDefaultServerId = 1;
43
- this.isCMSSuccessful = false;
44
- this.debug = false;
45
- this.apiHeaders = {};
46
- if (options.debug) {
47
- this.debug = options.debug;
48
- }
49
- if (Object.prototype.hasOwnProperty.call(options, 'apiHeaders') && options.apiHeaders !== undefined) {
50
- this.apiHeaders = options.apiHeaders;
51
- }
52
- if (Object.prototype.hasOwnProperty.call(options, 'apiKey') && Object.prototype.hasOwnProperty.call(options, 'communityId')) {
53
- if (Object.prototype.hasOwnProperty.call(options, 'product')) {
54
- switch (options.product) {
55
- case globalTypes.productEnums.CAD: {
56
- this.cadCommunityId = options.communityId;
57
- this.cadApiKey = options.apiKey;
58
- if (options.serverId !== undefined) {
59
- this._debugLog(`Overriding default server id... ${options.serverId}`);
60
- this.cadDefaultServerId = options.serverId;
61
- }
62
- if (Object.prototype.hasOwnProperty.call(options, 'cadApiUrl') && typeof options.cadApiUrl === 'string') {
63
- this._debugLog(`Overriding CAD API Url... ${options.cadApiUrl}`);
64
- this.cadApiUrl = options.cadApiUrl;
65
- }
66
- this._debugLog('About to initialize instance.');
67
- this.initialize();
68
- break;
69
- }
70
- case globalTypes.productEnums.CMS: {
71
- this.cmsCommunityId = options.communityId;
72
- this.cmsApiKey = options.apiKey;
73
- if (options.serverId !== undefined) {
74
- this._debugLog(`Overriding default server id... ${options.serverId}`);
75
- this.cmsDefaultServerId = options.serverId;
76
- }
77
- if (Object.prototype.hasOwnProperty.call(options, 'cmsApiUrl') && typeof options.cmsApiUrl === 'string') {
78
- this._debugLog(`Overriding CMS API URL... ${options.cmsApiUrl}`);
79
- this.cmsApiUrl = options.cmsApiUrl;
80
- }
81
- this.initialize();
82
- break;
83
- }
84
- default: {
85
- throw new Error('Invalid product enum given for constructor.');
86
- }
87
- }
88
- }
89
- else {
90
- throw new Error('No product enum given when instancing.');
91
- }
92
- }
93
- else {
94
- this.cadCommunityId = options.cadCommunityId;
95
- this.cadApiKey = options.cadApiKey;
96
- this.cmsCommunityId = options.cmsCommunityId;
97
- this.cmsApiKey = options.cmsApiKey;
98
- if (options.cadDefaultServerId !== undefined) {
99
- this._debugLog(`Overriding default CAD server id... ${options.serverId}`);
100
- this.cadDefaultServerId = options.cadDefaultServerId;
101
- }
102
- if (options.cmsDefaultServerId !== undefined) {
103
- this._debugLog(`Overriding default CMS server id... ${options.serverId}`);
104
- this.cmsDefaultServerId = options.cmsDefaultServerId;
105
- }
106
- if (Object.prototype.hasOwnProperty.call(options, 'cadApiUrl') && typeof options.cadApiUrl === 'string') {
107
- this._debugLog(`Overriding CAD API Url... ${options.cadApiUrl}`);
108
- this.cadApiUrl = options.cadApiUrl;
109
- }
110
- if (Object.prototype.hasOwnProperty.call(options, 'cmsApiUrl') && typeof options.cmsApiUrl === 'string') {
111
- this._debugLog(`Overriding CMS API URL... ${options.cmsApiUrl}`);
112
- this.cmsApiUrl = options.cmsApiUrl;
113
- }
114
- this.initialize();
115
- }
116
- }
117
- initialize() {
118
- if (this.cadCommunityId && this.cadApiKey && this.cadApiUrl) {
119
- this._debugLog('About to initialize CAD Manager');
120
- this.cad = new CADManager_1.CADManager(this);
121
- }
122
- else {
123
- this._debugLog('Not initializing CAD Manager due to a missing community id, api key, or api url.');
124
- }
125
- if (this.cmsCommunityId && this.cmsApiKey && this.cmsApiUrl) {
126
- this._debugLog('About to initialize CMS Manager');
127
- this.cms = new CMSManager_1.CMSManager(this);
128
- }
129
- else {
130
- this._debugLog('Not initializing CMS Manager due to a missing community id, api key, or api url.');
131
- }
132
- }
133
- _debugLog(message) {
134
- if (this.debug) {
135
- (0, utils_1.debugLog)(message);
136
- }
137
- }
138
- }
139
- exports.Instance = Instance;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Instance = void 0;
30
+ const events_1 = __importDefault(require("events"));
31
+ const globalTypes = __importStar(require("../constants"));
32
+ const CADManager_1 = require("../managers/CADManager");
33
+ const CMSManager_1 = require("../managers/CMSManager");
34
+ const utils_1 = require("../utils");
35
+ class Instance extends events_1.default {
36
+ constructor(options) {
37
+ super({ captureRejections: true });
38
+ this.cadApiUrl = 'https://api.sonorancad.com';
39
+ this.cadDefaultServerId = 1;
40
+ this.isCADSuccessful = false;
41
+ this.cmsApiUrl = 'https://api.sonorancms.com';
42
+ this.cmsDefaultServerId = 1;
43
+ this.isCMSSuccessful = false;
44
+ this.debug = false;
45
+ this.apiHeaders = {};
46
+ if (options.debug) {
47
+ this.debug = options.debug;
48
+ }
49
+ if (Object.prototype.hasOwnProperty.call(options, 'apiHeaders') && options.apiHeaders !== undefined) {
50
+ this.apiHeaders = options.apiHeaders;
51
+ }
52
+ if (Object.prototype.hasOwnProperty.call(options, 'apiKey') && Object.prototype.hasOwnProperty.call(options, 'communityId')) {
53
+ if (Object.prototype.hasOwnProperty.call(options, 'product')) {
54
+ switch (options.product) {
55
+ case globalTypes.productEnums.CAD: {
56
+ this.cadCommunityId = options.communityId;
57
+ this.cadApiKey = options.apiKey;
58
+ if (options.serverId !== undefined) {
59
+ this._debugLog(`Overriding default server id... ${options.serverId}`);
60
+ this.cadDefaultServerId = options.serverId;
61
+ }
62
+ if (Object.prototype.hasOwnProperty.call(options, 'cadApiUrl') && typeof options.cadApiUrl === 'string') {
63
+ this._debugLog(`Overriding CAD API Url... ${options.cadApiUrl}`);
64
+ this.cadApiUrl = options.cadApiUrl;
65
+ }
66
+ this._debugLog('About to initialize instance.');
67
+ this.initialize();
68
+ break;
69
+ }
70
+ case globalTypes.productEnums.CMS: {
71
+ this.cmsCommunityId = options.communityId;
72
+ this.cmsApiKey = options.apiKey;
73
+ if (options.serverId !== undefined) {
74
+ this._debugLog(`Overriding default server id... ${options.serverId}`);
75
+ this.cmsDefaultServerId = options.serverId;
76
+ }
77
+ if (Object.prototype.hasOwnProperty.call(options, 'cmsApiUrl') && typeof options.cmsApiUrl === 'string') {
78
+ this._debugLog(`Overriding CMS API URL... ${options.cmsApiUrl}`);
79
+ this.cmsApiUrl = options.cmsApiUrl;
80
+ }
81
+ this.initialize();
82
+ break;
83
+ }
84
+ default: {
85
+ throw new Error('Invalid product enum given for constructor.');
86
+ }
87
+ }
88
+ }
89
+ else {
90
+ throw new Error('No product enum given when instancing.');
91
+ }
92
+ }
93
+ else {
94
+ this.cadCommunityId = options.cadCommunityId;
95
+ this.cadApiKey = options.cadApiKey;
96
+ this.cmsCommunityId = options.cmsCommunityId;
97
+ this.cmsApiKey = options.cmsApiKey;
98
+ if (options.cadDefaultServerId !== undefined) {
99
+ this._debugLog(`Overriding default CAD server id... ${options.serverId}`);
100
+ this.cadDefaultServerId = options.cadDefaultServerId;
101
+ }
102
+ if (options.cmsDefaultServerId !== undefined) {
103
+ this._debugLog(`Overriding default CMS server id... ${options.serverId}`);
104
+ this.cmsDefaultServerId = options.cmsDefaultServerId;
105
+ }
106
+ if (Object.prototype.hasOwnProperty.call(options, 'cadApiUrl') && typeof options.cadApiUrl === 'string') {
107
+ this._debugLog(`Overriding CAD API Url... ${options.cadApiUrl}`);
108
+ this.cadApiUrl = options.cadApiUrl;
109
+ }
110
+ if (Object.prototype.hasOwnProperty.call(options, 'cmsApiUrl') && typeof options.cmsApiUrl === 'string') {
111
+ this._debugLog(`Overriding CMS API URL... ${options.cmsApiUrl}`);
112
+ this.cmsApiUrl = options.cmsApiUrl;
113
+ }
114
+ this.initialize();
115
+ }
116
+ }
117
+ initialize() {
118
+ if (this.cadCommunityId && this.cadApiKey && this.cadApiUrl) {
119
+ this._debugLog('About to initialize CAD Manager');
120
+ this.cad = new CADManager_1.CADManager(this);
121
+ }
122
+ else {
123
+ this._debugLog('Not initializing CAD Manager due to a missing community id, api key, or api url.');
124
+ }
125
+ if (this.cmsCommunityId && this.cmsApiKey && this.cmsApiUrl) {
126
+ this._debugLog('About to initialize CMS Manager');
127
+ this.cms = new CMSManager_1.CMSManager(this);
128
+ }
129
+ else {
130
+ this._debugLog('Not initializing CMS Manager due to a missing community id, api key, or api url.');
131
+ }
132
+ }
133
+ _debugLog(message) {
134
+ if (this.debug) {
135
+ (0, utils_1.debugLog)(message);
136
+ }
137
+ }
138
+ }
139
+ exports.Instance = Instance;
@@ -1,17 +1,17 @@
1
- import * as globalTypes from '../constants';
2
- export type InstanceOptions = {
3
- communityId?: string;
4
- apiKey?: string;
5
- product?: globalTypes.productEnums;
6
- serverId?: number;
7
- cadCommunityId?: string;
8
- cadApiKey?: string;
9
- cadApiUrl?: string;
10
- cadDefaultServerId?: number;
11
- cmsCommunityId?: string;
12
- cmsApiKey?: string;
13
- cmsApiUrl?: string;
14
- cmsDefaultServerId?: number;
15
- debug?: boolean;
16
- apiHeaders?: HeadersInit;
17
- };
1
+ import * as globalTypes from '../constants';
2
+ export type InstanceOptions = {
3
+ communityId?: string;
4
+ apiKey?: string;
5
+ product?: globalTypes.productEnums;
6
+ serverId?: number;
7
+ cadCommunityId?: string;
8
+ cadApiKey?: string;
9
+ cadApiUrl?: string;
10
+ cadDefaultServerId?: number;
11
+ cmsCommunityId?: string;
12
+ cmsApiKey?: string;
13
+ cmsApiUrl?: string;
14
+ cmsDefaultServerId?: number;
15
+ debug?: boolean;
16
+ apiHeaders?: HeadersInit;
17
+ };
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
- export * from './lib/errors/APIError';
2
- export * from './lib/errors/HTTPError';
3
- export * from './lib/errors/RateLimitError';
4
- export * from './lib/RequestManager';
5
- export * from './lib/REST';
6
- export * from './lib/utils/constants';
1
+ export * from './lib/errors/APIError';
2
+ export * from './lib/errors/HTTPError';
3
+ export * from './lib/errors/RateLimitError';
4
+ export * from './lib/RequestManager';
5
+ export * from './lib/REST';
6
+ export * from './lib/utils/constants';
@@ -1,22 +1,22 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./lib/errors/APIError"), exports);
18
- __exportStar(require("./lib/errors/HTTPError"), exports);
19
- __exportStar(require("./lib/errors/RateLimitError"), exports);
20
- __exportStar(require("./lib/RequestManager"), exports);
21
- __exportStar(require("./lib/REST"), exports);
22
- __exportStar(require("./lib/utils/constants"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib/errors/APIError"), exports);
18
+ __exportStar(require("./lib/errors/HTTPError"), exports);
19
+ __exportStar(require("./lib/errors/RateLimitError"), exports);
20
+ __exportStar(require("./lib/RequestManager"), exports);
21
+ __exportStar(require("./lib/REST"), exports);
22
+ __exportStar(require("./lib/utils/constants"), exports);