@amityco/ts-sdk 7.1.1-279cf96.0 → 7.1.1-53d7c83.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/client.d.ts +0 -1
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/client/api/createClient.d.ts +0 -1
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/client/utils/endpoints.d.ts +0 -1
- package/dist/client/utils/endpoints.d.ts.map +1 -1
- package/dist/client/utils/setClientToken.d.ts.map +1 -1
- package/dist/index.cjs.js +6 -16
- package/dist/index.esm.js +6 -16
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
- package/src/@types/domains/client.ts +0 -1
- package/src/client/api/createClient.ts +1 -4
- package/src/client/utils/endpoints.ts +0 -1
- package/src/client/utils/setClientToken.ts +0 -8
- package/src/fileRepository/api/uploadFile.ts +1 -1
- package/src/fileRepository/api/uploadImage.ts +1 -1
- package/src/fileRepository/api/uploadVideo.ts +1 -1
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ export const createClient = (
|
|
|
50
50
|
rteEnabled = true,
|
|
51
51
|
}: {
|
|
52
52
|
debugSession?: string;
|
|
53
|
-
apiEndpoint?: { http?: string; mqtt?: string
|
|
53
|
+
apiEndpoint?: { http?: string; mqtt?: string };
|
|
54
54
|
prefixDeviceIdKey?: string;
|
|
55
55
|
rteEnabled?: boolean;
|
|
56
56
|
} = {},
|
|
@@ -63,11 +63,9 @@ export const createClient = (
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
const httpEndpoint = apiEndpoint?.http ?? computeUrl('http', apiRegion);
|
|
66
|
-
const uploadEndpoint = apiEndpoint?.upload ?? computeUrl('upload', apiRegion);
|
|
67
66
|
const mqttEndpoint = apiEndpoint?.mqtt ?? computeUrl('mqtt', apiRegion);
|
|
68
67
|
|
|
69
68
|
const http = createHttpTransport(httpEndpoint);
|
|
70
|
-
const upload = createHttpTransport(uploadEndpoint);
|
|
71
69
|
|
|
72
70
|
let ws;
|
|
73
71
|
let mqtt;
|
|
@@ -107,7 +105,6 @@ export const createClient = (
|
|
|
107
105
|
http,
|
|
108
106
|
ws,
|
|
109
107
|
mqtt,
|
|
110
|
-
upload,
|
|
111
108
|
emitter,
|
|
112
109
|
|
|
113
110
|
/*
|
|
@@ -30,14 +30,6 @@ export const setClientToken = async (params: Parameters<typeof getToken>[0]) =>
|
|
|
30
30
|
isUserDeleted: false,
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
client.upload.defaults.headers.common.Authorization = `Bearer ${accessToken}`;
|
|
34
|
-
|
|
35
|
-
client.upload.defaults.metadata = {
|
|
36
|
-
tokenExpiry: expiresAt,
|
|
37
|
-
isGlobalBanned: false,
|
|
38
|
-
isUserDeleted: false,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
33
|
// manually setup the token for ws transport
|
|
42
34
|
if (client.ws) client.ws.io.opts.query = { token: accessToken };
|
|
43
35
|
|
|
@@ -42,7 +42,7 @@ export const uploadFile = async <T extends Amity.FileType = any>(
|
|
|
42
42
|
? (formData as any).getHeaders()
|
|
43
43
|
: { 'content-type': 'multipart/form-data' };
|
|
44
44
|
|
|
45
|
-
const { data } = await client.
|
|
45
|
+
const { data } = await client.http.post<Amity.CreateFilePayload<T>>('/api/v4/files', formData, {
|
|
46
46
|
headers,
|
|
47
47
|
onUploadProgress({ loaded, total = 100 }) {
|
|
48
48
|
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
@@ -42,7 +42,7 @@ export const uploadImage = async (
|
|
|
42
42
|
? (formData as any).getHeaders()
|
|
43
43
|
: { 'content-type': 'multipart/form-data' };
|
|
44
44
|
|
|
45
|
-
const { data } = await client.
|
|
45
|
+
const { data } = await client.http.post<Amity.CreateFilePayload<'image'>>(
|
|
46
46
|
'/api/v4/images',
|
|
47
47
|
formData,
|
|
48
48
|
{
|
|
@@ -48,7 +48,7 @@ export const uploadVideo = async (
|
|
|
48
48
|
? (formData as any).getHeaders()
|
|
49
49
|
: { 'content-type': 'multipart/form-data' };
|
|
50
50
|
|
|
51
|
-
const { data } = await client.
|
|
51
|
+
const { data } = await client.http.post<Amity.CreateFilePayload<'video'>>(
|
|
52
52
|
'/api/v4/videos',
|
|
53
53
|
formData,
|
|
54
54
|
{
|