@sonoransoftware/sonoran.js 1.0.64 → 1.0.66
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/libs/rest/src/lib/REST.js +5 -4
- package/dist/libs/rest/src/lib/RequestManager.js +4 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +10 -2
- package/dist/libs/rest/src/lib/utils/constants.js +6 -0
- package/dist/managers/CADManager.d.ts +5 -1
- package/dist/managers/CADManager.js +18 -0
- package/dist/managers/CMSManager.d.ts +1 -0
- package/dist/managers/CMSManager.js +1 -1
- package/package.json +1 -1
- package/src/libs/rest/src/lib/REST.ts +5 -4
- package/src/libs/rest/src/lib/RequestManager.ts +4 -0
- package/src/libs/rest/src/lib/utils/constants.ts +17 -2
- package/src/managers/CADManager.ts +20 -0
- package/src/managers/CMSManager.ts +2 -2
|
@@ -356,10 +356,11 @@ class REST extends events_1.EventEmitter {
|
|
|
356
356
|
accId: args[0],
|
|
357
357
|
formId: args[1],
|
|
358
358
|
newStageId: args[2],
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
359
|
+
optionalReason: args[3],
|
|
360
|
+
apiId: args[4],
|
|
361
|
+
username: args[5],
|
|
362
|
+
discord: args[6],
|
|
363
|
+
uniqueId: args[7],
|
|
363
364
|
};
|
|
364
365
|
}
|
|
365
366
|
case 'BAN_ACCOUNT': {
|
|
@@ -133,6 +133,10 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
133
133
|
apiData.data.data = [clonedData[0]];
|
|
134
134
|
break;
|
|
135
135
|
}
|
|
136
|
+
case 'SEND_DRAFT': {
|
|
137
|
+
apiData.data.data = [clonedData[0]];
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
136
140
|
case 'EDIT_RECORD': {
|
|
137
141
|
apiData.data.data = [clonedData[0]];
|
|
138
142
|
break;
|
|
@@ -38,7 +38,7 @@ export declare const CommunitiesCMSAPITypes: APITypeData[];
|
|
|
38
38
|
export declare const ERLCMSAPITypes: APITypeData[];
|
|
39
39
|
export declare const RadioAPITypes: APITypeData[];
|
|
40
40
|
export declare const AllAPITypes: AllAPITypeData[];
|
|
41
|
-
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'SET_CLOCK' | 'JOIN_COMMUNITY' | 'LEAVE_COMMUNITY' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'IDENTS_TO_GROUP' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_MY_CALL' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'GET_CURRENT_CLOCK_IN' | 'GET_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | 'GET_ACCOUNTS' | 'GET_PROFILE_FIELDS' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'GET_FORM_TEMPLATE_SUBMISSIONS' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'GET_CUSTOM_LOG_TYPES' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | 'RADIO_GET_COMMUNITY_CHANNELS' | 'RADIO_GET_CONNECTED_USERS' | 'RADIO_GET_CONNECTED_USER' | 'RADIO_SET_USER_CHANNELS' | 'RADIO_SET_USER_DISPLAY_NAME' | 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP' | 'RADIO_SET_SERVER_IP' | 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS' | 'PLAY_TONE';
|
|
41
|
+
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'SEND_DRAFT' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'SET_CLOCK' | 'JOIN_COMMUNITY' | 'LEAVE_COMMUNITY' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'IDENTS_TO_GROUP' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_MY_CALL' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'GET_CURRENT_CLOCK_IN' | 'GET_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | 'GET_ACCOUNTS' | 'GET_PROFILE_FIELDS' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'GET_FORM_TEMPLATE_SUBMISSIONS' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'GET_CUSTOM_LOG_TYPES' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | 'RADIO_GET_COMMUNITY_CHANNELS' | 'RADIO_GET_CONNECTED_USERS' | 'RADIO_GET_CONNECTED_USER' | 'RADIO_SET_USER_CHANNELS' | 'RADIO_SET_USER_DISPLAY_NAME' | 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP' | 'RADIO_SET_SERVER_IP' | 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS' | 'PLAY_TONE';
|
|
42
42
|
export interface CMSServerAPIStruct {
|
|
43
43
|
id: number;
|
|
44
44
|
name: string;
|
|
@@ -145,6 +145,12 @@ export interface CADNewEditRecordOptionTwoStruct {
|
|
|
145
145
|
user: string;
|
|
146
146
|
record: CADRecordStruct;
|
|
147
147
|
}
|
|
148
|
+
export interface CADSendDraftStruct {
|
|
149
|
+
apiId?: string;
|
|
150
|
+
account?: string;
|
|
151
|
+
recordTypeId: number;
|
|
152
|
+
replaceValues: Record<string, string>;
|
|
153
|
+
}
|
|
148
154
|
export declare enum CADLookupByIntSearchTypeEnums {
|
|
149
155
|
IDENTIFIER = 0,
|
|
150
156
|
SUPERVISOR_STATUS = 1,
|
|
@@ -338,6 +344,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
338
344
|
SET_API_ID: [data: CADSetAPIIDStruct];
|
|
339
345
|
GET_TEMPLATES: [recordTypeId?: number];
|
|
340
346
|
NEW_RECORD: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
|
|
347
|
+
SEND_DRAFT: [data: CADSendDraftStruct];
|
|
341
348
|
EDIT_RECORD: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
|
|
342
349
|
REMOVE_RECORD: [id: number];
|
|
343
350
|
LOOKUP_INT: [data: CADLookupByIntStruct];
|
|
@@ -612,6 +619,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
612
619
|
accId: string | undefined,
|
|
613
620
|
formId: number,
|
|
614
621
|
newStageId: string,
|
|
622
|
+
optionalReason: string | null,
|
|
615
623
|
apiId: string | undefined,
|
|
616
624
|
username: string | undefined,
|
|
617
625
|
discord: string | undefined,
|
|
@@ -700,7 +708,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
700
708
|
];
|
|
701
709
|
}
|
|
702
710
|
export type PossibleRequestData = undefined | {
|
|
703
|
-
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADIdentsToGroupStruct[] | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[];
|
|
711
|
+
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADSendDraftStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADIdentsToGroupStruct[] | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[];
|
|
704
712
|
} | {
|
|
705
713
|
servers: CADServerAPIStruct[];
|
|
706
714
|
deployMap: boolean;
|
|
@@ -1,7 +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, CADIdentsToGroupStruct, CADAddBlipStruct, CADModifyBlipStruct, CADGetCallsStruct, CADGetMyCallStruct, CADAddCallNoteStruct, CADGetActiveUnitsStruct, CADNewDispatchStruct, CADAttachUnitsStruct, CADDetachUnitsStruct, CADStreetSignStruct, CADUnitLocationStruct, CADUnitPanicStruct } from '../libs/rest/src';
|
|
4
|
+
import type { CADPenalCodeStruct, CADSetAPIIDStruct, CADNewEditRecordOptionOneStruct, CADNewEditRecordOptionTwoStruct, CADSendDraftStruct, CADLookupByIntStruct, CADLookupStruct, CADModifyAccountPermsStruct, CADKickBanUserStruct, CADSetPostalStruct, CADModifyIdentifierStruct, CADIdentsToGroupStruct, CADAddBlipStruct, CADModifyBlipStruct, CADGetCallsStruct, CADGetMyCallStruct, CADAddCallNoteStruct, CADGetActiveUnitsStruct, CADNewDispatchStruct, CADAttachUnitsStruct, CADDetachUnitsStruct, CADStreetSignStruct, CADUnitLocationStruct, CADUnitPanicStruct } from '../libs/rest/src';
|
|
5
5
|
import { BaseManager } from './BaseManager';
|
|
6
6
|
import * as globalTypes from '../constants';
|
|
7
7
|
import { CADServerManager } from './CADServerManager';
|
|
@@ -76,6 +76,10 @@ export declare class CADManager extends BaseManager {
|
|
|
76
76
|
* Creates a new record entry.
|
|
77
77
|
*/
|
|
78
78
|
createRecord(data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct): Promise<globalTypes.CADStandardResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Sends a record draft with populated fields.
|
|
81
|
+
*/
|
|
82
|
+
sendDraft(data: CADSendDraftStruct): Promise<globalTypes.CADStandardResponse>;
|
|
79
83
|
/**
|
|
80
84
|
* Updates an existing record entry.
|
|
81
85
|
*/
|
|
@@ -217,6 +217,24 @@ class CADManager extends BaseManager_1.BaseManager {
|
|
|
217
217
|
async createRecord(data) {
|
|
218
218
|
return this.executeCadRequest('NEW_RECORD', data);
|
|
219
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Sends a record draft with populated fields.
|
|
222
|
+
*/
|
|
223
|
+
async sendDraft(data) {
|
|
224
|
+
if (!data || typeof data !== 'object') {
|
|
225
|
+
throw new Error('data is required when sending a draft.');
|
|
226
|
+
}
|
|
227
|
+
if (!data.apiId && !data.account) {
|
|
228
|
+
throw new Error('apiId or account is required when sending a draft.');
|
|
229
|
+
}
|
|
230
|
+
if (!Number.isInteger(data.recordTypeId)) {
|
|
231
|
+
throw new Error('recordTypeId must be an integer when sending a draft.');
|
|
232
|
+
}
|
|
233
|
+
if (!data.replaceValues || typeof data.replaceValues !== 'object') {
|
|
234
|
+
throw new Error('replaceValues is required when sending a draft.');
|
|
235
|
+
}
|
|
236
|
+
return this.executeCadRequest('SEND_DRAFT', data);
|
|
237
|
+
}
|
|
220
238
|
/**
|
|
221
239
|
* Updates an existing record entry.
|
|
222
240
|
*/
|
|
@@ -506,7 +506,7 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
506
506
|
return new Promise(async (resolve, reject) => {
|
|
507
507
|
var _a;
|
|
508
508
|
try {
|
|
509
|
-
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('CHANGE_FORM_STAGE', params.accId, params.formId, params.newStageId, params.apiId, params.username, params.discord, params.uniqueId));
|
|
509
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('CHANGE_FORM_STAGE', params.accId, params.formId, params.newStageId, params.optionalReason, params.apiId, params.username, params.discord, params.uniqueId));
|
|
510
510
|
resolve({ success: true, data: response });
|
|
511
511
|
}
|
|
512
512
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonoransoftware/sonoran.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.66",
|
|
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",
|
|
@@ -466,10 +466,11 @@ export class REST extends EventEmitter {
|
|
|
466
466
|
accId: args[0],
|
|
467
467
|
formId: args[1],
|
|
468
468
|
newStageId: args[2],
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
469
|
+
optionalReason: args[3],
|
|
470
|
+
apiId: args[4],
|
|
471
|
+
username: args[5],
|
|
472
|
+
discord: args[6],
|
|
473
|
+
uniqueId: args[7],
|
|
473
474
|
};
|
|
474
475
|
}
|
|
475
476
|
case 'BAN_ACCOUNT': {
|
|
@@ -206,6 +206,10 @@ export class RequestManager extends EventEmitter {
|
|
|
206
206
|
apiData.data.data = [clonedData[0]];
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
|
+
case 'SEND_DRAFT': {
|
|
210
|
+
apiData.data.data = [clonedData[0]];
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
209
213
|
case 'EDIT_RECORD': {
|
|
210
214
|
apiData.data.data = [clonedData[0]];
|
|
211
215
|
break;
|
|
@@ -93,6 +93,12 @@ export const GeneralCADAPITypes: APITypeData[] = [
|
|
|
93
93
|
method: 'POST',
|
|
94
94
|
minVersion: 3
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
type: 'SEND_DRAFT',
|
|
98
|
+
path: 'general/send_draft',
|
|
99
|
+
method: 'POST',
|
|
100
|
+
minVersion: 3
|
|
101
|
+
},
|
|
96
102
|
{
|
|
97
103
|
type: 'EDIT_RECORD',
|
|
98
104
|
path: 'general/edit_record',
|
|
@@ -703,7 +709,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
703
709
|
|
|
704
710
|
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) ];
|
|
705
711
|
|
|
706
|
-
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'SET_CLOCK' | 'JOIN_COMMUNITY' | 'LEAVE_COMMUNITY' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'IDENTS_TO_GROUP' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_MY_CALL' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'GET_CURRENT_CLOCK_IN' | 'GET_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | 'GET_ACCOUNTS' | 'GET_PROFILE_FIELDS' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'GET_FORM_TEMPLATE_SUBMISSIONS' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'GET_CUSTOM_LOG_TYPES' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | 'RADIO_GET_COMMUNITY_CHANNELS' | 'RADIO_GET_CONNECTED_USERS' | 'RADIO_GET_CONNECTED_USER' | 'RADIO_SET_USER_CHANNELS' | 'RADIO_SET_USER_DISPLAY_NAME' | 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP' | 'RADIO_SET_SERVER_IP' | 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS' | 'PLAY_TONE';
|
|
712
|
+
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'SEND_DRAFT' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'SET_CLOCK' | 'JOIN_COMMUNITY' | 'LEAVE_COMMUNITY' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'IDENTS_TO_GROUP' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_MY_CALL' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'GET_CURRENT_CLOCK_IN' | 'GET_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | 'GET_ACCOUNTS' | 'GET_PROFILE_FIELDS' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'GET_FORM_TEMPLATE_SUBMISSIONS' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'GET_CUSTOM_LOG_TYPES' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'ERLC_EXECUTE_COMMAND' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | 'RADIO_GET_COMMUNITY_CHANNELS' | 'RADIO_GET_CONNECTED_USERS' | 'RADIO_GET_CONNECTED_USER' | 'RADIO_SET_USER_CHANNELS' | 'RADIO_SET_USER_DISPLAY_NAME' | 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP' | 'RADIO_SET_SERVER_IP' | 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS' | 'PLAY_TONE';
|
|
707
713
|
|
|
708
714
|
export interface CMSServerAPIStruct {
|
|
709
715
|
id: number;
|
|
@@ -823,6 +829,13 @@ export interface CADNewEditRecordOptionTwoStruct {
|
|
|
823
829
|
record: CADRecordStruct;
|
|
824
830
|
}
|
|
825
831
|
|
|
832
|
+
export interface CADSendDraftStruct {
|
|
833
|
+
apiId?: string;
|
|
834
|
+
account?: string;
|
|
835
|
+
recordTypeId: number;
|
|
836
|
+
replaceValues: Record<string, string>;
|
|
837
|
+
}
|
|
838
|
+
|
|
826
839
|
export enum CADLookupByIntSearchTypeEnums {
|
|
827
840
|
IDENTIFIER,
|
|
828
841
|
SUPERVISOR_STATUS,
|
|
@@ -1040,6 +1053,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1040
1053
|
SET_API_ID: [data: CADSetAPIIDStruct];
|
|
1041
1054
|
GET_TEMPLATES: [recordTypeId?: number];
|
|
1042
1055
|
NEW_RECORD: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
|
|
1056
|
+
SEND_DRAFT: [data: CADSendDraftStruct];
|
|
1043
1057
|
EDIT_RECORD: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
|
|
1044
1058
|
REMOVE_RECORD: [id: number];
|
|
1045
1059
|
LOOKUP_INT: [data: CADLookupByIntStruct];
|
|
@@ -1315,6 +1329,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1315
1329
|
accId: string | undefined,
|
|
1316
1330
|
formId: number,
|
|
1317
1331
|
newStageId: string,
|
|
1332
|
+
optionalReason: string | null,
|
|
1318
1333
|
apiId: string | undefined,
|
|
1319
1334
|
username: string | undefined,
|
|
1320
1335
|
discord: string | undefined,
|
|
@@ -1408,7 +1423,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1408
1423
|
export type PossibleRequestData =
|
|
1409
1424
|
undefined |
|
|
1410
1425
|
{
|
|
1411
|
-
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADIdentsToGroupStruct[] | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[]
|
|
1426
|
+
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADSendDraftStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADIdentsToGroupStruct[] | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[]
|
|
1412
1427
|
} |
|
|
1413
1428
|
{
|
|
1414
1429
|
servers: CADServerAPIStruct[];
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
CADSetAPIIDStruct,
|
|
8
8
|
CADNewEditRecordOptionOneStruct,
|
|
9
9
|
CADNewEditRecordOptionTwoStruct,
|
|
10
|
+
CADSendDraftStruct,
|
|
10
11
|
CADLookupByIntStruct,
|
|
11
12
|
CADLookupStruct,
|
|
12
13
|
CADModifyAccountPermsStruct,
|
|
@@ -224,6 +225,25 @@ export class CADManager extends BaseManager {
|
|
|
224
225
|
return this.executeCadRequest('NEW_RECORD', data);
|
|
225
226
|
}
|
|
226
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Sends a record draft with populated fields.
|
|
230
|
+
*/
|
|
231
|
+
public async sendDraft(data: CADSendDraftStruct): Promise<globalTypes.CADStandardResponse> {
|
|
232
|
+
if (!data || typeof data !== 'object') {
|
|
233
|
+
throw new Error('data is required when sending a draft.');
|
|
234
|
+
}
|
|
235
|
+
if (!data.apiId && !data.account) {
|
|
236
|
+
throw new Error('apiId or account is required when sending a draft.');
|
|
237
|
+
}
|
|
238
|
+
if (!Number.isInteger(data.recordTypeId)) {
|
|
239
|
+
throw new Error('recordTypeId must be an integer when sending a draft.');
|
|
240
|
+
}
|
|
241
|
+
if (!data.replaceValues || typeof data.replaceValues !== 'object') {
|
|
242
|
+
throw new Error('replaceValues is required when sending a draft.');
|
|
243
|
+
}
|
|
244
|
+
return this.executeCadRequest('SEND_DRAFT', data);
|
|
245
|
+
}
|
|
246
|
+
|
|
227
247
|
/**
|
|
228
248
|
* Updates an existing record entry.
|
|
229
249
|
*/
|
|
@@ -442,7 +442,7 @@ export class CMSManager extends BaseManager {
|
|
|
442
442
|
/**
|
|
443
443
|
* Updates the stage of a form for the specified account.
|
|
444
444
|
*/
|
|
445
|
-
public async changeFormStage(params: { accId?: string, formId: number, newStageId: string, apiId?: string, username?: string, discord?: string, uniqueId: number }): Promise<globalTypes.CMSChangeFormStagePromiseResult> {
|
|
445
|
+
public async changeFormStage(params: { accId?: string, formId: number, newStageId: string, optionalReason: string | null, apiId?: string, username?: string, discord?: string, uniqueId: number }): Promise<globalTypes.CMSChangeFormStagePromiseResult> {
|
|
446
446
|
if (!params.formId || !params.newStageId) {
|
|
447
447
|
throw new Error('formId and newStageId are required to change a form stage.');
|
|
448
448
|
}
|
|
@@ -452,7 +452,7 @@ export class CMSManager extends BaseManager {
|
|
|
452
452
|
|
|
453
453
|
return new Promise(async (resolve, reject) => {
|
|
454
454
|
try {
|
|
455
|
-
const response: any = await this.rest?.request('CHANGE_FORM_STAGE', params.accId, params.formId, params.newStageId, params.apiId, params.username, params.discord, params.uniqueId);
|
|
455
|
+
const response: any = await this.rest?.request('CHANGE_FORM_STAGE', params.accId, params.formId, params.newStageId, params.optionalReason, params.apiId, params.username, params.discord, params.uniqueId);
|
|
456
456
|
resolve({ success: true, data: response });
|
|
457
457
|
} catch (err) {
|
|
458
458
|
if (err instanceof APIError) {
|