@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.cjs.js
CHANGED
|
@@ -10,6 +10,7 @@ var HttpAgent = require('agentkeepalive');
|
|
|
10
10
|
var io = require('socket.io-client');
|
|
11
11
|
var AsyncStorage = require('@react-native-async-storage/async-storage');
|
|
12
12
|
var uuid$1 = require('react-native-uuid');
|
|
13
|
+
var reactNative = require('react-native');
|
|
13
14
|
var hash = require('object-hash');
|
|
14
15
|
var Hls = require('hls.js');
|
|
15
16
|
|
|
@@ -117,8 +118,8 @@ const PostContentType = Object.freeze({
|
|
|
117
118
|
|
|
118
119
|
function getVersion() {
|
|
119
120
|
try {
|
|
120
|
-
// the string ''v6.
|
|
121
|
-
return 'v6.
|
|
121
|
+
// the string ''v6.25.1-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
122
|
+
return 'v6.25.1-cjs';
|
|
122
123
|
}
|
|
123
124
|
catch (error) {
|
|
124
125
|
return '__dev__';
|
|
@@ -546,6 +547,7 @@ const idResolvers = {
|
|
|
546
547
|
reaction: ({ referenceType, referenceId }) => `${referenceType}#${referenceId}`,
|
|
547
548
|
reactor: ({ reactionId }) => reactionId,
|
|
548
549
|
stream: ({ streamId }) => streamId,
|
|
550
|
+
streamModeration: ({ streamId }) => streamId,
|
|
549
551
|
follow: ({ from, to }) => `${from}#${to}`,
|
|
550
552
|
followInfo: ({ userId }) => userId,
|
|
551
553
|
followCount: ({ userId }) => userId,
|
|
@@ -595,6 +597,7 @@ const PAYLOAD2MODEL = {
|
|
|
595
597
|
reactors: 'reactor',
|
|
596
598
|
reactions: 'reaction',
|
|
597
599
|
videoStreamings: 'stream',
|
|
600
|
+
videoStreamModerations: 'streamModeration',
|
|
598
601
|
follows: 'follow',
|
|
599
602
|
followCounts: 'followCount',
|
|
600
603
|
feeds: 'feed',
|
|
@@ -673,6 +676,18 @@ class ASCConnectionError extends ASCError {
|
|
|
673
676
|
: 800210 /* Amity.ClientError.CONNECTION_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
674
677
|
this.event = event;
|
|
675
678
|
}
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Input sanitization related error
|
|
682
|
+
* @category Errors
|
|
683
|
+
*/
|
|
684
|
+
class ASCInvalidParameterError extends ASCError {
|
|
685
|
+
/**
|
|
686
|
+
* @param message A custom error message
|
|
687
|
+
*/
|
|
688
|
+
constructor(message) {
|
|
689
|
+
super(message, 800110 /* Amity.ClientError.INVALID_PARAMETERS */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
690
|
+
}
|
|
676
691
|
}
|
|
677
692
|
|
|
678
693
|
let activeClient = null;
|
|
@@ -5269,6 +5284,13 @@ const storyLinkedObject = (story) => {
|
|
|
5269
5284
|
} });
|
|
5270
5285
|
};
|
|
5271
5286
|
|
|
5287
|
+
const streamLinkedObject = (stream) => {
|
|
5288
|
+
return Object.assign(Object.assign({}, stream), { get moderation() {
|
|
5289
|
+
var _a;
|
|
5290
|
+
return (_a = pullFromCache(['streamModeration', 'get', stream.streamId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
5291
|
+
} });
|
|
5292
|
+
};
|
|
5293
|
+
|
|
5272
5294
|
const categoryLinkedObject = (category) => {
|
|
5273
5295
|
return Object.assign(Object.assign({}, category), { get avatar() {
|
|
5274
5296
|
var _a;
|
|
@@ -5737,6 +5759,7 @@ const LinkedObject = {
|
|
|
5737
5759
|
post: postLinkedObject,
|
|
5738
5760
|
user: userLinkedObject,
|
|
5739
5761
|
category: categoryLinkedObject,
|
|
5762
|
+
stream: streamLinkedObject,
|
|
5740
5763
|
story: storyLinkedObject,
|
|
5741
5764
|
storyTarget: storyTargetLinkedObject,
|
|
5742
5765
|
message: messageLinkedObject,
|
|
@@ -9150,6 +9173,43 @@ const isConnected = () => {
|
|
|
9150
9173
|
client.ws.connected);
|
|
9151
9174
|
};
|
|
9152
9175
|
|
|
9176
|
+
const registerPushNotification = async (deviceToken) => {
|
|
9177
|
+
const client = getActiveClient();
|
|
9178
|
+
let platform;
|
|
9179
|
+
if (reactNative.Platform.OS === 'ios' || reactNative.Platform.OS === 'android') {
|
|
9180
|
+
platform = reactNative.Platform.OS;
|
|
9181
|
+
}
|
|
9182
|
+
else {
|
|
9183
|
+
throw new ASCInvalidParameterError('Unsupported platform');
|
|
9184
|
+
}
|
|
9185
|
+
const deviceId = getDeviceId();
|
|
9186
|
+
const { data: { status, error }, } = await client.http.post('/v1/notification', {
|
|
9187
|
+
userId: client.userId,
|
|
9188
|
+
deviceId,
|
|
9189
|
+
platform,
|
|
9190
|
+
token: deviceToken,
|
|
9191
|
+
}, { headers: { 'X-API-Key': client.apiKey } });
|
|
9192
|
+
if (error) {
|
|
9193
|
+
throw new ASCApiError(error, 500000 /* Amity.ServerError.BUSINESS_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
9194
|
+
}
|
|
9195
|
+
return status === 'success';
|
|
9196
|
+
};
|
|
9197
|
+
|
|
9198
|
+
const unregisterPushNotification = async () => {
|
|
9199
|
+
const client = getActiveClient();
|
|
9200
|
+
const deviceId = getDeviceId();
|
|
9201
|
+
const { data: { status, error }, } = await client.http.delete('/v1/notification', {
|
|
9202
|
+
data: {
|
|
9203
|
+
deviceId,
|
|
9204
|
+
},
|
|
9205
|
+
headers: { 'X-API-Key': client.apiKey },
|
|
9206
|
+
});
|
|
9207
|
+
if (error) {
|
|
9208
|
+
throw new ASCApiError(error, 500000 /* Amity.ServerError.BUSINESS_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
9209
|
+
}
|
|
9210
|
+
return status === 'success';
|
|
9211
|
+
};
|
|
9212
|
+
|
|
9153
9213
|
/**
|
|
9154
9214
|
* ```js
|
|
9155
9215
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk-react-native'
|
|
@@ -9680,6 +9740,8 @@ var index$k = /*#__PURE__*/Object.freeze({
|
|
|
9680
9740
|
renewal: renewal,
|
|
9681
9741
|
markerSync: markerSync,
|
|
9682
9742
|
enableUnreadCount: enableUnreadCount,
|
|
9743
|
+
registerPushNotification: registerPushNotification,
|
|
9744
|
+
unregisterPushNotification: unregisterPushNotification,
|
|
9683
9745
|
onConnectionError: onConnectionError,
|
|
9684
9746
|
onClientDisconnected: onClientDisconnected,
|
|
9685
9747
|
onClientBanned: onClientBanned,
|
|
@@ -13335,9 +13397,10 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
13335
13397
|
if (!payload.reactions[0])
|
|
13336
13398
|
return;
|
|
13337
13399
|
ingestInCache(payload);
|
|
13400
|
+
ingestInCache({ reactors: payload.reactions });
|
|
13338
13401
|
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
13339
13402
|
};
|
|
13340
|
-
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.
|
|
13403
|
+
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.reactionAdded', filter);
|
|
13341
13404
|
}
|
|
13342
13405
|
if (referenceType === 'post') {
|
|
13343
13406
|
const filter = (payload) => {
|
|
@@ -13400,7 +13463,7 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
13400
13463
|
ingestInCache(payload);
|
|
13401
13464
|
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
13402
13465
|
};
|
|
13403
|
-
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.
|
|
13466
|
+
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.reactionRemoved', filter);
|
|
13404
13467
|
}
|
|
13405
13468
|
if (referenceType === 'post') {
|
|
13406
13469
|
const filter = (payload) => {
|
|
@@ -22071,10 +22134,10 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
22071
22134
|
* const created = await createStream({ title: 'my stream', 'thumbnailFileId': fileId })
|
|
22072
22135
|
* ```
|
|
22073
22136
|
*
|
|
22074
|
-
* Creates an {@link Amity.
|
|
22137
|
+
* Creates an {@link Amity.InternalStream}
|
|
22075
22138
|
*
|
|
22076
|
-
* @param bundle The data necessary to create a new {@link Amity.
|
|
22077
|
-
* @returns The newly created {@link Amity.
|
|
22139
|
+
* @param bundle The data necessary to create a new {@link Amity.InternalStream}
|
|
22140
|
+
* @returns The newly created {@link Amity.InternalStream}
|
|
22078
22141
|
*
|
|
22079
22142
|
* @category Stream API
|
|
22080
22143
|
* @async
|
|
@@ -22088,7 +22151,7 @@ const createStream = async (bundle) => {
|
|
|
22088
22151
|
ingestInCache(data, { cachedAt });
|
|
22089
22152
|
const { videoStreamings } = data;
|
|
22090
22153
|
return {
|
|
22091
|
-
data: videoStreamings[0],
|
|
22154
|
+
data: LinkedObject.stream(videoStreamings[0]),
|
|
22092
22155
|
cachedAt,
|
|
22093
22156
|
};
|
|
22094
22157
|
};
|
|
@@ -22121,7 +22184,7 @@ const updateStream = async (streamId, patch) => {
|
|
|
22121
22184
|
ingestInCache(data, { cachedAt });
|
|
22122
22185
|
const { videoStreamings } = data;
|
|
22123
22186
|
return {
|
|
22124
|
-
data: videoStreamings.find(stream => stream.streamId === streamId),
|
|
22187
|
+
data: LinkedObject.stream(videoStreamings.find(stream => stream.streamId === streamId)),
|
|
22125
22188
|
cachedAt,
|
|
22126
22189
|
};
|
|
22127
22190
|
};
|
|
@@ -22195,10 +22258,10 @@ getStream.locally = (streamId) => {
|
|
|
22195
22258
|
* const success = await deleteStream(streamId)
|
|
22196
22259
|
* ```
|
|
22197
22260
|
*
|
|
22198
|
-
* Deletes a {@link Amity.
|
|
22261
|
+
* Deletes a {@link Amity.InternalStream}
|
|
22199
22262
|
*
|
|
22200
|
-
* @param streamId The {@link Amity.
|
|
22201
|
-
* @return A success boolean if the {@link Amity.
|
|
22263
|
+
* @param streamId The {@link Amity.InternalStream} ID to delete
|
|
22264
|
+
* @return A success boolean if the {@link Amity.InternalStream} was deleted
|
|
22202
22265
|
*
|
|
22203
22266
|
* @category Stream API
|
|
22204
22267
|
* @async
|
|
@@ -22223,11 +22286,11 @@ const deleteStream = async (streamId) => {
|
|
|
22223
22286
|
* const stream = await disposeStream(streamId)
|
|
22224
22287
|
* ```
|
|
22225
22288
|
*
|
|
22226
|
-
* Dispose a {@link Amity.
|
|
22289
|
+
* Dispose a {@link Amity.InternalStream}.
|
|
22227
22290
|
* Streaming status will be updated to "ended" and streaming url will be invalidated
|
|
22228
22291
|
*
|
|
22229
|
-
* @param streamId The {@link Amity.
|
|
22230
|
-
* @returns the associated {@link Amity.
|
|
22292
|
+
* @param streamId The {@link Amity.InternalStream} ID to dispose
|
|
22293
|
+
* @returns the associated {@link Amity.InternalStream} object
|
|
22231
22294
|
*
|
|
22232
22295
|
* @category Stream API
|
|
22233
22296
|
* @async
|
|
@@ -22258,10 +22321,10 @@ const disposeStream = async (streamId) => {
|
|
|
22258
22321
|
* const streams = await getStreams()
|
|
22259
22322
|
* ```
|
|
22260
22323
|
*
|
|
22261
|
-
* Queries a paginable list of {@link Amity.
|
|
22324
|
+
* Queries a paginable list of {@link Amity.InternalStream} objects
|
|
22262
22325
|
*
|
|
22263
22326
|
* @param query The query parameters
|
|
22264
|
-
* @returns A page of {@link Amity.
|
|
22327
|
+
* @returns A page of {@link Amity.InternalStream} objects
|
|
22265
22328
|
*
|
|
22266
22329
|
* @category Stream API
|
|
22267
22330
|
* @async
|
|
@@ -22296,7 +22359,7 @@ const queryStreams$1 = async (query) => {
|
|
|
22296
22359
|
* })
|
|
22297
22360
|
* ```
|
|
22298
22361
|
*
|
|
22299
|
-
* Fired when a {@link Amity.
|
|
22362
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
22300
22363
|
*
|
|
22301
22364
|
* @param callback The function to call when the event was fired
|
|
22302
22365
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -22320,7 +22383,7 @@ const onStreamStarted = (callback) => {
|
|
|
22320
22383
|
* })
|
|
22321
22384
|
* ```
|
|
22322
22385
|
*
|
|
22323
|
-
* Fired when a {@link Amity.
|
|
22386
|
+
* Fired when a {@link Amity.InternalStream} has stopped airing
|
|
22324
22387
|
*
|
|
22325
22388
|
* @param callback The function to call when the event was fired
|
|
22326
22389
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -22344,7 +22407,7 @@ const onStreamStopped = (callback) => {
|
|
|
22344
22407
|
* })
|
|
22345
22408
|
* ```
|
|
22346
22409
|
*
|
|
22347
|
-
* Fired when the recordings of a {@link Amity.
|
|
22410
|
+
* Fired when the recordings of a {@link Amity.InternalStream} are available
|
|
22348
22411
|
*
|
|
22349
22412
|
* @param callback The function to call when the event was fired
|
|
22350
22413
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -22360,6 +22423,54 @@ const onStreamRecorded = (callback) => {
|
|
|
22360
22423
|
return createEventSubscriber(client, 'stream/onStreamRecorded', 'v3.video-streaming.didRecord', filter);
|
|
22361
22424
|
};
|
|
22362
22425
|
|
|
22426
|
+
/**
|
|
22427
|
+
* ```js
|
|
22428
|
+
* import { onStreamFlagged } from '@amityco/ts-sdk-react-native'
|
|
22429
|
+
* const dispose = onStreamFlagged(stream => {
|
|
22430
|
+
* // ...
|
|
22431
|
+
* })
|
|
22432
|
+
* ```
|
|
22433
|
+
*
|
|
22434
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
22435
|
+
*
|
|
22436
|
+
* @param callback The function to call when the event was fired
|
|
22437
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
22438
|
+
*
|
|
22439
|
+
* @category Stream Events
|
|
22440
|
+
*/
|
|
22441
|
+
const onStreamFlagged = (callback) => {
|
|
22442
|
+
const client = getActiveClient();
|
|
22443
|
+
const filter = (payload) => {
|
|
22444
|
+
ingestInCache(payload);
|
|
22445
|
+
callback(payload.videoStreamings[0]);
|
|
22446
|
+
};
|
|
22447
|
+
return createEventSubscriber(client, 'stream/onStreamFlagged', 'v3.video-streaming.didFlag', filter);
|
|
22448
|
+
};
|
|
22449
|
+
|
|
22450
|
+
/**
|
|
22451
|
+
* ```js
|
|
22452
|
+
* import { onStreamTerminated } from '@amityco/ts-sdk-react-native'
|
|
22453
|
+
* const dispose = onStreamTerminated(stream => {
|
|
22454
|
+
* // ...
|
|
22455
|
+
* })
|
|
22456
|
+
* ```
|
|
22457
|
+
*
|
|
22458
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
22459
|
+
*
|
|
22460
|
+
* @param callback The function to call when the event was fired
|
|
22461
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
22462
|
+
*
|
|
22463
|
+
* @category Stream Events
|
|
22464
|
+
*/
|
|
22465
|
+
const onStreamTerminated = (callback) => {
|
|
22466
|
+
const client = getActiveClient();
|
|
22467
|
+
const filter = (payload) => {
|
|
22468
|
+
ingestInCache(payload);
|
|
22469
|
+
callback(payload.videoStreamings[0]);
|
|
22470
|
+
};
|
|
22471
|
+
return createEventSubscriber(client, 'stream/onStreamTerminated', 'v3.video-streaming.didTerminate', filter);
|
|
22472
|
+
};
|
|
22473
|
+
|
|
22363
22474
|
/* eslint-disable no-use-before-define */
|
|
22364
22475
|
/* begin_public_function
|
|
22365
22476
|
id: stream.get
|
|
@@ -22374,15 +22485,22 @@ const onStreamRecorded = (callback) => {
|
|
|
22374
22485
|
* Fetches a {@link Amity.Stream} object
|
|
22375
22486
|
*
|
|
22376
22487
|
* @param streamId the ID of the {@link Amity.Stream} to get
|
|
22488
|
+
* @param callback
|
|
22377
22489
|
* @returns the associated {@link Amity.Stream} object
|
|
22378
22490
|
*
|
|
22379
22491
|
* @category Stream Live Object
|
|
22380
22492
|
*/
|
|
22381
22493
|
const getStreamById = (streamId, callback) => {
|
|
22382
|
-
|
|
22494
|
+
const reactor = (snapshot) => {
|
|
22495
|
+
const { data } = snapshot;
|
|
22496
|
+
callback(Object.assign(Object.assign({}, snapshot), { data: data ? LinkedObject.stream(snapshot.data) : data }));
|
|
22497
|
+
};
|
|
22498
|
+
return liveObject(streamId, reactor, 'streamId', getStream, [
|
|
22383
22499
|
onStreamRecorded,
|
|
22384
22500
|
onStreamStarted,
|
|
22385
22501
|
onStreamStopped,
|
|
22502
|
+
onStreamFlagged,
|
|
22503
|
+
onStreamTerminated,
|
|
22386
22504
|
]);
|
|
22387
22505
|
};
|
|
22388
22506
|
/* end_public_function */
|
|
@@ -22408,7 +22526,7 @@ getStreamById.locally = (streamId) => {
|
|
|
22408
22526
|
if (!cached)
|
|
22409
22527
|
return;
|
|
22410
22528
|
return {
|
|
22411
|
-
data: cached.data,
|
|
22529
|
+
data: LinkedObject.stream(cached.data),
|
|
22412
22530
|
cachedAt: cached.cachedAt,
|
|
22413
22531
|
};
|
|
22414
22532
|
};
|
|
@@ -22422,10 +22540,10 @@ getStreamById.locally = (streamId) => {
|
|
|
22422
22540
|
* const streams = await getStreams()
|
|
22423
22541
|
* ```
|
|
22424
22542
|
*
|
|
22425
|
-
* Queries a paginable list of {@link Amity.
|
|
22543
|
+
* Queries a paginable list of {@link Amity.InternalStream} objects
|
|
22426
22544
|
*
|
|
22427
22545
|
* @param query The query parameters
|
|
22428
|
-
* @returns A page of {@link Amity.
|
|
22546
|
+
* @returns A page of {@link Amity.InternalStream} objects
|
|
22429
22547
|
*
|
|
22430
22548
|
* @category Stream API
|
|
22431
22549
|
* @async
|
|
@@ -22559,6 +22677,8 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
22559
22677
|
onStreamStarted: onStreamStarted,
|
|
22560
22678
|
onStreamStopped: onStreamStopped,
|
|
22561
22679
|
onStreamRecorded: onStreamRecorded,
|
|
22680
|
+
onStreamFlagged: onStreamFlagged,
|
|
22681
|
+
onStreamTerminated: onStreamTerminated,
|
|
22562
22682
|
getStreamById: getStreamById,
|
|
22563
22683
|
getStreams: getStreams
|
|
22564
22684
|
});
|
|
@@ -22891,7 +23011,7 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
22891
23011
|
getPoll: getPoll
|
|
22892
23012
|
});
|
|
22893
23013
|
|
|
22894
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
23014
|
+
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-----";
|
|
22895
23015
|
/*
|
|
22896
23016
|
* The crypto algorithm used for importing key and signing string
|
|
22897
23017
|
*/
|