@sonoransoftware/sonoran.js 1.0.34 → 1.0.36
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 +242 -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 +118 -0
- package/dist/libs/rest/src/lib/RequestManager.d.ts +2 -0
- package/dist/libs/rest/src/lib/RequestManager.js +209 -0
- package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -1
- package/dist/libs/rest/src/lib/utils/constants.d.ts +108 -24
- package/dist/libs/rest/src/lib/utils/constants.js +118 -2
- package/dist/managers/CADActiveUnitsManager.d.ts +3 -0
- package/dist/managers/CADActiveUnitsManager.js +16 -6
- package/dist/managers/CADManager.d.ts +223 -0
- package/dist/managers/CADManager.js +513 -4
- package/dist/managers/CADServerManager.d.ts +11 -0
- package/dist/managers/CADServerManager.js +56 -13
- package/dist/managers/CMSManager.d.ts +78 -0
- package/dist/managers/CMSManager.js +213 -3
- package/dist/managers/CMSServerManager.d.ts +8 -0
- package/dist/managers/CMSServerManager.js +61 -18
- package/dist/managers/RadioManager.d.ts +55 -0
- package/dist/managers/RadioManager.js +224 -0
- package/package.json +1 -1
- package/readme.md +294 -12
- package/src/constants.ts +281 -1
- package/src/index.ts +42 -1
- package/src/instance/Instance.ts +30 -1
- package/src/instance/instance.types.ts +4 -1
- package/src/libs/rest/src/lib/REST.ts +117 -1
- package/src/libs/rest/src/lib/RequestManager.ts +229 -10
- package/src/libs/rest/src/lib/errors/RateLimitError.ts +20 -2
- package/src/libs/rest/src/lib/utils/constants.ts +223 -26
- package/src/managers/CADActiveUnitsManager.ts +19 -6
- package/src/managers/CADManager.ts +574 -4
- package/src/managers/CADServerManager.ts +59 -15
- package/src/managers/CMSManager.ts +196 -2
- package/src/managers/CMSServerManager.ts +65 -21
- package/src/managers/RadioManager.ts +187 -0
package/src/constants.ts
CHANGED
|
@@ -6,7 +6,8 @@ import { CADActiveUnit } from './structures/CADActiveUnit';
|
|
|
6
6
|
|
|
7
7
|
export enum productEnums {
|
|
8
8
|
CAD,
|
|
9
|
-
CMS
|
|
9
|
+
CMS,
|
|
10
|
+
RADIO
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export interface CADNewDispatchBuilderOptions {
|
|
@@ -252,6 +253,37 @@ export interface CMSSetAccountNamePromiseResult {
|
|
|
252
253
|
reason?: string;
|
|
253
254
|
}
|
|
254
255
|
|
|
256
|
+
export interface CADSetClockTimePromiseResult {
|
|
257
|
+
success: boolean;
|
|
258
|
+
reason?: string;
|
|
259
|
+
data?: unknown;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface CADJoinCommunityPromiseResult {
|
|
263
|
+
success: boolean;
|
|
264
|
+
reason?: string;
|
|
265
|
+
data?: unknown;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface CADLeaveCommunityPromiseResult {
|
|
269
|
+
success: boolean;
|
|
270
|
+
reason?: string;
|
|
271
|
+
data?: unknown;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface CADStandardResponse<T = unknown> {
|
|
275
|
+
success: boolean;
|
|
276
|
+
data?: T;
|
|
277
|
+
reason?: unknown;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface CMSProfileField {
|
|
281
|
+
id: string;
|
|
282
|
+
type: string;
|
|
283
|
+
label: string;
|
|
284
|
+
options: unknown;
|
|
285
|
+
}
|
|
286
|
+
|
|
255
287
|
export interface CMSKickAccountPromiseResult {
|
|
256
288
|
success: boolean;
|
|
257
289
|
reason?: string;
|
|
@@ -267,6 +299,127 @@ export interface CMSForceSyncPromiseResult {
|
|
|
267
299
|
reason?: string;
|
|
268
300
|
}
|
|
269
301
|
|
|
302
|
+
export interface CMSGetCurrentClockInPromiseResult {
|
|
303
|
+
success: boolean;
|
|
304
|
+
reason?: string;
|
|
305
|
+
data?: clockInOutRequest | null;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface CMSAccountSummary {
|
|
309
|
+
accId: string;
|
|
310
|
+
accName: string;
|
|
311
|
+
activeApiIds: string[];
|
|
312
|
+
discordId?: string;
|
|
313
|
+
sysStatus: boolean;
|
|
314
|
+
comStatus: boolean;
|
|
315
|
+
archived: boolean;
|
|
316
|
+
banned: boolean;
|
|
317
|
+
[key: string]: unknown;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface CMSAccountsPage {
|
|
321
|
+
total: number;
|
|
322
|
+
skip: number;
|
|
323
|
+
take: number;
|
|
324
|
+
accounts: CMSAccountSummary[];
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface CMSGetAccountsPromiseResult {
|
|
328
|
+
success: boolean;
|
|
329
|
+
reason?: string;
|
|
330
|
+
data?: CMSAccountsPage;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface CMSGetProfileFieldsPromiseResult {
|
|
334
|
+
success: boolean;
|
|
335
|
+
reason?: string;
|
|
336
|
+
data?: CMSProfileField[];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface CMSProfileFieldUpdate {
|
|
340
|
+
id: string;
|
|
341
|
+
value: unknown;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export interface CMSEditAccountProfileFieldsPromiseResult {
|
|
345
|
+
success: boolean;
|
|
346
|
+
reason?: string;
|
|
347
|
+
data?: CMSProfileFieldUpdate[];
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface CMSRsvpPromiseResult {
|
|
351
|
+
success: boolean;
|
|
352
|
+
reason?: string;
|
|
353
|
+
status?: string;
|
|
354
|
+
data?: unknown;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface CMSChangeFormStagePromiseResult {
|
|
358
|
+
success: boolean;
|
|
359
|
+
reason?: string;
|
|
360
|
+
data?: unknown;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export interface CMSSetGameServerStruct {
|
|
364
|
+
id?: number;
|
|
365
|
+
name: string;
|
|
366
|
+
description?: string;
|
|
367
|
+
ip?: string;
|
|
368
|
+
port?: string;
|
|
369
|
+
allowedRanks?: string[];
|
|
370
|
+
blockedRanks?: string[];
|
|
371
|
+
[key: string]: unknown;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export interface CMSSetGameServersPromiseResult {
|
|
375
|
+
success: boolean;
|
|
376
|
+
reason?: string;
|
|
377
|
+
data?: CMSSetGameServerStruct[];
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface CMSExecuteRankPromotionResult {
|
|
381
|
+
users: string[];
|
|
382
|
+
flow: string;
|
|
383
|
+
promote: boolean;
|
|
384
|
+
succeeded: boolean;
|
|
385
|
+
message?: string;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface CMSTriggerPromotionFlowPayload {
|
|
389
|
+
userId: string;
|
|
390
|
+
flowId: string;
|
|
391
|
+
users: string[];
|
|
392
|
+
promote: boolean;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export interface CMSPromotionFlow {
|
|
396
|
+
id: string;
|
|
397
|
+
communityUuid: string;
|
|
398
|
+
labelFrom: string;
|
|
399
|
+
labelTo: string;
|
|
400
|
+
ranksToAdd: string[];
|
|
401
|
+
ranksToRemove: string[];
|
|
402
|
+
actions: unknown[];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export interface CMSTriggerPromotionFlowsPromiseResult {
|
|
406
|
+
success: boolean;
|
|
407
|
+
reason?: string;
|
|
408
|
+
data?: CMSExecuteRankPromotionResult[];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface CMSGetPromotionFlowsPromiseResult {
|
|
412
|
+
success: boolean;
|
|
413
|
+
reason?: string;
|
|
414
|
+
data?: CMSPromotionFlow[];
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface CMSGetFormSubmissionsPromiseResult<T = unknown> {
|
|
418
|
+
success: boolean;
|
|
419
|
+
reason?: string;
|
|
420
|
+
data?: T[];
|
|
421
|
+
}
|
|
422
|
+
|
|
270
423
|
export interface CMSERLCGetOnlinePlayersPromiseResult {
|
|
271
424
|
success: boolean;
|
|
272
425
|
reason?: string;
|
|
@@ -289,3 +442,130 @@ export interface CMSERLCAddNewRecordPromiseResult {
|
|
|
289
442
|
reason?: string;
|
|
290
443
|
logId?: string;
|
|
291
444
|
}
|
|
445
|
+
|
|
446
|
+
export interface RadioChannelGroup {
|
|
447
|
+
id: number;
|
|
448
|
+
name: string;
|
|
449
|
+
orderIndex: number;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export interface RadioChannel {
|
|
453
|
+
id: number;
|
|
454
|
+
groupId: number;
|
|
455
|
+
displayName: string;
|
|
456
|
+
recvFreqMajor: number;
|
|
457
|
+
recvFreqMinor: number;
|
|
458
|
+
xmitFreqMajor: number;
|
|
459
|
+
xmitFreqMinor: number;
|
|
460
|
+
repeatsXmit: boolean;
|
|
461
|
+
status: boolean;
|
|
462
|
+
orderIndex: number;
|
|
463
|
+
talkoverProtection: boolean;
|
|
464
|
+
[key: string]: unknown;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export interface RadioConnectedUserMetadataScanList {
|
|
468
|
+
id: number;
|
|
469
|
+
name: string;
|
|
470
|
+
channelIds: number[];
|
|
471
|
+
[key: string]: unknown;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export interface RadioConnectedUserMetadataState {
|
|
475
|
+
primaryChId?: number;
|
|
476
|
+
scannedChIds?: number[];
|
|
477
|
+
scanLists?: RadioConnectedUserMetadataScanList[];
|
|
478
|
+
spec?: number;
|
|
479
|
+
[key: string]: unknown;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export interface RadioConnectedUserMetadata {
|
|
483
|
+
sonrad?: boolean;
|
|
484
|
+
state?: RadioConnectedUserMetadataState;
|
|
485
|
+
[key: string]: unknown;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export interface RadioConnectedUser {
|
|
489
|
+
identity: string;
|
|
490
|
+
name: string;
|
|
491
|
+
roomId?: number;
|
|
492
|
+
metadata: RadioConnectedUserMetadata;
|
|
493
|
+
[key: string]: unknown;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export interface RadioSpeakerLocation {
|
|
497
|
+
label: string;
|
|
498
|
+
id: string;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export interface RadioSetUserChannelsOptions {
|
|
502
|
+
transmit?: number;
|
|
503
|
+
scan?: number[];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export type RadioSubscriptionLevel = 0 | 1 | 2;
|
|
507
|
+
|
|
508
|
+
export interface RadioGetCommunityChannelsPromiseResult {
|
|
509
|
+
success: boolean;
|
|
510
|
+
reason?: string;
|
|
511
|
+
data?: {
|
|
512
|
+
result: string;
|
|
513
|
+
groups: RadioChannelGroup[];
|
|
514
|
+
channels: RadioChannel[];
|
|
515
|
+
[key: string]: unknown;
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export interface RadioGetConnectedUsersPromiseResult {
|
|
520
|
+
success: boolean;
|
|
521
|
+
reason?: string;
|
|
522
|
+
data?: {
|
|
523
|
+
result: string;
|
|
524
|
+
connectedUsers: RadioConnectedUser[];
|
|
525
|
+
[key: string]: unknown;
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export interface RadioGetConnectedUserPromiseResult {
|
|
530
|
+
success: boolean;
|
|
531
|
+
reason?: string;
|
|
532
|
+
data?: {
|
|
533
|
+
result: string;
|
|
534
|
+
data: RadioConnectedUser;
|
|
535
|
+
[key: string]: unknown;
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export interface RadioSetUserChannelsPromiseResult {
|
|
540
|
+
success: boolean;
|
|
541
|
+
reason?: string;
|
|
542
|
+
result?: string;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export interface RadioSetUserDisplayNamePromiseResult {
|
|
546
|
+
success: boolean;
|
|
547
|
+
reason?: string;
|
|
548
|
+
result?: string;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export interface RadioGetServerSubscriptionFromIpPromiseResult {
|
|
552
|
+
success: boolean;
|
|
553
|
+
reason?: string;
|
|
554
|
+
data?: {
|
|
555
|
+
result: string;
|
|
556
|
+
subscription: RadioSubscriptionLevel;
|
|
557
|
+
[key: string]: unknown;
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export interface RadioSetServerIpPromiseResult {
|
|
562
|
+
success: boolean;
|
|
563
|
+
reason?: string;
|
|
564
|
+
result?: string;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export interface RadioSetInGameSpeakerLocationsPromiseResult {
|
|
568
|
+
success: boolean;
|
|
569
|
+
reason?: string;
|
|
570
|
+
result?: string;
|
|
571
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,45 @@
|
|
|
1
1
|
export * from './instance/Instance';
|
|
2
2
|
export * from './builders';
|
|
3
3
|
export * from './libs/rest/src';
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
productEnums,
|
|
6
|
+
CADNewDispatchBuilderOptions,
|
|
7
|
+
CADSubscriptionVersionEnum,
|
|
8
|
+
CMSSubscriptionVersionEnum,
|
|
9
|
+
RadioSubscriptionLevel,
|
|
10
|
+
RadioSetUserChannelsOptions,
|
|
11
|
+
RadioChannel,
|
|
12
|
+
RadioChannelGroup,
|
|
13
|
+
RadioConnectedUser,
|
|
14
|
+
RadioSpeakerLocation,
|
|
15
|
+
RadioGetCommunityChannelsPromiseResult,
|
|
16
|
+
RadioGetConnectedUsersPromiseResult,
|
|
17
|
+
RadioGetConnectedUserPromiseResult,
|
|
18
|
+
RadioSetUserChannelsPromiseResult,
|
|
19
|
+
RadioSetUserDisplayNamePromiseResult,
|
|
20
|
+
RadioGetServerSubscriptionFromIpPromiseResult,
|
|
21
|
+
RadioSetServerIpPromiseResult,
|
|
22
|
+
RadioSetInGameSpeakerLocationsPromiseResult,
|
|
23
|
+
CADSetClockTimePromiseResult,
|
|
24
|
+
CADJoinCommunityPromiseResult,
|
|
25
|
+
CADLeaveCommunityPromiseResult,
|
|
26
|
+
CADStandardResponse,
|
|
27
|
+
CMSProfileField,
|
|
28
|
+
CMSGetCurrentClockInPromiseResult,
|
|
29
|
+
CMSAccountsPage,
|
|
30
|
+
CMSAccountSummary,
|
|
31
|
+
CMSGetAccountsPromiseResult,
|
|
32
|
+
CMSGetProfileFieldsPromiseResult,
|
|
33
|
+
CMSProfileFieldUpdate,
|
|
34
|
+
CMSEditAccountProfileFieldsPromiseResult,
|
|
35
|
+
CMSRsvpPromiseResult,
|
|
36
|
+
CMSChangeFormStagePromiseResult,
|
|
37
|
+
CMSSetGameServerStruct,
|
|
38
|
+
CMSSetGameServersPromiseResult,
|
|
39
|
+
CMSExecuteRankPromotionResult,
|
|
40
|
+
CMSTriggerPromotionFlowPayload,
|
|
41
|
+
CMSPromotionFlow,
|
|
42
|
+
CMSTriggerPromotionFlowsPromiseResult,
|
|
43
|
+
CMSGetPromotionFlowsPromiseResult,
|
|
44
|
+
CMSGetFormSubmissionsPromiseResult
|
|
45
|
+
} from './constants';
|
package/src/instance/Instance.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as globalTypes from '../constants';
|
|
|
4
4
|
import * as InstanceTypes from './instance.types';
|
|
5
5
|
import { CADManager } from '../managers/CADManager';
|
|
6
6
|
import { CMSManager } from '../managers/CMSManager';
|
|
7
|
+
import { RadioManager } from '../managers/RadioManager';
|
|
7
8
|
import { debugLog } from '../utils';
|
|
8
9
|
|
|
9
10
|
export class Instance extends EventEmitter {
|
|
@@ -17,9 +18,14 @@ export class Instance extends EventEmitter {
|
|
|
17
18
|
public cmsApiUrl: string = 'https://api.sonorancms.com';
|
|
18
19
|
public cmsDefaultServerId: number = 1;
|
|
19
20
|
public isCMSSuccessful: boolean = false;
|
|
21
|
+
public radioCommunityId: string | undefined;
|
|
22
|
+
public radioApiKey: string | undefined;
|
|
23
|
+
public radioApiUrl: string = 'https://api.sonoranradio.com';
|
|
24
|
+
public isRadioSuccessful: boolean = false;
|
|
20
25
|
|
|
21
26
|
public cad: CADManager | undefined;
|
|
22
27
|
public cms: CMSManager | undefined;
|
|
28
|
+
public radio: RadioManager | undefined;
|
|
23
29
|
|
|
24
30
|
public debug: boolean = false;
|
|
25
31
|
public apiHeaders: HeadersInit = {};
|
|
@@ -64,6 +70,17 @@ export class Instance extends EventEmitter {
|
|
|
64
70
|
this.initialize();
|
|
65
71
|
break;
|
|
66
72
|
}
|
|
73
|
+
case globalTypes.productEnums.RADIO: {
|
|
74
|
+
this.radioCommunityId = options.communityId;
|
|
75
|
+
this.radioApiKey = options.apiKey;
|
|
76
|
+
if (Object.prototype.hasOwnProperty.call(options, 'radioApiUrl') && typeof options.radioApiUrl === 'string') {
|
|
77
|
+
this._debugLog(`Overriding Radio API URL... ${options.radioApiUrl}`);
|
|
78
|
+
this.radioApiUrl = options.radioApiUrl;
|
|
79
|
+
}
|
|
80
|
+
this._debugLog('About to initialize instance.');
|
|
81
|
+
this.initialize();
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
67
84
|
default: {
|
|
68
85
|
throw new Error('Invalid product enum given for constructor.');
|
|
69
86
|
}
|
|
@@ -76,6 +93,8 @@ export class Instance extends EventEmitter {
|
|
|
76
93
|
this.cadApiKey = options.cadApiKey;
|
|
77
94
|
this.cmsCommunityId = options.cmsCommunityId;
|
|
78
95
|
this.cmsApiKey = options.cmsApiKey;
|
|
96
|
+
this.radioCommunityId = options.radioCommunityId;
|
|
97
|
+
this.radioApiKey = options.radioApiKey;
|
|
79
98
|
|
|
80
99
|
if (options.cadDefaultServerId !== undefined) {
|
|
81
100
|
this._debugLog(`Overriding default CAD server id... ${options.serverId}`);
|
|
@@ -93,6 +112,10 @@ export class Instance extends EventEmitter {
|
|
|
93
112
|
this._debugLog(`Overriding CMS API URL... ${options.cmsApiUrl}`);
|
|
94
113
|
this.cmsApiUrl = options.cmsApiUrl;
|
|
95
114
|
}
|
|
115
|
+
if (Object.prototype.hasOwnProperty.call(options, 'radioApiUrl') && typeof options.radioApiUrl === 'string') {
|
|
116
|
+
this._debugLog(`Overriding Radio API URL... ${options.radioApiUrl}`);
|
|
117
|
+
this.radioApiUrl = options.radioApiUrl;
|
|
118
|
+
}
|
|
96
119
|
this.initialize();
|
|
97
120
|
}
|
|
98
121
|
}
|
|
@@ -112,6 +135,12 @@ export class Instance extends EventEmitter {
|
|
|
112
135
|
} else {
|
|
113
136
|
this._debugLog('Not initializing CMS Manager due to a missing community id, api key, or api url.');
|
|
114
137
|
}
|
|
138
|
+
if (this.radioCommunityId && this.radioApiKey && this.radioApiUrl) {
|
|
139
|
+
this._debugLog('About to initialize Radio Manager');
|
|
140
|
+
this.radio = new RadioManager(this);
|
|
141
|
+
} else {
|
|
142
|
+
this._debugLog('Not initializing Radio Manager due to a missing community id, api key, or api url.');
|
|
143
|
+
}
|
|
115
144
|
}
|
|
116
145
|
|
|
117
146
|
public _debugLog(message: string): void {
|
|
@@ -119,4 +148,4 @@ export class Instance extends EventEmitter {
|
|
|
119
148
|
debugLog(message);
|
|
120
149
|
}
|
|
121
150
|
}
|
|
122
|
-
}
|
|
151
|
+
}
|
|
@@ -14,6 +14,7 @@ import type { RequestInit, Response } from 'node-fetch';
|
|
|
14
14
|
import { Instance } from '../../../../instance/Instance';
|
|
15
15
|
import { CADManager } from '../../../../managers/CADManager';
|
|
16
16
|
import { CMSManager } from '../../../../managers/CMSManager';
|
|
17
|
+
import { RadioManager } from '../../../../managers/RadioManager';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Options to be passed when creating the REST instance
|
|
@@ -106,7 +107,7 @@ export interface REST {
|
|
|
106
107
|
(<S extends string | symbol>(event?: Exclude<S, keyof RestEvents>) => this);
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
export type RestManagerTypes = CADManager | CMSManager;
|
|
110
|
+
export type RestManagerTypes = CADManager | CMSManager | RadioManager;
|
|
110
111
|
|
|
111
112
|
export class REST extends EventEmitter {
|
|
112
113
|
public readonly requestManager: RequestManager;
|
|
@@ -150,6 +151,11 @@ export class REST extends EventEmitter {
|
|
|
150
151
|
apiKey = this.instance.cmsApiKey;
|
|
151
152
|
break;
|
|
152
153
|
}
|
|
154
|
+
case productEnums.RADIO: {
|
|
155
|
+
communityId = this.instance.radioCommunityId;
|
|
156
|
+
apiKey = this.instance.radioApiKey;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
153
159
|
}
|
|
154
160
|
if (!communityId || !apiKey) throw new Error(`Community ID or API Key could not be found for request. P${apiType.product}`);
|
|
155
161
|
// if (apiType.minVersion > this.manager.version) throw new Error(`[${type}] Subscription version too low for this API type request. Current Version: ${convertSubNumToName(this.manager.version)} Needed Version: ${convertSubNumToName(apiType.minVersion)}`); // Verifies API Subscription Level Requirement which is deprecated currently
|
|
@@ -179,6 +185,9 @@ export class REST extends EventEmitter {
|
|
|
179
185
|
serverId: args[0]
|
|
180
186
|
}
|
|
181
187
|
}
|
|
188
|
+
case 'SET_GAME_SERVERS': {
|
|
189
|
+
return args[0] ?? [];
|
|
190
|
+
}
|
|
182
191
|
case 'RSVP': {
|
|
183
192
|
return {
|
|
184
193
|
eventId: args[0],
|
|
@@ -206,6 +215,62 @@ export class REST extends EventEmitter {
|
|
|
206
215
|
uniqueId: args[4]
|
|
207
216
|
};
|
|
208
217
|
}
|
|
218
|
+
case 'GET_CURRENT_CLOCK_IN': {
|
|
219
|
+
return {
|
|
220
|
+
apiId: args[0],
|
|
221
|
+
username: args[1],
|
|
222
|
+
accId: args[2],
|
|
223
|
+
discord: args[3],
|
|
224
|
+
uniqueId: args[4]
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
case 'GET_ACCOUNTS': {
|
|
228
|
+
return args[0] ?? {};
|
|
229
|
+
}
|
|
230
|
+
case 'GET_PROFILE_FIELDS': {
|
|
231
|
+
return {};
|
|
232
|
+
}
|
|
233
|
+
case 'SET_CLOCK': {
|
|
234
|
+
if (args[0] && typeof args[0] === 'object' && !Array.isArray(args[0])) {
|
|
235
|
+
return args[0];
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
serverId: args[0],
|
|
239
|
+
currentUtc: args[1],
|
|
240
|
+
currentGame: args[2],
|
|
241
|
+
secondsPerHour: args[3]
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
case 'JOIN_COMMUNITY':
|
|
245
|
+
case 'LEAVE_COMMUNITY': {
|
|
246
|
+
const payload = args[0] && typeof args[0] === 'object' && !Array.isArray(args[0]) && 'internalKey' in args[0]
|
|
247
|
+
? args[0]
|
|
248
|
+
: null;
|
|
249
|
+
const internalKey = payload ? payload.internalKey : args[0];
|
|
250
|
+
const accountsInput = payload ? payload.accounts : args[1];
|
|
251
|
+
let accounts: Array<{ account: string }> = [];
|
|
252
|
+
if (Array.isArray(accountsInput)) {
|
|
253
|
+
accounts = accountsInput.map((entry) => {
|
|
254
|
+
if (typeof entry === 'string') {
|
|
255
|
+
return { account: entry };
|
|
256
|
+
}
|
|
257
|
+
if (entry && typeof entry === 'object' && 'account' in entry) {
|
|
258
|
+
return entry as { account: string };
|
|
259
|
+
}
|
|
260
|
+
return { account: String(entry) };
|
|
261
|
+
});
|
|
262
|
+
} else if (accountsInput) {
|
|
263
|
+
if (typeof accountsInput === 'string') {
|
|
264
|
+
accounts = [{ account: accountsInput }];
|
|
265
|
+
} else if (typeof accountsInput === 'object' && 'account' in accountsInput) {
|
|
266
|
+
accounts = [accountsInput as { account: string }];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
internalKey,
|
|
271
|
+
accounts
|
|
272
|
+
};
|
|
273
|
+
}
|
|
209
274
|
case 'CLOCK_IN_OUT': {
|
|
210
275
|
return {
|
|
211
276
|
apiId: args[0],
|
|
@@ -237,6 +302,13 @@ export class REST extends EventEmitter {
|
|
|
237
302
|
secret: args[0],
|
|
238
303
|
};
|
|
239
304
|
}
|
|
305
|
+
case 'GET_FORM_TEMPLATE_SUBMISSIONS': {
|
|
306
|
+
return {
|
|
307
|
+
templateId: args[0],
|
|
308
|
+
skip: args[1],
|
|
309
|
+
take: args[2],
|
|
310
|
+
};
|
|
311
|
+
}
|
|
240
312
|
case 'CHANGE_FORM_STAGE': {
|
|
241
313
|
return {
|
|
242
314
|
accId: args[0],
|
|
@@ -301,6 +373,16 @@ export class REST extends EventEmitter {
|
|
|
301
373
|
uniqueId: args[4],
|
|
302
374
|
}
|
|
303
375
|
}
|
|
376
|
+
case 'TRIGGER_PROMOTION_FLOWS': {
|
|
377
|
+
const payload = args[0];
|
|
378
|
+
if (!Array.isArray(payload)) {
|
|
379
|
+
throw new Error('TRIGGER_PROMOTION_FLOWS requires an array of promotion flow payloads.');
|
|
380
|
+
}
|
|
381
|
+
return payload;
|
|
382
|
+
}
|
|
383
|
+
case 'GET_PROMOTION_FLOWS': {
|
|
384
|
+
return [];
|
|
385
|
+
}
|
|
304
386
|
case 'ERLC_GET_ONLINE_PLAYERS': {
|
|
305
387
|
return {
|
|
306
388
|
robloxJoinCode: args[0]
|
|
@@ -322,6 +404,40 @@ export class REST extends EventEmitter {
|
|
|
322
404
|
points: args[6],
|
|
323
405
|
}
|
|
324
406
|
}
|
|
407
|
+
case 'RADIO_GET_COMMUNITY_CHANNELS':
|
|
408
|
+
case 'RADIO_GET_CONNECTED_USERS':
|
|
409
|
+
case 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP': {
|
|
410
|
+
return undefined;
|
|
411
|
+
}
|
|
412
|
+
case 'RADIO_GET_CONNECTED_USER': {
|
|
413
|
+
return {
|
|
414
|
+
roomId: args[0],
|
|
415
|
+
identity: args[1]
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
case 'RADIO_SET_USER_CHANNELS': {
|
|
419
|
+
return {
|
|
420
|
+
identity: args[0],
|
|
421
|
+
options: args[1] ?? {}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
case 'RADIO_SET_USER_DISPLAY_NAME': {
|
|
425
|
+
return {
|
|
426
|
+
accId: args[0],
|
|
427
|
+
displayName: args[1]
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
case 'RADIO_SET_SERVER_IP': {
|
|
431
|
+
return {
|
|
432
|
+
pushUrl: args[0]
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
case 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS': {
|
|
436
|
+
return {
|
|
437
|
+
locations: args[0],
|
|
438
|
+
token: args[1]
|
|
439
|
+
}
|
|
440
|
+
}
|
|
325
441
|
default: {
|
|
326
442
|
return args;
|
|
327
443
|
}
|