@amityco/ts-sdk-react-native 6.24.2-d89a258.0 → 6.25.1
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/.env +26 -26
- package/dist/@types/core/events.d.ts +2 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +4 -2
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +2 -1
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/stream.d.ts +19 -3
- package/dist/@types/domains/stream.d.ts.map +1 -1
- package/dist/client/api/index.d.ts +2 -0
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/client/api/registerPushNotification.d.ts +2 -0
- package/dist/client/api/registerPushNotification.d.ts.map +1 -0
- package/dist/client/api/unregisterPushNotification.d.ts +2 -0
- package/dist/client/api/unregisterPushNotification.d.ts.map +1 -0
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +145 -25
- package/dist/index.esm.js +145 -25
- package/dist/index.umd.js +3 -4
- package/dist/reactionRepository/events/onReactionAdded.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorAdded.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorRemoved.d.ts.map +1 -1
- package/dist/streamRepository/api/createStream.d.ts +4 -4
- package/dist/streamRepository/api/createStream.d.ts.map +1 -1
- package/dist/streamRepository/api/deleteStream.d.ts +4 -4
- package/dist/streamRepository/api/deleteStream.d.ts.map +1 -1
- package/dist/streamRepository/api/disposeStream.d.ts +4 -4
- package/dist/streamRepository/api/disposeStream.d.ts.map +1 -1
- package/dist/streamRepository/api/queryStreams.d.ts +4 -4
- package/dist/streamRepository/api/queryStreams.d.ts.map +1 -1
- package/dist/streamRepository/api/updateStream.d.ts.map +1 -1
- package/dist/streamRepository/events/index.d.ts +2 -0
- package/dist/streamRepository/events/index.d.ts.map +1 -1
- package/dist/streamRepository/events/onStreamFlagged.d.ts +17 -0
- package/dist/streamRepository/events/onStreamFlagged.d.ts.map +1 -0
- package/dist/streamRepository/events/onStreamRecorded.d.ts +2 -2
- package/dist/streamRepository/events/onStreamRecorded.d.ts.map +1 -1
- package/dist/streamRepository/events/onStreamStarted.d.ts +2 -2
- package/dist/streamRepository/events/onStreamStarted.d.ts.map +1 -1
- package/dist/streamRepository/events/onStreamStopped.d.ts +2 -2
- package/dist/streamRepository/events/onStreamStopped.d.ts.map +1 -1
- package/dist/streamRepository/events/onStreamTerminated.d.ts +17 -0
- package/dist/streamRepository/events/onStreamTerminated.d.ts.map +1 -0
- package/dist/streamRepository/internalApi/queryStreams.d.ts +3 -3
- package/dist/streamRepository/internalApi/queryStreams.d.ts.map +1 -1
- package/dist/streamRepository/observers/getStreamById.d.ts +1 -0
- package/dist/streamRepository/observers/getStreamById.d.ts.map +1 -1
- package/dist/streamRepository/observers/getStreams/GetStreamsLiveCollectionController.d.ts +14 -0
- package/dist/streamRepository/observers/getStreams/GetStreamsLiveCollectionController.d.ts.map +1 -0
- package/dist/streamRepository/observers/getStreams/GetStreamsPageController.d.ts +14 -0
- package/dist/streamRepository/observers/getStreams/GetStreamsPageController.d.ts.map +1 -0
- package/dist/streamRepository/observers/getStreams/GetStreamsQueryStreamController.d.ts +15 -0
- package/dist/streamRepository/observers/getStreams/GetStreamsQueryStreamController.d.ts.map +1 -0
- package/dist/streamRepository/observers/getStreams/getStreams.d.ts +2 -0
- package/dist/streamRepository/observers/getStreams/getStreams.d.ts.map +1 -0
- package/dist/streamRepository/observers/getStreams/index.d.ts +2 -0
- package/dist/streamRepository/observers/getStreams/index.d.ts.map +1 -0
- package/dist/utils/linkedObject/index.d.ts +1 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/streamLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/streamLinkedObject.d.ts.map +1 -0
- package/package.json +3 -1
- package/rollup.config.js +6 -0
- package/src/@types/core/events.ts +5 -1
- package/src/@types/core/model.ts +4 -2
- package/src/@types/core/payload.ts +2 -1
- package/src/@types/domains/stream.ts +23 -3
- package/src/client/api/index.ts +3 -0
- package/src/client/api/registerPushNotification.ts +37 -0
- package/src/client/api/unregisterPushNotification.ts +26 -0
- package/src/core/model/idResolvers.ts +1 -0
- package/src/core/model/index.ts +1 -0
- package/src/reactionRepository/events/onReactionAdded.ts +0 -1
- package/src/reactionRepository/events/onReactorAdded.ts +7 -1
- package/src/reactionRepository/events/onReactorRemoved.ts +6 -1
- package/src/streamRepository/api/createStream.ts +8 -5
- package/src/streamRepository/api/deleteStream.ts +6 -4
- package/src/streamRepository/api/disposeStream.ts +5 -5
- package/src/streamRepository/api/queryStreams.ts +4 -4
- package/src/streamRepository/api/updateStream.ts +2 -1
- package/src/streamRepository/events/index.ts +2 -0
- package/src/streamRepository/events/onStreamFlagged.ts +37 -0
- package/src/streamRepository/events/onStreamRecorded.ts +4 -2
- package/src/streamRepository/events/onStreamStarted.ts +4 -2
- package/src/streamRepository/events/onStreamStopped.ts +4 -2
- package/src/streamRepository/events/onStreamTerminated.ts +37 -0
- package/src/streamRepository/internalApi/queryStreams.ts +3 -3
- package/src/streamRepository/observers/getStreamById.ts +18 -5
- package/src/streamRepository/observers/getStreams/GetStreamsLiveCollectionController.ts +114 -0
- package/src/streamRepository/observers/getStreams/GetStreamsPageController.ts +23 -0
- package/src/streamRepository/observers/getStreams/GetStreamsQueryStreamController.ts +83 -0
- package/src/streamRepository/observers/getStreams/getStreams.ts +32 -0
- package/src/streamRepository/observers/getStreams/index.ts +1 -0
- package/src/streamRepository/observers/tests/getStreamById.test.ts +1 -1
- package/src/utils/linkedObject/index.ts +2 -0
- package/src/utils/linkedObject/streamLinkedObject.ts +11 -0
package/dist/index.esm.js
CHANGED
|
@@ -6,6 +6,7 @@ import HttpAgent, { HttpsAgent } from 'agentkeepalive';
|
|
|
6
6
|
import io from 'socket.io-client';
|
|
7
7
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
8
8
|
import uuid$1 from 'react-native-uuid';
|
|
9
|
+
import { Platform } from 'react-native';
|
|
9
10
|
import hash from 'object-hash';
|
|
10
11
|
import Hls from 'hls.js';
|
|
11
12
|
|
|
@@ -83,8 +84,8 @@ const PostContentType = Object.freeze({
|
|
|
83
84
|
|
|
84
85
|
function getVersion() {
|
|
85
86
|
try {
|
|
86
|
-
// the string ''v6.
|
|
87
|
-
return 'v6.
|
|
87
|
+
// the string ''v6.25.1-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
88
|
+
return 'v6.25.1-esm';
|
|
88
89
|
}
|
|
89
90
|
catch (error) {
|
|
90
91
|
return '__dev__';
|
|
@@ -512,6 +513,7 @@ const idResolvers = {
|
|
|
512
513
|
reaction: ({ referenceType, referenceId }) => `${referenceType}#${referenceId}`,
|
|
513
514
|
reactor: ({ reactionId }) => reactionId,
|
|
514
515
|
stream: ({ streamId }) => streamId,
|
|
516
|
+
streamModeration: ({ streamId }) => streamId,
|
|
515
517
|
follow: ({ from, to }) => `${from}#${to}`,
|
|
516
518
|
followInfo: ({ userId }) => userId,
|
|
517
519
|
followCount: ({ userId }) => userId,
|
|
@@ -561,6 +563,7 @@ const PAYLOAD2MODEL = {
|
|
|
561
563
|
reactors: 'reactor',
|
|
562
564
|
reactions: 'reaction',
|
|
563
565
|
videoStreamings: 'stream',
|
|
566
|
+
videoStreamModerations: 'streamModeration',
|
|
564
567
|
follows: 'follow',
|
|
565
568
|
followCounts: 'followCount',
|
|
566
569
|
feeds: 'feed',
|
|
@@ -639,6 +642,18 @@ class ASCConnectionError extends ASCError {
|
|
|
639
642
|
: 800210 /* Amity.ClientError.CONNECTION_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
640
643
|
this.event = event;
|
|
641
644
|
}
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Input sanitization related error
|
|
648
|
+
* @category Errors
|
|
649
|
+
*/
|
|
650
|
+
class ASCInvalidParameterError extends ASCError {
|
|
651
|
+
/**
|
|
652
|
+
* @param message A custom error message
|
|
653
|
+
*/
|
|
654
|
+
constructor(message) {
|
|
655
|
+
super(message, 800110 /* Amity.ClientError.INVALID_PARAMETERS */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
656
|
+
}
|
|
642
657
|
}
|
|
643
658
|
|
|
644
659
|
let activeClient = null;
|
|
@@ -21340,6 +21355,13 @@ const storyLinkedObject = (story) => {
|
|
|
21340
21355
|
} });
|
|
21341
21356
|
};
|
|
21342
21357
|
|
|
21358
|
+
const streamLinkedObject = (stream) => {
|
|
21359
|
+
return Object.assign(Object.assign({}, stream), { get moderation() {
|
|
21360
|
+
var _a;
|
|
21361
|
+
return (_a = pullFromCache(['streamModeration', 'get', stream.streamId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
21362
|
+
} });
|
|
21363
|
+
};
|
|
21364
|
+
|
|
21343
21365
|
const categoryLinkedObject = (category) => {
|
|
21344
21366
|
return Object.assign(Object.assign({}, category), { get avatar() {
|
|
21345
21367
|
var _a;
|
|
@@ -21808,6 +21830,7 @@ const LinkedObject = {
|
|
|
21808
21830
|
post: postLinkedObject,
|
|
21809
21831
|
user: userLinkedObject,
|
|
21810
21832
|
category: categoryLinkedObject,
|
|
21833
|
+
stream: streamLinkedObject,
|
|
21811
21834
|
story: storyLinkedObject,
|
|
21812
21835
|
storyTarget: storyTargetLinkedObject,
|
|
21813
21836
|
message: messageLinkedObject,
|
|
@@ -25221,6 +25244,43 @@ const isConnected = () => {
|
|
|
25221
25244
|
client.ws.connected);
|
|
25222
25245
|
};
|
|
25223
25246
|
|
|
25247
|
+
const registerPushNotification = async (deviceToken) => {
|
|
25248
|
+
const client = getActiveClient();
|
|
25249
|
+
let platform;
|
|
25250
|
+
if (Platform.OS === 'ios' || Platform.OS === 'android') {
|
|
25251
|
+
platform = Platform.OS;
|
|
25252
|
+
}
|
|
25253
|
+
else {
|
|
25254
|
+
throw new ASCInvalidParameterError('Unsupported platform');
|
|
25255
|
+
}
|
|
25256
|
+
const deviceId = getDeviceId();
|
|
25257
|
+
const { data: { status, error }, } = await client.http.post('/v1/notification', {
|
|
25258
|
+
userId: client.userId,
|
|
25259
|
+
deviceId,
|
|
25260
|
+
platform,
|
|
25261
|
+
token: deviceToken,
|
|
25262
|
+
}, { headers: { 'X-API-Key': client.apiKey } });
|
|
25263
|
+
if (error) {
|
|
25264
|
+
throw new ASCApiError(error, 500000 /* Amity.ServerError.BUSINESS_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
25265
|
+
}
|
|
25266
|
+
return status === 'success';
|
|
25267
|
+
};
|
|
25268
|
+
|
|
25269
|
+
const unregisterPushNotification = async () => {
|
|
25270
|
+
const client = getActiveClient();
|
|
25271
|
+
const deviceId = getDeviceId();
|
|
25272
|
+
const { data: { status, error }, } = await client.http.delete('/v1/notification', {
|
|
25273
|
+
data: {
|
|
25274
|
+
deviceId,
|
|
25275
|
+
},
|
|
25276
|
+
headers: { 'X-API-Key': client.apiKey },
|
|
25277
|
+
});
|
|
25278
|
+
if (error) {
|
|
25279
|
+
throw new ASCApiError(error, 500000 /* Amity.ServerError.BUSINESS_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
25280
|
+
}
|
|
25281
|
+
return status === 'success';
|
|
25282
|
+
};
|
|
25283
|
+
|
|
25224
25284
|
/**
|
|
25225
25285
|
* ```js
|
|
25226
25286
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -25751,6 +25811,8 @@ var index$k = /*#__PURE__*/Object.freeze({
|
|
|
25751
25811
|
renewal: renewal,
|
|
25752
25812
|
markerSync: markerSync,
|
|
25753
25813
|
enableUnreadCount: enableUnreadCount,
|
|
25814
|
+
registerPushNotification: registerPushNotification,
|
|
25815
|
+
unregisterPushNotification: unregisterPushNotification,
|
|
25754
25816
|
onConnectionError: onConnectionError,
|
|
25755
25817
|
onClientDisconnected: onClientDisconnected,
|
|
25756
25818
|
onClientBanned: onClientBanned,
|
|
@@ -29406,9 +29468,10 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
29406
29468
|
if (!payload.reactions[0])
|
|
29407
29469
|
return;
|
|
29408
29470
|
ingestInCache(payload);
|
|
29471
|
+
ingestInCache({ reactors: payload.reactions });
|
|
29409
29472
|
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
29410
29473
|
};
|
|
29411
|
-
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.
|
|
29474
|
+
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.reactionAdded', filter);
|
|
29412
29475
|
}
|
|
29413
29476
|
if (referenceType === 'post') {
|
|
29414
29477
|
const filter = (payload) => {
|
|
@@ -29471,7 +29534,7 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
29471
29534
|
ingestInCache(payload);
|
|
29472
29535
|
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
29473
29536
|
};
|
|
29474
|
-
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.
|
|
29537
|
+
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.reactionRemoved', filter);
|
|
29475
29538
|
}
|
|
29476
29539
|
if (referenceType === 'post') {
|
|
29477
29540
|
const filter = (payload) => {
|
|
@@ -38142,10 +38205,10 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
38142
38205
|
* const created = await createStream({ title: 'my stream', 'thumbnailFileId': fileId })
|
|
38143
38206
|
* ```
|
|
38144
38207
|
*
|
|
38145
|
-
* Creates an {@link Amity.
|
|
38208
|
+
* Creates an {@link Amity.InternalStream}
|
|
38146
38209
|
*
|
|
38147
|
-
* @param bundle The data necessary to create a new {@link Amity.
|
|
38148
|
-
* @returns The newly created {@link Amity.
|
|
38210
|
+
* @param bundle The data necessary to create a new {@link Amity.InternalStream}
|
|
38211
|
+
* @returns The newly created {@link Amity.InternalStream}
|
|
38149
38212
|
*
|
|
38150
38213
|
* @category Stream API
|
|
38151
38214
|
* @async
|
|
@@ -38159,7 +38222,7 @@ const createStream = async (bundle) => {
|
|
|
38159
38222
|
ingestInCache(data, { cachedAt });
|
|
38160
38223
|
const { videoStreamings } = data;
|
|
38161
38224
|
return {
|
|
38162
|
-
data: videoStreamings[0],
|
|
38225
|
+
data: LinkedObject.stream(videoStreamings[0]),
|
|
38163
38226
|
cachedAt,
|
|
38164
38227
|
};
|
|
38165
38228
|
};
|
|
@@ -38192,7 +38255,7 @@ const updateStream = async (streamId, patch) => {
|
|
|
38192
38255
|
ingestInCache(data, { cachedAt });
|
|
38193
38256
|
const { videoStreamings } = data;
|
|
38194
38257
|
return {
|
|
38195
|
-
data: videoStreamings.find(stream => stream.streamId === streamId),
|
|
38258
|
+
data: LinkedObject.stream(videoStreamings.find(stream => stream.streamId === streamId)),
|
|
38196
38259
|
cachedAt,
|
|
38197
38260
|
};
|
|
38198
38261
|
};
|
|
@@ -38266,10 +38329,10 @@ getStream.locally = (streamId) => {
|
|
|
38266
38329
|
* const success = await deleteStream(streamId)
|
|
38267
38330
|
* ```
|
|
38268
38331
|
*
|
|
38269
|
-
* Deletes a {@link Amity.
|
|
38332
|
+
* Deletes a {@link Amity.InternalStream}
|
|
38270
38333
|
*
|
|
38271
|
-
* @param streamId The {@link Amity.
|
|
38272
|
-
* @return A success boolean if the {@link Amity.
|
|
38334
|
+
* @param streamId The {@link Amity.InternalStream} ID to delete
|
|
38335
|
+
* @return A success boolean if the {@link Amity.InternalStream} was deleted
|
|
38273
38336
|
*
|
|
38274
38337
|
* @category Stream API
|
|
38275
38338
|
* @async
|
|
@@ -38294,11 +38357,11 @@ const deleteStream = async (streamId) => {
|
|
|
38294
38357
|
* const stream = await disposeStream(streamId)
|
|
38295
38358
|
* ```
|
|
38296
38359
|
*
|
|
38297
|
-
* Dispose a {@link Amity.
|
|
38360
|
+
* Dispose a {@link Amity.InternalStream}.
|
|
38298
38361
|
* Streaming status will be updated to "ended" and streaming url will be invalidated
|
|
38299
38362
|
*
|
|
38300
|
-
* @param streamId The {@link Amity.
|
|
38301
|
-
* @returns the associated {@link Amity.
|
|
38363
|
+
* @param streamId The {@link Amity.InternalStream} ID to dispose
|
|
38364
|
+
* @returns the associated {@link Amity.InternalStream} object
|
|
38302
38365
|
*
|
|
38303
38366
|
* @category Stream API
|
|
38304
38367
|
* @async
|
|
@@ -38329,10 +38392,10 @@ const disposeStream = async (streamId) => {
|
|
|
38329
38392
|
* const streams = await getStreams()
|
|
38330
38393
|
* ```
|
|
38331
38394
|
*
|
|
38332
|
-
* Queries a paginable list of {@link Amity.
|
|
38395
|
+
* Queries a paginable list of {@link Amity.InternalStream} objects
|
|
38333
38396
|
*
|
|
38334
38397
|
* @param query The query parameters
|
|
38335
|
-
* @returns A page of {@link Amity.
|
|
38398
|
+
* @returns A page of {@link Amity.InternalStream} objects
|
|
38336
38399
|
*
|
|
38337
38400
|
* @category Stream API
|
|
38338
38401
|
* @async
|
|
@@ -38367,7 +38430,7 @@ const queryStreams$1 = async (query) => {
|
|
|
38367
38430
|
* })
|
|
38368
38431
|
* ```
|
|
38369
38432
|
*
|
|
38370
|
-
* Fired when a {@link Amity.
|
|
38433
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
38371
38434
|
*
|
|
38372
38435
|
* @param callback The function to call when the event was fired
|
|
38373
38436
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -38391,7 +38454,7 @@ const onStreamStarted = (callback) => {
|
|
|
38391
38454
|
* })
|
|
38392
38455
|
* ```
|
|
38393
38456
|
*
|
|
38394
|
-
* Fired when a {@link Amity.
|
|
38457
|
+
* Fired when a {@link Amity.InternalStream} has stopped airing
|
|
38395
38458
|
*
|
|
38396
38459
|
* @param callback The function to call when the event was fired
|
|
38397
38460
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -38415,7 +38478,7 @@ const onStreamStopped = (callback) => {
|
|
|
38415
38478
|
* })
|
|
38416
38479
|
* ```
|
|
38417
38480
|
*
|
|
38418
|
-
* Fired when the recordings of a {@link Amity.
|
|
38481
|
+
* Fired when the recordings of a {@link Amity.InternalStream} are available
|
|
38419
38482
|
*
|
|
38420
38483
|
* @param callback The function to call when the event was fired
|
|
38421
38484
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -38431,6 +38494,54 @@ const onStreamRecorded = (callback) => {
|
|
|
38431
38494
|
return createEventSubscriber(client, 'stream/onStreamRecorded', 'v3.video-streaming.didRecord', filter);
|
|
38432
38495
|
};
|
|
38433
38496
|
|
|
38497
|
+
/**
|
|
38498
|
+
* ```js
|
|
38499
|
+
* import { onStreamFlagged } from '@amityco/ts-sdk-react-native'
|
|
38500
|
+
* const dispose = onStreamFlagged(stream => {
|
|
38501
|
+
* // ...
|
|
38502
|
+
* })
|
|
38503
|
+
* ```
|
|
38504
|
+
*
|
|
38505
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
38506
|
+
*
|
|
38507
|
+
* @param callback The function to call when the event was fired
|
|
38508
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
38509
|
+
*
|
|
38510
|
+
* @category Stream Events
|
|
38511
|
+
*/
|
|
38512
|
+
const onStreamFlagged = (callback) => {
|
|
38513
|
+
const client = getActiveClient();
|
|
38514
|
+
const filter = (payload) => {
|
|
38515
|
+
ingestInCache(payload);
|
|
38516
|
+
callback(payload.videoStreamings[0]);
|
|
38517
|
+
};
|
|
38518
|
+
return createEventSubscriber(client, 'stream/onStreamFlagged', 'v3.video-streaming.didFlag', filter);
|
|
38519
|
+
};
|
|
38520
|
+
|
|
38521
|
+
/**
|
|
38522
|
+
* ```js
|
|
38523
|
+
* import { onStreamTerminated } from '@amityco/ts-sdk-react-native'
|
|
38524
|
+
* const dispose = onStreamTerminated(stream => {
|
|
38525
|
+
* // ...
|
|
38526
|
+
* })
|
|
38527
|
+
* ```
|
|
38528
|
+
*
|
|
38529
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
38530
|
+
*
|
|
38531
|
+
* @param callback The function to call when the event was fired
|
|
38532
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
38533
|
+
*
|
|
38534
|
+
* @category Stream Events
|
|
38535
|
+
*/
|
|
38536
|
+
const onStreamTerminated = (callback) => {
|
|
38537
|
+
const client = getActiveClient();
|
|
38538
|
+
const filter = (payload) => {
|
|
38539
|
+
ingestInCache(payload);
|
|
38540
|
+
callback(payload.videoStreamings[0]);
|
|
38541
|
+
};
|
|
38542
|
+
return createEventSubscriber(client, 'stream/onStreamTerminated', 'v3.video-streaming.didTerminate', filter);
|
|
38543
|
+
};
|
|
38544
|
+
|
|
38434
38545
|
/* eslint-disable no-use-before-define */
|
|
38435
38546
|
/* begin_public_function
|
|
38436
38547
|
id: stream.get
|
|
@@ -38445,15 +38556,22 @@ const onStreamRecorded = (callback) => {
|
|
|
38445
38556
|
* Fetches a {@link Amity.Stream} object
|
|
38446
38557
|
*
|
|
38447
38558
|
* @param streamId the ID of the {@link Amity.Stream} to get
|
|
38559
|
+
* @param callback
|
|
38448
38560
|
* @returns the associated {@link Amity.Stream} object
|
|
38449
38561
|
*
|
|
38450
38562
|
* @category Stream Live Object
|
|
38451
38563
|
*/
|
|
38452
38564
|
const getStreamById = (streamId, callback) => {
|
|
38453
|
-
|
|
38565
|
+
const reactor = (snapshot) => {
|
|
38566
|
+
const { data } = snapshot;
|
|
38567
|
+
callback(Object.assign(Object.assign({}, snapshot), { data: data ? LinkedObject.stream(snapshot.data) : data }));
|
|
38568
|
+
};
|
|
38569
|
+
return liveObject(streamId, reactor, 'streamId', getStream, [
|
|
38454
38570
|
onStreamRecorded,
|
|
38455
38571
|
onStreamStarted,
|
|
38456
38572
|
onStreamStopped,
|
|
38573
|
+
onStreamFlagged,
|
|
38574
|
+
onStreamTerminated,
|
|
38457
38575
|
]);
|
|
38458
38576
|
};
|
|
38459
38577
|
/* end_public_function */
|
|
@@ -38479,7 +38597,7 @@ getStreamById.locally = (streamId) => {
|
|
|
38479
38597
|
if (!cached)
|
|
38480
38598
|
return;
|
|
38481
38599
|
return {
|
|
38482
|
-
data: cached.data,
|
|
38600
|
+
data: LinkedObject.stream(cached.data),
|
|
38483
38601
|
cachedAt: cached.cachedAt,
|
|
38484
38602
|
};
|
|
38485
38603
|
};
|
|
@@ -38493,10 +38611,10 @@ getStreamById.locally = (streamId) => {
|
|
|
38493
38611
|
* const streams = await getStreams()
|
|
38494
38612
|
* ```
|
|
38495
38613
|
*
|
|
38496
|
-
* Queries a paginable list of {@link Amity.
|
|
38614
|
+
* Queries a paginable list of {@link Amity.InternalStream} objects
|
|
38497
38615
|
*
|
|
38498
38616
|
* @param query The query parameters
|
|
38499
|
-
* @returns A page of {@link Amity.
|
|
38617
|
+
* @returns A page of {@link Amity.InternalStream} objects
|
|
38500
38618
|
*
|
|
38501
38619
|
* @category Stream API
|
|
38502
38620
|
* @async
|
|
@@ -38630,6 +38748,8 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
38630
38748
|
onStreamStarted: onStreamStarted,
|
|
38631
38749
|
onStreamStopped: onStreamStopped,
|
|
38632
38750
|
onStreamRecorded: onStreamRecorded,
|
|
38751
|
+
onStreamFlagged: onStreamFlagged,
|
|
38752
|
+
onStreamTerminated: onStreamTerminated,
|
|
38633
38753
|
getStreamById: getStreamById,
|
|
38634
38754
|
getStreams: getStreams
|
|
38635
38755
|
});
|
|
@@ -38962,7 +39082,7 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
38962
39082
|
getPoll: getPoll
|
|
38963
39083
|
});
|
|
38964
39084
|
|
|
38965
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
39085
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2HtUJL4RETogbAOLVY0XM\njs6sPn8G1nALmh9qeDpUtVqFOVtBHxEZ910TLOtQiunjqJKO5nWdqZ71EC3OFluR\niGQkO84BiIFbv37ub7xl3S8XarbtKoLcyVpkDHi+1wx1pgCAn6gtBUgckPL5NR8j\nLseabl3HAXQfhTCKo4tmOFM2Dxwl1IUMmIJrJg/aIU/U0tj/1Eoo7mG0JcNWX19l\nW3EecCbi0ncCJOrkUdwlBrcjaMayaX/ubEwyUeTGiLdyc4L3GRLHjyK8xgVNXRMH\nbZWJ2a5NAgMBAAECggEASxuE+35zTFO/XydKgmvIGcWL9FbgMlXb7Vcf0nBoG945\nbiz0NVc2paraIhJXc608xbYF3qLmtAE1MVBI0ORyRdBHNxY024l/6H6SH60Ed+uI\nM4ysp5ourY6Vj+DLwpdRiI9YDjqYAQDIUmhNxJP7XPhOMoZI6st+xZQBM34ic/bv\nAMSJm9OZphSp3+qXVkFZztr2mxD2EZSJJLYxi8BCdgM2qhazalbcJ6zDKHCZWVWm\n8RRxDGldyMb/237JxETzP40tAlzOZDmBAbUgEnurDJ93RVDIE3rbZUshwgeQd18a\nem096mWgvB1AIKYgsTAR3pw+V19YWAjq/glP6fz8wQKBgQD/oQq+ukKF0PRgBeM5\ngeTjSwsdGppQLmf5ndujvoiz/TpdjDEPu6R8kigQr1rG2t4K/yfdZoI8RdmJD1al\n3Q7N9hofooSy4rj6E3txzWZCHJjHad2cnCp/O26HiReGAl7wTcfTmNdiFHhZQzm5\nJBkvWAiwuvQMNfEbnXxw6/vIDwKBgQDH7fX8gsc77JLvAWgp1MaQN/sbqVb6JeT1\nFQfR8E/WFCSmzQBtNzd5KgYuCeelwr/8DyYytvN2BzCYZXp73gI1jF3YlW5jVn74\nOY6TwQ095digwo6Z0yuxopdIOApKgAkL9PRKgNrqAf3NAyMua6lOGifzjDojC3KU\nfylQmxMn4wKBgHp2B9O/H0dEBw5JQ8W0+JX6yWQz7mEjGiR2/1W+XXb8hQ1zr709\nw1r6Gb+EghRpnZ3fBpYGGbYOMFx8wKHM+N6qW3F0ReX8v2juFGE8aRSa5oYBrWzt\nU16Idjbv8hj84cZ1PJmdyvDtpYn9rpWHOZl4rxEbPvbqkIsOMyNVqdT5AoGAOSge\nmwIIU2le2FVeohbibXiToWTYKMuMmURZ5/r72AgKMmWJKbAPe+Q3wBG01/7FRBpQ\noU8Ma0HC8s6QJbliiEyIx9JwrJWd1vkdecBHONrtA4ibm/5zD2WcOllLF+FitLhi\n3qnX6+6F0IaFGFBPJrTzlv0P4dTz/OAdv52V7GECgYEA2TttOKBAqWllgOaZOkql\nLVMJVmgR7s6tLi1+cEP8ZcapV9aRbRzTAKXm4f8AEhtlG9F9kCOvHYCYGi6JaiWJ\nZkHjeex3T+eE6Di6y5Bm/Ift5jtVhJ4jCVwHOKTMej79NPUFTJfv8hCo29haBDv6\nRXFrv+T21KCcw8k3sJeJWWQ=\n-----END PRIVATE KEY-----";
|
|
38966
39086
|
/*
|
|
38967
39087
|
* The crypto algorithm used for importing key and signing string
|
|
38968
39088
|
*/
|