// @flow import { exportWorkspacesHAR, exportWorkspacesData, importRaw, importUri, } from '../../common/import'; import type { Workspace } from '../../models/workspace'; export function init(): { data: { import: Object, export: Object } } { return { data: { import: { async uri(uri: string, options: { workspaceId?: string } = {}): Promise { await importUri(() => Promise.resolve(options.workspaceId || null), uri); }, async raw(text: string, options: { workspaceId?: string } = {}): Promise { await importRaw(() => Promise.resolve(options.workspaceId || null), text); }, }, export: { async insomnia( options: { includePrivate?: boolean, format?: 'json' | 'yaml', workspace?: Workspace, } = {}, ): Promise { options = options || {}; return exportWorkspacesData( options.workspace || null, !!options.includePrivate, options.format || 'json', ); }, async har( options: { includePrivate?: boolean, workspace?: Workspace } = {}, ): Promise { return exportWorkspacesHAR(options.workspace || null, !!options.includePrivate); }, }, }, }; }