@amityco/ts-sdk 6.17.3-c7279f3.0 → 6.17.3
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/client/api/login.d.ts.map +1 -1
- package/dist/client/api/logout.d.ts.map +1 -1
- package/dist/client/utils/setClientToken.d.ts +1 -1
- package/dist/client/utils/setClientToken.d.ts.map +1 -1
- package/dist/commentRepository/api/deleteComment.d.ts.map +1 -1
- package/dist/index.cjs.js +105 -114
- package/dist/index.esm.js +105 -114
- package/dist/index.umd.js +2 -2
- package/dist/storyRepository/observers/getActiveStoriesByTarget.d.ts.map +1 -1
- package/dist/storyRepository/utils/convertRawToStory.d.ts +2 -2
- package/dist/storyRepository/utils/convertRawToStory.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/api/login.ts +29 -6
- package/src/client/api/logout.ts +5 -0
- package/src/client/utils/setClientToken.ts +1 -1
- package/src/commentRepository/api/deleteComment.ts +12 -29
- package/src/storyRepository/events/onStoryCreated.ts +1 -1
- package/src/storyRepository/observers/getActiveStoriesByTarget.ts +5 -11
- package/src/storyRepository/utils/convertRawToStory.ts +3 -10
package/dist/index.esm.js
CHANGED
|
@@ -83,8 +83,8 @@ const PostContentType = Object.freeze({
|
|
|
83
83
|
|
|
84
84
|
function getVersion() {
|
|
85
85
|
try {
|
|
86
|
-
// the string ''v6.17.
|
|
87
|
-
return 'v6.17.
|
|
86
|
+
// the string ''v6.17.3-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
87
|
+
return 'v6.17.3-esm';
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
90
|
return '__dev__';
|
|
@@ -23079,6 +23079,11 @@ const logout = async () => {
|
|
|
23079
23079
|
client.userId = undefined;
|
|
23080
23080
|
client.token = undefined;
|
|
23081
23081
|
client.http.defaults.headers.common.Authorization = '';
|
|
23082
|
+
client.http.defaults.metadata = {
|
|
23083
|
+
tokenExpiry: '',
|
|
23084
|
+
isGlobalBanned: false,
|
|
23085
|
+
isUserDeleted: false,
|
|
23086
|
+
};
|
|
23082
23087
|
client.ws.io.opts.query = { token: '' };
|
|
23083
23088
|
/*
|
|
23084
23089
|
* Cache should be usable if tokenExpired
|
|
@@ -23263,7 +23268,7 @@ async function runMqtt() {
|
|
|
23263
23268
|
* @async
|
|
23264
23269
|
*/
|
|
23265
23270
|
const login = async (params, sessionHandler, config) => {
|
|
23266
|
-
var _a, _b
|
|
23271
|
+
var _a, _b;
|
|
23267
23272
|
const client = getActiveClient();
|
|
23268
23273
|
let unsubWatcher;
|
|
23269
23274
|
client.log('client/api/connectClient', Object.assign({ apiKey: client.apiKey, sessionState: client.sessionState }, params));
|
|
@@ -23275,25 +23280,35 @@ const login = async (params, sessionHandler, config) => {
|
|
|
23275
23280
|
subscriptions = [];
|
|
23276
23281
|
}
|
|
23277
23282
|
// default values
|
|
23278
|
-
|
|
23283
|
+
const defaultDeviceId = await getDeviceId();
|
|
23279
23284
|
try {
|
|
23280
|
-
|
|
23281
|
-
|
|
23282
|
-
|
|
23285
|
+
const { users } = await setClientToken(Object.assign(Object.assign({}, params), { displayName: (params === null || params === void 0 ? void 0 : params.displayName) || params.userId, deviceId: (params === null || params === void 0 ? void 0 : params.deviceId) || defaultDeviceId }));
|
|
23286
|
+
const user = users.find(u => u.userId === params.userId);
|
|
23287
|
+
if (user == null) {
|
|
23288
|
+
throw new ASCError(`${params.userId} has not been founded`, 800000 /* Amity.ClientError.UNKNOWN_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
23289
|
+
}
|
|
23290
|
+
if (user.isDeleted) {
|
|
23291
|
+
terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
|
|
23292
|
+
return false;
|
|
23293
|
+
}
|
|
23294
|
+
if (user.isGlobalBanned) {
|
|
23295
|
+
terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
|
|
23296
|
+
return false;
|
|
23297
|
+
}
|
|
23283
23298
|
// FIXME: events are duplicated if connectClient is called few times without disconnectClient
|
|
23284
23299
|
// wire websocket events to our event emitter
|
|
23285
23300
|
proxyWebsocketEvents(client.ws, client.emitter);
|
|
23286
23301
|
client.ws.once('connect', () => {
|
|
23287
23302
|
client.ws.open();
|
|
23288
23303
|
});
|
|
23289
|
-
client.userId =
|
|
23304
|
+
client.userId = user.userId;
|
|
23290
23305
|
client.sessionHandler = sessionHandler;
|
|
23291
23306
|
/*
|
|
23292
23307
|
* Cannot push to subscriptions as watcher needs to continue working even if
|
|
23293
23308
|
* token expires
|
|
23294
23309
|
*/
|
|
23295
|
-
unsubWatcher = client.accessTokenExpiryWatcher((
|
|
23296
|
-
setActiveUser(
|
|
23310
|
+
unsubWatcher = client.accessTokenExpiryWatcher((_a = client.token) === null || _a === void 0 ? void 0 : _a.expiresAt, (_b = client.token) === null || _b === void 0 ? void 0 : _b.issuedAt, sessionHandler);
|
|
23311
|
+
setActiveUser(user);
|
|
23297
23312
|
}
|
|
23298
23313
|
catch (error) {
|
|
23299
23314
|
/*
|
|
@@ -35475,60 +35490,6 @@ const updateComment = async (commentId, patch) => {
|
|
|
35475
35490
|
};
|
|
35476
35491
|
/* end_public_function */
|
|
35477
35492
|
|
|
35478
|
-
const getStoryByStoryId$1 = async (storyId) => {
|
|
35479
|
-
const client = getActiveClient();
|
|
35480
|
-
client.log('story/getStoryByStoryId', storyId);
|
|
35481
|
-
// Get story referenceId from cache
|
|
35482
|
-
const cacheReferenceId = pullFromCache([
|
|
35483
|
-
"story-reference" /* STORY_KEY_CACHE.STORY_ID_TO_REFERENCE_ID */,
|
|
35484
|
-
storyId,
|
|
35485
|
-
]);
|
|
35486
|
-
if (cacheReferenceId === null || cacheReferenceId === void 0 ? void 0 : cacheReferenceId.data) {
|
|
35487
|
-
const { data: referenceId } = cacheReferenceId;
|
|
35488
|
-
isInTombstone('story', referenceId);
|
|
35489
|
-
}
|
|
35490
|
-
let data;
|
|
35491
|
-
try {
|
|
35492
|
-
const response = await client.http.get(`/api/v4/stories/${storyId}`);
|
|
35493
|
-
data = response.data;
|
|
35494
|
-
}
|
|
35495
|
-
catch (error) {
|
|
35496
|
-
if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
|
|
35497
|
-
pushToTombstone('story', storyId);
|
|
35498
|
-
}
|
|
35499
|
-
throw error;
|
|
35500
|
-
}
|
|
35501
|
-
const cachedAt = client.cache && Date.now();
|
|
35502
|
-
if (client.cache) {
|
|
35503
|
-
ingestInCache(data, { cachedAt });
|
|
35504
|
-
}
|
|
35505
|
-
return {
|
|
35506
|
-
data: data.stories[0],
|
|
35507
|
-
cachedAt,
|
|
35508
|
-
};
|
|
35509
|
-
};
|
|
35510
|
-
getStoryByStoryId$1.locally = (storyId) => {
|
|
35511
|
-
const client = getActiveClient();
|
|
35512
|
-
client.log('story/getStorybyStoryId', storyId);
|
|
35513
|
-
// Get story referenceId from cache
|
|
35514
|
-
const cacheReferenceId = pullFromCache([
|
|
35515
|
-
"story-reference" /* STORY_KEY_CACHE.STORY_ID_TO_REFERENCE_ID */,
|
|
35516
|
-
storyId,
|
|
35517
|
-
]);
|
|
35518
|
-
if (cacheReferenceId === null || cacheReferenceId === void 0 ? void 0 : cacheReferenceId.data) {
|
|
35519
|
-
const { data: referenceId } = cacheReferenceId;
|
|
35520
|
-
isInTombstone('story', referenceId);
|
|
35521
|
-
}
|
|
35522
|
-
const cachedAt = client.cache && Date.now();
|
|
35523
|
-
const storyCache = pullFromCache(['story', 'get', storyId]);
|
|
35524
|
-
if (!storyCache)
|
|
35525
|
-
return;
|
|
35526
|
-
return {
|
|
35527
|
-
data: storyCache.data,
|
|
35528
|
-
cachedAt,
|
|
35529
|
-
};
|
|
35530
|
-
};
|
|
35531
|
-
|
|
35532
35493
|
/* begin_public_function
|
|
35533
35494
|
id: comment.soft_delete, comment.hard_delete
|
|
35534
35495
|
*/
|
|
@@ -35558,34 +35519,18 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
35558
35519
|
});
|
|
35559
35520
|
// to support hard deletion
|
|
35560
35521
|
const deleted = Object.assign(Object.assign({}, comment.data), { isDeleted: true });
|
|
35561
|
-
|
|
35562
|
-
|
|
35563
|
-
|
|
35564
|
-
|
|
35565
|
-
|
|
35566
|
-
|
|
35567
|
-
|
|
35568
|
-
|
|
35569
|
-
|
|
35570
|
-
|
|
35571
|
-
|
|
35572
|
-
}
|
|
35573
|
-
else {
|
|
35574
|
-
const post = await getPost$1(comment.data.referenceId);
|
|
35575
|
-
// @TODO: Need to separate Local / MQTT later
|
|
35576
|
-
fireEvent('post.updated', {
|
|
35577
|
-
posts: [post.data],
|
|
35578
|
-
categories: [],
|
|
35579
|
-
comments: [],
|
|
35580
|
-
communities: [],
|
|
35581
|
-
communityUsers: [],
|
|
35582
|
-
feeds: [],
|
|
35583
|
-
files: [],
|
|
35584
|
-
postChildren: [],
|
|
35585
|
-
users: [],
|
|
35586
|
-
});
|
|
35587
|
-
}
|
|
35588
|
-
// @TODO: Need to separate Local / MQTT later
|
|
35522
|
+
const post = await getPost$1(comment.data.referenceId);
|
|
35523
|
+
fireEvent('post.updated', {
|
|
35524
|
+
posts: [post.data],
|
|
35525
|
+
categories: [],
|
|
35526
|
+
comments: [],
|
|
35527
|
+
communities: [],
|
|
35528
|
+
communityUsers: [],
|
|
35529
|
+
feeds: [],
|
|
35530
|
+
files: [],
|
|
35531
|
+
postChildren: [],
|
|
35532
|
+
users: [],
|
|
35533
|
+
});
|
|
35589
35534
|
fireEvent('comment.deleted', {
|
|
35590
35535
|
comments: [deleted],
|
|
35591
35536
|
commentChildren: [],
|
|
@@ -36897,7 +36842,7 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
36897
36842
|
getPoll: getPoll
|
|
36898
36843
|
});
|
|
36899
36844
|
|
|
36900
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
36845
|
+
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-----";
|
|
36901
36846
|
/*
|
|
36902
36847
|
* The crypto algorithm used for importing key and signing string
|
|
36903
36848
|
*/
|
|
@@ -37299,17 +37244,15 @@ const createOptimisticEvent = ({ payload, formData = undefined, isVideo = false,
|
|
|
37299
37244
|
};
|
|
37300
37245
|
|
|
37301
37246
|
// Due to we have optimistic logic, we will use referenceId as a id in SDK instead of storyId
|
|
37302
|
-
const convertRawStoryToInternalStory = (rawData
|
|
37247
|
+
const convertRawStoryToInternalStory = (rawData) => {
|
|
37303
37248
|
const { storyId, referenceId } = rawData;
|
|
37304
|
-
if (
|
|
37305
|
-
|
|
37306
|
-
return Object.assign(Object.assign({}, rawData), { syncState: "synced" /* Amity.SyncState.Synced */ });
|
|
37307
|
-
}
|
|
37249
|
+
if (referenceId)
|
|
37250
|
+
return Object.assign(Object.assign({}, rawData), { syncState: "synced" /* Amity.SyncState.Synced */ });
|
|
37308
37251
|
return Object.assign(Object.assign({}, rawData), { syncState: "synced" /* Amity.SyncState.Synced */, referenceId: storyId });
|
|
37309
37252
|
};
|
|
37310
|
-
const convertStoryRawToInternal = (data
|
|
37253
|
+
const convertStoryRawToInternal = (data) => {
|
|
37311
37254
|
const { stories } = data;
|
|
37312
|
-
const storiesData = stories.map(
|
|
37255
|
+
const storiesData = stories.map(convertRawStoryToInternalStory);
|
|
37313
37256
|
return Object.assign(Object.assign({}, data), { stories: storiesData });
|
|
37314
37257
|
};
|
|
37315
37258
|
|
|
@@ -37629,7 +37572,7 @@ const onStoryCreated = (callback) => {
|
|
|
37629
37572
|
const client = getActiveClient();
|
|
37630
37573
|
const filter = async (payload) => {
|
|
37631
37574
|
// Apply the necessary field for story payload
|
|
37632
|
-
const convertPayload = convertStoryRawToInternal(payload
|
|
37575
|
+
const convertPayload = convertStoryRawToInternal(payload);
|
|
37633
37576
|
ingestInCache(convertPayload);
|
|
37634
37577
|
callback(convertPayload.stories);
|
|
37635
37578
|
};
|
|
@@ -37785,7 +37728,7 @@ const getActiveStoriesByTarget = (params, callback) => {
|
|
|
37785
37728
|
loading: snapshot.loading || false,
|
|
37786
37729
|
});
|
|
37787
37730
|
};
|
|
37788
|
-
const processNewData = (result,
|
|
37731
|
+
const processNewData = (result, initial = false, loading = false, error = false) => {
|
|
37789
37732
|
const cached = pullFromCache(cacheKey);
|
|
37790
37733
|
const data = {
|
|
37791
37734
|
loading,
|
|
@@ -37794,21 +37737,15 @@ const getActiveStoriesByTarget = (params, callback) => {
|
|
|
37794
37737
|
data: (cached === null || cached === void 0 ? void 0 : cached.data) || [],
|
|
37795
37738
|
};
|
|
37796
37739
|
if (result) {
|
|
37797
|
-
|
|
37798
|
-
|
|
37799
|
-
|
|
37800
|
-
}
|
|
37801
|
-
else {
|
|
37802
|
-
data.data = initial
|
|
37803
|
-
? result.map(getResolver('story'))
|
|
37804
|
-
: [...new Set([...data.data, ...result.map(getResolver('story'))])];
|
|
37805
|
-
}
|
|
37740
|
+
data.data = initial
|
|
37741
|
+
? result.map(getResolver('story'))
|
|
37742
|
+
: [...new Set([...data.data, ...result.map(getResolver('story'))])];
|
|
37806
37743
|
}
|
|
37807
37744
|
pushToCache(cacheKey, data.data);
|
|
37808
37745
|
responder(data);
|
|
37809
37746
|
};
|
|
37810
37747
|
const realtimeRouter = (event) => (story) => {
|
|
37811
|
-
processNewData(story
|
|
37748
|
+
processNewData(story);
|
|
37812
37749
|
};
|
|
37813
37750
|
const reloadData = () => (newData) => {
|
|
37814
37751
|
const cached = pullFromCache(cacheKey);
|
|
@@ -37830,17 +37767,71 @@ const getActiveStoriesByTarget = (params, callback) => {
|
|
|
37830
37767
|
const onFetch = (initial) => {
|
|
37831
37768
|
const query = createQuery(getActiveStoriesByTarget$1, params);
|
|
37832
37769
|
runQuery(query, ({ data: result, error, loading }) => {
|
|
37833
|
-
processNewData(result,
|
|
37770
|
+
processNewData(result, initial, loading, error);
|
|
37834
37771
|
});
|
|
37835
37772
|
};
|
|
37836
37773
|
onFetch(true);
|
|
37837
|
-
disposers.push(onStoryCreated(realtimeRouter(
|
|
37774
|
+
disposers.push(onStoryCreated(realtimeRouter()), onStoryUpdated(realtimeRouter()), onStoryDeleted(realtimeRouter()), onStoryReactionAdded(realtimeRouter()), onStoryReactionRemoved(realtimeRouter()), onStoryError(realtimeRouter()), onStoryCreatedLocal(realtimeRouter()), onStoryUpdatedLocal(realtimeRouter()), onStoryDeletedLocal(realtimeRouter()), onStoryReactionAddedLocal(realtimeRouter()), onStoryReactionRemovedLocal(realtimeRouter()), onStoryLocalDataUpdated(reloadData()), () => dropFromCache(cacheKey));
|
|
37838
37775
|
return () => {
|
|
37839
37776
|
log(`getActiveStoriesByTarget(tmpid: ${timestamp}) > dispose`);
|
|
37840
37777
|
disposers.forEach(fn => fn());
|
|
37841
37778
|
};
|
|
37842
37779
|
};
|
|
37843
37780
|
|
|
37781
|
+
const getStoryByStoryId$1 = async (storyId) => {
|
|
37782
|
+
const client = getActiveClient();
|
|
37783
|
+
client.log('story/getStoryByStoryId', storyId);
|
|
37784
|
+
// Get story referenceId from cache
|
|
37785
|
+
const cacheReferenceId = pullFromCache([
|
|
37786
|
+
"story-reference" /* STORY_KEY_CACHE.STORY_ID_TO_REFERENCE_ID */,
|
|
37787
|
+
storyId,
|
|
37788
|
+
]);
|
|
37789
|
+
if (cacheReferenceId === null || cacheReferenceId === void 0 ? void 0 : cacheReferenceId.data) {
|
|
37790
|
+
const { data: referenceId } = cacheReferenceId;
|
|
37791
|
+
isInTombstone('story', referenceId);
|
|
37792
|
+
}
|
|
37793
|
+
let data;
|
|
37794
|
+
try {
|
|
37795
|
+
const response = await client.http.get(`/api/v4/stories/${storyId}`);
|
|
37796
|
+
data = response.data;
|
|
37797
|
+
}
|
|
37798
|
+
catch (error) {
|
|
37799
|
+
if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
|
|
37800
|
+
pushToTombstone('story', storyId);
|
|
37801
|
+
}
|
|
37802
|
+
throw error;
|
|
37803
|
+
}
|
|
37804
|
+
const cachedAt = client.cache && Date.now();
|
|
37805
|
+
if (client.cache) {
|
|
37806
|
+
ingestInCache(data, { cachedAt });
|
|
37807
|
+
}
|
|
37808
|
+
return {
|
|
37809
|
+
data: data.stories[0],
|
|
37810
|
+
cachedAt,
|
|
37811
|
+
};
|
|
37812
|
+
};
|
|
37813
|
+
getStoryByStoryId$1.locally = (storyId) => {
|
|
37814
|
+
const client = getActiveClient();
|
|
37815
|
+
client.log('story/getStorybyStoryId', storyId);
|
|
37816
|
+
// Get story referenceId from cache
|
|
37817
|
+
const cacheReferenceId = pullFromCache([
|
|
37818
|
+
"story-reference" /* STORY_KEY_CACHE.STORY_ID_TO_REFERENCE_ID */,
|
|
37819
|
+
storyId,
|
|
37820
|
+
]);
|
|
37821
|
+
if (cacheReferenceId === null || cacheReferenceId === void 0 ? void 0 : cacheReferenceId.data) {
|
|
37822
|
+
const { data: referenceId } = cacheReferenceId;
|
|
37823
|
+
isInTombstone('story', referenceId);
|
|
37824
|
+
}
|
|
37825
|
+
const cachedAt = client.cache && Date.now();
|
|
37826
|
+
const storyCache = pullFromCache(['story', 'get', storyId]);
|
|
37827
|
+
if (!storyCache)
|
|
37828
|
+
return;
|
|
37829
|
+
return {
|
|
37830
|
+
data: storyCache.data,
|
|
37831
|
+
cachedAt,
|
|
37832
|
+
};
|
|
37833
|
+
};
|
|
37834
|
+
|
|
37844
37835
|
const getSingleItemFromArray = (func) => (callback) => func((result) => callback(result[0]));
|
|
37845
37836
|
const getStoryByStoryId = (storyId, callback) => {
|
|
37846
37837
|
return liveObject(storyId, data => {
|