2017-11-26 13:42:43 +00:00
|
|
|
// @flow
|
2019-03-05 06:53:45 +00:00
|
|
|
import {
|
|
|
|
exportWorkspacesHAR,
|
2019-04-18 17:23:15 +00:00
|
|
|
exportWorkspacesData,
|
2019-03-05 06:53:45 +00:00
|
|
|
importRaw,
|
|
|
|
importUri,
|
|
|
|
} from '../../common/import';
|
2017-11-26 13:42:43 +00:00
|
|
|
|
2018-06-25 17:42:50 +00:00
|
|
|
export function init(): { import: Object, export: Object } {
|
2017-11-26 13:42:43 +00:00
|
|
|
return {
|
2018-06-25 17:42:50 +00:00
|
|
|
import: {
|
2018-10-17 16:42:33 +00:00
|
|
|
async uri(uri: string, options: { workspaceId?: string } = {}): Promise<void> {
|
2019-08-12 21:15:44 +00:00
|
|
|
await importUri(() => Promise.resolve(options.workspaceId || null), uri);
|
2017-11-26 13:42:43 +00:00
|
|
|
},
|
2018-10-17 16:42:33 +00:00
|
|
|
async raw(text: string, options: { workspaceId?: string } = {}): Promise<void> {
|
2019-08-12 21:15:44 +00:00
|
|
|
await importRaw(() => Promise.resolve(options.workspaceId || null), text);
|
2018-12-12 17:36:11 +00:00
|
|
|
},
|
2017-11-26 13:42:43 +00:00
|
|
|
},
|
2018-06-25 17:42:50 +00:00
|
|
|
export: {
|
2019-04-18 04:21:29 +00:00
|
|
|
async insomnia(
|
|
|
|
options: { includePrivate?: boolean, format?: 'json' | 'yaml' } = {},
|
|
|
|
): Promise<string> {
|
2017-11-26 13:42:43 +00:00
|
|
|
options = options || {};
|
2019-04-18 18:13:12 +00:00
|
|
|
return exportWorkspacesData(null, !!options.includePrivate, options.format || 'json');
|
2017-11-26 13:42:43 +00:00
|
|
|
},
|
2018-06-25 17:42:50 +00:00
|
|
|
async har(options: { includePrivate?: boolean } = {}): Promise<string> {
|
2019-04-18 18:13:12 +00:00
|
|
|
return exportWorkspacesHAR(null, !!options.includePrivate);
|
2018-12-12 17:36:11 +00:00
|
|
|
},
|
|
|
|
},
|
2017-11-26 13:42:43 +00:00
|
|
|
};
|
|
|
|
}
|