@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,191 +1,191 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RequestManager = void 0;
4
- const collection_1 = require("@discordjs/collection");
5
- // import { DiscordSnowflake } from '@sapphire/snowflake';
6
- const events_1 = require("events");
7
- const constants_1 = require("./utils/constants");
8
- const constants_2 = require("../../../../constants");
9
- const SequentialHandler_1 = require("./handlers/SequentialHandler");
10
- const utils_1 = require("../../../../utils/utils");
11
- class RequestManager extends events_1.EventEmitter {
12
- constructor(_instance, _product, options) {
13
- super();
14
- this.ratelimitedTypes = new collection_1.Collection();
15
- this.handlers = new collection_1.Collection();
16
- this.product = _product;
17
- this.instance = _instance;
18
- switch (_product) {
19
- case constants_2.productEnums.CAD: {
20
- this.options = { ...constants_1.DefaultCADRestOptions, ...options };
21
- break;
22
- }
23
- case constants_2.productEnums.CMS: {
24
- this.options = { ...constants_1.DefaultCMSRestOptions, ...options };
25
- break;
26
- }
27
- default: {
28
- throw new Error('No Product provided for RequestManager initialization');
29
- }
30
- }
31
- }
32
- async queueRequest(request) {
33
- var _a;
34
- let requestData = request;
35
- const resolvedData = RequestManager.resolveRequestData(this.instance, request.type, request.product, requestData);
36
- const handler = (_a = this.handlers.get(`${resolvedData.typePath}:${String(request.product)}`)) !== null && _a !== void 0 ? _a : this.createHandler(resolvedData);
37
- return handler.queueRequest(resolvedData.fullUrl, resolvedData.fetchOptions, resolvedData);
38
- }
39
- onRateLimit(id, rateLimitData) {
40
- this.ratelimitedTypes.set(id, rateLimitData);
41
- }
42
- removeRateLimit(id) {
43
- this.ratelimitedTypes.delete(id);
44
- }
45
- createHandler(data) {
46
- const queue = new SequentialHandler_1.SequentialHandler(this, data);
47
- this.handlers.set(queue.id, queue);
48
- return queue;
49
- }
50
- static resolveRequestData(instance, type, product, data) {
51
- let apiURL = false;
52
- let apiData = {
53
- requestTypeId: `${type}:${String(product)}`,
54
- typePath: '',
55
- fullUrl: '',
56
- method: '',
57
- fetchOptions: {},
58
- data,
59
- product,
60
- type
61
- };
62
- switch (product) {
63
- case constants_2.productEnums.CAD:
64
- apiURL = instance.cadApiUrl;
65
- break;
66
- case constants_2.productEnums.CMS:
67
- apiURL = instance.cmsApiUrl;
68
- break;
69
- }
70
- const findType = constants_1.AllAPITypes.find((_type) => _type.type === type);
71
- if (findType) {
72
- apiData.fullUrl = `${apiURL}/${findType.path}`;
73
- apiData.method = findType.method;
74
- apiData.fetchOptions.method = findType.method;
75
- apiData.typePath = findType.path;
76
- const clonedData = (0, utils_1.cloneObject)(data.data);
77
- switch (findType.type) {
78
- case 'SET_SERVERS': {
79
- apiData.data.data = clonedData;
80
- break;
81
- }
82
- case 'SET_PENAL_CODES': {
83
- apiData.data.data = [clonedData[0]];
84
- break;
85
- }
86
- case 'SET_API_ID': {
87
- apiData.data.data = [clonedData[0]];
88
- break;
89
- }
90
- case 'NEW_RECORD': {
91
- apiData.data.data = [clonedData[0]];
92
- break;
93
- }
94
- case 'EDIT_RECORD': {
95
- apiData.data.data = [clonedData[0]];
96
- break;
97
- }
98
- case 'LOOKUP_INT': {
99
- apiData.data.data = [clonedData[0]];
100
- break;
101
- }
102
- case 'LOOKUP': {
103
- apiData.data.data = [clonedData[0]];
104
- break;
105
- }
106
- case 'SET_ACCOUNT_PERMISSIONS': {
107
- apiData.data.data = [clonedData[0]];
108
- break;
109
- }
110
- case 'BAN_USER': {
111
- apiData.data.data = [clonedData[0]];
112
- break;
113
- }
114
- case 'AUTH_STREETSIGNS': {
115
- apiData.data.data = clonedData;
116
- break;
117
- }
118
- case 'SET_POSTALS': {
119
- apiData.data.data = [clonedData[0]];
120
- break;
121
- }
122
- case 'NEW_CHARACTER': {
123
- apiData.data.data = [clonedData[0]];
124
- break;
125
- }
126
- case 'EDIT_CHARACTER': {
127
- apiData.data.data = [clonedData[0]];
128
- break;
129
- }
130
- case 'MODIFY_IDENTIFIER': {
131
- apiData.data.data = [clonedData[0]];
132
- break;
133
- }
134
- case 'ADD_BLIP': {
135
- apiData.data.data = [clonedData[0]];
136
- break;
137
- }
138
- case 'MODIFY_BLIP': {
139
- apiData.data.data = [clonedData[0]];
140
- break;
141
- }
142
- case 'GET_CALLS': {
143
- apiData.data.data = [clonedData[0]];
144
- break;
145
- }
146
- case 'GET_ACTIVE_UNITS': {
147
- apiData.data.data = [clonedData[0]];
148
- break;
149
- }
150
- case 'NEW_DISPATCH': {
151
- apiData.data.data = [clonedData[0]];
152
- break;
153
- }
154
- case 'UNIT_LOCATION': {
155
- apiData.data.data = [clonedData[0]];
156
- break;
157
- }
158
- default: {
159
- if (data.data) {
160
- if (Array.isArray(data.data)) {
161
- if (data.data.length > 0) {
162
- apiData.data.data = [clonedData];
163
- }
164
- else {
165
- apiData.data.data = [];
166
- }
167
- }
168
- else {
169
- apiData.data.data = [clonedData];
170
- }
171
- }
172
- else {
173
- apiData.data.data = [];
174
- }
175
- break;
176
- }
177
- }
178
- }
179
- apiData.fetchOptions.body = JSON.stringify(apiData.data);
180
- apiData.fetchOptions.headers = {
181
- 'Accept': 'application/json',
182
- 'Content-Type': 'application/json',
183
- ...instance.apiHeaders
184
- };
185
- return apiData;
186
- }
187
- debug(log) {
188
- return this.instance._debugLog(log);
189
- }
190
- }
191
- exports.RequestManager = RequestManager;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestManager = void 0;
4
+ const collection_1 = require("@discordjs/collection");
5
+ // import { DiscordSnowflake } from '@sapphire/snowflake';
6
+ const events_1 = require("events");
7
+ const constants_1 = require("./utils/constants");
8
+ const constants_2 = require("../../../../constants");
9
+ const SequentialHandler_1 = require("./handlers/SequentialHandler");
10
+ const utils_1 = require("../../../../utils/utils");
11
+ class RequestManager extends events_1.EventEmitter {
12
+ constructor(_instance, _product, options) {
13
+ super();
14
+ this.ratelimitedTypes = new collection_1.Collection();
15
+ this.handlers = new collection_1.Collection();
16
+ this.product = _product;
17
+ this.instance = _instance;
18
+ switch (_product) {
19
+ case constants_2.productEnums.CAD: {
20
+ this.options = { ...constants_1.DefaultCADRestOptions, ...options };
21
+ break;
22
+ }
23
+ case constants_2.productEnums.CMS: {
24
+ this.options = { ...constants_1.DefaultCMSRestOptions, ...options };
25
+ break;
26
+ }
27
+ default: {
28
+ throw new Error('No Product provided for RequestManager initialization');
29
+ }
30
+ }
31
+ }
32
+ async queueRequest(request) {
33
+ var _a;
34
+ let requestData = request;
35
+ const resolvedData = RequestManager.resolveRequestData(this.instance, request.type, request.product, requestData);
36
+ const handler = (_a = this.handlers.get(`${resolvedData.typePath}:${String(request.product)}`)) !== null && _a !== void 0 ? _a : this.createHandler(resolvedData);
37
+ return handler.queueRequest(resolvedData.fullUrl, resolvedData.fetchOptions, resolvedData);
38
+ }
39
+ onRateLimit(id, rateLimitData) {
40
+ this.ratelimitedTypes.set(id, rateLimitData);
41
+ }
42
+ removeRateLimit(id) {
43
+ this.ratelimitedTypes.delete(id);
44
+ }
45
+ createHandler(data) {
46
+ const queue = new SequentialHandler_1.SequentialHandler(this, data);
47
+ this.handlers.set(queue.id, queue);
48
+ return queue;
49
+ }
50
+ static resolveRequestData(instance, type, product, data) {
51
+ let apiURL = false;
52
+ let apiData = {
53
+ requestTypeId: `${type}:${String(product)}`,
54
+ typePath: '',
55
+ fullUrl: '',
56
+ method: '',
57
+ fetchOptions: {},
58
+ data,
59
+ product,
60
+ type
61
+ };
62
+ switch (product) {
63
+ case constants_2.productEnums.CAD:
64
+ apiURL = instance.cadApiUrl;
65
+ break;
66
+ case constants_2.productEnums.CMS:
67
+ apiURL = instance.cmsApiUrl;
68
+ break;
69
+ }
70
+ const findType = constants_1.AllAPITypes.find((_type) => _type.type === type);
71
+ if (findType) {
72
+ apiData.fullUrl = `${apiURL}/${findType.path}`;
73
+ apiData.method = findType.method;
74
+ apiData.fetchOptions.method = findType.method;
75
+ apiData.typePath = findType.path;
76
+ const clonedData = (0, utils_1.cloneObject)(data.data);
77
+ switch (findType.type) {
78
+ case 'SET_SERVERS': {
79
+ apiData.data.data = clonedData;
80
+ break;
81
+ }
82
+ case 'SET_PENAL_CODES': {
83
+ apiData.data.data = [clonedData[0]];
84
+ break;
85
+ }
86
+ case 'SET_API_ID': {
87
+ apiData.data.data = [clonedData[0]];
88
+ break;
89
+ }
90
+ case 'NEW_RECORD': {
91
+ apiData.data.data = [clonedData[0]];
92
+ break;
93
+ }
94
+ case 'EDIT_RECORD': {
95
+ apiData.data.data = [clonedData[0]];
96
+ break;
97
+ }
98
+ case 'LOOKUP_INT': {
99
+ apiData.data.data = [clonedData[0]];
100
+ break;
101
+ }
102
+ case 'LOOKUP': {
103
+ apiData.data.data = [clonedData[0]];
104
+ break;
105
+ }
106
+ case 'SET_ACCOUNT_PERMISSIONS': {
107
+ apiData.data.data = [clonedData[0]];
108
+ break;
109
+ }
110
+ case 'BAN_USER': {
111
+ apiData.data.data = [clonedData[0]];
112
+ break;
113
+ }
114
+ case 'AUTH_STREETSIGNS': {
115
+ apiData.data.data = clonedData;
116
+ break;
117
+ }
118
+ case 'SET_POSTALS': {
119
+ apiData.data.data = [clonedData[0]];
120
+ break;
121
+ }
122
+ case 'NEW_CHARACTER': {
123
+ apiData.data.data = [clonedData[0]];
124
+ break;
125
+ }
126
+ case 'EDIT_CHARACTER': {
127
+ apiData.data.data = [clonedData[0]];
128
+ break;
129
+ }
130
+ case 'MODIFY_IDENTIFIER': {
131
+ apiData.data.data = [clonedData[0]];
132
+ break;
133
+ }
134
+ case 'ADD_BLIP': {
135
+ apiData.data.data = [clonedData[0]];
136
+ break;
137
+ }
138
+ case 'MODIFY_BLIP': {
139
+ apiData.data.data = [clonedData[0]];
140
+ break;
141
+ }
142
+ case 'GET_CALLS': {
143
+ apiData.data.data = [clonedData[0]];
144
+ break;
145
+ }
146
+ case 'GET_ACTIVE_UNITS': {
147
+ apiData.data.data = [clonedData[0]];
148
+ break;
149
+ }
150
+ case 'NEW_DISPATCH': {
151
+ apiData.data.data = [clonedData[0]];
152
+ break;
153
+ }
154
+ case 'UNIT_LOCATION': {
155
+ apiData.data.data = [clonedData[0]];
156
+ break;
157
+ }
158
+ default: {
159
+ if (data.data) {
160
+ if (Array.isArray(data.data)) {
161
+ if (data.data.length > 0) {
162
+ apiData.data.data = [clonedData];
163
+ }
164
+ else {
165
+ apiData.data.data = [];
166
+ }
167
+ }
168
+ else {
169
+ apiData.data.data = [clonedData];
170
+ }
171
+ }
172
+ else {
173
+ apiData.data.data = [];
174
+ }
175
+ break;
176
+ }
177
+ }
178
+ }
179
+ apiData.fetchOptions.body = JSON.stringify(apiData.data);
180
+ apiData.fetchOptions.headers = {
181
+ 'Accept': 'application/json',
182
+ 'Content-Type': 'application/json',
183
+ ...instance.apiHeaders
184
+ };
185
+ return apiData;
186
+ }
187
+ debug(log) {
188
+ return this.instance._debugLog(log);
189
+ }
190
+ }
191
+ exports.RequestManager = RequestManager;
@@ -1,9 +1,9 @@
1
- export declare class APIError extends Error {
2
- response: string;
3
- requestType: string;
4
- requestUrl: string;
5
- responseCode: number;
6
- requestData: any;
7
- constructor(response: string, requestType: string, requestUrl: string, responseCode: number, requestData: any);
8
- get name(): string;
9
- }
1
+ export declare class APIError extends Error {
2
+ response: string;
3
+ requestType: string;
4
+ requestUrl: string;
5
+ responseCode: number;
6
+ requestData: any;
7
+ constructor(response: string, requestType: string, requestUrl: string, responseCode: number, requestData: any);
8
+ get name(): string;
9
+ }
@@ -1,17 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APIError = void 0;
4
- class APIError extends Error {
5
- constructor(response, requestType, requestUrl, responseCode, requestData) {
6
- super(response);
7
- this.response = response;
8
- this.requestType = requestType;
9
- this.requestUrl = requestUrl;
10
- this.responseCode = responseCode;
11
- this.requestData = requestData;
12
- }
13
- get name() {
14
- return `Sonoran.js API Error - ${this.requestType} [${this.responseCode}]`;
15
- }
16
- }
17
- exports.APIError = APIError;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APIError = void 0;
4
+ class APIError extends Error {
5
+ constructor(response, requestType, requestUrl, responseCode, requestData) {
6
+ super(response);
7
+ this.response = response;
8
+ this.requestType = requestType;
9
+ this.requestUrl = requestUrl;
10
+ this.responseCode = responseCode;
11
+ this.requestData = requestData;
12
+ }
13
+ get name() {
14
+ return `Sonoran.js API Error - ${this.requestType} [${this.responseCode}]`;
15
+ }
16
+ }
17
+ exports.APIError = APIError;
@@ -1,17 +1,17 @@
1
- /**
2
- * Represents a HTTP error
3
- */
4
- export declare class HTTPError extends Error {
5
- name: string;
6
- status: number;
7
- method: string;
8
- url: string;
9
- /**
10
- * @param message The error message
11
- * @param name The name of the error
12
- * @param status The status code of the response
13
- * @param method The method of the request that erred
14
- * @param url The url of the request that erred
15
- */
16
- constructor(message: string, name: string, status: number, method: string, url: string);
17
- }
1
+ /**
2
+ * Represents a HTTP error
3
+ */
4
+ export declare class HTTPError extends Error {
5
+ name: string;
6
+ status: number;
7
+ method: string;
8
+ url: string;
9
+ /**
10
+ * @param message The error message
11
+ * @param name The name of the error
12
+ * @param status The status code of the response
13
+ * @param method The method of the request that erred
14
+ * @param url The url of the request that erred
15
+ */
16
+ constructor(message: string, name: string, status: number, method: string, url: string);
17
+ }
@@ -1,23 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HTTPError = void 0;
4
- /**
5
- * Represents a HTTP error
6
- */
7
- class HTTPError extends Error {
8
- /**
9
- * @param message The error message
10
- * @param name The name of the error
11
- * @param status The status code of the response
12
- * @param method The method of the request that erred
13
- * @param url The url of the request that erred
14
- */
15
- constructor(message, name, status, method, url) {
16
- super(message);
17
- this.name = name;
18
- this.status = status;
19
- this.method = method;
20
- this.url = url;
21
- }
22
- }
23
- exports.HTTPError = HTTPError;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HTTPError = void 0;
4
+ /**
5
+ * Represents a HTTP error
6
+ */
7
+ class HTTPError extends Error {
8
+ /**
9
+ * @param message The error message
10
+ * @param name The name of the error
11
+ * @param status The status code of the response
12
+ * @param method The method of the request that erred
13
+ * @param url The url of the request that erred
14
+ */
15
+ constructor(message, name, status, method, url) {
16
+ super(message);
17
+ this.name = name;
18
+ this.status = status;
19
+ this.method = method;
20
+ this.url = url;
21
+ }
22
+ }
23
+ exports.HTTPError = HTTPError;
@@ -1,13 +1,13 @@
1
- /// <reference types="node" />
2
- import type { RateLimitData } from '../REST';
3
- import { productEnums } from '../../../../../constants';
4
- export declare class RateLimitError extends Error implements RateLimitData {
5
- product: productEnums;
6
- type: string;
7
- timeTill: NodeJS.Timer;
8
- constructor({ product, type, timeTill }: RateLimitData);
9
- /**
10
- * The name of the error
11
- */
12
- get name(): string;
13
- }
1
+ /// <reference types="node" />
2
+ import type { RateLimitData } from '../REST';
3
+ import { productEnums } from '../../../../../constants';
4
+ export declare class RateLimitError extends Error implements RateLimitData {
5
+ product: productEnums;
6
+ type: string;
7
+ timeTill: NodeJS.Timer;
8
+ constructor({ product, type, timeTill }: RateLimitData);
9
+ /**
10
+ * The name of the error
11
+ */
12
+ get name(): string;
13
+ }
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RateLimitError = void 0;
4
- const constants_1 = require("../../../../../constants");
5
- class RateLimitError extends Error {
6
- constructor({ product, type, timeTill }) {
7
- super();
8
- this.product = product;
9
- this.type = type;
10
- this.timeTill = timeTill;
11
- }
12
- /**
13
- * The name of the error
14
- */
15
- get name() {
16
- return `Ratelimit Hit - [${this.product === constants_1.productEnums.CAD ? 'Sonoran CAD' : this.product === constants_1.productEnums.CMS ? 'Sonoran CMS' : 'Invalid Product'} '${this.type}']`;
17
- }
18
- }
19
- exports.RateLimitError = RateLimitError;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RateLimitError = void 0;
4
+ const constants_1 = require("../../../../../constants");
5
+ class RateLimitError extends Error {
6
+ constructor({ product, type, timeTill }) {
7
+ super();
8
+ this.product = product;
9
+ this.type = type;
10
+ this.timeTill = timeTill;
11
+ }
12
+ /**
13
+ * The name of the error
14
+ */
15
+ get name() {
16
+ return `Ratelimit Hit - [${this.product === constants_1.productEnums.CAD ? 'Sonoran CAD' : this.product === constants_1.productEnums.CMS ? 'Sonoran CMS' : 'Invalid Product'} '${this.type}']`;
17
+ }
18
+ }
19
+ exports.RateLimitError = RateLimitError;
@@ -1,4 +1,4 @@
1
- export * from './APIError';
2
- export * from './APIError';
3
- export * from './HTTPError';
4
- export * from './RateLimitError';
1
+ export * from './APIError';
2
+ export * from './APIError';
3
+ export * from './HTTPError';
4
+ export * from './RateLimitError';
@@ -1,20 +1,20 @@
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("./APIError"), exports);
18
- __exportStar(require("./APIError"), exports);
19
- __exportStar(require("./HTTPError"), exports);
20
- __exportStar(require("./RateLimitError"), 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("./APIError"), exports);
18
+ __exportStar(require("./APIError"), exports);
19
+ __exportStar(require("./HTTPError"), exports);
20
+ __exportStar(require("./RateLimitError"), exports);
@@ -1,7 +1,7 @@
1
- import type { RequestInit } from 'node-fetch';
2
- import type { APIData } from '../RequestManager';
3
- export interface IHandler {
4
- queueRequest: (url: string, options: RequestInit, data: APIData) => Promise<unknown>;
5
- get inactive(): boolean;
6
- readonly id: string;
7
- }
1
+ import type { RequestInit } from 'node-fetch';
2
+ import type { APIData } from '../RequestManager';
3
+ export interface IHandler {
4
+ queueRequest: (url: string, options: RequestInit, data: APIData) => Promise<unknown>;
5
+ get inactive(): boolean;
6
+ readonly id: string;
7
+ }