@amityco/ts-sdk-react-native 6.24.2-d89a258.0 → 6.25.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/.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 +144 -25
- package/dist/index.esm.js +144 -25
- package/dist/index.umd.js +3 -4
- 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/onReactorAdded.ts +6 -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.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
88
|
+
return 'v6.25.0-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,
|
|
@@ -29408,7 +29470,7 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
29408
29470
|
ingestInCache(payload);
|
|
29409
29471
|
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
29410
29472
|
};
|
|
29411
|
-
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.
|
|
29473
|
+
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.reactionAdded', filter);
|
|
29412
29474
|
}
|
|
29413
29475
|
if (referenceType === 'post') {
|
|
29414
29476
|
const filter = (payload) => {
|
|
@@ -29471,7 +29533,7 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
29471
29533
|
ingestInCache(payload);
|
|
29472
29534
|
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
29473
29535
|
};
|
|
29474
|
-
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.
|
|
29536
|
+
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.reactionRemoved', filter);
|
|
29475
29537
|
}
|
|
29476
29538
|
if (referenceType === 'post') {
|
|
29477
29539
|
const filter = (payload) => {
|
|
@@ -38142,10 +38204,10 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
38142
38204
|
* const created = await createStream({ title: 'my stream', 'thumbnailFileId': fileId })
|
|
38143
38205
|
* ```
|
|
38144
38206
|
*
|
|
38145
|
-
* Creates an {@link Amity.
|
|
38207
|
+
* Creates an {@link Amity.InternalStream}
|
|
38146
38208
|
*
|
|
38147
|
-
* @param bundle The data necessary to create a new {@link Amity.
|
|
38148
|
-
* @returns The newly created {@link Amity.
|
|
38209
|
+
* @param bundle The data necessary to create a new {@link Amity.InternalStream}
|
|
38210
|
+
* @returns The newly created {@link Amity.InternalStream}
|
|
38149
38211
|
*
|
|
38150
38212
|
* @category Stream API
|
|
38151
38213
|
* @async
|
|
@@ -38159,7 +38221,7 @@ const createStream = async (bundle) => {
|
|
|
38159
38221
|
ingestInCache(data, { cachedAt });
|
|
38160
38222
|
const { videoStreamings } = data;
|
|
38161
38223
|
return {
|
|
38162
|
-
data: videoStreamings[0],
|
|
38224
|
+
data: LinkedObject.stream(videoStreamings[0]),
|
|
38163
38225
|
cachedAt,
|
|
38164
38226
|
};
|
|
38165
38227
|
};
|
|
@@ -38192,7 +38254,7 @@ const updateStream = async (streamId, patch) => {
|
|
|
38192
38254
|
ingestInCache(data, { cachedAt });
|
|
38193
38255
|
const { videoStreamings } = data;
|
|
38194
38256
|
return {
|
|
38195
|
-
data: videoStreamings.find(stream => stream.streamId === streamId),
|
|
38257
|
+
data: LinkedObject.stream(videoStreamings.find(stream => stream.streamId === streamId)),
|
|
38196
38258
|
cachedAt,
|
|
38197
38259
|
};
|
|
38198
38260
|
};
|
|
@@ -38266,10 +38328,10 @@ getStream.locally = (streamId) => {
|
|
|
38266
38328
|
* const success = await deleteStream(streamId)
|
|
38267
38329
|
* ```
|
|
38268
38330
|
*
|
|
38269
|
-
* Deletes a {@link Amity.
|
|
38331
|
+
* Deletes a {@link Amity.InternalStream}
|
|
38270
38332
|
*
|
|
38271
|
-
* @param streamId The {@link Amity.
|
|
38272
|
-
* @return A success boolean if the {@link Amity.
|
|
38333
|
+
* @param streamId The {@link Amity.InternalStream} ID to delete
|
|
38334
|
+
* @return A success boolean if the {@link Amity.InternalStream} was deleted
|
|
38273
38335
|
*
|
|
38274
38336
|
* @category Stream API
|
|
38275
38337
|
* @async
|
|
@@ -38294,11 +38356,11 @@ const deleteStream = async (streamId) => {
|
|
|
38294
38356
|
* const stream = await disposeStream(streamId)
|
|
38295
38357
|
* ```
|
|
38296
38358
|
*
|
|
38297
|
-
* Dispose a {@link Amity.
|
|
38359
|
+
* Dispose a {@link Amity.InternalStream}.
|
|
38298
38360
|
* Streaming status will be updated to "ended" and streaming url will be invalidated
|
|
38299
38361
|
*
|
|
38300
|
-
* @param streamId The {@link Amity.
|
|
38301
|
-
* @returns the associated {@link Amity.
|
|
38362
|
+
* @param streamId The {@link Amity.InternalStream} ID to dispose
|
|
38363
|
+
* @returns the associated {@link Amity.InternalStream} object
|
|
38302
38364
|
*
|
|
38303
38365
|
* @category Stream API
|
|
38304
38366
|
* @async
|
|
@@ -38329,10 +38391,10 @@ const disposeStream = async (streamId) => {
|
|
|
38329
38391
|
* const streams = await getStreams()
|
|
38330
38392
|
* ```
|
|
38331
38393
|
*
|
|
38332
|
-
* Queries a paginable list of {@link Amity.
|
|
38394
|
+
* Queries a paginable list of {@link Amity.InternalStream} objects
|
|
38333
38395
|
*
|
|
38334
38396
|
* @param query The query parameters
|
|
38335
|
-
* @returns A page of {@link Amity.
|
|
38397
|
+
* @returns A page of {@link Amity.InternalStream} objects
|
|
38336
38398
|
*
|
|
38337
38399
|
* @category Stream API
|
|
38338
38400
|
* @async
|
|
@@ -38367,7 +38429,7 @@ const queryStreams$1 = async (query) => {
|
|
|
38367
38429
|
* })
|
|
38368
38430
|
* ```
|
|
38369
38431
|
*
|
|
38370
|
-
* Fired when a {@link Amity.
|
|
38432
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
38371
38433
|
*
|
|
38372
38434
|
* @param callback The function to call when the event was fired
|
|
38373
38435
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -38391,7 +38453,7 @@ const onStreamStarted = (callback) => {
|
|
|
38391
38453
|
* })
|
|
38392
38454
|
* ```
|
|
38393
38455
|
*
|
|
38394
|
-
* Fired when a {@link Amity.
|
|
38456
|
+
* Fired when a {@link Amity.InternalStream} has stopped airing
|
|
38395
38457
|
*
|
|
38396
38458
|
* @param callback The function to call when the event was fired
|
|
38397
38459
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -38415,7 +38477,7 @@ const onStreamStopped = (callback) => {
|
|
|
38415
38477
|
* })
|
|
38416
38478
|
* ```
|
|
38417
38479
|
*
|
|
38418
|
-
* Fired when the recordings of a {@link Amity.
|
|
38480
|
+
* Fired when the recordings of a {@link Amity.InternalStream} are available
|
|
38419
38481
|
*
|
|
38420
38482
|
* @param callback The function to call when the event was fired
|
|
38421
38483
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -38431,6 +38493,54 @@ const onStreamRecorded = (callback) => {
|
|
|
38431
38493
|
return createEventSubscriber(client, 'stream/onStreamRecorded', 'v3.video-streaming.didRecord', filter);
|
|
38432
38494
|
};
|
|
38433
38495
|
|
|
38496
|
+
/**
|
|
38497
|
+
* ```js
|
|
38498
|
+
* import { onStreamFlagged } from '@amityco/ts-sdk-react-native'
|
|
38499
|
+
* const dispose = onStreamFlagged(stream => {
|
|
38500
|
+
* // ...
|
|
38501
|
+
* })
|
|
38502
|
+
* ```
|
|
38503
|
+
*
|
|
38504
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
38505
|
+
*
|
|
38506
|
+
* @param callback The function to call when the event was fired
|
|
38507
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
38508
|
+
*
|
|
38509
|
+
* @category Stream Events
|
|
38510
|
+
*/
|
|
38511
|
+
const onStreamFlagged = (callback) => {
|
|
38512
|
+
const client = getActiveClient();
|
|
38513
|
+
const filter = (payload) => {
|
|
38514
|
+
ingestInCache(payload);
|
|
38515
|
+
callback(payload.videoStreamings[0]);
|
|
38516
|
+
};
|
|
38517
|
+
return createEventSubscriber(client, 'stream/onStreamFlagged', 'v3.video-streaming.didFlag', filter);
|
|
38518
|
+
};
|
|
38519
|
+
|
|
38520
|
+
/**
|
|
38521
|
+
* ```js
|
|
38522
|
+
* import { onStreamTerminated } from '@amityco/ts-sdk-react-native'
|
|
38523
|
+
* const dispose = onStreamTerminated(stream => {
|
|
38524
|
+
* // ...
|
|
38525
|
+
* })
|
|
38526
|
+
* ```
|
|
38527
|
+
*
|
|
38528
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
38529
|
+
*
|
|
38530
|
+
* @param callback The function to call when the event was fired
|
|
38531
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
38532
|
+
*
|
|
38533
|
+
* @category Stream Events
|
|
38534
|
+
*/
|
|
38535
|
+
const onStreamTerminated = (callback) => {
|
|
38536
|
+
const client = getActiveClient();
|
|
38537
|
+
const filter = (payload) => {
|
|
38538
|
+
ingestInCache(payload);
|
|
38539
|
+
callback(payload.videoStreamings[0]);
|
|
38540
|
+
};
|
|
38541
|
+
return createEventSubscriber(client, 'stream/onStreamTerminated', 'v3.video-streaming.didTerminate', filter);
|
|
38542
|
+
};
|
|
38543
|
+
|
|
38434
38544
|
/* eslint-disable no-use-before-define */
|
|
38435
38545
|
/* begin_public_function
|
|
38436
38546
|
id: stream.get
|
|
@@ -38445,15 +38555,22 @@ const onStreamRecorded = (callback) => {
|
|
|
38445
38555
|
* Fetches a {@link Amity.Stream} object
|
|
38446
38556
|
*
|
|
38447
38557
|
* @param streamId the ID of the {@link Amity.Stream} to get
|
|
38558
|
+
* @param callback
|
|
38448
38559
|
* @returns the associated {@link Amity.Stream} object
|
|
38449
38560
|
*
|
|
38450
38561
|
* @category Stream Live Object
|
|
38451
38562
|
*/
|
|
38452
38563
|
const getStreamById = (streamId, callback) => {
|
|
38453
|
-
|
|
38564
|
+
const reactor = (snapshot) => {
|
|
38565
|
+
const { data } = snapshot;
|
|
38566
|
+
callback(Object.assign(Object.assign({}, snapshot), { data: data ? LinkedObject.stream(snapshot.data) : data }));
|
|
38567
|
+
};
|
|
38568
|
+
return liveObject(streamId, reactor, 'streamId', getStream, [
|
|
38454
38569
|
onStreamRecorded,
|
|
38455
38570
|
onStreamStarted,
|
|
38456
38571
|
onStreamStopped,
|
|
38572
|
+
onStreamFlagged,
|
|
38573
|
+
onStreamTerminated,
|
|
38457
38574
|
]);
|
|
38458
38575
|
};
|
|
38459
38576
|
/* end_public_function */
|
|
@@ -38479,7 +38596,7 @@ getStreamById.locally = (streamId) => {
|
|
|
38479
38596
|
if (!cached)
|
|
38480
38597
|
return;
|
|
38481
38598
|
return {
|
|
38482
|
-
data: cached.data,
|
|
38599
|
+
data: LinkedObject.stream(cached.data),
|
|
38483
38600
|
cachedAt: cached.cachedAt,
|
|
38484
38601
|
};
|
|
38485
38602
|
};
|
|
@@ -38493,10 +38610,10 @@ getStreamById.locally = (streamId) => {
|
|
|
38493
38610
|
* const streams = await getStreams()
|
|
38494
38611
|
* ```
|
|
38495
38612
|
*
|
|
38496
|
-
* Queries a paginable list of {@link Amity.
|
|
38613
|
+
* Queries a paginable list of {@link Amity.InternalStream} objects
|
|
38497
38614
|
*
|
|
38498
38615
|
* @param query The query parameters
|
|
38499
|
-
* @returns A page of {@link Amity.
|
|
38616
|
+
* @returns A page of {@link Amity.InternalStream} objects
|
|
38500
38617
|
*
|
|
38501
38618
|
* @category Stream API
|
|
38502
38619
|
* @async
|
|
@@ -38630,6 +38747,8 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
38630
38747
|
onStreamStarted: onStreamStarted,
|
|
38631
38748
|
onStreamStopped: onStreamStopped,
|
|
38632
38749
|
onStreamRecorded: onStreamRecorded,
|
|
38750
|
+
onStreamFlagged: onStreamFlagged,
|
|
38751
|
+
onStreamTerminated: onStreamTerminated,
|
|
38633
38752
|
getStreamById: getStreamById,
|
|
38634
38753
|
getStreams: getStreams
|
|
38635
38754
|
});
|
|
@@ -38962,7 +39081,7 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
38962
39081
|
getPoll: getPoll
|
|
38963
39082
|
});
|
|
38964
39083
|
|
|
38965
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
39084
|
+
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
39085
|
/*
|
|
38967
39086
|
* The crypto algorithm used for importing key and signing string
|
|
38968
39087
|
*/
|