camstreamerlib 4.0.0-beta.137 → 4.0.0-beta.138
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 +8 -4
- package/cjs/CamStreamerAPI.js +6 -5
- package/cjs/errors/errors.d.ts +6 -1
- package/cjs/errors/errors.js +3 -1
- package/esm/CamStreamerAPI.js +6 -5
- package/esm/errors/errors.js +3 -1
- package/package.json +1 -1
- package/types/CamStreamerAPI.d.ts +8 -4
- package/types/errors/errors.d.ts +6 -1
package/cjs/CamStreamerAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IClient, TResponse } from './internal/types';
|
|
2
|
-
import { TAudioFile, TAudioFileStorageType, TDiagnosticsParams, TStream
|
|
2
|
+
import { TAudioFile, TAudioFileStorageType, TDiagnosticsParams, TStream } from './types/CamStreamerAPI/CamStreamerAPI';
|
|
3
3
|
import { THttpRequestOptions } from './types/common';
|
|
4
4
|
import { TOldStream, TOldStringStream } from './types/CamStreamerAPI/oldStreamSchema';
|
|
5
5
|
import { BasicAPI } from './internal/BasicAPI';
|
|
@@ -12,7 +12,9 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
|
|
|
12
12
|
getMaxFps(source?: number, options?: THttpRequestOptions): Promise<any>;
|
|
13
13
|
isCSPassValid(pass: string, options?: THttpRequestOptions): Promise<boolean>;
|
|
14
14
|
getCamStreamerAppLog(options?: THttpRequestOptions): Promise<string>;
|
|
15
|
-
getStreamList
|
|
15
|
+
getStreamList<TUnknownStream extends {
|
|
16
|
+
platform: string;
|
|
17
|
+
}>(options?: THttpRequestOptions): Promise<({
|
|
16
18
|
post: {
|
|
17
19
|
postLocation: "timeline";
|
|
18
20
|
streamPrivacy: "public" | "friends" | "only_me";
|
|
@@ -1554,8 +1556,10 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
|
|
|
1554
1556
|
avSyncMsec: number;
|
|
1555
1557
|
};
|
|
1556
1558
|
platform: "youtube_rtmp";
|
|
1557
|
-
})[]>;
|
|
1558
|
-
setStreamList
|
|
1559
|
+
} | TUnknownStream)[]>;
|
|
1560
|
+
setStreamList<TUnknownStream extends {
|
|
1561
|
+
platform: string;
|
|
1562
|
+
}>(streamList: (TStream | TUnknownStream)[], options?: THttpRequestOptions): Promise<void>;
|
|
1559
1563
|
getStream(streamId: string, options?: THttpRequestOptions): Promise<{
|
|
1560
1564
|
post: {
|
|
1561
1565
|
postLocation: "timeline";
|
package/cjs/CamStreamerAPI.js
CHANGED
|
@@ -46,14 +46,15 @@ class CamStreamerAPI extends BasicAPI_1.BasicAPI {
|
|
|
46
46
|
streamId,
|
|
47
47
|
...(0, exports.parseCameraStreamResponse)(streamData),
|
|
48
48
|
}));
|
|
49
|
-
throw new errors_1.MigrationError([], data);
|
|
49
|
+
throw new errors_1.MigrationError([], data, [], []);
|
|
50
50
|
}
|
|
51
51
|
const newStreamData = [];
|
|
52
|
+
const unknownStreamData = [];
|
|
52
53
|
const oldStreamData = [];
|
|
53
54
|
const invalidStreamData = [];
|
|
54
55
|
for (const streamData of res.data.streamList) {
|
|
55
56
|
if (streamData.platform !== undefined && !Object.values(CamStreamerAPI_2.streamPlatforms).includes(streamData.platform)) {
|
|
56
|
-
|
|
57
|
+
unknownStreamData.push(streamData);
|
|
57
58
|
continue;
|
|
58
59
|
}
|
|
59
60
|
const newStreamParse = CamStreamerAPI_1.streamSchema.safeParse(streamData);
|
|
@@ -72,9 +73,9 @@ class CamStreamerAPI extends BasicAPI_1.BasicAPI {
|
|
|
72
73
|
invalidStreamData.push(streamData);
|
|
73
74
|
}
|
|
74
75
|
if (oldStreamData.length > 0 || invalidStreamData.length > 0) {
|
|
75
|
-
throw new errors_1.MigrationError(newStreamData, oldStreamData, invalidStreamData);
|
|
76
|
+
throw new errors_1.MigrationError(newStreamData, oldStreamData, invalidStreamData, unknownStreamData);
|
|
76
77
|
}
|
|
77
|
-
return newStreamData;
|
|
78
|
+
return [...newStreamData, ...unknownStreamData];
|
|
78
79
|
}
|
|
79
80
|
async setStreamList(streamList, options) {
|
|
80
81
|
await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`, { streamList }, {
|
|
@@ -88,7 +89,7 @@ class CamStreamerAPI extends BasicAPI_1.BasicAPI {
|
|
|
88
89
|
return newStream.data;
|
|
89
90
|
}
|
|
90
91
|
const oldStream = oldStreamSchema_1.oldStringStreamSchema.passthrough().parse(res.data);
|
|
91
|
-
throw new errors_1.MigrationError([], [{ streamId, ...(0, exports.parseCameraStreamResponse)(oldStream) }]);
|
|
92
|
+
throw new errors_1.MigrationError([], [{ streamId, ...(0, exports.parseCameraStreamResponse)(oldStream) }], [], []);
|
|
92
93
|
}
|
|
93
94
|
async setStream(streamId, streamData, options) {
|
|
94
95
|
await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`, streamData, {
|
package/cjs/errors/errors.d.ts
CHANGED
|
@@ -96,8 +96,13 @@ export declare class MigrationError extends Error {
|
|
|
96
96
|
streamId: string;
|
|
97
97
|
})[];
|
|
98
98
|
readonly invalid: any[];
|
|
99
|
+
readonly unknown: {
|
|
100
|
+
platform: string;
|
|
101
|
+
}[];
|
|
99
102
|
constructor(valid: TStream[], old: (TOldStream & {
|
|
100
103
|
streamId: string;
|
|
101
|
-
})[], invalid?: any[]
|
|
104
|
+
})[], invalid?: any[], unknown?: {
|
|
105
|
+
platform: string;
|
|
106
|
+
}[]);
|
|
102
107
|
}
|
|
103
108
|
export {};
|
package/cjs/errors/errors.js
CHANGED
|
@@ -208,12 +208,14 @@ class MigrationError extends Error {
|
|
|
208
208
|
valid;
|
|
209
209
|
old;
|
|
210
210
|
invalid;
|
|
211
|
-
|
|
211
|
+
unknown;
|
|
212
|
+
constructor(valid, old, invalid = [], unknown = []) {
|
|
212
213
|
super('Migration to newer version is needed: some stream entries failed to parse.');
|
|
213
214
|
this.name = 'MigrationError';
|
|
214
215
|
this.valid = valid;
|
|
215
216
|
this.old = old;
|
|
216
217
|
this.invalid = invalid;
|
|
218
|
+
this.unknown = unknown;
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
exports.MigrationError = MigrationError;
|
package/esm/CamStreamerAPI.js
CHANGED
|
@@ -43,14 +43,15 @@ export class CamStreamerAPI extends BasicAPI {
|
|
|
43
43
|
streamId,
|
|
44
44
|
...parseCameraStreamResponse(streamData),
|
|
45
45
|
}));
|
|
46
|
-
throw new MigrationError([], data);
|
|
46
|
+
throw new MigrationError([], data, [], []);
|
|
47
47
|
}
|
|
48
48
|
const newStreamData = [];
|
|
49
|
+
const unknownStreamData = [];
|
|
49
50
|
const oldStreamData = [];
|
|
50
51
|
const invalidStreamData = [];
|
|
51
52
|
for (const streamData of res.data.streamList) {
|
|
52
53
|
if (streamData.platform !== undefined && !Object.values(streamPlatforms).includes(streamData.platform)) {
|
|
53
|
-
|
|
54
|
+
unknownStreamData.push(streamData);
|
|
54
55
|
continue;
|
|
55
56
|
}
|
|
56
57
|
const newStreamParse = streamSchema.safeParse(streamData);
|
|
@@ -69,9 +70,9 @@ export class CamStreamerAPI extends BasicAPI {
|
|
|
69
70
|
invalidStreamData.push(streamData);
|
|
70
71
|
}
|
|
71
72
|
if (oldStreamData.length > 0 || invalidStreamData.length > 0) {
|
|
72
|
-
throw new MigrationError(newStreamData, oldStreamData, invalidStreamData);
|
|
73
|
+
throw new MigrationError(newStreamData, oldStreamData, invalidStreamData, unknownStreamData);
|
|
73
74
|
}
|
|
74
|
-
return newStreamData;
|
|
75
|
+
return [...newStreamData, ...unknownStreamData];
|
|
75
76
|
}
|
|
76
77
|
async setStreamList(streamList, options) {
|
|
77
78
|
await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`, { streamList }, {
|
|
@@ -85,7 +86,7 @@ export class CamStreamerAPI extends BasicAPI {
|
|
|
85
86
|
return newStream.data;
|
|
86
87
|
}
|
|
87
88
|
const oldStream = oldStringStreamSchema.passthrough().parse(res.data);
|
|
88
|
-
throw new MigrationError([], [{ streamId, ...parseCameraStreamResponse(oldStream) }]);
|
|
89
|
+
throw new MigrationError([], [{ streamId, ...parseCameraStreamResponse(oldStream) }], [], []);
|
|
89
90
|
}
|
|
90
91
|
async setStream(streamId, streamData, options) {
|
|
91
92
|
await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`, streamData, {
|
package/esm/errors/errors.js
CHANGED
|
@@ -178,11 +178,13 @@ export class MigrationError extends Error {
|
|
|
178
178
|
valid;
|
|
179
179
|
old;
|
|
180
180
|
invalid;
|
|
181
|
-
|
|
181
|
+
unknown;
|
|
182
|
+
constructor(valid, old, invalid = [], unknown = []) {
|
|
182
183
|
super('Migration to newer version is needed: some stream entries failed to parse.');
|
|
183
184
|
this.name = 'MigrationError';
|
|
184
185
|
this.valid = valid;
|
|
185
186
|
this.old = old;
|
|
186
187
|
this.invalid = invalid;
|
|
188
|
+
this.unknown = unknown;
|
|
187
189
|
}
|
|
188
190
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IClient, TResponse } from './internal/types';
|
|
2
|
-
import { TAudioFile, TAudioFileStorageType, TDiagnosticsParams, TStream
|
|
2
|
+
import { TAudioFile, TAudioFileStorageType, TDiagnosticsParams, TStream } from './types/CamStreamerAPI/CamStreamerAPI';
|
|
3
3
|
import { THttpRequestOptions } from './types/common';
|
|
4
4
|
import { TOldStream, TOldStringStream } from './types/CamStreamerAPI/oldStreamSchema';
|
|
5
5
|
import { BasicAPI } from './internal/BasicAPI';
|
|
@@ -12,7 +12,9 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
|
|
|
12
12
|
getMaxFps(source?: number, options?: THttpRequestOptions): Promise<any>;
|
|
13
13
|
isCSPassValid(pass: string, options?: THttpRequestOptions): Promise<boolean>;
|
|
14
14
|
getCamStreamerAppLog(options?: THttpRequestOptions): Promise<string>;
|
|
15
|
-
getStreamList
|
|
15
|
+
getStreamList<TUnknownStream extends {
|
|
16
|
+
platform: string;
|
|
17
|
+
}>(options?: THttpRequestOptions): Promise<({
|
|
16
18
|
post: {
|
|
17
19
|
postLocation: "timeline";
|
|
18
20
|
streamPrivacy: "public" | "friends" | "only_me";
|
|
@@ -1554,8 +1556,10 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
|
|
|
1554
1556
|
avSyncMsec: number;
|
|
1555
1557
|
};
|
|
1556
1558
|
platform: "youtube_rtmp";
|
|
1557
|
-
})[]>;
|
|
1558
|
-
setStreamList
|
|
1559
|
+
} | TUnknownStream)[]>;
|
|
1560
|
+
setStreamList<TUnknownStream extends {
|
|
1561
|
+
platform: string;
|
|
1562
|
+
}>(streamList: (TStream | TUnknownStream)[], options?: THttpRequestOptions): Promise<void>;
|
|
1559
1563
|
getStream(streamId: string, options?: THttpRequestOptions): Promise<{
|
|
1560
1564
|
post: {
|
|
1561
1565
|
postLocation: "timeline";
|
package/types/errors/errors.d.ts
CHANGED
|
@@ -96,8 +96,13 @@ export declare class MigrationError extends Error {
|
|
|
96
96
|
streamId: string;
|
|
97
97
|
})[];
|
|
98
98
|
readonly invalid: any[];
|
|
99
|
+
readonly unknown: {
|
|
100
|
+
platform: string;
|
|
101
|
+
}[];
|
|
99
102
|
constructor(valid: TStream[], old: (TOldStream & {
|
|
100
103
|
streamId: string;
|
|
101
|
-
})[], invalid?: any[]
|
|
104
|
+
})[], invalid?: any[], unknown?: {
|
|
105
|
+
platform: string;
|
|
106
|
+
}[]);
|
|
102
107
|
}
|
|
103
108
|
export {};
|