@sonoransoftware/sonoran.js 1.0.34 → 1.0.35
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.
- package/.github/workflows/auto-pr-on-branch-push.yml +89 -0
- package/.github/workflows/codex_instructions.md +24 -0
- package/.github/workflows/push-pr-nudge-codex.yml +50 -0
- package/dist/constants.d.ts +200 -1
- package/dist/constants.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/instance/Instance.d.ts +6 -0
- package/dist/instance/Instance.js +27 -0
- package/dist/instance/instance.types.d.ts +3 -0
- package/dist/libs/rest/src/lib/REST.d.ts +2 -1
- package/dist/libs/rest/src/lib/REST.js +108 -0
- package/dist/libs/rest/src/lib/RequestManager.d.ts +2 -0
- package/dist/libs/rest/src/lib/RequestManager.js +201 -0
- package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -1
- package/dist/libs/rest/src/lib/utils/constants.d.ts +102 -22
- package/dist/libs/rest/src/lib/utils/constants.js +106 -2
- package/dist/managers/CADManager.d.ts +28 -0
- package/dist/managers/CADManager.js +90 -0
- package/dist/managers/CMSManager.d.ts +54 -0
- package/dist/managers/CMSManager.js +134 -0
- package/dist/managers/CMSServerManager.d.ts +3 -0
- package/dist/managers/CMSServerManager.js +36 -2
- package/dist/managers/RadioManager.d.ts +55 -0
- package/dist/managers/RadioManager.js +224 -0
- package/package.json +1 -1
- package/readme.md +170 -0
- package/src/constants.ts +232 -1
- package/src/index.ts +35 -1
- package/src/instance/Instance.ts +30 -1
- package/src/instance/instance.types.ts +4 -1
- package/src/libs/rest/src/lib/REST.ts +107 -1
- package/src/libs/rest/src/lib/RequestManager.ts +221 -10
- package/src/libs/rest/src/lib/errors/RateLimitError.ts +20 -2
- package/src/libs/rest/src/lib/utils/constants.ts +205 -24
- package/src/managers/CADManager.ts +86 -1
- package/src/managers/CMSManager.ts +121 -0
- package/src/managers/CMSServerManager.ts +39 -6
- package/src/managers/RadioManager.ts +187 -0
|
@@ -24,6 +24,10 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
24
24
|
this.options = { ...constants_1.DefaultCMSRestOptions, ...options };
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
|
+
case constants_2.productEnums.RADIO: {
|
|
28
|
+
this.options = { ...constants_1.DefaultRadioRestOptions, ...options };
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
27
31
|
default: {
|
|
28
32
|
throw new Error('No Product provided for RequestManager initialization');
|
|
29
33
|
}
|
|
@@ -66,9 +70,15 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
66
70
|
case constants_2.productEnums.CMS:
|
|
67
71
|
apiURL = instance.cmsApiUrl;
|
|
68
72
|
break;
|
|
73
|
+
case constants_2.productEnums.RADIO:
|
|
74
|
+
apiURL = instance.radioApiUrl;
|
|
75
|
+
break;
|
|
69
76
|
}
|
|
70
77
|
const findType = constants_1.AllAPITypes.find((_type) => _type.type === type);
|
|
71
78
|
if (findType) {
|
|
79
|
+
if (product === constants_2.productEnums.RADIO) {
|
|
80
|
+
return RequestManager.resolveRadioRequest(instance, apiURL, findType, data, apiData);
|
|
81
|
+
}
|
|
72
82
|
apiData.fullUrl = `${apiURL}/${findType.path}`;
|
|
73
83
|
apiData.method = findType.method;
|
|
74
84
|
apiData.fetchOptions.method = findType.method;
|
|
@@ -79,6 +89,10 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
79
89
|
apiData.data.data = clonedData;
|
|
80
90
|
break;
|
|
81
91
|
}
|
|
92
|
+
case 'SET_GAME_SERVERS': {
|
|
93
|
+
apiData.data.data = clonedData;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
82
96
|
case 'SET_PENAL_CODES': {
|
|
83
97
|
apiData.data.data = [clonedData[0]];
|
|
84
98
|
break;
|
|
@@ -119,6 +133,29 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
119
133
|
apiData.data.data = [clonedData[0]];
|
|
120
134
|
break;
|
|
121
135
|
}
|
|
136
|
+
case 'SET_CLOCK': {
|
|
137
|
+
apiData.data.data = Array.isArray(clonedData) ? clonedData : [clonedData];
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
case 'JOIN_COMMUNITY':
|
|
141
|
+
case 'LEAVE_COMMUNITY': {
|
|
142
|
+
const internalKey = clonedData === null || clonedData === void 0 ? void 0 : clonedData.internalKey;
|
|
143
|
+
if (internalKey !== undefined) {
|
|
144
|
+
apiData.data.internalKey = internalKey;
|
|
145
|
+
}
|
|
146
|
+
const accountsSource = clonedData === null || clonedData === void 0 ? void 0 : clonedData.accounts;
|
|
147
|
+
const accountsArray = Array.isArray(accountsSource) ? accountsSource : accountsSource ? [accountsSource] : [];
|
|
148
|
+
apiData.data.data = accountsArray.map((entry) => {
|
|
149
|
+
if (typeof entry === 'string') {
|
|
150
|
+
return { account: entry };
|
|
151
|
+
}
|
|
152
|
+
if (entry && typeof entry === 'object' && 'account' in entry) {
|
|
153
|
+
return entry;
|
|
154
|
+
}
|
|
155
|
+
return { account: String(entry) };
|
|
156
|
+
});
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
122
159
|
case 'NEW_CHARACTER': {
|
|
123
160
|
apiData.data.data = [clonedData[0]];
|
|
124
161
|
break;
|
|
@@ -184,6 +221,170 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
184
221
|
};
|
|
185
222
|
return apiData;
|
|
186
223
|
}
|
|
224
|
+
static resolveRadioRequest(instance, apiURL, apiType, request, apiData) {
|
|
225
|
+
var _a, _b, _c;
|
|
226
|
+
if (!apiURL || typeof apiURL !== 'string') {
|
|
227
|
+
throw new Error('Radio API URL could not be resolved for request.');
|
|
228
|
+
}
|
|
229
|
+
const rawData = request.data;
|
|
230
|
+
const payload = rawData == null ? {} : (typeof rawData === 'object' ? (0, utils_1.cloneObject)(rawData) : rawData);
|
|
231
|
+
const headers = {
|
|
232
|
+
Accept: 'application/json'
|
|
233
|
+
};
|
|
234
|
+
const applyHeaders = (source) => {
|
|
235
|
+
if (!source)
|
|
236
|
+
return;
|
|
237
|
+
if (Array.isArray(source)) {
|
|
238
|
+
for (const [key, value] of source) {
|
|
239
|
+
headers[key] = value;
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (typeof source === 'object' && source !== null && 'forEach' in source && typeof source.forEach === 'function') {
|
|
244
|
+
source.forEach((value, key) => {
|
|
245
|
+
headers[key] = value;
|
|
246
|
+
});
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
Object.assign(headers, source);
|
|
250
|
+
};
|
|
251
|
+
applyHeaders(instance.apiHeaders);
|
|
252
|
+
let method = apiType.method;
|
|
253
|
+
let path = apiType.path;
|
|
254
|
+
let body;
|
|
255
|
+
const ensureAuth = () => {
|
|
256
|
+
if (!request.id || !request.key) {
|
|
257
|
+
throw new Error('Community ID or API Key could not be found for request.');
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
id: request.id,
|
|
261
|
+
key: request.key,
|
|
262
|
+
encodedId: encodeURIComponent(request.id),
|
|
263
|
+
encodedKey: encodeURIComponent(request.key)
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
const encodeSegment = (value) => encodeURIComponent(String(value));
|
|
267
|
+
switch (apiType.type) {
|
|
268
|
+
case 'RADIO_GET_COMMUNITY_CHANNELS': {
|
|
269
|
+
const auth = ensureAuth();
|
|
270
|
+
path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}`;
|
|
271
|
+
method = 'GET';
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
case 'RADIO_GET_CONNECTED_USERS': {
|
|
275
|
+
const auth = ensureAuth();
|
|
276
|
+
path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}`;
|
|
277
|
+
method = 'GET';
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
case 'RADIO_GET_CONNECTED_USER': {
|
|
281
|
+
const auth = ensureAuth();
|
|
282
|
+
const roomIdRaw = (_a = payload === null || payload === void 0 ? void 0 : payload.roomId) !== null && _a !== void 0 ? _a : payload === null || payload === void 0 ? void 0 : payload.roomID;
|
|
283
|
+
if (roomIdRaw === undefined) {
|
|
284
|
+
throw new Error('roomId is required for RADIO_GET_CONNECTED_USER requests.');
|
|
285
|
+
}
|
|
286
|
+
const roomIdNumeric = typeof roomIdRaw === 'number' ? roomIdRaw : Number(roomIdRaw);
|
|
287
|
+
if (Number.isNaN(roomIdNumeric)) {
|
|
288
|
+
throw new Error('roomId must be a number for RADIO_GET_CONNECTED_USER requests.');
|
|
289
|
+
}
|
|
290
|
+
const identity = payload === null || payload === void 0 ? void 0 : payload.identity;
|
|
291
|
+
if (!identity) {
|
|
292
|
+
throw new Error('identity is required for RADIO_GET_CONNECTED_USER requests.');
|
|
293
|
+
}
|
|
294
|
+
path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}/${encodeSegment(roomIdNumeric)}/${encodeSegment(identity)}`;
|
|
295
|
+
method = 'GET';
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
case 'RADIO_SET_USER_CHANNELS': {
|
|
299
|
+
const auth = ensureAuth();
|
|
300
|
+
const identity = payload === null || payload === void 0 ? void 0 : payload.identity;
|
|
301
|
+
if (!identity) {
|
|
302
|
+
throw new Error('identity is required for RADIO_SET_USER_CHANNELS requests.');
|
|
303
|
+
}
|
|
304
|
+
const options = (_b = payload === null || payload === void 0 ? void 0 : payload.options) !== null && _b !== void 0 ? _b : {};
|
|
305
|
+
path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}/${encodeSegment(identity)}`;
|
|
306
|
+
method = 'POST';
|
|
307
|
+
const requestBody = {};
|
|
308
|
+
if ((options === null || options === void 0 ? void 0 : options.transmit) !== undefined) {
|
|
309
|
+
requestBody.transmit = options.transmit;
|
|
310
|
+
}
|
|
311
|
+
if ((options === null || options === void 0 ? void 0 : options.scan) !== undefined) {
|
|
312
|
+
requestBody.scan = options.scan;
|
|
313
|
+
}
|
|
314
|
+
body = requestBody;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
case 'RADIO_SET_USER_DISPLAY_NAME': {
|
|
318
|
+
const auth = ensureAuth();
|
|
319
|
+
const accId = payload === null || payload === void 0 ? void 0 : payload.accId;
|
|
320
|
+
const displayName = payload === null || payload === void 0 ? void 0 : payload.displayName;
|
|
321
|
+
if (!accId || !displayName) {
|
|
322
|
+
throw new Error('accId and displayName are required for RADIO_SET_USER_DISPLAY_NAME requests.');
|
|
323
|
+
}
|
|
324
|
+
method = 'POST';
|
|
325
|
+
body = {
|
|
326
|
+
id: auth.id,
|
|
327
|
+
key: auth.key,
|
|
328
|
+
accId,
|
|
329
|
+
displayName
|
|
330
|
+
};
|
|
331
|
+
path = apiType.path;
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
case 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP': {
|
|
335
|
+
method = 'GET';
|
|
336
|
+
path = apiType.path;
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
case 'RADIO_SET_SERVER_IP': {
|
|
340
|
+
const auth = ensureAuth();
|
|
341
|
+
const pushUrl = payload === null || payload === void 0 ? void 0 : payload.pushUrl;
|
|
342
|
+
if (!pushUrl) {
|
|
343
|
+
throw new Error('pushUrl is required for RADIO_SET_SERVER_IP requests.');
|
|
344
|
+
}
|
|
345
|
+
method = 'POST';
|
|
346
|
+
body = {
|
|
347
|
+
id: auth.id,
|
|
348
|
+
key: auth.key,
|
|
349
|
+
pushUrl
|
|
350
|
+
};
|
|
351
|
+
path = apiType.path;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
case 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS': {
|
|
355
|
+
const auth = ensureAuth();
|
|
356
|
+
const locations = payload === null || payload === void 0 ? void 0 : payload.locations;
|
|
357
|
+
if (!Array.isArray(locations)) {
|
|
358
|
+
throw new Error('locations array is required for RADIO_SET_IN_GAME_SPEAKER_LOCATIONS requests.');
|
|
359
|
+
}
|
|
360
|
+
method = 'POST';
|
|
361
|
+
body = {
|
|
362
|
+
id: auth.id,
|
|
363
|
+
key: auth.key,
|
|
364
|
+
locations
|
|
365
|
+
};
|
|
366
|
+
const token = (_c = payload === null || payload === void 0 ? void 0 : payload.token) !== null && _c !== void 0 ? _c : auth.key;
|
|
367
|
+
if (token) {
|
|
368
|
+
headers.Authorization = `Bearer ${token}`;
|
|
369
|
+
}
|
|
370
|
+
path = apiType.path;
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
default: {
|
|
374
|
+
throw new Error(`Unsupported radio API type received: ${apiType.type}`);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
apiData.typePath = path;
|
|
378
|
+
apiData.fullUrl = `${apiURL}/${path}`;
|
|
379
|
+
apiData.method = method;
|
|
380
|
+
apiData.fetchOptions.method = method;
|
|
381
|
+
if (body !== undefined) {
|
|
382
|
+
headers['Content-Type'] = 'application/json';
|
|
383
|
+
apiData.fetchOptions.body = JSON.stringify(body);
|
|
384
|
+
}
|
|
385
|
+
apiData.fetchOptions.headers = headers;
|
|
386
|
+
return apiData;
|
|
387
|
+
}
|
|
187
388
|
debug(log) {
|
|
188
389
|
return this.instance._debugLog(log);
|
|
189
390
|
}
|
|
@@ -13,7 +13,25 @@ class RateLimitError extends Error {
|
|
|
13
13
|
* The name of the error
|
|
14
14
|
*/
|
|
15
15
|
get name() {
|
|
16
|
-
|
|
16
|
+
let productName;
|
|
17
|
+
switch (this.product) {
|
|
18
|
+
case constants_1.productEnums.CAD: {
|
|
19
|
+
productName = 'Sonoran CAD';
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case constants_1.productEnums.CMS: {
|
|
23
|
+
productName = 'Sonoran CMS';
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case constants_1.productEnums.RADIO: {
|
|
27
|
+
productName = 'Sonoran Radio';
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
default: {
|
|
31
|
+
productName = 'Invalid Product';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return `Ratelimit Hit - [${productName} '${this.type}']`;
|
|
17
35
|
}
|
|
18
36
|
}
|
|
19
37
|
exports.RateLimitError = RateLimitError;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { productEnums } from '../../../../../constants';
|
|
1
|
+
import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, CMSProfileFieldUpdate, CMSSetGameServerStruct } from '../../../../../constants';
|
|
2
2
|
import type { RESTOptions } from '../REST';
|
|
3
3
|
export declare const DefaultUserAgent = "Sonoran.js NPM Module";
|
|
4
4
|
export declare const DefaultCADRestOptions: Required<RESTOptions>;
|
|
5
5
|
export declare const DefaultCMSRestOptions: Required<RESTOptions>;
|
|
6
|
+
export declare const DefaultRadioRestOptions: Required<RESTOptions>;
|
|
6
7
|
/**
|
|
7
8
|
* The events that the REST manager emits
|
|
8
9
|
*/
|
|
@@ -35,8 +36,9 @@ export declare const EventsCMSAPITypes: APITypeData[];
|
|
|
35
36
|
export declare const FormsCMSAPITypes: APITypeData[];
|
|
36
37
|
export declare const CommunitiesCMSAPITypes: APITypeData[];
|
|
37
38
|
export declare const ERLCMSAPITypes: APITypeData[];
|
|
39
|
+
export declare const RadioAPITypes: APITypeData[];
|
|
38
40
|
export declare const AllAPITypes: AllAPITypeData[];
|
|
39
|
-
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' |
|
|
41
|
+
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'SET_CLOCK' | 'JOIN_COMMUNITY' | 'LEAVE_COMMUNITY' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'GET_CURRENT_CLOCK_IN' | 'GET_ACCOUNTS' | 'GET_PROFILE_FIELDS' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'GET_FORM_TEMPLATE_SUBMISSIONS' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'RADIO_GET_COMMUNITY_CHANNELS' | 'RADIO_GET_CONNECTED_USERS' | 'RADIO_GET_CONNECTED_USER' | 'RADIO_SET_USER_CHANNELS' | 'RADIO_SET_USER_DISPLAY_NAME' | 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP' | 'RADIO_SET_SERVER_IP' | 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS';
|
|
40
42
|
export interface CMSServerAPIStruct {
|
|
41
43
|
id: number;
|
|
42
44
|
name: string;
|
|
@@ -271,10 +273,6 @@ export interface CADUnitLocationStruct {
|
|
|
271
273
|
apiId: string;
|
|
272
274
|
location: string;
|
|
273
275
|
}
|
|
274
|
-
export interface CMSProfileField {
|
|
275
|
-
id: string;
|
|
276
|
-
value: string;
|
|
277
|
-
}
|
|
278
276
|
export interface RESTTypedAPIDataStructs {
|
|
279
277
|
GET_SERVERS: [];
|
|
280
278
|
SET_SERVERS: [
|
|
@@ -296,7 +294,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
296
294
|
];
|
|
297
295
|
CHECK_APIID: [apiId: string];
|
|
298
296
|
APPLY_PERMISSION_KEY: [
|
|
299
|
-
apiId: string,
|
|
297
|
+
apiId: string | undefined,
|
|
300
298
|
permissionKey: string
|
|
301
299
|
];
|
|
302
300
|
SET_ACCOUNT_PERMISSIONS: [data: CADModifyAccountPermsStruct];
|
|
@@ -305,9 +303,33 @@ export interface RESTTypedAPIDataStructs {
|
|
|
305
303
|
AUTH_STREETSIGNS: [serverId: number];
|
|
306
304
|
SET_POSTALS: [data: CADSetPostalStruct[]];
|
|
307
305
|
SEND_PHOTO: [
|
|
308
|
-
apiId: string,
|
|
306
|
+
apiId: string | undefined,
|
|
309
307
|
url: string
|
|
310
308
|
];
|
|
309
|
+
SET_CLOCK: [
|
|
310
|
+
data: {
|
|
311
|
+
serverId: number;
|
|
312
|
+
currentUtc: string;
|
|
313
|
+
currentGame: string;
|
|
314
|
+
secondsPerHour: number;
|
|
315
|
+
}
|
|
316
|
+
];
|
|
317
|
+
JOIN_COMMUNITY: [
|
|
318
|
+
payload: {
|
|
319
|
+
internalKey: string;
|
|
320
|
+
accounts: Array<{
|
|
321
|
+
account: string;
|
|
322
|
+
}>;
|
|
323
|
+
}
|
|
324
|
+
];
|
|
325
|
+
LEAVE_COMMUNITY: [
|
|
326
|
+
payload: {
|
|
327
|
+
internalKey: string;
|
|
328
|
+
accounts: Array<{
|
|
329
|
+
account: string;
|
|
330
|
+
}>;
|
|
331
|
+
}
|
|
332
|
+
];
|
|
311
333
|
GET_CHARACTERS: [apiId: string];
|
|
312
334
|
NEW_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
|
|
313
335
|
EDIT_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
|
|
@@ -315,15 +337,15 @@ export interface RESTTypedAPIDataStructs {
|
|
|
315
337
|
GET_IDENTIFIERS: [apiId: string];
|
|
316
338
|
MODIFY_IDENTIFIER: [data: CADModifyIdentifierStruct];
|
|
317
339
|
SET_IDENTIFIER: [
|
|
318
|
-
apiId: string,
|
|
340
|
+
apiId: string | undefined,
|
|
319
341
|
identId: number
|
|
320
342
|
];
|
|
321
343
|
UNIT_PANIC: [
|
|
322
|
-
apiId: string,
|
|
344
|
+
apiId: string | undefined,
|
|
323
345
|
isPanic: boolean
|
|
324
346
|
];
|
|
325
347
|
UNIT_STATUS: [
|
|
326
|
-
apiId: string,
|
|
348
|
+
apiId: string | undefined,
|
|
327
349
|
status: number,
|
|
328
350
|
serverId: number
|
|
329
351
|
];
|
|
@@ -335,7 +357,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
335
357
|
GET_CALLS: [data: CADGetCallsStruct];
|
|
336
358
|
GET_ACTIVE_UNITS: [data: CADGetActiveUnitsStruct];
|
|
337
359
|
KICK_UNIT: [
|
|
338
|
-
apiId: string,
|
|
360
|
+
apiId: string | undefined,
|
|
339
361
|
reason: string,
|
|
340
362
|
serverId: number
|
|
341
363
|
];
|
|
@@ -399,6 +421,24 @@ export interface RESTTypedAPIDataStructs {
|
|
|
399
421
|
uniqueId?: string
|
|
400
422
|
];
|
|
401
423
|
GET_SUB_VERSION: [];
|
|
424
|
+
GET_CURRENT_CLOCK_IN: [
|
|
425
|
+
apiId?: string,
|
|
426
|
+
username?: string,
|
|
427
|
+
accId?: string,
|
|
428
|
+
discord?: string,
|
|
429
|
+
uniqueId?: string
|
|
430
|
+
];
|
|
431
|
+
GET_ACCOUNTS: [
|
|
432
|
+
options?: {
|
|
433
|
+
skip?: number;
|
|
434
|
+
take?: number;
|
|
435
|
+
sysStatus?: boolean;
|
|
436
|
+
comStatus?: boolean;
|
|
437
|
+
banned?: boolean;
|
|
438
|
+
archived?: boolean;
|
|
439
|
+
}
|
|
440
|
+
];
|
|
441
|
+
GET_PROFILE_FIELDS: [];
|
|
402
442
|
CHECK_COM_APIID: [apiId: string];
|
|
403
443
|
CLOCK_IN_OUT: [
|
|
404
444
|
apiId?: string,
|
|
@@ -441,6 +481,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
441
481
|
uniqueId: string | undefined
|
|
442
482
|
];
|
|
443
483
|
GET_GAME_SERVERS: [];
|
|
484
|
+
SET_GAME_SERVERS: [servers: CMSSetGameServerStruct[]];
|
|
444
485
|
VERIFY_WHITELIST: [
|
|
445
486
|
apiId: string | undefined,
|
|
446
487
|
accId: string | undefined,
|
|
@@ -460,22 +501,27 @@ export interface RESTTypedAPIDataStructs {
|
|
|
460
501
|
uniqueId: string | undefined
|
|
461
502
|
];
|
|
462
503
|
EDIT_ACC_PROFLIE_FIELDS: [
|
|
463
|
-
apiId: string,
|
|
464
|
-
username: string,
|
|
465
|
-
accId: string,
|
|
466
|
-
discord: string,
|
|
467
|
-
uniqueId: string,
|
|
468
|
-
profileFields:
|
|
504
|
+
apiId: string | undefined,
|
|
505
|
+
username: string | undefined,
|
|
506
|
+
accId: string | undefined,
|
|
507
|
+
discord: string | undefined,
|
|
508
|
+
uniqueId: string | undefined,
|
|
509
|
+
profileFields: CMSProfileFieldUpdate[]
|
|
469
510
|
];
|
|
470
511
|
CHANGE_FORM_STAGE: [
|
|
471
|
-
accId: string,
|
|
512
|
+
accId: string | undefined,
|
|
472
513
|
formId: number,
|
|
473
514
|
newStageId: string,
|
|
474
|
-
apiId: string,
|
|
475
|
-
username: string,
|
|
476
|
-
discord: string,
|
|
515
|
+
apiId: string | undefined,
|
|
516
|
+
username: string | undefined,
|
|
517
|
+
discord: string | undefined,
|
|
477
518
|
uniqueId: number
|
|
478
519
|
];
|
|
520
|
+
GET_FORM_TEMPLATE_SUBMISSIONS: [
|
|
521
|
+
templateId: number,
|
|
522
|
+
skip?: number,
|
|
523
|
+
take?: number
|
|
524
|
+
];
|
|
479
525
|
BAN_ACCOUNT: [
|
|
480
526
|
apiId: string | undefined,
|
|
481
527
|
username: string | undefined,
|
|
@@ -505,12 +551,41 @@ export interface RESTTypedAPIDataStructs {
|
|
|
505
551
|
playerRobloxId?: string | number,
|
|
506
552
|
points?: number
|
|
507
553
|
];
|
|
554
|
+
RADIO_GET_COMMUNITY_CHANNELS: [];
|
|
555
|
+
RADIO_GET_CONNECTED_USERS: [];
|
|
556
|
+
RADIO_GET_CONNECTED_USER: [
|
|
557
|
+
roomId: number,
|
|
558
|
+
identity: string
|
|
559
|
+
];
|
|
560
|
+
RADIO_SET_USER_CHANNELS: [
|
|
561
|
+
identity: string,
|
|
562
|
+
options?: RadioSetUserChannelsOptions
|
|
563
|
+
];
|
|
564
|
+
RADIO_SET_USER_DISPLAY_NAME: [
|
|
565
|
+
accId: string | undefined,
|
|
566
|
+
displayName: string
|
|
567
|
+
];
|
|
568
|
+
RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP: [];
|
|
569
|
+
RADIO_SET_SERVER_IP: [
|
|
570
|
+
pushUrl: string
|
|
571
|
+
];
|
|
572
|
+
RADIO_SET_IN_GAME_SPEAKER_LOCATIONS: [
|
|
573
|
+
locations: RadioSpeakerLocation[],
|
|
574
|
+
token?: string
|
|
575
|
+
];
|
|
508
576
|
}
|
|
509
577
|
export type PossibleRequestData = undefined | {
|
|
510
578
|
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct;
|
|
511
579
|
} | {
|
|
512
580
|
servers: CADServerAPIStruct[];
|
|
513
581
|
deployMap: boolean;
|
|
582
|
+
} | {
|
|
583
|
+
data: {
|
|
584
|
+
serverId: number;
|
|
585
|
+
currentUtc: string;
|
|
586
|
+
currentGame: string;
|
|
587
|
+
secondsPerHour: number;
|
|
588
|
+
};
|
|
514
589
|
} | {
|
|
515
590
|
id: number;
|
|
516
591
|
} | {
|
|
@@ -585,6 +660,11 @@ export type PossibleRequestData = undefined | {
|
|
|
585
660
|
text2: string;
|
|
586
661
|
text3: string;
|
|
587
662
|
};
|
|
663
|
+
} | {
|
|
664
|
+
internalKey: string;
|
|
665
|
+
accounts: {
|
|
666
|
+
account: string;
|
|
667
|
+
}[];
|
|
588
668
|
} | {
|
|
589
669
|
apiId?: string;
|
|
590
670
|
username?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CADDispatchStatusEnums = exports.CADDispatchOriginEnums = exports.CADModifyIdentifierActionEnums = exports.CADLookupByIntSearchTypeEnums = exports.CADRecordSectionCategoryEnums = exports.CADRecordTypeEnums = exports.AllAPITypes = exports.ERLCMSAPITypes = exports.CommunitiesCMSAPITypes = exports.FormsCMSAPITypes = exports.EventsCMSAPITypes = exports.ServersCMSAPITypes = exports.GeneralCMSAPITypes = exports.EmergencyCADAPITypes = exports.CivilianCADAPITypes = exports.GeneralCADAPITypes = exports.DefaultCMSRestOptions = exports.DefaultCADRestOptions = exports.DefaultUserAgent = void 0;
|
|
3
|
+
exports.CADDispatchStatusEnums = exports.CADDispatchOriginEnums = exports.CADModifyIdentifierActionEnums = exports.CADLookupByIntSearchTypeEnums = exports.CADRecordSectionCategoryEnums = exports.CADRecordTypeEnums = exports.AllAPITypes = exports.RadioAPITypes = exports.ERLCMSAPITypes = exports.CommunitiesCMSAPITypes = exports.FormsCMSAPITypes = exports.EventsCMSAPITypes = exports.ServersCMSAPITypes = exports.GeneralCMSAPITypes = exports.EmergencyCADAPITypes = exports.CivilianCADAPITypes = exports.GeneralCADAPITypes = exports.DefaultRadioRestOptions = exports.DefaultCMSRestOptions = exports.DefaultCADRestOptions = exports.DefaultUserAgent = void 0;
|
|
4
4
|
const constants_1 = require("../../../../../constants");
|
|
5
5
|
exports.DefaultUserAgent = 'Sonoran.js NPM Module';
|
|
6
6
|
exports.DefaultCADRestOptions = {
|
|
@@ -15,6 +15,12 @@ exports.DefaultCMSRestOptions = {
|
|
|
15
15
|
headers: {},
|
|
16
16
|
rejectOnRateLimit: true
|
|
17
17
|
};
|
|
18
|
+
exports.DefaultRadioRestOptions = {
|
|
19
|
+
agent: {},
|
|
20
|
+
api: 'https://api.sonoranradio.com',
|
|
21
|
+
headers: {},
|
|
22
|
+
rejectOnRateLimit: true
|
|
23
|
+
};
|
|
18
24
|
exports.GeneralCADAPITypes = [
|
|
19
25
|
{
|
|
20
26
|
type: 'GET_SERVERS',
|
|
@@ -135,6 +141,24 @@ exports.GeneralCADAPITypes = [
|
|
|
135
141
|
path: 'general/send_photo',
|
|
136
142
|
method: 'POST',
|
|
137
143
|
minVersion: 4
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: 'SET_CLOCK',
|
|
147
|
+
path: 'general/set_clock',
|
|
148
|
+
method: 'POST',
|
|
149
|
+
minVersion: 3
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
type: 'JOIN_COMMUNITY',
|
|
153
|
+
path: 'sso/community',
|
|
154
|
+
method: 'POST',
|
|
155
|
+
minVersion: 0
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: 'LEAVE_COMMUNITY',
|
|
159
|
+
path: 'sso/community',
|
|
160
|
+
method: 'POST',
|
|
161
|
+
minVersion: 0
|
|
138
162
|
}
|
|
139
163
|
];
|
|
140
164
|
exports.CivilianCADAPITypes = [
|
|
@@ -316,6 +340,18 @@ exports.GeneralCMSAPITypes = [
|
|
|
316
340
|
method: 'POST',
|
|
317
341
|
minVersion: 3
|
|
318
342
|
},
|
|
343
|
+
{
|
|
344
|
+
type: 'GET_CURRENT_CLOCK_IN',
|
|
345
|
+
path: 'general/get_current_clock_in',
|
|
346
|
+
method: 'POST',
|
|
347
|
+
minVersion: 0
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
type: 'GET_ACCOUNTS',
|
|
351
|
+
path: 'general/get_accounts',
|
|
352
|
+
method: 'POST',
|
|
353
|
+
minVersion: 0
|
|
354
|
+
},
|
|
319
355
|
{
|
|
320
356
|
type: 'GET_ACCOUNT_RANKS',
|
|
321
357
|
path: 'general/get_account_ranks',
|
|
@@ -334,6 +370,12 @@ exports.GeneralCMSAPITypes = [
|
|
|
334
370
|
method: 'POST',
|
|
335
371
|
minVersion: 2,
|
|
336
372
|
},
|
|
373
|
+
{
|
|
374
|
+
type: 'GET_PROFILE_FIELDS',
|
|
375
|
+
path: 'general/get_profile_fields',
|
|
376
|
+
method: 'POST',
|
|
377
|
+
minVersion: 0
|
|
378
|
+
},
|
|
337
379
|
{
|
|
338
380
|
type: 'GET_SUB_VERSION',
|
|
339
381
|
path: 'general/get_sub_version',
|
|
@@ -390,6 +432,12 @@ exports.ServersCMSAPITypes = [
|
|
|
390
432
|
method: 'POST',
|
|
391
433
|
minVersion: 2
|
|
392
434
|
},
|
|
435
|
+
{
|
|
436
|
+
type: 'SET_GAME_SERVERS',
|
|
437
|
+
path: 'servers/set_game_servers',
|
|
438
|
+
method: 'POST',
|
|
439
|
+
minVersion: 2
|
|
440
|
+
},
|
|
393
441
|
{
|
|
394
442
|
type: 'VERIFY_WHITELIST',
|
|
395
443
|
path: 'servers/verify_whitelist',
|
|
@@ -417,6 +465,12 @@ exports.FormsCMSAPITypes = [
|
|
|
417
465
|
path: 'forms/change/stage',
|
|
418
466
|
method: 'POST',
|
|
419
467
|
minVersion: 0
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
type: 'GET_FORM_TEMPLATE_SUBMISSIONS',
|
|
471
|
+
path: 'forms/get_template_submissions',
|
|
472
|
+
method: 'POST',
|
|
473
|
+
minVersion: 0
|
|
420
474
|
}
|
|
421
475
|
];
|
|
422
476
|
exports.CommunitiesCMSAPITypes = [
|
|
@@ -447,6 +501,56 @@ exports.ERLCMSAPITypes = [
|
|
|
447
501
|
minVersion: 0
|
|
448
502
|
}
|
|
449
503
|
];
|
|
504
|
+
exports.RadioAPITypes = [
|
|
505
|
+
{
|
|
506
|
+
type: 'RADIO_GET_COMMUNITY_CHANNELS',
|
|
507
|
+
path: 'api/radio/get-community-channels',
|
|
508
|
+
method: 'GET',
|
|
509
|
+
minVersion: 0
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
type: 'RADIO_GET_CONNECTED_USERS',
|
|
513
|
+
path: 'api/radio/get-connected-users',
|
|
514
|
+
method: 'GET',
|
|
515
|
+
minVersion: 0
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
type: 'RADIO_GET_CONNECTED_USER',
|
|
519
|
+
path: 'api/radio/get-connected-user',
|
|
520
|
+
method: 'GET',
|
|
521
|
+
minVersion: 0
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
type: 'RADIO_SET_USER_CHANNELS',
|
|
525
|
+
path: 'api/radio/set-user-channels',
|
|
526
|
+
method: 'POST',
|
|
527
|
+
minVersion: 0
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
type: 'RADIO_SET_USER_DISPLAY_NAME',
|
|
531
|
+
path: 'api/set-user-display-name',
|
|
532
|
+
method: 'POST',
|
|
533
|
+
minVersion: 0
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
type: 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP',
|
|
537
|
+
path: 'radio/check-server-subscription',
|
|
538
|
+
method: 'GET',
|
|
539
|
+
minVersion: 0
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
type: 'RADIO_SET_SERVER_IP',
|
|
543
|
+
path: 'radio/set-server-ip',
|
|
544
|
+
method: 'POST',
|
|
545
|
+
minVersion: 0
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
type: 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS',
|
|
549
|
+
path: 'radio/set-server-speakers',
|
|
550
|
+
method: 'POST',
|
|
551
|
+
minVersion: 0
|
|
552
|
+
}
|
|
553
|
+
];
|
|
450
554
|
function formatForAll(array, product) {
|
|
451
555
|
return array.map((val) => {
|
|
452
556
|
return {
|
|
@@ -455,7 +559,7 @@ function formatForAll(array, product) {
|
|
|
455
559
|
};
|
|
456
560
|
});
|
|
457
561
|
}
|
|
458
|
-
exports.AllAPITypes = [...formatForAll(exports.GeneralCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.CivilianCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.EmergencyCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.GeneralCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ServersCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.EventsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.FormsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.CommunitiesCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ERLCMSAPITypes, constants_1.productEnums.CMS)];
|
|
562
|
+
exports.AllAPITypes = [...formatForAll(exports.GeneralCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.CivilianCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.EmergencyCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.GeneralCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ServersCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.EventsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.FormsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.CommunitiesCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ERLCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.RadioAPITypes, constants_1.productEnums.RADIO)];
|
|
459
563
|
var CADRecordTypeEnums;
|
|
460
564
|
(function (CADRecordTypeEnums) {
|
|
461
565
|
CADRecordTypeEnums[CADRecordTypeEnums["Warrant"] = 2] = "Warrant";
|