@expressms/smartapp-sdk 1.9.0-alpha.0 → 1.9.0-alpha.1
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/build/main/lib/client/file.d.ts +8 -8
- package/build/main/lib/client/file.js +13 -9
- package/build/main/types/client.d.ts +17 -1
- package/build/module/lib/client/file.d.ts +8 -8
- package/build/module/lib/client/file.js +14 -10
- package/build/module/types/client.d.ts +17 -1
- package/build/umd/index.js +12 -8
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { File } from '../../types';
|
|
1
|
+
import { File, StatusResponse, UploadFileTypeResponse, UploadFilesTypeResponse } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Download and open single file with client
|
|
4
4
|
* @param file File data to be opened
|
|
5
5
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
6
6
|
*/
|
|
7
|
-
declare const openFile: (file: File) => Promise<
|
|
7
|
+
declare const openFile: (file: File) => Promise<StatusResponse>;
|
|
8
8
|
/**
|
|
9
9
|
* Download file list with client
|
|
10
10
|
* @param files Files list to be opened
|
|
11
11
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
12
12
|
*/
|
|
13
|
-
declare const openFiles: (files: File[]) => Promise<
|
|
13
|
+
declare const openFiles: (files: File[]) => Promise<StatusResponse>;
|
|
14
14
|
/**
|
|
15
15
|
* Upload single file with client
|
|
16
16
|
* @param mimeType Mime type of allowed files
|
|
17
17
|
* @param maxSize Max file size in bytes
|
|
18
18
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
19
19
|
*/
|
|
20
|
-
declare const uploadFile: ({ mimeType, maxSize }: {
|
|
20
|
+
declare const uploadFile: ({ mimeType, maxSize, }: {
|
|
21
21
|
mimeType: string;
|
|
22
22
|
maxSize?: number | undefined;
|
|
23
|
-
}) => Promise<
|
|
23
|
+
}) => Promise<UploadFileTypeResponse>;
|
|
24
24
|
/**
|
|
25
25
|
* Upload files list with client
|
|
26
26
|
* @param mimeType Mime type of allowed files
|
|
27
27
|
* @param maxSize Max file size in bytes
|
|
28
28
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
29
29
|
*/
|
|
30
|
-
declare const uploadFiles: ({ mimeType, maxSize }: {
|
|
30
|
+
declare const uploadFiles: ({ mimeType, maxSize, }: {
|
|
31
31
|
mimeType: string;
|
|
32
32
|
maxSize?: number | undefined;
|
|
33
|
-
}) => Promise<
|
|
34
|
-
export { openFile, openFiles, uploadFile, uploadFiles
|
|
33
|
+
}) => Promise<UploadFilesTypeResponse>;
|
|
34
|
+
export { openFile, openFiles, uploadFile, uploadFiles };
|
|
@@ -11,13 +11,14 @@ const types_1 = require("../../types");
|
|
|
11
11
|
* @param file File data to be opened
|
|
12
12
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
13
13
|
*/
|
|
14
|
-
const openFile = (file) => {
|
|
14
|
+
const openFile = async (file) => {
|
|
15
15
|
if (!smartapp_bridge_1.default)
|
|
16
16
|
return Promise.reject(types_1.ERROR_CODES.NO_BRIDGE);
|
|
17
|
-
|
|
17
|
+
const response = await smartapp_bridge_1.default.sendClientEvent({
|
|
18
18
|
method: types_1.METHODS.OPEN_FILE,
|
|
19
19
|
params: file,
|
|
20
20
|
});
|
|
21
|
+
return response;
|
|
21
22
|
};
|
|
22
23
|
exports.openFile = openFile;
|
|
23
24
|
/**
|
|
@@ -25,13 +26,14 @@ exports.openFile = openFile;
|
|
|
25
26
|
* @param files Files list to be opened
|
|
26
27
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
27
28
|
*/
|
|
28
|
-
const openFiles = (files) => {
|
|
29
|
+
const openFiles = async (files) => {
|
|
29
30
|
if (!smartapp_bridge_1.default)
|
|
30
31
|
return Promise.reject(types_1.ERROR_CODES.NO_BRIDGE);
|
|
31
|
-
|
|
32
|
+
const response = await smartapp_bridge_1.default.sendClientEvent({
|
|
32
33
|
method: types_1.METHODS.OPEN_FILES,
|
|
33
34
|
params: files,
|
|
34
35
|
});
|
|
36
|
+
return response;
|
|
35
37
|
};
|
|
36
38
|
exports.openFiles = openFiles;
|
|
37
39
|
/**
|
|
@@ -40,16 +42,17 @@ exports.openFiles = openFiles;
|
|
|
40
42
|
* @param maxSize Max file size in bytes
|
|
41
43
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
42
44
|
*/
|
|
43
|
-
const uploadFile = ({ mimeType, maxSize }) => {
|
|
45
|
+
const uploadFile = async ({ mimeType, maxSize, }) => {
|
|
44
46
|
if (!smartapp_bridge_1.default)
|
|
45
47
|
return Promise.reject(types_1.ERROR_CODES.NO_BRIDGE);
|
|
46
|
-
|
|
48
|
+
const response = await smartapp_bridge_1.default.sendClientEvent({
|
|
47
49
|
method: types_1.METHODS.UPLOAD_FILE,
|
|
48
50
|
params: {
|
|
49
51
|
type: mimeType,
|
|
50
52
|
maxSize,
|
|
51
53
|
},
|
|
52
54
|
});
|
|
55
|
+
return response;
|
|
53
56
|
};
|
|
54
57
|
exports.uploadFile = uploadFile;
|
|
55
58
|
/**
|
|
@@ -58,16 +61,17 @@ exports.uploadFile = uploadFile;
|
|
|
58
61
|
* @param maxSize Max file size in bytes
|
|
59
62
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
60
63
|
*/
|
|
61
|
-
const uploadFiles = ({ mimeType, maxSize }) => {
|
|
64
|
+
const uploadFiles = async ({ mimeType, maxSize, }) => {
|
|
62
65
|
if (!smartapp_bridge_1.default)
|
|
63
66
|
return Promise.reject(types_1.ERROR_CODES.NO_BRIDGE);
|
|
64
|
-
|
|
67
|
+
const response = await smartapp_bridge_1.default.sendClientEvent({
|
|
65
68
|
method: types_1.METHODS.UPLOAD_FILES,
|
|
66
69
|
params: {
|
|
67
70
|
type: mimeType,
|
|
68
71
|
maxSize,
|
|
69
72
|
},
|
|
70
73
|
});
|
|
74
|
+
return response;
|
|
71
75
|
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1
|
import { EmitterEventPayload } from '@expressms/smartapp-bridge/build/main/types/eventEmitter';
|
|
2
|
-
import { STATUS } from './bridge';
|
|
2
|
+
import { File, STATUS } from './bridge';
|
|
3
3
|
export declare enum SubscriptionEventType {
|
|
4
4
|
CONNECTION_STATUS = "connection_status",
|
|
5
5
|
UNREAD_COUNTER_CHANGE = "unread_counter_change",
|
|
@@ -56,3 +56,19 @@ export type GetLayoutTypeResponse = {
|
|
|
56
56
|
layoutType: "minimal" | "full" | "half";
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
export type UploadFileTypeResponse = {
|
|
60
|
+
ref: string;
|
|
61
|
+
payload: {
|
|
62
|
+
status: STATUS;
|
|
63
|
+
errorCode?: string | null;
|
|
64
|
+
record: File;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type UploadFilesTypeResponse = {
|
|
68
|
+
ref: string;
|
|
69
|
+
payload: {
|
|
70
|
+
status: STATUS;
|
|
71
|
+
errorCode?: string | null;
|
|
72
|
+
records: File[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { File } from '../../types';
|
|
1
|
+
import { File, StatusResponse, UploadFileTypeResponse, UploadFilesTypeResponse } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Download and open single file with client
|
|
4
4
|
* @param file File data to be opened
|
|
5
5
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
6
6
|
*/
|
|
7
|
-
declare const openFile: (file: File) => Promise<
|
|
7
|
+
declare const openFile: (file: File) => Promise<StatusResponse>;
|
|
8
8
|
/**
|
|
9
9
|
* Download file list with client
|
|
10
10
|
* @param files Files list to be opened
|
|
11
11
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
12
12
|
*/
|
|
13
|
-
declare const openFiles: (files: File[]) => Promise<
|
|
13
|
+
declare const openFiles: (files: File[]) => Promise<StatusResponse>;
|
|
14
14
|
/**
|
|
15
15
|
* Upload single file with client
|
|
16
16
|
* @param mimeType Mime type of allowed files
|
|
17
17
|
* @param maxSize Max file size in bytes
|
|
18
18
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
19
19
|
*/
|
|
20
|
-
declare const uploadFile: ({ mimeType, maxSize }: {
|
|
20
|
+
declare const uploadFile: ({ mimeType, maxSize, }: {
|
|
21
21
|
mimeType: string;
|
|
22
22
|
maxSize?: number | undefined;
|
|
23
|
-
}) => Promise<
|
|
23
|
+
}) => Promise<UploadFileTypeResponse>;
|
|
24
24
|
/**
|
|
25
25
|
* Upload files list with client
|
|
26
26
|
* @param mimeType Mime type of allowed files
|
|
27
27
|
* @param maxSize Max file size in bytes
|
|
28
28
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
29
29
|
*/
|
|
30
|
-
declare const uploadFiles: ({ mimeType, maxSize }: {
|
|
30
|
+
declare const uploadFiles: ({ mimeType, maxSize, }: {
|
|
31
31
|
mimeType: string;
|
|
32
32
|
maxSize?: number | undefined;
|
|
33
|
-
}) => Promise<
|
|
34
|
-
export { openFile, openFiles, uploadFile, uploadFiles
|
|
33
|
+
}) => Promise<UploadFilesTypeResponse>;
|
|
34
|
+
export { openFile, openFiles, uploadFile, uploadFiles };
|
|
@@ -5,26 +5,28 @@ import { ERROR_CODES, METHODS, } from '../../types';
|
|
|
5
5
|
* @param file File data to be opened
|
|
6
6
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
7
7
|
*/
|
|
8
|
-
const openFile = (file) => {
|
|
8
|
+
const openFile = async (file) => {
|
|
9
9
|
if (!bridge)
|
|
10
10
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
11
|
-
|
|
11
|
+
const response = await bridge.sendClientEvent({
|
|
12
12
|
method: METHODS.OPEN_FILE,
|
|
13
13
|
params: file,
|
|
14
14
|
});
|
|
15
|
+
return response;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
18
|
* Download file list with client
|
|
18
19
|
* @param files Files list to be opened
|
|
19
20
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
20
21
|
*/
|
|
21
|
-
const openFiles = (files) => {
|
|
22
|
+
const openFiles = async (files) => {
|
|
22
23
|
if (!bridge)
|
|
23
24
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
24
|
-
|
|
25
|
+
const response = await bridge.sendClientEvent({
|
|
25
26
|
method: METHODS.OPEN_FILES,
|
|
26
27
|
params: files,
|
|
27
28
|
});
|
|
29
|
+
return response;
|
|
28
30
|
};
|
|
29
31
|
/**
|
|
30
32
|
* Upload single file with client
|
|
@@ -32,16 +34,17 @@ const openFiles = (files) => {
|
|
|
32
34
|
* @param maxSize Max file size in bytes
|
|
33
35
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
34
36
|
*/
|
|
35
|
-
const uploadFile = ({ mimeType, maxSize }) => {
|
|
37
|
+
const uploadFile = async ({ mimeType, maxSize, }) => {
|
|
36
38
|
if (!bridge)
|
|
37
39
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
38
|
-
|
|
40
|
+
const response = await bridge.sendClientEvent({
|
|
39
41
|
method: METHODS.UPLOAD_FILE,
|
|
40
42
|
params: {
|
|
41
43
|
type: mimeType,
|
|
42
44
|
maxSize,
|
|
43
45
|
},
|
|
44
46
|
});
|
|
47
|
+
return response;
|
|
45
48
|
};
|
|
46
49
|
/**
|
|
47
50
|
* Upload files list with client
|
|
@@ -49,16 +52,17 @@ const uploadFile = ({ mimeType, maxSize }) => {
|
|
|
49
52
|
* @param maxSize Max file size in bytes
|
|
50
53
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
51
54
|
*/
|
|
52
|
-
const uploadFiles = ({ mimeType, maxSize }) => {
|
|
55
|
+
const uploadFiles = async ({ mimeType, maxSize, }) => {
|
|
53
56
|
if (!bridge)
|
|
54
57
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
55
|
-
|
|
58
|
+
const response = await bridge.sendClientEvent({
|
|
56
59
|
method: METHODS.UPLOAD_FILES,
|
|
57
60
|
params: {
|
|
58
61
|
type: mimeType,
|
|
59
62
|
maxSize,
|
|
60
63
|
},
|
|
61
64
|
});
|
|
65
|
+
return response;
|
|
62
66
|
};
|
|
63
|
-
export { openFile, openFiles, uploadFile, uploadFiles
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
export { openFile, openFiles, uploadFile, uploadFiles };
|
|
68
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saWIvY2xpZW50L2ZpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNLE1BQU0sNEJBQTRCLENBQUE7QUFDL0MsT0FBTyxFQUNMLFdBQVcsRUFFWCxPQUFPLEdBSVIsTUFBTSxhQUFhLENBQUE7QUFFcEI7Ozs7R0FJRztBQUNILE1BQU0sUUFBUSxHQUFHLEtBQUssRUFBRSxJQUFVLEVBQTJCLEVBQUU7SUFDN0QsSUFBSSxDQUFDLE1BQU07UUFBRSxPQUFPLE9BQU8sQ0FBQyxNQUFNLENBQUMsV0FBVyxDQUFDLFNBQVMsQ0FBQyxDQUFBO0lBRXpELE1BQU0sUUFBUSxHQUFHLE1BQU0sTUFBTSxDQUFDLGVBQWUsQ0FBQztRQUM1QyxNQUFNLEVBQUUsT0FBTyxDQUFDLFNBQVM7UUFDekIsTUFBTSxFQUFFLElBQUk7S0FDYixDQUFDLENBQUE7SUFFRixPQUFPLFFBQTBCLENBQUE7QUFDbkMsQ0FBQyxDQUFBO0FBRUQ7Ozs7R0FJRztBQUNILE1BQU0sU0FBUyxHQUFHLEtBQUssRUFBRSxLQUFhLEVBQTJCLEVBQUU7SUFDakUsSUFBSSxDQUFDLE1BQU07UUFBR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tRQUM1QixNQUFNLEVBQUU7WUFDTixJQUFJLEVBQUUsUUFBUTtZQUNkLE9BQU87U0FDUjtLQUNGLENBQUMsQ0FBQTtJQUVGLE9BQU8sUUFBbUMsQ0FBQTtBQUM1QyxDQUFDLENBQUE7QUFFRCxPQUFPLEVBQUUsUUFBUSxFQUFFLFNBQVMsRUFBRSxVQUFVLEVBQUUsV0FBVyxFQUFFLENBQUEifQ==
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmitterEventPayload } from '@expressms/smartapp-bridge/build/main/types/eventEmitter';
|
|
2
|
-
import { STATUS } from './bridge';
|
|
2
|
+
import { File, STATUS } from './bridge';
|
|
3
3
|
export declare enum SubscriptionEventType {
|
|
4
4
|
CONNECTION_STATUS = "connection_status",
|
|
5
5
|
UNREAD_COUNTER_CHANGE = "unread_counter_change",
|
|
@@ -56,3 +56,19 @@ export type GetLayoutTypeResponse = {
|
|
|
56
56
|
layoutType: "minimal" | "full" | "half";
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
export type UploadFileTypeResponse = {
|
|
60
|
+
ref: string;
|
|
61
|
+
payload: {
|
|
62
|
+
status: STATUS;
|
|
63
|
+
errorCode?: string | null;
|
|
64
|
+
record: File;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type UploadFilesTypeResponse = {
|
|
68
|
+
ref: string;
|
|
69
|
+
payload: {
|
|
70
|
+
status: STATUS;
|
|
71
|
+
errorCode?: string | null;
|
|
72
|
+
records: File[];
|
|
73
|
+
};
|
|
74
|
+
};
|
package/build/umd/index.js
CHANGED
|
@@ -2319,26 +2319,28 @@
|
|
|
2319
2319
|
* @param file File data to be opened
|
|
2320
2320
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
2321
2321
|
*/
|
|
2322
|
-
const openFile = (file) => {
|
|
2322
|
+
const openFile = async (file) => {
|
|
2323
2323
|
if (!bridge)
|
|
2324
2324
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2325
|
-
|
|
2325
|
+
const response = await bridge.sendClientEvent({
|
|
2326
2326
|
method: METHODS.OPEN_FILE,
|
|
2327
2327
|
params: file,
|
|
2328
2328
|
});
|
|
2329
|
+
return response;
|
|
2329
2330
|
};
|
|
2330
2331
|
/**
|
|
2331
2332
|
* Download file list with client
|
|
2332
2333
|
* @param files Files list to be opened
|
|
2333
2334
|
* @returns Promise that'll be fullfilled, otherwise rejected with reason
|
|
2334
2335
|
*/
|
|
2335
|
-
const openFiles = (files) => {
|
|
2336
|
+
const openFiles = async (files) => {
|
|
2336
2337
|
if (!bridge)
|
|
2337
2338
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2338
|
-
|
|
2339
|
+
const response = await bridge.sendClientEvent({
|
|
2339
2340
|
method: METHODS.OPEN_FILES,
|
|
2340
2341
|
params: files,
|
|
2341
2342
|
});
|
|
2343
|
+
return response;
|
|
2342
2344
|
};
|
|
2343
2345
|
/**
|
|
2344
2346
|
* Upload single file with client
|
|
@@ -2346,16 +2348,17 @@
|
|
|
2346
2348
|
* @param maxSize Max file size in bytes
|
|
2347
2349
|
* @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
|
|
2348
2350
|
*/
|
|
2349
|
-
const uploadFile = ({ mimeType, maxSize }) => {
|
|
2351
|
+
const uploadFile = async ({ mimeType, maxSize, }) => {
|
|
2350
2352
|
if (!bridge)
|
|
2351
2353
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2352
|
-
|
|
2354
|
+
const response = await bridge.sendClientEvent({
|
|
2353
2355
|
method: METHODS.UPLOAD_FILE,
|
|
2354
2356
|
params: {
|
|
2355
2357
|
type: mimeType,
|
|
2356
2358
|
maxSize,
|
|
2357
2359
|
},
|
|
2358
2360
|
});
|
|
2361
|
+
return response;
|
|
2359
2362
|
};
|
|
2360
2363
|
/**
|
|
2361
2364
|
* Upload files list with client
|
|
@@ -2363,16 +2366,17 @@
|
|
|
2363
2366
|
* @param maxSize Max file size in bytes
|
|
2364
2367
|
* @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
|
|
2365
2368
|
*/
|
|
2366
|
-
const uploadFiles = ({ mimeType, maxSize }) => {
|
|
2369
|
+
const uploadFiles = async ({ mimeType, maxSize, }) => {
|
|
2367
2370
|
if (!bridge)
|
|
2368
2371
|
return Promise.reject(ERROR_CODES.NO_BRIDGE);
|
|
2369
|
-
|
|
2372
|
+
const response = await bridge.sendClientEvent({
|
|
2370
2373
|
method: METHODS.UPLOAD_FILES,
|
|
2371
2374
|
params: {
|
|
2372
2375
|
type: mimeType,
|
|
2373
2376
|
maxSize,
|
|
2374
2377
|
},
|
|
2375
2378
|
});
|
|
2379
|
+
return response;
|
|
2376
2380
|
};
|
|
2377
2381
|
|
|
2378
2382
|
const addContact = ({ phone, name }) => {
|