@amityco/ts-sdk 7.33.1-37a3a70.0 → 7.33.1-3b1a9bbf.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.
@@ -9,10 +9,11 @@
9
9
  * @param formData The data necessary to create a new {@link Amity.File<'image'>}
10
10
  * @param onProgress The callback to track the upload progress
11
11
  * @param altText The alt text for the image
12
+ * @param isFullImage Keeps the original image so `size=full` returns it instead of the large copy
12
13
  * @returns The newly created {@link Amity.File<'image'>}
13
14
  *
14
15
  * @category File API
15
16
  * @async
16
17
  */
17
- export declare const uploadImage: (formData: FormData, onProgress?: ((percent: number) => void) | undefined, altText?: string) => Promise<Amity.Cached<Amity.File<'image'>[]>>;
18
+ export declare const uploadImage: (formData: FormData, onProgress?: ((percent: number) => void) | undefined, altText?: string, isFullImage?: boolean) => Promise<Amity.Cached<Amity.File<'image'>[]>>;
18
19
  //# sourceMappingURL=uploadImage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uploadImage.d.ts","sourceRoot":"","sources":["../../../src/fileRepository/api/uploadImage.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,WAAW,aACZ,QAAQ,0BACK,MAAM,KAAK,IAAI,yBAC5B,MAAM,KACf,QAAQ,MAAM,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAuD7C,CAAC"}
1
+ {"version":3,"file":"uploadImage.d.ts","sourceRoot":"","sources":["../../../src/fileRepository/api/uploadImage.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,WAAW,aACZ,QAAQ,0BACK,MAAM,KAAK,IAAI,yBAC5B,MAAM,gBACF,OAAO,KACpB,QAAQ,MAAM,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CA4D7C,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -17637,12 +17637,13 @@ const uploadVideo = async (formData, feedType, onProgress) => {
17637
17637
  * @param formData The data necessary to create a new {@link Amity.File<'image'>}
17638
17638
  * @param onProgress The callback to track the upload progress
17639
17639
  * @param altText The alt text for the image
17640
+ * @param isFullImage Keeps the original image so `size=full` returns it instead of the large copy
17640
17641
  * @returns The newly created {@link Amity.File<'image'>}
17641
17642
  *
17642
17643
  * @category File API
17643
17644
  * @async
17644
17645
  */
17645
- const uploadImage = async (formData, onProgress, altText) => {
17646
+ const uploadImage = async (formData, onProgress, altText, isFullImage) => {
17646
17647
  const client = getActiveClient();
17647
17648
  client.log('file/uploadImage', formData);
17648
17649
  const files = formData.getAll('files');
@@ -17663,6 +17664,10 @@ const uploadImage = async (formData, onProgress, altText) => {
17663
17664
  }
17664
17665
  const accessType = GlobalFileAccessType$1.getInstance().getFileAccessType();
17665
17666
  formData.append('accessType', accessType);
17667
+ // skip if the caller already appended it, so the old FormData workaround keeps working
17668
+ if (isFullImage && !formData.getAll('fullImage').length) {
17669
+ formData.append('fullImage', 'true');
17670
+ }
17666
17671
  const headers = 'getHeaders' in formData
17667
17672
  ? formData.getHeaders()
17668
17673
  : { 'content-type': 'multipart/form-data' };
package/dist/index.esm.js CHANGED
@@ -17637,12 +17637,13 @@ const uploadVideo = async (formData, feedType, onProgress) => {
17637
17637
  * @param formData The data necessary to create a new {@link Amity.File<'image'>}
17638
17638
  * @param onProgress The callback to track the upload progress
17639
17639
  * @param altText The alt text for the image
17640
+ * @param isFullImage Keeps the original image so `size=full` returns it instead of the large copy
17640
17641
  * @returns The newly created {@link Amity.File<'image'>}
17641
17642
  *
17642
17643
  * @category File API
17643
17644
  * @async
17644
17645
  */
17645
- const uploadImage = async (formData, onProgress, altText) => {
17646
+ const uploadImage = async (formData, onProgress, altText, isFullImage) => {
17646
17647
  const client = getActiveClient();
17647
17648
  client.log('file/uploadImage', formData);
17648
17649
  const files = formData.getAll('files');
@@ -17663,6 +17664,10 @@ const uploadImage = async (formData, onProgress, altText) => {
17663
17664
  }
17664
17665
  const accessType = GlobalFileAccessType$1.getInstance().getFileAccessType();
17665
17666
  formData.append('accessType', accessType);
17667
+ // skip if the caller already appended it, so the old FormData workaround keeps working
17668
+ if (isFullImage && !formData.getAll('fullImage').length) {
17669
+ formData.append('fullImage', 'true');
17670
+ }
17666
17671
  const headers = 'getHeaders' in formData
17667
17672
  ? formData.getHeaders()
17668
17673
  : { 'content-type': 'multipart/form-data' };