@amityco/ts-sdk 0.0.1-44bbdcd.0 → 0.0.1-4fb63bf.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.
@@ -13,7 +13,7 @@
13
13
  * @async
14
14
  **/
15
15
  export declare const queryGlobalFeed: (query?: {
16
- dataTypes?: ("video" | "image" | "file")[] | undefined;
16
+ dataTypes?: ("video" | "image" | "file" | "liveStream")[] | undefined;
17
17
  page?: Amity.Page | undefined;
18
18
  } | undefined) => Promise<{
19
19
  data: Record<string, Amity.Post<any>>;
@@ -12,5 +12,7 @@
12
12
  * @category File API
13
13
  * @async
14
14
  */
15
- export declare const deleteFile: (fileId: Amity.File<any>['fileId']) => Promise<boolean>;
15
+ export declare const deleteFile: (fileId: Amity.File<any>['fileId']) => Promise<{
16
+ success: boolean;
17
+ }>;
16
18
  //# sourceMappingURL=deleteFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deleteFile.d.ts","sourceRoot":"","sources":["../../../src/file/api/deleteFile.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,WACb,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,qBAelC,CAAA"}
1
+ {"version":3,"file":"deleteFile.d.ts","sourceRoot":"","sources":["../../../src/file/api/deleteFile.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,WACb,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;;EAclC,CAAA"}
package/dist/index.cjs.js CHANGED
@@ -1813,11 +1813,10 @@ const createFile = async (formData, onProgress) => {
1813
1813
  const deleteFile = async (fileId) => {
1814
1814
  const client = getActiveClient();
1815
1815
  client.log('file/deleteFile', fileId);
1816
+ // API-FIX: payload is different than swagger docs!!
1816
1817
  const { data } = await client.http.delete(`/api/v3/files/${fileId}`);
1817
- const { success } = data;
1818
- if (success)
1819
- mergeInCache('file', { fileId, isDeleted: true });
1820
- return success;
1818
+ dropFromCache('file', { fileId: data.fileId });
1819
+ return { success: true };
1821
1820
  };
1822
1821
 
1823
1822
  /**
package/dist/index.esm.js CHANGED
@@ -1799,11 +1799,10 @@ const createFile = async (formData, onProgress) => {
1799
1799
  const deleteFile = async (fileId) => {
1800
1800
  const client = getActiveClient();
1801
1801
  client.log('file/deleteFile', fileId);
1802
+ // API-FIX: payload is different than swagger docs!!
1802
1803
  const { data } = await client.http.delete(`/api/v3/files/${fileId}`);
1803
- const { success } = data;
1804
- if (success)
1805
- mergeInCache('file', { fileId, isDeleted: true });
1806
- return success;
1804
+ dropFromCache('file', { fileId: data.fileId });
1805
+ return { success: true };
1807
1806
  };
1808
1807
 
1809
1808
  /**
package/dist/index.umd.js CHANGED
@@ -1803,11 +1803,10 @@ var Amity = (function (exports, jsBase64, nativeIdGenerator, debug, axios, HttpA
1803
1803
  const deleteFile = async (fileId) => {
1804
1804
  const client = getActiveClient();
1805
1805
  client.log('file/deleteFile', fileId);
1806
+ // API-FIX: payload is different than swagger docs!!
1806
1807
  const { data } = await client.http.delete(`/api/v3/files/${fileId}`);
1807
- const { success } = data;
1808
- if (success)
1809
- mergeInCache('file', { fileId, isDeleted: true });
1810
- return success;
1808
+ dropFromCache('file', { fileId: data.fileId });
1809
+ return { success: true };
1811
1810
  };
1812
1811
 
1813
1812
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "0.0.1-44bbdcd.0",
3
+ "version": "0.0.1-4fb63bf.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -19,7 +19,7 @@ import { decoratePayload, toPage, toToken } from '~/core/query'
19
19
  * @async
20
20
  **/
21
21
  export const queryGlobalFeed = async (query?: {
22
- dataTypes?: ('video' | 'image' | 'file')[]
22
+ dataTypes?: ('video' | 'image' | 'file' | 'liveStream')[]
23
23
  page?: Amity.Page
24
24
  }) => {
25
25
  const client = getActiveClient()
@@ -1,6 +1,6 @@
1
1
  import { getActiveClient } from '~/client/api'
2
2
 
3
- import { mergeInCache } from '~/core/cache'
3
+ import { dropFromCache } from '~/core/cache'
4
4
 
5
5
  /**
6
6
  * ```js
@@ -22,14 +22,13 @@ export const deleteFile = async (
22
22
  const client = getActiveClient()
23
23
  client.log('file/deleteFile', fileId)
24
24
 
25
- const { data } = await client.http.delete<{ success: boolean }>(
25
+ // API-FIX: payload is different than swagger docs!!
26
+ const { data } = await client.http.delete<{ fileId: string }>(
26
27
  `/api/v3/files/${fileId}`,
27
28
  )
28
29
 
29
- const { success } = data
30
+ dropFromCache('file', {fileId: data.fileId})
30
31
 
31
- if (success)
32
- mergeInCache('file', { fileId, isDeleted: true })
33
32
 
34
- return success
33
+ return { success: true }
35
34
  }