@sonoransoftware/sonoran.js 1.0.50 → 1.0.51
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/dist/constants.d.ts +43 -0
- package/dist/libs/rest/src/lib/REST.js +34 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +28 -1
- package/dist/libs/rest/src/lib/utils/constants.js +36 -0
- package/dist/managers/CMSManager.d.ts +24 -0
- package/dist/managers/CMSManager.js +179 -0
- package/package.json +1 -1
- package/readme.md +37 -0
- package/src/constants.ts +50 -0
- package/src/libs/rest/src/lib/REST.ts +34 -0
- package/src/libs/rest/src/lib/utils/constants.ts +66 -1
- package/src/managers/CMSManager.ts +176 -0
package/dist/constants.d.ts
CHANGED
|
@@ -362,6 +362,49 @@ export interface CMSChangeFormStagePromiseResult {
|
|
|
362
362
|
reason?: string;
|
|
363
363
|
data?: unknown;
|
|
364
364
|
}
|
|
365
|
+
export interface CMSGetFormLockStatusPromiseResult {
|
|
366
|
+
success: boolean;
|
|
367
|
+
reason?: string;
|
|
368
|
+
locked?: boolean;
|
|
369
|
+
}
|
|
370
|
+
export interface CMSSetFormLockStatusPromiseResult {
|
|
371
|
+
success: boolean;
|
|
372
|
+
reason?: string;
|
|
373
|
+
data?: unknown;
|
|
374
|
+
}
|
|
375
|
+
export interface CMSCurrentSession {
|
|
376
|
+
id: string;
|
|
377
|
+
sysStatus: boolean;
|
|
378
|
+
community: string;
|
|
379
|
+
serverId: number;
|
|
380
|
+
startedBy: string;
|
|
381
|
+
startedAt: string;
|
|
382
|
+
endedBy: string | null;
|
|
383
|
+
endedAt: string | null;
|
|
384
|
+
cancelledBy: string | null;
|
|
385
|
+
stats: Record<string, unknown>;
|
|
386
|
+
metadata: Record<string, unknown>;
|
|
387
|
+
}
|
|
388
|
+
export interface CMSGetCurrentSessionPromiseResult {
|
|
389
|
+
success: boolean;
|
|
390
|
+
reason?: string;
|
|
391
|
+
data?: CMSCurrentSession | null;
|
|
392
|
+
}
|
|
393
|
+
export interface CMSStartSessionPromiseResult {
|
|
394
|
+
success: boolean;
|
|
395
|
+
reason?: string;
|
|
396
|
+
data?: CMSCurrentSession | null;
|
|
397
|
+
}
|
|
398
|
+
export interface CMSStopSessionPromiseResult {
|
|
399
|
+
success: boolean;
|
|
400
|
+
reason?: string;
|
|
401
|
+
data?: CMSCurrentSession | null;
|
|
402
|
+
}
|
|
403
|
+
export interface CMSCancelSessionPromiseResult {
|
|
404
|
+
success: boolean;
|
|
405
|
+
reason?: string;
|
|
406
|
+
data?: CMSCurrentSession | null;
|
|
407
|
+
}
|
|
365
408
|
export interface CMSSetGameServerStruct {
|
|
366
409
|
id?: number;
|
|
367
410
|
name: string;
|
|
@@ -79,6 +79,29 @@ class REST extends events_1.EventEmitter {
|
|
|
79
79
|
serverId: args[0]
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
+
case 'GET_CURRENT_SESSION': {
|
|
83
|
+
return {
|
|
84
|
+
serverId: args[0]
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
case 'START_SESSION': {
|
|
88
|
+
return {
|
|
89
|
+
serverId: args[0],
|
|
90
|
+
accId: args[1],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
case 'STOP_SESSION': {
|
|
94
|
+
return {
|
|
95
|
+
serverId: args[0],
|
|
96
|
+
accId: args[1],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
case 'CANCEL_SESSION': {
|
|
100
|
+
return {
|
|
101
|
+
serverId: args[0],
|
|
102
|
+
accId: args[1],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
82
105
|
case 'SET_GAME_SERVERS': {
|
|
83
106
|
return (_a = args[0]) !== null && _a !== void 0 ? _a : [];
|
|
84
107
|
}
|
|
@@ -295,6 +318,17 @@ class REST extends events_1.EventEmitter {
|
|
|
295
318
|
take: args[2],
|
|
296
319
|
};
|
|
297
320
|
}
|
|
321
|
+
case 'GET_FORM_LOCK_STATUS': {
|
|
322
|
+
return {
|
|
323
|
+
templateId: args[0],
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
case 'SET_FORM_LOCK_STATUS': {
|
|
327
|
+
return {
|
|
328
|
+
templateId: args[0],
|
|
329
|
+
state: args[1],
|
|
330
|
+
};
|
|
331
|
+
}
|
|
298
332
|
case 'CHANGE_FORM_STAGE': {
|
|
299
333
|
return {
|
|
300
334
|
accId: args[0],
|
|
@@ -38,7 +38,7 @@ export declare const CommunitiesCMSAPITypes: APITypeData[];
|
|
|
38
38
|
export declare const ERLCMSAPITypes: APITypeData[];
|
|
39
39
|
export declare const RadioAPITypes: APITypeData[];
|
|
40
40
|
export declare const AllAPITypes: AllAPITypeData[];
|
|
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_MY_CALL' | '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_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | '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' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | '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' | 'PLAY_TONE';
|
|
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_MY_CALL' | '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_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | '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' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | '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' | 'PLAY_TONE';
|
|
42
42
|
export interface CMSServerAPIStruct {
|
|
43
43
|
id: number;
|
|
44
44
|
name: string;
|
|
@@ -556,6 +556,21 @@ export interface RESTTypedAPIDataStructs {
|
|
|
556
556
|
FULL_WHITELIST: [
|
|
557
557
|
serverId?: number
|
|
558
558
|
];
|
|
559
|
+
GET_CURRENT_SESSION: [
|
|
560
|
+
serverId: number
|
|
561
|
+
];
|
|
562
|
+
STOP_SESSION: [
|
|
563
|
+
serverId: number,
|
|
564
|
+
accId?: string
|
|
565
|
+
];
|
|
566
|
+
START_SESSION: [
|
|
567
|
+
serverId: number,
|
|
568
|
+
accId?: string
|
|
569
|
+
];
|
|
570
|
+
CANCEL_SESSION: [
|
|
571
|
+
serverId: number,
|
|
572
|
+
accId?: string
|
|
573
|
+
];
|
|
559
574
|
RSVP: [
|
|
560
575
|
eventId: string,
|
|
561
576
|
apiId: string | undefined,
|
|
@@ -585,6 +600,13 @@ export interface RESTTypedAPIDataStructs {
|
|
|
585
600
|
skip?: number,
|
|
586
601
|
take?: number
|
|
587
602
|
];
|
|
603
|
+
GET_FORM_LOCK_STATUS: [
|
|
604
|
+
templateId: number
|
|
605
|
+
];
|
|
606
|
+
SET_FORM_LOCK_STATUS: [
|
|
607
|
+
templateId: number,
|
|
608
|
+
state: boolean
|
|
609
|
+
];
|
|
588
610
|
BAN_ACCOUNT: [
|
|
589
611
|
apiId: string | undefined,
|
|
590
612
|
username: string | undefined,
|
|
@@ -662,6 +684,11 @@ export type PossibleRequestData = undefined | {
|
|
|
662
684
|
id: number;
|
|
663
685
|
} | {
|
|
664
686
|
recordTypeId?: number;
|
|
687
|
+
} | {
|
|
688
|
+
templateId: number;
|
|
689
|
+
} | {
|
|
690
|
+
templateId: number;
|
|
691
|
+
state: boolean;
|
|
665
692
|
} | {
|
|
666
693
|
apiId?: string;
|
|
667
694
|
username?: string;
|
|
@@ -479,6 +479,30 @@ exports.ServersCMSAPITypes = [
|
|
|
479
479
|
path: 'servers/full_whitelist',
|
|
480
480
|
method: 'POST',
|
|
481
481
|
minVersion: 3
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
type: 'GET_CURRENT_SESSION',
|
|
485
|
+
path: 'servers/get_current_session',
|
|
486
|
+
method: 'POST',
|
|
487
|
+
minVersion: 0
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
type: 'START_SESSION',
|
|
491
|
+
path: 'servers/start_session',
|
|
492
|
+
method: 'POST',
|
|
493
|
+
minVersion: 0
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
type: 'STOP_SESSION',
|
|
497
|
+
path: 'servers/stop_session',
|
|
498
|
+
method: 'POST',
|
|
499
|
+
minVersion: 0
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
type: 'CANCEL_SESSION',
|
|
503
|
+
path: 'servers/cancel_session',
|
|
504
|
+
method: 'POST',
|
|
505
|
+
minVersion: 0
|
|
482
506
|
}
|
|
483
507
|
];
|
|
484
508
|
exports.EventsCMSAPITypes = [
|
|
@@ -501,6 +525,18 @@ exports.FormsCMSAPITypes = [
|
|
|
501
525
|
path: 'forms/get_template_submissions',
|
|
502
526
|
method: 'POST',
|
|
503
527
|
minVersion: 0
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
type: 'GET_FORM_LOCK_STATUS',
|
|
531
|
+
path: 'forms/get_form_lock_status',
|
|
532
|
+
method: 'POST',
|
|
533
|
+
minVersion: 0
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
type: 'SET_FORM_LOCK_STATUS',
|
|
537
|
+
path: 'forms/set_form_lock_status',
|
|
538
|
+
method: 'POST',
|
|
539
|
+
minVersion: 0
|
|
504
540
|
}
|
|
505
541
|
];
|
|
506
542
|
exports.CommunitiesCMSAPITypes = [
|
|
@@ -210,6 +210,14 @@ export declare class CMSManager extends BaseManager {
|
|
|
210
210
|
discord?: string;
|
|
211
211
|
uniqueId: number;
|
|
212
212
|
}): Promise<globalTypes.CMSChangeFormStagePromiseResult>;
|
|
213
|
+
/**
|
|
214
|
+
* Retrieves the lock status for a form template.
|
|
215
|
+
*/
|
|
216
|
+
getFormLockStatus(templateId: number): Promise<globalTypes.CMSGetFormLockStatusPromiseResult>;
|
|
217
|
+
/**
|
|
218
|
+
* Sets the lock status for a form template.
|
|
219
|
+
*/
|
|
220
|
+
setFormLockStatus(templateId: number, state: boolean): Promise<globalTypes.CMSSetFormLockStatusPromiseResult>;
|
|
213
221
|
/**
|
|
214
222
|
* Retrieves submissions for a specific form template.
|
|
215
223
|
*/
|
|
@@ -263,6 +271,22 @@ export declare class CMSManager extends BaseManager {
|
|
|
263
271
|
* Retrieves configured profile fields for the community.
|
|
264
272
|
*/
|
|
265
273
|
getProfileFields(): Promise<globalTypes.CMSGetProfileFieldsPromiseResult>;
|
|
274
|
+
/**
|
|
275
|
+
* Retrieves the current active session for the specified server, if present.
|
|
276
|
+
*/
|
|
277
|
+
getCurrentSession(serverId?: number): Promise<globalTypes.CMSGetCurrentSessionPromiseResult>;
|
|
278
|
+
/**
|
|
279
|
+
* Starts a new CMS session for the specified server.
|
|
280
|
+
*/
|
|
281
|
+
startSession(serverId?: number, accId?: string): Promise<globalTypes.CMSStartSessionPromiseResult>;
|
|
282
|
+
/**
|
|
283
|
+
* Stops the current CMS session for the specified server.
|
|
284
|
+
*/
|
|
285
|
+
stopSession(serverId?: number, accId?: string): Promise<globalTypes.CMSStopSessionPromiseResult>;
|
|
286
|
+
/**
|
|
287
|
+
* Cancels the current CMS session for the specified server.
|
|
288
|
+
*/
|
|
289
|
+
cancelSession(serverId?: number, accId?: string): Promise<globalTypes.CMSCancelSessionPromiseResult>;
|
|
266
290
|
/**
|
|
267
291
|
* Gets the current ERLC player queue count for the provided roblox join code.
|
|
268
292
|
* @param {string} robloxJoinCode The roblox join code to get the player queue size for.
|
|
@@ -518,6 +518,80 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
518
518
|
}
|
|
519
519
|
});
|
|
520
520
|
}
|
|
521
|
+
/**
|
|
522
|
+
* Retrieves the lock status for a form template.
|
|
523
|
+
*/
|
|
524
|
+
async getFormLockStatus(templateId) {
|
|
525
|
+
if (templateId === undefined || Number.isNaN(Number(templateId))) {
|
|
526
|
+
throw new Error('templateId is required to get form lock status.');
|
|
527
|
+
}
|
|
528
|
+
return new Promise(async (resolve, reject) => {
|
|
529
|
+
var _a;
|
|
530
|
+
try {
|
|
531
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_FORM_LOCK_STATUS', templateId));
|
|
532
|
+
if (typeof response === 'boolean') {
|
|
533
|
+
resolve({ success: true, locked: response });
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (typeof response === 'string') {
|
|
537
|
+
const normalized = response.toLowerCase();
|
|
538
|
+
if (normalized === 'locked') {
|
|
539
|
+
resolve({ success: true, locked: true });
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (normalized === 'unlocked') {
|
|
543
|
+
resolve({ success: true, locked: false });
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (response && typeof response === 'object') {
|
|
548
|
+
if ('locked' in response) {
|
|
549
|
+
resolve({ success: true, locked: Boolean(response.locked) });
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
if ('isLocked' in response) {
|
|
553
|
+
resolve({ success: true, locked: Boolean(response.isLocked) });
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
resolve({ success: false, reason: response });
|
|
558
|
+
}
|
|
559
|
+
catch (err) {
|
|
560
|
+
if (err instanceof src_1.APIError) {
|
|
561
|
+
resolve({ success: false, reason: err.response });
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
reject(err);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Sets the lock status for a form template.
|
|
571
|
+
*/
|
|
572
|
+
async setFormLockStatus(templateId, state) {
|
|
573
|
+
if (templateId === undefined || Number.isNaN(Number(templateId))) {
|
|
574
|
+
throw new Error('templateId is required to set form lock status.');
|
|
575
|
+
}
|
|
576
|
+
if (typeof state !== 'boolean') {
|
|
577
|
+
throw new Error('state must be a boolean to set form lock status.');
|
|
578
|
+
}
|
|
579
|
+
return new Promise(async (resolve, reject) => {
|
|
580
|
+
var _a;
|
|
581
|
+
try {
|
|
582
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('SET_FORM_LOCK_STATUS', templateId, state));
|
|
583
|
+
resolve({ success: true, data: response });
|
|
584
|
+
}
|
|
585
|
+
catch (err) {
|
|
586
|
+
if (err instanceof src_1.APIError) {
|
|
587
|
+
resolve({ success: false, reason: err.response });
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
reject(err);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
}
|
|
521
595
|
/**
|
|
522
596
|
* Retrieves submissions for a specific form template.
|
|
523
597
|
*/
|
|
@@ -657,6 +731,111 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
657
731
|
}
|
|
658
732
|
});
|
|
659
733
|
}
|
|
734
|
+
/**
|
|
735
|
+
* Retrieves the current active session for the specified server, if present.
|
|
736
|
+
*/
|
|
737
|
+
async getCurrentSession(serverId) {
|
|
738
|
+
const resolvedServerId = serverId !== null && serverId !== void 0 ? serverId : this.instance.cmsDefaultServerId;
|
|
739
|
+
if (resolvedServerId === undefined || Number.isNaN(Number(resolvedServerId))) {
|
|
740
|
+
throw new Error('serverId is required to get current session.');
|
|
741
|
+
}
|
|
742
|
+
return new Promise(async (resolve, reject) => {
|
|
743
|
+
var _a;
|
|
744
|
+
try {
|
|
745
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_CURRENT_SESSION', resolvedServerId));
|
|
746
|
+
resolve({ success: true, data: response !== null && response !== void 0 ? response : null });
|
|
747
|
+
}
|
|
748
|
+
catch (err) {
|
|
749
|
+
if (err instanceof src_1.APIError) {
|
|
750
|
+
resolve({ success: false, reason: err.response });
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
reject(err);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Starts a new CMS session for the specified server.
|
|
760
|
+
*/
|
|
761
|
+
async startSession(serverId, accId) {
|
|
762
|
+
const resolvedServerId = serverId !== null && serverId !== void 0 ? serverId : this.instance.cmsDefaultServerId;
|
|
763
|
+
if (resolvedServerId === undefined || Number.isNaN(Number(resolvedServerId))) {
|
|
764
|
+
throw new Error('serverId is required to start a session.');
|
|
765
|
+
}
|
|
766
|
+
if (!accId) {
|
|
767
|
+
throw new Error('accId is required to start a session.');
|
|
768
|
+
}
|
|
769
|
+
return new Promise(async (resolve, reject) => {
|
|
770
|
+
var _a;
|
|
771
|
+
try {
|
|
772
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('START_SESSION', resolvedServerId, accId));
|
|
773
|
+
resolve({ success: true, data: response !== null && response !== void 0 ? response : null });
|
|
774
|
+
}
|
|
775
|
+
catch (err) {
|
|
776
|
+
if (err instanceof src_1.APIError) {
|
|
777
|
+
resolve({ success: false, reason: err.response });
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
reject(err);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Stops the current CMS session for the specified server.
|
|
787
|
+
*/
|
|
788
|
+
async stopSession(serverId, accId) {
|
|
789
|
+
const resolvedServerId = serverId !== null && serverId !== void 0 ? serverId : this.instance.cmsDefaultServerId;
|
|
790
|
+
if (resolvedServerId === undefined || Number.isNaN(Number(resolvedServerId))) {
|
|
791
|
+
throw new Error('serverId is required to stop a session.');
|
|
792
|
+
}
|
|
793
|
+
if (!accId) {
|
|
794
|
+
throw new Error('accId is required to stop a session.');
|
|
795
|
+
}
|
|
796
|
+
return new Promise(async (resolve, reject) => {
|
|
797
|
+
var _a;
|
|
798
|
+
try {
|
|
799
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('STOP_SESSION', resolvedServerId, accId));
|
|
800
|
+
resolve({ success: true, data: response !== null && response !== void 0 ? response : null });
|
|
801
|
+
}
|
|
802
|
+
catch (err) {
|
|
803
|
+
if (err instanceof src_1.APIError) {
|
|
804
|
+
resolve({ success: false, reason: err.response });
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
reject(err);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Cancels the current CMS session for the specified server.
|
|
814
|
+
*/
|
|
815
|
+
async cancelSession(serverId, accId) {
|
|
816
|
+
const resolvedServerId = serverId !== null && serverId !== void 0 ? serverId : this.instance.cmsDefaultServerId;
|
|
817
|
+
if (resolvedServerId === undefined || Number.isNaN(Number(resolvedServerId))) {
|
|
818
|
+
throw new Error('serverId is required to cancel a session.');
|
|
819
|
+
}
|
|
820
|
+
if (!accId) {
|
|
821
|
+
throw new Error('accId is required to cancel a session.');
|
|
822
|
+
}
|
|
823
|
+
return new Promise(async (resolve, reject) => {
|
|
824
|
+
var _a;
|
|
825
|
+
try {
|
|
826
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('CANCEL_SESSION', resolvedServerId, accId));
|
|
827
|
+
resolve({ success: true, data: response !== null && response !== void 0 ? response : null });
|
|
828
|
+
}
|
|
829
|
+
catch (err) {
|
|
830
|
+
if (err instanceof src_1.APIError) {
|
|
831
|
+
resolve({ success: false, reason: err.response });
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
reject(err);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
}
|
|
660
839
|
/**
|
|
661
840
|
* Gets the current ERLC player queue count for the provided roblox join code.
|
|
662
841
|
* @param {string} robloxJoinCode The roblox join code to get the player queue size for.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonoransoftware/sonoran.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.51",
|
|
4
4
|
"description": "Sonoran.js is a library that allows you to interact with the Sonoran CAD and Sonoran CMS API. Based off of and utilizes several Discord.js library techniques for ease of use.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/readme.md
CHANGED
|
@@ -404,6 +404,19 @@ Retrieves form submissions with optional pagination.
|
|
|
404
404
|
const submissions = await instance.cms.getFormSubmissions(42, { skip: 0, take: 25 });
|
|
405
405
|
```
|
|
406
406
|
|
|
407
|
+
### getFormLockStatus(templateId)
|
|
408
|
+
Returns whether a form template is locked.
|
|
409
|
+
```js
|
|
410
|
+
const lockStatus = await instance.cms.getFormLockStatus(42);
|
|
411
|
+
// lockStatus => { success: true, locked: true } when locked
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### setFormLockStatus(templateId, state)
|
|
415
|
+
Sets the lock state for a form template.
|
|
416
|
+
```js
|
|
417
|
+
const result = await instance.cms.setFormLockStatus(42, true); // lock form
|
|
418
|
+
```
|
|
419
|
+
|
|
407
420
|
### changeFormStage(params)
|
|
408
421
|
Moves a form to the specified stage for an account.
|
|
409
422
|
```js
|
|
@@ -464,6 +477,30 @@ await instance.cms.servers?.setGameServers([
|
|
|
464
477
|
]);
|
|
465
478
|
```
|
|
466
479
|
|
|
480
|
+
### getCurrentSession(serverId?)
|
|
481
|
+
Retrieves the active CMS session for a server (if one exists).
|
|
482
|
+
```js
|
|
483
|
+
const session = await instance.cms.getCurrentSession(1);
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### startSession(serverId?, accId)
|
|
487
|
+
Starts a CMS session for the given server using the provided account.
|
|
488
|
+
```js
|
|
489
|
+
const session = await instance.cms.startSession(1, 'account-uuid');
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### stopSession(serverId?, accId)
|
|
493
|
+
Stops the active CMS session for the given server using the provided account.
|
|
494
|
+
```js
|
|
495
|
+
const session = await instance.cms.stopSession(1, 'account-uuid');
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### cancelSession(serverId?, accId)
|
|
499
|
+
Cancels the active CMS session for the given server using the provided account.
|
|
500
|
+
```js
|
|
501
|
+
const session = await instance.cms.cancelSession(1, 'account-uuid');
|
|
502
|
+
```
|
|
503
|
+
|
|
467
504
|
## Radio Functions
|
|
468
505
|
### getCommunityChannels()
|
|
469
506
|
Retrieves configured community channel groups and channels.
|
package/src/constants.ts
CHANGED
|
@@ -405,6 +405,56 @@ export interface CMSChangeFormStagePromiseResult {
|
|
|
405
405
|
data?: unknown;
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
export interface CMSGetFormLockStatusPromiseResult {
|
|
409
|
+
success: boolean;
|
|
410
|
+
reason?: string;
|
|
411
|
+
locked?: boolean;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface CMSSetFormLockStatusPromiseResult {
|
|
415
|
+
success: boolean;
|
|
416
|
+
reason?: string;
|
|
417
|
+
data?: unknown;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export interface CMSCurrentSession {
|
|
421
|
+
id: string;
|
|
422
|
+
sysStatus: boolean;
|
|
423
|
+
community: string;
|
|
424
|
+
serverId: number;
|
|
425
|
+
startedBy: string;
|
|
426
|
+
startedAt: string;
|
|
427
|
+
endedBy: string | null;
|
|
428
|
+
endedAt: string | null;
|
|
429
|
+
cancelledBy: string | null;
|
|
430
|
+
stats: Record<string, unknown>;
|
|
431
|
+
metadata: Record<string, unknown>;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export interface CMSGetCurrentSessionPromiseResult {
|
|
435
|
+
success: boolean;
|
|
436
|
+
reason?: string;
|
|
437
|
+
data?: CMSCurrentSession | null;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export interface CMSStartSessionPromiseResult {
|
|
441
|
+
success: boolean;
|
|
442
|
+
reason?: string;
|
|
443
|
+
data?: CMSCurrentSession | null;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface CMSStopSessionPromiseResult {
|
|
447
|
+
success: boolean;
|
|
448
|
+
reason?: string;
|
|
449
|
+
data?: CMSCurrentSession | null;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export interface CMSCancelSessionPromiseResult {
|
|
453
|
+
success: boolean;
|
|
454
|
+
reason?: string;
|
|
455
|
+
data?: CMSCurrentSession | null;
|
|
456
|
+
}
|
|
457
|
+
|
|
408
458
|
export interface CMSSetGameServerStruct {
|
|
409
459
|
id?: number;
|
|
410
460
|
name: string;
|
|
@@ -185,6 +185,29 @@ export class REST extends EventEmitter {
|
|
|
185
185
|
serverId: args[0]
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
+
case 'GET_CURRENT_SESSION': {
|
|
189
|
+
return {
|
|
190
|
+
serverId: args[0]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
case 'START_SESSION': {
|
|
194
|
+
return {
|
|
195
|
+
serverId: args[0],
|
|
196
|
+
accId: args[1],
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
case 'STOP_SESSION': {
|
|
200
|
+
return {
|
|
201
|
+
serverId: args[0],
|
|
202
|
+
accId: args[1],
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
case 'CANCEL_SESSION': {
|
|
206
|
+
return {
|
|
207
|
+
serverId: args[0],
|
|
208
|
+
accId: args[1],
|
|
209
|
+
}
|
|
210
|
+
}
|
|
188
211
|
case 'SET_GAME_SERVERS': {
|
|
189
212
|
return args[0] ?? [];
|
|
190
213
|
}
|
|
@@ -404,6 +427,17 @@ export class REST extends EventEmitter {
|
|
|
404
427
|
take: args[2],
|
|
405
428
|
};
|
|
406
429
|
}
|
|
430
|
+
case 'GET_FORM_LOCK_STATUS': {
|
|
431
|
+
return {
|
|
432
|
+
templateId: args[0],
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
case 'SET_FORM_LOCK_STATUS': {
|
|
436
|
+
return {
|
|
437
|
+
templateId: args[0],
|
|
438
|
+
state: args[1],
|
|
439
|
+
};
|
|
440
|
+
}
|
|
407
441
|
case 'CHANGE_FORM_STAGE': {
|
|
408
442
|
return {
|
|
409
443
|
accId: args[0],
|
|
@@ -512,6 +512,30 @@ export const ServersCMSAPITypes: APITypeData[] = [
|
|
|
512
512
|
path: 'servers/full_whitelist',
|
|
513
513
|
method: 'POST',
|
|
514
514
|
minVersion: 3
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
type: 'GET_CURRENT_SESSION',
|
|
518
|
+
path: 'servers/get_current_session',
|
|
519
|
+
method: 'POST',
|
|
520
|
+
minVersion: 0
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
type: 'START_SESSION',
|
|
524
|
+
path: 'servers/start_session',
|
|
525
|
+
method: 'POST',
|
|
526
|
+
minVersion: 0
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
type: 'STOP_SESSION',
|
|
530
|
+
path: 'servers/stop_session',
|
|
531
|
+
method: 'POST',
|
|
532
|
+
minVersion: 0
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
type: 'CANCEL_SESSION',
|
|
536
|
+
path: 'servers/cancel_session',
|
|
537
|
+
method: 'POST',
|
|
538
|
+
minVersion: 0
|
|
515
539
|
}
|
|
516
540
|
];
|
|
517
541
|
|
|
@@ -536,6 +560,18 @@ export const FormsCMSAPITypes: APITypeData[] = [
|
|
|
536
560
|
path: 'forms/get_template_submissions',
|
|
537
561
|
method: 'POST',
|
|
538
562
|
minVersion: 0
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
type: 'GET_FORM_LOCK_STATUS',
|
|
566
|
+
path: 'forms/get_form_lock_status',
|
|
567
|
+
method: 'POST',
|
|
568
|
+
minVersion: 0
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
type: 'SET_FORM_LOCK_STATUS',
|
|
572
|
+
path: 'forms/set_form_lock_status',
|
|
573
|
+
method: 'POST',
|
|
574
|
+
minVersion: 0
|
|
539
575
|
}
|
|
540
576
|
];
|
|
541
577
|
|
|
@@ -643,7 +679,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
643
679
|
|
|
644
680
|
export const AllAPITypes: AllAPITypeData[] = [ ...formatForAll(GeneralCADAPITypes, productEnums.CAD), ...formatForAll(CivilianCADAPITypes, productEnums.CAD), ...formatForAll(EmergencyCADAPITypes, productEnums.CAD), ...formatForAll(GeneralCMSAPITypes, productEnums.CMS), ...formatForAll(ServersCMSAPITypes, productEnums.CMS), ...formatForAll(EventsCMSAPITypes, productEnums.CMS), ...formatForAll(FormsCMSAPITypes, productEnums.CMS), ...formatForAll(CommunitiesCMSAPITypes, productEnums.CMS), ...formatForAll(ERLCMSAPITypes, productEnums.CMS), ...formatForAll(RadioAPITypes, productEnums.RADIO) ];
|
|
645
681
|
|
|
646
|
-
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_MY_CALL' | '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_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | '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' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | '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' | 'PLAY_TONE';
|
|
682
|
+
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_MY_CALL' | '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_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | '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' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | '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' | 'PLAY_TONE';
|
|
647
683
|
|
|
648
684
|
export interface CMSServerAPIStruct {
|
|
649
685
|
id: number;
|
|
@@ -1196,6 +1232,21 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1196
1232
|
FULL_WHITELIST: [
|
|
1197
1233
|
serverId?: number,
|
|
1198
1234
|
]
|
|
1235
|
+
GET_CURRENT_SESSION: [
|
|
1236
|
+
serverId: number,
|
|
1237
|
+
]
|
|
1238
|
+
STOP_SESSION: [
|
|
1239
|
+
serverId: number,
|
|
1240
|
+
accId?: string,
|
|
1241
|
+
]
|
|
1242
|
+
START_SESSION: [
|
|
1243
|
+
serverId: number,
|
|
1244
|
+
accId?: string,
|
|
1245
|
+
]
|
|
1246
|
+
CANCEL_SESSION: [
|
|
1247
|
+
serverId: number,
|
|
1248
|
+
accId?: string,
|
|
1249
|
+
]
|
|
1199
1250
|
RSVP : [
|
|
1200
1251
|
eventId: string,
|
|
1201
1252
|
apiId: string | undefined,
|
|
@@ -1226,6 +1277,13 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1226
1277
|
skip?: number,
|
|
1227
1278
|
take?: number,
|
|
1228
1279
|
]
|
|
1280
|
+
GET_FORM_LOCK_STATUS: [
|
|
1281
|
+
templateId: number,
|
|
1282
|
+
]
|
|
1283
|
+
SET_FORM_LOCK_STATUS: [
|
|
1284
|
+
templateId: number,
|
|
1285
|
+
state: boolean,
|
|
1286
|
+
]
|
|
1229
1287
|
BAN_ACCOUNT: [
|
|
1230
1288
|
apiId: string | undefined,
|
|
1231
1289
|
username: string | undefined,
|
|
@@ -1313,6 +1371,13 @@ export type PossibleRequestData =
|
|
|
1313
1371
|
{
|
|
1314
1372
|
recordTypeId?: number;
|
|
1315
1373
|
} |
|
|
1374
|
+
{
|
|
1375
|
+
templateId: number;
|
|
1376
|
+
} |
|
|
1377
|
+
{
|
|
1378
|
+
templateId: number;
|
|
1379
|
+
state: boolean;
|
|
1380
|
+
} |
|
|
1316
1381
|
{
|
|
1317
1382
|
apiId?: string;
|
|
1318
1383
|
username?: string;
|
|
@@ -463,6 +463,81 @@ export class CMSManager extends BaseManager {
|
|
|
463
463
|
});
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
+
/**
|
|
467
|
+
* Retrieves the lock status for a form template.
|
|
468
|
+
*/
|
|
469
|
+
public async getFormLockStatus(templateId: number): Promise<globalTypes.CMSGetFormLockStatusPromiseResult> {
|
|
470
|
+
if (templateId === undefined || Number.isNaN(Number(templateId))) {
|
|
471
|
+
throw new Error('templateId is required to get form lock status.');
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return new Promise(async (resolve, reject) => {
|
|
475
|
+
try {
|
|
476
|
+
const response: any = await this.rest?.request('GET_FORM_LOCK_STATUS', templateId);
|
|
477
|
+
if (typeof response === 'boolean') {
|
|
478
|
+
resolve({ success: true, locked: response });
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (typeof response === 'string') {
|
|
483
|
+
const normalized = response.toLowerCase();
|
|
484
|
+
if (normalized === 'locked') {
|
|
485
|
+
resolve({ success: true, locked: true });
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (normalized === 'unlocked') {
|
|
489
|
+
resolve({ success: true, locked: false });
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (response && typeof response === 'object') {
|
|
495
|
+
if ('locked' in response) {
|
|
496
|
+
resolve({ success: true, locked: Boolean((response as any).locked) });
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if ('isLocked' in response) {
|
|
500
|
+
resolve({ success: true, locked: Boolean((response as any).isLocked) });
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
resolve({ success: false, reason: response });
|
|
506
|
+
} catch (err) {
|
|
507
|
+
if (err instanceof APIError) {
|
|
508
|
+
resolve({ success: false, reason: err.response });
|
|
509
|
+
} else {
|
|
510
|
+
reject(err);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Sets the lock status for a form template.
|
|
518
|
+
*/
|
|
519
|
+
public async setFormLockStatus(templateId: number, state: boolean): Promise<globalTypes.CMSSetFormLockStatusPromiseResult> {
|
|
520
|
+
if (templateId === undefined || Number.isNaN(Number(templateId))) {
|
|
521
|
+
throw new Error('templateId is required to set form lock status.');
|
|
522
|
+
}
|
|
523
|
+
if (typeof state !== 'boolean') {
|
|
524
|
+
throw new Error('state must be a boolean to set form lock status.');
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
return new Promise(async (resolve, reject) => {
|
|
528
|
+
try {
|
|
529
|
+
const response: any = await this.rest?.request('SET_FORM_LOCK_STATUS', templateId, state);
|
|
530
|
+
resolve({ success: true, data: response });
|
|
531
|
+
} catch (err) {
|
|
532
|
+
if (err instanceof APIError) {
|
|
533
|
+
resolve({ success: false, reason: err.response });
|
|
534
|
+
} else {
|
|
535
|
+
reject(err);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
|
|
466
541
|
/**
|
|
467
542
|
* Retrieves submissions for a specific form template.
|
|
468
543
|
*/
|
|
@@ -591,6 +666,107 @@ export class CMSManager extends BaseManager {
|
|
|
591
666
|
});
|
|
592
667
|
}
|
|
593
668
|
|
|
669
|
+
/**
|
|
670
|
+
* Retrieves the current active session for the specified server, if present.
|
|
671
|
+
*/
|
|
672
|
+
public async getCurrentSession(serverId?: number): Promise<globalTypes.CMSGetCurrentSessionPromiseResult> {
|
|
673
|
+
const resolvedServerId = serverId ?? this.instance.cmsDefaultServerId;
|
|
674
|
+
if (resolvedServerId === undefined || Number.isNaN(Number(resolvedServerId))) {
|
|
675
|
+
throw new Error('serverId is required to get current session.');
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
return new Promise(async (resolve, reject) => {
|
|
679
|
+
try {
|
|
680
|
+
const response: any = await this.rest?.request('GET_CURRENT_SESSION', resolvedServerId);
|
|
681
|
+
resolve({ success: true, data: response ?? null });
|
|
682
|
+
} catch (err) {
|
|
683
|
+
if (err instanceof APIError) {
|
|
684
|
+
resolve({ success: false, reason: err.response });
|
|
685
|
+
} else {
|
|
686
|
+
reject(err);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Starts a new CMS session for the specified server.
|
|
694
|
+
*/
|
|
695
|
+
public async startSession(serverId?: number, accId?: string): Promise<globalTypes.CMSStartSessionPromiseResult> {
|
|
696
|
+
const resolvedServerId = serverId ?? this.instance.cmsDefaultServerId;
|
|
697
|
+
if (resolvedServerId === undefined || Number.isNaN(Number(resolvedServerId))) {
|
|
698
|
+
throw new Error('serverId is required to start a session.');
|
|
699
|
+
}
|
|
700
|
+
if (!accId) {
|
|
701
|
+
throw new Error('accId is required to start a session.');
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
return new Promise(async (resolve, reject) => {
|
|
705
|
+
try {
|
|
706
|
+
const response: any = await this.rest?.request('START_SESSION', resolvedServerId, accId);
|
|
707
|
+
resolve({ success: true, data: response ?? null });
|
|
708
|
+
} catch (err) {
|
|
709
|
+
if (err instanceof APIError) {
|
|
710
|
+
resolve({ success: false, reason: err.response });
|
|
711
|
+
} else {
|
|
712
|
+
reject(err);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Stops the current CMS session for the specified server.
|
|
720
|
+
*/
|
|
721
|
+
public async stopSession(serverId?: number, accId?: string): Promise<globalTypes.CMSStopSessionPromiseResult> {
|
|
722
|
+
const resolvedServerId = serverId ?? this.instance.cmsDefaultServerId;
|
|
723
|
+
if (resolvedServerId === undefined || Number.isNaN(Number(resolvedServerId))) {
|
|
724
|
+
throw new Error('serverId is required to stop a session.');
|
|
725
|
+
}
|
|
726
|
+
if (!accId) {
|
|
727
|
+
throw new Error('accId is required to stop a session.');
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
return new Promise(async (resolve, reject) => {
|
|
731
|
+
try {
|
|
732
|
+
const response: any = await this.rest?.request('STOP_SESSION', resolvedServerId, accId);
|
|
733
|
+
resolve({ success: true, data: response ?? null });
|
|
734
|
+
} catch (err) {
|
|
735
|
+
if (err instanceof APIError) {
|
|
736
|
+
resolve({ success: false, reason: err.response });
|
|
737
|
+
} else {
|
|
738
|
+
reject(err);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Cancels the current CMS session for the specified server.
|
|
746
|
+
*/
|
|
747
|
+
public async cancelSession(serverId?: number, accId?: string): Promise<globalTypes.CMSCancelSessionPromiseResult> {
|
|
748
|
+
const resolvedServerId = serverId ?? this.instance.cmsDefaultServerId;
|
|
749
|
+
if (resolvedServerId === undefined || Number.isNaN(Number(resolvedServerId))) {
|
|
750
|
+
throw new Error('serverId is required to cancel a session.');
|
|
751
|
+
}
|
|
752
|
+
if (!accId) {
|
|
753
|
+
throw new Error('accId is required to cancel a session.');
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return new Promise(async (resolve, reject) => {
|
|
757
|
+
try {
|
|
758
|
+
const response: any = await this.rest?.request('CANCEL_SESSION', resolvedServerId, accId);
|
|
759
|
+
resolve({ success: true, data: response ?? null });
|
|
760
|
+
} catch (err) {
|
|
761
|
+
if (err instanceof APIError) {
|
|
762
|
+
resolve({ success: false, reason: err.response });
|
|
763
|
+
} else {
|
|
764
|
+
reject(err);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
|
|
594
770
|
/**
|
|
595
771
|
* Gets the current ERLC player queue count for the provided roblox join code.
|
|
596
772
|
* @param {string} robloxJoinCode The roblox join code to get the player queue size for.
|