camstreamerlib 4.0.15 → 4.0.17-dev-milestone.0
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/cjs/PlaneTrackerAPI.d.ts +9 -0
- package/cjs/node/events/MilestoneAgent.d.ts +14 -0
- package/cjs/node/events/MilestoneAgent.js +124 -0
- package/cjs/node/events/MilestoneAgent.test.d.ts +1 -0
- package/cjs/node/events/MilestoneAgent.test.js +102 -0
- package/cjs/node/index.d.ts +2 -0
- package/cjs/node/index.js +2 -0
- package/cjs/types/MilestoneAgent.d.ts +81 -0
- package/cjs/types/MilestoneAgent.js +18 -0
- package/cjs/types/PlaneTrackerAPI.d.ts +44 -0
- package/cjs/types/PlaneTrackerAPI.js +14 -0
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +135 -0
- package/cjs/types/ws/PlaneTrackerEvents.js +8 -0
- package/esm/node/events/MilestoneAgent.js +120 -0
- package/esm/node/events/MilestoneAgent.test.js +100 -0
- package/esm/node/index.js +2 -0
- package/esm/types/MilestoneAgent.js +15 -0
- package/esm/types/PlaneTrackerAPI.js +14 -0
- package/esm/types/ws/PlaneTrackerEvents.js +8 -0
- package/package.json +1 -1
- package/types/PlaneTrackerAPI.d.ts +9 -0
- package/types/node/events/MilestoneAgent.d.ts +14 -0
- package/types/node/events/MilestoneAgent.test.d.ts +1 -0
- package/types/node/index.d.ts +2 -0
- package/types/types/MilestoneAgent.d.ts +81 -0
- package/types/types/PlaneTrackerAPI.d.ts +44 -0
- package/types/types/ws/PlaneTrackerEvents.d.ts +135 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ErrorWithResponse } from '../../errors/errors';
|
|
2
|
+
import { HttpRequestSender } from '../HttpRequestSender';
|
|
3
|
+
import { camerasResponseSchema, tokenResponseSchema, } from '../../types/MilestoneAgent';
|
|
4
|
+
const CLIENT_ID = 'GrantValidatorClient';
|
|
5
|
+
const PAGE_SIZE = 100;
|
|
6
|
+
const TOKEN_EXPIRY_MARGIN_SEC = 60;
|
|
7
|
+
export class MilestoneAgent {
|
|
8
|
+
settings;
|
|
9
|
+
protocol;
|
|
10
|
+
sender;
|
|
11
|
+
token;
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
this.settings = {
|
|
14
|
+
protocol: options.protocol ?? 'https_insecure',
|
|
15
|
+
ip: options.ip ?? '127.0.0.1',
|
|
16
|
+
port: options.port ?? 443,
|
|
17
|
+
user: options.user ?? '',
|
|
18
|
+
pass: options.pass ?? '',
|
|
19
|
+
timeout: options.timeout ?? 10000,
|
|
20
|
+
};
|
|
21
|
+
this.protocol = this.settings.protocol === 'http' ? 'http:' : 'https:';
|
|
22
|
+
const tlsInsecure = this.settings.protocol === 'https_insecure';
|
|
23
|
+
this.sender = new HttpRequestSender({ rejectUnaurhorized: !tlsInsecure });
|
|
24
|
+
}
|
|
25
|
+
async checkConnection() {
|
|
26
|
+
await this.getToken(true);
|
|
27
|
+
await this.getCamerasPage(1, 1);
|
|
28
|
+
}
|
|
29
|
+
async getAllCameras() {
|
|
30
|
+
const cameras = [];
|
|
31
|
+
let page = 1;
|
|
32
|
+
for (;;) {
|
|
33
|
+
const pageCameras = await this.getCamerasPage(page, PAGE_SIZE);
|
|
34
|
+
cameras.push(...pageCameras);
|
|
35
|
+
if (pageCameras.length < PAGE_SIZE) {
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
page += 1;
|
|
39
|
+
}
|
|
40
|
+
return cameras;
|
|
41
|
+
}
|
|
42
|
+
async sendBookmark(cameraId, bookmark) {
|
|
43
|
+
const token = await this.getToken();
|
|
44
|
+
const body = JSON.stringify({
|
|
45
|
+
...bookmark,
|
|
46
|
+
devicePath: { type: 'cameras', id: cameraId },
|
|
47
|
+
});
|
|
48
|
+
const res = await this.sender.sendRequest(this.getRequestOptions('POST', '/api/rest/v1/bookmarks', token, {
|
|
49
|
+
'Content-Type': 'application/json',
|
|
50
|
+
}), body);
|
|
51
|
+
if (!res.ok) {
|
|
52
|
+
throw new ErrorWithResponse(res);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async getCamerasPage(page, itemsPerPage) {
|
|
56
|
+
const token = await this.getToken();
|
|
57
|
+
const res = await this.sender.sendRequest(this.getRequestOptions('GET', `/api/rest/v1/cameras?page=${page}&itemsPerPage=${itemsPerPage}`, token));
|
|
58
|
+
if (!res.ok) {
|
|
59
|
+
throw new ErrorWithResponse(res);
|
|
60
|
+
}
|
|
61
|
+
const responseBody = await res.text();
|
|
62
|
+
const result = await camerasResponseSchema.safeParseAsync(JSON.parse(responseBody));
|
|
63
|
+
if (!result.success) {
|
|
64
|
+
throw new Error('Milestone get cameras failed: ' + JSON.stringify(result.error.issues) + '\n' + responseBody);
|
|
65
|
+
}
|
|
66
|
+
return result.data.array;
|
|
67
|
+
}
|
|
68
|
+
async getToken(forceRefresh = false) {
|
|
69
|
+
const nowSec = Date.now() / 1000;
|
|
70
|
+
if (!forceRefresh && this.token !== undefined && this.token.expiresAt > nowSec) {
|
|
71
|
+
return this.token.value;
|
|
72
|
+
}
|
|
73
|
+
const body = new URLSearchParams({
|
|
74
|
+
grant_type: 'password',
|
|
75
|
+
username: this.settings.user,
|
|
76
|
+
password: this.settings.pass,
|
|
77
|
+
client_id: CLIENT_ID,
|
|
78
|
+
}).toString();
|
|
79
|
+
const res = await this.sender.sendRequest({
|
|
80
|
+
method: 'POST',
|
|
81
|
+
protocol: this.protocol,
|
|
82
|
+
host: this.settings.ip,
|
|
83
|
+
port: this.settings.port,
|
|
84
|
+
path: '/idp/connect/token',
|
|
85
|
+
timeout: this.settings.timeout,
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
88
|
+
'Accept': 'application/json',
|
|
89
|
+
},
|
|
90
|
+
}, body);
|
|
91
|
+
if (!res.ok) {
|
|
92
|
+
throw new ErrorWithResponse(res);
|
|
93
|
+
}
|
|
94
|
+
const responseBody = await res.text();
|
|
95
|
+
const result = await tokenResponseSchema.safeParseAsync(JSON.parse(responseBody));
|
|
96
|
+
if (!result.success) {
|
|
97
|
+
throw new Error('Milestone authorization failed: ' + JSON.stringify(result.error.issues) + '\n' + responseBody);
|
|
98
|
+
}
|
|
99
|
+
this.token = {
|
|
100
|
+
value: result.data.access_token,
|
|
101
|
+
expiresAt: nowSec + result.data.expires_in - TOKEN_EXPIRY_MARGIN_SEC,
|
|
102
|
+
};
|
|
103
|
+
return this.token.value;
|
|
104
|
+
}
|
|
105
|
+
getRequestOptions(method, path, token, extraHeaders) {
|
|
106
|
+
return {
|
|
107
|
+
method,
|
|
108
|
+
protocol: this.protocol,
|
|
109
|
+
host: this.settings.ip,
|
|
110
|
+
port: this.settings.port,
|
|
111
|
+
path,
|
|
112
|
+
timeout: this.settings.timeout,
|
|
113
|
+
headers: {
|
|
114
|
+
Authorization: `Bearer ${token}`,
|
|
115
|
+
Accept: 'application/json',
|
|
116
|
+
...extraHeaders,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, jest } from '@jest/globals';
|
|
2
|
+
import { HttpRequestSender } from '../HttpRequestSender';
|
|
3
|
+
import { MilestoneAgent } from './MilestoneAgent';
|
|
4
|
+
jest.mock('../HttpRequestSender');
|
|
5
|
+
function jsonResponse(body, status = 200) {
|
|
6
|
+
return {
|
|
7
|
+
ok: status >= 200 && status < 300,
|
|
8
|
+
status,
|
|
9
|
+
statusText: 'OK',
|
|
10
|
+
text: () => Promise.resolve(JSON.stringify(body)),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const TOKEN_BODY = { access_token: 'abc123', expires_in: 3600, token_type: 'Bearer', scope: 'managementserver' };
|
|
14
|
+
describe('MilestoneAgent', () => {
|
|
15
|
+
const MockedSender = jest.mocked(HttpRequestSender);
|
|
16
|
+
let sendRequest;
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
sendRequest = jest.fn();
|
|
19
|
+
MockedSender.mockImplementation(() => ({ sendRequest }));
|
|
20
|
+
});
|
|
21
|
+
function callsTo(prefix) {
|
|
22
|
+
return sendRequest.mock.calls.filter((c) => c[0].path.startsWith(prefix));
|
|
23
|
+
}
|
|
24
|
+
function routeByPath(handlers) {
|
|
25
|
+
sendRequest.mockImplementation((...args) => {
|
|
26
|
+
const options = args[0];
|
|
27
|
+
if (options.path === '/idp/connect/token') {
|
|
28
|
+
return Promise.resolve(jsonResponse(TOKEN_BODY));
|
|
29
|
+
}
|
|
30
|
+
for (const [prefix, handler] of Object.entries(handlers)) {
|
|
31
|
+
if (options.path.startsWith(prefix)) {
|
|
32
|
+
if (typeof handler === 'function') {
|
|
33
|
+
const page = Number(new URLSearchParams(options.path.split('?')[1]).get('page'));
|
|
34
|
+
return Promise.resolve(handler(page));
|
|
35
|
+
}
|
|
36
|
+
return Promise.resolve(handler);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Unexpected path ${options.path}`);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
test('fetches a bearer token before listing cameras and sends it in the header', async () => {
|
|
43
|
+
routeByPath({ '/api/rest/v1/cameras': jsonResponse({ array: [{ id: 'cam-1', displayName: 'Cam 1' }] }) });
|
|
44
|
+
const agent = new MilestoneAgent({ ip: '1.2.3.4' });
|
|
45
|
+
const cameras = await agent.getAllCameras();
|
|
46
|
+
expect(cameras).toEqual([{ id: 'cam-1', displayName: 'Cam 1' }]);
|
|
47
|
+
const tokenCalls = callsTo('/idp/connect/token');
|
|
48
|
+
expect(tokenCalls.length).toBe(1);
|
|
49
|
+
expect(tokenCalls[0][0].method).toBe('POST');
|
|
50
|
+
const camerasCall = callsTo('/api/rest/v1/cameras')[0];
|
|
51
|
+
expect(camerasCall[0].headers.Authorization).toBe('Bearer abc123');
|
|
52
|
+
});
|
|
53
|
+
test('reuses the cached token across calls', async () => {
|
|
54
|
+
routeByPath({ '/api/rest/v1/cameras': jsonResponse({ array: [] }) });
|
|
55
|
+
const agent = new MilestoneAgent({ ip: '1.2.3.4' });
|
|
56
|
+
await agent.getAllCameras();
|
|
57
|
+
await agent.getAllCameras();
|
|
58
|
+
expect(callsTo('/idp/connect/token').length).toBe(1);
|
|
59
|
+
});
|
|
60
|
+
test('pages through cameras until a non-full page is returned', async () => {
|
|
61
|
+
const fullPage = (page) => jsonResponse({ array: Array.from({ length: 100 }, (_, i) => ({ id: `p${page}-${i}` })) });
|
|
62
|
+
routeByPath({
|
|
63
|
+
'/api/rest/v1/cameras': (page) => page < 3 ? fullPage(page) : jsonResponse({ array: [{ id: 'last' }] }),
|
|
64
|
+
});
|
|
65
|
+
const agent = new MilestoneAgent({ ip: '1.2.3.4' });
|
|
66
|
+
const cameras = await agent.getAllCameras();
|
|
67
|
+
expect(cameras.length).toBe(201);
|
|
68
|
+
expect(cameras[cameras.length - 1]).toEqual({ id: 'last' });
|
|
69
|
+
});
|
|
70
|
+
test('sends a bookmark with the camera devicePath', async () => {
|
|
71
|
+
routeByPath({ '/api/rest/v1/bookmarks': jsonResponse({ result: {} }, 201) });
|
|
72
|
+
const agent = new MilestoneAgent({ ip: '1.2.3.4' });
|
|
73
|
+
await agent.sendBookmark('cam-guid', {
|
|
74
|
+
header: 'Airbus A320',
|
|
75
|
+
description: 'ICAO BC4AA',
|
|
76
|
+
timeBegin: '2026-04-16T10:25:00.000Z',
|
|
77
|
+
timeEnd: '2026-04-16T10:25:00.000Z',
|
|
78
|
+
timeTriggered: '2026-04-16T10:25:00.000Z',
|
|
79
|
+
reference: 'BC4AA',
|
|
80
|
+
});
|
|
81
|
+
const call = callsTo('/api/rest/v1/bookmarks')[0];
|
|
82
|
+
expect(call).toBeDefined();
|
|
83
|
+
const body = JSON.parse(call[1]);
|
|
84
|
+
expect(body.devicePath).toEqual({ type: 'cameras', id: 'cam-guid' });
|
|
85
|
+
expect(body.header).toBe('Airbus A320');
|
|
86
|
+
expect(body.description).toBe('ICAO BC4AA');
|
|
87
|
+
});
|
|
88
|
+
test('throws on a non-ok bookmark response', async () => {
|
|
89
|
+
routeByPath({ '/api/rest/v1/bookmarks': jsonResponse({ error: 'nope' }, 500) });
|
|
90
|
+
const agent = new MilestoneAgent({ ip: '1.2.3.4' });
|
|
91
|
+
await expect(agent.sendBookmark('cam-guid', {
|
|
92
|
+
header: 'h',
|
|
93
|
+
description: 'd',
|
|
94
|
+
timeBegin: 't',
|
|
95
|
+
timeEnd: 't',
|
|
96
|
+
timeTriggered: 't',
|
|
97
|
+
reference: 'r',
|
|
98
|
+
})).rejects.toThrow();
|
|
99
|
+
});
|
|
100
|
+
});
|
package/esm/node/index.js
CHANGED
|
@@ -6,6 +6,8 @@ export * from './events/AxisCameraStationEvents';
|
|
|
6
6
|
export * from './TimeZoneDaemon';
|
|
7
7
|
export * from './events/GenetecAgent';
|
|
8
8
|
export * from '../types/GenetecAgent';
|
|
9
|
+
export * from './events/MilestoneAgent';
|
|
10
|
+
export * from '../types/MilestoneAgent';
|
|
9
11
|
export { ResourceManager } from './CamOverlayPainter/ResourceManager';
|
|
10
12
|
export { Painter } from './CamOverlayPainter/Painter';
|
|
11
13
|
export { Frame } from './CamOverlayPainter/Frame';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const tokenResponseSchema = z.object({
|
|
3
|
+
access_token: z.string(),
|
|
4
|
+
expires_in: z.number(),
|
|
5
|
+
token_type: z.string(),
|
|
6
|
+
});
|
|
7
|
+
export const milestoneCameraSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
name: z.string().optional(),
|
|
10
|
+
displayName: z.string().optional(),
|
|
11
|
+
enabled: z.boolean().optional(),
|
|
12
|
+
});
|
|
13
|
+
export const camerasResponseSchema = z.object({
|
|
14
|
+
array: z.array(milestoneCameraSchema),
|
|
15
|
+
});
|
|
@@ -199,6 +199,20 @@ export const cameraSettingsSchema = z.object({
|
|
|
199
199
|
pass: '',
|
|
200
200
|
sourceKey: '',
|
|
201
201
|
}),
|
|
202
|
+
milestone: connectionSchema
|
|
203
|
+
.extend({
|
|
204
|
+
enabled: z.boolean(),
|
|
205
|
+
cameraList: z.string().array().default([]),
|
|
206
|
+
})
|
|
207
|
+
.default({
|
|
208
|
+
enabled: false,
|
|
209
|
+
protocol: 'https_insecure',
|
|
210
|
+
ip: '',
|
|
211
|
+
port: 443,
|
|
212
|
+
user: '',
|
|
213
|
+
pass: '',
|
|
214
|
+
cameraList: [],
|
|
215
|
+
}),
|
|
202
216
|
camstreamerIntegration: z
|
|
203
217
|
.object({
|
|
204
218
|
adPlacementEnabled: z.boolean(),
|
|
@@ -44,6 +44,7 @@ export var EUserActions;
|
|
|
44
44
|
EUserActions["TRACK_ICAO"] = "trackIcao.cgi";
|
|
45
45
|
EUserActions["TRACK_TARGET"] = "trackTarget.cgi";
|
|
46
46
|
EUserActions["RESET_ICAO"] = "resetIcao.cgi";
|
|
47
|
+
EUserActions["RESET_TARGET"] = "resetTarget.cgi";
|
|
47
48
|
EUserActions["SET_PRIORITY_LIST"] = "setPriorityList.cgi";
|
|
48
49
|
EUserActions["SET_BLACK_LIST"] = "setBlackList.cgi";
|
|
49
50
|
EUserActions["SET_WHITE_LIST"] = "setWhiteList.cgi";
|
|
@@ -86,6 +87,13 @@ const eventsDataSchema = z.union([
|
|
|
86
87
|
params: userSchema,
|
|
87
88
|
postJsonBody: z.any(),
|
|
88
89
|
}),
|
|
90
|
+
z.object({
|
|
91
|
+
type: z.literal('USER_ACTION'),
|
|
92
|
+
cgi: z.literal(EUserActions.RESET_TARGET),
|
|
93
|
+
ip: z.string(),
|
|
94
|
+
params: userSchema,
|
|
95
|
+
postJsonBody: z.any(),
|
|
96
|
+
}),
|
|
89
97
|
z.object({
|
|
90
98
|
type: z.literal('USER_ACTION'),
|
|
91
99
|
cgi: z.literal(EUserActions.SET_PRIORITY_LIST),
|
package/package.json
CHANGED
|
@@ -107,6 +107,15 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> ext
|
|
|
107
107
|
protocol: "https" | "http" | "https_insecure";
|
|
108
108
|
sourceKey: string;
|
|
109
109
|
};
|
|
110
|
+
milestone: {
|
|
111
|
+
ip: string;
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
port: number;
|
|
114
|
+
cameraList: string[];
|
|
115
|
+
pass: string;
|
|
116
|
+
user: string;
|
|
117
|
+
protocol: "https" | "http" | "https_insecure";
|
|
118
|
+
};
|
|
110
119
|
camstreamerIntegration: {
|
|
111
120
|
adPlacementEnabled: boolean;
|
|
112
121
|
adMinIntervalSec: number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MilestoneAgentOptions, TBookmark, TMilestoneCamera } from '../../types/MilestoneAgent';
|
|
2
|
+
export declare class MilestoneAgent {
|
|
3
|
+
private settings;
|
|
4
|
+
private protocol;
|
|
5
|
+
private sender;
|
|
6
|
+
private token?;
|
|
7
|
+
constructor(options?: MilestoneAgentOptions);
|
|
8
|
+
checkConnection(): Promise<void>;
|
|
9
|
+
getAllCameras(): Promise<TMilestoneCamera[]>;
|
|
10
|
+
sendBookmark(cameraId: string, bookmark: TBookmark): Promise<void>;
|
|
11
|
+
private getCamerasPage;
|
|
12
|
+
private getToken;
|
|
13
|
+
private getRequestOptions;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/node/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export * from './events/AxisCameraStationEvents';
|
|
|
6
6
|
export * from './TimeZoneDaemon';
|
|
7
7
|
export * from './events/GenetecAgent';
|
|
8
8
|
export * from '../types/GenetecAgent';
|
|
9
|
+
export * from './events/MilestoneAgent';
|
|
10
|
+
export * from '../types/MilestoneAgent';
|
|
9
11
|
export { ResourceManager } from './CamOverlayPainter/ResourceManager';
|
|
10
12
|
export { Painter } from './CamOverlayPainter/Painter';
|
|
11
13
|
export { Frame } from './CamOverlayPainter/Frame';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type MilestoneAgentOptions = {
|
|
3
|
+
protocol?: 'http' | 'https' | 'https_insecure';
|
|
4
|
+
ip?: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
user?: string;
|
|
7
|
+
pass?: string;
|
|
8
|
+
timeout?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const tokenResponseSchema: z.ZodObject<{
|
|
11
|
+
access_token: z.ZodString;
|
|
12
|
+
expires_in: z.ZodNumber;
|
|
13
|
+
token_type: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
access_token: string;
|
|
16
|
+
expires_in: number;
|
|
17
|
+
token_type: string;
|
|
18
|
+
}, {
|
|
19
|
+
access_token: string;
|
|
20
|
+
expires_in: number;
|
|
21
|
+
token_type: string;
|
|
22
|
+
}>;
|
|
23
|
+
export type TTokenResponse = z.infer<typeof tokenResponseSchema>;
|
|
24
|
+
export declare const milestoneCameraSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
name: z.ZodOptional<z.ZodString>;
|
|
27
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
28
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
id: string;
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
enabled?: boolean | undefined;
|
|
33
|
+
displayName?: string | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
id: string;
|
|
36
|
+
name?: string | undefined;
|
|
37
|
+
enabled?: boolean | undefined;
|
|
38
|
+
displayName?: string | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export type TMilestoneCamera = z.infer<typeof milestoneCameraSchema>;
|
|
41
|
+
export declare const camerasResponseSchema: z.ZodObject<{
|
|
42
|
+
array: z.ZodArray<z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
name: z.ZodOptional<z.ZodString>;
|
|
45
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
46
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
id: string;
|
|
49
|
+
name?: string | undefined;
|
|
50
|
+
enabled?: boolean | undefined;
|
|
51
|
+
displayName?: string | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
id: string;
|
|
54
|
+
name?: string | undefined;
|
|
55
|
+
enabled?: boolean | undefined;
|
|
56
|
+
displayName?: string | undefined;
|
|
57
|
+
}>, "many">;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
array: {
|
|
60
|
+
id: string;
|
|
61
|
+
name?: string | undefined;
|
|
62
|
+
enabled?: boolean | undefined;
|
|
63
|
+
displayName?: string | undefined;
|
|
64
|
+
}[];
|
|
65
|
+
}, {
|
|
66
|
+
array: {
|
|
67
|
+
id: string;
|
|
68
|
+
name?: string | undefined;
|
|
69
|
+
enabled?: boolean | undefined;
|
|
70
|
+
displayName?: string | undefined;
|
|
71
|
+
}[];
|
|
72
|
+
}>;
|
|
73
|
+
export type TCamerasResponse = z.infer<typeof camerasResponseSchema>;
|
|
74
|
+
export type TBookmark = {
|
|
75
|
+
header: string;
|
|
76
|
+
description: string;
|
|
77
|
+
timeBegin: string;
|
|
78
|
+
timeEnd: string;
|
|
79
|
+
timeTriggered: string;
|
|
80
|
+
reference: string;
|
|
81
|
+
};
|
|
@@ -358,6 +358,32 @@ export declare const cameraSettingsSchema: z.ZodObject<{
|
|
|
358
358
|
protocol: "https" | "http" | "https_insecure";
|
|
359
359
|
sourceKey: string;
|
|
360
360
|
}>>;
|
|
361
|
+
milestone: z.ZodDefault<z.ZodObject<{
|
|
362
|
+
protocol: z.ZodUnion<[z.ZodLiteral<"http">, z.ZodLiteral<"https">, z.ZodLiteral<"https_insecure">]>;
|
|
363
|
+
ip: z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>;
|
|
364
|
+
port: z.ZodNumber;
|
|
365
|
+
user: z.ZodString;
|
|
366
|
+
pass: z.ZodString;
|
|
367
|
+
} & {
|
|
368
|
+
enabled: z.ZodBoolean;
|
|
369
|
+
cameraList: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
370
|
+
}, "strip", z.ZodTypeAny, {
|
|
371
|
+
ip: string;
|
|
372
|
+
enabled: boolean;
|
|
373
|
+
port: number;
|
|
374
|
+
cameraList: string[];
|
|
375
|
+
pass: string;
|
|
376
|
+
user: string;
|
|
377
|
+
protocol: "https" | "http" | "https_insecure";
|
|
378
|
+
}, {
|
|
379
|
+
ip: string;
|
|
380
|
+
enabled: boolean;
|
|
381
|
+
port: number;
|
|
382
|
+
pass: string;
|
|
383
|
+
user: string;
|
|
384
|
+
protocol: "https" | "http" | "https_insecure";
|
|
385
|
+
cameraList?: string[] | undefined;
|
|
386
|
+
}>>;
|
|
361
387
|
camstreamerIntegration: z.ZodDefault<z.ZodObject<{
|
|
362
388
|
adPlacementEnabled: z.ZodBoolean;
|
|
363
389
|
adMinIntervalSec: z.ZodNumber;
|
|
@@ -463,6 +489,15 @@ export declare const cameraSettingsSchema: z.ZodObject<{
|
|
|
463
489
|
protocol: "https" | "http" | "https_insecure";
|
|
464
490
|
sourceKey: string;
|
|
465
491
|
};
|
|
492
|
+
milestone: {
|
|
493
|
+
ip: string;
|
|
494
|
+
enabled: boolean;
|
|
495
|
+
port: number;
|
|
496
|
+
cameraList: string[];
|
|
497
|
+
pass: string;
|
|
498
|
+
user: string;
|
|
499
|
+
protocol: "https" | "http" | "https_insecure";
|
|
500
|
+
};
|
|
466
501
|
camstreamerIntegration: {
|
|
467
502
|
adPlacementEnabled: boolean;
|
|
468
503
|
adMinIntervalSec: number;
|
|
@@ -606,6 +641,15 @@ export declare const cameraSettingsSchema: z.ZodObject<{
|
|
|
606
641
|
protocol: "https" | "http" | "https_insecure";
|
|
607
642
|
sourceKey: string;
|
|
608
643
|
} | undefined;
|
|
644
|
+
milestone?: {
|
|
645
|
+
ip: string;
|
|
646
|
+
enabled: boolean;
|
|
647
|
+
port: number;
|
|
648
|
+
pass: string;
|
|
649
|
+
user: string;
|
|
650
|
+
protocol: "https" | "http" | "https_insecure";
|
|
651
|
+
cameraList?: string[] | undefined;
|
|
652
|
+
} | undefined;
|
|
609
653
|
camstreamerIntegration?: {
|
|
610
654
|
adPlacementEnabled: boolean;
|
|
611
655
|
adMinIntervalSec: number;
|
|
@@ -107,6 +107,7 @@ export declare enum EUserActions {
|
|
|
107
107
|
TRACK_ICAO = "trackIcao.cgi",
|
|
108
108
|
TRACK_TARGET = "trackTarget.cgi",
|
|
109
109
|
RESET_ICAO = "resetIcao.cgi",
|
|
110
|
+
RESET_TARGET = "resetTarget.cgi",
|
|
110
111
|
SET_PRIORITY_LIST = "setPriorityList.cgi",
|
|
111
112
|
SET_BLACK_LIST = "setBlackList.cgi",
|
|
112
113
|
SET_WHITE_LIST = "setWhiteList.cgi",
|
|
@@ -408,6 +409,44 @@ declare const eventsDataSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
408
409
|
ip: string;
|
|
409
410
|
cgi: EUserActions.RESET_ICAO;
|
|
410
411
|
postJsonBody?: any;
|
|
412
|
+
}>, z.ZodObject<{
|
|
413
|
+
type: z.ZodLiteral<"USER_ACTION">;
|
|
414
|
+
cgi: z.ZodLiteral<EUserActions.RESET_TARGET>;
|
|
415
|
+
ip: z.ZodString;
|
|
416
|
+
params: z.ZodObject<{
|
|
417
|
+
userId: z.ZodString;
|
|
418
|
+
userName: z.ZodString;
|
|
419
|
+
userPriority: z.ZodString;
|
|
420
|
+
}, "strip", z.ZodTypeAny, {
|
|
421
|
+
userId: string;
|
|
422
|
+
userName: string;
|
|
423
|
+
userPriority: string;
|
|
424
|
+
}, {
|
|
425
|
+
userId: string;
|
|
426
|
+
userName: string;
|
|
427
|
+
userPriority: string;
|
|
428
|
+
}>;
|
|
429
|
+
postJsonBody: z.ZodAny;
|
|
430
|
+
}, "strip", z.ZodTypeAny, {
|
|
431
|
+
params: {
|
|
432
|
+
userId: string;
|
|
433
|
+
userName: string;
|
|
434
|
+
userPriority: string;
|
|
435
|
+
};
|
|
436
|
+
type: "USER_ACTION";
|
|
437
|
+
ip: string;
|
|
438
|
+
cgi: EUserActions.RESET_TARGET;
|
|
439
|
+
postJsonBody?: any;
|
|
440
|
+
}, {
|
|
441
|
+
params: {
|
|
442
|
+
userId: string;
|
|
443
|
+
userName: string;
|
|
444
|
+
userPriority: string;
|
|
445
|
+
};
|
|
446
|
+
type: "USER_ACTION";
|
|
447
|
+
ip: string;
|
|
448
|
+
cgi: EUserActions.RESET_TARGET;
|
|
449
|
+
postJsonBody?: any;
|
|
411
450
|
}>, z.ZodObject<{
|
|
412
451
|
type: z.ZodLiteral<"USER_ACTION">;
|
|
413
452
|
cgi: z.ZodLiteral<EUserActions.SET_PRIORITY_LIST>;
|
|
@@ -1406,6 +1445,44 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1406
1445
|
ip: string;
|
|
1407
1446
|
cgi: EUserActions.RESET_ICAO;
|
|
1408
1447
|
postJsonBody?: any;
|
|
1448
|
+
}>, z.ZodObject<{
|
|
1449
|
+
type: z.ZodLiteral<"USER_ACTION">;
|
|
1450
|
+
cgi: z.ZodLiteral<EUserActions.RESET_TARGET>;
|
|
1451
|
+
ip: z.ZodString;
|
|
1452
|
+
params: z.ZodObject<{
|
|
1453
|
+
userId: z.ZodString;
|
|
1454
|
+
userName: z.ZodString;
|
|
1455
|
+
userPriority: z.ZodString;
|
|
1456
|
+
}, "strip", z.ZodTypeAny, {
|
|
1457
|
+
userId: string;
|
|
1458
|
+
userName: string;
|
|
1459
|
+
userPriority: string;
|
|
1460
|
+
}, {
|
|
1461
|
+
userId: string;
|
|
1462
|
+
userName: string;
|
|
1463
|
+
userPriority: string;
|
|
1464
|
+
}>;
|
|
1465
|
+
postJsonBody: z.ZodAny;
|
|
1466
|
+
}, "strip", z.ZodTypeAny, {
|
|
1467
|
+
params: {
|
|
1468
|
+
userId: string;
|
|
1469
|
+
userName: string;
|
|
1470
|
+
userPriority: string;
|
|
1471
|
+
};
|
|
1472
|
+
type: "USER_ACTION";
|
|
1473
|
+
ip: string;
|
|
1474
|
+
cgi: EUserActions.RESET_TARGET;
|
|
1475
|
+
postJsonBody?: any;
|
|
1476
|
+
}, {
|
|
1477
|
+
params: {
|
|
1478
|
+
userId: string;
|
|
1479
|
+
userName: string;
|
|
1480
|
+
userPriority: string;
|
|
1481
|
+
};
|
|
1482
|
+
type: "USER_ACTION";
|
|
1483
|
+
ip: string;
|
|
1484
|
+
cgi: EUserActions.RESET_TARGET;
|
|
1485
|
+
postJsonBody?: any;
|
|
1409
1486
|
}>, z.ZodObject<{
|
|
1410
1487
|
type: z.ZodLiteral<"USER_ACTION">;
|
|
1411
1488
|
cgi: z.ZodLiteral<EUserActions.SET_PRIORITY_LIST>;
|
|
@@ -2185,6 +2262,16 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
2185
2262
|
ip: string;
|
|
2186
2263
|
cgi: EUserActions.RESET_ICAO;
|
|
2187
2264
|
postJsonBody?: any;
|
|
2265
|
+
} | {
|
|
2266
|
+
params: {
|
|
2267
|
+
userId: string;
|
|
2268
|
+
userName: string;
|
|
2269
|
+
userPriority: string;
|
|
2270
|
+
};
|
|
2271
|
+
type: "USER_ACTION";
|
|
2272
|
+
ip: string;
|
|
2273
|
+
cgi: EUserActions.RESET_TARGET;
|
|
2274
|
+
postJsonBody?: any;
|
|
2188
2275
|
} | {
|
|
2189
2276
|
params: {
|
|
2190
2277
|
userId: string;
|
|
@@ -2414,6 +2501,16 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
2414
2501
|
ip: string;
|
|
2415
2502
|
cgi: EUserActions.RESET_ICAO;
|
|
2416
2503
|
postJsonBody?: any;
|
|
2504
|
+
} | {
|
|
2505
|
+
params: {
|
|
2506
|
+
userId: string;
|
|
2507
|
+
userName: string;
|
|
2508
|
+
userPriority: string;
|
|
2509
|
+
};
|
|
2510
|
+
type: "USER_ACTION";
|
|
2511
|
+
ip: string;
|
|
2512
|
+
cgi: EUserActions.RESET_TARGET;
|
|
2513
|
+
postJsonBody?: any;
|
|
2417
2514
|
} | {
|
|
2418
2515
|
params: {
|
|
2419
2516
|
userId: string;
|
|
@@ -2860,6 +2957,44 @@ export declare const ptrEventsSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
2860
2957
|
ip: string;
|
|
2861
2958
|
cgi: EUserActions.RESET_ICAO;
|
|
2862
2959
|
postJsonBody?: any;
|
|
2960
|
+
}>, z.ZodObject<{
|
|
2961
|
+
type: z.ZodLiteral<"USER_ACTION">;
|
|
2962
|
+
cgi: z.ZodLiteral<EUserActions.RESET_TARGET>;
|
|
2963
|
+
ip: z.ZodString;
|
|
2964
|
+
params: z.ZodObject<{
|
|
2965
|
+
userId: z.ZodString;
|
|
2966
|
+
userName: z.ZodString;
|
|
2967
|
+
userPriority: z.ZodString;
|
|
2968
|
+
}, "strip", z.ZodTypeAny, {
|
|
2969
|
+
userId: string;
|
|
2970
|
+
userName: string;
|
|
2971
|
+
userPriority: string;
|
|
2972
|
+
}, {
|
|
2973
|
+
userId: string;
|
|
2974
|
+
userName: string;
|
|
2975
|
+
userPriority: string;
|
|
2976
|
+
}>;
|
|
2977
|
+
postJsonBody: z.ZodAny;
|
|
2978
|
+
}, "strip", z.ZodTypeAny, {
|
|
2979
|
+
params: {
|
|
2980
|
+
userId: string;
|
|
2981
|
+
userName: string;
|
|
2982
|
+
userPriority: string;
|
|
2983
|
+
};
|
|
2984
|
+
type: "USER_ACTION";
|
|
2985
|
+
ip: string;
|
|
2986
|
+
cgi: EUserActions.RESET_TARGET;
|
|
2987
|
+
postJsonBody?: any;
|
|
2988
|
+
}, {
|
|
2989
|
+
params: {
|
|
2990
|
+
userId: string;
|
|
2991
|
+
userName: string;
|
|
2992
|
+
userPriority: string;
|
|
2993
|
+
};
|
|
2994
|
+
type: "USER_ACTION";
|
|
2995
|
+
ip: string;
|
|
2996
|
+
cgi: EUserActions.RESET_TARGET;
|
|
2997
|
+
postJsonBody?: any;
|
|
2863
2998
|
}>, z.ZodObject<{
|
|
2864
2999
|
type: z.ZodLiteral<"USER_ACTION">;
|
|
2865
3000
|
cgi: z.ZodLiteral<EUserActions.SET_PRIORITY_LIST>;
|