@sonoransoftware/sonoran.js 1.0.52 → 1.0.56
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 +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/libs/rest/src/lib/REST.js +42 -0
- package/dist/libs/rest/src/lib/RequestManager.js +12 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +18 -2
- package/dist/libs/rest/src/lib/utils/constants.js +12 -0
- package/dist/managers/CMSManager.d.ts +15 -0
- package/dist/managers/CMSManager.js +47 -0
- package/package.json +1 -1
- package/src/constants.ts +12 -0
- package/src/index.ts +3 -1
- package/src/libs/rest/src/lib/REST.ts +42 -0
- package/src/libs/rest/src/lib/RequestManager.ts +12 -0
- package/src/libs/rest/src/lib/utils/constants.ts +31 -2
- package/src/managers/CMSManager.ts +43 -0
package/dist/constants.d.ts
CHANGED
|
@@ -490,6 +490,15 @@ export interface CMSERLCExecuteCommandPromiseResult {
|
|
|
490
490
|
reason?: string;
|
|
491
491
|
data?: unknown;
|
|
492
492
|
}
|
|
493
|
+
export type ERLCTeams = 'police' | 'sheriff' | 'fire' | 'dot';
|
|
494
|
+
export interface CMSERLCTeamsLockPromiseResult {
|
|
495
|
+
success: boolean;
|
|
496
|
+
reason: string;
|
|
497
|
+
}
|
|
498
|
+
export interface CMSERLCTeamsUnlockPromiseResult {
|
|
499
|
+
success: boolean;
|
|
500
|
+
reason: string;
|
|
501
|
+
}
|
|
493
502
|
export interface RadioChannelGroup {
|
|
494
503
|
id: number;
|
|
495
504
|
name: string;
|
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 } 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, CMSGetFormSubmissionsPromiseResult, CMSERLCGetOnlinePlayersPromiseResult, CMSERLCGetPlayerQueuePromiseResult, CMSERLCAddNewRecordPromiseResult, CMSERLCExecuteCommandPayload, CMSERLCExecuteCommandPromiseResult, CMSERLCTeamsLockPromiseResult, CMSERLCTeamsUnlockPromiseResult } from './constants';
|
|
@@ -238,6 +238,16 @@ class REST extends events_1.EventEmitter {
|
|
|
238
238
|
label: args[3]
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
+
case 'CLOSE_CALL': {
|
|
242
|
+
const payload = args[0];
|
|
243
|
+
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
244
|
+
return payload;
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
serverId: args[0],
|
|
248
|
+
callId: args[1]
|
|
249
|
+
};
|
|
250
|
+
}
|
|
241
251
|
case 'UNIT_STATUS': {
|
|
242
252
|
const payload = args[0];
|
|
243
253
|
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
@@ -445,6 +455,38 @@ class REST extends events_1.EventEmitter {
|
|
|
445
455
|
};
|
|
446
456
|
});
|
|
447
457
|
}
|
|
458
|
+
case 'ERLC_TEAMS_LOCK': {
|
|
459
|
+
const payload = args[0];
|
|
460
|
+
if (!Array.isArray(payload)) {
|
|
461
|
+
throw new Error('ERLC_TEAMS_LOCK requires an array of command payloads.');
|
|
462
|
+
}
|
|
463
|
+
return payload.map((cmd) => {
|
|
464
|
+
const robloxJoinCode = cmd.robloxJoinCode;
|
|
465
|
+
if (typeof robloxJoinCode !== 'string' || robloxJoinCode.length === 0) {
|
|
466
|
+
throw new Error('ERLC_TEAMS_LOCK requires each command to include a valid robloxJoinCode.');
|
|
467
|
+
}
|
|
468
|
+
return {
|
|
469
|
+
...cmd,
|
|
470
|
+
robloxJoinCode
|
|
471
|
+
};
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
case 'ERLC_TEAMS_UNLOCK': {
|
|
475
|
+
const payload = args[0];
|
|
476
|
+
if (!Array.isArray(payload)) {
|
|
477
|
+
throw new Error('ERLC_TEAMS_UNLOCK requires an array of command payloads.');
|
|
478
|
+
}
|
|
479
|
+
return payload.map((cmd) => {
|
|
480
|
+
const robloxJoinCode = cmd.robloxJoinCode;
|
|
481
|
+
if (typeof robloxJoinCode !== 'string' || robloxJoinCode.length === 0) {
|
|
482
|
+
throw new Error('ERLC_TEAMS_UNLOCK requires each command to include a valid robloxJoinCode.');
|
|
483
|
+
}
|
|
484
|
+
return {
|
|
485
|
+
...cmd,
|
|
486
|
+
robloxJoinCode
|
|
487
|
+
};
|
|
488
|
+
});
|
|
489
|
+
}
|
|
448
490
|
case 'RADIO_GET_COMMUNITY_CHANNELS':
|
|
449
491
|
case 'RADIO_GET_CONNECTED_USERS':
|
|
450
492
|
case 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP': {
|
|
@@ -109,6 +109,14 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
109
109
|
apiData.data.data = clonedData;
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
|
+
case 'ERLC_TEAMS_LOCK': {
|
|
113
|
+
apiData.data.data = clonedData;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case 'ERLC_TEAMS_UNLOCK': {
|
|
117
|
+
apiData.data.data = clonedData;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
112
120
|
case 'SET_PENAL_CODES': {
|
|
113
121
|
apiData.data.data = [clonedData[0]];
|
|
114
122
|
break;
|
|
@@ -239,6 +247,10 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
239
247
|
}
|
|
240
248
|
break;
|
|
241
249
|
}
|
|
250
|
+
case 'CLOSE_CALL': {
|
|
251
|
+
apiData.data.data = [clonedData];
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
242
254
|
case 'UNIT_PANIC': {
|
|
243
255
|
const payload = data.data;
|
|
244
256
|
if (Array.isArray(payload)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload, CMSERLCExecuteCommandPayload } from '../../../../../constants';
|
|
1
|
+
import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload, CMSERLCExecuteCommandPayload, ERLCTeams } from '../../../../../constants';
|
|
2
2
|
import type { RESTOptions } from '../REST';
|
|
3
3
|
export declare const DefaultUserAgent = "Sonoran.js NPM Module";
|
|
4
4
|
export declare const DefaultCADRestOptions: Required<RESTOptions>;
|
|
@@ -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' | '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';
|
|
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' | '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;
|
|
@@ -245,6 +245,12 @@ export interface CADGetActiveUnitsStruct {
|
|
|
245
245
|
limit?: number;
|
|
246
246
|
offset?: number;
|
|
247
247
|
}
|
|
248
|
+
export interface CADDispatchNoteStruct {
|
|
249
|
+
time: string;
|
|
250
|
+
label: string;
|
|
251
|
+
type: string;
|
|
252
|
+
content: string;
|
|
253
|
+
}
|
|
248
254
|
export interface CADAttachUnitsStruct {
|
|
249
255
|
serverId: number;
|
|
250
256
|
callId: number;
|
|
@@ -285,6 +291,7 @@ interface CADNewDispatchBaseStruct {
|
|
|
285
291
|
primary: number;
|
|
286
292
|
trackPrimary: boolean;
|
|
287
293
|
description: string;
|
|
294
|
+
notes: CADDispatchNoteStruct[];
|
|
288
295
|
metaData: Record<string, string>;
|
|
289
296
|
}
|
|
290
297
|
export type CADNewDispatchStruct = (CADNewDispatchBaseStruct & {
|
|
@@ -640,6 +647,15 @@ export interface RESTTypedAPIDataStructs {
|
|
|
640
647
|
ERLC_EXECUTE_COMMAND: [
|
|
641
648
|
commands: CMSERLCExecuteCommandPayload[]
|
|
642
649
|
];
|
|
650
|
+
ERLC_TEAMS_LOCK: [
|
|
651
|
+
robloxJoinCode: string,
|
|
652
|
+
team: ERLCTeams,
|
|
653
|
+
maxPlayers: number
|
|
654
|
+
];
|
|
655
|
+
ERLC_TEAMS_UNLOCK: [
|
|
656
|
+
robloxJoinCode: string,
|
|
657
|
+
team: ERLCTeams
|
|
658
|
+
];
|
|
643
659
|
RADIO_GET_COMMUNITY_CHANNELS: [];
|
|
644
660
|
RADIO_GET_CONNECTED_USERS: [];
|
|
645
661
|
RADIO_GET_CONNECTED_USER: [
|
|
@@ -571,6 +571,18 @@ exports.ERLCMSAPITypes = [
|
|
|
571
571
|
path: "erlc/command",
|
|
572
572
|
method: "POST",
|
|
573
573
|
minVersion: 0
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
type: "ERLC_TEAMS_LOCK",
|
|
577
|
+
path: "erlc/teams/lock",
|
|
578
|
+
method: "POST",
|
|
579
|
+
minVersion: 0
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
type: "ERLC_TEAMS_UNLOCK",
|
|
583
|
+
path: "erlc/teams/unlock",
|
|
584
|
+
method: "POST",
|
|
585
|
+
minVersion: 0
|
|
574
586
|
}
|
|
575
587
|
];
|
|
576
588
|
exports.RadioAPITypes = [
|
|
@@ -319,4 +319,19 @@ export declare class CMSManager extends BaseManager {
|
|
|
319
319
|
playerRobloxId?: string | number;
|
|
320
320
|
points?: number;
|
|
321
321
|
}): Promise<globalTypes.CMSERLCAddNewRecordPromiseResult>;
|
|
322
|
+
/**
|
|
323
|
+
* Adds a new ERLC record for a player.
|
|
324
|
+
* @param {string} robloxJoinCode The roblox join code to add the record to.
|
|
325
|
+
* @param {string} team The ERLC team to be player limit locked
|
|
326
|
+
* @param {number} maxPlayers The maximum amount of players that are allowed on the team
|
|
327
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
328
|
+
* */
|
|
329
|
+
erlcTeamsLock(robloxJoinCode: string, team: globalTypes.ERLCTeams, maxPlayers: number): Promise<globalTypes.CMSERLCTeamsLockPromiseResult>;
|
|
330
|
+
/**
|
|
331
|
+
* Adds a new ERLC record for a player.
|
|
332
|
+
* @param {string} robloxJoinCode The roblox join code to add the record to.
|
|
333
|
+
* @param {string} team The ERLC team to no longer be player limit locked
|
|
334
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
335
|
+
* */
|
|
336
|
+
erlcTeamsUnlock(robloxJoinCode: string, team: globalTypes.ERLCTeams): Promise<globalTypes.CMSERLCTeamsUnlockPromiseResult>;
|
|
322
337
|
}
|
|
@@ -935,5 +935,52 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
935
935
|
}
|
|
936
936
|
});
|
|
937
937
|
}
|
|
938
|
+
/**
|
|
939
|
+
* Adds a new ERLC record for a player.
|
|
940
|
+
* @param {string} robloxJoinCode The roblox join code to add the record to.
|
|
941
|
+
* @param {string} team The ERLC team to be player limit locked
|
|
942
|
+
* @param {number} maxPlayers The maximum amount of players that are allowed on the team
|
|
943
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
944
|
+
* */
|
|
945
|
+
async erlcTeamsLock(robloxJoinCode, team, maxPlayers) {
|
|
946
|
+
return new Promise(async (resolve, reject) => {
|
|
947
|
+
var _a;
|
|
948
|
+
try {
|
|
949
|
+
const erlcTeamsLockRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('ERLC_TEAMS_LOCK', robloxJoinCode, team, maxPlayers));
|
|
950
|
+
resolve({ success: true, reason: erlcTeamsLockRequest });
|
|
951
|
+
}
|
|
952
|
+
catch (err) {
|
|
953
|
+
if (err instanceof src_1.APIError) {
|
|
954
|
+
resolve({ success: false, reason: err.response });
|
|
955
|
+
}
|
|
956
|
+
else {
|
|
957
|
+
reject(err);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Adds a new ERLC record for a player.
|
|
964
|
+
* @param {string} robloxJoinCode The roblox join code to add the record to.
|
|
965
|
+
* @param {string} team The ERLC team to no longer be player limit locked
|
|
966
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
967
|
+
* */
|
|
968
|
+
async erlcTeamsUnlock(robloxJoinCode, team) {
|
|
969
|
+
return new Promise(async (resolve, reject) => {
|
|
970
|
+
var _a;
|
|
971
|
+
try {
|
|
972
|
+
const erlcTeamsLockRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('ERLC_TEAMS_UNLOCK', robloxJoinCode, team));
|
|
973
|
+
resolve({ success: true, reason: erlcTeamsLockRequest });
|
|
974
|
+
}
|
|
975
|
+
catch (err) {
|
|
976
|
+
if (err instanceof src_1.APIError) {
|
|
977
|
+
resolve({ success: false, reason: err.response });
|
|
978
|
+
}
|
|
979
|
+
else {
|
|
980
|
+
reject(err);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
}
|
|
938
985
|
}
|
|
939
986
|
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.56",
|
|
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
|
@@ -553,6 +553,18 @@ export interface CMSERLCExecuteCommandPromiseResult {
|
|
|
553
553
|
data?: unknown;
|
|
554
554
|
}
|
|
555
555
|
|
|
556
|
+
export type ERLCTeams = 'police' | 'sheriff' | 'fire' | 'dot';
|
|
557
|
+
|
|
558
|
+
export interface CMSERLCTeamsLockPromiseResult {
|
|
559
|
+
success: boolean;
|
|
560
|
+
reason: string;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export interface CMSERLCTeamsUnlockPromiseResult {
|
|
564
|
+
success: boolean;
|
|
565
|
+
reason: string;
|
|
566
|
+
}
|
|
567
|
+
|
|
556
568
|
export interface RadioChannelGroup {
|
|
557
569
|
id: number;
|
|
558
570
|
name: string;
|
package/src/index.ts
CHANGED
|
@@ -46,5 +46,7 @@ export {
|
|
|
46
46
|
CMSERLCGetPlayerQueuePromiseResult,
|
|
47
47
|
CMSERLCAddNewRecordPromiseResult,
|
|
48
48
|
CMSERLCExecuteCommandPayload,
|
|
49
|
-
CMSERLCExecuteCommandPromiseResult
|
|
49
|
+
CMSERLCExecuteCommandPromiseResult,
|
|
50
|
+
CMSERLCTeamsLockPromiseResult,
|
|
51
|
+
CMSERLCTeamsUnlockPromiseResult
|
|
50
52
|
} from './constants';
|
|
@@ -342,6 +342,16 @@ export class REST extends EventEmitter {
|
|
|
342
342
|
label: args[3]
|
|
343
343
|
};
|
|
344
344
|
}
|
|
345
|
+
case 'CLOSE_CALL': {
|
|
346
|
+
const payload = args[0];
|
|
347
|
+
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
348
|
+
return payload;
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
serverId: args[0],
|
|
352
|
+
callId: args[1]
|
|
353
|
+
};
|
|
354
|
+
}
|
|
345
355
|
case 'UNIT_STATUS': {
|
|
346
356
|
const payload = args[0];
|
|
347
357
|
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
@@ -554,6 +564,38 @@ export class REST extends EventEmitter {
|
|
|
554
564
|
};
|
|
555
565
|
});
|
|
556
566
|
}
|
|
567
|
+
case 'ERLC_TEAMS_LOCK': {
|
|
568
|
+
const payload = args[0];
|
|
569
|
+
if (!Array.isArray(payload)) {
|
|
570
|
+
throw new Error('ERLC_TEAMS_LOCK requires an array of command payloads.');
|
|
571
|
+
}
|
|
572
|
+
return payload.map((cmd) => {
|
|
573
|
+
const robloxJoinCode = cmd.robloxJoinCode;
|
|
574
|
+
if (typeof robloxJoinCode !== 'string' || robloxJoinCode.length === 0) {
|
|
575
|
+
throw new Error('ERLC_TEAMS_LOCK requires each command to include a valid robloxJoinCode.');
|
|
576
|
+
}
|
|
577
|
+
return {
|
|
578
|
+
...cmd,
|
|
579
|
+
robloxJoinCode
|
|
580
|
+
};
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
case 'ERLC_TEAMS_UNLOCK': {
|
|
584
|
+
const payload = args[0];
|
|
585
|
+
if (!Array.isArray(payload)) {
|
|
586
|
+
throw new Error('ERLC_TEAMS_UNLOCK requires an array of command payloads.');
|
|
587
|
+
}
|
|
588
|
+
return payload.map((cmd) => {
|
|
589
|
+
const robloxJoinCode = cmd.robloxJoinCode;
|
|
590
|
+
if (typeof robloxJoinCode !== 'string' || robloxJoinCode.length === 0) {
|
|
591
|
+
throw new Error('ERLC_TEAMS_UNLOCK requires each command to include a valid robloxJoinCode.');
|
|
592
|
+
}
|
|
593
|
+
return {
|
|
594
|
+
...cmd,
|
|
595
|
+
robloxJoinCode
|
|
596
|
+
};
|
|
597
|
+
});
|
|
598
|
+
}
|
|
557
599
|
case 'RADIO_GET_COMMUNITY_CHANNELS':
|
|
558
600
|
case 'RADIO_GET_CONNECTED_USERS':
|
|
559
601
|
case 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP': {
|
|
@@ -182,6 +182,14 @@ export class RequestManager extends EventEmitter {
|
|
|
182
182
|
apiData.data.data = clonedData;
|
|
183
183
|
break;
|
|
184
184
|
}
|
|
185
|
+
case 'ERLC_TEAMS_LOCK': {
|
|
186
|
+
apiData.data.data = clonedData;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
case 'ERLC_TEAMS_UNLOCK': {
|
|
190
|
+
apiData.data.data = clonedData;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
185
193
|
case 'SET_PENAL_CODES': {
|
|
186
194
|
apiData.data.data = [clonedData[0]];
|
|
187
195
|
break;
|
|
@@ -306,6 +314,10 @@ export class RequestManager extends EventEmitter {
|
|
|
306
314
|
}
|
|
307
315
|
break;
|
|
308
316
|
}
|
|
317
|
+
case 'CLOSE_CALL': {
|
|
318
|
+
apiData.data.data = [clonedData];
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
309
321
|
case 'UNIT_PANIC': {
|
|
310
322
|
const payload = data.data;
|
|
311
323
|
if (Array.isArray(payload)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload, CMSERLCExecuteCommandPayload } from '../../../../../constants';
|
|
1
|
+
import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload, CMSERLCExecuteCommandPayload, ERLCTeams } from '../../../../../constants';
|
|
2
2
|
import type { RESTOptions } from '../REST';
|
|
3
3
|
|
|
4
4
|
export const DefaultUserAgent = 'Sonoran.js NPM Module';
|
|
@@ -608,6 +608,18 @@ export const ERLCMSAPITypes: APITypeData[] = [
|
|
|
608
608
|
path: "erlc/command",
|
|
609
609
|
method: "POST",
|
|
610
610
|
minVersion: 0
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
type: "ERLC_TEAMS_LOCK",
|
|
614
|
+
path: "erlc/teams/lock",
|
|
615
|
+
method: "POST",
|
|
616
|
+
minVersion: 0
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
type: "ERLC_TEAMS_UNLOCK",
|
|
620
|
+
path: "erlc/teams/unlock",
|
|
621
|
+
method: "POST",
|
|
622
|
+
minVersion: 0
|
|
611
623
|
}
|
|
612
624
|
];
|
|
613
625
|
|
|
@@ -679,7 +691,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
679
691
|
|
|
680
692
|
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) ];
|
|
681
693
|
|
|
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';
|
|
694
|
+
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' | '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';
|
|
683
695
|
|
|
684
696
|
export interface CMSServerAPIStruct {
|
|
685
697
|
id: number;
|
|
@@ -914,6 +926,13 @@ export interface CADGetActiveUnitsStruct {
|
|
|
914
926
|
offset?: number;
|
|
915
927
|
}
|
|
916
928
|
|
|
929
|
+
export interface CADDispatchNoteStruct {
|
|
930
|
+
time: string;
|
|
931
|
+
label: string;
|
|
932
|
+
type: string;
|
|
933
|
+
content: string;
|
|
934
|
+
}
|
|
935
|
+
|
|
917
936
|
export interface CADAttachUnitsStruct {
|
|
918
937
|
serverId: number;
|
|
919
938
|
callId: number;
|
|
@@ -959,6 +978,7 @@ interface CADNewDispatchBaseStruct {
|
|
|
959
978
|
primary: number;
|
|
960
979
|
trackPrimary: boolean;
|
|
961
980
|
description: string;
|
|
981
|
+
notes: CADDispatchNoteStruct[];
|
|
962
982
|
metaData: Record<string, string>;
|
|
963
983
|
}
|
|
964
984
|
|
|
@@ -1318,6 +1338,15 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1318
1338
|
ERLC_EXECUTE_COMMAND: [
|
|
1319
1339
|
commands: CMSERLCExecuteCommandPayload[]
|
|
1320
1340
|
]
|
|
1341
|
+
ERLC_TEAMS_LOCK: [
|
|
1342
|
+
robloxJoinCode: string,
|
|
1343
|
+
team: ERLCTeams,
|
|
1344
|
+
maxPlayers: number
|
|
1345
|
+
]
|
|
1346
|
+
ERLC_TEAMS_UNLOCK: [
|
|
1347
|
+
robloxJoinCode: string,
|
|
1348
|
+
team: ERLCTeams,
|
|
1349
|
+
]
|
|
1321
1350
|
// Radio
|
|
1322
1351
|
RADIO_GET_COMMUNITY_CHANNELS: [];
|
|
1323
1352
|
RADIO_GET_CONNECTED_USERS: [];
|
|
@@ -863,4 +863,47 @@ export class CMSManager extends BaseManager {
|
|
|
863
863
|
}
|
|
864
864
|
});
|
|
865
865
|
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Adds a new ERLC record for a player.
|
|
869
|
+
* @param {string} robloxJoinCode The roblox join code to add the record to.
|
|
870
|
+
* @param {string} team The ERLC team to be player limit locked
|
|
871
|
+
* @param {number} maxPlayers The maximum amount of players that are allowed on the team
|
|
872
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
873
|
+
* */
|
|
874
|
+
public async erlcTeamsLock(robloxJoinCode: string, team: globalTypes.ERLCTeams, maxPlayers: number): Promise<globalTypes.CMSERLCTeamsLockPromiseResult> {
|
|
875
|
+
return new Promise(async (resolve, reject) => {
|
|
876
|
+
try {
|
|
877
|
+
const erlcTeamsLockRequest: any = await this.rest?.request('ERLC_TEAMS_LOCK', robloxJoinCode, team, maxPlayers);
|
|
878
|
+
resolve({ success: true, reason: erlcTeamsLockRequest });
|
|
879
|
+
} catch (err) {
|
|
880
|
+
if (err instanceof APIError) {
|
|
881
|
+
resolve({ success: false, reason: err.response });
|
|
882
|
+
} else {
|
|
883
|
+
reject(err);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Adds a new ERLC record for a player.
|
|
891
|
+
* @param {string} robloxJoinCode The roblox join code to add the record to.
|
|
892
|
+
* @param {string} team The ERLC team to no longer be player limit locked
|
|
893
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
894
|
+
* */
|
|
895
|
+
public async erlcTeamsUnlock(robloxJoinCode: string, team: globalTypes.ERLCTeams): Promise<globalTypes.CMSERLCTeamsUnlockPromiseResult> {
|
|
896
|
+
return new Promise(async (resolve, reject) => {
|
|
897
|
+
try {
|
|
898
|
+
const erlcTeamsLockRequest: any = await this.rest?.request('ERLC_TEAMS_UNLOCK', robloxJoinCode, team);
|
|
899
|
+
resolve({ success: true, reason: erlcTeamsLockRequest });
|
|
900
|
+
} catch (err) {
|
|
901
|
+
if (err instanceof APIError) {
|
|
902
|
+
resolve({ success: false, reason: err.response });
|
|
903
|
+
} else {
|
|
904
|
+
reject(err);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
}
|
|
866
909
|
}
|