@sonoransoftware/sonoran.js 1.0.34 → 1.0.36
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 +242 -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 +118 -0
- package/dist/libs/rest/src/lib/RequestManager.d.ts +2 -0
- package/dist/libs/rest/src/lib/RequestManager.js +209 -0
- package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -1
- package/dist/libs/rest/src/lib/utils/constants.d.ts +108 -24
- package/dist/libs/rest/src/lib/utils/constants.js +118 -2
- package/dist/managers/CADActiveUnitsManager.d.ts +3 -0
- package/dist/managers/CADActiveUnitsManager.js +16 -6
- package/dist/managers/CADManager.d.ts +223 -0
- package/dist/managers/CADManager.js +513 -4
- package/dist/managers/CADServerManager.d.ts +11 -0
- package/dist/managers/CADServerManager.js +56 -13
- package/dist/managers/CMSManager.d.ts +78 -0
- package/dist/managers/CMSManager.js +213 -3
- package/dist/managers/CMSServerManager.d.ts +8 -0
- package/dist/managers/CMSServerManager.js +61 -18
- package/dist/managers/RadioManager.d.ts +55 -0
- package/dist/managers/RadioManager.js +224 -0
- package/package.json +1 -1
- package/readme.md +294 -12
- package/src/constants.ts +281 -1
- package/src/index.ts +42 -1
- package/src/instance/Instance.ts +30 -1
- package/src/instance/instance.types.ts +4 -1
- package/src/libs/rest/src/lib/REST.ts +117 -1
- package/src/libs/rest/src/lib/RequestManager.ts +229 -10
- package/src/libs/rest/src/lib/errors/RateLimitError.ts +20 -2
- package/src/libs/rest/src/lib/utils/constants.ts +223 -26
- package/src/managers/CADActiveUnitsManager.ts +19 -6
- package/src/managers/CADManager.ts +574 -4
- package/src/managers/CADServerManager.ts +59 -15
- package/src/managers/CMSManager.ts +196 -2
- package/src/managers/CMSServerManager.ts +65 -21
- package/src/managers/RadioManager.ts +187 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: Auto PR for new branch (trigger Codex)
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- 'feat/**'
|
|
7
|
+
- 'fix/**'
|
|
8
|
+
- 'tweak/**'
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
ensure-pr:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
env:
|
|
18
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
+
BRANCH: ${{ github.ref_name }}
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
with: { fetch-depth: 0 }
|
|
23
|
+
|
|
24
|
+
- name: Auth gh
|
|
25
|
+
run: gh auth status || true
|
|
26
|
+
|
|
27
|
+
- name: Ensure PR exists
|
|
28
|
+
id: pr
|
|
29
|
+
run: |
|
|
30
|
+
PR_NUMBER=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number')
|
|
31
|
+
if [ -n "$PR_NUMBER" ]; then
|
|
32
|
+
echo "PR exists: #$PR_NUMBER"
|
|
33
|
+
echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
|
|
34
|
+
echo "created=false" >> "$GITHUB_OUTPUT"
|
|
35
|
+
exit 0
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
TITLE="Auto Review: $BRANCH"
|
|
39
|
+
BODY_FILE="$(mktemp)"
|
|
40
|
+
{
|
|
41
|
+
echo "Auto-created to trigger Codex code review for branch **$BRANCH** targeting \`staging\`."
|
|
42
|
+
echo
|
|
43
|
+
echo "Codex instructions: .github/codex_instructions.md"
|
|
44
|
+
} > "$BODY_FILE"
|
|
45
|
+
|
|
46
|
+
gh pr create \
|
|
47
|
+
--head "$BRANCH" \
|
|
48
|
+
--base "staging" \
|
|
49
|
+
--title "$TITLE" \
|
|
50
|
+
--body-file "$BODY_FILE" \
|
|
51
|
+
--draft
|
|
52
|
+
PR_NUMBER=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number')
|
|
53
|
+
if [ -z "$PR_NUMBER" ]; then
|
|
54
|
+
echo "Failed to determine PR number after creation" >&2
|
|
55
|
+
exit 1
|
|
56
|
+
fi
|
|
57
|
+
echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
|
|
58
|
+
echo "created=true" >> "$GITHUB_OUTPUT"
|
|
59
|
+
|
|
60
|
+
- name: Ensure auto-review label exists
|
|
61
|
+
if: steps.pr.outputs.number
|
|
62
|
+
run: |
|
|
63
|
+
if ! gh label list --json name --limit 100 | jq -e '.[] | select(.name == "auto-review")' > /dev/null; then
|
|
64
|
+
gh label create "auto-review" --color "0E8A16" --description "PRs ready for Codex auto review"
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
- name: Label PR (optional)
|
|
68
|
+
if: steps.pr.outputs.number
|
|
69
|
+
run: |
|
|
70
|
+
gh pr edit "${{ steps.pr.outputs.number }}" --add-label "auto-review"
|
|
71
|
+
|
|
72
|
+
- name: Mark PR ready for review
|
|
73
|
+
if: steps.pr.outputs.created == 'true'
|
|
74
|
+
run: gh pr ready "${{ steps.pr.outputs.number }}"
|
|
75
|
+
|
|
76
|
+
- name: Trigger initial Codex review
|
|
77
|
+
if: steps.pr.outputs.created == 'true'
|
|
78
|
+
env:
|
|
79
|
+
PR: ${{ steps.pr.outputs.number }}
|
|
80
|
+
GH_TOKEN: ${{ secrets.CODEX_TRIGGER_TOKEN }}
|
|
81
|
+
run: |
|
|
82
|
+
TMP=$(mktemp)
|
|
83
|
+
{
|
|
84
|
+
echo "@codex review"
|
|
85
|
+
echo
|
|
86
|
+
echo "instructions: .github/codex_instructions.md"
|
|
87
|
+
} > "$TMP"
|
|
88
|
+
|
|
89
|
+
gh pr comment "$PR" --body-file "$TMP"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Codex Review Instructions
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
- Branch naming: feat/*, fix/*, tweak/*
|
|
5
|
+
- Target: merge to `staging` after preview validation
|
|
6
|
+
|
|
7
|
+
## What to prioritize
|
|
8
|
+
1. Security pitfalls (injection, authz, secret handling)
|
|
9
|
+
2. Reliability & edge cases
|
|
10
|
+
3. Breaking changes / migration notes
|
|
11
|
+
4. Performance hotspots (N+1, O(n^2), heavy I/O)
|
|
12
|
+
5. Code style & maintainability (prefer actionable diffs)
|
|
13
|
+
6. Any new English words, phrases, or sentences should be added as an i18n key
|
|
14
|
+
|
|
15
|
+
## Project-specific rules
|
|
16
|
+
- Backend: Prefer async handlers for network I/O.
|
|
17
|
+
- Frontend: Avoid blocking renders; use Suspense on data boundaries.
|
|
18
|
+
- Infra: Terraform modules must be idempotent and tagged.
|
|
19
|
+
|
|
20
|
+
## Test expectations
|
|
21
|
+
- New endpoints/components: at least 1 direct test.
|
|
22
|
+
- Bug fixes: a regression test.
|
|
23
|
+
|
|
24
|
+
> If you recommend changes, include concrete diffs.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Nudge Codex on push
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- 'feat/**'
|
|
7
|
+
- 'fix/**'
|
|
8
|
+
- 'tweak/**'
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
nudge:
|
|
16
|
+
if: ${{ !github.event.created }}
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
env:
|
|
19
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
BRANCH: ${{ github.ref_name }}
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with: { fetch-depth: 0 }
|
|
24
|
+
|
|
25
|
+
- name: Auth gh
|
|
26
|
+
run: gh auth status || true
|
|
27
|
+
|
|
28
|
+
- name: Find PR for this branch
|
|
29
|
+
id: pr
|
|
30
|
+
run: |
|
|
31
|
+
PR_NUMBER=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number')
|
|
32
|
+
if [ -z "$PR_NUMBER" ]; then
|
|
33
|
+
echo "No open PR for $BRANCH"; exit 0
|
|
34
|
+
fi
|
|
35
|
+
echo "pr=$PR_NUMBER" >> "$GITHUB_OUTPUT"
|
|
36
|
+
|
|
37
|
+
- name: Post Codex trigger comment with instructions
|
|
38
|
+
if: steps.pr.outputs.pr
|
|
39
|
+
env:
|
|
40
|
+
PR: ${{ steps.pr.outputs.pr }}
|
|
41
|
+
GH_TOKEN: ${{ secrets.CODEX_TRIGGER_TOKEN }}
|
|
42
|
+
run: |
|
|
43
|
+
TMP=$(mktemp)
|
|
44
|
+
{
|
|
45
|
+
echo "@codex review"
|
|
46
|
+
echo
|
|
47
|
+
echo "instructions: .github/codex_instructions.md"
|
|
48
|
+
} > "$TMP"
|
|
49
|
+
|
|
50
|
+
gh pr comment "$PR" --body-file "$TMP"
|
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { CADActiveUnitsManager } from './managers/CADActiveUnitsManager';
|
|
|
5
5
|
import { CADActiveUnit } from './structures/CADActiveUnit';
|
|
6
6
|
export declare enum productEnums {
|
|
7
7
|
CAD = 0,
|
|
8
|
-
CMS = 1
|
|
8
|
+
CMS = 1,
|
|
9
|
+
RADIO = 2
|
|
9
10
|
}
|
|
10
11
|
export interface CADNewDispatchBuilderOptions {
|
|
11
12
|
serverId?: number;
|
|
@@ -231,6 +232,32 @@ export interface CMSSetAccountNamePromiseResult {
|
|
|
231
232
|
data?: string;
|
|
232
233
|
reason?: string;
|
|
233
234
|
}
|
|
235
|
+
export interface CADSetClockTimePromiseResult {
|
|
236
|
+
success: boolean;
|
|
237
|
+
reason?: string;
|
|
238
|
+
data?: unknown;
|
|
239
|
+
}
|
|
240
|
+
export interface CADJoinCommunityPromiseResult {
|
|
241
|
+
success: boolean;
|
|
242
|
+
reason?: string;
|
|
243
|
+
data?: unknown;
|
|
244
|
+
}
|
|
245
|
+
export interface CADLeaveCommunityPromiseResult {
|
|
246
|
+
success: boolean;
|
|
247
|
+
reason?: string;
|
|
248
|
+
data?: unknown;
|
|
249
|
+
}
|
|
250
|
+
export interface CADStandardResponse<T = unknown> {
|
|
251
|
+
success: boolean;
|
|
252
|
+
data?: T;
|
|
253
|
+
reason?: unknown;
|
|
254
|
+
}
|
|
255
|
+
export interface CMSProfileField {
|
|
256
|
+
id: string;
|
|
257
|
+
type: string;
|
|
258
|
+
label: string;
|
|
259
|
+
options: unknown;
|
|
260
|
+
}
|
|
234
261
|
export interface CMSKickAccountPromiseResult {
|
|
235
262
|
success: boolean;
|
|
236
263
|
reason?: string;
|
|
@@ -243,6 +270,110 @@ export interface CMSForceSyncPromiseResult {
|
|
|
243
270
|
success: boolean;
|
|
244
271
|
reason?: string;
|
|
245
272
|
}
|
|
273
|
+
export interface CMSGetCurrentClockInPromiseResult {
|
|
274
|
+
success: boolean;
|
|
275
|
+
reason?: string;
|
|
276
|
+
data?: clockInOutRequest | null;
|
|
277
|
+
}
|
|
278
|
+
export interface CMSAccountSummary {
|
|
279
|
+
accId: string;
|
|
280
|
+
accName: string;
|
|
281
|
+
activeApiIds: string[];
|
|
282
|
+
discordId?: string;
|
|
283
|
+
sysStatus: boolean;
|
|
284
|
+
comStatus: boolean;
|
|
285
|
+
archived: boolean;
|
|
286
|
+
banned: boolean;
|
|
287
|
+
[key: string]: unknown;
|
|
288
|
+
}
|
|
289
|
+
export interface CMSAccountsPage {
|
|
290
|
+
total: number;
|
|
291
|
+
skip: number;
|
|
292
|
+
take: number;
|
|
293
|
+
accounts: CMSAccountSummary[];
|
|
294
|
+
}
|
|
295
|
+
export interface CMSGetAccountsPromiseResult {
|
|
296
|
+
success: boolean;
|
|
297
|
+
reason?: string;
|
|
298
|
+
data?: CMSAccountsPage;
|
|
299
|
+
}
|
|
300
|
+
export interface CMSGetProfileFieldsPromiseResult {
|
|
301
|
+
success: boolean;
|
|
302
|
+
reason?: string;
|
|
303
|
+
data?: CMSProfileField[];
|
|
304
|
+
}
|
|
305
|
+
export interface CMSProfileFieldUpdate {
|
|
306
|
+
id: string;
|
|
307
|
+
value: unknown;
|
|
308
|
+
}
|
|
309
|
+
export interface CMSEditAccountProfileFieldsPromiseResult {
|
|
310
|
+
success: boolean;
|
|
311
|
+
reason?: string;
|
|
312
|
+
data?: CMSProfileFieldUpdate[];
|
|
313
|
+
}
|
|
314
|
+
export interface CMSRsvpPromiseResult {
|
|
315
|
+
success: boolean;
|
|
316
|
+
reason?: string;
|
|
317
|
+
status?: string;
|
|
318
|
+
data?: unknown;
|
|
319
|
+
}
|
|
320
|
+
export interface CMSChangeFormStagePromiseResult {
|
|
321
|
+
success: boolean;
|
|
322
|
+
reason?: string;
|
|
323
|
+
data?: unknown;
|
|
324
|
+
}
|
|
325
|
+
export interface CMSSetGameServerStruct {
|
|
326
|
+
id?: number;
|
|
327
|
+
name: string;
|
|
328
|
+
description?: string;
|
|
329
|
+
ip?: string;
|
|
330
|
+
port?: string;
|
|
331
|
+
allowedRanks?: string[];
|
|
332
|
+
blockedRanks?: string[];
|
|
333
|
+
[key: string]: unknown;
|
|
334
|
+
}
|
|
335
|
+
export interface CMSSetGameServersPromiseResult {
|
|
336
|
+
success: boolean;
|
|
337
|
+
reason?: string;
|
|
338
|
+
data?: CMSSetGameServerStruct[];
|
|
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
|
+
}
|
|
372
|
+
export interface CMSGetFormSubmissionsPromiseResult<T = unknown> {
|
|
373
|
+
success: boolean;
|
|
374
|
+
reason?: string;
|
|
375
|
+
data?: T[];
|
|
376
|
+
}
|
|
246
377
|
export interface CMSERLCGetOnlinePlayersPromiseResult {
|
|
247
378
|
success: boolean;
|
|
248
379
|
reason?: string;
|
|
@@ -263,3 +394,113 @@ export interface CMSERLCAddNewRecordPromiseResult {
|
|
|
263
394
|
reason?: string;
|
|
264
395
|
logId?: string;
|
|
265
396
|
}
|
|
397
|
+
export interface RadioChannelGroup {
|
|
398
|
+
id: number;
|
|
399
|
+
name: string;
|
|
400
|
+
orderIndex: number;
|
|
401
|
+
}
|
|
402
|
+
export interface RadioChannel {
|
|
403
|
+
id: number;
|
|
404
|
+
groupId: number;
|
|
405
|
+
displayName: string;
|
|
406
|
+
recvFreqMajor: number;
|
|
407
|
+
recvFreqMinor: number;
|
|
408
|
+
xmitFreqMajor: number;
|
|
409
|
+
xmitFreqMinor: number;
|
|
410
|
+
repeatsXmit: boolean;
|
|
411
|
+
status: boolean;
|
|
412
|
+
orderIndex: number;
|
|
413
|
+
talkoverProtection: boolean;
|
|
414
|
+
[key: string]: unknown;
|
|
415
|
+
}
|
|
416
|
+
export interface RadioConnectedUserMetadataScanList {
|
|
417
|
+
id: number;
|
|
418
|
+
name: string;
|
|
419
|
+
channelIds: number[];
|
|
420
|
+
[key: string]: unknown;
|
|
421
|
+
}
|
|
422
|
+
export interface RadioConnectedUserMetadataState {
|
|
423
|
+
primaryChId?: number;
|
|
424
|
+
scannedChIds?: number[];
|
|
425
|
+
scanLists?: RadioConnectedUserMetadataScanList[];
|
|
426
|
+
spec?: number;
|
|
427
|
+
[key: string]: unknown;
|
|
428
|
+
}
|
|
429
|
+
export interface RadioConnectedUserMetadata {
|
|
430
|
+
sonrad?: boolean;
|
|
431
|
+
state?: RadioConnectedUserMetadataState;
|
|
432
|
+
[key: string]: unknown;
|
|
433
|
+
}
|
|
434
|
+
export interface RadioConnectedUser {
|
|
435
|
+
identity: string;
|
|
436
|
+
name: string;
|
|
437
|
+
roomId?: number;
|
|
438
|
+
metadata: RadioConnectedUserMetadata;
|
|
439
|
+
[key: string]: unknown;
|
|
440
|
+
}
|
|
441
|
+
export interface RadioSpeakerLocation {
|
|
442
|
+
label: string;
|
|
443
|
+
id: string;
|
|
444
|
+
}
|
|
445
|
+
export interface RadioSetUserChannelsOptions {
|
|
446
|
+
transmit?: number;
|
|
447
|
+
scan?: number[];
|
|
448
|
+
}
|
|
449
|
+
export type RadioSubscriptionLevel = 0 | 1 | 2;
|
|
450
|
+
export interface RadioGetCommunityChannelsPromiseResult {
|
|
451
|
+
success: boolean;
|
|
452
|
+
reason?: string;
|
|
453
|
+
data?: {
|
|
454
|
+
result: string;
|
|
455
|
+
groups: RadioChannelGroup[];
|
|
456
|
+
channels: RadioChannel[];
|
|
457
|
+
[key: string]: unknown;
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
export interface RadioGetConnectedUsersPromiseResult {
|
|
461
|
+
success: boolean;
|
|
462
|
+
reason?: string;
|
|
463
|
+
data?: {
|
|
464
|
+
result: string;
|
|
465
|
+
connectedUsers: RadioConnectedUser[];
|
|
466
|
+
[key: string]: unknown;
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
export interface RadioGetConnectedUserPromiseResult {
|
|
470
|
+
success: boolean;
|
|
471
|
+
reason?: string;
|
|
472
|
+
data?: {
|
|
473
|
+
result: string;
|
|
474
|
+
data: RadioConnectedUser;
|
|
475
|
+
[key: string]: unknown;
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
export interface RadioSetUserChannelsPromiseResult {
|
|
479
|
+
success: boolean;
|
|
480
|
+
reason?: string;
|
|
481
|
+
result?: string;
|
|
482
|
+
}
|
|
483
|
+
export interface RadioSetUserDisplayNamePromiseResult {
|
|
484
|
+
success: boolean;
|
|
485
|
+
reason?: string;
|
|
486
|
+
result?: string;
|
|
487
|
+
}
|
|
488
|
+
export interface RadioGetServerSubscriptionFromIpPromiseResult {
|
|
489
|
+
success: boolean;
|
|
490
|
+
reason?: string;
|
|
491
|
+
data?: {
|
|
492
|
+
result: string;
|
|
493
|
+
subscription: RadioSubscriptionLevel;
|
|
494
|
+
[key: string]: unknown;
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
export interface RadioSetServerIpPromiseResult {
|
|
498
|
+
success: boolean;
|
|
499
|
+
reason?: string;
|
|
500
|
+
result?: string;
|
|
501
|
+
}
|
|
502
|
+
export interface RadioSetInGameSpeakerLocationsPromiseResult {
|
|
503
|
+
success: boolean;
|
|
504
|
+
reason?: string;
|
|
505
|
+
result?: string;
|
|
506
|
+
}
|
package/dist/constants.js
CHANGED
|
@@ -5,6 +5,7 @@ var productEnums;
|
|
|
5
5
|
(function (productEnums) {
|
|
6
6
|
productEnums[productEnums["CAD"] = 0] = "CAD";
|
|
7
7
|
productEnums[productEnums["CMS"] = 1] = "CMS";
|
|
8
|
+
productEnums[productEnums["RADIO"] = 2] = "RADIO";
|
|
8
9
|
})(productEnums = exports.productEnums || (exports.productEnums = {}));
|
|
9
10
|
var CADSubscriptionVersionEnum;
|
|
10
11
|
(function (CADSubscriptionVersionEnum) {
|
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 } 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';
|
|
@@ -3,6 +3,7 @@ import EventEmitter from 'events';
|
|
|
3
3
|
import * as InstanceTypes from './instance.types';
|
|
4
4
|
import { CADManager } from '../managers/CADManager';
|
|
5
5
|
import { CMSManager } from '../managers/CMSManager';
|
|
6
|
+
import { RadioManager } from '../managers/RadioManager';
|
|
6
7
|
export declare class Instance extends EventEmitter {
|
|
7
8
|
cadCommunityId: string | undefined;
|
|
8
9
|
cadApiKey: string | undefined;
|
|
@@ -14,8 +15,13 @@ export declare class Instance extends EventEmitter {
|
|
|
14
15
|
cmsApiUrl: string;
|
|
15
16
|
cmsDefaultServerId: number;
|
|
16
17
|
isCMSSuccessful: boolean;
|
|
18
|
+
radioCommunityId: string | undefined;
|
|
19
|
+
radioApiKey: string | undefined;
|
|
20
|
+
radioApiUrl: string;
|
|
21
|
+
isRadioSuccessful: boolean;
|
|
17
22
|
cad: CADManager | undefined;
|
|
18
23
|
cms: CMSManager | undefined;
|
|
24
|
+
radio: RadioManager | undefined;
|
|
19
25
|
debug: boolean;
|
|
20
26
|
apiHeaders: HeadersInit;
|
|
21
27
|
constructor(options: InstanceTypes.InstanceOptions);
|
|
@@ -31,6 +31,7 @@ const events_1 = __importDefault(require("events"));
|
|
|
31
31
|
const globalTypes = __importStar(require("../constants"));
|
|
32
32
|
const CADManager_1 = require("../managers/CADManager");
|
|
33
33
|
const CMSManager_1 = require("../managers/CMSManager");
|
|
34
|
+
const RadioManager_1 = require("../managers/RadioManager");
|
|
34
35
|
const utils_1 = require("../utils");
|
|
35
36
|
class Instance extends events_1.default {
|
|
36
37
|
constructor(options) {
|
|
@@ -41,6 +42,8 @@ class Instance extends events_1.default {
|
|
|
41
42
|
this.cmsApiUrl = 'https://api.sonorancms.com';
|
|
42
43
|
this.cmsDefaultServerId = 1;
|
|
43
44
|
this.isCMSSuccessful = false;
|
|
45
|
+
this.radioApiUrl = 'https://api.sonoranradio.com';
|
|
46
|
+
this.isRadioSuccessful = false;
|
|
44
47
|
this.debug = false;
|
|
45
48
|
this.apiHeaders = {};
|
|
46
49
|
if (options.debug) {
|
|
@@ -81,6 +84,17 @@ class Instance extends events_1.default {
|
|
|
81
84
|
this.initialize();
|
|
82
85
|
break;
|
|
83
86
|
}
|
|
87
|
+
case globalTypes.productEnums.RADIO: {
|
|
88
|
+
this.radioCommunityId = options.communityId;
|
|
89
|
+
this.radioApiKey = options.apiKey;
|
|
90
|
+
if (Object.prototype.hasOwnProperty.call(options, 'radioApiUrl') && typeof options.radioApiUrl === 'string') {
|
|
91
|
+
this._debugLog(`Overriding Radio API URL... ${options.radioApiUrl}`);
|
|
92
|
+
this.radioApiUrl = options.radioApiUrl;
|
|
93
|
+
}
|
|
94
|
+
this._debugLog('About to initialize instance.');
|
|
95
|
+
this.initialize();
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
84
98
|
default: {
|
|
85
99
|
throw new Error('Invalid product enum given for constructor.');
|
|
86
100
|
}
|
|
@@ -95,6 +109,8 @@ class Instance extends events_1.default {
|
|
|
95
109
|
this.cadApiKey = options.cadApiKey;
|
|
96
110
|
this.cmsCommunityId = options.cmsCommunityId;
|
|
97
111
|
this.cmsApiKey = options.cmsApiKey;
|
|
112
|
+
this.radioCommunityId = options.radioCommunityId;
|
|
113
|
+
this.radioApiKey = options.radioApiKey;
|
|
98
114
|
if (options.cadDefaultServerId !== undefined) {
|
|
99
115
|
this._debugLog(`Overriding default CAD server id... ${options.serverId}`);
|
|
100
116
|
this.cadDefaultServerId = options.cadDefaultServerId;
|
|
@@ -111,6 +127,10 @@ class Instance extends events_1.default {
|
|
|
111
127
|
this._debugLog(`Overriding CMS API URL... ${options.cmsApiUrl}`);
|
|
112
128
|
this.cmsApiUrl = options.cmsApiUrl;
|
|
113
129
|
}
|
|
130
|
+
if (Object.prototype.hasOwnProperty.call(options, 'radioApiUrl') && typeof options.radioApiUrl === 'string') {
|
|
131
|
+
this._debugLog(`Overriding Radio API URL... ${options.radioApiUrl}`);
|
|
132
|
+
this.radioApiUrl = options.radioApiUrl;
|
|
133
|
+
}
|
|
114
134
|
this.initialize();
|
|
115
135
|
}
|
|
116
136
|
}
|
|
@@ -129,6 +149,13 @@ class Instance extends events_1.default {
|
|
|
129
149
|
else {
|
|
130
150
|
this._debugLog('Not initializing CMS Manager due to a missing community id, api key, or api url.');
|
|
131
151
|
}
|
|
152
|
+
if (this.radioCommunityId && this.radioApiKey && this.radioApiUrl) {
|
|
153
|
+
this._debugLog('About to initialize Radio Manager');
|
|
154
|
+
this.radio = new RadioManager_1.RadioManager(this);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
this._debugLog('Not initializing Radio Manager due to a missing community id, api key, or api url.');
|
|
158
|
+
}
|
|
132
159
|
}
|
|
133
160
|
_debugLog(message) {
|
|
134
161
|
if (this.debug) {
|
|
@@ -10,6 +10,7 @@ import type { RequestInit, Response } from 'node-fetch';
|
|
|
10
10
|
import { Instance } from '../../../../instance/Instance';
|
|
11
11
|
import { CADManager } from '../../../../managers/CADManager';
|
|
12
12
|
import { CMSManager } from '../../../../managers/CMSManager';
|
|
13
|
+
import { RadioManager } from '../../../../managers/RadioManager';
|
|
13
14
|
/**
|
|
14
15
|
* Options to be passed when creating the REST instance
|
|
15
16
|
*/
|
|
@@ -86,7 +87,7 @@ export interface REST {
|
|
|
86
87
|
off: (<K extends keyof RestEvents>(event: K, listener: (...args: RestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof RestEvents>, listener: (...args: any[]) => void) => this);
|
|
87
88
|
removeAllListeners: (<K extends keyof RestEvents>(event?: K) => this) & (<S extends string | symbol>(event?: Exclude<S, keyof RestEvents>) => this);
|
|
88
89
|
}
|
|
89
|
-
export type RestManagerTypes = CADManager | CMSManager;
|
|
90
|
+
export type RestManagerTypes = CADManager | CMSManager | RadioManager;
|
|
90
91
|
export declare class REST extends EventEmitter {
|
|
91
92
|
readonly requestManager: RequestManager;
|
|
92
93
|
readonly instance: Instance;
|