@sonoransoftware/sonoran.js 1.0.60 → 1.0.62
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 +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/libs/rest/src/lib/REST.js +6 -1
- package/dist/libs/rest/src/lib/RequestManager.js +4 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +6 -2
- package/dist/libs/rest/src/lib/utils/constants.js +6 -0
- package/dist/managers/CADManager.d.ts +1 -1
- package/dist/managers/CADManager.js +18 -7
- package/dist/managers/CMSManager.d.ts +5 -0
- package/dist/managers/CMSManager.js +21 -0
- package/package.json +1 -1
- package/src/constants.ts +13 -0
- package/src/index.ts +2 -0
- package/src/libs/rest/src/lib/REST.ts +6 -1
- package/src/libs/rest/src/lib/RequestManager.ts +4 -0
- package/src/libs/rest/src/lib/utils/constants.ts +12 -2
- package/src/managers/CADManager.ts +20 -8
- package/src/managers/CMSManager.ts +19 -0
package/dist/constants.d.ts
CHANGED
|
@@ -373,6 +373,17 @@ export interface CMSSetFormLockStatusPromiseResult {
|
|
|
373
373
|
reason?: string;
|
|
374
374
|
data?: unknown;
|
|
375
375
|
}
|
|
376
|
+
export interface CMSCustomLogType {
|
|
377
|
+
id: string;
|
|
378
|
+
label: string;
|
|
379
|
+
shortCode: string;
|
|
380
|
+
melonlyId?: string;
|
|
381
|
+
}
|
|
382
|
+
export interface CMSGetCustomLogTypesPromiseResult {
|
|
383
|
+
success: boolean;
|
|
384
|
+
reason?: string;
|
|
385
|
+
data?: CMSCustomLogType[];
|
|
386
|
+
}
|
|
376
387
|
export interface CMSCurrentSession {
|
|
377
388
|
id: string;
|
|
378
389
|
sysStatus: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './instance/Instance';
|
|
2
2
|
export * from './builders';
|
|
3
3
|
export * from './libs/rest/src';
|
|
4
|
-
export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum, RadioSubscriptionLevel, RadioSetUserChannelsOptions, RadioChannel, RadioChannelGroup, RadioConnectedUser, RadioSpeakerLocation, RadioGetCommunityChannelsPromiseResult, RadioGetConnectedUsersPromiseResult, RadioGetConnectedUserPromiseResult, RadioSetUserChannelsPromiseResult, RadioSetUserDisplayNamePromiseResult, RadioGetServerSubscriptionFromIpPromiseResult, RadioSetServerIpPromiseResult, RadioSetInGameSpeakerLocationsPromiseResult, CADSetClockTimePromiseResult, CADJoinCommunityPromiseResult, CADLeaveCommunityPromiseResult, CADStandardResponse, CMSProfileField, CMSGetCurrentClockInPromiseResult, CMSAccountsPage, CMSAccountSummary, CMSGetAccountsPromiseResult, CMSGetProfileFieldsPromiseResult, CMSProfileFieldUpdate, CMSEditAccountProfileFieldsPromiseResult, CMSRsvpPromiseResult, CMSChangeFormStagePromiseResult, CMSSetGameServerStruct, CMSSetGameServersPromiseResult, CMSExecuteRankPromotionResult, CMSTriggerPromotionFlowPayload, CMSPromotionFlow, CMSTriggerPromotionFlowsPromiseResult, CMSGetPromotionFlowsPromiseResult, CMSGetFormSubmissionsPromiseResult, CMSERLCGetOnlinePlayersPromiseResult, CMSERLCGetPlayerQueuePromiseResult, CMSERLCAddNewRecordPromiseResult, CMSERLCExecuteCommandPayload, CMSERLCExecuteCommandPromiseResult, CMSERLCTeamsLockPromiseResult, CMSERLCTeamsUnlockPromiseResult } from './constants';
|
|
4
|
+
export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum, RadioSubscriptionLevel, RadioSetUserChannelsOptions, RadioChannel, RadioChannelGroup, RadioConnectedUser, RadioSpeakerLocation, RadioGetCommunityChannelsPromiseResult, RadioGetConnectedUsersPromiseResult, RadioGetConnectedUserPromiseResult, RadioSetUserChannelsPromiseResult, RadioSetUserDisplayNamePromiseResult, RadioGetServerSubscriptionFromIpPromiseResult, RadioSetServerIpPromiseResult, RadioSetInGameSpeakerLocationsPromiseResult, CADSetClockTimePromiseResult, CADJoinCommunityPromiseResult, CADLeaveCommunityPromiseResult, CADStandardResponse, CMSProfileField, CMSGetCurrentClockInPromiseResult, CMSAccountsPage, CMSAccountSummary, CMSGetAccountsPromiseResult, CMSGetProfileFieldsPromiseResult, CMSProfileFieldUpdate, CMSEditAccountProfileFieldsPromiseResult, CMSRsvpPromiseResult, CMSChangeFormStagePromiseResult, CMSSetGameServerStruct, CMSSetGameServersPromiseResult, CMSExecuteRankPromotionResult, CMSTriggerPromotionFlowPayload, CMSPromotionFlow, CMSTriggerPromotionFlowsPromiseResult, CMSGetPromotionFlowsPromiseResult, CMSCustomLogType, CMSGetCustomLogTypesPromiseResult, CMSGetFormSubmissionsPromiseResult, CMSERLCGetOnlinePlayersPromiseResult, CMSERLCGetPlayerQueuePromiseResult, CMSERLCAddNewRecordPromiseResult, CMSERLCExecuteCommandPayload, CMSERLCExecuteCommandPromiseResult, CMSERLCTeamsLockPromiseResult, CMSERLCTeamsUnlockPromiseResult } from './constants';
|
|
@@ -284,13 +284,15 @@ class REST extends events_1.EventEmitter {
|
|
|
284
284
|
return payload;
|
|
285
285
|
}
|
|
286
286
|
const unitsOrAccount = args[2];
|
|
287
|
+
const identIds = args[3];
|
|
287
288
|
const account = typeof unitsOrAccount === 'string' && !Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
|
|
288
289
|
const units = Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
|
|
289
290
|
return {
|
|
290
291
|
serverId: args[0],
|
|
291
292
|
callId: args[1],
|
|
292
293
|
units,
|
|
293
|
-
account
|
|
294
|
+
account,
|
|
295
|
+
identIds
|
|
294
296
|
};
|
|
295
297
|
}
|
|
296
298
|
case 'DETACH_UNIT': {
|
|
@@ -425,6 +427,9 @@ class REST extends events_1.EventEmitter {
|
|
|
425
427
|
case 'GET_PROMOTION_FLOWS': {
|
|
426
428
|
return [];
|
|
427
429
|
}
|
|
430
|
+
case 'GET_CUSTOM_LOG_TYPES': {
|
|
431
|
+
return [];
|
|
432
|
+
}
|
|
428
433
|
case 'ERLC_GET_ONLINE_PLAYERS': {
|
|
429
434
|
return {
|
|
430
435
|
robloxJoinCode: args[0]
|
|
@@ -101,6 +101,10 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
101
101
|
apiData.data.data = [];
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
|
+
case 'GET_CUSTOM_LOG_TYPES': {
|
|
105
|
+
apiData.data.data = [];
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
104
108
|
case 'GET_CLOCKIN_TYPES': {
|
|
105
109
|
apiData.data.data = [];
|
|
106
110
|
break;
|
|
@@ -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' | 'IDENTS_TO_GROUP' | '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' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | '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' | 'IDENTS_TO_GROUP' | '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' | 'GET_CUSTOM_LOG_TYPES' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | '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;
|
|
@@ -262,6 +262,7 @@ export interface CADAttachUnitsStruct {
|
|
|
262
262
|
callId: number;
|
|
263
263
|
units?: string[];
|
|
264
264
|
account?: string;
|
|
265
|
+
identIds?: number[];
|
|
265
266
|
}
|
|
266
267
|
export interface CADDetachUnitsStruct {
|
|
267
268
|
serverId: number;
|
|
@@ -422,7 +423,8 @@ export interface RESTTypedAPIDataStructs {
|
|
|
422
423
|
ATTACH_UNIT: [
|
|
423
424
|
serverId: number,
|
|
424
425
|
callId: number,
|
|
425
|
-
units: string[]
|
|
426
|
+
units: string[],
|
|
427
|
+
identIds?: number[]
|
|
426
428
|
] | [
|
|
427
429
|
data: CADAttachUnitsStruct
|
|
428
430
|
];
|
|
@@ -558,6 +560,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
558
560
|
data: CMSTriggerPromotionFlowPayload[]
|
|
559
561
|
];
|
|
560
562
|
GET_PROMOTION_FLOWS: [];
|
|
563
|
+
GET_CUSTOM_LOG_TYPES: [];
|
|
561
564
|
GET_GAME_SERVERS: [];
|
|
562
565
|
SET_GAME_SERVERS: [servers: CMSSetGameServerStruct[]];
|
|
563
566
|
VERIFY_WHITELIST: [
|
|
@@ -752,6 +755,7 @@ export type PossibleRequestData = undefined | {
|
|
|
752
755
|
callId: number;
|
|
753
756
|
units?: string[];
|
|
754
757
|
account?: string;
|
|
758
|
+
identIds?: number[];
|
|
755
759
|
} | {
|
|
756
760
|
serverId: number;
|
|
757
761
|
units?: string[];
|
|
@@ -459,6 +459,12 @@ exports.GeneralCMSAPITypes = [
|
|
|
459
459
|
path: 'general/get_promotion_flows',
|
|
460
460
|
method: 'POST',
|
|
461
461
|
minVersion: 0
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
type: 'GET_CUSTOM_LOG_TYPES',
|
|
465
|
+
path: 'general/get_custom_log_types',
|
|
466
|
+
method: 'POST',
|
|
467
|
+
minVersion: 0
|
|
462
468
|
}
|
|
463
469
|
];
|
|
464
470
|
exports.ServersCMSAPITypes = [
|
|
@@ -226,7 +226,7 @@ export declare class CADManager extends BaseManager {
|
|
|
226
226
|
/**
|
|
227
227
|
* Attaches units to an existing dispatch call.
|
|
228
228
|
*/
|
|
229
|
-
attachUnits(serverId: number, callId: number, unitsOrAccount: string[] | string): Promise<globalTypes.CADStandardResponse>;
|
|
229
|
+
attachUnits(serverId: number, callId: number, unitsOrAccount: string[] | string, identIds?: number[]): Promise<globalTypes.CADStandardResponse>;
|
|
230
230
|
attachUnits(params: CADAttachUnitsStruct): Promise<globalTypes.CADStandardResponse>;
|
|
231
231
|
/**
|
|
232
232
|
* Detaches units from dispatch calls.
|
|
@@ -552,7 +552,7 @@ class CADManager extends BaseManager_1.BaseManager {
|
|
|
552
552
|
};
|
|
553
553
|
return this.executeCadRequest('NEW_DISPATCH', payload);
|
|
554
554
|
}
|
|
555
|
-
async attachUnits(serverIdOrParams, callId, unitsOrAccount) {
|
|
555
|
+
async attachUnits(serverIdOrParams, callId, unitsOrAccount, identIds) {
|
|
556
556
|
let payload;
|
|
557
557
|
if (serverIdOrParams && typeof serverIdOrParams === 'object') {
|
|
558
558
|
payload = { ...serverIdOrParams };
|
|
@@ -565,19 +565,30 @@ class CADManager extends BaseManager_1.BaseManager {
|
|
|
565
565
|
? { units: unitsOrAccount }
|
|
566
566
|
: typeof unitsOrAccount === 'string'
|
|
567
567
|
? { account: unitsOrAccount }
|
|
568
|
-
: {})
|
|
568
|
+
: {}),
|
|
569
|
+
...(Array.isArray(identIds) ? { identIds } : {})
|
|
569
570
|
};
|
|
570
571
|
}
|
|
571
|
-
const { serverId, callId: resolvedCallId, units, account } = payload;
|
|
572
|
+
const { serverId, callId: resolvedCallId, units, account, identIds: resolvedIdentIds } = payload;
|
|
572
573
|
if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
|
|
573
574
|
throw new Error('serverId and callId must be integers when attaching units.');
|
|
574
575
|
}
|
|
575
576
|
const hasUnits = Array.isArray(units) && units.length > 0;
|
|
576
577
|
const hasAccount = typeof account === 'string' && account.length > 0;
|
|
577
|
-
if (
|
|
578
|
-
throw new Error('
|
|
579
|
-
}
|
|
580
|
-
|
|
578
|
+
if (resolvedIdentIds !== undefined && (!Array.isArray(resolvedIdentIds) || resolvedIdentIds.some((id) => !Number.isInteger(id)))) {
|
|
579
|
+
throw new Error('identIds must be an array of integers when attaching units.');
|
|
580
|
+
}
|
|
581
|
+
const hasIdentIds = Array.isArray(resolvedIdentIds) && resolvedIdentIds.length > 0;
|
|
582
|
+
if (!hasUnits && !hasAccount && !hasIdentIds) {
|
|
583
|
+
throw new Error('Either units, account, or identIds is required when attaching units.');
|
|
584
|
+
}
|
|
585
|
+
return this.executeCadRequest('ATTACH_UNIT', {
|
|
586
|
+
serverId,
|
|
587
|
+
callId: resolvedCallId,
|
|
588
|
+
units: hasUnits ? units : undefined,
|
|
589
|
+
account: hasAccount ? account : undefined,
|
|
590
|
+
identIds: hasIdentIds ? resolvedIdentIds : undefined
|
|
591
|
+
});
|
|
581
592
|
}
|
|
582
593
|
async detachUnits(serverIdOrParams, unitsOrAccount) {
|
|
583
594
|
let payload;
|
|
@@ -334,4 +334,9 @@ export declare class CMSManager extends BaseManager {
|
|
|
334
334
|
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
335
335
|
* */
|
|
336
336
|
erlcTeamsUnlock(robloxJoinCode: string, team: globalTypes.ERLCTeams): Promise<globalTypes.CMSERLCTeamsUnlockPromiseResult>;
|
|
337
|
+
/**
|
|
338
|
+
* Adds a new ERLC record for a player.
|
|
339
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
340
|
+
* */
|
|
341
|
+
getCustomLogTypes(): Promise<globalTypes.CMSGetCustomLogTypesPromiseResult>;
|
|
337
342
|
}
|
|
@@ -982,5 +982,26 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
982
982
|
}
|
|
983
983
|
});
|
|
984
984
|
}
|
|
985
|
+
/**
|
|
986
|
+
* Adds a new ERLC record for a player.
|
|
987
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
988
|
+
* */
|
|
989
|
+
async getCustomLogTypes() {
|
|
990
|
+
return new Promise(async (resolve, reject) => {
|
|
991
|
+
var _a;
|
|
992
|
+
try {
|
|
993
|
+
const getCustomLogTypesRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_CUSTOM_LOG_TYPES'));
|
|
994
|
+
resolve({ success: true, data: getCustomLogTypesRequest });
|
|
995
|
+
}
|
|
996
|
+
catch (err) {
|
|
997
|
+
if (err instanceof src_1.APIError) {
|
|
998
|
+
resolve({ success: false, reason: err.response });
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
reject(err);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
985
1006
|
}
|
|
986
1007
|
exports.CMSManager = CMSManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonoransoftware/sonoran.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.62",
|
|
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/src/constants.ts
CHANGED
|
@@ -418,6 +418,19 @@ export interface CMSSetFormLockStatusPromiseResult {
|
|
|
418
418
|
data?: unknown;
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
+
export interface CMSCustomLogType {
|
|
422
|
+
id: string;
|
|
423
|
+
label: string;
|
|
424
|
+
shortCode: string;
|
|
425
|
+
melonlyId?: string;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export interface CMSGetCustomLogTypesPromiseResult {
|
|
429
|
+
success: boolean;
|
|
430
|
+
reason?: string;
|
|
431
|
+
data?: CMSCustomLogType[];
|
|
432
|
+
}
|
|
433
|
+
|
|
421
434
|
export interface CMSCurrentSession {
|
|
422
435
|
id: string;
|
|
423
436
|
sysStatus: boolean;
|
package/src/index.ts
CHANGED
|
@@ -41,6 +41,8 @@ export {
|
|
|
41
41
|
CMSPromotionFlow,
|
|
42
42
|
CMSTriggerPromotionFlowsPromiseResult,
|
|
43
43
|
CMSGetPromotionFlowsPromiseResult,
|
|
44
|
+
CMSCustomLogType,
|
|
45
|
+
CMSGetCustomLogTypesPromiseResult,
|
|
44
46
|
CMSGetFormSubmissionsPromiseResult,
|
|
45
47
|
CMSERLCGetOnlinePlayersPromiseResult,
|
|
46
48
|
CMSERLCGetPlayerQueuePromiseResult,
|
|
@@ -393,13 +393,15 @@ export class REST extends EventEmitter {
|
|
|
393
393
|
return payload;
|
|
394
394
|
}
|
|
395
395
|
const unitsOrAccount = args[2];
|
|
396
|
+
const identIds = args[3];
|
|
396
397
|
const account = typeof unitsOrAccount === 'string' && !Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
|
|
397
398
|
const units = Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
|
|
398
399
|
return {
|
|
399
400
|
serverId: args[0],
|
|
400
401
|
callId: args[1],
|
|
401
402
|
units,
|
|
402
|
-
account
|
|
403
|
+
account,
|
|
404
|
+
identIds
|
|
403
405
|
};
|
|
404
406
|
}
|
|
405
407
|
case 'DETACH_UNIT': {
|
|
@@ -534,6 +536,9 @@ export class REST extends EventEmitter {
|
|
|
534
536
|
case 'GET_PROMOTION_FLOWS': {
|
|
535
537
|
return [];
|
|
536
538
|
}
|
|
539
|
+
case 'GET_CUSTOM_LOG_TYPES': {
|
|
540
|
+
return [];
|
|
541
|
+
}
|
|
537
542
|
case 'ERLC_GET_ONLINE_PLAYERS': {
|
|
538
543
|
return {
|
|
539
544
|
robloxJoinCode: args[0]
|
|
@@ -491,6 +491,12 @@ export const GeneralCMSAPITypes: APITypeData[] = [
|
|
|
491
491
|
path: 'general/get_promotion_flows',
|
|
492
492
|
method: 'POST',
|
|
493
493
|
minVersion: 0
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
type: 'GET_CUSTOM_LOG_TYPES',
|
|
497
|
+
path: 'general/get_custom_log_types',
|
|
498
|
+
method: 'POST',
|
|
499
|
+
minVersion: 0
|
|
494
500
|
}
|
|
495
501
|
];
|
|
496
502
|
|
|
@@ -697,7 +703,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
697
703
|
|
|
698
704
|
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) ];
|
|
699
705
|
|
|
700
|
-
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' | 'IDENTS_TO_GROUP' | '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' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | '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';
|
|
706
|
+
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' | 'IDENTS_TO_GROUP' | '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' | 'GET_CUSTOM_LOG_TYPES' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | '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';
|
|
701
707
|
|
|
702
708
|
export interface CMSServerAPIStruct {
|
|
703
709
|
id: number;
|
|
@@ -951,6 +957,7 @@ export interface CADAttachUnitsStruct {
|
|
|
951
957
|
callId: number;
|
|
952
958
|
units?: string[];
|
|
953
959
|
account?: string;
|
|
960
|
+
identIds?: number[];
|
|
954
961
|
}
|
|
955
962
|
|
|
956
963
|
export interface CADDetachUnitsStruct {
|
|
@@ -1116,7 +1123,8 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1116
1123
|
ATTACH_UNIT: [
|
|
1117
1124
|
serverId: number,
|
|
1118
1125
|
callId: number,
|
|
1119
|
-
units: string[]
|
|
1126
|
+
units: string[],
|
|
1127
|
+
identIds?: number[]
|
|
1120
1128
|
] | [
|
|
1121
1129
|
data: CADAttachUnitsStruct
|
|
1122
1130
|
];
|
|
@@ -1253,6 +1261,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1253
1261
|
data: CMSTriggerPromotionFlowPayload[]
|
|
1254
1262
|
];
|
|
1255
1263
|
GET_PROMOTION_FLOWS: [];
|
|
1264
|
+
GET_CUSTOM_LOG_TYPES: [];
|
|
1256
1265
|
// CMS - Servers
|
|
1257
1266
|
GET_GAME_SERVERS: [];
|
|
1258
1267
|
SET_GAME_SERVERS: [servers: CMSSetGameServerStruct[]];
|
|
@@ -1473,6 +1482,7 @@ export type PossibleRequestData =
|
|
|
1473
1482
|
callId: number;
|
|
1474
1483
|
units?: string[];
|
|
1475
1484
|
account?: string;
|
|
1485
|
+
identIds?: number[];
|
|
1476
1486
|
} |
|
|
1477
1487
|
{
|
|
1478
1488
|
serverId: number;
|
|
@@ -607,12 +607,13 @@ export class CADManager extends BaseManager {
|
|
|
607
607
|
/**
|
|
608
608
|
* Attaches units to an existing dispatch call.
|
|
609
609
|
*/
|
|
610
|
-
public async attachUnits(serverId: number, callId: number, unitsOrAccount: string[] | string): Promise<globalTypes.CADStandardResponse>;
|
|
610
|
+
public async attachUnits(serverId: number, callId: number, unitsOrAccount: string[] | string, identIds?: number[]): Promise<globalTypes.CADStandardResponse>;
|
|
611
611
|
public async attachUnits(params: CADAttachUnitsStruct): Promise<globalTypes.CADStandardResponse>;
|
|
612
612
|
public async attachUnits(
|
|
613
613
|
serverIdOrParams: number | CADAttachUnitsStruct,
|
|
614
614
|
callId?: number,
|
|
615
|
-
unitsOrAccount?: string[] | string
|
|
615
|
+
unitsOrAccount?: string[] | string,
|
|
616
|
+
identIds?: number[]
|
|
616
617
|
): Promise<globalTypes.CADStandardResponse> {
|
|
617
618
|
let payload: CADAttachUnitsStruct;
|
|
618
619
|
if (serverIdOrParams && typeof serverIdOrParams === 'object') {
|
|
@@ -625,20 +626,31 @@ export class CADManager extends BaseManager {
|
|
|
625
626
|
? { units: unitsOrAccount }
|
|
626
627
|
: typeof unitsOrAccount === 'string'
|
|
627
628
|
? { account: unitsOrAccount }
|
|
628
|
-
: {})
|
|
629
|
+
: {}),
|
|
630
|
+
...(Array.isArray(identIds) ? { identIds } : {})
|
|
629
631
|
};
|
|
630
632
|
}
|
|
631
633
|
|
|
632
|
-
const { serverId, callId: resolvedCallId, units, account } = payload;
|
|
634
|
+
const { serverId, callId: resolvedCallId, units, account, identIds: resolvedIdentIds } = payload;
|
|
633
635
|
if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
|
|
634
636
|
throw new Error('serverId and callId must be integers when attaching units.');
|
|
635
637
|
}
|
|
636
638
|
const hasUnits = Array.isArray(units) && units.length > 0;
|
|
637
639
|
const hasAccount = typeof account === 'string' && account.length > 0;
|
|
638
|
-
if (
|
|
639
|
-
throw new Error('
|
|
640
|
-
}
|
|
641
|
-
|
|
640
|
+
if (resolvedIdentIds !== undefined && (!Array.isArray(resolvedIdentIds) || resolvedIdentIds.some((id) => !Number.isInteger(id)))) {
|
|
641
|
+
throw new Error('identIds must be an array of integers when attaching units.');
|
|
642
|
+
}
|
|
643
|
+
const hasIdentIds = Array.isArray(resolvedIdentIds) && resolvedIdentIds.length > 0;
|
|
644
|
+
if (!hasUnits && !hasAccount && !hasIdentIds) {
|
|
645
|
+
throw new Error('Either units, account, or identIds is required when attaching units.');
|
|
646
|
+
}
|
|
647
|
+
return this.executeCadRequest('ATTACH_UNIT', {
|
|
648
|
+
serverId,
|
|
649
|
+
callId: resolvedCallId,
|
|
650
|
+
units: hasUnits ? units : undefined,
|
|
651
|
+
account: hasAccount ? account : undefined,
|
|
652
|
+
identIds: hasIdentIds ? resolvedIdentIds : undefined
|
|
653
|
+
});
|
|
642
654
|
}
|
|
643
655
|
|
|
644
656
|
/**
|
|
@@ -906,4 +906,23 @@ export class CMSManager extends BaseManager {
|
|
|
906
906
|
}
|
|
907
907
|
});
|
|
908
908
|
}
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* Adds a new ERLC record for a player.
|
|
912
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
913
|
+
* */
|
|
914
|
+
public async getCustomLogTypes(): Promise<globalTypes.CMSGetCustomLogTypesPromiseResult> {
|
|
915
|
+
return new Promise(async (resolve, reject) => {
|
|
916
|
+
try {
|
|
917
|
+
const getCustomLogTypesRequest: any = await this.rest?.request('GET_CUSTOM_LOG_TYPES');
|
|
918
|
+
resolve({ success: true, data: getCustomLogTypesRequest });
|
|
919
|
+
} catch (err) {
|
|
920
|
+
if (err instanceof APIError) {
|
|
921
|
+
resolve({ success: false, reason: err.response });
|
|
922
|
+
} else {
|
|
923
|
+
reject(err);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
}
|
|
909
928
|
}
|