camstreamerlib 4.0.0-beta.81 → 4.0.0-beta.83
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/CamStreamerAPI.d.ts +282 -1
- package/cjs/CamStreamerAPI.js +30 -0
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +1927 -0
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +27 -1
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +103 -0
- package/cjs/types/CamStreamerAPI/hlsSchema.d.ts +103 -0
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +103 -0
- package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +24 -24
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +103 -0
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +103 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +170 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +20 -1
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +103 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +103 -0
- package/esm/CamStreamerAPI.js +31 -1
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +26 -0
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +19 -0
- package/package.json +1 -1
- package/types/CamStreamerAPI.d.ts +282 -1
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +1927 -0
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +103 -0
- package/types/types/CamStreamerAPI/hlsSchema.d.ts +103 -0
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +103 -0
- package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +24 -24
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +103 -0
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +103 -0
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +170 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +103 -0
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +103 -0
|
@@ -4,6 +4,71 @@ export declare const sdCardSchema: z.ZodObject<{
|
|
|
4
4
|
enabled: z.ZodBoolean;
|
|
5
5
|
active: z.ZodBoolean;
|
|
6
6
|
title: z.ZodString;
|
|
7
|
+
trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"manual">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "manual";
|
|
11
|
+
}, {
|
|
12
|
+
type: "manual";
|
|
13
|
+
}>, z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"onetime">;
|
|
15
|
+
startTime: z.ZodNumber;
|
|
16
|
+
stopTime: z.ZodNumber;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
type: "onetime";
|
|
19
|
+
startTime: number;
|
|
20
|
+
stopTime: number;
|
|
21
|
+
}, {
|
|
22
|
+
type: "onetime";
|
|
23
|
+
startTime: number;
|
|
24
|
+
stopTime: number;
|
|
25
|
+
}>, z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"recurrent">;
|
|
27
|
+
schedule: z.ZodArray<z.ZodObject<{
|
|
28
|
+
day: z.ZodNumber;
|
|
29
|
+
startTimeS: z.ZodNumber;
|
|
30
|
+
stopTimeS: z.ZodNumber;
|
|
31
|
+
isActive: z.ZodBoolean;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
day: number;
|
|
34
|
+
startTimeS: number;
|
|
35
|
+
stopTimeS: number;
|
|
36
|
+
isActive: boolean;
|
|
37
|
+
}, {
|
|
38
|
+
day: number;
|
|
39
|
+
startTimeS: number;
|
|
40
|
+
stopTimeS: number;
|
|
41
|
+
isActive: boolean;
|
|
42
|
+
}>, "many">;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
type: "recurrent";
|
|
45
|
+
schedule: {
|
|
46
|
+
day: number;
|
|
47
|
+
startTimeS: number;
|
|
48
|
+
stopTimeS: number;
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
}[];
|
|
51
|
+
}, {
|
|
52
|
+
type: "recurrent";
|
|
53
|
+
schedule: {
|
|
54
|
+
day: number;
|
|
55
|
+
startTimeS: number;
|
|
56
|
+
stopTimeS: number;
|
|
57
|
+
isActive: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
}>, z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"io">;
|
|
61
|
+
ioPort: z.ZodString;
|
|
62
|
+
triggerOn: z.ZodUnion<[z.ZodLiteral<"open">, z.ZodLiteral<"closed">]>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
type: "io";
|
|
65
|
+
ioPort: string;
|
|
66
|
+
triggerOn: "open" | "closed";
|
|
67
|
+
}, {
|
|
68
|
+
type: "io";
|
|
69
|
+
ioPort: string;
|
|
70
|
+
triggerOn: "open" | "closed";
|
|
71
|
+
}>]>;
|
|
7
72
|
} & {
|
|
8
73
|
type: z.ZodLiteral<"sd_card">;
|
|
9
74
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -12,10 +77,48 @@ export declare const sdCardSchema: z.ZodObject<{
|
|
|
12
77
|
id: number;
|
|
13
78
|
active: boolean;
|
|
14
79
|
title: string;
|
|
80
|
+
trigger: {
|
|
81
|
+
type: "manual";
|
|
82
|
+
} | {
|
|
83
|
+
type: "onetime";
|
|
84
|
+
startTime: number;
|
|
85
|
+
stopTime: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: "recurrent";
|
|
88
|
+
schedule: {
|
|
89
|
+
day: number;
|
|
90
|
+
startTimeS: number;
|
|
91
|
+
stopTimeS: number;
|
|
92
|
+
isActive: boolean;
|
|
93
|
+
}[];
|
|
94
|
+
} | {
|
|
95
|
+
type: "io";
|
|
96
|
+
ioPort: string;
|
|
97
|
+
triggerOn: "open" | "closed";
|
|
98
|
+
};
|
|
15
99
|
}, {
|
|
16
100
|
type: "sd_card";
|
|
17
101
|
enabled: boolean;
|
|
18
102
|
id: number;
|
|
19
103
|
active: boolean;
|
|
20
104
|
title: string;
|
|
105
|
+
trigger: {
|
|
106
|
+
type: "manual";
|
|
107
|
+
} | {
|
|
108
|
+
type: "onetime";
|
|
109
|
+
startTime: number;
|
|
110
|
+
stopTime: number;
|
|
111
|
+
} | {
|
|
112
|
+
type: "recurrent";
|
|
113
|
+
schedule: {
|
|
114
|
+
day: number;
|
|
115
|
+
startTimeS: number;
|
|
116
|
+
stopTimeS: number;
|
|
117
|
+
isActive: boolean;
|
|
118
|
+
}[];
|
|
119
|
+
} | {
|
|
120
|
+
type: "io";
|
|
121
|
+
ioPort: string;
|
|
122
|
+
triggerOn: "open" | "closed";
|
|
123
|
+
};
|
|
21
124
|
}>;
|
|
@@ -1,20 +1,190 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const streamTypeSchema: z.ZodUnion<[z.ZodLiteral<"youtube">, z.ZodLiteral<"facebook">, z.ZodLiteral<"sd_card">, z.ZodLiteral<"windy">, z.ZodLiteral<"mpeg_dvb">, z.ZodLiteral<"hls">, z.ZodLiteral<"rtmp">]>;
|
|
3
3
|
export type TStreamType = z.infer<typeof streamTypeSchema>;
|
|
4
|
+
export declare const streamTriggerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"manual">;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: "manual";
|
|
8
|
+
}, {
|
|
9
|
+
type: "manual";
|
|
10
|
+
}>, z.ZodObject<{
|
|
11
|
+
type: z.ZodLiteral<"onetime">;
|
|
12
|
+
startTime: z.ZodNumber;
|
|
13
|
+
stopTime: z.ZodNumber;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
type: "onetime";
|
|
16
|
+
startTime: number;
|
|
17
|
+
stopTime: number;
|
|
18
|
+
}, {
|
|
19
|
+
type: "onetime";
|
|
20
|
+
startTime: number;
|
|
21
|
+
stopTime: number;
|
|
22
|
+
}>, z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"recurrent">;
|
|
24
|
+
schedule: z.ZodArray<z.ZodObject<{
|
|
25
|
+
day: z.ZodNumber;
|
|
26
|
+
startTimeS: z.ZodNumber;
|
|
27
|
+
stopTimeS: z.ZodNumber;
|
|
28
|
+
isActive: z.ZodBoolean;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
day: number;
|
|
31
|
+
startTimeS: number;
|
|
32
|
+
stopTimeS: number;
|
|
33
|
+
isActive: boolean;
|
|
34
|
+
}, {
|
|
35
|
+
day: number;
|
|
36
|
+
startTimeS: number;
|
|
37
|
+
stopTimeS: number;
|
|
38
|
+
isActive: boolean;
|
|
39
|
+
}>, "many">;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
type: "recurrent";
|
|
42
|
+
schedule: {
|
|
43
|
+
day: number;
|
|
44
|
+
startTimeS: number;
|
|
45
|
+
stopTimeS: number;
|
|
46
|
+
isActive: boolean;
|
|
47
|
+
}[];
|
|
48
|
+
}, {
|
|
49
|
+
type: "recurrent";
|
|
50
|
+
schedule: {
|
|
51
|
+
day: number;
|
|
52
|
+
startTimeS: number;
|
|
53
|
+
stopTimeS: number;
|
|
54
|
+
isActive: boolean;
|
|
55
|
+
}[];
|
|
56
|
+
}>, z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"io">;
|
|
58
|
+
ioPort: z.ZodString;
|
|
59
|
+
triggerOn: z.ZodUnion<[z.ZodLiteral<"open">, z.ZodLiteral<"closed">]>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
type: "io";
|
|
62
|
+
ioPort: string;
|
|
63
|
+
triggerOn: "open" | "closed";
|
|
64
|
+
}, {
|
|
65
|
+
type: "io";
|
|
66
|
+
ioPort: string;
|
|
67
|
+
triggerOn: "open" | "closed";
|
|
68
|
+
}>]>;
|
|
69
|
+
export type TStreamTrigger = z.infer<typeof streamTriggerSchema>;
|
|
70
|
+
export type TStreamTriggerType = TStreamTrigger['type'];
|
|
4
71
|
export declare const streamCommonSchema: z.ZodObject<{
|
|
5
72
|
id: z.ZodNumber;
|
|
6
73
|
enabled: z.ZodBoolean;
|
|
7
74
|
active: z.ZodBoolean;
|
|
8
75
|
title: z.ZodString;
|
|
76
|
+
trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
77
|
+
type: z.ZodLiteral<"manual">;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
type: "manual";
|
|
80
|
+
}, {
|
|
81
|
+
type: "manual";
|
|
82
|
+
}>, z.ZodObject<{
|
|
83
|
+
type: z.ZodLiteral<"onetime">;
|
|
84
|
+
startTime: z.ZodNumber;
|
|
85
|
+
stopTime: z.ZodNumber;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
type: "onetime";
|
|
88
|
+
startTime: number;
|
|
89
|
+
stopTime: number;
|
|
90
|
+
}, {
|
|
91
|
+
type: "onetime";
|
|
92
|
+
startTime: number;
|
|
93
|
+
stopTime: number;
|
|
94
|
+
}>, z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"recurrent">;
|
|
96
|
+
schedule: z.ZodArray<z.ZodObject<{
|
|
97
|
+
day: z.ZodNumber;
|
|
98
|
+
startTimeS: z.ZodNumber;
|
|
99
|
+
stopTimeS: z.ZodNumber;
|
|
100
|
+
isActive: z.ZodBoolean;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
day: number;
|
|
103
|
+
startTimeS: number;
|
|
104
|
+
stopTimeS: number;
|
|
105
|
+
isActive: boolean;
|
|
106
|
+
}, {
|
|
107
|
+
day: number;
|
|
108
|
+
startTimeS: number;
|
|
109
|
+
stopTimeS: number;
|
|
110
|
+
isActive: boolean;
|
|
111
|
+
}>, "many">;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
type: "recurrent";
|
|
114
|
+
schedule: {
|
|
115
|
+
day: number;
|
|
116
|
+
startTimeS: number;
|
|
117
|
+
stopTimeS: number;
|
|
118
|
+
isActive: boolean;
|
|
119
|
+
}[];
|
|
120
|
+
}, {
|
|
121
|
+
type: "recurrent";
|
|
122
|
+
schedule: {
|
|
123
|
+
day: number;
|
|
124
|
+
startTimeS: number;
|
|
125
|
+
stopTimeS: number;
|
|
126
|
+
isActive: boolean;
|
|
127
|
+
}[];
|
|
128
|
+
}>, z.ZodObject<{
|
|
129
|
+
type: z.ZodLiteral<"io">;
|
|
130
|
+
ioPort: z.ZodString;
|
|
131
|
+
triggerOn: z.ZodUnion<[z.ZodLiteral<"open">, z.ZodLiteral<"closed">]>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
type: "io";
|
|
134
|
+
ioPort: string;
|
|
135
|
+
triggerOn: "open" | "closed";
|
|
136
|
+
}, {
|
|
137
|
+
type: "io";
|
|
138
|
+
ioPort: string;
|
|
139
|
+
triggerOn: "open" | "closed";
|
|
140
|
+
}>]>;
|
|
9
141
|
}, "strip", z.ZodTypeAny, {
|
|
10
142
|
enabled: boolean;
|
|
11
143
|
id: number;
|
|
12
144
|
active: boolean;
|
|
13
145
|
title: string;
|
|
146
|
+
trigger: {
|
|
147
|
+
type: "manual";
|
|
148
|
+
} | {
|
|
149
|
+
type: "onetime";
|
|
150
|
+
startTime: number;
|
|
151
|
+
stopTime: number;
|
|
152
|
+
} | {
|
|
153
|
+
type: "recurrent";
|
|
154
|
+
schedule: {
|
|
155
|
+
day: number;
|
|
156
|
+
startTimeS: number;
|
|
157
|
+
stopTimeS: number;
|
|
158
|
+
isActive: boolean;
|
|
159
|
+
}[];
|
|
160
|
+
} | {
|
|
161
|
+
type: "io";
|
|
162
|
+
ioPort: string;
|
|
163
|
+
triggerOn: "open" | "closed";
|
|
164
|
+
};
|
|
14
165
|
}, {
|
|
15
166
|
enabled: boolean;
|
|
16
167
|
id: number;
|
|
17
168
|
active: boolean;
|
|
18
169
|
title: string;
|
|
170
|
+
trigger: {
|
|
171
|
+
type: "manual";
|
|
172
|
+
} | {
|
|
173
|
+
type: "onetime";
|
|
174
|
+
startTime: number;
|
|
175
|
+
stopTime: number;
|
|
176
|
+
} | {
|
|
177
|
+
type: "recurrent";
|
|
178
|
+
schedule: {
|
|
179
|
+
day: number;
|
|
180
|
+
startTimeS: number;
|
|
181
|
+
stopTimeS: number;
|
|
182
|
+
isActive: boolean;
|
|
183
|
+
}[];
|
|
184
|
+
} | {
|
|
185
|
+
type: "io";
|
|
186
|
+
ioPort: string;
|
|
187
|
+
triggerOn: "open" | "closed";
|
|
188
|
+
};
|
|
19
189
|
}>;
|
|
20
190
|
export type TCommonStream = z.infer<typeof streamCommonSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.streamCommonSchema = exports.streamTypeSchema = void 0;
|
|
3
|
+
exports.streamCommonSchema = exports.streamTriggerSchema = exports.streamTypeSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.streamTypeSchema = zod_1.z.union([
|
|
6
6
|
zod_1.z.literal('youtube'),
|
|
@@ -11,9 +11,28 @@ exports.streamTypeSchema = zod_1.z.union([
|
|
|
11
11
|
zod_1.z.literal('hls'),
|
|
12
12
|
zod_1.z.literal('rtmp'),
|
|
13
13
|
]);
|
|
14
|
+
exports.streamTriggerSchema = zod_1.z.discriminatedUnion('type', [
|
|
15
|
+
zod_1.z.object({ type: zod_1.z.literal('manual') }),
|
|
16
|
+
zod_1.z.object({ type: zod_1.z.literal('onetime'), startTime: zod_1.z.number(), stopTime: zod_1.z.number() }),
|
|
17
|
+
zod_1.z.object({
|
|
18
|
+
type: zod_1.z.literal('recurrent'),
|
|
19
|
+
schedule: zod_1.z.array(zod_1.z.object({
|
|
20
|
+
day: zod_1.z.number().int().min(0).max(6),
|
|
21
|
+
startTimeS: zod_1.z.number().int().min(0).max(86400),
|
|
22
|
+
stopTimeS: zod_1.z.number().int().min(0).max(86400),
|
|
23
|
+
isActive: zod_1.z.boolean(),
|
|
24
|
+
})),
|
|
25
|
+
}),
|
|
26
|
+
zod_1.z.object({
|
|
27
|
+
type: zod_1.z.literal('io'),
|
|
28
|
+
ioPort: zod_1.z.string(),
|
|
29
|
+
triggerOn: zod_1.z.union([zod_1.z.literal('open'), zod_1.z.literal('closed')]),
|
|
30
|
+
}),
|
|
31
|
+
]);
|
|
14
32
|
exports.streamCommonSchema = zod_1.z.object({
|
|
15
33
|
id: zod_1.z.number(),
|
|
16
34
|
enabled: zod_1.z.boolean(),
|
|
17
35
|
active: zod_1.z.boolean(),
|
|
18
36
|
title: zod_1.z.string(),
|
|
37
|
+
trigger: exports.streamTriggerSchema,
|
|
19
38
|
});
|
|
@@ -4,6 +4,71 @@ export declare const windySchema: z.ZodObject<{
|
|
|
4
4
|
enabled: z.ZodBoolean;
|
|
5
5
|
active: z.ZodBoolean;
|
|
6
6
|
title: z.ZodString;
|
|
7
|
+
trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"manual">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "manual";
|
|
11
|
+
}, {
|
|
12
|
+
type: "manual";
|
|
13
|
+
}>, z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"onetime">;
|
|
15
|
+
startTime: z.ZodNumber;
|
|
16
|
+
stopTime: z.ZodNumber;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
type: "onetime";
|
|
19
|
+
startTime: number;
|
|
20
|
+
stopTime: number;
|
|
21
|
+
}, {
|
|
22
|
+
type: "onetime";
|
|
23
|
+
startTime: number;
|
|
24
|
+
stopTime: number;
|
|
25
|
+
}>, z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"recurrent">;
|
|
27
|
+
schedule: z.ZodArray<z.ZodObject<{
|
|
28
|
+
day: z.ZodNumber;
|
|
29
|
+
startTimeS: z.ZodNumber;
|
|
30
|
+
stopTimeS: z.ZodNumber;
|
|
31
|
+
isActive: z.ZodBoolean;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
day: number;
|
|
34
|
+
startTimeS: number;
|
|
35
|
+
stopTimeS: number;
|
|
36
|
+
isActive: boolean;
|
|
37
|
+
}, {
|
|
38
|
+
day: number;
|
|
39
|
+
startTimeS: number;
|
|
40
|
+
stopTimeS: number;
|
|
41
|
+
isActive: boolean;
|
|
42
|
+
}>, "many">;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
type: "recurrent";
|
|
45
|
+
schedule: {
|
|
46
|
+
day: number;
|
|
47
|
+
startTimeS: number;
|
|
48
|
+
stopTimeS: number;
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
}[];
|
|
51
|
+
}, {
|
|
52
|
+
type: "recurrent";
|
|
53
|
+
schedule: {
|
|
54
|
+
day: number;
|
|
55
|
+
startTimeS: number;
|
|
56
|
+
stopTimeS: number;
|
|
57
|
+
isActive: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
}>, z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"io">;
|
|
61
|
+
ioPort: z.ZodString;
|
|
62
|
+
triggerOn: z.ZodUnion<[z.ZodLiteral<"open">, z.ZodLiteral<"closed">]>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
type: "io";
|
|
65
|
+
ioPort: string;
|
|
66
|
+
triggerOn: "open" | "closed";
|
|
67
|
+
}, {
|
|
68
|
+
type: "io";
|
|
69
|
+
ioPort: string;
|
|
70
|
+
triggerOn: "open" | "closed";
|
|
71
|
+
}>]>;
|
|
7
72
|
} & {
|
|
8
73
|
type: z.ZodLiteral<"windy">;
|
|
9
74
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -12,10 +77,48 @@ export declare const windySchema: z.ZodObject<{
|
|
|
12
77
|
id: number;
|
|
13
78
|
active: boolean;
|
|
14
79
|
title: string;
|
|
80
|
+
trigger: {
|
|
81
|
+
type: "manual";
|
|
82
|
+
} | {
|
|
83
|
+
type: "onetime";
|
|
84
|
+
startTime: number;
|
|
85
|
+
stopTime: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: "recurrent";
|
|
88
|
+
schedule: {
|
|
89
|
+
day: number;
|
|
90
|
+
startTimeS: number;
|
|
91
|
+
stopTimeS: number;
|
|
92
|
+
isActive: boolean;
|
|
93
|
+
}[];
|
|
94
|
+
} | {
|
|
95
|
+
type: "io";
|
|
96
|
+
ioPort: string;
|
|
97
|
+
triggerOn: "open" | "closed";
|
|
98
|
+
};
|
|
15
99
|
}, {
|
|
16
100
|
type: "windy";
|
|
17
101
|
enabled: boolean;
|
|
18
102
|
id: number;
|
|
19
103
|
active: boolean;
|
|
20
104
|
title: string;
|
|
105
|
+
trigger: {
|
|
106
|
+
type: "manual";
|
|
107
|
+
} | {
|
|
108
|
+
type: "onetime";
|
|
109
|
+
startTime: number;
|
|
110
|
+
stopTime: number;
|
|
111
|
+
} | {
|
|
112
|
+
type: "recurrent";
|
|
113
|
+
schedule: {
|
|
114
|
+
day: number;
|
|
115
|
+
startTimeS: number;
|
|
116
|
+
stopTimeS: number;
|
|
117
|
+
isActive: boolean;
|
|
118
|
+
}[];
|
|
119
|
+
} | {
|
|
120
|
+
type: "io";
|
|
121
|
+
ioPort: string;
|
|
122
|
+
triggerOn: "open" | "closed";
|
|
123
|
+
};
|
|
21
124
|
}>;
|
|
@@ -4,6 +4,71 @@ export declare const youtubeSchema: z.ZodObject<{
|
|
|
4
4
|
enabled: z.ZodBoolean;
|
|
5
5
|
active: z.ZodBoolean;
|
|
6
6
|
title: z.ZodString;
|
|
7
|
+
trigger: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"manual">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "manual";
|
|
11
|
+
}, {
|
|
12
|
+
type: "manual";
|
|
13
|
+
}>, z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"onetime">;
|
|
15
|
+
startTime: z.ZodNumber;
|
|
16
|
+
stopTime: z.ZodNumber;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
type: "onetime";
|
|
19
|
+
startTime: number;
|
|
20
|
+
stopTime: number;
|
|
21
|
+
}, {
|
|
22
|
+
type: "onetime";
|
|
23
|
+
startTime: number;
|
|
24
|
+
stopTime: number;
|
|
25
|
+
}>, z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"recurrent">;
|
|
27
|
+
schedule: z.ZodArray<z.ZodObject<{
|
|
28
|
+
day: z.ZodNumber;
|
|
29
|
+
startTimeS: z.ZodNumber;
|
|
30
|
+
stopTimeS: z.ZodNumber;
|
|
31
|
+
isActive: z.ZodBoolean;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
day: number;
|
|
34
|
+
startTimeS: number;
|
|
35
|
+
stopTimeS: number;
|
|
36
|
+
isActive: boolean;
|
|
37
|
+
}, {
|
|
38
|
+
day: number;
|
|
39
|
+
startTimeS: number;
|
|
40
|
+
stopTimeS: number;
|
|
41
|
+
isActive: boolean;
|
|
42
|
+
}>, "many">;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
type: "recurrent";
|
|
45
|
+
schedule: {
|
|
46
|
+
day: number;
|
|
47
|
+
startTimeS: number;
|
|
48
|
+
stopTimeS: number;
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
}[];
|
|
51
|
+
}, {
|
|
52
|
+
type: "recurrent";
|
|
53
|
+
schedule: {
|
|
54
|
+
day: number;
|
|
55
|
+
startTimeS: number;
|
|
56
|
+
stopTimeS: number;
|
|
57
|
+
isActive: boolean;
|
|
58
|
+
}[];
|
|
59
|
+
}>, z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"io">;
|
|
61
|
+
ioPort: z.ZodString;
|
|
62
|
+
triggerOn: z.ZodUnion<[z.ZodLiteral<"open">, z.ZodLiteral<"closed">]>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
type: "io";
|
|
65
|
+
ioPort: string;
|
|
66
|
+
triggerOn: "open" | "closed";
|
|
67
|
+
}, {
|
|
68
|
+
type: "io";
|
|
69
|
+
ioPort: string;
|
|
70
|
+
triggerOn: "open" | "closed";
|
|
71
|
+
}>]>;
|
|
7
72
|
} & {
|
|
8
73
|
type: z.ZodLiteral<"youtube">;
|
|
9
74
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -12,10 +77,48 @@ export declare const youtubeSchema: z.ZodObject<{
|
|
|
12
77
|
id: number;
|
|
13
78
|
active: boolean;
|
|
14
79
|
title: string;
|
|
80
|
+
trigger: {
|
|
81
|
+
type: "manual";
|
|
82
|
+
} | {
|
|
83
|
+
type: "onetime";
|
|
84
|
+
startTime: number;
|
|
85
|
+
stopTime: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: "recurrent";
|
|
88
|
+
schedule: {
|
|
89
|
+
day: number;
|
|
90
|
+
startTimeS: number;
|
|
91
|
+
stopTimeS: number;
|
|
92
|
+
isActive: boolean;
|
|
93
|
+
}[];
|
|
94
|
+
} | {
|
|
95
|
+
type: "io";
|
|
96
|
+
ioPort: string;
|
|
97
|
+
triggerOn: "open" | "closed";
|
|
98
|
+
};
|
|
15
99
|
}, {
|
|
16
100
|
type: "youtube";
|
|
17
101
|
enabled: boolean;
|
|
18
102
|
id: number;
|
|
19
103
|
active: boolean;
|
|
20
104
|
title: string;
|
|
105
|
+
trigger: {
|
|
106
|
+
type: "manual";
|
|
107
|
+
} | {
|
|
108
|
+
type: "onetime";
|
|
109
|
+
startTime: number;
|
|
110
|
+
stopTime: number;
|
|
111
|
+
} | {
|
|
112
|
+
type: "recurrent";
|
|
113
|
+
schedule: {
|
|
114
|
+
day: number;
|
|
115
|
+
startTimeS: number;
|
|
116
|
+
stopTimeS: number;
|
|
117
|
+
isActive: boolean;
|
|
118
|
+
}[];
|
|
119
|
+
} | {
|
|
120
|
+
type: "io";
|
|
121
|
+
ioPort: string;
|
|
122
|
+
triggerOn: "open" | "closed";
|
|
123
|
+
};
|
|
21
124
|
}>;
|
package/esm/CamStreamerAPI.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ProxyClient } from './internal/ProxyClient';
|
|
3
|
-
import { streamSchema } from './types/CamStreamerAPI/CamStreamerAPI';
|
|
3
|
+
import { audioFileListSchema, storageListSchema, streamSchema, } from './types/CamStreamerAPI/CamStreamerAPI';
|
|
4
4
|
import { ErrorWithResponse, UtcTimeFetchError, WsAuthorizationError, MigrationError } from './errors/errors';
|
|
5
5
|
import { oldStringStreamSchema, oldStringStreamSchemaWithId, } from './types/CamStreamerAPI/oldStreamSchema';
|
|
6
6
|
const BASE_PATH = '/local/camstreamer';
|
|
@@ -84,6 +84,26 @@ export class CamStreamerAPI {
|
|
|
84
84
|
const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
|
|
85
85
|
return res.data.is_streaming === 1;
|
|
86
86
|
}
|
|
87
|
+
async listFiles(options) {
|
|
88
|
+
const res = await this._getJson(`${BASE_PATH}/upload_audio.cgi`, { action: 'list' }, options);
|
|
89
|
+
return audioFileListSchema.parse(res.data);
|
|
90
|
+
}
|
|
91
|
+
async uploadFile(formData, storage, options) {
|
|
92
|
+
await this._post(`${BASE_PATH}/upload_audio.cgi`, formData, {
|
|
93
|
+
action: 'upload',
|
|
94
|
+
storage: storage,
|
|
95
|
+
}, options);
|
|
96
|
+
}
|
|
97
|
+
async removeFile(fileParams, options) {
|
|
98
|
+
await this._getJson(`${BASE_PATH}/upload_audio.cgi`, {
|
|
99
|
+
action: 'remove',
|
|
100
|
+
...fileParams,
|
|
101
|
+
}, options);
|
|
102
|
+
}
|
|
103
|
+
async getFileStorage(options) {
|
|
104
|
+
const res = await this._getJson(`${BASE_PATH}/upload_audio.cgi`, { action: 'get_storage' }, options);
|
|
105
|
+
return storageListSchema.parse(res.data);
|
|
106
|
+
}
|
|
87
107
|
async _getJson(path, parameters, options) {
|
|
88
108
|
const agent = this.getClient(options?.proxyParams);
|
|
89
109
|
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
@@ -105,6 +125,16 @@ export class CamStreamerAPI {
|
|
|
105
125
|
headers: { ...baseHeaders, ...headers },
|
|
106
126
|
});
|
|
107
127
|
}
|
|
128
|
+
async _post(path, data, parameters, options, headers) {
|
|
129
|
+
const agent = this.getClient(options?.proxyParams);
|
|
130
|
+
const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
|
|
131
|
+
if (res.ok) {
|
|
132
|
+
return await res.json();
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
throw new ErrorWithResponse(res);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
108
138
|
}
|
|
109
139
|
export const parseCameraStreamResponse = (cameraStreamData) => {
|
|
110
140
|
return {
|
|
@@ -37,3 +37,29 @@ export const isWindyStream = (stream) => {
|
|
|
37
37
|
export const isYouTubeStream = (stream) => {
|
|
38
38
|
return stream.type === 'youtube';
|
|
39
39
|
};
|
|
40
|
+
export var AudioType;
|
|
41
|
+
(function (AudioType) {
|
|
42
|
+
AudioType[AudioType["MP3"] = 0] = "MP3";
|
|
43
|
+
AudioType[AudioType["AAC"] = 1] = "AAC";
|
|
44
|
+
})(AudioType || (AudioType = {}));
|
|
45
|
+
export const audioFileStorageTypeSchema = z.union([z.literal('flash'), z.literal('SD0'), z.literal('url')]);
|
|
46
|
+
export const storageListSchema = z.array(z.discriminatedUnion('type', [
|
|
47
|
+
z.object({
|
|
48
|
+
type: z.literal('flash'),
|
|
49
|
+
flash: z.string(),
|
|
50
|
+
}),
|
|
51
|
+
z.object({
|
|
52
|
+
type: z.literal('SD0'),
|
|
53
|
+
SD0: z.string(),
|
|
54
|
+
}),
|
|
55
|
+
]));
|
|
56
|
+
export const audioFileSchema = z.object({
|
|
57
|
+
name: z.string(),
|
|
58
|
+
path: z.string(),
|
|
59
|
+
storage: audioFileStorageTypeSchema,
|
|
60
|
+
});
|
|
61
|
+
export const audioFileListSchema = z.array(audioFileSchema);
|
|
62
|
+
export const audioFileDataSchema = z.object({
|
|
63
|
+
code: z.number(),
|
|
64
|
+
list: audioFileListSchema,
|
|
65
|
+
});
|
|
@@ -8,9 +8,28 @@ export const streamTypeSchema = z.union([
|
|
|
8
8
|
z.literal('hls'),
|
|
9
9
|
z.literal('rtmp'),
|
|
10
10
|
]);
|
|
11
|
+
export const streamTriggerSchema = z.discriminatedUnion('type', [
|
|
12
|
+
z.object({ type: z.literal('manual') }),
|
|
13
|
+
z.object({ type: z.literal('onetime'), startTime: z.number(), stopTime: z.number() }),
|
|
14
|
+
z.object({
|
|
15
|
+
type: z.literal('recurrent'),
|
|
16
|
+
schedule: z.array(z.object({
|
|
17
|
+
day: z.number().int().min(0).max(6),
|
|
18
|
+
startTimeS: z.number().int().min(0).max(86400),
|
|
19
|
+
stopTimeS: z.number().int().min(0).max(86400),
|
|
20
|
+
isActive: z.boolean(),
|
|
21
|
+
})),
|
|
22
|
+
}),
|
|
23
|
+
z.object({
|
|
24
|
+
type: z.literal('io'),
|
|
25
|
+
ioPort: z.string(),
|
|
26
|
+
triggerOn: z.union([z.literal('open'), z.literal('closed')]),
|
|
27
|
+
}),
|
|
28
|
+
]);
|
|
11
29
|
export const streamCommonSchema = z.object({
|
|
12
30
|
id: z.number(),
|
|
13
31
|
enabled: z.boolean(),
|
|
14
32
|
active: z.boolean(),
|
|
15
33
|
title: z.string(),
|
|
34
|
+
trigger: streamTriggerSchema,
|
|
16
35
|
});
|