@sonoransoftware/sonoran.js 1.0.35 → 1.0.37
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/LICENSE +24 -0
- package/dist/constants.d.ts +56 -0
- package/dist/index.d.ts +1 -1
- package/dist/libs/rest/src/lib/REST.js +17 -0
- package/dist/libs/rest/src/lib/RequestManager.js +37 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +13 -4
- package/dist/libs/rest/src/lib/utils/constants.js +18 -0
- package/dist/managers/CADActiveUnitsManager.d.ts +3 -0
- package/dist/managers/CADActiveUnitsManager.js +16 -6
- package/dist/managers/CADManager.d.ts +195 -0
- package/dist/managers/CADManager.js +423 -4
- package/dist/managers/CADServerManager.d.ts +11 -0
- package/dist/managers/CADServerManager.js +56 -13
- package/dist/managers/CMSManager.d.ts +24 -0
- package/dist/managers/CMSManager.js +79 -3
- package/dist/managers/CMSServerManager.d.ts +5 -0
- package/dist/managers/CMSServerManager.js +33 -24
- package/dist/managers/RadioManager.d.ts +7 -0
- package/dist/managers/RadioManager.js +23 -0
- package/package.json +1 -1
- package/readme.md +158 -32
- package/src/constants.ts +66 -0
- package/src/index.ts +7 -0
- package/src/libs/rest/src/lib/REST.ts +17 -0
- package/src/libs/rest/src/lib/RequestManager.ts +37 -0
- package/src/libs/rest/src/lib/utils/constants.ts +31 -4
- package/src/managers/CADActiveUnitsManager.ts +19 -6
- package/src/managers/CADManager.ts +488 -3
- package/src/managers/CADServerManager.ts +59 -15
- package/src/managers/CMSManager.ts +75 -2
- package/src/managers/CMSServerManager.ts +33 -22
- package/src/managers/RadioManager.ts +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
PolyForm Noncommercial License 1.0.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2025] [Sonoran Software Systems, LLC]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the “Software”), to
|
|
7
|
+
use, copy, modify, and distribute the Software, for any noncommercial purpose,
|
|
8
|
+
subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
1. Noncommercial Use Only. You may not use the Software for a commercial
|
|
11
|
+
purpose. “Commercial purpose” means the sale, lease, license, or other
|
|
12
|
+
commercial exploitation of the Software, or the use of the Software to
|
|
13
|
+
provide a service or product for which you receive compensation.
|
|
14
|
+
|
|
15
|
+
2. Compliance and Attribution. You must ensure that anyone who uses the
|
|
16
|
+
Software complies with this license, and you must retain the above
|
|
17
|
+
copyright notice and this license in all copies or substantial portions
|
|
18
|
+
of the Software.
|
|
19
|
+
|
|
20
|
+
3. No Warranty. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
|
|
21
|
+
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
22
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
23
|
+
|
|
24
|
+
See https://polyformproject.org/licenses/noncommercial/1.0.0/ for the full license text.
|
package/dist/constants.d.ts
CHANGED
|
@@ -247,6 +247,11 @@ export interface CADLeaveCommunityPromiseResult {
|
|
|
247
247
|
reason?: string;
|
|
248
248
|
data?: unknown;
|
|
249
249
|
}
|
|
250
|
+
export interface CADStandardResponse<T = unknown> {
|
|
251
|
+
success: boolean;
|
|
252
|
+
data?: T;
|
|
253
|
+
reason?: unknown;
|
|
254
|
+
}
|
|
250
255
|
export interface CMSProfileField {
|
|
251
256
|
id: string;
|
|
252
257
|
type: string;
|
|
@@ -312,6 +317,11 @@ export interface CMSRsvpPromiseResult {
|
|
|
312
317
|
status?: string;
|
|
313
318
|
data?: unknown;
|
|
314
319
|
}
|
|
320
|
+
export interface CMSChangeFormStagePromiseResult {
|
|
321
|
+
success: boolean;
|
|
322
|
+
reason?: string;
|
|
323
|
+
data?: unknown;
|
|
324
|
+
}
|
|
315
325
|
export interface CMSSetGameServerStruct {
|
|
316
326
|
id?: number;
|
|
317
327
|
name: string;
|
|
@@ -327,6 +337,38 @@ export interface CMSSetGameServersPromiseResult {
|
|
|
327
337
|
reason?: string;
|
|
328
338
|
data?: CMSSetGameServerStruct[];
|
|
329
339
|
}
|
|
340
|
+
export interface CMSExecuteRankPromotionResult {
|
|
341
|
+
users: string[];
|
|
342
|
+
flow: string;
|
|
343
|
+
promote: boolean;
|
|
344
|
+
succeeded: boolean;
|
|
345
|
+
message?: string;
|
|
346
|
+
}
|
|
347
|
+
export interface CMSTriggerPromotionFlowPayload {
|
|
348
|
+
userId: string;
|
|
349
|
+
flowId: string;
|
|
350
|
+
users: string[];
|
|
351
|
+
promote: boolean;
|
|
352
|
+
}
|
|
353
|
+
export interface CMSPromotionFlow {
|
|
354
|
+
id: string;
|
|
355
|
+
communityUuid: string;
|
|
356
|
+
labelFrom: string;
|
|
357
|
+
labelTo: string;
|
|
358
|
+
ranksToAdd: string[];
|
|
359
|
+
ranksToRemove: string[];
|
|
360
|
+
actions: unknown[];
|
|
361
|
+
}
|
|
362
|
+
export interface CMSTriggerPromotionFlowsPromiseResult {
|
|
363
|
+
success: boolean;
|
|
364
|
+
reason?: string;
|
|
365
|
+
data?: CMSExecuteRankPromotionResult[];
|
|
366
|
+
}
|
|
367
|
+
export interface CMSGetPromotionFlowsPromiseResult {
|
|
368
|
+
success: boolean;
|
|
369
|
+
reason?: string;
|
|
370
|
+
data?: CMSPromotionFlow[];
|
|
371
|
+
}
|
|
330
372
|
export interface CMSGetFormSubmissionsPromiseResult<T = unknown> {
|
|
331
373
|
success: boolean;
|
|
332
374
|
reason?: string;
|
|
@@ -400,6 +442,15 @@ export interface RadioSpeakerLocation {
|
|
|
400
442
|
label: string;
|
|
401
443
|
id: string;
|
|
402
444
|
}
|
|
445
|
+
export type RadioTonePlayTargetType = 'channel' | 'group' | 'game';
|
|
446
|
+
export interface RadioTonePlayTarget {
|
|
447
|
+
label: string;
|
|
448
|
+
type: RadioTonePlayTargetType;
|
|
449
|
+
value: unknown;
|
|
450
|
+
group: number | null;
|
|
451
|
+
icon?: string;
|
|
452
|
+
color?: string;
|
|
453
|
+
}
|
|
403
454
|
export interface RadioSetUserChannelsOptions {
|
|
404
455
|
transmit?: number;
|
|
405
456
|
scan?: number[];
|
|
@@ -462,3 +513,8 @@ export interface RadioSetInGameSpeakerLocationsPromiseResult {
|
|
|
462
513
|
reason?: string;
|
|
463
514
|
result?: string;
|
|
464
515
|
}
|
|
516
|
+
export interface RadioPlayTonePromiseResult {
|
|
517
|
+
success: boolean;
|
|
518
|
+
reason?: string;
|
|
519
|
+
result?: string;
|
|
520
|
+
}
|
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, CMSProfileField, CMSGetCurrentClockInPromiseResult, CMSAccountsPage, CMSAccountSummary, CMSGetAccountsPromiseResult, CMSGetProfileFieldsPromiseResult, CMSProfileFieldUpdate, CMSEditAccountProfileFieldsPromiseResult, CMSRsvpPromiseResult, CMSSetGameServerStruct, CMSSetGameServersPromiseResult, CMSGetFormSubmissionsPromiseResult } 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 } from './constants';
|
|
@@ -269,6 +269,16 @@ class REST extends events_1.EventEmitter {
|
|
|
269
269
|
uniqueId: args[4],
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
|
+
case 'TRIGGER_PROMOTION_FLOWS': {
|
|
273
|
+
const payload = args[0];
|
|
274
|
+
if (!Array.isArray(payload)) {
|
|
275
|
+
throw new Error('TRIGGER_PROMOTION_FLOWS requires an array of promotion flow payloads.');
|
|
276
|
+
}
|
|
277
|
+
return payload;
|
|
278
|
+
}
|
|
279
|
+
case 'GET_PROMOTION_FLOWS': {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
272
282
|
case 'ERLC_GET_ONLINE_PLAYERS': {
|
|
273
283
|
return {
|
|
274
284
|
robloxJoinCode: args[0]
|
|
@@ -324,6 +334,13 @@ class REST extends events_1.EventEmitter {
|
|
|
324
334
|
token: args[1]
|
|
325
335
|
};
|
|
326
336
|
}
|
|
337
|
+
case 'PLAY_TONE': {
|
|
338
|
+
return {
|
|
339
|
+
roomId: args[0],
|
|
340
|
+
tones: args[1],
|
|
341
|
+
playTo: args[2]
|
|
342
|
+
};
|
|
343
|
+
}
|
|
327
344
|
default: {
|
|
328
345
|
return args;
|
|
329
346
|
}
|
|
@@ -93,6 +93,14 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
93
93
|
apiData.data.data = clonedData;
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
|
+
case 'TRIGGER_PROMOTION_FLOWS': {
|
|
97
|
+
apiData.data.data = clonedData;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case 'GET_PROMOTION_FLOWS': {
|
|
101
|
+
apiData.data.data = [];
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
96
104
|
case 'SET_PENAL_CODES': {
|
|
97
105
|
apiData.data.data = [clonedData[0]];
|
|
98
106
|
break;
|
|
@@ -370,6 +378,35 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
370
378
|
path = apiType.path;
|
|
371
379
|
break;
|
|
372
380
|
}
|
|
381
|
+
case 'PLAY_TONE': {
|
|
382
|
+
const auth = ensureAuth();
|
|
383
|
+
const roomIdRaw = payload === null || payload === void 0 ? void 0 : payload.roomId;
|
|
384
|
+
if (roomIdRaw === undefined || roomIdRaw === null) {
|
|
385
|
+
throw new Error('roomId is required for PLAY_TONE requests.');
|
|
386
|
+
}
|
|
387
|
+
const roomIdNumber = typeof roomIdRaw === 'number' ? roomIdRaw : Number(roomIdRaw);
|
|
388
|
+
if (Number.isNaN(roomIdNumber)) {
|
|
389
|
+
throw new Error('roomId must be a number for PLAY_TONE requests.');
|
|
390
|
+
}
|
|
391
|
+
const tones = payload === null || payload === void 0 ? void 0 : payload.tones;
|
|
392
|
+
if (!Array.isArray(tones) || tones.length === 0) {
|
|
393
|
+
throw new Error('tones array is required for PLAY_TONE requests.');
|
|
394
|
+
}
|
|
395
|
+
const playTo = payload === null || payload === void 0 ? void 0 : payload.playTo;
|
|
396
|
+
if (!Array.isArray(playTo) || playTo.length === 0) {
|
|
397
|
+
throw new Error('playTo array is required for PLAY_TONE requests.');
|
|
398
|
+
}
|
|
399
|
+
method = 'POST';
|
|
400
|
+
body = {
|
|
401
|
+
id: auth.id,
|
|
402
|
+
key: auth.key,
|
|
403
|
+
roomId: roomIdNumber,
|
|
404
|
+
tones,
|
|
405
|
+
playTo
|
|
406
|
+
};
|
|
407
|
+
path = apiType.path;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
373
410
|
default: {
|
|
374
411
|
throw new Error(`Unsupported radio API type received: ${apiType.type}`);
|
|
375
412
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, CMSProfileFieldUpdate, CMSSetGameServerStruct } from '../../../../../constants';
|
|
1
|
+
import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload } 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_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'GET_CURRENT_CLOCK_IN' | 'GET_ACCOUNTS' | 'GET_PROFILE_FIELDS' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'GET_FORM_TEMPLATE_SUBMISSIONS' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'RADIO_GET_COMMUNITY_CHANNELS' | 'RADIO_GET_CONNECTED_USERS' | 'RADIO_GET_CONNECTED_USER' | 'RADIO_SET_USER_CHANNELS' | 'RADIO_SET_USER_DISPLAY_NAME' | 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP' | 'RADIO_SET_SERVER_IP' | 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS';
|
|
41
|
+
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'SET_CLOCK' | 'JOIN_COMMUNITY' | 'LEAVE_COMMUNITY' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'GET_CURRENT_CLOCK_IN' | 'GET_ACCOUNTS' | 'GET_PROFILE_FIELDS' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'GET_FORM_TEMPLATE_SUBMISSIONS' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'RADIO_GET_COMMUNITY_CHANNELS' | 'RADIO_GET_CONNECTED_USERS' | 'RADIO_GET_CONNECTED_USER' | 'RADIO_SET_USER_CHANNELS' | 'RADIO_SET_USER_DISPLAY_NAME' | 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP' | 'RADIO_SET_SERVER_IP' | 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS' | 'PLAY_TONE';
|
|
42
42
|
export interface CMSServerAPIStruct {
|
|
43
43
|
id: number;
|
|
44
44
|
name: string;
|
|
@@ -391,7 +391,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
391
391
|
serverId: number,
|
|
392
392
|
callId: number
|
|
393
393
|
];
|
|
394
|
-
'
|
|
394
|
+
'911_CALL': [
|
|
395
395
|
serverId: number,
|
|
396
396
|
isEmergency: boolean,
|
|
397
397
|
caller: string,
|
|
@@ -480,6 +480,10 @@ export interface RESTTypedAPIDataStructs {
|
|
|
480
480
|
discordId: string | undefined,
|
|
481
481
|
uniqueId: string | undefined
|
|
482
482
|
];
|
|
483
|
+
TRIGGER_PROMOTION_FLOWS: [
|
|
484
|
+
data: CMSTriggerPromotionFlowPayload[]
|
|
485
|
+
];
|
|
486
|
+
GET_PROMOTION_FLOWS: [];
|
|
483
487
|
GET_GAME_SERVERS: [];
|
|
484
488
|
SET_GAME_SERVERS: [servers: CMSSetGameServerStruct[]];
|
|
485
489
|
VERIFY_WHITELIST: [
|
|
@@ -573,9 +577,14 @@ export interface RESTTypedAPIDataStructs {
|
|
|
573
577
|
locations: RadioSpeakerLocation[],
|
|
574
578
|
token?: string
|
|
575
579
|
];
|
|
580
|
+
PLAY_TONE: [
|
|
581
|
+
roomId: number,
|
|
582
|
+
tones: number[],
|
|
583
|
+
playTo: RadioTonePlayTarget[]
|
|
584
|
+
];
|
|
576
585
|
}
|
|
577
586
|
export type PossibleRequestData = undefined | {
|
|
578
|
-
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct;
|
|
587
|
+
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[];
|
|
579
588
|
} | {
|
|
580
589
|
servers: CADServerAPIStruct[];
|
|
581
590
|
deployMap: boolean;
|
|
@@ -423,6 +423,18 @@ exports.GeneralCMSAPITypes = [
|
|
|
423
423
|
path: 'general/force_sync',
|
|
424
424
|
method: 'POST',
|
|
425
425
|
minVersion: 0
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
type: 'TRIGGER_PROMOTION_FLOWS',
|
|
429
|
+
path: 'general/trigger_promotion_flows',
|
|
430
|
+
method: 'POST',
|
|
431
|
+
minVersion: 0
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
type: 'GET_PROMOTION_FLOWS',
|
|
435
|
+
path: 'general/get_promotion_flows',
|
|
436
|
+
method: 'POST',
|
|
437
|
+
minVersion: 0
|
|
426
438
|
}
|
|
427
439
|
];
|
|
428
440
|
exports.ServersCMSAPITypes = [
|
|
@@ -549,6 +561,12 @@ exports.RadioAPITypes = [
|
|
|
549
561
|
path: 'radio/set-server-speakers',
|
|
550
562
|
method: 'POST',
|
|
551
563
|
minVersion: 0
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
type: 'PLAY_TONE',
|
|
567
|
+
path: 'api/play-tone',
|
|
568
|
+
method: 'POST',
|
|
569
|
+
minVersion: 0
|
|
552
570
|
}
|
|
553
571
|
];
|
|
554
572
|
function formatForAll(array, product) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Instance } from '../instance/Instance';
|
|
2
|
+
import * as globalTypes from '../constants';
|
|
3
|
+
import type { CADGetActiveUnitsStruct } from '../libs/rest/src';
|
|
2
4
|
import { CADActiveUnit, CADActiveUnitResolvable, CADActiveUnitStruct } from '../structures/CADActiveUnit';
|
|
3
5
|
import { CacheManager } from './CacheManager';
|
|
4
6
|
export declare class CADActiveUnitsManager extends CacheManager<number, CADActiveUnit, CADActiveUnitResolvable> {
|
|
@@ -7,6 +9,7 @@ export declare class CADActiveUnitsManager extends CacheManager<number, CADActiv
|
|
|
7
9
|
constructor(instance: Instance, iterable: Iterable<CADActiveUnitStruct>, serverId: number);
|
|
8
10
|
_add(data: any, cache?: boolean): any;
|
|
9
11
|
fetch(): void;
|
|
12
|
+
getActiveUnits(options?: Partial<CADGetActiveUnitsStruct>): Promise<globalTypes.CADStandardResponse>;
|
|
10
13
|
_fetchSingle({ unit, includeOffline, force }: {
|
|
11
14
|
unit: CADActiveUnitResolvable;
|
|
12
15
|
includeOffline: boolean;
|
|
@@ -21,18 +21,28 @@ class CADActiveUnitsManager extends CacheManager_1.CacheManager {
|
|
|
21
21
|
force: false
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
async
|
|
24
|
+
async getActiveUnits(options = {}) {
|
|
25
25
|
var _a, _b;
|
|
26
|
+
if (!this.instance.cad) {
|
|
27
|
+
throw new Error('CAD manager is not initialized.');
|
|
28
|
+
}
|
|
29
|
+
const payload = {
|
|
30
|
+
serverId: (_a = options.serverId) !== null && _a !== void 0 ? _a : this.serverId,
|
|
31
|
+
includeOffline: (_b = options.includeOffline) !== null && _b !== void 0 ? _b : false,
|
|
32
|
+
onlyUnits: options.onlyUnits,
|
|
33
|
+
limit: options.limit,
|
|
34
|
+
offset: options.offset
|
|
35
|
+
};
|
|
36
|
+
return this.instance.cad.getActiveUnits(payload);
|
|
37
|
+
}
|
|
38
|
+
async _fetchSingle({ unit, includeOffline = false, force = false }) {
|
|
26
39
|
if (!force) {
|
|
27
40
|
const existing = this.cache.get(unit);
|
|
28
41
|
if (existing)
|
|
29
42
|
return existing;
|
|
30
43
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
includeOffline
|
|
34
|
-
}));
|
|
35
|
-
console.log(data);
|
|
44
|
+
const result = await this.getActiveUnits({ includeOffline });
|
|
45
|
+
console.log(result);
|
|
36
46
|
}
|
|
37
47
|
}
|
|
38
48
|
exports.CADActiveUnitsManager = CADActiveUnitsManager;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Instance } from '../instance/Instance';
|
|
2
2
|
import { CADSubscriptionVersionEnum } from '../constants';
|
|
3
3
|
import { REST } from '../libs/rest/src';
|
|
4
|
+
import type { CADPenalCodeStruct, CADSetAPIIDStruct, CADNewEditRecordOptionOneStruct, CADNewEditRecordOptionTwoStruct, CADLookupByIntStruct, CADLookupStruct, CADModifyAccountPermsStruct, CADKickBanUserStruct, CADSetPostalStruct, CADModifyIdentifierStruct, CADAddBlipStruct, CADModifyBlipStruct, CADGetCallsStruct, CADGetActiveUnitsStruct, CADNewDispatchStruct, CADStreetSignStruct, CADUnitLocationStruct } from '../libs/rest/src';
|
|
4
5
|
import { BaseManager } from './BaseManager';
|
|
5
6
|
import * as globalTypes from '../constants';
|
|
6
7
|
import { CADServerManager } from './CADServerManager';
|
|
@@ -15,6 +16,12 @@ export declare class CADManager extends BaseManager {
|
|
|
15
16
|
servers: CADServerManager | undefined;
|
|
16
17
|
constructor(instance: Instance);
|
|
17
18
|
protected buildManager(instance: Instance): Promise<void>;
|
|
19
|
+
private getRest;
|
|
20
|
+
private executeCadRequest;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the community's CAD subscription version.
|
|
23
|
+
*/
|
|
24
|
+
getVersion(): Promise<number>;
|
|
18
25
|
/**
|
|
19
26
|
* Gets a community account by `accId` or `apiId`.
|
|
20
27
|
* @param {Object} params The object that contains parameters to get a community account.
|
|
@@ -53,5 +60,193 @@ export declare class CADManager extends BaseManager {
|
|
|
53
60
|
} | Array<string | {
|
|
54
61
|
account: string;
|
|
55
62
|
}>): Promise<globalTypes.CADLeaveCommunityPromiseResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Updates the penal code configuration for the community.
|
|
65
|
+
*/
|
|
66
|
+
setPenalCodes(codes: CADPenalCodeStruct[]): Promise<globalTypes.CADStandardResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Assigns API IDs to a community account.
|
|
69
|
+
*/
|
|
70
|
+
setAccountApiIds(data: CADSetAPIIDStruct): Promise<globalTypes.CADStandardResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Retrieves record templates filtered by a specific record type.
|
|
73
|
+
*/
|
|
74
|
+
getRecordTemplates(recordTypeId?: number): Promise<globalTypes.CADStandardResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a new record entry.
|
|
77
|
+
*/
|
|
78
|
+
createRecord(data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct): Promise<globalTypes.CADStandardResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Updates an existing record entry.
|
|
81
|
+
*/
|
|
82
|
+
updateRecord(data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct): Promise<globalTypes.CADStandardResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Removes a record by its identifier.
|
|
85
|
+
*/
|
|
86
|
+
removeRecord(id: number): Promise<globalTypes.CADStandardResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Performs an internal lookup using the CAD lookup by identifier endpoint.
|
|
89
|
+
*/
|
|
90
|
+
lookupByInt(data: CADLookupByIntStruct): Promise<globalTypes.CADStandardResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Executes a CAD lookup using first/last name, plate, or other values.
|
|
93
|
+
*/
|
|
94
|
+
lookupRecords(data: CADLookupStruct): Promise<globalTypes.CADStandardResponse>;
|
|
95
|
+
/**
|
|
96
|
+
* Checks whether the provided API ID exists.
|
|
97
|
+
*/
|
|
98
|
+
checkApiId(apiId: string): Promise<globalTypes.CADStandardResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Applies a permission key to an account.
|
|
101
|
+
*/
|
|
102
|
+
applyPermissionKey(apiId: string | undefined, permissionKey: string): Promise<globalTypes.CADStandardResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Sets account permissions for a CAD user.
|
|
105
|
+
*/
|
|
106
|
+
setAccountPermissions(data: CADModifyAccountPermsStruct): Promise<globalTypes.CADStandardResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Bans or kicks a CAD user.
|
|
109
|
+
*/
|
|
110
|
+
banUser(data: CADKickBanUserStruct): Promise<globalTypes.CADStandardResponse>;
|
|
111
|
+
/**
|
|
112
|
+
* Verifies a secret string against CAD configuration.
|
|
113
|
+
*/
|
|
114
|
+
verifySecret(secret: string): Promise<globalTypes.CADStandardResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Authorizes street sign changes for a CAD server.
|
|
117
|
+
*/
|
|
118
|
+
authorizeStreetSigns(serverId: number): Promise<globalTypes.CADStandardResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Replaces the community postal list.
|
|
121
|
+
*/
|
|
122
|
+
setPostals(data: CADSetPostalStruct[]): Promise<globalTypes.CADStandardResponse>;
|
|
123
|
+
/**
|
|
124
|
+
* Sends a photo to CAD for the provided API ID.
|
|
125
|
+
*/
|
|
126
|
+
sendPhoto(apiId: string | undefined, url: string): Promise<globalTypes.CADStandardResponse>;
|
|
127
|
+
/**
|
|
128
|
+
* Retrieves characters belonging to an API ID.
|
|
129
|
+
*/
|
|
130
|
+
getCharacters(apiId: string): Promise<globalTypes.CADStandardResponse>;
|
|
131
|
+
/**
|
|
132
|
+
* Creates a new civilian character.
|
|
133
|
+
*/
|
|
134
|
+
createCharacter(data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct): Promise<globalTypes.CADStandardResponse>;
|
|
135
|
+
/**
|
|
136
|
+
* Updates an existing civilian character.
|
|
137
|
+
*/
|
|
138
|
+
updateCharacter(data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct): Promise<globalTypes.CADStandardResponse>;
|
|
139
|
+
/**
|
|
140
|
+
* Removes a civilian character by identifier.
|
|
141
|
+
*/
|
|
142
|
+
removeCharacter(id: number): Promise<globalTypes.CADStandardResponse>;
|
|
143
|
+
/**
|
|
144
|
+
* Retrieves identifiers assigned to an API ID.
|
|
145
|
+
*/
|
|
146
|
+
getIdentifiers(apiId: string): Promise<globalTypes.CADStandardResponse>;
|
|
147
|
+
/**
|
|
148
|
+
* Modifies identifiers for an account.
|
|
149
|
+
*/
|
|
150
|
+
modifyIdentifier(data: CADModifyIdentifierStruct): Promise<globalTypes.CADStandardResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Sets the active identifier by identifier ID.
|
|
153
|
+
*/
|
|
154
|
+
setIdentifier(apiId: string | undefined, identId: number): Promise<globalTypes.CADStandardResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Toggles panic state for a unit.
|
|
157
|
+
*/
|
|
158
|
+
setUnitPanic(apiId: string | undefined, isPanic: boolean): Promise<globalTypes.CADStandardResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* Updates a unit's status.
|
|
161
|
+
*/
|
|
162
|
+
setUnitStatus(apiId: string | undefined, status: number, serverId: number): Promise<globalTypes.CADStandardResponse>;
|
|
163
|
+
/**
|
|
164
|
+
* Retrieves live map blips for a CAD server.
|
|
165
|
+
*/
|
|
166
|
+
getBlips(serverId: number): Promise<globalTypes.CADStandardResponse>;
|
|
167
|
+
/**
|
|
168
|
+
* Adds blips to the CAD map.
|
|
169
|
+
*/
|
|
170
|
+
addBlips(blips: CADAddBlipStruct | CADAddBlipStruct[]): Promise<globalTypes.CADStandardResponse>;
|
|
171
|
+
/**
|
|
172
|
+
* Updates existing CAD map blips.
|
|
173
|
+
*/
|
|
174
|
+
updateBlips(blips: CADModifyBlipStruct | CADModifyBlipStruct[]): Promise<globalTypes.CADStandardResponse>;
|
|
175
|
+
/**
|
|
176
|
+
* Removes a CAD map blip.
|
|
177
|
+
*/
|
|
178
|
+
removeBlip(id: number): Promise<globalTypes.CADStandardResponse>;
|
|
179
|
+
/**
|
|
180
|
+
* Creates a new 911 call entry.
|
|
181
|
+
*/
|
|
182
|
+
create911Call(params: {
|
|
183
|
+
serverId: number;
|
|
184
|
+
isEmergency: boolean;
|
|
185
|
+
caller: string;
|
|
186
|
+
location: string;
|
|
187
|
+
description: string;
|
|
188
|
+
metaData?: Record<string, string>;
|
|
189
|
+
}): Promise<globalTypes.CADStandardResponse>;
|
|
190
|
+
/**
|
|
191
|
+
* Removes a 911 call by its identifier.
|
|
192
|
+
*/
|
|
193
|
+
remove911Call(callId: number): Promise<globalTypes.CADStandardResponse>;
|
|
194
|
+
/**
|
|
195
|
+
* Retrieves dispatch calls with optional pagination.
|
|
196
|
+
*/
|
|
197
|
+
getCalls(options: CADGetCallsStruct): Promise<globalTypes.CADStandardResponse>;
|
|
198
|
+
/**
|
|
199
|
+
* Retrieves active units for the provided filters.
|
|
200
|
+
*/
|
|
201
|
+
getActiveUnits(options: CADGetActiveUnitsStruct): Promise<globalTypes.CADStandardResponse>;
|
|
202
|
+
/**
|
|
203
|
+
* Kicks an active unit from the CAD.
|
|
204
|
+
*/
|
|
205
|
+
kickUnit(apiId: string | undefined, reason: string, serverId: number): Promise<globalTypes.CADStandardResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Creates a new dispatch call.
|
|
208
|
+
*/
|
|
209
|
+
createDispatch(data: CADNewDispatchStruct): Promise<globalTypes.CADStandardResponse>;
|
|
210
|
+
/**
|
|
211
|
+
* Attaches units to an existing dispatch call.
|
|
212
|
+
*/
|
|
213
|
+
attachUnits(serverId: number, callId: number, units: string[]): Promise<globalTypes.CADStandardResponse>;
|
|
214
|
+
/**
|
|
215
|
+
* Detaches units from dispatch calls.
|
|
216
|
+
*/
|
|
217
|
+
detachUnits(serverId: number, units: string[]): Promise<globalTypes.CADStandardResponse>;
|
|
218
|
+
/**
|
|
219
|
+
* Updates the postal code on a call.
|
|
220
|
+
*/
|
|
221
|
+
setCallPostal(serverId: number, callId: number, postal: string): Promise<globalTypes.CADStandardResponse>;
|
|
222
|
+
/**
|
|
223
|
+
* Updates a call's primary unit.
|
|
224
|
+
*/
|
|
225
|
+
setCallPrimary(serverId: number, callId: number, primary: number, trackPrimary: boolean): Promise<globalTypes.CADStandardResponse>;
|
|
226
|
+
/**
|
|
227
|
+
* Adds a note to an active call.
|
|
228
|
+
*/
|
|
229
|
+
addCallNote(serverId: number, callId: number, note: string): Promise<globalTypes.CADStandardResponse>;
|
|
230
|
+
/**
|
|
231
|
+
* Closes a CAD call.
|
|
232
|
+
*/
|
|
233
|
+
closeCall(serverId: number, callId: number): Promise<globalTypes.CADStandardResponse>;
|
|
234
|
+
/**
|
|
235
|
+
* Updates live unit locations on the CAD map.
|
|
236
|
+
*/
|
|
237
|
+
updateUnitLocations(locations: CADUnitLocationStruct[]): Promise<globalTypes.CADStandardResponse>;
|
|
238
|
+
/**
|
|
239
|
+
* Replaces the street sign configuration for a server.
|
|
240
|
+
*/
|
|
241
|
+
setStreetSignConfig(serverId: number, signConfig: CADStreetSignStruct[]): Promise<globalTypes.CADStandardResponse>;
|
|
242
|
+
/**
|
|
243
|
+
* Updates an existing street sign's text.
|
|
244
|
+
*/
|
|
245
|
+
updateStreetSign(serverId: number, signData: {
|
|
246
|
+
ids: number[];
|
|
247
|
+
text1: string;
|
|
248
|
+
text2: string;
|
|
249
|
+
text3: string;
|
|
250
|
+
}): Promise<globalTypes.CADStandardResponse>;
|
|
56
251
|
private normalizeAccountEntries;
|
|
57
252
|
}
|