@amityco/ts-sdk-react-native 7.26.1-30c953a9.0 → 7.26.1-9f3ac9f9.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.
@@ -38,7 +38,12 @@ declare global {
38
38
  fileId?: Amity.File<'image'>['fileId'];
39
39
  };
40
40
  type ContentDataVideo = {
41
- thumbnailFileId: Amity.File<'image'>['fileId'];
41
+ /**
42
+ * Null until the server has finished transcoding the video: the field is
43
+ * always present, so a presence test such as `'thumbnailFileId' in data`
44
+ * says nothing about whether the id can be used. Read it as a value.
45
+ */
46
+ thumbnailFileId: Amity.File<'image'>['fileId'] | null;
42
47
  videoFileId: {
43
48
  [K in Amity.VideoSize]?: Amity.File<'video'>['fileId'];
44
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AAEH,oBAAY,qBAAqB;IAC/B,mBAAmB,iCAAiC;IACpD,oBAAoB,2BAA2B;IAC/C,iBAAiB,yBAAyB;IAC1C,4BAA4B,oCAAoC;IAChE,sBAAsB,2CAA2C;IACjE,qBAAqB,6BAA6B;IAClD,WAAW,kBAAkB;IAC7B,gBAAgB,wCAAwC;IACxD,MAAM,WAAW;CAClB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,iBAAiB,GAClB,OAAO,CAAC,GAAG,qBAAqB,EAAE,EAAE,GAAG,qBAAqB,CAAC,MAAM,EAAE,CAAC,GACtE,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAElB,KAAK,WAAW,GACZ,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,YAAY,GACZ,MAAM,GACN,OAAO,GACP,MAAM,CAAC;QAEX,KAAK,eAAe,GAAG,OAAO,CAAC,OAAO,eAAe,CAAC,C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GAChB,eAAe,GACf,CAAC,SAAS,MAAM,GAChB,eAAe,GACf,CAAC,SAAS,OAAO,GACjB,gBAAgB,GAChB,CAAC,SAAS,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,CAAC,SAAS,MAAM,GAChB,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,KAAK,CAAC;QAEV,KAAK,OAAO,CAAC,CAAC,SAAS,WAAW,IAAI;YAEpC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACb,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC;YAChB,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;SACvB,CAAC;QAEF,KAAK,kBAAkB,GAAG;YACxB,WAAW,EAAE,MAAM,CAAC;YACpB,OAAO,EAAE,OAAO,CAAC;SAClB,CAAC;QAEF,KAAK,mBAAmB,GAAG;YACzB,WAAW,EAAE,OAAO,CAAC;YACrB,OAAO,EAAE,OAAO,CAAC;YACjB,kBAAkB,EAAE,MAAM,CAAC;YAC3B,eAAe,EAAE;gBACf,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;gBACrC,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;aACtC,CAAC;SACH,CAAC;QAEF,KAAK,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,MAAM,GAAG,OAAO,IAAI,CAAC,SAAS,MAAM,GAC5E,kBAAkB,GAClB,CAAC,SAAS,OAAO,GACjB,mBAAmB,GACnB,KAAK,CAAC;KACX;CACF"}
package/dist/index.cjs.js CHANGED
@@ -13151,6 +13151,11 @@ const postLinkedObject = (post) => {
13151
13151
  .filter(Boolean) || []);
13152
13152
  },
13153
13153
  get creator() {
13154
+ // The id is checked for a value, not just for presence: a payload can
13155
+ // carry the field as null, and a null segment in a cache key throws
13156
+ // while encoding it rather than simply missing the cache.
13157
+ if (!post.postedUserId)
13158
+ return;
13154
13159
  const cacheData = pullFromCache(['user', 'get', post.postedUserId]);
13155
13160
  if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
13156
13161
  return;
@@ -13158,6 +13163,8 @@ const postLinkedObject = (post) => {
13158
13163
  },
13159
13164
  get targetCommunity() {
13160
13165
  var _a;
13166
+ if (!post.targetId)
13167
+ return;
13161
13168
  const communityCache = (_a = pullFromCache([
13162
13169
  'community',
13163
13170
  'get',
@@ -13169,36 +13176,43 @@ const postLinkedObject = (post) => {
13169
13176
  },
13170
13177
  getImageInfo() {
13171
13178
  var _a, _b;
13172
- return isAmityImagePost(post)
13173
- ? fileLinkedObject((_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data)
13174
- : undefined;
13179
+ if (!isAmityImagePost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13180
+ return undefined;
13181
+ return fileLinkedObject((_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data);
13175
13182
  },
13176
13183
  getVideoInfo() {
13177
13184
  var _a, _b, _c;
13178
- return isAmityVideoPost(post)
13179
- ? fileLinkedObject((_c = pullFromCache(['file', 'get', (_b = (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.videoFileId) === null || _b === void 0 ? void 0 : _b.original])) === null || _c === void 0 ? void 0 : _c.data)
13180
- : undefined;
13185
+ const originalFileId = isAmityVideoPost(post) ? (_b = (_a = post.data) === null || _a === void 0 ? void 0 : _a.videoFileId) === null || _b === void 0 ? void 0 : _b.original : undefined;
13186
+ if (!originalFileId)
13187
+ return undefined;
13188
+ return fileLinkedObject((_c = pullFromCache(['file', 'get', originalFileId])) === null || _c === void 0 ? void 0 : _c.data);
13181
13189
  },
13182
13190
  getVideoThumbnailInfo() {
13183
13191
  var _a, _b;
13184
- return isAmityVideoPost(post)
13185
- ? fileLinkedObject((_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.thumbnailFileId])) === null || _b === void 0 ? void 0 : _b.data)
13186
- : undefined;
13192
+ // `isAmityVideoPost` proves the field is *present* — it tests
13193
+ // `'thumbnailFileId' in post.data` and presence is not a value. The
13194
+ // server sends the field as null until it has finished transcoding the
13195
+ // video, so a just-published post reaches here with a null id and used
13196
+ // to build the cache key ['file', 'get', null].
13197
+ const thumbnailFileId = isAmityVideoPost(post) ? (_a = post.data) === null || _a === void 0 ? void 0 : _a.thumbnailFileId : undefined;
13198
+ if (!thumbnailFileId)
13199
+ return undefined;
13200
+ return fileLinkedObject((_b = pullFromCache(['file', 'get', thumbnailFileId])) === null || _b === void 0 ? void 0 : _b.data);
13187
13201
  },
13188
13202
  getFileInfo() {
13189
13203
  var _a, _b;
13190
- return isAmityFilePost(post)
13191
- ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
13192
- : undefined;
13204
+ if (!isAmityFilePost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13205
+ return undefined;
13206
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13193
13207
  },
13194
13208
  getLivestreamInfo() {
13195
13209
  var _a, _b;
13196
- if (!isAmityLivestreamPost(post))
13210
+ if (!isAmityLivestreamPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.streamId))
13197
13211
  return;
13198
13212
  const cache = (_b = pullFromCache([
13199
13213
  'stream',
13200
13214
  'get',
13201
- (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.streamId,
13215
+ post.data.streamId,
13202
13216
  ])) === null || _b === void 0 ? void 0 : _b.data;
13203
13217
  if (!cache)
13204
13218
  return;
@@ -13206,30 +13220,30 @@ const postLinkedObject = (post) => {
13206
13220
  },
13207
13221
  getPollInfo() {
13208
13222
  var _a, _b;
13209
- if (!isAmityPollPost(post))
13223
+ if (!isAmityPollPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.pollId))
13210
13224
  return;
13211
- const cache = (_b = pullFromCache(['poll', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.pollId])) === null || _b === void 0 ? void 0 : _b.data;
13225
+ const cache = (_b = pullFromCache(['poll', 'get', post.data.pollId])) === null || _b === void 0 ? void 0 : _b.data;
13212
13226
  if (!cache)
13213
13227
  return;
13214
13228
  return pollLinkedObject(cache);
13215
13229
  },
13216
13230
  getClipInfo() {
13217
13231
  var _a, _b;
13218
- return isAmityClipPost(post)
13219
- ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
13220
- : undefined;
13232
+ if (!isAmityClipPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13233
+ return undefined;
13234
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13221
13235
  },
13222
13236
  getAudioInfo() {
13223
13237
  var _a, _b;
13224
- return isAmityAudioPost(post)
13225
- ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
13226
- : undefined;
13238
+ if (!isAmityAudioPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13239
+ return undefined;
13240
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13227
13241
  },
13228
13242
  getRoomInfo() {
13229
13243
  var _a, _b;
13230
- if (!isAmityRoomPost(post))
13244
+ if (!isAmityRoomPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.roomId))
13231
13245
  return;
13232
- 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;
13246
+ const room = (_b = pullFromCache(['room', 'get', post.data.roomId])) === null || _b === void 0 ? void 0 : _b.data;
13233
13247
  return room ? roomLinkedObject(room) : undefined;
13234
13248
  },
13235
13249
  getEventInfo() {
@@ -13258,6 +13272,8 @@ const postLinkedObject = (post) => {
13258
13272
  // full linked-object surface — including RSVP methods and `event.post` —
13259
13273
  // is available via EventRepository.getEvent(eventId).
13260
13274
  return Object.assign(Object.assign({}, event), { get creator() {
13275
+ if (!event.userId)
13276
+ return undefined;
13261
13277
  const cacheData = pullFromCache(['user', 'get', event.userId]);
13262
13278
  if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
13263
13279
  return undefined;
package/dist/index.esm.js CHANGED
@@ -13132,6 +13132,11 @@ const postLinkedObject = (post) => {
13132
13132
  .filter(Boolean) || []);
13133
13133
  },
13134
13134
  get creator() {
13135
+ // The id is checked for a value, not just for presence: a payload can
13136
+ // carry the field as null, and a null segment in a cache key throws
13137
+ // while encoding it rather than simply missing the cache.
13138
+ if (!post.postedUserId)
13139
+ return;
13135
13140
  const cacheData = pullFromCache(['user', 'get', post.postedUserId]);
13136
13141
  if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
13137
13142
  return;
@@ -13139,6 +13144,8 @@ const postLinkedObject = (post) => {
13139
13144
  },
13140
13145
  get targetCommunity() {
13141
13146
  var _a;
13147
+ if (!post.targetId)
13148
+ return;
13142
13149
  const communityCache = (_a = pullFromCache([
13143
13150
  'community',
13144
13151
  'get',
@@ -13150,36 +13157,43 @@ const postLinkedObject = (post) => {
13150
13157
  },
13151
13158
  getImageInfo() {
13152
13159
  var _a, _b;
13153
- return isAmityImagePost(post)
13154
- ? fileLinkedObject((_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data)
13155
- : undefined;
13160
+ if (!isAmityImagePost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13161
+ return undefined;
13162
+ return fileLinkedObject((_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data);
13156
13163
  },
13157
13164
  getVideoInfo() {
13158
13165
  var _a, _b, _c;
13159
- return isAmityVideoPost(post)
13160
- ? fileLinkedObject((_c = pullFromCache(['file', 'get', (_b = (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.videoFileId) === null || _b === void 0 ? void 0 : _b.original])) === null || _c === void 0 ? void 0 : _c.data)
13161
- : undefined;
13166
+ const originalFileId = isAmityVideoPost(post) ? (_b = (_a = post.data) === null || _a === void 0 ? void 0 : _a.videoFileId) === null || _b === void 0 ? void 0 : _b.original : undefined;
13167
+ if (!originalFileId)
13168
+ return undefined;
13169
+ return fileLinkedObject((_c = pullFromCache(['file', 'get', originalFileId])) === null || _c === void 0 ? void 0 : _c.data);
13162
13170
  },
13163
13171
  getVideoThumbnailInfo() {
13164
13172
  var _a, _b;
13165
- return isAmityVideoPost(post)
13166
- ? fileLinkedObject((_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.thumbnailFileId])) === null || _b === void 0 ? void 0 : _b.data)
13167
- : undefined;
13173
+ // `isAmityVideoPost` proves the field is *present* — it tests
13174
+ // `'thumbnailFileId' in post.data` and presence is not a value. The
13175
+ // server sends the field as null until it has finished transcoding the
13176
+ // video, so a just-published post reaches here with a null id and used
13177
+ // to build the cache key ['file', 'get', null].
13178
+ const thumbnailFileId = isAmityVideoPost(post) ? (_a = post.data) === null || _a === void 0 ? void 0 : _a.thumbnailFileId : undefined;
13179
+ if (!thumbnailFileId)
13180
+ return undefined;
13181
+ return fileLinkedObject((_b = pullFromCache(['file', 'get', thumbnailFileId])) === null || _b === void 0 ? void 0 : _b.data);
13168
13182
  },
13169
13183
  getFileInfo() {
13170
13184
  var _a, _b;
13171
- return isAmityFilePost(post)
13172
- ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
13173
- : undefined;
13185
+ if (!isAmityFilePost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13186
+ return undefined;
13187
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13174
13188
  },
13175
13189
  getLivestreamInfo() {
13176
13190
  var _a, _b;
13177
- if (!isAmityLivestreamPost(post))
13191
+ if (!isAmityLivestreamPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.streamId))
13178
13192
  return;
13179
13193
  const cache = (_b = pullFromCache([
13180
13194
  'stream',
13181
13195
  'get',
13182
- (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.streamId,
13196
+ post.data.streamId,
13183
13197
  ])) === null || _b === void 0 ? void 0 : _b.data;
13184
13198
  if (!cache)
13185
13199
  return;
@@ -13187,30 +13201,30 @@ const postLinkedObject = (post) => {
13187
13201
  },
13188
13202
  getPollInfo() {
13189
13203
  var _a, _b;
13190
- if (!isAmityPollPost(post))
13204
+ if (!isAmityPollPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.pollId))
13191
13205
  return;
13192
- const cache = (_b = pullFromCache(['poll', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.pollId])) === null || _b === void 0 ? void 0 : _b.data;
13206
+ const cache = (_b = pullFromCache(['poll', 'get', post.data.pollId])) === null || _b === void 0 ? void 0 : _b.data;
13193
13207
  if (!cache)
13194
13208
  return;
13195
13209
  return pollLinkedObject(cache);
13196
13210
  },
13197
13211
  getClipInfo() {
13198
13212
  var _a, _b;
13199
- return isAmityClipPost(post)
13200
- ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
13201
- : undefined;
13213
+ if (!isAmityClipPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13214
+ return undefined;
13215
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13202
13216
  },
13203
13217
  getAudioInfo() {
13204
13218
  var _a, _b;
13205
- return isAmityAudioPost(post)
13206
- ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
13207
- : undefined;
13219
+ if (!isAmityAudioPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.fileId))
13220
+ return undefined;
13221
+ return (_b = pullFromCache(['file', 'get', post.data.fileId])) === null || _b === void 0 ? void 0 : _b.data;
13208
13222
  },
13209
13223
  getRoomInfo() {
13210
13224
  var _a, _b;
13211
- if (!isAmityRoomPost(post))
13225
+ if (!isAmityRoomPost(post) || !((_a = post.data) === null || _a === void 0 ? void 0 : _a.roomId))
13212
13226
  return;
13213
- 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;
13227
+ const room = (_b = pullFromCache(['room', 'get', post.data.roomId])) === null || _b === void 0 ? void 0 : _b.data;
13214
13228
  return room ? roomLinkedObject(room) : undefined;
13215
13229
  },
13216
13230
  getEventInfo() {
@@ -13239,6 +13253,8 @@ const postLinkedObject = (post) => {
13239
13253
  // full linked-object surface — including RSVP methods and `event.post` —
13240
13254
  // is available via EventRepository.getEvent(eventId).
13241
13255
  return Object.assign(Object.assign({}, event), { get creator() {
13256
+ if (!event.userId)
13257
+ return undefined;
13242
13258
  const cacheData = pullFromCache(['user', 'get', event.userId]);
13243
13259
  if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
13244
13260
  return undefined;