@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.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.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
122
|
+
return 'v6.25.0-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,
|
|
@@ -13337,7 +13399,7 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
13337
13399
|
ingestInCache(payload);
|
|
13338
13400
|
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
13339
13401
|
};
|
|
13340
|
-
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.
|
|
13402
|
+
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.reactionAdded', filter);
|
|
13341
13403
|
}
|
|
13342
13404
|
if (referenceType === 'post') {
|
|
13343
13405
|
const filter = (payload) => {
|
|
@@ -13400,7 +13462,7 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
13400
13462
|
ingestInCache(payload);
|
|
13401
13463
|
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
13402
13464
|
};
|
|
13403
|
-
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.
|
|
13465
|
+
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.reactionRemoved', filter);
|
|
13404
13466
|
}
|
|
13405
13467
|
if (referenceType === 'post') {
|
|
13406
13468
|
const filter = (payload) => {
|
|
@@ -22071,10 +22133,10 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
22071
22133
|
* const created = await createStream({ title: 'my stream', 'thumbnailFileId': fileId })
|
|
22072
22134
|
* ```
|
|
22073
22135
|
*
|
|
22074
|
-
* Creates an {@link Amity.
|
|
22136
|
+
* Creates an {@link Amity.InternalStream}
|
|
22075
22137
|
*
|
|
22076
|
-
* @param bundle The data necessary to create a new {@link Amity.
|
|
22077
|
-
* @returns The newly created {@link Amity.
|
|
22138
|
+
* @param bundle The data necessary to create a new {@link Amity.InternalStream}
|
|
22139
|
+
* @returns The newly created {@link Amity.InternalStream}
|
|
22078
22140
|
*
|
|
22079
22141
|
* @category Stream API
|
|
22080
22142
|
* @async
|
|
@@ -22088,7 +22150,7 @@ const createStream = async (bundle) => {
|
|
|
22088
22150
|
ingestInCache(data, { cachedAt });
|
|
22089
22151
|
const { videoStreamings } = data;
|
|
22090
22152
|
return {
|
|
22091
|
-
data: videoStreamings[0],
|
|
22153
|
+
data: LinkedObject.stream(videoStreamings[0]),
|
|
22092
22154
|
cachedAt,
|
|
22093
22155
|
};
|
|
22094
22156
|
};
|
|
@@ -22121,7 +22183,7 @@ const updateStream = async (streamId, patch) => {
|
|
|
22121
22183
|
ingestInCache(data, { cachedAt });
|
|
22122
22184
|
const { videoStreamings } = data;
|
|
22123
22185
|
return {
|
|
22124
|
-
data: videoStreamings.find(stream => stream.streamId === streamId),
|
|
22186
|
+
data: LinkedObject.stream(videoStreamings.find(stream => stream.streamId === streamId)),
|
|
22125
22187
|
cachedAt,
|
|
22126
22188
|
};
|
|
22127
22189
|
};
|
|
@@ -22195,10 +22257,10 @@ getStream.locally = (streamId) => {
|
|
|
22195
22257
|
* const success = await deleteStream(streamId)
|
|
22196
22258
|
* ```
|
|
22197
22259
|
*
|
|
22198
|
-
* Deletes a {@link Amity.
|
|
22260
|
+
* Deletes a {@link Amity.InternalStream}
|
|
22199
22261
|
*
|
|
22200
|
-
* @param streamId The {@link Amity.
|
|
22201
|
-
* @return A success boolean if the {@link Amity.
|
|
22262
|
+
* @param streamId The {@link Amity.InternalStream} ID to delete
|
|
22263
|
+
* @return A success boolean if the {@link Amity.InternalStream} was deleted
|
|
22202
22264
|
*
|
|
22203
22265
|
* @category Stream API
|
|
22204
22266
|
* @async
|
|
@@ -22223,11 +22285,11 @@ const deleteStream = async (streamId) => {
|
|
|
22223
22285
|
* const stream = await disposeStream(streamId)
|
|
22224
22286
|
* ```
|
|
22225
22287
|
*
|
|
22226
|
-
* Dispose a {@link Amity.
|
|
22288
|
+
* Dispose a {@link Amity.InternalStream}.
|
|
22227
22289
|
* Streaming status will be updated to "ended" and streaming url will be invalidated
|
|
22228
22290
|
*
|
|
22229
|
-
* @param streamId The {@link Amity.
|
|
22230
|
-
* @returns the associated {@link Amity.
|
|
22291
|
+
* @param streamId The {@link Amity.InternalStream} ID to dispose
|
|
22292
|
+
* @returns the associated {@link Amity.InternalStream} object
|
|
22231
22293
|
*
|
|
22232
22294
|
* @category Stream API
|
|
22233
22295
|
* @async
|
|
@@ -22258,10 +22320,10 @@ const disposeStream = async (streamId) => {
|
|
|
22258
22320
|
* const streams = await getStreams()
|
|
22259
22321
|
* ```
|
|
22260
22322
|
*
|
|
22261
|
-
* Queries a paginable list of {@link Amity.
|
|
22323
|
+
* Queries a paginable list of {@link Amity.InternalStream} objects
|
|
22262
22324
|
*
|
|
22263
22325
|
* @param query The query parameters
|
|
22264
|
-
* @returns A page of {@link Amity.
|
|
22326
|
+
* @returns A page of {@link Amity.InternalStream} objects
|
|
22265
22327
|
*
|
|
22266
22328
|
* @category Stream API
|
|
22267
22329
|
* @async
|
|
@@ -22296,7 +22358,7 @@ const queryStreams$1 = async (query) => {
|
|
|
22296
22358
|
* })
|
|
22297
22359
|
* ```
|
|
22298
22360
|
*
|
|
22299
|
-
* Fired when a {@link Amity.
|
|
22361
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
22300
22362
|
*
|
|
22301
22363
|
* @param callback The function to call when the event was fired
|
|
22302
22364
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -22320,7 +22382,7 @@ const onStreamStarted = (callback) => {
|
|
|
22320
22382
|
* })
|
|
22321
22383
|
* ```
|
|
22322
22384
|
*
|
|
22323
|
-
* Fired when a {@link Amity.
|
|
22385
|
+
* Fired when a {@link Amity.InternalStream} has stopped airing
|
|
22324
22386
|
*
|
|
22325
22387
|
* @param callback The function to call when the event was fired
|
|
22326
22388
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -22344,7 +22406,7 @@ const onStreamStopped = (callback) => {
|
|
|
22344
22406
|
* })
|
|
22345
22407
|
* ```
|
|
22346
22408
|
*
|
|
22347
|
-
* Fired when the recordings of a {@link Amity.
|
|
22409
|
+
* Fired when the recordings of a {@link Amity.InternalStream} are available
|
|
22348
22410
|
*
|
|
22349
22411
|
* @param callback The function to call when the event was fired
|
|
22350
22412
|
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
@@ -22360,6 +22422,54 @@ const onStreamRecorded = (callback) => {
|
|
|
22360
22422
|
return createEventSubscriber(client, 'stream/onStreamRecorded', 'v3.video-streaming.didRecord', filter);
|
|
22361
22423
|
};
|
|
22362
22424
|
|
|
22425
|
+
/**
|
|
22426
|
+
* ```js
|
|
22427
|
+
* import { onStreamFlagged } from '@amityco/ts-sdk-react-native'
|
|
22428
|
+
* const dispose = onStreamFlagged(stream => {
|
|
22429
|
+
* // ...
|
|
22430
|
+
* })
|
|
22431
|
+
* ```
|
|
22432
|
+
*
|
|
22433
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
22434
|
+
*
|
|
22435
|
+
* @param callback The function to call when the event was fired
|
|
22436
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
22437
|
+
*
|
|
22438
|
+
* @category Stream Events
|
|
22439
|
+
*/
|
|
22440
|
+
const onStreamFlagged = (callback) => {
|
|
22441
|
+
const client = getActiveClient();
|
|
22442
|
+
const filter = (payload) => {
|
|
22443
|
+
ingestInCache(payload);
|
|
22444
|
+
callback(payload.videoStreamings[0]);
|
|
22445
|
+
};
|
|
22446
|
+
return createEventSubscriber(client, 'stream/onStreamFlagged', 'v3.video-streaming.didFlag', filter);
|
|
22447
|
+
};
|
|
22448
|
+
|
|
22449
|
+
/**
|
|
22450
|
+
* ```js
|
|
22451
|
+
* import { onStreamTerminated } from '@amityco/ts-sdk-react-native'
|
|
22452
|
+
* const dispose = onStreamTerminated(stream => {
|
|
22453
|
+
* // ...
|
|
22454
|
+
* })
|
|
22455
|
+
* ```
|
|
22456
|
+
*
|
|
22457
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
22458
|
+
*
|
|
22459
|
+
* @param callback The function to call when the event was fired
|
|
22460
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
22461
|
+
*
|
|
22462
|
+
* @category Stream Events
|
|
22463
|
+
*/
|
|
22464
|
+
const onStreamTerminated = (callback) => {
|
|
22465
|
+
const client = getActiveClient();
|
|
22466
|
+
const filter = (payload) => {
|
|
22467
|
+
ingestInCache(payload);
|
|
22468
|
+
callback(payload.videoStreamings[0]);
|
|
22469
|
+
};
|
|
22470
|
+
return createEventSubscriber(client, 'stream/onStreamTerminated', 'v3.video-streaming.didTerminate', filter);
|
|
22471
|
+
};
|
|
22472
|
+
|
|
22363
22473
|
/* eslint-disable no-use-before-define */
|
|
22364
22474
|
/* begin_public_function
|
|
22365
22475
|
id: stream.get
|
|
@@ -22374,15 +22484,22 @@ const onStreamRecorded = (callback) => {
|
|
|
22374
22484
|
* Fetches a {@link Amity.Stream} object
|
|
22375
22485
|
*
|
|
22376
22486
|
* @param streamId the ID of the {@link Amity.Stream} to get
|
|
22487
|
+
* @param callback
|
|
22377
22488
|
* @returns the associated {@link Amity.Stream} object
|
|
22378
22489
|
*
|
|
22379
22490
|
* @category Stream Live Object
|
|
22380
22491
|
*/
|
|
22381
22492
|
const getStreamById = (streamId, callback) => {
|
|
22382
|
-
|
|
22493
|
+
const reactor = (snapshot) => {
|
|
22494
|
+
const { data } = snapshot;
|
|
22495
|
+
callback(Object.assign(Object.assign({}, snapshot), { data: data ? LinkedObject.stream(snapshot.data) : data }));
|
|
22496
|
+
};
|
|
22497
|
+
return liveObject(streamId, reactor, 'streamId', getStream, [
|
|
22383
22498
|
onStreamRecorded,
|
|
22384
22499
|
onStreamStarted,
|
|
22385
22500
|
onStreamStopped,
|
|
22501
|
+
onStreamFlagged,
|
|
22502
|
+
onStreamTerminated,
|
|
22386
22503
|
]);
|
|
22387
22504
|
};
|
|
22388
22505
|
/* end_public_function */
|
|
@@ -22408,7 +22525,7 @@ getStreamById.locally = (streamId) => {
|
|
|
22408
22525
|
if (!cached)
|
|
22409
22526
|
return;
|
|
22410
22527
|
return {
|
|
22411
|
-
data: cached.data,
|
|
22528
|
+
data: LinkedObject.stream(cached.data),
|
|
22412
22529
|
cachedAt: cached.cachedAt,
|
|
22413
22530
|
};
|
|
22414
22531
|
};
|
|
@@ -22422,10 +22539,10 @@ getStreamById.locally = (streamId) => {
|
|
|
22422
22539
|
* const streams = await getStreams()
|
|
22423
22540
|
* ```
|
|
22424
22541
|
*
|
|
22425
|
-
* Queries a paginable list of {@link Amity.
|
|
22542
|
+
* Queries a paginable list of {@link Amity.InternalStream} objects
|
|
22426
22543
|
*
|
|
22427
22544
|
* @param query The query parameters
|
|
22428
|
-
* @returns A page of {@link Amity.
|
|
22545
|
+
* @returns A page of {@link Amity.InternalStream} objects
|
|
22429
22546
|
*
|
|
22430
22547
|
* @category Stream API
|
|
22431
22548
|
* @async
|
|
@@ -22559,6 +22676,8 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
22559
22676
|
onStreamStarted: onStreamStarted,
|
|
22560
22677
|
onStreamStopped: onStreamStopped,
|
|
22561
22678
|
onStreamRecorded: onStreamRecorded,
|
|
22679
|
+
onStreamFlagged: onStreamFlagged,
|
|
22680
|
+
onStreamTerminated: onStreamTerminated,
|
|
22562
22681
|
getStreamById: getStreamById,
|
|
22563
22682
|
getStreams: getStreams
|
|
22564
22683
|
});
|
|
@@ -22891,7 +23010,7 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
22891
23010
|
getPoll: getPoll
|
|
22892
23011
|
});
|
|
22893
23012
|
|
|
22894
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
23013
|
+
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
23014
|
/*
|
|
22896
23015
|
* The crypto algorithm used for importing key and signing string
|
|
22897
23016
|
*/
|