@sonoransoftware/sonoran.js 1.0.33 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/auto-pr-on-branch-push.yml +89 -0
- package/.github/workflows/codex_instructions.md +24 -0
- package/.github/workflows/push-pr-nudge-codex.yml +50 -0
- package/dist/constants.d.ts +205 -1
- package/dist/constants.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/instance/Instance.d.ts +6 -0
- package/dist/instance/Instance.js +27 -0
- package/dist/instance/instance.types.d.ts +3 -0
- package/dist/libs/rest/src/lib/REST.d.ts +2 -1
- package/dist/libs/rest/src/lib/REST.js +113 -0
- package/dist/libs/rest/src/lib/RequestManager.d.ts +2 -0
- package/dist/libs/rest/src/lib/RequestManager.js +201 -0
- package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -1
- package/dist/libs/rest/src/lib/utils/constants.d.ts +105 -22
- package/dist/libs/rest/src/lib/utils/constants.js +112 -2
- package/dist/managers/CADManager.d.ts +28 -0
- package/dist/managers/CADManager.js +90 -0
- package/dist/managers/CMSManager.d.ts +60 -0
- package/dist/managers/CMSManager.js +156 -0
- package/dist/managers/CMSServerManager.d.ts +3 -0
- package/dist/managers/CMSServerManager.js +36 -2
- package/dist/managers/RadioManager.d.ts +55 -0
- package/dist/managers/RadioManager.js +224 -0
- package/package.json +1 -1
- package/readme.md +170 -0
- package/src/constants.ts +239 -2
- package/src/index.ts +35 -1
- package/src/instance/Instance.ts +30 -1
- package/src/instance/instance.types.ts +4 -1
- package/src/libs/rest/src/lib/REST.ts +112 -1
- package/src/libs/rest/src/lib/RequestManager.ts +221 -10
- package/src/libs/rest/src/lib/errors/RateLimitError.ts +20 -2
- package/src/libs/rest/src/lib/utils/constants.ts +215 -25
- package/src/managers/CADManager.ts +86 -1
- package/src/managers/CMSManager.ts +142 -1
- package/src/managers/CMSServerManager.ts +39 -6
- package/src/managers/RadioManager.ts +187 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CADDispatchStatusEnums = exports.CADDispatchOriginEnums = exports.CADModifyIdentifierActionEnums = exports.CADLookupByIntSearchTypeEnums = exports.CADRecordSectionCategoryEnums = exports.CADRecordTypeEnums = exports.AllAPITypes = exports.ERLCMSAPITypes = exports.CommunitiesCMSAPITypes = exports.FormsCMSAPITypes = exports.EventsCMSAPITypes = exports.ServersCMSAPITypes = exports.GeneralCMSAPITypes = exports.EmergencyCADAPITypes = exports.CivilianCADAPITypes = exports.GeneralCADAPITypes = exports.DefaultCMSRestOptions = exports.DefaultCADRestOptions = exports.DefaultUserAgent = void 0;
|
|
3
|
+
exports.CADDispatchStatusEnums = exports.CADDispatchOriginEnums = exports.CADModifyIdentifierActionEnums = exports.CADLookupByIntSearchTypeEnums = exports.CADRecordSectionCategoryEnums = exports.CADRecordTypeEnums = exports.AllAPITypes = exports.RadioAPITypes = exports.ERLCMSAPITypes = exports.CommunitiesCMSAPITypes = exports.FormsCMSAPITypes = exports.EventsCMSAPITypes = exports.ServersCMSAPITypes = exports.GeneralCMSAPITypes = exports.EmergencyCADAPITypes = exports.CivilianCADAPITypes = exports.GeneralCADAPITypes = exports.DefaultRadioRestOptions = exports.DefaultCMSRestOptions = exports.DefaultCADRestOptions = exports.DefaultUserAgent = void 0;
|
|
4
4
|
const constants_1 = require("../../../../../constants");
|
|
5
5
|
exports.DefaultUserAgent = 'Sonoran.js NPM Module';
|
|
6
6
|
exports.DefaultCADRestOptions = {
|
|
@@ -15,6 +15,12 @@ exports.DefaultCMSRestOptions = {
|
|
|
15
15
|
headers: {},
|
|
16
16
|
rejectOnRateLimit: true
|
|
17
17
|
};
|
|
18
|
+
exports.DefaultRadioRestOptions = {
|
|
19
|
+
agent: {},
|
|
20
|
+
api: 'https://api.sonoranradio.com',
|
|
21
|
+
headers: {},
|
|
22
|
+
rejectOnRateLimit: true
|
|
23
|
+
};
|
|
18
24
|
exports.GeneralCADAPITypes = [
|
|
19
25
|
{
|
|
20
26
|
type: 'GET_SERVERS',
|
|
@@ -135,6 +141,24 @@ exports.GeneralCADAPITypes = [
|
|
|
135
141
|
path: 'general/send_photo',
|
|
136
142
|
method: 'POST',
|
|
137
143
|
minVersion: 4
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: 'SET_CLOCK',
|
|
147
|
+
path: 'general/set_clock',
|
|
148
|
+
method: 'POST',
|
|
149
|
+
minVersion: 3
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
type: 'JOIN_COMMUNITY',
|
|
153
|
+
path: 'sso/community',
|
|
154
|
+
method: 'POST',
|
|
155
|
+
minVersion: 0
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
type: 'LEAVE_COMMUNITY',
|
|
159
|
+
path: 'sso/community',
|
|
160
|
+
method: 'POST',
|
|
161
|
+
minVersion: 0
|
|
138
162
|
}
|
|
139
163
|
];
|
|
140
164
|
exports.CivilianCADAPITypes = [
|
|
@@ -316,6 +340,18 @@ exports.GeneralCMSAPITypes = [
|
|
|
316
340
|
method: 'POST',
|
|
317
341
|
minVersion: 3
|
|
318
342
|
},
|
|
343
|
+
{
|
|
344
|
+
type: 'GET_CURRENT_CLOCK_IN',
|
|
345
|
+
path: 'general/get_current_clock_in',
|
|
346
|
+
method: 'POST',
|
|
347
|
+
minVersion: 0
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
type: 'GET_ACCOUNTS',
|
|
351
|
+
path: 'general/get_accounts',
|
|
352
|
+
method: 'POST',
|
|
353
|
+
minVersion: 0
|
|
354
|
+
},
|
|
319
355
|
{
|
|
320
356
|
type: 'GET_ACCOUNT_RANKS',
|
|
321
357
|
path: 'general/get_account_ranks',
|
|
@@ -334,6 +370,12 @@ exports.GeneralCMSAPITypes = [
|
|
|
334
370
|
method: 'POST',
|
|
335
371
|
minVersion: 2,
|
|
336
372
|
},
|
|
373
|
+
{
|
|
374
|
+
type: 'GET_PROFILE_FIELDS',
|
|
375
|
+
path: 'general/get_profile_fields',
|
|
376
|
+
method: 'POST',
|
|
377
|
+
minVersion: 0
|
|
378
|
+
},
|
|
337
379
|
{
|
|
338
380
|
type: 'GET_SUB_VERSION',
|
|
339
381
|
path: 'general/get_sub_version',
|
|
@@ -390,6 +432,12 @@ exports.ServersCMSAPITypes = [
|
|
|
390
432
|
method: 'POST',
|
|
391
433
|
minVersion: 2
|
|
392
434
|
},
|
|
435
|
+
{
|
|
436
|
+
type: 'SET_GAME_SERVERS',
|
|
437
|
+
path: 'servers/set_game_servers',
|
|
438
|
+
method: 'POST',
|
|
439
|
+
minVersion: 2
|
|
440
|
+
},
|
|
393
441
|
{
|
|
394
442
|
type: 'VERIFY_WHITELIST',
|
|
395
443
|
path: 'servers/verify_whitelist',
|
|
@@ -417,6 +465,12 @@ exports.FormsCMSAPITypes = [
|
|
|
417
465
|
path: 'forms/change/stage',
|
|
418
466
|
method: 'POST',
|
|
419
467
|
minVersion: 0
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
type: 'GET_FORM_TEMPLATE_SUBMISSIONS',
|
|
471
|
+
path: 'forms/get_template_submissions',
|
|
472
|
+
method: 'POST',
|
|
473
|
+
minVersion: 0
|
|
420
474
|
}
|
|
421
475
|
];
|
|
422
476
|
exports.CommunitiesCMSAPITypes = [
|
|
@@ -434,6 +488,12 @@ exports.ERLCMSAPITypes = [
|
|
|
434
488
|
method: "POST",
|
|
435
489
|
minVersion: 0
|
|
436
490
|
},
|
|
491
|
+
{
|
|
492
|
+
type: "ERLC_GET_PLAYER_QUEUE",
|
|
493
|
+
path: "erlc/get_player_queue",
|
|
494
|
+
method: "POST",
|
|
495
|
+
minVersion: 0
|
|
496
|
+
},
|
|
437
497
|
{
|
|
438
498
|
type: "ERLC_ADD_NEW_RECORD",
|
|
439
499
|
path: "erlc/add_new_record",
|
|
@@ -441,6 +501,56 @@ exports.ERLCMSAPITypes = [
|
|
|
441
501
|
minVersion: 0
|
|
442
502
|
}
|
|
443
503
|
];
|
|
504
|
+
exports.RadioAPITypes = [
|
|
505
|
+
{
|
|
506
|
+
type: 'RADIO_GET_COMMUNITY_CHANNELS',
|
|
507
|
+
path: 'api/radio/get-community-channels',
|
|
508
|
+
method: 'GET',
|
|
509
|
+
minVersion: 0
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
type: 'RADIO_GET_CONNECTED_USERS',
|
|
513
|
+
path: 'api/radio/get-connected-users',
|
|
514
|
+
method: 'GET',
|
|
515
|
+
minVersion: 0
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
type: 'RADIO_GET_CONNECTED_USER',
|
|
519
|
+
path: 'api/radio/get-connected-user',
|
|
520
|
+
method: 'GET',
|
|
521
|
+
minVersion: 0
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
type: 'RADIO_SET_USER_CHANNELS',
|
|
525
|
+
path: 'api/radio/set-user-channels',
|
|
526
|
+
method: 'POST',
|
|
527
|
+
minVersion: 0
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
type: 'RADIO_SET_USER_DISPLAY_NAME',
|
|
531
|
+
path: 'api/set-user-display-name',
|
|
532
|
+
method: 'POST',
|
|
533
|
+
minVersion: 0
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
type: 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP',
|
|
537
|
+
path: 'radio/check-server-subscription',
|
|
538
|
+
method: 'GET',
|
|
539
|
+
minVersion: 0
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
type: 'RADIO_SET_SERVER_IP',
|
|
543
|
+
path: 'radio/set-server-ip',
|
|
544
|
+
method: 'POST',
|
|
545
|
+
minVersion: 0
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
type: 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS',
|
|
549
|
+
path: 'radio/set-server-speakers',
|
|
550
|
+
method: 'POST',
|
|
551
|
+
minVersion: 0
|
|
552
|
+
}
|
|
553
|
+
];
|
|
444
554
|
function formatForAll(array, product) {
|
|
445
555
|
return array.map((val) => {
|
|
446
556
|
return {
|
|
@@ -449,7 +559,7 @@ function formatForAll(array, product) {
|
|
|
449
559
|
};
|
|
450
560
|
});
|
|
451
561
|
}
|
|
452
|
-
exports.AllAPITypes = [...formatForAll(exports.GeneralCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.CivilianCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.EmergencyCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.GeneralCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ServersCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.EventsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.FormsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.CommunitiesCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ERLCMSAPITypes, constants_1.productEnums.CMS)];
|
|
562
|
+
exports.AllAPITypes = [...formatForAll(exports.GeneralCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.CivilianCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.EmergencyCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.GeneralCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ServersCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.EventsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.FormsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.CommunitiesCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ERLCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.RadioAPITypes, constants_1.productEnums.RADIO)];
|
|
453
563
|
var CADRecordTypeEnums;
|
|
454
564
|
(function (CADRecordTypeEnums) {
|
|
455
565
|
CADRecordTypeEnums[CADRecordTypeEnums["Warrant"] = 2] = "Warrant";
|
|
@@ -26,4 +26,32 @@ export declare class CADManager extends BaseManager {
|
|
|
26
26
|
apiId?: string;
|
|
27
27
|
username?: string;
|
|
28
28
|
}): Promise<globalTypes.CADGetAccountPromiseResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Updates the CAD clock to match in-game time.
|
|
31
|
+
*/
|
|
32
|
+
setClockTime(data: {
|
|
33
|
+
serverId: number;
|
|
34
|
+
currentUtc: string;
|
|
35
|
+
currentGame: string;
|
|
36
|
+
secondsPerHour: number;
|
|
37
|
+
}): Promise<globalTypes.CADSetClockTimePromiseResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Adds accounts to the community via the join community endpoint.
|
|
40
|
+
* NOTE: This endpoint is intended for internal CMS use and requires an internal key.
|
|
41
|
+
*/
|
|
42
|
+
joinCommunity(internalKey: string, accounts: string | {
|
|
43
|
+
account: string;
|
|
44
|
+
} | Array<string | {
|
|
45
|
+
account: string;
|
|
46
|
+
}>): Promise<globalTypes.CADJoinCommunityPromiseResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Removes accounts from the community via the leave community endpoint.
|
|
49
|
+
* NOTE: This endpoint is intended for internal CMS use and requires an internal key.
|
|
50
|
+
*/
|
|
51
|
+
leaveCommunity(internalKey: string, accounts: string | {
|
|
52
|
+
account: string;
|
|
53
|
+
} | Array<string | {
|
|
54
|
+
account: string;
|
|
55
|
+
}>): Promise<globalTypes.CADLeaveCommunityPromiseResult>;
|
|
56
|
+
private normalizeAccountEntries;
|
|
29
57
|
}
|
|
@@ -82,5 +82,95 @@ class CADManager extends BaseManager_1.BaseManager {
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Updates the CAD clock to match in-game time.
|
|
87
|
+
*/
|
|
88
|
+
async setClockTime(data) {
|
|
89
|
+
return new Promise(async (resolve, reject) => {
|
|
90
|
+
var _a;
|
|
91
|
+
try {
|
|
92
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('SET_CLOCK', data));
|
|
93
|
+
resolve({ success: true, data: response });
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
if (err instanceof src_1.APIError) {
|
|
97
|
+
resolve({ success: false, reason: err.response });
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
reject(err);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Adds accounts to the community via the join community endpoint.
|
|
107
|
+
* NOTE: This endpoint is intended for internal CMS use and requires an internal key.
|
|
108
|
+
*/
|
|
109
|
+
async joinCommunity(internalKey, accounts) {
|
|
110
|
+
if (!internalKey) {
|
|
111
|
+
throw new Error('internalKey is required to join a community.');
|
|
112
|
+
}
|
|
113
|
+
const normalizedAccounts = this.normalizeAccountEntries(accounts);
|
|
114
|
+
if (normalizedAccounts.length === 0) {
|
|
115
|
+
throw new Error('At least one account must be provided to join the community.');
|
|
116
|
+
}
|
|
117
|
+
return new Promise(async (resolve, reject) => {
|
|
118
|
+
var _a;
|
|
119
|
+
try {
|
|
120
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('JOIN_COMMUNITY', { internalKey, accounts: normalizedAccounts }));
|
|
121
|
+
resolve({ success: true, data: response });
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
if (err instanceof src_1.APIError) {
|
|
125
|
+
resolve({ success: false, reason: err.response });
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
reject(err);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Removes accounts from the community via the leave community endpoint.
|
|
135
|
+
* NOTE: This endpoint is intended for internal CMS use and requires an internal key.
|
|
136
|
+
*/
|
|
137
|
+
async leaveCommunity(internalKey, accounts) {
|
|
138
|
+
if (!internalKey) {
|
|
139
|
+
throw new Error('internalKey is required to leave a community.');
|
|
140
|
+
}
|
|
141
|
+
const normalizedAccounts = this.normalizeAccountEntries(accounts);
|
|
142
|
+
if (normalizedAccounts.length === 0) {
|
|
143
|
+
throw new Error('At least one account must be provided to leave the community.');
|
|
144
|
+
}
|
|
145
|
+
return new Promise(async (resolve, reject) => {
|
|
146
|
+
var _a;
|
|
147
|
+
try {
|
|
148
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('LEAVE_COMMUNITY', { internalKey, accounts: normalizedAccounts }));
|
|
149
|
+
resolve({ success: true, data: response });
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
if (err instanceof src_1.APIError) {
|
|
153
|
+
resolve({ success: false, reason: err.response });
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
reject(err);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
normalizeAccountEntries(input) {
|
|
162
|
+
const entries = Array.isArray(input) ? input : [input];
|
|
163
|
+
return entries
|
|
164
|
+
.filter((entry) => entry !== undefined && entry !== null)
|
|
165
|
+
.map((entry) => {
|
|
166
|
+
if (typeof entry === 'string') {
|
|
167
|
+
return { account: entry };
|
|
168
|
+
}
|
|
169
|
+
if ('account' in entry) {
|
|
170
|
+
return { account: entry.account };
|
|
171
|
+
}
|
|
172
|
+
throw new Error('Invalid account entry provided.');
|
|
173
|
+
});
|
|
174
|
+
}
|
|
85
175
|
}
|
|
86
176
|
exports.CADManager = CADManager;
|
|
@@ -176,6 +176,66 @@ export declare class CMSManager extends BaseManager {
|
|
|
176
176
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the list of online players if successful.
|
|
177
177
|
*/
|
|
178
178
|
erlcGetOnlinePlayers(robloxJoinCode: string): Promise<globalTypes.CMSERLCGetOnlinePlayersPromiseResult>;
|
|
179
|
+
/**
|
|
180
|
+
* Toggles RSVP for the provided event and account.
|
|
181
|
+
*/
|
|
182
|
+
rsvp(eventId: string, params?: {
|
|
183
|
+
apiId?: string;
|
|
184
|
+
username?: string;
|
|
185
|
+
accId?: string;
|
|
186
|
+
discord?: string;
|
|
187
|
+
uniqueId?: string;
|
|
188
|
+
}): Promise<globalTypes.CMSRsvpPromiseResult>;
|
|
189
|
+
/**
|
|
190
|
+
* Retrieves submissions for a specific form template.
|
|
191
|
+
*/
|
|
192
|
+
getFormSubmissions<T = unknown>(templateId: number, options?: {
|
|
193
|
+
skip?: number;
|
|
194
|
+
take?: number;
|
|
195
|
+
}): Promise<globalTypes.CMSGetFormSubmissionsPromiseResult<T>>;
|
|
196
|
+
/**
|
|
197
|
+
* Updates profile fields for the specified account.
|
|
198
|
+
*/
|
|
199
|
+
editAccountProfileFields(params: {
|
|
200
|
+
apiId?: string;
|
|
201
|
+
username?: string;
|
|
202
|
+
accId?: string;
|
|
203
|
+
discord?: string;
|
|
204
|
+
uniqueId?: string;
|
|
205
|
+
profileFields: globalTypes.CMSProfileFieldUpdate[];
|
|
206
|
+
}): Promise<globalTypes.CMSEditAccountProfileFieldsPromiseResult>;
|
|
207
|
+
/**
|
|
208
|
+
* Gets the current clock in entry for a community member.
|
|
209
|
+
* @param {Object} params Identification parameters for the account.
|
|
210
|
+
*/
|
|
211
|
+
getCurrentClockIn(params: {
|
|
212
|
+
accId?: string;
|
|
213
|
+
apiId?: string;
|
|
214
|
+
username?: string;
|
|
215
|
+
discord?: string;
|
|
216
|
+
uniqueId?: string;
|
|
217
|
+
}): Promise<globalTypes.CMSGetCurrentClockInPromiseResult>;
|
|
218
|
+
/**
|
|
219
|
+
* Retrieves community accounts using optional pagination and status filters.
|
|
220
|
+
*/
|
|
221
|
+
getAccounts(options?: {
|
|
222
|
+
skip?: number;
|
|
223
|
+
take?: number;
|
|
224
|
+
sysStatus?: boolean;
|
|
225
|
+
comStatus?: boolean;
|
|
226
|
+
banned?: boolean;
|
|
227
|
+
archived?: boolean;
|
|
228
|
+
}): Promise<globalTypes.CMSGetAccountsPromiseResult>;
|
|
229
|
+
/**
|
|
230
|
+
* Retrieves configured profile fields for the community.
|
|
231
|
+
*/
|
|
232
|
+
getProfileFields(): Promise<globalTypes.CMSGetProfileFieldsPromiseResult>;
|
|
233
|
+
/**
|
|
234
|
+
* Gets the current ERLC player queue count for the provided roblox join code.
|
|
235
|
+
* @param {string} robloxJoinCode The roblox join code to get the player queue size for.
|
|
236
|
+
* @returns {Promise} Promise object indicates success and includes the queue count when successful.
|
|
237
|
+
*/
|
|
238
|
+
erlcGetPlayerQueue(robloxJoinCode: string): Promise<globalTypes.CMSERLCGetPlayerQueuePromiseResult>;
|
|
179
239
|
/**
|
|
180
240
|
* Adds a new ERLC record for a player.
|
|
181
241
|
* @param {Object} data The object that contains critical data to add a new ERLC record.
|
|
@@ -395,6 +395,162 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Toggles RSVP for the provided event and account.
|
|
400
|
+
*/
|
|
401
|
+
async rsvp(eventId, params = {}) {
|
|
402
|
+
return new Promise(async (resolve, reject) => {
|
|
403
|
+
var _a;
|
|
404
|
+
try {
|
|
405
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('RSVP', eventId, params.apiId, params.accId, params.discord, params.uniqueId));
|
|
406
|
+
if (typeof response === 'string') {
|
|
407
|
+
resolve({ success: true, status: response });
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
resolve({ success: true, data: response });
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
catch (err) {
|
|
414
|
+
if (err instanceof src_1.APIError) {
|
|
415
|
+
resolve({ success: false, reason: err.response });
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
reject(err);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Retrieves submissions for a specific form template.
|
|
425
|
+
*/
|
|
426
|
+
async getFormSubmissions(templateId, options = {}) {
|
|
427
|
+
return new Promise(async (resolve, reject) => {
|
|
428
|
+
var _a;
|
|
429
|
+
try {
|
|
430
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_FORM_TEMPLATE_SUBMISSIONS', templateId, options.skip, options.take));
|
|
431
|
+
resolve({ success: true, data: response });
|
|
432
|
+
}
|
|
433
|
+
catch (err) {
|
|
434
|
+
if (err instanceof src_1.APIError) {
|
|
435
|
+
resolve({ success: false, reason: err.response });
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
reject(err);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Updates profile fields for the specified account.
|
|
445
|
+
*/
|
|
446
|
+
async editAccountProfileFields(params) {
|
|
447
|
+
if (!params.profileFields || params.profileFields.length === 0) {
|
|
448
|
+
throw new Error('profileFields array must include at least one value.');
|
|
449
|
+
}
|
|
450
|
+
return new Promise(async (resolve, reject) => {
|
|
451
|
+
var _a;
|
|
452
|
+
try {
|
|
453
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('EDIT_ACC_PROFLIE_FIELDS', params.apiId, params.username, params.accId, params.discord, params.uniqueId, params.profileFields));
|
|
454
|
+
resolve({ success: true, data: response });
|
|
455
|
+
}
|
|
456
|
+
catch (err) {
|
|
457
|
+
if (err instanceof src_1.APIError) {
|
|
458
|
+
resolve({ success: false, reason: err.response });
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
reject(err);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Gets the current clock in entry for a community member.
|
|
468
|
+
* @param {Object} params Identification parameters for the account.
|
|
469
|
+
*/
|
|
470
|
+
async getCurrentClockIn(params) {
|
|
471
|
+
return new Promise(async (resolve, reject) => {
|
|
472
|
+
var _a;
|
|
473
|
+
try {
|
|
474
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_CURRENT_CLOCK_IN', params.apiId, params.username, params.accId, params.discord, params.uniqueId));
|
|
475
|
+
if (typeof response === 'string') {
|
|
476
|
+
resolve({ success: true, reason: response, data: null });
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
resolve({ success: true, data: response });
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
catch (err) {
|
|
483
|
+
if (err instanceof src_1.APIError) {
|
|
484
|
+
resolve({ success: false, reason: err.response });
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
reject(err);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Retrieves community accounts using optional pagination and status filters.
|
|
494
|
+
*/
|
|
495
|
+
async getAccounts(options = {}) {
|
|
496
|
+
return new Promise(async (resolve, reject) => {
|
|
497
|
+
var _a;
|
|
498
|
+
try {
|
|
499
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_ACCOUNTS', options));
|
|
500
|
+
resolve({ success: true, data: response });
|
|
501
|
+
}
|
|
502
|
+
catch (err) {
|
|
503
|
+
if (err instanceof src_1.APIError) {
|
|
504
|
+
resolve({ success: false, reason: err.response });
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
reject(err);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Retrieves configured profile fields for the community.
|
|
514
|
+
*/
|
|
515
|
+
async getProfileFields() {
|
|
516
|
+
return new Promise(async (resolve, reject) => {
|
|
517
|
+
var _a;
|
|
518
|
+
try {
|
|
519
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_PROFILE_FIELDS'));
|
|
520
|
+
resolve({ success: true, data: response });
|
|
521
|
+
}
|
|
522
|
+
catch (err) {
|
|
523
|
+
if (err instanceof src_1.APIError) {
|
|
524
|
+
resolve({ success: false, reason: err.response });
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
reject(err);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Gets the current ERLC player queue count for the provided roblox join code.
|
|
534
|
+
* @param {string} robloxJoinCode The roblox join code to get the player queue size for.
|
|
535
|
+
* @returns {Promise} Promise object indicates success and includes the queue count when successful.
|
|
536
|
+
*/
|
|
537
|
+
async erlcGetPlayerQueue(robloxJoinCode) {
|
|
538
|
+
return new Promise(async (resolve, reject) => {
|
|
539
|
+
var _a;
|
|
540
|
+
try {
|
|
541
|
+
const erlcGetPlayerQueueRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('ERLC_GET_PLAYER_QUEUE', robloxJoinCode));
|
|
542
|
+
resolve({ success: true, data: erlcGetPlayerQueueRequest });
|
|
543
|
+
}
|
|
544
|
+
catch (err) {
|
|
545
|
+
if (err instanceof src_1.APIError) {
|
|
546
|
+
resolve({ success: false, reason: err.response });
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
reject(err);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
}
|
|
398
554
|
/**
|
|
399
555
|
* Adds a new ERLC record for a player.
|
|
400
556
|
* @param {Object} data The object that contains critical data to add a new ERLC record.
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Instance } from '../instance/Instance';
|
|
2
2
|
import { CMSServerAPIStruct } from '../libs/rest/src';
|
|
3
|
+
import * as globalTypes from '../constants';
|
|
3
4
|
import { CMSServer } from '../structures/CMSServer';
|
|
4
5
|
import { CacheManager } from './CacheManager';
|
|
5
6
|
import { CMSManager } from './CMSManager';
|
|
6
7
|
export declare class CMSServerManager extends CacheManager<number, CMSServer, CMSServerAPIStruct> {
|
|
8
|
+
private readonly manager;
|
|
7
9
|
constructor(instance: Instance, manager: CMSManager);
|
|
10
|
+
setGameServers(servers: globalTypes.CMSSetGameServerStruct[]): Promise<globalTypes.CMSSetGameServersPromiseResult>;
|
|
8
11
|
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CMSServerManager = void 0;
|
|
4
|
+
const src_1 = require("../libs/rest/src");
|
|
4
5
|
const CMSServer_1 = require("../structures/CMSServer");
|
|
5
6
|
const CacheManager_1 = require("./CacheManager");
|
|
6
7
|
class CMSServerManager extends CacheManager_1.CacheManager {
|
|
7
8
|
constructor(instance, manager) {
|
|
8
9
|
super(instance, CMSServer_1.CMSServer, []);
|
|
10
|
+
this.manager = manager;
|
|
9
11
|
(async () => {
|
|
10
12
|
var _a;
|
|
11
|
-
|
|
13
|
+
const managerRef = this.manager;
|
|
14
|
+
while (!managerRef.ready) {
|
|
12
15
|
await new Promise((resolve) => {
|
|
13
16
|
setTimeout(resolve, 100);
|
|
14
17
|
});
|
|
15
18
|
}
|
|
16
19
|
try {
|
|
17
|
-
const serversRes = await ((_a =
|
|
20
|
+
const serversRes = await ((_a = managerRef.rest) === null || _a === void 0 ? void 0 : _a.request('GET_GAME_SERVERS'));
|
|
18
21
|
const servers = serversRes.servers;
|
|
19
22
|
servers.forEach((server) => {
|
|
20
23
|
const serverStruct = {
|
|
@@ -30,5 +33,36 @@ class CMSServerManager extends CacheManager_1.CacheManager {
|
|
|
30
33
|
}
|
|
31
34
|
})();
|
|
32
35
|
}
|
|
36
|
+
async setGameServers(servers) {
|
|
37
|
+
if (!Array.isArray(servers) || servers.length === 0) {
|
|
38
|
+
throw new Error('servers array must include at least one server configuration.');
|
|
39
|
+
}
|
|
40
|
+
return new Promise(async (resolve, reject) => {
|
|
41
|
+
var _a;
|
|
42
|
+
try {
|
|
43
|
+
const response = await ((_a = this.manager.rest) === null || _a === void 0 ? void 0 : _a.request('SET_GAME_SERVERS', servers));
|
|
44
|
+
const updatedServers = (Array.isArray(response === null || response === void 0 ? void 0 : response.data) ? response.data : []);
|
|
45
|
+
if (updatedServers.length > 0) {
|
|
46
|
+
this.cache.clear();
|
|
47
|
+
updatedServers.forEach((server) => {
|
|
48
|
+
const serverStruct = {
|
|
49
|
+
id: server.id,
|
|
50
|
+
config: server
|
|
51
|
+
};
|
|
52
|
+
this._add(serverStruct, true, server.id);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
resolve({ success: true, data: updatedServers });
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
if (err instanceof src_1.APIError) {
|
|
59
|
+
resolve({ success: false, reason: err.response });
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
reject(err);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
33
67
|
}
|
|
34
68
|
exports.CMSServerManager = CMSServerManager;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Instance } from '../instance/Instance';
|
|
2
|
+
import { REST } from '../libs/rest/src';
|
|
3
|
+
import { BaseManager } from './BaseManager';
|
|
4
|
+
import * as globalTypes from '../constants';
|
|
5
|
+
/**
|
|
6
|
+
* Manages all Sonoran Radio API interactions.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RadioManager extends BaseManager {
|
|
9
|
+
readonly ready: boolean;
|
|
10
|
+
readonly failReason: unknown;
|
|
11
|
+
rest: REST | undefined;
|
|
12
|
+
constructor(instance: Instance);
|
|
13
|
+
protected buildManager(instance: Instance): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves the configured community channel groups and channels.
|
|
16
|
+
*/
|
|
17
|
+
getCommunityChannels(): Promise<globalTypes.RadioGetCommunityChannelsPromiseResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves all connected users for the community.
|
|
20
|
+
*/
|
|
21
|
+
getConnectedUsers(): Promise<globalTypes.RadioGetConnectedUsersPromiseResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves a specific connected user by room id and identity.
|
|
24
|
+
* @param {number} roomId Multi-server room id.
|
|
25
|
+
* @param {string} identity User account UUID.
|
|
26
|
+
*/
|
|
27
|
+
getConnectedUser(roomId: number, identity: string): Promise<globalTypes.RadioGetConnectedUserPromiseResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Updates a user's transmit and scanned channel configuration.
|
|
30
|
+
* @param {string} identity The user's UUID.
|
|
31
|
+
* @param {RadioSetUserChannelsOptions} options Transmit and scan channel configuration.
|
|
32
|
+
*/
|
|
33
|
+
setUserChannels(identity: string, options?: globalTypes.RadioSetUserChannelsOptions): Promise<globalTypes.RadioSetUserChannelsPromiseResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Updates a user's display name.
|
|
36
|
+
* @param {string} accId The user's account UUID.
|
|
37
|
+
* @param {string} displayName The new display name.
|
|
38
|
+
*/
|
|
39
|
+
setUserDisplayName(accId: string, displayName: string): Promise<globalTypes.RadioSetUserDisplayNamePromiseResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves the community subscription level determined by the calling server's IP.
|
|
42
|
+
*/
|
|
43
|
+
getServerSubscriptionFromIp(): Promise<globalTypes.RadioGetServerSubscriptionFromIpPromiseResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Sets the push event URL for the community.
|
|
46
|
+
* @param {string} pushUrl The server push URL.
|
|
47
|
+
*/
|
|
48
|
+
setServerIp(pushUrl: string): Promise<globalTypes.RadioSetServerIpPromiseResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the available in-game speaker locations for tone dispatching.
|
|
51
|
+
* @param {RadioSpeakerLocation[]} locations Collection of speaker locations.
|
|
52
|
+
* @param {string} [token] Optional bearer token for authorization. Defaults to the community API key.
|
|
53
|
+
*/
|
|
54
|
+
setInGameSpeakerLocations(locations: globalTypes.RadioSpeakerLocation[], token?: string): Promise<globalTypes.RadioSetInGameSpeakerLocationsPromiseResult>;
|
|
55
|
+
}
|