@amityco/ts-sdk 7.11.1-bd338235.0 → 7.11.1-c511b906.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/dist/@types/domains/room.d.ts +5 -2
- package/dist/@types/domains/room.d.ts.map +1 -1
- package/dist/channelRepository/api/createChannel.d.ts +1 -0
- package/dist/channelRepository/api/createChannel.d.ts.map +1 -1
- package/dist/index.cjs.js +90 -6
- package/dist/index.esm.js +90 -6
- package/dist/index.umd.js +1 -1
- package/dist/roomRepository/api/{getRoomToken.d.ts → getBroadcasterData.d.ts} +3 -3
- package/dist/roomRepository/api/getBroadcasterData.d.ts.map +1 -0
- package/dist/roomRepository/api/index.d.ts +1 -1
- package/dist/roomRepository/api/index.d.ts.map +1 -1
- package/dist/roomRepository/internalApi/getLiveChat.d.ts +16 -0
- package/dist/roomRepository/internalApi/getLiveChat.d.ts.map +1 -0
- package/dist/roomRepository/internalApi/index.d.ts +1 -0
- package/dist/roomRepository/internalApi/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/dist/utils/linkedObject/roomLinkedObject.d.ts +1 -3
- package/dist/utils/linkedObject/roomLinkedObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/roomRepository/api/getRoomToken.d.ts.map +0 -1
|
@@ -49,10 +49,13 @@ declare global {
|
|
|
49
49
|
path: string;
|
|
50
50
|
};
|
|
51
51
|
type InternalRoom = RawRoom;
|
|
52
|
-
type
|
|
53
|
-
post?: Amity.Post;
|
|
52
|
+
type RoomLinkedObject = {
|
|
54
53
|
moderation?: Amity.StreamModeration;
|
|
54
|
+
post?: Amity.InternalPost;
|
|
55
|
+
childRooms: Amity.Room[];
|
|
56
|
+
getLiveChat: () => Promise<Amity.Channel<'live'> | undefined>;
|
|
55
57
|
};
|
|
58
|
+
type Room = InternalRoom & RoomLinkedObject;
|
|
56
59
|
type RoomLiveCollection = {
|
|
57
60
|
type?: RoomType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1B,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QAEF,KAAK,YAAY,GAAG,OAAO,CAAC;QAE5B,KAAK,gBAAgB,GAAG;YAEtB,UAAU,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC;YACpC,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;YAC1B,UAAU,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;YACzB,WAAW,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC;SAC/D,CAAC;QAEF,KAAK,IAAI,GAAG,YAAY,GAAG,gBAAgB,CAAC;QAE5C,KAAK,kBAAkB,GAAG;YACxB,IAAI,CAAC,EAAE,QAAQ,CAAC;YAChB,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;YACxB,MAAM,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;YACxC,KAAK,CAAC,EAAE,MAAM,CAAC;YAEf,cAAc,CAAC,EAAE,OAAO,CAAC;SAC1B,CAAC;QAEF,KAAK,uBAAuB,GAAG;YAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SAC7B,CAAC;QAEF,KAAK,eAAe,GAAG;YACrB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,eAAe,CAAC,EAAE,MAAM,CAAC;SAC1B,CAAC;KACH;CACF"}
|
|
@@ -17,5 +17,6 @@ export declare const createChannel: <T extends Amity.ChannelType>(bundle: {
|
|
|
17
17
|
userIds?: string[] | undefined;
|
|
18
18
|
videoStreamId?: string | undefined;
|
|
19
19
|
postId?: string | undefined;
|
|
20
|
+
roomId?: string | undefined;
|
|
20
21
|
} & Pick<Amity.Channel<T>, "displayName" | "avatarFileId" | "isPublic" | "tags" | "metadata">) => Promise<Amity.Cached<Amity.Channel<T>>>;
|
|
21
22
|
//# sourceMappingURL=createChannel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createChannel.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/api/createChannel.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"createChannel.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/api/createChannel.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;;;;;;yIAsCzB,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -12036,7 +12036,7 @@ getChannel$1.locally = (channelId) => {
|
|
|
12036
12036
|
* @category Stream API
|
|
12037
12037
|
* @async
|
|
12038
12038
|
*/
|
|
12039
|
-
const getLiveChat = async (stream) => {
|
|
12039
|
+
const getLiveChat$1 = async (stream) => {
|
|
12040
12040
|
var _a;
|
|
12041
12041
|
const client = getActiveClient();
|
|
12042
12042
|
client.log('stream/getLiveChat', stream.streamId);
|
|
@@ -12103,7 +12103,7 @@ const streamLinkedObject = (stream) => {
|
|
|
12103
12103
|
return streamLinkedObject(streamCache);
|
|
12104
12104
|
})
|
|
12105
12105
|
.filter(isNonNullable);
|
|
12106
|
-
}, getLiveChat: () => getLiveChat(stream), isBanned: !stream.watcherUrl, watcherUrl: null, get [GET_WATCHER_URLS]() {
|
|
12106
|
+
}, getLiveChat: () => getLiveChat$1(stream), isBanned: !stream.watcherUrl, watcherUrl: null, get [GET_WATCHER_URLS]() {
|
|
12107
12107
|
return stream.watcherUrl;
|
|
12108
12108
|
} });
|
|
12109
12109
|
};
|
|
@@ -12218,6 +12218,89 @@ function isAmityRoomPost(post) {
|
|
|
12218
12218
|
post.dataType === 'room');
|
|
12219
12219
|
}
|
|
12220
12220
|
|
|
12221
|
+
/**
|
|
12222
|
+
* ```js
|
|
12223
|
+
* import { RoomRepository } from '@amityco/ts-sdk'
|
|
12224
|
+
* const stream = await getStream('foobar')
|
|
12225
|
+
* ```
|
|
12226
|
+
*
|
|
12227
|
+
* Fetches a {@link Amity.Channel} object linked with a current stream
|
|
12228
|
+
*
|
|
12229
|
+
* @param stream {@link Amity.Stream} that has linked live channel
|
|
12230
|
+
* @returns the associated {@link Amity.Channel<'live'>} object
|
|
12231
|
+
*
|
|
12232
|
+
* @category Stream API
|
|
12233
|
+
* @async
|
|
12234
|
+
*/
|
|
12235
|
+
const getLiveChat = async (room) => {
|
|
12236
|
+
var _a;
|
|
12237
|
+
const client = getActiveClient();
|
|
12238
|
+
client.log('room/getLiveChat', room.roomId);
|
|
12239
|
+
if (room.liveChannelId) {
|
|
12240
|
+
const channel = (_a = pullFromCache([
|
|
12241
|
+
'channel',
|
|
12242
|
+
'get',
|
|
12243
|
+
room.liveChannelId,
|
|
12244
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
12245
|
+
if (channel)
|
|
12246
|
+
return channelLinkedObject(constructChannelObject(channel));
|
|
12247
|
+
const { data } = await getChannel$1(room.liveChannelId);
|
|
12248
|
+
return channelLinkedObject(constructChannelObject(data));
|
|
12249
|
+
}
|
|
12250
|
+
// No Channel ID
|
|
12251
|
+
// streamer: create a new live channel
|
|
12252
|
+
if (room.createdBy === client.userId) {
|
|
12253
|
+
const { data: channel } = await createChannel({
|
|
12254
|
+
type: 'live',
|
|
12255
|
+
postId: room.referenceId,
|
|
12256
|
+
roomId: room.roomId,
|
|
12257
|
+
});
|
|
12258
|
+
// Update channelId to stream object in cache
|
|
12259
|
+
mergeInCache(['room', 'get', room.roomId], {
|
|
12260
|
+
liveChannelId: channel.channelId,
|
|
12261
|
+
});
|
|
12262
|
+
return channel;
|
|
12263
|
+
}
|
|
12264
|
+
// watcher: return undefined
|
|
12265
|
+
return undefined;
|
|
12266
|
+
};
|
|
12267
|
+
|
|
12268
|
+
const roomLinkedObject = (room) => {
|
|
12269
|
+
return Object.assign(Object.assign({}, room), { get moderation() {
|
|
12270
|
+
var _a;
|
|
12271
|
+
return (_a = pullFromCache(['roomModeration', 'get', room.roomId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
12272
|
+
},
|
|
12273
|
+
get post() {
|
|
12274
|
+
var _a;
|
|
12275
|
+
if (room.referenceType !== 'post')
|
|
12276
|
+
return;
|
|
12277
|
+
return (_a = pullFromCache(['post', 'get', room.referenceId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
12278
|
+
},
|
|
12279
|
+
get community() {
|
|
12280
|
+
var _a;
|
|
12281
|
+
if (room.targetType !== 'community')
|
|
12282
|
+
return;
|
|
12283
|
+
return (_a = pullFromCache(['community', 'get', room.targetId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
12284
|
+
},
|
|
12285
|
+
get user() {
|
|
12286
|
+
var _a;
|
|
12287
|
+
return (_a = pullFromCache(['user', 'get', room.createdBy])) === null || _a === void 0 ? void 0 : _a.data;
|
|
12288
|
+
},
|
|
12289
|
+
get childRooms() {
|
|
12290
|
+
if (!room.childRoomIds || room.childRoomIds.length === 0)
|
|
12291
|
+
return [];
|
|
12292
|
+
return room.childRoomIds
|
|
12293
|
+
.map(id => {
|
|
12294
|
+
var _a;
|
|
12295
|
+
const roomCache = (_a = pullFromCache(['room', 'get', id])) === null || _a === void 0 ? void 0 : _a.data;
|
|
12296
|
+
if (!roomCache)
|
|
12297
|
+
return undefined;
|
|
12298
|
+
return roomLinkedObject(roomCache);
|
|
12299
|
+
})
|
|
12300
|
+
.filter(isNonNullable);
|
|
12301
|
+
}, getLiveChat: () => getLiveChat(room) });
|
|
12302
|
+
};
|
|
12303
|
+
|
|
12221
12304
|
const postLinkedObject = (post) => {
|
|
12222
12305
|
return shallowClone(post, {
|
|
12223
12306
|
childrenPosts: post.children
|
|
@@ -12315,7 +12398,8 @@ const postLinkedObject = (post) => {
|
|
|
12315
12398
|
var _a, _b;
|
|
12316
12399
|
if (!isAmityRoomPost(post))
|
|
12317
12400
|
return;
|
|
12318
|
-
|
|
12401
|
+
const room = (_b = pullFromCache(['room', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.roomId])) === null || _b === void 0 ? void 0 : _b.data;
|
|
12402
|
+
return room ? roomLinkedObject(room) : undefined;
|
|
12319
12403
|
},
|
|
12320
12404
|
});
|
|
12321
12405
|
};
|
|
@@ -27704,7 +27788,7 @@ const createRoom = async (bundle) => {
|
|
|
27704
27788
|
ingestInCache(data, { cachedAt });
|
|
27705
27789
|
const { rooms } = data;
|
|
27706
27790
|
return {
|
|
27707
|
-
data: rooms[0],
|
|
27791
|
+
data: roomLinkedObject(rooms[0]),
|
|
27708
27792
|
cachedAt,
|
|
27709
27793
|
};
|
|
27710
27794
|
};
|
|
@@ -27811,10 +27895,10 @@ const stopRoom = async (roomId) => {
|
|
|
27811
27895
|
* const token = await getBroadcasterData('roomId')
|
|
27812
27896
|
* ```
|
|
27813
27897
|
*
|
|
27814
|
-
* Gets
|
|
27898
|
+
* Gets broadcaster data for a room
|
|
27815
27899
|
*
|
|
27816
27900
|
* @param roomId The ID of the room to get token for
|
|
27817
|
-
* @returns The room
|
|
27901
|
+
* @returns The broadcaster data of the room including coHostToken, coHostUrl and direactStreamUrl
|
|
27818
27902
|
*
|
|
27819
27903
|
* @category Room API
|
|
27820
27904
|
* @async
|
package/dist/index.esm.js
CHANGED
|
@@ -28128,7 +28128,7 @@ getChannel$1.locally = (channelId) => {
|
|
|
28128
28128
|
* @category Stream API
|
|
28129
28129
|
* @async
|
|
28130
28130
|
*/
|
|
28131
|
-
const getLiveChat = async (stream) => {
|
|
28131
|
+
const getLiveChat$1 = async (stream) => {
|
|
28132
28132
|
var _a;
|
|
28133
28133
|
const client = getActiveClient();
|
|
28134
28134
|
client.log('stream/getLiveChat', stream.streamId);
|
|
@@ -28195,7 +28195,7 @@ const streamLinkedObject = (stream) => {
|
|
|
28195
28195
|
return streamLinkedObject(streamCache);
|
|
28196
28196
|
})
|
|
28197
28197
|
.filter(isNonNullable);
|
|
28198
|
-
}, getLiveChat: () => getLiveChat(stream), isBanned: !stream.watcherUrl, watcherUrl: null, get [GET_WATCHER_URLS]() {
|
|
28198
|
+
}, getLiveChat: () => getLiveChat$1(stream), isBanned: !stream.watcherUrl, watcherUrl: null, get [GET_WATCHER_URLS]() {
|
|
28199
28199
|
return stream.watcherUrl;
|
|
28200
28200
|
} });
|
|
28201
28201
|
};
|
|
@@ -28310,6 +28310,89 @@ function isAmityRoomPost(post) {
|
|
|
28310
28310
|
post.dataType === 'room');
|
|
28311
28311
|
}
|
|
28312
28312
|
|
|
28313
|
+
/**
|
|
28314
|
+
* ```js
|
|
28315
|
+
* import { RoomRepository } from '@amityco/ts-sdk'
|
|
28316
|
+
* const stream = await getStream('foobar')
|
|
28317
|
+
* ```
|
|
28318
|
+
*
|
|
28319
|
+
* Fetches a {@link Amity.Channel} object linked with a current stream
|
|
28320
|
+
*
|
|
28321
|
+
* @param stream {@link Amity.Stream} that has linked live channel
|
|
28322
|
+
* @returns the associated {@link Amity.Channel<'live'>} object
|
|
28323
|
+
*
|
|
28324
|
+
* @category Stream API
|
|
28325
|
+
* @async
|
|
28326
|
+
*/
|
|
28327
|
+
const getLiveChat = async (room) => {
|
|
28328
|
+
var _a;
|
|
28329
|
+
const client = getActiveClient();
|
|
28330
|
+
client.log('room/getLiveChat', room.roomId);
|
|
28331
|
+
if (room.liveChannelId) {
|
|
28332
|
+
const channel = (_a = pullFromCache([
|
|
28333
|
+
'channel',
|
|
28334
|
+
'get',
|
|
28335
|
+
room.liveChannelId,
|
|
28336
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
28337
|
+
if (channel)
|
|
28338
|
+
return channelLinkedObject(constructChannelObject(channel));
|
|
28339
|
+
const { data } = await getChannel$1(room.liveChannelId);
|
|
28340
|
+
return channelLinkedObject(constructChannelObject(data));
|
|
28341
|
+
}
|
|
28342
|
+
// No Channel ID
|
|
28343
|
+
// streamer: create a new live channel
|
|
28344
|
+
if (room.createdBy === client.userId) {
|
|
28345
|
+
const { data: channel } = await createChannel({
|
|
28346
|
+
type: 'live',
|
|
28347
|
+
postId: room.referenceId,
|
|
28348
|
+
roomId: room.roomId,
|
|
28349
|
+
});
|
|
28350
|
+
// Update channelId to stream object in cache
|
|
28351
|
+
mergeInCache(['room', 'get', room.roomId], {
|
|
28352
|
+
liveChannelId: channel.channelId,
|
|
28353
|
+
});
|
|
28354
|
+
return channel;
|
|
28355
|
+
}
|
|
28356
|
+
// watcher: return undefined
|
|
28357
|
+
return undefined;
|
|
28358
|
+
};
|
|
28359
|
+
|
|
28360
|
+
const roomLinkedObject = (room) => {
|
|
28361
|
+
return Object.assign(Object.assign({}, room), { get moderation() {
|
|
28362
|
+
var _a;
|
|
28363
|
+
return (_a = pullFromCache(['roomModeration', 'get', room.roomId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
28364
|
+
},
|
|
28365
|
+
get post() {
|
|
28366
|
+
var _a;
|
|
28367
|
+
if (room.referenceType !== 'post')
|
|
28368
|
+
return;
|
|
28369
|
+
return (_a = pullFromCache(['post', 'get', room.referenceId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
28370
|
+
},
|
|
28371
|
+
get community() {
|
|
28372
|
+
var _a;
|
|
28373
|
+
if (room.targetType !== 'community')
|
|
28374
|
+
return;
|
|
28375
|
+
return (_a = pullFromCache(['community', 'get', room.targetId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
28376
|
+
},
|
|
28377
|
+
get user() {
|
|
28378
|
+
var _a;
|
|
28379
|
+
return (_a = pullFromCache(['user', 'get', room.createdBy])) === null || _a === void 0 ? void 0 : _a.data;
|
|
28380
|
+
},
|
|
28381
|
+
get childRooms() {
|
|
28382
|
+
if (!room.childRoomIds || room.childRoomIds.length === 0)
|
|
28383
|
+
return [];
|
|
28384
|
+
return room.childRoomIds
|
|
28385
|
+
.map(id => {
|
|
28386
|
+
var _a;
|
|
28387
|
+
const roomCache = (_a = pullFromCache(['room', 'get', id])) === null || _a === void 0 ? void 0 : _a.data;
|
|
28388
|
+
if (!roomCache)
|
|
28389
|
+
return undefined;
|
|
28390
|
+
return roomLinkedObject(roomCache);
|
|
28391
|
+
})
|
|
28392
|
+
.filter(isNonNullable);
|
|
28393
|
+
}, getLiveChat: () => getLiveChat(room) });
|
|
28394
|
+
};
|
|
28395
|
+
|
|
28313
28396
|
const postLinkedObject = (post) => {
|
|
28314
28397
|
return shallowClone(post, {
|
|
28315
28398
|
childrenPosts: post.children
|
|
@@ -28407,7 +28490,8 @@ const postLinkedObject = (post) => {
|
|
|
28407
28490
|
var _a, _b;
|
|
28408
28491
|
if (!isAmityRoomPost(post))
|
|
28409
28492
|
return;
|
|
28410
|
-
|
|
28493
|
+
const room = (_b = pullFromCache(['room', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.roomId])) === null || _b === void 0 ? void 0 : _b.data;
|
|
28494
|
+
return room ? roomLinkedObject(room) : undefined;
|
|
28411
28495
|
},
|
|
28412
28496
|
});
|
|
28413
28497
|
};
|
|
@@ -43796,7 +43880,7 @@ const createRoom = async (bundle) => {
|
|
|
43796
43880
|
ingestInCache(data, { cachedAt });
|
|
43797
43881
|
const { rooms } = data;
|
|
43798
43882
|
return {
|
|
43799
|
-
data: rooms[0],
|
|
43883
|
+
data: roomLinkedObject(rooms[0]),
|
|
43800
43884
|
cachedAt,
|
|
43801
43885
|
};
|
|
43802
43886
|
};
|
|
@@ -43903,10 +43987,10 @@ const stopRoom = async (roomId) => {
|
|
|
43903
43987
|
* const token = await getBroadcasterData('roomId')
|
|
43904
43988
|
* ```
|
|
43905
43989
|
*
|
|
43906
|
-
* Gets
|
|
43990
|
+
* Gets broadcaster data for a room
|
|
43907
43991
|
*
|
|
43908
43992
|
* @param roomId The ID of the room to get token for
|
|
43909
|
-
* @returns The room
|
|
43993
|
+
* @returns The broadcaster data of the room including coHostToken, coHostUrl and direactStreamUrl
|
|
43910
43994
|
*
|
|
43911
43995
|
* @category Room API
|
|
43912
43996
|
* @async
|