From 88b0bb784f126fcc880f1db596aa7eb76b75b9fe Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 12 Dec 2018 12:36:11 -0500 Subject: [PATCH] Add trailing commas to ESLint + Prettier --- .prettierrc | 4 +- packages/insomnia-app/.eslintrc | 17 +- packages/insomnia-app/app/__jest__/setup.js | 2 +- .../insomnia-app/app/__mocks__/electron.js | 18 +- .../app/__mocks__/insomnia-libcurl.js | 22 +-- .../insomnia-app/app/__mocks__/node-forge.js | 32 +-- .../app/common/__fixtures__/nestedfolders.js | 26 +-- .../app/common/__tests__/database.test.js | 52 ++--- .../app/common/__tests__/har.test.js | 130 ++++++------- .../app/common/__tests__/import.test.js | 80 ++++---- .../app/common/__tests__/misc.test.js | 26 +-- .../app/common/__tests__/render.test.js | 164 ++++++++-------- packages/insomnia-app/app/common/constants.js | 15 +- packages/insomnia-app/app/common/database.js | 48 ++--- packages/insomnia-app/app/common/fetch.js | 2 +- packages/insomnia-app/app/common/har.js | 88 ++++----- packages/insomnia-app/app/common/hotkeys.js | 58 +++--- packages/insomnia-app/app/common/import.js | 28 +-- packages/insomnia-app/app/common/keycodes.js | 2 +- .../app/common/markdown-to-html.js | 2 +- packages/insomnia-app/app/common/misc.js | 8 +- packages/insomnia-app/app/common/render.js | 32 +-- .../app/datasets/access-token-urls.js | 2 +- .../app/datasets/authorization-urls.js | 2 +- .../insomnia-app/app/datasets/charsets.js | 2 +- .../app/datasets/content-types.js | 2 +- .../insomnia-app/app/datasets/header-names.js | 2 +- packages/insomnia-app/app/main.development.js | 4 +- packages/insomnia-app/app/main/updates.js | 6 +- .../insomnia-app/app/main/window-utils.js | 80 ++++---- .../insomnia-app/app/models/__mocks__/uuid.js | 4 +- .../app/models/__tests__/request.test.js | 78 ++++---- .../app/models/__tests__/response.test.js | 26 +-- .../app/models/__tests__/workspace.test.js | 8 +- .../app/models/client-certificate.js | 4 +- .../insomnia-app/app/models/cookie-jar.js | 6 +- .../insomnia-app/app/models/environment.js | 6 +- packages/insomnia-app/app/models/index.js | 8 +- .../insomnia-app/app/models/o-auth-2-token.js | 4 +- .../insomnia-app/app/models/plugin-data.js | 4 +- .../app/models/request-group-meta.js | 2 +- .../insomnia-app/app/models/request-group.js | 4 +- .../insomnia-app/app/models/request-meta.js | 2 +- .../app/models/request-version.js | 4 +- packages/insomnia-app/app/models/request.js | 34 ++-- packages/insomnia-app/app/models/response.js | 14 +- packages/insomnia-app/app/models/settings.js | 4 +- packages/insomnia-app/app/models/stats.js | 4 +- .../insomnia-app/app/models/workspace-meta.js | 6 +- packages/insomnia-app/app/models/workspace.js | 6 +- .../network/__tests__/authentication.test.js | 20 +- .../app/network/__tests__/multipart.test.js | 18 +- .../app/network/__tests__/network.test.js | 182 +++++++++--------- .../app/network/authentication.js | 18 +- .../basic-auth/__tests__/get-header.test.js | 8 +- .../insomnia-app/app/network/multipart.js | 6 +- packages/insomnia-app/app/network/network.js | 88 ++++----- .../app/network/o-auth-1/get-token.js | 12 +- .../grant-authorization-code.test.js | 54 +++--- .../grant-client-credentials.test.js | 54 +++--- .../o-auth-2/__tests__/grant-implicit.test.js | 2 +- .../o-auth-2/__tests__/grant-password.test.js | 54 +++--- .../app/network/o-auth-2/get-token.js | 26 +-- .../o-auth-2/grant-authorization-code.js | 24 +-- .../o-auth-2/grant-client-credentials.js | 14 +- .../app/network/o-auth-2/grant-implicit.js | 6 +- .../app/network/o-auth-2/grant-password.js | 16 +- .../insomnia-app/app/network/o-auth-2/misc.js | 12 +- .../app/network/o-auth-2/refresh-token.js | 12 +- .../app/plugins/context/__tests__/app.test.js | 14 +- .../plugins/context/__tests__/data.test.js | 54 +++--- .../plugins/context/__tests__/request.test.js | 20 +- .../context/__tests__/response.test.js | 8 +- .../plugins/context/__tests__/store.test.js | 6 +- .../insomnia-app/app/plugins/context/app.js | 12 +- .../insomnia-app/app/plugins/context/data.js | 6 +- .../app/plugins/context/request.js | 8 +- .../app/plugins/context/response.js | 6 +- .../insomnia-app/app/plugins/context/store.js | 6 +- packages/insomnia-app/app/plugins/index.js | 16 +- packages/insomnia-app/app/plugins/install.js | 22 +-- packages/insomnia-app/app/plugins/misc.js | 20 +- .../app/sync/__tests__/crypt.test.js | 2 +- .../app/sync/__tests__/sync.test.js | 86 ++++----- packages/insomnia-app/app/sync/crypt.js | 28 +-- packages/insomnia-app/app/sync/index.js | 22 +-- packages/insomnia-app/app/sync/session.js | 22 +-- packages/insomnia-app/app/sync/storage.js | 12 +- .../app/templating/__tests__/utils.test.js | 26 +-- .../app/templating/base-extension.js | 14 +- .../app/templating/extensions/index.js | 28 +-- packages/insomnia-app/app/templating/index.js | 8 +- packages/insomnia-app/app/templating/utils.js | 4 +- .../app/ui/components/base/button.js | 2 +- .../app/ui/components/base/copy-button.js | 4 +- .../app/ui/components/base/debounced-input.js | 2 +- .../base/dropdown/dropdown-button.js | 2 +- .../base/dropdown/dropdown-divider.js | 4 +- .../components/base/dropdown/dropdown-hint.js | 2 +- .../components/base/dropdown/dropdown-item.js | 4 +- .../base/dropdown/dropdown-right.js | 2 +- .../ui/components/base/dropdown/dropdown.js | 26 +-- .../app/ui/components/base/editable.js | 6 +- .../ui/components/base/file-input-button.js | 4 +- .../app/ui/components/base/highlight.js | 6 +- .../app/ui/components/base/lazy.js | 2 +- .../app/ui/components/base/link.js | 2 +- .../app/ui/components/base/mailto.js | 2 +- .../app/ui/components/base/modal-body.js | 4 +- .../app/ui/components/base/modal-footer.js | 2 +- .../app/ui/components/base/modal-header.js | 2 +- .../app/ui/components/base/modal.js | 8 +- .../app/ui/components/base/prompt-button.js | 4 +- .../ui/components/check-for-updates-button.js | 6 +- .../ui/components/codemirror/code-editor.js | 34 ++-- .../codemirror/extensions/autocomplete.js | 30 +-- .../codemirror/extensions/clickable.js | 2 +- .../codemirror/extensions/nunjucks-tags.js | 12 +- .../ui/components/codemirror/modes/curl.js | 14 +- .../components/codemirror/modes/nunjucks.js | 2 +- .../components/codemirror/one-line-editor.js | 8 +- .../app/ui/components/cookie-list.js | 4 +- .../ui/components/dropdowns/auth-dropdown.js | 6 +- .../dropdowns/content-type-dropdown.js | 6 +- .../dropdowns/environments-dropdown.js | 4 +- .../components/dropdowns/method-dropdown.js | 4 +- .../dropdowns/preview-mode-dropdown.js | 2 +- .../dropdowns/request-actions-dropdown.js | 4 +- .../request-group-actions-dropdown.js | 6 +- .../dropdowns/response-history-dropdown.js | 2 +- .../ui/components/dropdowns/sync-dropdown.js | 10 +- .../dropdowns/workspace-dropdown.js | 10 +- .../ui/components/editors/auth/asap-auth.js | 24 +-- .../components/editors/auth/auth-wrapper.js | 6 +- .../ui/components/editors/auth/aws-auth.js | 14 +- .../ui/components/editors/auth/basic-auth.js | 8 +- .../ui/components/editors/auth/bearer-auth.js | 8 +- .../ui/components/editors/auth/digest-auth.js | 8 +- .../ui/components/editors/auth/hawk-auth.js | 14 +- .../ui/components/editors/auth/ntlm-auth.js | 8 +- .../components/editors/auth/o-auth-1-auth.js | 40 ++-- .../components/editors/auth/o-auth-2-auth.js | 62 +++--- .../ui/components/editors/body/body-editor.js | 10 +- .../ui/components/editors/body/file-editor.js | 2 +- .../ui/components/editors/body/form-editor.js | 4 +- .../editors/body/graph-ql-editor.js | 50 ++--- .../ui/components/editors/body/raw-editor.js | 4 +- .../editors/body/url-encoded-editor.js | 4 +- .../components/editors/environment-editor.js | 6 +- .../editors/request-headers-editor.js | 8 +- .../app/ui/components/error-boundary.js | 8 +- .../app/ui/components/gravatar-img.js | 2 +- .../app/ui/components/help-tooltip.js | 2 +- .../insomnia-app/app/ui/components/hotkey.js | 2 +- .../ui/components/key-value-editor/editor.js | 14 +- .../app/ui/components/key-value-editor/row.js | 30 +-- .../app/ui/components/keydown-binder.js | 2 +- .../app/ui/components/markdown-editor.js | 8 +- .../app/ui/components/markdown-preview.js | 8 +- .../app/ui/components/modals/alert-modal.js | 2 +- .../app/ui/components/modals/ask-modal.js | 2 +- .../ui/components/modals/code-prompt-modal.js | 14 +- .../components/modals/cookie-modify-modal.js | 10 +- .../app/ui/components/modals/cookies-modal.js | 6 +- .../modals/environment-edit-modal.js | 4 +- .../app/ui/components/modals/error-modal.js | 2 +- .../ui/components/modals/filter-help-modal.js | 2 +- .../components/modals/generate-code-modal.js | 10 +- .../app/ui/components/modals/login-modal.js | 6 +- .../modals/move-request-group-modal.js | 8 +- .../ui/components/modals/nunjucks-modal.js | 4 +- .../app/ui/components/modals/prompt-modal.js | 14 +- .../components/modals/request-create-modal.js | 10 +- .../modals/request-render-error-modal.js | 2 +- .../modals/request-settings-modal.js | 22 +-- .../modals/request-switcher-modal.js | 18 +- .../components/modals/response-debug-modal.js | 4 +- .../app/ui/components/modals/select-modal.js | 4 +- .../ui/components/modals/settings-modal.js | 2 +- .../ui/components/modals/setup-sync-modal.js | 16 +- .../workspace-environments-edit-modal.js | 24 +-- .../modals/workspace-settings-modal.js | 18 +- .../modals/workspace-share-settings-modal.js | 12 +- .../app/ui/components/modals/wrapper-modal.js | 6 +- .../ui/components/rendered-query-string.js | 8 +- .../app/ui/components/rendered-text.js | 6 +- .../app/ui/components/request-pane.js | 8 +- .../app/ui/components/request-url-bar.js | 14 +- .../app/ui/components/response-pane.js | 8 +- .../app/ui/components/response-timer.js | 6 +- .../app/ui/components/settings/general.js | 8 +- .../ui/components/settings/import-export.js | 4 +- .../app/ui/components/settings/plugins.js | 6 +- .../app/ui/components/settings/theme.js | 6 +- .../ui/components/sidebar/sidebar-children.js | 6 +- .../ui/components/sidebar/sidebar-filter.js | 2 +- .../sidebar/sidebar-request-group-row.js | 26 +-- .../components/sidebar/sidebar-request-row.js | 18 +- .../app/ui/components/sidebar/sidebar.js | 8 +- .../app/ui/components/tags/method-tag.js | 2 +- .../app/ui/components/tags/size-tag.js | 2 +- .../app/ui/components/tags/status-tag.js | 2 +- .../app/ui/components/tags/time-tag.js | 2 +- .../app/ui/components/tags/url-tag.js | 2 +- .../ui/components/templating/tag-editor.js | 36 ++-- .../components/templating/variable-editor.js | 4 +- .../app/ui/components/time-from-now.js | 6 +- .../insomnia-app/app/ui/components/toast.js | 10 +- .../insomnia-app/app/ui/components/tooltip.js | 8 +- .../viewers/response-cookies-viewer.js | 2 +- .../components/viewers/response-csv-viewer.js | 8 +- .../ui/components/viewers/response-error.js | 2 +- .../viewers/response-headers-viewer.js | 4 +- .../components/viewers/response-multipart.js | 26 +-- .../components/viewers/response-pdf-viewer.js | 10 +- .../app/ui/components/viewers/response-raw.js | 2 +- .../viewers/response-timeline-viewer.js | 2 +- .../ui/components/viewers/response-viewer.js | 14 +- .../components/viewers/response-web-view.js | 4 +- .../insomnia-app/app/ui/components/wrapper.js | 22 +-- .../insomnia-app/app/ui/containers/app.js | 92 ++++----- packages/insomnia-app/app/ui/index.js | 4 +- packages/insomnia-app/app/ui/redux/create.js | 2 +- .../app/ui/redux/modules/global.js | 30 +-- .../app/ui/redux/modules/index.js | 4 +- .../insomnia-app/app/ui/redux/selectors.js | 30 +-- packages/insomnia-app/flow-typed/aws4.js | 2 +- .../insomnia-app/flow-typed/codemirror.js | 4 +- packages/insomnia-app/flow-typed/electron.js | 4 +- packages/insomnia-app/flow-typed/fs-extra.js | 2 +- packages/insomnia-app/flow-typed/fuzzysort.js | 2 +- packages/insomnia-app/flow-typed/graphql.js | 22 +-- .../flow-typed/insomnia-cookies.js | 2 +- .../flow-typed/insomnia-importers.js | 10 +- .../flow-typed/insomnia-libcurl.js | 16 +- .../flow-typed/insomnia-plugin-hash.js | 2 +- .../flow-typed/insomnia-prettify.js | 2 +- .../insomnia-app/flow-typed/insomnia-url.js | 2 +- packages/insomnia-app/flow-typed/jsonpath.js | 2 +- .../insomnia-app/flow-typed/mime-types.js | 2 +- packages/insomnia-app/flow-typed/mkdirp.js | 2 +- packages/insomnia-app/flow-typed/moment.js | 2 +- packages/insomnia-app/flow-typed/nedb.js | 2 +- packages/insomnia-app/flow-typed/nunjucks.js | 6 +- .../insomnia-app/flow-typed/oauth-1.0a.js | 6 +- packages/insomnia-app/flow-typed/papaparse.js | 2 +- .../flow-typed/react-sortable-hoc.js | 2 +- .../insomnia-app/flow-typed/react-tabs.js | 2 +- packages/insomnia-app/flow-typed/reselect.js | 2 +- packages/insomnia-app/flow-typed/uuid.js | 2 +- packages/insomnia-app/flow-typed/xmldom.js | 2 +- packages/insomnia-app/scripts/build.js | 4 +- packages/insomnia-app/scripts/package.js | 4 +- .../webpack/webpack.config.base.babel.js | 28 +-- .../webpack.config.development.babel.js | 12 +- .../webpack/webpack.config.electron.babel.js | 10 +- .../webpack.config.production.babel.js | 8 +- .../insomnia-cookies/__tests__/index.test.js | 10 +- .../insomnia-httpsnippet/src/helpers/shell.js | 2 +- packages/insomnia-httpsnippet/src/index.js | 10 +- .../src/targets/c/index.js | 4 +- .../src/targets/c/libcurl.js | 2 +- .../src/targets/csharp/index.js | 4 +- .../src/targets/csharp/restsharp.js | 4 +- .../src/targets/go/index.js | 4 +- .../src/targets/go/native.js | 8 +- .../insomnia-httpsnippet/src/targets/index.js | 2 +- .../src/targets/java/index.js | 4 +- .../src/targets/java/okhttp.js | 10 +- .../src/targets/java/unirest.js | 10 +- .../src/targets/javascript/index.js | 4 +- .../src/targets/javascript/jquery.js | 12 +- .../src/targets/javascript/xhr.js | 12 +- .../src/targets/node/index.js | 4 +- .../src/targets/node/native.js | 16 +- .../src/targets/node/request.js | 12 +- .../src/targets/node/unirest.js | 10 +- .../src/targets/objc/helpers.js | 4 +- .../src/targets/objc/index.js | 4 +- .../src/targets/objc/nsurlsession.js | 36 ++-- .../src/targets/ocaml/cohttp.js | 10 +- .../src/targets/ocaml/index.js | 4 +- .../src/targets/php/curl.js | 30 +-- .../src/targets/php/helpers.js | 4 +- .../src/targets/php/http1.js | 8 +- .../src/targets/php/http2.js | 14 +- .../src/targets/php/index.js | 4 +- .../src/targets/python/index.js | 4 +- .../src/targets/python/python3.js | 2 +- .../src/targets/python/requests.js | 2 +- .../src/targets/ruby/index.js | 4 +- .../src/targets/ruby/native.js | 4 +- .../src/targets/shell/curl.js | 8 +- .../src/targets/shell/httpie.js | 8 +- .../src/targets/shell/index.js | 4 +- .../src/targets/shell/wget.js | 6 +- .../src/targets/swift/helpers.js | 8 +- .../src/targets/swift/index.js | 4 +- .../src/targets/swift/nsurlsession.js | 22 +-- .../jquery/application-form-encoded.js | 6 +- .../javascript/jquery/application-json.js | 4 +- .../output/javascript/jquery/cookies.js | 4 +- .../output/javascript/jquery/custom-method.js | 2 +- .../fixtures/output/javascript/jquery/full.js | 6 +- .../output/javascript/jquery/headers.js | 4 +- .../output/javascript/jquery/https.js | 2 +- .../javascript/jquery/multipart-data.js | 2 +- .../javascript/jquery/multipart-file.js | 2 +- .../javascript/jquery/multipart-form-data.js | 2 +- .../output/javascript/jquery/query.js | 2 +- .../output/javascript/jquery/short.js | 2 +- .../output/javascript/jquery/text-plain.js | 4 +- .../output/javascript/xhr/application-json.js | 8 +- .../node/native/application-form-encoded.js | 4 +- .../output/node/native/application-json.js | 8 +- .../fixtures/output/node/native/cookies.js | 4 +- .../output/node/native/custom-method.js | 2 +- .../test/fixtures/output/node/native/full.js | 4 +- .../fixtures/output/node/native/headers.js | 4 +- .../test/fixtures/output/node/native/https.js | 2 +- .../output/node/native/multipart-data.js | 6 +- .../output/node/native/multipart-file.js | 6 +- .../output/node/native/multipart-form-data.js | 6 +- .../test/fixtures/output/node/native/query.js | 2 +- .../test/fixtures/output/node/native/short.js | 2 +- .../fixtures/output/node/native/text-plain.js | 4 +- .../node/request/application-form-encoded.js | 2 +- .../output/node/request/application-json.js | 4 +- .../test/fixtures/output/node/request/full.js | 4 +- .../fixtures/output/node/request/headers.js | 2 +- .../output/node/request/multipart-data.js | 8 +- .../output/node/request/multipart-file.js | 10 +- .../node/request/multipart-form-data.js | 4 +- .../fixtures/output/node/request/query.js | 2 +- .../output/node/request/text-plain.js | 2 +- .../node/unirest/application-form-encoded.js | 4 +- .../output/node/unirest/application-json.js | 10 +- .../test/fixtures/output/node/unirest/full.js | 6 +- .../fixtures/output/node/unirest/headers.js | 2 +- .../output/node/unirest/multipart-data.js | 6 +- .../output/node/unirest/multipart-file.js | 6 +- .../node/unirest/multipart-form-data.js | 6 +- .../fixtures/output/node/unirest/query.js | 2 +- .../output/node/unirest/text-plain.js | 2 +- packages/insomnia-httpsnippet/test/index.js | 8 +- packages/insomnia-httpsnippet/test/reducer.js | 2 +- .../insomnia-httpsnippet/test/requests.js | 2 +- packages/insomnia-httpsnippet/test/targets.js | 2 +- .../test/targets/go/native.js | 16 +- .../test/targets/javascript/xhr.js | 4 +- .../test/targets/objc/nsurlsession.js | 12 +- .../test/targets/shell/curl.js | 14 +- .../test/targets/shell/httpie.js | 24 +-- .../test/targets/shell/wget.js | 12 +- .../test/targets/swift/nsurlsession.js | 12 +- packages/insomnia-importers/index.js | 8 +- .../src/__tests__/utils.test.js | 6 +- .../insomnia-importers/src/importers/curl.js | 4 +- .../insomnia-importers/src/importers/har.js | 4 +- .../src/importers/insomnia-1.js | 12 +- .../src/importers/insomnia-2.js | 2 +- .../src/importers/postman-env.js | 2 +- .../src/importers/postman.js | 30 +-- .../src/importers/swagger2.js | 24 +-- packages/insomnia-importers/src/utils.js | 12 +- packages/insomnia-libcurl/index.js | 2 +- packages/insomnia-libcurl/src/curl.js | 2 +- packages/insomnia-prettify/index.js | 2 +- packages/insomnia-prettify/src/json.js | 4 +- packages/insomnia-url/index.js | 2 +- .../src/__tests__/querystring.test.js | 16 +- packages/insomnia-url/src/querystring.js | 4 +- .../insomnia-xpath/__tests__/index.test.js | 6 +- packages/insomnia-xpath/index.js | 6 +- .../__tests__/index.test.js | 2 +- plugins/insomnia-plugin-base64/index.js | 12 +- .../__tests__/index.js | 28 +-- plugins/insomnia-plugin-cookie-jar/index.js | 12 +- plugins/insomnia-plugin-core-themes/index.js | 2 +- .../themes/default.js | 50 ++--- .../themes/hyper.js | 26 +-- .../themes/material.js | 34 ++-- .../themes/one-dark.js | 28 +-- .../themes/one-light.js | 28 +-- .../themes/purple.js | 30 +-- .../themes/railscasts.js | 24 +-- .../themes/simple-dark.js | 18 +- .../themes/simple-light.js | 12 +- .../themes/solarized-dark.js | 10 +- .../themes/solarized-light.js | 10 +- .../themes/solarized.js | 18 +- .../__tests__/index.test.js | 4 +- plugins/insomnia-plugin-file/index.js | 8 +- .../__tests__/index.test.js | 14 +- plugins/insomnia-plugin-hash/index.js | 16 +- plugins/insomnia-plugin-jsonpath/index.js | 10 +- plugins/insomnia-plugin-now/index.js | 14 +- plugins/insomnia-plugin-os/index.js | 12 +- plugins/insomnia-plugin-prompt/index.js | 20 +- .../__tests__/index.test.js | 36 ++-- plugins/insomnia-plugin-request/index.js | 38 ++-- .../__tests__/index.test.js | 90 ++++----- plugins/insomnia-plugin-response/index.js | 20 +- plugins/insomnia-plugin-uuid/index.js | 10 +- 404 files changed, 2575 insertions(+), 2571 deletions(-) diff --git a/.prettierrc b/.prettierrc index 631058b4f4..1001dcf271 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,6 +4,6 @@ "semi": true, "singleQuote": true, "tabWidth": 2, - "trailingComma": "none", + "trailingComma": "all", "printWidth": 100 -} \ No newline at end of file +} diff --git a/packages/insomnia-app/.eslintrc b/packages/insomnia-app/.eslintrc index 4a5000c329..b0485470b7 100644 --- a/packages/insomnia-app/.eslintrc +++ b/packages/insomnia-app/.eslintrc @@ -29,16 +29,23 @@ "jest/globals": true }, "rules": { + "comma-dangle": [ + "error", + "always-multiline" + ], "indent": "off", "no-var": "error", "no-duplicate-imports": "off", "react/jsx-uses-react": "error", "react/jsx-uses-vars": "error", - "space-before-function-paren": ["error", { - "anonymous": "never", - "named": "never", - "asyncArrow": "always" - }], + "space-before-function-paren": [ + "error", + { + "anonymous": "never", + "named": "never", + "asyncArrow": "always" + } + ], "filenames/match-exported": [ "error", "kebab" diff --git a/packages/insomnia-app/app/__jest__/setup.js b/packages/insomnia-app/app/__jest__/setup.js index 379abd718a..f6191a5127 100644 --- a/packages/insomnia-app/app/__jest__/setup.js +++ b/packages/insomnia-app/app/__jest__/setup.js @@ -12,7 +12,7 @@ const localStorageMock = (function() { }, clear() { store = {}; - } + }, }; })(); diff --git a/packages/insomnia-app/app/__mocks__/electron.js b/packages/insomnia-app/app/__mocks__/electron.js index 5c3a6666da..5f73637b86 100644 --- a/packages/insomnia-app/app/__mocks__/electron.js +++ b/packages/insomnia-app/app/__mocks__/electron.js @@ -14,14 +14,14 @@ const remote = { }, getLocale() { return 'en-US'; - } + }, }, net: { request(url) { const req = new events.EventEmitter(); req.end = function() {}; return req; - } + }, }, BrowserWindow: { getAllWindows() { @@ -31,15 +31,15 @@ const remote = { return { getContentBounds() { return { width: 1900, height: 1060 }; - } + }, }; - } + }, }, screen: { getPrimaryDisplay() { return { workAreaSize: { width: 1920, height: 1080 } }; - } - } + }, + }, }; module.exports = { @@ -47,11 +47,11 @@ module.exports = { remote: remote, ipcMain: { on() {}, - once() {} + once() {}, }, ipcRenderer: { on() {}, once() {}, - send() {} - } + send() {}, + }, }; diff --git a/packages/insomnia-app/app/__mocks__/insomnia-libcurl.js b/packages/insomnia-app/app/__mocks__/insomnia-libcurl.js index fe5f436c87..9b0e2fcefa 100644 --- a/packages/insomnia-app/app/__mocks__/insomnia-libcurl.js +++ b/packages/insomnia-app/app/__mocks__/insomnia-libcurl.js @@ -81,8 +81,8 @@ class Curl extends EventEmitter { JSON.stringify({ options: this._options, meta: this._meta, - features: this._features - }) + features: this._features, + }), ); this.emit('data', data); @@ -97,8 +97,8 @@ class Curl extends EventEmitter { 'HTTP/1.1 200 OK', `Content-Length: ${data.length}`, 'Content-Type: application/json', - '' - ].join('\n') + '', + ].join('\n'), ); }); }); @@ -117,23 +117,23 @@ Curl.info = { DATA_OUT: 'DATA_OUT', SSL_DATA_IN: 'SSL_DATA_IN', SSL_DATA_OUT: 'SSL_DATA_OUT', - TEXT: 'TEXT' - } + TEXT: 'TEXT', + }, }; Curl.auth = { - ANY: 'ANY' + ANY: 'ANY', }; Curl.netrc = { IGNORED: 0, OPTIONAL: 1, - REQUIRED: 2 + REQUIRED: 2, }; Curl.feature = { NO_HEADER_PARSING: 'NO_HEADER_PARSING', - NO_DATA_PARSING: 'NO_DATA_PARSING' + NO_DATA_PARSING: 'NO_DATA_PARSING', }; Curl.option = { @@ -175,9 +175,9 @@ Curl.option = { USERNAME: 'USERNAME', VERBOSE: 'VERBOSE', WRITEFUNCTION: 'WRITEFUNCTION', - XFERINFOFUNCTION: 'XFERINFOFUNCTION' + XFERINFOFUNCTION: 'XFERINFOFUNCTION', }; module.exports = { - Curl: Curl + Curl: Curl, }; diff --git a/packages/insomnia-app/app/__mocks__/node-forge.js b/packages/insomnia-app/app/__mocks__/node-forge.js index 20c952df21..3beb06b124 100644 --- a/packages/insomnia-app/app/__mocks__/node-forge.js +++ b/packages/insomnia-app/app/__mocks__/node-forge.js @@ -9,30 +9,30 @@ module.exports = { jsbn: forge.jsbn, util: forge.util, pkcs5: { - pbkdf2() {} + pbkdf2() {}, }, md: { sha256: { create() { return 'TODO'; - } - } + }, + }, }, rsa: { setPublicKey() { return { encrypt(str) { return str; - } + }, }; }, setPrivateKey() { return { decrypt(str) { return str; - } + }, }; - } + }, }, random: { getBytesSync(n) { @@ -41,7 +41,7 @@ module.exports = { s += 'a'; } return s; - } + }, }, pki: { rsa: { @@ -55,15 +55,15 @@ module.exports = { n: 'a', p: 'a', q: 'a', - qInv: 'a' + qInv: 'a', }, publicKey: { e: 'a', - n: 'a' - } + n: 'a', + }, }; - } - } + }, + }, }, cipher: { createCipher(alg, key) { @@ -77,7 +77,7 @@ module.exports = { finish() { this.mode = { tag: 'tag' }; this.output = this._data; - } + }, }; }, createDecipher(alg, key) { @@ -90,8 +90,8 @@ module.exports = { }, finish() { return true; - } + }, }; - } - } + }, + }, }; diff --git a/packages/insomnia-app/app/common/__fixtures__/nestedfolders.js b/packages/insomnia-app/app/common/__fixtures__/nestedfolders.js index 21fc25c05d..dd0e3be052 100644 --- a/packages/insomnia-app/app/common/__fixtures__/nestedfolders.js +++ b/packages/insomnia-app/app/common/__fixtures__/nestedfolders.js @@ -4,53 +4,53 @@ export const data = { [models.workspace.type]: [ { _id: 'wrk_1', - name: 'Wrk 1' - } + name: 'Wrk 1', + }, ], [models.requestGroup.type]: [ { _id: 'fld_1', parentId: 'wrk_1', - name: 'Fld 1' + name: 'Fld 1', }, { _id: 'fld_2', parentId: 'wrk_1', - name: 'Fld 2' + name: 'Fld 2', }, { _id: 'fld_3', parentId: 'fld_1', - name: 'Fld 3' - } + name: 'Fld 3', + }, ], [models.request.type]: [ { _id: 'req_1', parentId: 'fld_1', - name: 'Req 1' + name: 'Req 1', }, { _id: 'req_2', parentId: 'fld_1', - name: 'Req 2' + name: 'Req 2', }, { _id: 'req_3', parentId: 'wrk_1', - name: 'Req 3' + name: 'Req 3', }, { _id: 'req_4', parentId: 'fld_3', - name: 'Req 4' + name: 'Req 4', }, { _id: 'req_5', parentId: 'wrk_1', - name: 'Req 5' - } - ] + name: 'Req 5', + }, + ], }; diff --git a/packages/insomnia-app/app/common/__tests__/database.test.js b/packages/insomnia-app/app/common/__tests__/database.test.js index e572f8e672..43a2716824 100644 --- a/packages/insomnia-app/app/common/__tests__/database.test.js +++ b/packages/insomnia-app/app/common/__tests__/database.test.js @@ -29,7 +29,7 @@ describe('onChange()', () => { const doc = { type: models.request.type, parentId: 'nothing', - name: 'foo' + name: 'foo', }; const changesSeen = []; @@ -44,7 +44,7 @@ describe('onChange()', () => { expect(changesSeen).toEqual([ [[db.CHANGE_INSERT, newDoc, false]], - [[db.CHANGE_UPDATE, updatedDoc, false]] + [[db.CHANGE_UPDATE, updatedDoc, false]], ]); db.offChange(callback); @@ -59,7 +59,7 @@ describe('bufferChanges()', () => { const doc = { type: models.request.type, parentId: 'n/a', - name: 'foo' + name: 'foo', }; const changesSeen = []; @@ -78,13 +78,13 @@ describe('bufferChanges()', () => { // Assert changes seen after flush await db.flushChanges(); expect(changesSeen).toEqual([ - [[db.CHANGE_INSERT, newDoc, false], [db.CHANGE_UPDATE, updatedDoc, false]] + [[db.CHANGE_INSERT, newDoc, false], [db.CHANGE_UPDATE, updatedDoc, false]], ]); // Assert no more changes seen after flush again await db.flushChanges(); expect(changesSeen).toEqual([ - [[db.CHANGE_INSERT, newDoc, false], [db.CHANGE_UPDATE, updatedDoc, false]] + [[db.CHANGE_INSERT, newDoc, false], [db.CHANGE_UPDATE, updatedDoc, false]], ]); }); }); @@ -96,7 +96,7 @@ describe('requestCreate()', () => { const patch = { name: 'My Request', - parentId: 'wrk_123' + parentId: 'wrk_123', }; const r = await models.request.create(patch); @@ -167,34 +167,34 @@ describe('_fixThings()', () => { await models.environment.create({ _id: 'b1', parentId: 'w1', - data: { foo: 'b1', b1: true } + data: { foo: 'b1', b1: true }, }); await models.environment.create({ _id: 'b1_sub1', parentId: 'b1', - data: { foo: '1' } + data: { foo: '1' }, }); await models.environment.create({ _id: 'b1_sub2', parentId: 'b1', - data: { foo: '2' } + data: { foo: '2' }, }); // Create second set of sub environments await models.environment.create({ _id: 'b2', parentId: 'w1', - data: { foo: 'b2', b2: true } + data: { foo: 'b2', b2: true }, }); await models.environment.create({ _id: 'b2_sub1', parentId: 'b2', - data: { foo: '3' } + data: { foo: '3' }, }); await models.environment.create({ _id: 'b2_sub2', parentId: 'b2', - data: { foo: '4' } + data: { foo: '4' }, }); // Make sure we have everything @@ -202,7 +202,7 @@ describe('_fixThings()', () => { const descendants = (await db.withDescendants(workspace)).map(d => ({ _id: d._id, parentId: d.parentId, - data: d.data || null + data: d.data || null, })); expect(descendants).toEqual([ { _id: 'w1', data: null, parentId: null }, @@ -211,7 +211,7 @@ describe('_fixThings()', () => { { _id: 'b1_sub1', data: { foo: '1' }, parentId: 'b1' }, { _id: 'b1_sub2', data: { foo: '2' }, parentId: 'b1' }, { _id: 'b2_sub1', data: { foo: '3' }, parentId: 'b2' }, - { _id: 'b2_sub2', data: { foo: '4' }, parentId: 'b2' } + { _id: 'b2_sub2', data: { foo: '4' }, parentId: 'b2' }, ]); // Run the fix algorithm @@ -221,7 +221,7 @@ describe('_fixThings()', () => { const descendants2 = (await db.withDescendants(workspace)).map(d => ({ _id: d._id, parentId: d.parentId, - data: d.data || null + data: d.data || null, })); expect(descendants2).toEqual([ { _id: 'w1', data: null, parentId: null }, @@ -234,7 +234,7 @@ describe('_fixThings()', () => { { _id: 'b1_sub1', data: { foo: '1' }, parentId: 'b1' }, { _id: 'b1_sub2', data: { foo: '2' }, parentId: 'b1' }, { _id: 'b2_sub1', data: { foo: '3' }, parentId: 'b1' }, - { _id: 'b2_sub2', data: { foo: '4' }, parentId: 'b1' } + { _id: 'b2_sub2', data: { foo: '4' }, parentId: 'b1' }, ]); }); @@ -247,13 +247,13 @@ describe('_fixThings()', () => { await models.cookieJar.create({ _id: 'j1', parentId: 'w1', - cookies: [{ id: '1', key: 'foo', value: '1' }, { id: 'j1_1', key: 'j1', value: '1' }] + cookies: [{ id: '1', key: 'foo', value: '1' }, { id: 'j1_1', key: 'j1', value: '1' }], }); await models.cookieJar.create({ _id: 'j2', parentId: 'w1', - cookies: [{ id: '1', key: 'foo', value: '2' }, { id: 'j2_1', key: 'j2', value: '2' }] + cookies: [{ id: '1', key: 'foo', value: '2' }, { id: 'j2_1', key: 'j2', value: '2' }], }); // Make sure we have everything @@ -261,20 +261,20 @@ describe('_fixThings()', () => { const descendants = (await db.withDescendants(workspace)).map(d => ({ _id: d._id, cookies: d.cookies || null, - parentId: d.parentId + parentId: d.parentId, })); expect(descendants).toEqual([ { _id: 'w1', cookies: null, parentId: null }, { _id: 'j1', parentId: 'w1', - cookies: [{ id: '1', key: 'foo', value: '1' }, { id: 'j1_1', key: 'j1', value: '1' }] + cookies: [{ id: '1', key: 'foo', value: '1' }, { id: 'j1_1', key: 'j1', value: '1' }], }, { _id: 'j2', parentId: 'w1', - cookies: [{ id: '1', key: 'foo', value: '2' }, { id: 'j2_1', key: 'j2', value: '2' }] - } + cookies: [{ id: '1', key: 'foo', value: '2' }, { id: 'j2_1', key: 'j2', value: '2' }], + }, ]); // Run the fix algorithm @@ -284,7 +284,7 @@ describe('_fixThings()', () => { const descendants2 = (await db.withDescendants(workspace)).map(d => ({ _id: d._id, cookies: d.cookies || null, - parentId: d.parentId + parentId: d.parentId, })); expect(descendants2).toEqual([ { _id: 'w1', cookies: null, parentId: null }, @@ -294,9 +294,9 @@ describe('_fixThings()', () => { cookies: [ { id: '1', key: 'foo', value: '1' }, { id: 'j1_1', key: 'j1', value: '1' }, - { id: 'j2_1', key: 'j2', value: '2' } - ] - } + { id: 'j2_1', key: 'j2', value: '2' }, + ], + }, ]); }); }); diff --git a/packages/insomnia-app/app/common/__tests__/har.test.js b/packages/insomnia-app/app/common/__tests__/har.test.js index 7c45aecef3..68593b6e92 100644 --- a/packages/insomnia-app/app/common/__tests__/har.test.js +++ b/packages/insomnia-app/app/common/__tests__/har.test.js @@ -10,7 +10,7 @@ describe('exportHar()', () => { it('exports single requests', async () => { const wrk = await models.workspace.create({ _id: 'wrk_1', - name: 'Workspace' + name: 'Workspace', }); const req1 = await models.request.create({ _id: 'req_1', @@ -21,13 +21,13 @@ describe('exportHar()', () => { method: 'POST', body: { mimeType: 'application/json', - text: '{}' + text: '{}', }, headers: [ { name: 'Content-Type', value: 'application/json' }, { name: 'Accept', value: 'application/json', disabled: false }, - { name: 'X-Disabled', value: 'X-Disabled', disabled: true } - ] + { name: 'X-Disabled', value: 'X-Disabled', disabled: true }, + ], }); await models.response.create({ parentId: req1._id, @@ -38,7 +38,7 @@ describe('exportHar()', () => { headers: [{ name: 'Content-Type', value: 'application/json' }], contentType: 'application/json', bodyPath: path.join(__dirname, '../__fixtures__/har/test-response.json'), - bodyCompression: null + bodyCompression: null, }); const exportRequests = [{ requestId: req1._id, environmentId: 'n/a' }]; @@ -48,7 +48,7 @@ describe('exportHar()', () => { log: { version: '1.2', creator: { - name: 'Insomnia REST Client' + name: 'Insomnia REST Client', }, entries: [ { @@ -61,16 +61,16 @@ describe('exportHar()', () => { cookies: [], headers: [ { name: 'Content-Type', value: 'application/json' }, - { name: 'Accept', value: 'application/json' } + { name: 'Accept', value: 'application/json' }, ], queryString: [], postData: { mimeType: 'application/json', params: [], - text: '{}' + text: '{}', }, headersSize: -1, - bodySize: -1 + bodySize: -1, }, response: { status: 200, @@ -81,11 +81,11 @@ describe('exportHar()', () => { content: { size: 15, mimeType: 'application/json', - text: '{"key":"value"}' + text: '{"key":"value"}', }, redirectURL: '', headersSize: -1, - bodySize: -1 + bodySize: -1, }, cache: {}, timings: { @@ -95,19 +95,19 @@ describe('exportHar()', () => { send: 0, wait: 999, receive: 0, - ssl: -1 + ssl: -1, }, - comment: req1.name - } - ] - } + comment: req1.name, + }, + ], + }, }); }); it('exports multiple requests', async () => { const workspace = await models.workspace.create({ _id: 'wrk_1', - name: 'Workspace' + name: 'Workspace', }); const baseReq = await models.request.create({ @@ -119,7 +119,7 @@ describe('exportHar()', () => { url: 'http://localhost', method: 'GET', body: {}, - headers: [{ name: 'X-Environment', value: '{{ envvalue }}' }] + headers: [{ name: 'X-Environment', value: '{{ envvalue }}' }], }); const req1 = await models.request.duplicate(baseReq); req1._id = 'req_1'; @@ -140,51 +140,51 @@ describe('exportHar()', () => { await models.response.create({ _id: 'res_1', parentId: req1._id, - statusCode: 204 + statusCode: 204, }); await models.response.create({ _id: 'res_2', parentId: req2._id, - statusCode: 404 + statusCode: 404, }); await models.response.create({ _id: 'res_3', parentId: req3._id, - statusCode: 500 + statusCode: 500, }); const envBase = await models.environment.getOrCreateForWorkspace(workspace); await models.environment.update(envBase, { data: { - envvalue: '' - } + envvalue: '', + }, }); const envPublic = await models.environment.create({ _id: 'env_1', name: 'Public', - parentId: envBase._id + parentId: envBase._id, }); await models.environment.update(envPublic, { data: { - envvalue: 'public' - } + envvalue: 'public', + }, }); const envPrivate = await models.environment.create({ _id: 'env_2', name: 'Private', isPrivate: true, - parentId: envBase._id + parentId: envBase._id, }); await models.environment.update(envPrivate, { data: { - envvalue: 'private' - } + envvalue: 'private', + }, }); const exportRequests = [ { requestId: req1._id, environmentId: 'n/a' }, { requestId: req2._id, environmentId: envPublic._id }, - { requestId: req3._id, environmentId: envPrivate._id } + { requestId: req3._id, environmentId: envPrivate._id }, ]; const harExport = await harUtils.exportHar(exportRequests); @@ -192,44 +192,44 @@ describe('exportHar()', () => { log: { version: '1.2', creator: { - name: 'Insomnia REST Client' + name: 'Insomnia REST Client', }, entries: [ { request: { - headers: [{ name: 'X-Environment', value: '' }, { name: 'X-Request', value: '1' }] + headers: [{ name: 'X-Environment', value: '' }, { name: 'X-Request', value: '1' }], }, response: { - status: 204 + status: 204, }, - comment: req1.name + comment: req1.name, }, { request: { headers: [ { name: 'X-Environment', value: 'public' }, - { name: 'X-Request', value: '2' } - ] + { name: 'X-Request', value: '2' }, + ], }, response: { - status: 404 + status: 404, }, - comment: req2.name + comment: req2.name, }, { request: { headers: [ { name: 'X-Environment', value: 'private' }, - { name: 'X-Request', value: '3' } - ] + { name: 'X-Request', value: '3' }, + ], }, response: { - status: 500 + status: 500, }, - comment: req3.name - } - ] - } + comment: req3.name, + }, + ], + }, }); }); }); @@ -247,8 +247,8 @@ describe('exportHarResponse()', () => { httpVersion: 'HTTP/1.1', content: { size: 0, - mimeType: '' - } + mimeType: '', + }, }); }); it('exports a valid har response for a non empty response', async () => { @@ -264,10 +264,10 @@ describe('exportHarResponse()', () => { headers: [ { name: 'Content-Type', value: 'application/json' }, { name: 'Content-Length', value: '2' }, - { name: 'Set-Cookie', value: 'sessionid=12345; HttpOnly; Path=/' } + { name: 'Set-Cookie', value: 'sessionid=12345; HttpOnly; Path=/' }, ], contentType: 'application/json', - bodyPath: path.join(__dirname, '../__fixtures__/har/test-response.json') + bodyPath: path.join(__dirname, '../__fixtures__/har/test-response.json'), }); const harResponse = await harUtils.exportHarResponse(response); @@ -281,22 +281,22 @@ describe('exportHarResponse()', () => { name: 'sessionid', value: '12345', path: '/', - httpOnly: true - } + httpOnly: true, + }, ], headers: [ { name: 'Content-Type', value: 'application/json' }, { name: 'Content-Length', value: '2' }, - { name: 'Set-Cookie', value: 'sessionid=12345; HttpOnly; Path=/' } + { name: 'Set-Cookie', value: 'sessionid=12345; HttpOnly; Path=/' }, ], content: { size: 15, mimeType: 'application/json', - text: '{"key":"value"}' + text: '{"key":"value"}', }, redirectURL: '', headersSize: -1, - bodySize: -1 + bodySize: -1, }); }); }); @@ -314,14 +314,14 @@ describe('exportHarWithRequest()', () => { domain: 'google.com', path: '/', hostOnly: true, - lastAccessed: new Date('2096-10-05T04:40:49.505Z') - } + lastAccessed: new Date('2096-10-05T04:40:49.505Z'), + }, ]; const cookieJar = await models.cookieJar.getOrCreateForParentId(workspace._id); await models.cookieJar.update(cookieJar, { parentId: workspace._id, - cookies + cookies, }); const request = Object.assign(models.request.init(), { @@ -331,14 +331,14 @@ describe('exportHarWithRequest()', () => { parameters: [{ name: 'foo bar', value: 'hello&world' }], method: 'POST', body: { - text: 'foo bar' + text: 'foo bar', }, url: 'http://google.com', authentication: { type: AUTH_BASIC, username: 'user', - password: 'pass' - } + password: 'pass', + }, }); const renderedRequest = await render.getRenderedRequest(request); @@ -353,12 +353,12 @@ describe('exportHarWithRequest()', () => { expires: '2096-10-12T04:40:49.000Z', name: 'foo', path: '/', - value: 'barrrrr' - } + value: 'barrrrr', + }, ], headers: [ { name: 'Content-Type', value: 'application/json' }, - { name: 'Authorization', value: 'Basic dXNlcjpwYXNz' } + { name: 'Authorization', value: 'Basic dXNlcjpwYXNz' }, ], headersSize: -1, httpVersion: 'HTTP/1.1', @@ -366,11 +366,11 @@ describe('exportHarWithRequest()', () => { postData: { mimeType: '', params: [], - text: 'foo bar' + text: 'foo bar', }, queryString: [{ name: 'foo bar', value: 'hello&world' }], url: 'http://google.com/', - settingEncodeUrl: true + settingEncodeUrl: true, }); }); }); diff --git a/packages/insomnia-app/app/common/__tests__/import.test.js b/packages/insomnia-app/app/common/__tests__/import.test.js index 89b354ee88..2c137fef69 100644 --- a/packages/insomnia-app/app/common/__tests__/import.test.js +++ b/packages/insomnia-app/app/common/__tests__/import.test.js @@ -8,47 +8,47 @@ describe('exportHAR()', () => { it('exports a single workspace as an HTTP Archive', async () => { const wrk1 = await models.workspace.create({ _id: 'wrk_1', - name: 'Workspace 1' + name: 'Workspace 1', }); const req1 = await models.request.create({ _id: 'req_1', name: 'Request 1', parentId: wrk1._id, headers: [{ name: 'X-Environment', value: '{{ envvalue }}' }], - metaSortKey: 0 + metaSortKey: 0, }); const req2 = await models.request.create({ _id: 'req_2', name: 'Request 2', parentId: wrk1._id, - metaSortKey: 1 + metaSortKey: 1, }); let env1Base = await models.environment.getOrCreateForWorkspace(wrk1); env1Base = await models.environment.update(env1Base, { data: { - envvalue: 'base1' - } + envvalue: 'base1', + }, }); const env1Private = await models.environment.create({ name: 'Private', parentId: env1Base._id, data: { - envvalue: 'private1' - } + envvalue: 'private1', + }, }); await models.workspaceMeta.create({ parentId: wrk1._id, - activeEnvironmentId: env1Private._id + activeEnvironmentId: env1Private._id, }); const wrk2 = await models.workspace.create({ _id: 'wrk_2', - name: 'Workspace 2' + name: 'Workspace 2', }); await models.request.create({ _id: 'req_3', name: 'Request 3', - parentId: wrk2._id + parentId: wrk2._id, }); const includePrivateDocs = true; @@ -60,75 +60,75 @@ describe('exportHAR()', () => { entries: [ { request: { - headers: [{ name: 'X-Environment', value: 'private1' }] + headers: [{ name: 'X-Environment', value: 'private1' }], }, - comment: req1.name + comment: req1.name, }, { - comment: req2.name - } - ] - } + comment: req2.name, + }, + ], + }, }); expect(data.log.entries.length).toBe(2); }); it('exports all workspaces as an HTTP Archive', async () => { const wrk1 = await models.workspace.create({ _id: 'wrk_1', - name: 'Workspace 1' + name: 'Workspace 1', }); const wrk2 = await models.workspace.create({ _id: 'wrk_2', - name: 'Workspace 2' + name: 'Workspace 2', }); await models.request.create({ _id: 'req_1', name: 'Request 1', parentId: wrk1._id, - headers: [{ name: 'X-Environment', value: '{{ envvalue }}' }] + headers: [{ name: 'X-Environment', value: '{{ envvalue }}' }], }); await models.request.create({ _id: 'req_2', name: 'Request 2', parentId: wrk2._id, - headers: [{ name: 'X-Environment', value: '{{ envvalue }}' }] + headers: [{ name: 'X-Environment', value: '{{ envvalue }}' }], }); let env1Base = await models.environment.getOrCreateForWorkspace(wrk1); env1Base = await models.environment.update(env1Base, { data: { - envvalue: 'base1' - } + envvalue: 'base1', + }, }); const env1Public = await models.environment.create({ name: 'Public', parentId: env1Base._id, data: { - envvalue: 'public1' - } + envvalue: 'public1', + }, }); const env2Base = await models.environment.getOrCreateForWorkspace(wrk2); await models.environment.update(env2Base, { data: { - envvalue: 'base2' - } + envvalue: 'base2', + }, }); const env2Private = await models.environment.create({ name: 'Private', isPrivate: true, parentId: env1Base._id, data: { - envvalue: 'private2' - } + envvalue: 'private2', + }, }); await models.workspaceMeta.create({ parentId: wrk1._id, - activeEnvironmentId: env1Public._id + activeEnvironmentId: env1Public._id, }); await models.workspaceMeta.create({ parentId: wrk2._id, - activeEnvironmentId: env2Private._id + activeEnvironmentId: env2Private._id, }); const includePrivateDocs = false; @@ -140,18 +140,18 @@ describe('exportHAR()', () => { entries: [ { request: { - headers: [{ name: 'X-Environment', value: 'public1' }] + headers: [{ name: 'X-Environment', value: 'public1' }], }, - comment: 'Request 1' + comment: 'Request 1', }, { request: { - headers: [{ name: 'X-Environment', value: 'base2' }] + headers: [{ name: 'X-Environment', value: 'base2' }], }, - comment: 'Request 2' - } - ] - } + comment: 'Request 2', + }, + ], + }, }); }); }); @@ -163,17 +163,17 @@ describe('exportJSON()', () => { const jar = await models.cookieJar.getOrCreateForParentId(w._id); const r1 = await models.request.create({ name: 'Request', - parentId: w._id + parentId: w._id, }); const eBase = await models.environment.getOrCreateForWorkspace(w); const ePub = await models.environment.create({ name: 'Public', - parentId: eBase._id + parentId: eBase._id, }); await models.environment.create({ name: 'Private', isPrivate: true, - parentId: eBase._id + parentId: eBase._id, }); const json = await importUtil.exportJSON(); diff --git a/packages/insomnia-app/app/common/__tests__/misc.test.js b/packages/insomnia-app/app/common/__tests__/misc.test.js index affeef71fe..172e3a3bab 100644 --- a/packages/insomnia-app/app/common/__tests__/misc.test.js +++ b/packages/insomnia-app/app/common/__tests__/misc.test.js @@ -6,7 +6,7 @@ describe('hasAuthHeader()', () => { it('finds valid header', () => { const yes = misc.hasAuthHeader([ { name: 'foo', value: 'bar' }, - { name: 'authorization', value: 'foo' } + { name: 'authorization', value: 'foo' }, ]); expect(yes).toEqual(true); @@ -15,7 +15,7 @@ describe('hasAuthHeader()', () => { it('finds valid header case insensitive', () => { const yes = misc.hasAuthHeader([ { name: 'foo', value: 'bar' }, - { name: 'AuthOrizAtiOn', value: 'foo' } + { name: 'AuthOrizAtiOn', value: 'foo' }, ]); expect(yes).toEqual(true); @@ -45,7 +45,7 @@ describe('filterHeaders()', () => { expect(misc.filterHeaders(null, 'good')).toEqual([]); expect(misc.filterHeaders([{ name: 'good', value: 'valid' }], null)).toEqual([]); expect(misc.filterHeaders([{ name: 'good', value: 'valid' }], 'good')).toEqual([ - { name: 'good', value: 'valid' } + { name: 'good', value: 'valid' }, ]); }); }); @@ -77,8 +77,8 @@ describe('keyedDebounce()', () => { { foo: ['bar3'], baz: ['bar'], - multi: ['foo', 'bar', 'baz'] - } + multi: ['foo', 'bar', 'baz'], + }, ]); }); }); @@ -116,13 +116,13 @@ describe('fuzzyMatch()', () => { expect(misc.fuzzyMatch('test', 'testing')).toEqual({ score: -3, indexes: [0, 1, 2, 3], - target: 'testing' + target: 'testing', }); expect(misc.fuzzyMatch('tst', 'testing')).toEqual({ score: -2004, indexes: [0, 2, 3], - target: 'testing' + target: 'testing', }); }); @@ -141,27 +141,27 @@ describe('fuzzyMatchAll()', () => { expect(misc.fuzzyMatchAll('test', ['testing', 'foo'])).toEqual({ score: -3, indexes: [0, 1, 2, 3], - target: 'testing foo' + target: 'testing foo', }); expect(misc.fuzzyMatchAll('test foo', ['testing', 'foo'], { splitSpace: true })).toEqual({ score: 0, indexes: [0, 1, 2, 3, 0, 1, 2], - target: 'testing foo' + target: 'testing foo', }); expect(misc.fuzzyMatchAll('tst', ['testing'])).toEqual({ score: -2004, indexes: [0, 2, 3], - target: 'testing' + target: 'testing', }); expect( misc.fuzzyMatch('tst this ou', 'testing this out', { splitSpace: true, - loose: true - }) + loose: true, + }), ).toEqual({ score: -20, indexes: [0, 2, 3, 8, 9, 10, 11, 13, 14], - target: 'testing this out' + target: 'testing this out', }); }); diff --git a/packages/insomnia-app/app/common/__tests__/render.test.js b/packages/insomnia-app/app/common/__tests__/render.test.js index 2dede0f3ee..81d90e2665 100644 --- a/packages/insomnia-app/app/common/__tests__/render.test.js +++ b/packages/insomnia-app/app/common/__tests__/render.test.js @@ -8,7 +8,7 @@ describe('render()', () => { beforeEach(globalBeforeEach); it('renders hello world', async () => { const rendered = await renderUtils.render('Hello {{ msg }}!', { - msg: 'World' + msg: 'World', }); expect(rendered).toBe('Hello World!'); }); @@ -39,35 +39,35 @@ describe('buildRenderContext()', () => { const ancestors = [ { type: models.requestGroup.type, - environment: { foo: 'parent', ancestor: true } + environment: { foo: 'parent', ancestor: true }, }, { type: models.requestGroup.type, - environment: { foo: 'grandparent', ancestor: true } - } + environment: { foo: 'grandparent', ancestor: true }, + }, ]; const rootEnvironment = { type: models.environment.type, - data: { foo: 'root', root: true } + data: { foo: 'root', root: true }, }; const subEnvironment = { type: models.environment.type, - data: { foo: 'sub', sub: true } + data: { foo: 'sub', sub: true }, }; const context = await renderUtils.buildRenderContext( ancestors, rootEnvironment, - subEnvironment + subEnvironment, ); expect(context).toEqual({ foo: 'parent', ancestor: true, root: true, - sub: true + sub: true, }); }); @@ -76,15 +76,15 @@ describe('buildRenderContext()', () => { { // Sub Environment type: models.requestGroup.type, - environment: { recursive: '{{ recursive }}/hello' } - } + environment: { recursive: '{{ recursive }}/hello' }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors); // This is longer than 3 because it multiplies every time (1 -> 2 -> 4 -> 8) expect(context).toEqual({ - recursive: '{{ recursive }}/hello/hello/hello/hello/hello/hello/hello/hello' + recursive: '{{ recursive }}/hello/hello/hello/hello/hello/hello/hello/hello', }); }); @@ -94,8 +94,8 @@ describe('buildRenderContext()', () => { data: { proto: 'http', domain: 'base.com', - url: '{{ proto }}://{{ domain }}' - } + url: '{{ proto }}://{{ domain }}', + }, }; const sub = { @@ -104,8 +104,8 @@ describe('buildRenderContext()', () => { proto: 'https', domain: 'sub.com', port: 8000, - url: '{{ proto }}://{{ domain }}:{{ port }}' - } + url: '{{ proto }}://{{ domain }}:{{ port }}', + }, }; const ancestors = [ @@ -115,9 +115,9 @@ describe('buildRenderContext()', () => { environment: { proto: 'https', domain: 'folder.com', - port: 7000 - } - } + port: 7000, + }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors, root, sub); @@ -126,19 +126,19 @@ describe('buildRenderContext()', () => { proto: 'https', domain: 'folder.com', port: 7000, - url: 'https://folder.com:7000' + url: 'https://folder.com:7000', }); }); it('does the thing', async () => { const root = { type: models.environment.type, - data: { url: 'insomnia.rest' } + data: { url: 'insomnia.rest' }, }; const sub = { type: models.environment.type, - data: { url: '{{ url }}/sub' } + data: { url: '{{ url }}/sub' }, }; const ancestors = [ @@ -147,16 +147,16 @@ describe('buildRenderContext()', () => { type: models.requestGroup.type, environment: { url: '{{ url }}/{{ name }}', - name: 'folder' - } - } + name: 'folder', + }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors, root, sub); expect(context).toEqual({ url: 'insomnia.rest/sub/folder', - name: 'folder' + name: 'folder', }); }); @@ -170,9 +170,9 @@ describe('buildRenderContext()', () => { c: '/c{{ d }}', b: '/b{{ c }}', a: '/a{{ b }}', - test: 'http://insomnia.rest{{ a }}' - } - } + test: 'http://insomnia.rest{{ a }}', + }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors); @@ -182,7 +182,7 @@ describe('buildRenderContext()', () => { c: '/c/d', b: '/b/c/d', a: '/a/b/c/d', - test: 'http://insomnia.rest/a/b/c/d' + test: 'http://insomnia.rest/a/b/c/d', }); }); @@ -193,9 +193,9 @@ describe('buildRenderContext()', () => { type: models.requestGroup.type, environment: { sibling: 'sibling', - test: '{{ sibling }}/hello' - } - } + test: '{{ sibling }}/hello', + }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors); @@ -209,23 +209,23 @@ describe('buildRenderContext()', () => { name: 'Parent', type: models.requestGroup.type, environment: { - test: '{{ grandparent }} parent' - } + test: '{{ grandparent }} parent', + }, }, { name: 'Grandparent', type: models.requestGroup.type, environment: { - grandparent: 'grandparent' - } - } + grandparent: 'grandparent', + }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors); expect(context).toEqual({ grandparent: 'grandparent', - test: 'grandparent parent' + test: 'grandparent parent', }); }); @@ -235,16 +235,16 @@ describe('buildRenderContext()', () => { name: 'Parent', type: models.requestGroup.type, environment: { - base_url: '{{ base_url }}/resource' - } + base_url: '{{ base_url }}/resource', + }, }, { name: 'Grandparent', type: models.requestGroup.type, environment: { - base_url: 'https://insomnia.rest' - } - } + base_url: 'https://insomnia.rest', + }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors); @@ -258,8 +258,8 @@ describe('buildRenderContext()', () => { name: 'Parent', type: models.requestGroup.type, environment: { - host: 'parent.com' - } + host: 'parent.com', + }, }, { name: 'Grandparent', @@ -269,22 +269,22 @@ describe('buildRenderContext()', () => { node: { admin: 'admin', test: 'test', - port: 8080 + port: 8080, }, urls: { admin: 'https://{{ host }}/{{ node.admin }}', - test: 'https://{{ host }}/{{ node.test }}' - } - } - } + test: 'https://{{ host }}/{{ node.test }}', + }, + }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors); expect(await renderUtils.render('{{ urls.admin }}/foo', context)).toBe( - 'https://parent.com/admin/foo' + 'https://parent.com/admin/foo', ); expect(await renderUtils.render('{{ urls.test }}/foo', context)).toBe( - 'https://parent.com/test/foo' + 'https://parent.com/test/foo', ); }); @@ -294,16 +294,16 @@ describe('buildRenderContext()', () => { name: 'Parent', type: models.requestGroup.type, environment: { - parent: 'parent' - } + parent: 'parent', + }, }, { name: 'Grandparent', type: models.requestGroup.type, environment: { - test: '{{ parent }} grandparent' - } - } + test: '{{ parent }} grandparent', + }, + }, ]; const context = await renderUtils.buildRenderContext(ancestors); @@ -318,32 +318,32 @@ describe('buildRenderContext()', () => { environment: { url: '{{ base_url }}/resource', ancestor: true, - winner: 'folder parent' - } + winner: 'folder parent', + }, }, { type: models.requestGroup.type, environment: { ancestor: true, - winner: 'folder grandparent' - } - } + winner: 'folder grandparent', + }, + }, ]; const subEnvironment = { type: models.environment.type, - data: { winner: 'sub', sub: true, base_url: 'https://insomnia.rest' } + data: { winner: 'sub', sub: true, base_url: 'https://insomnia.rest' }, }; const rootEnvironment = { type: models.environment.type, - data: { winner: 'root', root: true, base_url: 'ignore this' } + data: { winner: 'root', root: true, base_url: 'ignore this' }, }; const context = await renderUtils.buildRenderContext( ancestors, rootEnvironment, - subEnvironment + subEnvironment, ); expect(context).toEqual({ @@ -352,7 +352,7 @@ describe('buildRenderContext()', () => { ancestor: true, winner: 'folder parent', root: true, - sub: true + sub: true, }); }); @@ -365,8 +365,8 @@ describe('buildRenderContext()', () => { orderId: 123456789012345, password: "{% hash 'sha512', 'hex', hash_input %}", password_expected: "{% hash 'sha512', 'hex', hash_input_expected %}", - secret: 'ThisIsATopSecretValue' - } + secret: 'ThisIsATopSecretValue', + }, }; const context = await renderUtils.buildRenderContext([], rootEnvironment); @@ -379,7 +379,7 @@ describe('buildRenderContext()', () => { 'ea84d15f33d3f9e9098fe01659b1ea0599d345770bba20ba98bf9056676a83ffe6b5528b2451ad04badbf690cf3009a94c510121cc6897045f8bb4ba0826134c', password_expected: 'ea84d15f33d3f9e9098fe01659b1ea0599d345770bba20ba98bf9056676a83ffe6b5528b2451ad04badbf690cf3009a94c510121cc6897045f8bb4ba0826134c', - secret: 'ThisIsATopSecretValue' + secret: 'ThisIsATopSecretValue', }); }); @@ -391,7 +391,7 @@ describe('buildRenderContext()', () => { const context = await renderUtils.buildRenderContext( ancestors, rootEnvironment, - subEnvironment + subEnvironment, ); expect(context).toEqual({}); @@ -405,15 +405,15 @@ describe('render()', () => { { foo: '{{ foo }}', bar: 'bar', - baz: '{{ bad }}' + baz: '{{ bad }}', }, - { foo: 'bar', bad: 'hi' } + { foo: 'bar', bad: 'hi' }, ); expect(newObj).toEqual({ foo: 'bar', bar: 'bar', - baz: 'hi' + baz: 'hi', }); }); @@ -428,8 +428,8 @@ describe('render()', () => { num: 1234, nested: { foo: '{{ foo }}', - arr: [1, 2, '{{ foo }}'] - } + arr: [1, 2, '{{ foo }}'], + }, }; const newObj = await renderUtils.render(obj, { foo: 'bar' }); @@ -443,8 +443,8 @@ describe('render()', () => { num: 1234, nested: { foo: 'bar', - arr: [1, 2, 'bar'] - } + arr: [1, 2, 'bar'], + }, }); // Make sure original request isn't changed @@ -459,9 +459,9 @@ describe('render()', () => { { foo: '{{ foo }', bar: 'bar', - baz: '{{ bad }}' + baz: '{{ bad }}', }, - { foo: 'bar' } + { foo: 'bar' }, ); fail('Render should have failed'); } catch (err) { @@ -477,7 +477,7 @@ describe('render()', () => { template, context, null, - renderUtils.KEEP_ON_ERROR + renderUtils.KEEP_ON_ERROR, ); expect(resultOnlyVars).toBe('{{ foo }} {% invalid "hi" %}'); @@ -491,7 +491,7 @@ describe('render()', () => { it('outputs correct error path', async () => { const template = { - foo: [{ bar: '{% foo %}' }] + foo: [{ bar: '{% foo %}' }], }; try { @@ -504,7 +504,7 @@ describe('render()', () => { it('outputs correct error path when private first node', async () => { const template = { - _foo: { _bar: { baz: '{% foo %}' } } + _foo: { _bar: { baz: '{% foo %}' } }, }; try { diff --git a/packages/insomnia-app/app/common/constants.js b/packages/insomnia-app/app/common/constants.js index f30be3ae81..907e84c7b3 100644 --- a/packages/insomnia-app/app/common/constants.js +++ b/packages/insomnia-app/app/common/constants.js @@ -67,10 +67,7 @@ export const LARGE_RESPONSE_MB = 5; export const HUGE_RESPONSE_MB = 100; export const FLEXIBLE_URL_REGEX = /^(http|https):\/\/[\wàâäèéêëîïôóœùûüÿçÀÂÄÈÉÊËÎÏÔŒÙÛÜŸÇ\-_.]+[/\wàâäèéêëîïôóœùûüÿçÀÂÄÈÉÊËÎÏÔŒÙÛÜŸÇ.\-+=:\][@%^*&!#?;$]*/; export const CHECK_FOR_UPDATES_INTERVAL = 1000 * 60 * 60 * 3; // 3 hours -export const PLUGIN_PATH = path.join( - getDataDirectory(), - 'plugins' -); +export const PLUGIN_PATH = path.join(getDataDirectory(), 'plugins'); // Hotkeys export const MNEMONIC_SYM = isMac() ? '' : '&'; @@ -116,7 +113,7 @@ export const HTTP_METHODS = [ METHOD_PATCH, METHOD_DELETE, METHOD_OPTIONS, - METHOD_HEAD + METHOD_HEAD, ]; // Preview Modes @@ -127,7 +124,7 @@ export const PREVIEW_MODE_RAW = 'raw'; const previewModeMap = { [PREVIEW_MODE_FRIENDLY]: ['Preview', 'Visual Preview'], [PREVIEW_MODE_SOURCE]: ['Source', 'Source Code'], - [PREVIEW_MODE_RAW]: ['Raw', 'Raw Data'] + [PREVIEW_MODE_RAW]: ['Raw', 'Raw Data'], }; export const PREVIEW_MODES = Object.keys(previewModeMap); @@ -150,7 +147,7 @@ const contentTypesMap = { [CONTENT_TYPE_FILE]: ['File', 'Binary File'], [CONTENT_TYPE_GRAPHQL]: ['GraphQL', 'GraphQL Query'], [CONTENT_TYPE_OTHER]: ['Other', 'Other'], - [CONTENT_TYPE_EDN]: ['EDN', 'EDN'] + [CONTENT_TYPE_EDN]: ['EDN', 'EDN'], }; // Auth Types @@ -179,7 +176,7 @@ const authTypesMap = { [AUTH_HAWK]: ['Hawk', 'Hawk'], [AUTH_AWS_IAM]: ['AWS', 'AWS IAM v4'], [AUTH_ASAP]: ['ASAP', 'Atlassian ASAP'], - [AUTH_NETRC]: ['Netrc', 'Netrc File'] + [AUTH_NETRC]: ['Netrc', 'Netrc File'], }; export function getPreviewModeName(previewMode, useLong = false) { @@ -298,5 +295,5 @@ export const RESPONSE_CODE_DESCRIPTIONS = { 507: 'The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.', 508: 'The server detected an infinite loop while processing the request.', 510: 'Further extensions to the request are required for the server to fulfill it.', - 511: 'The 511 status code indicates that the client needs to authenticate to gain network access.' + 511: 'The 511 status code indicates that the client needs to authenticate to gain network access.', }; diff --git a/packages/insomnia-app/app/common/database.js b/packages/insomnia-app/app/common/database.js index 76f589e880..adbc049433 100644 --- a/packages/insomnia-app/app/common/database.js +++ b/packages/insomnia-app/app/common/database.js @@ -14,7 +14,7 @@ export const CHANGE_REMOVE = 'remove'; const database = {}; const db = { - _empty: true + _empty: true, }; // ~~~~~~~ // @@ -63,10 +63,10 @@ export async function init(types: Array, config: Object = {}, forceReset Object.assign( { autoload: true, - filename: filePath + filename: filePath, }, - config - ) + config, + ), ); collection.persistence.setAutocompactionInterval(DB_PERSIST_INTERVAL); @@ -152,7 +152,7 @@ export function offChange(callback: Function): void { } export const bufferChanges = (database.bufferChanges = async function( - millis: number = 1000 + millis: number = 1000, ): Promise { if (db._empty) return _send('bufferChanges', ...arguments); @@ -205,7 +205,7 @@ async function notifyOfChange(event: string, doc: BaseModel, fromSync: boolean): export const getMostRecentlyModified = (database.getMostRecentlyModified = async function( type: string, - query: Object = {} + query: Object = {}, ): Promise { if (db._empty) return _send('getMostRecentlyModified', ...arguments); @@ -216,7 +216,7 @@ export const getMostRecentlyModified = (database.getMostRecentlyModified = async export const findMostRecentlyModified = (database.findMostRecentlyModified = async function( type: string, query: Object = {}, - limit: number | null = null + limit: number | null = null, ): Promise> { if (db._empty) return _send('findMostRecentlyModified', ...arguments); @@ -245,7 +245,7 @@ export const findMostRecentlyModified = (database.findMostRecentlyModified = asy export const find = (database.find = async function( type: string, query: Object = {}, - sort: Object = { created: 1 } + sort: Object = { created: 1 }, ): Promise> { if (db._empty) return _send('find', ...arguments); @@ -276,7 +276,7 @@ export const all = (database.all = async function(type: string): P export const getWhere = (database.getWhere = async function( type: string, - query: Object + query: Object, ): Promise { if (db._empty) return _send('getWhere', ...arguments); @@ -286,7 +286,7 @@ export const getWhere = (database.getWhere = async function( export const get = (database.get = async function( type: string, - id: string + id: string, ): Promise { if (db._empty) return _send('get', ...arguments); @@ -300,7 +300,7 @@ export const get = (database.get = async function( export const count = (database.count = async function( type: string, - query: Object = {} + query: Object = {}, ): Promise { if (db._empty) return _send('count', ...arguments); @@ -317,7 +317,7 @@ export const count = (database.count = async function( export const upsert = (database.upsert = async function( doc: BaseModel, - fromSync: boolean = false + fromSync: boolean = false, ): Promise { if (db._empty) return _send('upsert', ...arguments); @@ -331,7 +331,7 @@ export const upsert = (database.upsert = async function( export const insert = (database.insert = async function( doc: T, - fromSync: boolean = false + fromSync: boolean = false, ): Promise { if (db._empty) return _send('insert', ...arguments); @@ -352,7 +352,7 @@ export const insert = (database.insert = async function( export const update = (database.update = async function( doc: T, - fromSync: boolean = false + fromSync: boolean = false, ): Promise { if (db._empty) return _send('update', ...arguments); @@ -373,7 +373,7 @@ export const update = (database.update = async function( export const remove = (database.remove = async function( doc: T, - fromSync: boolean = false + fromSync: boolean = false, ): Promise { if (db._empty) return _send('remove', ...arguments); @@ -393,7 +393,7 @@ export const remove = (database.remove = async function( export const removeWhere = (database.removeWhere = async function( type: string, - query: Object + query: Object, ): Promise { if (db._empty) return _send('removeWhere', ...arguments); @@ -428,7 +428,7 @@ export async function docUpdate( // NOTE: This is before `patch` because we want `patch.modified` to win if it has it { modified: Date.now() }, - ...patches + ...patches, ); return database.update(doc); @@ -440,7 +440,7 @@ export async function docCreate(type: string, ...patches: Array(type: string, ...patches: Array> { if (db._empty) return _send('withDescendants', ...arguments); @@ -489,7 +489,7 @@ export const withDescendants = (database.withDescendants = async function( export const withAncestors = (database.withAncestors = async function( doc: BaseModel | null, - types: Array = allTypes() + types: Array = allTypes(), ): Promise> { if (db._empty) return _send('withAncestors', ...arguments); @@ -524,7 +524,7 @@ export const withAncestors = (database.withAncestors = async function( export const duplicate = (database.duplicate = async function( originalDoc: T, - patch: Object = {} + patch: Object = {}, ): Promise { if (db._empty) return _send('duplicate', ...arguments); @@ -595,7 +595,7 @@ export async function _repairDatabase() { */ async function _repairBaseEnvironments(workspace) { const baseEnvironments = await find(models.environment.type, { - parentId: workspace._id + parentId: workspace._id, }); // Nothing to do here @@ -611,7 +611,7 @@ async function _repairBaseEnvironments(workspace) { chosenBase.data = Object.assign(baseEnvironment.data, chosenBase.data); const subEnvironments = await find(models.environment.type, { - parentId: baseEnvironment._id + parentId: baseEnvironment._id, }); for (const subEnvironment of subEnvironments) { @@ -635,7 +635,7 @@ async function _repairBaseEnvironments(workspace) { */ async function _fixMultipleCookieJars(workspace) { const cookieJars = await find(models.cookieJar.type, { - parentId: workspace._id + parentId: workspace._id, }); // Nothing to do here diff --git a/packages/insomnia-app/app/common/fetch.js b/packages/insomnia-app/app/common/fetch.js index 7737130113..4b4ebc1a9e 100644 --- a/packages/insomnia-app/app/common/fetch.js +++ b/packages/insomnia-app/app/common/fetch.js @@ -37,7 +37,7 @@ export function rawFetch(...args) { async function _fetch(method, path, obj, sessionId = null) { const config = { method: method, - headers: new window.Headers() + headers: new window.Headers(), }; // Set some client information diff --git a/packages/insomnia-app/app/common/har.js b/packages/insomnia-app/app/common/har.js index 1fe23209e8..cd8ef6eeb9 100644 --- a/packages/insomnia-app/app/common/har.js +++ b/packages/insomnia-app/app/common/har.js @@ -26,19 +26,19 @@ export type HarCookie = { expires?: string, httpOnly?: boolean, secure?: boolean, - comment?: string + comment?: string, }; export type HarHeader = { name: string, value: string, - comment?: string + comment?: string, }; export type HarQueryString = { name: string, value: string, - comment?: string + comment?: string, }; export type HarPostParam = { @@ -46,14 +46,14 @@ export type HarPostParam = { value?: string, fileName?: string, contentType?: string, - comment?: string + comment?: string, }; export type HarPostData = { mimeType: string, params: Array, text: string, - comment?: string + comment?: string, }; export type HarRequest = { @@ -67,7 +67,7 @@ export type HarRequest = { headersSize: number, bodySize: number, comment?: string, - settingEncodeUrl: boolean + settingEncodeUrl: boolean, }; export type HarContent = { @@ -76,7 +76,7 @@ export type HarContent = { mimeType: string, text?: string, encoding?: string, - comment?: string + comment?: string, }; export type HarResponse = { @@ -89,7 +89,7 @@ export type HarResponse = { redirectURL: string, headersSize: number, bodySize: number, - comment?: string + comment?: string, }; export type HarRequestCache = { @@ -97,13 +97,13 @@ export type HarRequestCache = { lastAccess: string, eTag: string, hitCount: number, - comment?: string + comment?: string, }; export type HarCache = { beforeRequest?: HarRequestCache, afterRequest?: HarRequestCache, - comment?: string + comment?: string, }; export type HarEntryTimings = { @@ -114,7 +114,7 @@ export type HarEntryTimings = { wait: number, receive: number, ssl?: number, - comment?: string + comment?: string, }; export type HarEntry = { @@ -127,13 +127,13 @@ export type HarEntry = { timings: HarEntryTimings, serverIPAddress?: string, connection?: string, - comment?: string + comment?: string, }; export type HarPageTimings = { onContentLoad?: number, onLoad?: number, - comment?: string + comment?: string, }; export type HarPage = { @@ -141,19 +141,19 @@ export type HarPage = { id: string, title: string, pageTimings: HarPageTimings, - comment?: string + comment?: string, }; export type HarCreator = { name: string, version: string, - comment?: string + comment?: string, }; export type HarBrowser = { name: string, version: string, - comment?: string + comment?: string, }; export type HarLog = { @@ -162,16 +162,16 @@ export type HarLog = { browser?: HarBrowser, pages?: Array, entries: Array, - comment?: string + comment?: string, }; export type Har = { - log: HarLog + log: HarLog, }; export type ExportRequest = { requestId: string, - environmentId: string + environmentId: string, }; export async function exportHar(exportRequests: Array): Promise { @@ -190,7 +190,7 @@ export async function exportHar(exportRequests: Array): Promise): Promise): Promise { const request = await models.request.getById(requestId); if (!request) { @@ -277,13 +277,13 @@ export async function exportHarRequest( export async function exportHarWithRequest( request: Request, environmentId: string, - addContentLength: boolean = false + addContentLength: boolean = false, ): Promise { try { const renderResult = await getRenderedRequestAndContext(request, environmentId); const renderedRequest = await _applyRequestPluginHooks( renderResult.request, - renderResult.context + renderResult.context, ); return exportHarWithRenderedRequest(renderedRequest, addContentLength); } catch (err) { @@ -297,7 +297,7 @@ export async function exportHarWithRequest( async function _applyRequestPluginHooks( renderedRequest: RenderedRequest, - renderedContext: Object + renderedContext: Object, ): Promise { let newRenderedRequest = renderedRequest; for (const { plugin, hook } of await plugins.getRequestHooks()) { @@ -306,7 +306,7 @@ async function _applyRequestPluginHooks( const context = { ...pluginContexts.app.init(), ...pluginContexts.request.init(newRenderedRequest, renderedContext), - ...pluginContexts.store.init(plugin) + ...pluginContexts.store.init(plugin), }; try { @@ -322,7 +322,7 @@ async function _applyRequestPluginHooks( export async function exportHarWithRenderedRequest( renderedRequest: RenderedRequest, - addContentLength: boolean = false + addContentLength: boolean = false, ): Promise { const url = smartEncodeUrl(renderedRequest.url, renderedRequest.settingEncodeUrl); @@ -343,12 +343,12 @@ export async function exportHarWithRenderedRequest( renderedRequest._id, url, renderedRequest.method, - renderedRequest.authentication + renderedRequest.authentication, ); if (header) { renderedRequest.headers.push({ name: header.name, - value: header.value + value: header.value, }); } } @@ -363,7 +363,7 @@ export async function exportHarWithRenderedRequest( postData: getRequestPostData(renderedRequest), headersSize: -1, bodySize: -1, - settingEncodeUrl: renderedRequest.settingEncodeUrl + settingEncodeUrl: renderedRequest.settingEncodeUrl, }; } @@ -393,7 +393,7 @@ function getReponseCookies(response: ResponseModel): Array { function mapCookie(cookie: Cookie): HarCookie { const harCookie: HarCookie = { name: cookie.key, - value: cookie.value + value: cookie.value, }; if (cookie.path) { @@ -441,7 +441,7 @@ function getResponseContent(response: ResponseModel): HarContent { return { size: body.byteLength, mimeType: response.contentType, - text: body.toString('utf8') + text: body.toString('utf8'), }; } @@ -449,7 +449,7 @@ function getResponseHeaders(response: ResponseModel): Array { return response.headers.filter(header => header.name).map(h => { return { name: h.name, - value: h.value + value: h.value, }; }); } @@ -458,7 +458,7 @@ function getRequestHeaders(renderedRequest: RenderedRequest): Array { return renderedRequest.headers.filter(header => header.name).map(header => { return { name: header.name, - value: header.value + value: header.value, }; }); } @@ -467,7 +467,7 @@ function getRequestQueryString(renderedRequest: RenderedRequest): Array { return { name: parameter.name, - value: parameter.value + value: parameter.value, }; }); } @@ -491,7 +491,7 @@ function getRequestPostData(renderedRequest: RenderedRequest): HarPostData | voi params = body.params.map(param => { return { name: param.name, - value: param.value + value: param.value, }; }); } @@ -499,6 +499,6 @@ function getRequestPostData(renderedRequest: RenderedRequest): HarPostData | voi return { mimeType: body.mimeType || '', text: body.text || '', - params: params + params: params, }; } diff --git a/packages/insomnia-app/app/common/hotkeys.js b/packages/insomnia-app/app/common/hotkeys.js index 4322409895..ba1e536ec7 100644 --- a/packages/insomnia-app/app/common/hotkeys.js +++ b/packages/insomnia-app/app/common/hotkeys.js @@ -8,7 +8,7 @@ export type Hotkey = { alt: boolean, shift: boolean, keycode: number | Array, - metaIsCtrl?: boolean + metaIsCtrl?: boolean, }; export const SHOW_WORKSPACE_SETTINGS: Hotkey = { @@ -16,7 +16,7 @@ export const SHOW_WORKSPACE_SETTINGS: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.comma + keycode: keycodes.comma, }; export const SHOW_REQUEST_SETTINGS: Hotkey = { @@ -24,7 +24,7 @@ export const SHOW_REQUEST_SETTINGS: Hotkey = { meta: true, alt: true, shift: true, - keycode: keycodes.comma + keycode: keycodes.comma, }; export const SHOW_KEYBOARD_SHORTCUTS: Hotkey = { @@ -32,7 +32,7 @@ export const SHOW_KEYBOARD_SHORTCUTS: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.forwardslash + keycode: keycodes.forwardslash, }; export const SHOW_SETTINGS: Hotkey = { @@ -40,7 +40,7 @@ export const SHOW_SETTINGS: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.comma + keycode: keycodes.comma, }; export const TOGGLE_MAIN_MENU: Hotkey = { @@ -48,7 +48,7 @@ export const TOGGLE_MAIN_MENU: Hotkey = { meta: true, alt: true, shift: false, - keycode: keycodes.comma + keycode: keycodes.comma, }; export const TOGGLE_SIDEBAR: Hotkey = { @@ -56,7 +56,7 @@ export const TOGGLE_SIDEBAR: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.backslash + keycode: keycodes.backslash, }; export const SHOW_QUICK_SWITCHER: Hotkey = { @@ -64,7 +64,7 @@ export const SHOW_QUICK_SWITCHER: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.p + keycode: keycodes.p, }; export const RELOAD_PLUGINS: Hotkey = { @@ -72,7 +72,7 @@ export const RELOAD_PLUGINS: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.r + keycode: keycodes.r, }; export const SHOW_AUTOCOMPLETE: Hotkey = { @@ -81,7 +81,7 @@ export const SHOW_AUTOCOMPLETE: Hotkey = { metaIsCtrl: true, alt: false, shift: false, - keycode: keycodes.space + keycode: keycodes.space, }; export const SEND_REQUEST: Hotkey = { @@ -89,7 +89,7 @@ export const SEND_REQUEST: Hotkey = { meta: true, alt: false, shift: false, - keycode: [keycodes.enter, keycodes.r] + keycode: [keycodes.enter, keycodes.r], }; export const SEND_REQUEST_F5: Hotkey = { @@ -97,7 +97,7 @@ export const SEND_REQUEST_F5: Hotkey = { meta: false, alt: false, shift: false, - keycode: keycodes.f5 + keycode: keycodes.f5, }; export const SHOW_SEND_OPTIONS: Hotkey = { @@ -105,7 +105,7 @@ export const SHOW_SEND_OPTIONS: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.enter + keycode: keycodes.enter, }; export const SHOW_ENVIRONMENTS: Hotkey = { @@ -113,7 +113,7 @@ export const SHOW_ENVIRONMENTS: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.e + keycode: keycodes.e, }; export const TOGGLE_ENVIRONMENTS_MENU: Hotkey = { @@ -121,7 +121,7 @@ export const TOGGLE_ENVIRONMENTS_MENU: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.e + keycode: keycodes.e, }; export const TOGGLE_METHOD_DROPDOWN: Hotkey = { @@ -129,7 +129,7 @@ export const TOGGLE_METHOD_DROPDOWN: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.l + keycode: keycodes.l, }; export const TOGGLE_HISTORY_DROPDOWN: Hotkey = { @@ -137,7 +137,7 @@ export const TOGGLE_HISTORY_DROPDOWN: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.h + keycode: keycodes.h, }; export const FOCUS_URL: Hotkey = { @@ -145,7 +145,7 @@ export const FOCUS_URL: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.l + keycode: keycodes.l, }; export const GENERATE_CODE: Hotkey = { @@ -153,7 +153,7 @@ export const GENERATE_CODE: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.g + keycode: keycodes.g, }; export const FOCUS_FILTER: Hotkey = { @@ -161,7 +161,7 @@ export const FOCUS_FILTER: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.f + keycode: keycodes.f, }; export const FOCUS_RESPONSE: Hotkey = { @@ -169,7 +169,7 @@ export const FOCUS_RESPONSE: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.singlequote + keycode: keycodes.singlequote, }; export const SHOW_COOKIES: Hotkey = { @@ -177,7 +177,7 @@ export const SHOW_COOKIES: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.k + keycode: keycodes.k, }; export const CREATE_REQUEST: Hotkey = { @@ -185,7 +185,7 @@ export const CREATE_REQUEST: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.n + keycode: keycodes.n, }; export const DELETE_REQUEST: Hotkey = { @@ -193,7 +193,7 @@ export const DELETE_REQUEST: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.delete + keycode: keycodes.delete, }; export const CREATE_FOLDER: Hotkey = { @@ -201,7 +201,7 @@ export const CREATE_FOLDER: Hotkey = { meta: true, alt: false, shift: true, - keycode: keycodes.n + keycode: keycodes.n, }; export const DUPLICATE_REQUEST: Hotkey = { @@ -209,7 +209,7 @@ export const DUPLICATE_REQUEST: Hotkey = { meta: true, alt: false, shift: false, - keycode: keycodes.d + keycode: keycodes.d, }; export const CLOSE_DROPDOWN: Hotkey = { @@ -217,7 +217,7 @@ export const CLOSE_DROPDOWN: Hotkey = { meta: false, alt: false, shift: false, - keycode: keycodes.esc + keycode: keycodes.esc, }; export const CLOSE_MODAL: Hotkey = { @@ -225,7 +225,7 @@ export const CLOSE_MODAL: Hotkey = { meta: false, alt: false, shift: false, - keycode: keycodes.esc + keycode: keycodes.esc, }; export const UNCOVER_VARIABLES: Hotkey = { @@ -233,7 +233,7 @@ export const UNCOVER_VARIABLES: Hotkey = { meta: false, alt: true, shift: true, - keycode: keycodes.u + keycode: keycodes.u, }; export function pressedHotKey(e: KeyboardEvent, definition: Hotkey): boolean { diff --git a/packages/insomnia-app/app/common/import.js b/packages/insomnia-app/app/common/import.js index c3ceb76d9e..2efb03e6f5 100644 --- a/packages/insomnia-app/app/common/import.js +++ b/packages/insomnia-app/app/common/import.js @@ -29,7 +29,7 @@ const MODELS = { [EXPORT_TYPE_REQUEST_GROUP]: models.requestGroup, [EXPORT_TYPE_WORKSPACE]: models.workspace, [EXPORT_TYPE_COOKIE_JAR]: models.cookieJar, - [EXPORT_TYPE_ENVIRONMENT]: models.environment + [EXPORT_TYPE_ENVIRONMENT]: models.environment, }; export async function importUri(workspaceId: string | null, uri: string): Promise { @@ -72,11 +72,11 @@ export async function importUri(workspaceId: string | null, uri: string): Promis export async function importRaw( workspaceId: string | null, rawContent: string, - generateNewIds: boolean = false + generateNewIds: boolean = false, ): Promise<{ source: string, error: string | null, - summary: { [string]: Array } + summary: { [string]: Array }, }> { let results; try { @@ -86,7 +86,7 @@ export async function importRaw( return { source: 'not found', error: 'No importers found for file', - summary: {} + summary: {}, }; } @@ -96,7 +96,7 @@ export async function importRaw( // Fetch the base environment in case we need it let baseEnvironment: Environment | null = await models.environment.getOrCreateForWorkspaceId( - workspaceId || 'n/a' + workspaceId || 'n/a', ); // Generate all the ids we may need @@ -120,7 +120,7 @@ export async function importRaw( if (!baseEnvironment) { if (!workspace) { workspace = await models.workspace.create({ - name: 'Imported Workspace' + name: 'Imported Workspace', }); } baseEnvironment = await models.environment.getOrCreateForWorkspace(workspace); @@ -184,13 +184,13 @@ export async function importRaw( return { source: results.type && typeof results.type.id === 'string' ? results.type.id : 'unknown', summary: importedDocs, - error: null + error: null, }; } export async function exportHAR( parentDoc: BaseModel | null = null, - includePrivateDocs: boolean = false + includePrivateDocs: boolean = false, ): Promise { let workspaces; if (parentDoc) { @@ -219,7 +219,7 @@ export async function exportHAR( .map((request: BaseModel) => { return { requestId: request._id, - environmentId: workspaceEnvironmentLookup[workspace._id] + environmentId: workspaceEnvironmentLookup[workspace._id], }; }); @@ -233,14 +233,14 @@ export async function exportHAR( export async function exportJSON( parentDoc: BaseModel | null = null, - includePrivateDocs: boolean = false + includePrivateDocs: boolean = false, ): Promise { const data = { _type: 'export', __export_format: EXPORT_FORMAT, __export_date: new Date(), __export_source: `insomnia.desktop.app:v${getAppVersion()}`, - resources: [] + resources: [], }; const docs: Array = await getDocWithDescendants(parentDoc, includePrivateDocs); @@ -253,7 +253,7 @@ export async function exportJSON( d.type === models.requestGroup.type || d.type === models.workspace.type || d.type === models.cookieJar.type || - d.type === models.environment.type + d.type === models.environment.type, ) .map((d: Object) => { if (d.type === models.workspace.type) { @@ -278,12 +278,12 @@ export async function exportJSON( async function getDocWithDescendants( parentDoc: BaseModel | null = null, - includePrivateDocs: boolean = false + includePrivateDocs: boolean = false, ): Promise> { const docs = await db.withDescendants(parentDoc); return docs.filter( d => // Don't include if private, except if we want to - !(d: any).isPrivate || includePrivateDocs + !(d: any).isPrivate || includePrivateDocs, ); } diff --git a/packages/insomnia-app/app/common/keycodes.js b/packages/insomnia-app/app/common/keycodes.js index 83f4e26b10..413c5fc6e4 100644 --- a/packages/insomnia-app/app/common/keycodes.js +++ b/packages/insomnia-app/app/common/keycodes.js @@ -97,5 +97,5 @@ export default { openbracket: 219, backslash: 220, closebracket: 221, - singlequote: 222 + singlequote: 222, }; diff --git a/packages/insomnia-app/app/common/markdown-to-html.js b/packages/insomnia-app/app/common/markdown-to-html.js index 815e34ec22..73c90f5784 100644 --- a/packages/insomnia-app/app/common/markdown-to-html.js +++ b/packages/insomnia-app/app/common/markdown-to-html.js @@ -8,7 +8,7 @@ marked.setOptions({ pedantic: false, sanitize: true, smartLists: true, - smartypants: false + smartypants: false, }); export function markdownToHTML(markdown) { diff --git a/packages/insomnia-app/app/common/misc.js b/packages/insomnia-app/app/common/misc.js index d90ca194b3..bda01c2889 100644 --- a/packages/insomnia-app/app/common/misc.js +++ b/packages/insomnia-app/app/common/misc.js @@ -11,12 +11,12 @@ const ESCAPE_REGEX_MATCH = /[-[\]/{}()*+?.\\^$|]/g; type Header = { name: string, - value: string + value: string, }; type Parameter = { name: string, - value: string + value: string, }; export function filterParameters(parameters: Array, name: string): Array { @@ -233,7 +233,7 @@ export function escapeRegex(str: string): string { export function fuzzyMatch( searchString: string, text: string, - options: { splitSpace?: boolean, loose?: boolean } = {} + options: { splitSpace?: boolean, loose?: boolean } = {}, ): null | { score: number, indexes: Array } { return fuzzyMatchAll(searchString, [text], options); } @@ -241,7 +241,7 @@ export function fuzzyMatch( export function fuzzyMatchAll( searchString: string, allText: Array, - options: { splitSpace?: boolean, loose?: boolean } = {} + options: { splitSpace?: boolean, loose?: boolean } = {}, ): null | { score: number, indexes: Array } { if (!searchString || !searchString.trim()) { return null; diff --git a/packages/insomnia-app/app/common/render.js b/packages/insomnia-app/app/common/render.js index 2e62672179..212eb5da34 100644 --- a/packages/insomnia-app/app/common/render.js +++ b/packages/insomnia-app/app/common/render.js @@ -21,14 +21,14 @@ export const RENDER_PURPOSE_GENERAL: RenderPurpose = 'general'; export type RenderedRequest = Request & { cookies: Array<{ name: string, value: string, disabled?: boolean }>, - cookieJar: CookieJar + cookieJar: CookieJar, }; export async function buildRenderContext( ancestors: Array | null, rootEnvironment: Environment | null, subEnvironment: Environment | null, - baseContext: Object = {} + baseContext: Object = {}, ): Object { const envObjects = []; @@ -77,7 +77,7 @@ export async function buildRenderContext( renderContext, // Only render with key being overwritten null, KEEP_ON_ERROR, - 'Environment' + 'Environment', ); } else { // Otherwise it's just a regular replacement @@ -101,7 +101,7 @@ export async function buildRenderContext( finalRenderContext, null, KEEP_ON_ERROR, - 'Environment' + 'Environment', ); } } @@ -123,7 +123,7 @@ export async function render( context: Object = {}, blacklistPathRegex: RegExp | null = null, errorMode: string = THROW_ON_ERROR, - name: string = '' + name: string = '', ): Promise { // Make a deep copy so no one gets mad :) const newObj = clone(obj); @@ -193,13 +193,13 @@ export async function getRenderContext( request: Request, environmentId: string, ancestors: Array | null = null, - purpose: string | null = null + purpose: string | null = null, ): Promise { if (!ancestors) { ancestors = await db.withAncestors(request, [ models.request.type, models.requestGroup.type, - models.workspace.type + models.workspace.type, ]); } @@ -209,7 +209,7 @@ export async function getRenderContext( } const rootEnvironment = await models.environment.getOrCreateForWorkspaceId( - workspace ? workspace._id : 'n/a' + workspace ? workspace._id : 'n/a', ); const subEnvironment = await models.environment.getById(environmentId); @@ -243,11 +243,11 @@ export async function getRenderContext( const baseContext = {}; baseContext.getMeta = () => ({ requestId: request ? request._id : null, - workspaceId: workspace ? workspace._id : 'n/a' + workspaceId: workspace ? workspace._id : 'n/a', }); baseContext.getKeysContext = () => ({ - keyContext: keySource + keyContext: keySource, }); baseContext.getPurpose = () => purpose; @@ -259,12 +259,12 @@ export async function getRenderContext( export async function getRenderedRequestAndContext( request: Request, environmentId: string, - purpose?: string + purpose?: string, ): Promise<{ request: RenderedRequest, context: Object }> { const ancestors = await db.withAncestors(request, [ models.request.type, models.requestGroup.type, - models.workspace.type + models.workspace.type, ]); const workspace = ancestors.find(doc => doc.type === models.workspace.type); const parentId = workspace ? workspace._id : 'n/a'; @@ -286,7 +286,7 @@ export async function getRenderedRequestAndContext( const renderResult = await render( { _request: request, _cookieJar: cookieJar }, renderContext, - request.settingDisableRenderRequestBody ? /^body.*/ : null + request.settingDisableRenderRequestBody ? /^body.*/ : null, ); const renderedRequest = renderResult._request; @@ -341,15 +341,15 @@ export async function getRenderedRequestAndContext( settingRebuildPath: renderedRequest.settingRebuildPath, settingMaxTimelineDataSize: renderedRequest.settingMaxTimelineDataSize, type: renderedRequest.type, - url: renderedRequest.url - } + url: renderedRequest.url, + }, }; } export async function getRenderedRequest( request: Request, environmentId: string, - purpose?: string + purpose?: string, ): Promise { const result = await getRenderedRequestAndContext(request, environmentId, purpose); return result.request; diff --git a/packages/insomnia-app/app/datasets/access-token-urls.js b/packages/insomnia-app/app/datasets/access-token-urls.js index 8b108f37ee..76a10f0a1e 100644 --- a/packages/insomnia-app/app/datasets/access-token-urls.js +++ b/packages/insomnia-app/app/datasets/access-token-urls.js @@ -12,5 +12,5 @@ export default [ 'https://{{ shop }}.myshopify.com/admin/oauth/authorize', 'https://api.box.com/oauth2/token', 'https://api-ssl.bitly.com/oauth/access_token', - 'https://api.imgur.com/oauth2/token' + 'https://api.imgur.com/oauth2/token', ]; diff --git a/packages/insomnia-app/app/datasets/authorization-urls.js b/packages/insomnia-app/app/datasets/authorization-urls.js index 596da85790..22f6af1c79 100644 --- a/packages/insomnia-app/app/datasets/authorization-urls.js +++ b/packages/insomnia-app/app/datasets/authorization-urls.js @@ -12,5 +12,5 @@ export default [ 'https://todoist.com/oauth/authorize', 'https://account.box.com/api/oauth2/authorize', 'https://bitly.com/oauth/authorize', - 'https://api.imgur.com/oauth2/authorize' + 'https://api.imgur.com/oauth2/authorize', ]; diff --git a/packages/insomnia-app/app/datasets/charsets.js b/packages/insomnia-app/app/datasets/charsets.js index c422a8c0c7..67e5a3f6ab 100644 --- a/packages/insomnia-app/app/datasets/charsets.js +++ b/packages/insomnia-app/app/datasets/charsets.js @@ -117,5 +117,5 @@ export default [ 'x-mac-icelandic', 'x-mac-japanese', 'x-mac-korean', - 'x-mac-turkish' + 'x-mac-turkish', ]; diff --git a/packages/insomnia-app/app/datasets/content-types.js b/packages/insomnia-app/app/datasets/content-types.js index 61c173af92..5f92eae4d3 100644 --- a/packages/insomnia-app/app/datasets/content-types.js +++ b/packages/insomnia-app/app/datasets/content-types.js @@ -204,5 +204,5 @@ export default [ 'video/x-f4v', 'video/x-fli', 'video/x-flv', - 'video/x-m4v' + 'video/x-m4v', ]; diff --git a/packages/insomnia-app/app/datasets/header-names.js b/packages/insomnia-app/app/datasets/header-names.js index a72c751c40..926b9da06b 100644 --- a/packages/insomnia-app/app/datasets/header-names.js +++ b/packages/insomnia-app/app/datasets/header-names.js @@ -31,5 +31,5 @@ export default [ 'User-Agent', 'Upgrade', 'Via', - 'Warning' + 'Warning', ]; diff --git a/packages/insomnia-app/app/main.development.js b/packages/insomnia-app/app/main.development.js index 6be53574d3..ddc0d2c5b0 100644 --- a/packages/insomnia-app/app/main.development.js +++ b/packages/insomnia-app/app/main.development.js @@ -109,7 +109,7 @@ async function _trackStats() { lastLaunch: oldStats.currentLaunch, currentVersion: getAppVersion(), lastVersion: oldStats.currentVersion, - launches: oldStats.launches + 1 + launches: oldStats.launches + 1, }); // Update Stats Object @@ -128,7 +128,7 @@ async function _trackStats() { url: `${CHANGELOG_BASE_URL}/${currentVersion}/`, cta: "See What's New", message: `Updated to ${currentVersion}`, - email: 'support@insomnia.rest' + email: 'support@insomnia.rest', }; // Wait a bit before showing the user because the app just launched. diff --git a/packages/insomnia-app/app/main/updates.js b/packages/insomnia-app/app/main/updates.js index aa41bd1a45..91900481b0 100644 --- a/packages/insomnia-app/app/main/updates.js +++ b/packages/insomnia-app/app/main/updates.js @@ -5,7 +5,7 @@ import { getAppVersion, isDevelopment, UPDATE_URL_MAC, - UPDATE_URL_WINDOWS + UPDATE_URL_WINDOWS, } from '../common/constants'; import * as models from '../models/index'; import { buildQueryStringFromParams, joinUrlAndQueryString } from 'insomnia-url'; @@ -28,7 +28,7 @@ async function getUpdateUrl(force: boolean): Promise { const params = [ { name: 'v', value: getAppVersion() }, - { name: 'channel', value: settings.updateChannel } + { name: 'channel', value: settings.updateChannel }, ]; const qs = buildQueryStringFromParams(params); @@ -131,7 +131,7 @@ async function _checkForUpdates(force: boolean) { if (updateUrl === null) { console.log( - `[updater] Updater not running platform=${process.platform} dev=${isDevelopment()}` + `[updater] Updater not running platform=${process.platform} dev=${isDevelopment()}`, ); _sendUpdateComplete(false, 'Updates Not Supported'); return; diff --git a/packages/insomnia-app/app/main/window-utils.js b/packages/insomnia-app/app/main/window-utils.js index 0778b6979c..d025e78eeb 100644 --- a/packages/insomnia-app/app/main/window-utils.js +++ b/packages/insomnia-app/app/main/window-utils.js @@ -10,7 +10,7 @@ import { getAppName, getAppVersion, isDevelopment, - isMac + isMac, } from '../common/constants'; import * as misc from '../common/misc'; @@ -59,8 +59,8 @@ export function createWindow() { acceptFirstMouse: true, icon: path.resolve(__dirname, 'static/icon.png'), webPreferences: { - zoomFactor: zoomFactor - } + zoomFactor: zoomFactor, + }, }); // BrowserWindow doesn't have an option for this, so we have to do it manually :( @@ -108,7 +108,7 @@ export function createWindow() { return; } window.webContents.send('toggle-preferences'); - } + }, }, { label: `${MNEMONIC_SYM}Changelog`, @@ -117,12 +117,12 @@ export function createWindow() { return; } misc.clickLink(`${CHANGELOG_BASE_URL}/${getAppVersion()}/`); - } + }, }, ...(isMac() ? [{ type: 'separator' }, { role: 'hide' }, { role: 'hideothers' }] : []), { type: 'separator' }, - { label: `${MNEMONIC_SYM}Quit`, accelerator: 'CmdOrCtrl+Q', click: () => app.quit() } - ] + { label: `${MNEMONIC_SYM}Quit`, accelerator: 'CmdOrCtrl+Q', click: () => app.quit() }, + ], }; const editMenu = { @@ -137,9 +137,9 @@ export function createWindow() { { label: `Select ${MNEMONIC_SYM}All`, accelerator: 'CmdOrCtrl+A', - selector: 'selectAll:' - } - ] + selector: 'selectAll:', + }, + ], }; const viewMenu = { @@ -158,7 +158,7 @@ export function createWindow() { const zoomFactor = 1; window.webContents.setZoomFactor(zoomFactor); saveZoomFactor(zoomFactor); - } + }, }, { label: `Zoom ${MNEMONIC_SYM}In`, @@ -173,7 +173,7 @@ export function createWindow() { window.webContents.setZoomFactor(zoomFactor); saveZoomFactor(zoomFactor); - } + }, }, { label: `Zoom ${MNEMONIC_SYM}Out`, @@ -187,7 +187,7 @@ export function createWindow() { const zoomFactor = Math.max(0.5, getZoomFactor() - 0.05); window.webContents.setZoomFactor(zoomFactor); saveZoomFactor(zoomFactor); - } + }, }, { label: `Toggle ${MNEMONIC_SYM}Sidebar`, @@ -199,13 +199,13 @@ export function createWindow() { } window.webContents.send('toggle-sidebar'); - } + }, }, { label: `Toggle ${MNEMONIC_SYM}DevTools`, - click: () => mainWindow.toggleDevTools() - } - ] + click: () => mainWindow.toggleDevTools(), + }, + ], }; const windowMenu = { @@ -213,8 +213,8 @@ export function createWindow() { role: 'window', submenu: [ { label: `${MNEMONIC_SYM}Minimize`, role: 'minimize' }, - ...(isMac() ? [{ label: `${MNEMONIC_SYM}Close`, role: 'close' }] : []) - ] + ...(isMac() ? [{ label: `${MNEMONIC_SYM}Close`, role: 'close' }] : []), + ], }; const helpMenu = { @@ -226,7 +226,7 @@ export function createWindow() { label: `Contact ${MNEMONIC_SYM}Support`, click: () => { shell.openExternal('https://insomnia.rest/support/'); - } + }, }, { label: `${MNEMONIC_SYM}Keyboard Shortcuts`, @@ -236,23 +236,23 @@ export function createWindow() { return; } window.webContents.send('toggle-preferences-shortcuts'); - } + }, }, { label: `Show App ${MNEMONIC_SYM}Data Folder`, click: (menuItem, window, e) => { const directory = misc.getDataDirectory(); shell.showItemInFolder(directory); - } + }, }, { label: `Insomnia ${MNEMONIC_SYM}Help`, accelerator: !isMac() ? 'F1' : null, click: () => { shell.openExternal('https://support.insomnia.rest'); - } - } - ] + }, + }, + ], }; if (!isMac()) { @@ -270,10 +270,10 @@ export function createWindow() { 'V8 ' + process.versions.v8, 'Architecture ' + process.arch, '', // Blank line before libcurl - Curl.getVersion() - ].join('\n') + Curl.getVersion(), + ].join('\n'), }); - } + }, }); } @@ -284,12 +284,12 @@ export function createWindow() { { label: `${MNEMONIC_SYM}Reload`, accelerator: 'Shift+F5', - click: () => mainWindow.reload() + click: () => mainWindow.reload(), }, { label: `Toggle ${MNEMONIC_SYM}DevTools`, accelerator: 'Alt+CmdOrCtrl+I', - click: () => mainWindow.toggleDevTools() + click: () => mainWindow.toggleDevTools(), }, { label: `Resize to Defaul${MNEMONIC_SYM}t`, @@ -298,8 +298,8 @@ export function createWindow() { x: 100, y: 100, width: DEFAULT_WIDTH, - height: DEFAULT_HEIGHT - }) + height: DEFAULT_HEIGHT, + }), }, { label: `Take ${MNEMONIC_SYM}Screenshot`, @@ -309,9 +309,9 @@ export function createWindow() { const dir = app.getPath('desktop'); fs.writeFileSync(path.join(dir, `Screenshot-${new Date()}.png`), buffer); }); - } - } - ] + }, + }, + ], }; const toolsMenu = { @@ -327,9 +327,9 @@ export function createWindow() { } window.webContents.send('reload-plugins'); - } - } - ] + }, + }, + ], }; let template = []; @@ -358,14 +358,14 @@ function showUnresponsiveModal() { defaultId: 1, cancelId: 0, title: 'Unresponsive', - message: 'Insomnia has become unresponsive. Do you want to reload?' + message: 'Insomnia has become unresponsive. Do you want to reload?', }, id => { if (id === 1) { mainWindow.destroy(); createWindow(); } - } + }, ); } diff --git a/packages/insomnia-app/app/models/__mocks__/uuid.js b/packages/insomnia-app/app/models/__mocks__/uuid.js index c4b0496cab..0a00c44f88 100644 --- a/packages/insomnia-app/app/models/__mocks__/uuid.js +++ b/packages/insomnia-app/app/models/__mocks__/uuid.js @@ -11,7 +11,7 @@ const v1UUIDs = [ 'f7273dba-f493-11e6-bc64-92361f002671', 'f7273eaa-f493-11e6-bc64-92361f002671', 'f7273f7c-f493-11e6-bc64-92361f002671', - 'f7274300-f493-11e6-bc64-92361f002671' + 'f7274300-f493-11e6-bc64-92361f002671', ]; const v4UUIDs = [ @@ -189,7 +189,7 @@ const v4UUIDs = [ '90160273-9bef-442b-aa36-393bdb3fcf38', '4d02d9bc-d81b-41da-b1e0-2d1ffde96103', 'f8be054e-651d-4542-a3e4-681a4a2ec9d0', - '966e9995-938a-4a5e-813c-de3691dddb3a' + '966e9995-938a-4a5e-813c-de3691dddb3a', ]; function v1() { diff --git a/packages/insomnia-app/app/models/__tests__/request.test.js b/packages/insomnia-app/app/models/__tests__/request.test.js index 08b9cf7776..27f71b91ca 100644 --- a/packages/insomnia-app/app/models/__tests__/request.test.js +++ b/packages/insomnia-app/app/models/__tests__/request.test.js @@ -21,7 +21,7 @@ describe('init()', () => { settingDisableRenderRequestBody: false, settingEncodeUrl: true, settingRebuildPath: true, - settingMaxTimelineDataSize: 1000 + settingMaxTimelineDataSize: 1000, }); }); }); @@ -34,7 +34,7 @@ describe('create()', async () => { const request = await models.request.create({ name: 'Test Request', parentId: 'fld_124', - description: 'A test Request' + description: 'A test Request', }); const expected = { _id: 'req_cc1dd2ca4275747aa88199e8efd42403', @@ -57,7 +57,7 @@ describe('create()', async () => { settingDisableRenderRequestBody: false, settingEncodeUrl: true, settingRebuildPath: true, - settingMaxTimelineDataSize: 1000 + settingMaxTimelineDataSize: 1000, }; expect(request).toEqual(expected); @@ -67,7 +67,7 @@ describe('create()', async () => { it('fails when missing parentId', async () => { Date.now = jest.fn().mockReturnValue(1478795580200); expect(() => models.request.create({ name: 'Test Request' })).toThrow( - 'New Requests missing `parentId`' + 'New Requests missing `parentId`', ); }); }); @@ -77,7 +77,7 @@ describe('updateMimeType()', async () => { it('adds header when does not exist', async () => { const request = await models.request.create({ name: 'My Request', - parentId: 'fld_1' + parentId: 'fld_1', }); expect(request).not.toBeNull(); @@ -93,8 +93,8 @@ describe('updateMimeType()', async () => { { name: 'content-tYPE', value: 'application/json' }, { name: 'foo', value: 'bar' }, { bad: true }, - null - ] + null, + ], }); expect(request).not.toBeNull(); @@ -103,7 +103,7 @@ describe('updateMimeType()', async () => { { name: 'content-tYPE', value: 'text/html' }, { name: 'foo', value: 'bar' }, { bad: true }, - null + null, ]); }); @@ -111,7 +111,7 @@ describe('updateMimeType()', async () => { const request = await models.request.create({ name: 'My Request', parentId: 'fld_1', - headers: [{ name: 'content-tYPE', value: 'application/json' }] + headers: [{ name: 'content-tYPE', value: 'application/json' }], }); expect(request).not.toBeNull(); @@ -123,7 +123,7 @@ describe('updateMimeType()', async () => { const request = await models.request.create({ name: 'My Request', parentId: 'fld_1', - headers: [{ name: 'content-tYPE', value: 'application/json' }] + headers: [{ name: 'content-tYPE', value: 'application/json' }], }); expect(request).not.toBeNull(); @@ -137,13 +137,13 @@ describe('updateMimeType()', async () => { name: 'My Request', parentId: 'fld_1', body: { - text: 'My Data' - } + text: 'My Data', + }, }); expect(request).not.toBeNull(); const newRequest = await models.request.updateMimeType(request, 'application/json', false, { - text: 'Saved Data' + text: 'Saved Data', }); expect(newRequest.body.text).toEqual('Saved Data'); }); @@ -153,8 +153,8 @@ describe('updateMimeType()', async () => { name: 'My Request', parentId: 'fld_1', body: { - text: 'My Data' - } + text: 'My Data', + }, }); expect(request).not.toBeNull(); @@ -168,13 +168,13 @@ describe('migrate()', () => { it('migrates basic case', () => { const original = { headers: [], - body: 'hello world!' + body: 'hello world!', }; const expected = { headers: [], body: { mimeType: '', text: 'hello world!' }, - url: '' + url: '', }; expect(models.request.migrate(original)).toEqual(expected); @@ -183,16 +183,16 @@ describe('migrate()', () => { it('migrates form-urlencoded', () => { const original = { headers: [{ name: 'content-type', value: 'application/x-www-form-urlencoded' }], - body: 'foo=bar&baz={{ hello }}' + body: 'foo=bar&baz={{ hello }}', }; const expected = { headers: [{ name: 'content-type', value: 'application/x-www-form-urlencoded' }], body: { mimeType: 'application/x-www-form-urlencoded', - params: [{ name: 'foo', value: 'bar' }, { name: 'baz', value: '{{ hello }}' }] + params: [{ name: 'foo', value: 'bar' }, { name: 'baz', value: '{{ hello }}' }], }, - url: '' + url: '', }; expect(models.request.migrate(original)).toEqual(expected); @@ -203,24 +203,24 @@ describe('migrate()', () => { headers: [ { name: 'content-type', - value: 'application/x-www-form-urlencoded; charset=utf-8' - } + value: 'application/x-www-form-urlencoded; charset=utf-8', + }, ], - body: 'foo=bar&baz={{ hello }}' + body: 'foo=bar&baz={{ hello }}', }; const expected = { headers: [ { name: 'content-type', - value: 'application/x-www-form-urlencoded; charset=utf-8' - } + value: 'application/x-www-form-urlencoded; charset=utf-8', + }, ], body: { mimeType: 'application/x-www-form-urlencoded', - params: [{ name: 'foo', value: 'bar' }, { name: 'baz', value: '{{ hello }}' }] + params: [{ name: 'foo', value: 'bar' }, { name: 'baz', value: '{{ hello }}' }], }, - url: '' + url: '', }; expect(models.request.migrate(original)).toEqual(expected); @@ -229,16 +229,16 @@ describe('migrate()', () => { it('migrates form-urlencoded malformed', () => { const original = { headers: [{ name: 'content-type', value: 'application/x-www-form-urlencoded' }], - body: '{"foo": "bar"}' + body: '{"foo": "bar"}', }; const expected = { headers: [{ name: 'content-type', value: 'application/x-www-form-urlencoded' }], body: { mimeType: 'application/x-www-form-urlencoded', - params: [{ name: '{"foo": "bar"}', value: '' }] + params: [{ name: '{"foo": "bar"}', value: '' }], }, - url: '' + url: '', }; expect(models.request.migrate(original)).toEqual(expected); @@ -248,19 +248,19 @@ describe('migrate()', () => { const contentToMimeMap = { 'application/json; charset=utf-8': 'application/json', 'text/plain': 'text/plain', - malformed: 'malformed' + malformed: 'malformed', }; for (const contentType of Object.keys(contentToMimeMap)) { const original = { headers: [{ name: 'content-type', value: contentType }], - body: '' + body: '', }; const expected = { headers: [{ name: 'content-type', value: contentType }], body: { mimeType: contentToMimeMap[contentType], text: '' }, - url: '' + url: '', }; expect(models.request.migrate(original)).toEqual(expected); @@ -269,7 +269,7 @@ describe('migrate()', () => { it('skips migrate for schema 1', () => { const original = { - body: { mimeType: 'text/plain', text: 'foo' } + body: { mimeType: 'text/plain', text: 'foo' }, }; expect(models.request.migrate(original)).toBe(original); @@ -284,14 +284,14 @@ describe('migrate()', () => { const expected = { body: { mimeType: '', - text: 'foo bar!' + text: 'foo bar!', }, - url: '' + url: '', }; const expected2 = { body: {}, - url: '' + url: '', }; expect(models.request.migrate(newBody)).toEqual(expected); @@ -306,7 +306,7 @@ describe('migrate()', () => { const original = { _id: 'req_123', headers: [], - body: 'hello world!' + body: 'hello world!', }; const expected = { @@ -330,7 +330,7 @@ describe('migrate()', () => { settingDisableRenderRequestBody: false, settingEncodeUrl: true, settingRebuildPath: true, - settingMaxTimelineDataSize: 1000 + settingMaxTimelineDataSize: 1000, }; const migrated = await models.initModel(models.request.type, original); diff --git a/packages/insomnia-app/app/models/__tests__/response.test.js b/packages/insomnia-app/app/models/__tests__/response.test.js index adc7526df9..ac8fd5044c 100644 --- a/packages/insomnia-app/app/models/__tests__/response.test.js +++ b/packages/insomnia-app/app/models/__tests__/response.test.js @@ -23,7 +23,7 @@ describe('migrate()', () => { const newModel = await models.initModel(models.response.type, initialModel); const expectedBodyPath = path.join( getDataDirectory(), - `responses/fc3ff98e8c6a0d3087d515c0473f8677.zip` + `responses/fc3ff98e8c6a0d3087d515c0473f8677.zip`, ); const storedBody = models.response.getBodyBuffer(newModel); @@ -43,7 +43,7 @@ describe('migrate()', () => { jest.runAllTimers(); const expectedBodyPath = path.join( getDataDirectory(), - `responses/fc3ff98e8c6a0d3087d515c0473f8677.zip` + `responses/fc3ff98e8c6a0d3087d515c0473f8677.zip`, ); const storedBody = models.response.getBodyBuffer(newModel); @@ -65,7 +65,7 @@ describe('migrate()', () => { const expectedBodyPath = path.join( getDataDirectory(), - 'responses/d41d8cd98f00b204e9800998ecf8427e.zip' + 'responses/d41d8cd98f00b204e9800998ecf8427e.zip', ); const storedBody = models.response.getBodyBuffer(newModel); @@ -105,7 +105,7 @@ describe('migrate()', () => { it('migrates old bodies', async () => { const response = await models.initModel(models.response.type, { body: 'aGVsbG8gd29ybGQh', - encoding: 'base64' + encoding: 'base64', }); const body = await models.response.getBodyBuffer(response).toString(); @@ -117,16 +117,16 @@ describe('migrate()', () => { expect( (await models.initModel(models.response.type, { bodyPath: '/foo/bar', - bodyCompression: null - })).bodyCompression + bodyCompression: null, + })).bodyCompression, ).toBe(null); }); it('migrates sets bodyCompression to zip if does not have one yet', async () => { expect( (await models.initModel(models.response.type, { - bodyPath: '/foo/bar' - })).bodyCompression + bodyPath: '/foo/bar', + })).bodyCompression, ).toBe('zip'); }); @@ -134,8 +134,8 @@ describe('migrate()', () => { expect( (await models.initModel(models.response.type, { bodyPath: '/foo/bar', - bodyCompression: 'zip' - })).bodyCompression + bodyCompression: 'zip', + })).bodyCompression, ).toBe('zip'); }); }); @@ -202,7 +202,7 @@ async function createModels(responsesDir, count) { await models.workspace.create({ _id: workspaceId, created: 111, - modified: 222 + modified: 222, }); await models.request.create({ _id: requestId, @@ -210,7 +210,7 @@ async function createModels(responsesDir, count) { created: 111, modified: 222, metaSortKey: 0, - url: 'https://insomnia.rest' + url: 'https://insomnia.rest', }); await models.response.create({ @@ -218,7 +218,7 @@ async function createModels(responsesDir, count) { parentId: requestId, statusCode: 200, body: 'foo', - bodyPath: path.join(responsesDir, responseId) + bodyPath: path.join(responsesDir, responseId), }); responseIds.push(responseId); } diff --git a/packages/insomnia-app/app/models/__tests__/workspace.test.js b/packages/insomnia-app/app/models/__tests__/workspace.test.js index 10441159b6..42088ccb02 100644 --- a/packages/insomnia-app/app/models/__tests__/workspace.test.js +++ b/packages/insomnia-app/app/models/__tests__/workspace.test.js @@ -6,7 +6,7 @@ describe('migrate()', () => { it('migrates client certificates properly', async () => { const workspace = await models.workspace.create({ name: 'My Workspace', - certificates: [{ key: 'key', passphrase: 'mypass' }, { disabled: true, cert: 'cert' }] + certificates: [{ key: 'key', passphrase: 'mypass' }, { disabled: true, cert: 'cert' }], }); const migratedWorkspace = await models.workspace.migrate(workspace); @@ -32,7 +32,7 @@ describe('migrate()', () => { parentId: 'wrk_cc1dd2ca4275747aa88199e8efd42403', passphrase: null, pfx: null, - type: 'ClientCertificate' + type: 'ClientCertificate', }, { _id: 'crt_dd2ccc1a2745477a881a9e8ef9d42403', @@ -44,8 +44,8 @@ describe('migrate()', () => { parentId: 'wrk_cc1dd2ca4275747aa88199e8efd42403', passphrase: 'mypass', pfx: null, - type: 'ClientCertificate' - } + type: 'ClientCertificate', + }, ]); expect(migratedWorkspace.certificates).toBeUndefined(); diff --git a/packages/insomnia-app/app/models/client-certificate.js b/packages/insomnia-app/app/models/client-certificate.js index 5e8dfd1f7d..a9f599e039 100644 --- a/packages/insomnia-app/app/models/client-certificate.js +++ b/packages/insomnia-app/app/models/client-certificate.js @@ -17,7 +17,7 @@ type BaseClientCertificate = { disabled: boolean, // For sync control - isPrivate: boolean + isPrivate: boolean, }; export type ClientCertificate = BaseModel & BaseClientCertificate; @@ -31,7 +31,7 @@ export function init(): BaseClientCertificate { cert: null, key: null, pfx: null, - isPrivate: false + isPrivate: false, }; } diff --git a/packages/insomnia-app/app/models/cookie-jar.js b/packages/insomnia-app/app/models/cookie-jar.js index 5c74faaaa8..d39a884829 100644 --- a/packages/insomnia-app/app/models/cookie-jar.js +++ b/packages/insomnia-app/app/models/cookie-jar.js @@ -22,12 +22,12 @@ export type Cookie = { creationIndex?: number, hostOnly?: boolean, pathIsDefault?: boolean, - lastAccessed?: Date + lastAccessed?: Date, }; type BaseCookieJar = { name: string, - cookies: Array + cookies: Array, }; export type CookieJar = BaseModel & BaseCookieJar; @@ -35,7 +35,7 @@ export type CookieJar = BaseModel & BaseCookieJar; export function init() { return { name: 'Default Jar', - cookies: [] + cookies: [], }; } diff --git a/packages/insomnia-app/app/models/environment.js b/packages/insomnia-app/app/models/environment.js index cd3128591d..22fa339b72 100644 --- a/packages/insomnia-app/app/models/environment.js +++ b/packages/insomnia-app/app/models/environment.js @@ -15,7 +15,7 @@ type BaseEnvironment = { metaSortKey: number, // For sync control - isPrivate: boolean + isPrivate: boolean, }; export type Environment = BaseModel & BaseEnvironment; @@ -26,7 +26,7 @@ export function init() { data: {}, color: null, isPrivate: false, - metaSortKey: Date.now() + metaSortKey: Date.now(), }; } @@ -56,7 +56,7 @@ export async function getOrCreateForWorkspaceId(workspaceId: string): Promise(type: string, ...sources: Array + params?: Array, }; type BaseRequest = { @@ -84,7 +84,7 @@ type BaseRequest = { settingDisableRenderRequestBody: boolean, settingEncodeUrl: boolean, settingRebuildPath: boolean, - settingMaxTimelineDataSize: number + settingMaxTimelineDataSize: number, }; export type Request = BaseModel & BaseRequest; @@ -108,7 +108,7 @@ export function init(): BaseRequest { settingDisableRenderRequestBody: false, settingEncodeUrl: true, settingRebuildPath: true, - settingMaxTimelineDataSize: 1000 + settingMaxTimelineDataSize: 1000, }; } @@ -126,7 +126,7 @@ export function newAuth(type: string, oldAuth: RequestAuthentication = {}): Requ type, disabled: oldAuth.disabled || false, username: oldAuth.username || '', - password: oldAuth.password || '' + password: oldAuth.password || '', }; case AUTH_OAUTH_1: @@ -142,14 +142,14 @@ export function newAuth(type: string, oldAuth: RequestAuthentication = {}): Requ version: '1.0', nonce: '', timestamp: '', - callback: '' + callback: '', }; // OAuth 2.0 case AUTH_OAUTH_2: return { type, - grantType: GRANT_TYPE_AUTHORIZATION_CODE + grantType: GRANT_TYPE_AUTHORIZATION_CODE, }; // Aws IAM @@ -159,14 +159,14 @@ export function newAuth(type: string, oldAuth: RequestAuthentication = {}): Requ disabled: oldAuth.disabled || false, accessKeyId: oldAuth.accessKeyId || '', secretAccessKey: oldAuth.secretAccessKey || '', - sessionToken: oldAuth.sessionToken || '' + sessionToken: oldAuth.sessionToken || '', }; // Hawk case AUTH_HAWK: return { type, - algorithm: HAWK_ALGORITHM_SHA256 + algorithm: HAWK_ALGORITHM_SHA256, }; // Atlassian ASAP @@ -178,7 +178,7 @@ export function newAuth(type: string, oldAuth: RequestAuthentication = {}): Requ audience: '', additionalClaims: '', keyId: '', - privateKey: '' + privateKey: '', }; // Types needing no defaults @@ -204,21 +204,21 @@ export function newBodyRaw(rawBody: string, contentType?: string): RequestBody { export function newBodyFormUrlEncoded(parameters: Array | null): RequestBody { return { mimeType: CONTENT_TYPE_FORM_URLENCODED, - params: parameters || [] + params: parameters || [], }; } export function newBodyFile(path: string): RequestBody { return { mimeType: CONTENT_TYPE_FILE, - fileName: path + fileName: path, }; } export function newBodyForm(parameters: Array): RequestBody { return { mimeType: CONTENT_TYPE_FORM_DATA, - params: parameters || [] + params: parameters || [], }; } @@ -253,7 +253,7 @@ export function updateMimeType( request: Request, mimeType: string, doCreate: boolean = false, - savedBody: RequestBody = {} + savedBody: RequestBody = {}, ): Promise { let headers = request.headers ? [...request.headers] : []; const contentTypeHeader = getContentTypeHeader(headers); diff --git a/packages/insomnia-app/app/models/response.js b/packages/insomnia-app/app/models/response.js index d70e4a3183..08f76ed0a1 100644 --- a/packages/insomnia-app/app/models/response.js +++ b/packages/insomnia-app/app/models/response.js @@ -19,12 +19,12 @@ export const canDuplicate = false; export type ResponseHeader = { name: string, - value: string + value: string, }; export type ResponseTimelineEntry = { name: string, - value: string + value: string, }; type BaseResponse = { @@ -45,7 +45,7 @@ type BaseResponse = { // Things from the request settingStoreCookies: boolean | null, - settingSendCookies: boolean | null + settingSendCookies: boolean | null, }; export type Response = BaseModel & BaseResponse; @@ -69,7 +69,7 @@ export function init(): BaseResponse { // Things from the request settingStoreCookies: null, - settingSendCookies: null + settingSendCookies: null, }; } @@ -111,7 +111,7 @@ export function remove(response: Response) { export async function findRecentForRequest( requestId: string, - limit: number + limit: number, ): Promise> { const responses = await db.findMostRecentlyModified(type, { parentId: requestId }, limit); return responses; @@ -159,7 +159,7 @@ export function getBodyBuffer(response: Object, readFailureValue: ?T): Buffer function getBodyStreamFromPath( bodyPath: string, compression: string | null, - readFailureValue: ?T + readFailureValue: ?T, ): Readable | null | T { // No body, so return empty Buffer if (!bodyPath) { @@ -184,7 +184,7 @@ function getBodyStreamFromPath( function getBodyBufferFromPath( bodyPath: string, compression: string | null, - readFailureValue: ?T + readFailureValue: ?T, ): Buffer | T | null { // No body, so return empty Buffer if (!bodyPath) { diff --git a/packages/insomnia-app/app/models/settings.js b/packages/insomnia-app/app/models/settings.js index 43b4a6b790..f146bea1f7 100644 --- a/packages/insomnia-app/app/models/settings.js +++ b/packages/insomnia-app/app/models/settings.js @@ -32,7 +32,7 @@ type BaseSettings = { fontMonospace: string | null, fontInterface: string | null, fontSize: number, - fontVariantLigatures: boolean + fontVariantLigatures: boolean, }; export type Settings = BaseModel & BaseSettings; @@ -72,7 +72,7 @@ export function init(): BaseSettings { fontMonospace: null, fontInterface: null, fontSize: 13, - fontVariantLigatures: false + fontVariantLigatures: false, }; } diff --git a/packages/insomnia-app/app/models/stats.js b/packages/insomnia-app/app/models/stats.js index 4bae757208..eb01e991cc 100644 --- a/packages/insomnia-app/app/models/stats.js +++ b/packages/insomnia-app/app/models/stats.js @@ -12,7 +12,7 @@ type BaseStats = { lastLaunch: number | null, currentVersion: string | null, lastVersion: string | null, - launches: number + launches: number, }; export type Stats = BaseModel & BaseStats; @@ -23,7 +23,7 @@ export function init(): BaseStats { lastLaunch: null, currentVersion: null, lastVersion: null, - launches: 0 + launches: 0, }; } diff --git a/packages/insomnia-app/app/models/workspace-meta.js b/packages/insomnia-app/app/models/workspace-meta.js index c6d2ab80eb..dfeef9dcff 100644 --- a/packages/insomnia-app/app/models/workspace-meta.js +++ b/packages/insomnia-app/app/models/workspace-meta.js @@ -4,7 +4,7 @@ import * as db from '../common/database'; import { DEFAULT_SIDEBAR_WIDTH, DEFAULT_PANE_WIDTH, - DEFAULT_PANE_HEIGHT + DEFAULT_PANE_HEIGHT, } from '../common/constants'; export const name = 'Workspace Meta'; @@ -20,7 +20,7 @@ type BaseWorkspaceMeta = { sidebarWidth: number, paneWidth: number, paneHeight: number, - hasSeen: boolean + hasSeen: boolean, }; export type WorkspaceMeta = BaseWorkspaceMeta & BaseModel; @@ -35,7 +35,7 @@ export function init(): BaseWorkspaceMeta { sidebarWidth: DEFAULT_SIDEBAR_WIDTH, paneWidth: DEFAULT_PANE_WIDTH, paneHeight: DEFAULT_PANE_HEIGHT, - hasSeen: true + hasSeen: true, }; } diff --git a/packages/insomnia-app/app/models/workspace.js b/packages/insomnia-app/app/models/workspace.js index c737a4a36e..2ab2aadaaf 100644 --- a/packages/insomnia-app/app/models/workspace.js +++ b/packages/insomnia-app/app/models/workspace.js @@ -10,7 +10,7 @@ export const canDuplicate = true; type BaseWorkspace = { name: string, - description: string + description: string, }; export type Workspace = BaseModel & BaseWorkspace; @@ -18,7 +18,7 @@ export type Workspace = BaseModel & BaseWorkspace; export function init() { return { name: 'New Workspace', - description: '' + description: '', }; } @@ -72,7 +72,7 @@ async function _migrateExtractClientCertificates(workspace: Workspace): Promise< cert: cert.cert || null, key: cert.key || null, pfx: cert.pfx || null, - isPrivate: false + isPrivate: false, }); } diff --git a/packages/insomnia-app/app/network/__tests__/authentication.test.js b/packages/insomnia-app/app/network/__tests__/authentication.test.js index 7bb8205c2e..d5edece4f3 100644 --- a/packages/insomnia-app/app/network/__tests__/authentication.test.js +++ b/packages/insomnia-app/app/network/__tests__/authentication.test.js @@ -12,7 +12,7 @@ describe('OAuth 1.0', () => { tokenSecret: 'tokenSecret', signatureMethod: 'HMAC-SHA1', nonce: 'nonce', - timestamp: '1234567890' + timestamp: '1234567890', }); expect(header).toEqual({ @@ -25,8 +25,8 @@ describe('OAuth 1.0', () => { 'oauth_signature_method="HMAC-SHA1"', 'oauth_timestamp="1234567890"', 'oauth_token="tokenKey"', - 'oauth_version="1.0"' - ].join(', ') + 'oauth_version="1.0"', + ].join(', '), }); }); @@ -56,7 +56,7 @@ describe('OAuth 1.0', () => { 'F29dI2yG3Ti+28/WlSdfYGe9P9SfeYM7RQbNbUp1MHWrkg==\n' + '-----END RSA PRIVATE KEY-----', nonce: 'nonce', - timestamp: '1234567890' + timestamp: '1234567890', }); expect(header).toEqual({ @@ -69,8 +69,8 @@ describe('OAuth 1.0', () => { 'oauth_signature_method="RSA-SHA1"', 'oauth_timestamp="1234567890"', 'oauth_token="tokenKey"', - 'oauth_version="1.0"' - ].join(', ') + 'oauth_version="1.0"', + ].join(', '), }); }); @@ -79,7 +79,7 @@ describe('OAuth 1.0', () => { type: AUTH_OAUTH_1, consumerKey: 'consumerKey', consumerSecret: 'consumerSecret', - signatureMethod: 'HMAC-SHA1' + signatureMethod: 'HMAC-SHA1', }); expect(header.name).toBe('Authorization'); @@ -91,9 +91,9 @@ describe('OAuth 1.0', () => { 'oauth_signature="[\\w\\d%]*"', 'oauth_signature_method="HMAC-SHA1"', 'oauth_timestamp="\\d*"', - 'oauth_version="1\\.0"' - ].join(', ') - ) + 'oauth_version="1\\.0"', + ].join(', '), + ), ); }); }); diff --git a/packages/insomnia-app/app/network/__tests__/multipart.test.js b/packages/insomnia-app/app/network/__tests__/multipart.test.js index 33687cbf51..b977d52863 100644 --- a/packages/insomnia-app/app/network/__tests__/multipart.test.js +++ b/packages/insomnia-app/app/network/__tests__/multipart.test.js @@ -9,7 +9,7 @@ describe('buildMultipart()', () => { it('builds a simple request', async () => { const { filePath, boundary, contentLength } = await buildMultipart([ { name: 'foo', value: 'bar' }, - { name: 'multi-line', value: 'Hello\nWorld!' } + { name: 'multi-line', value: 'Hello\nWorld!' }, ]); expect(boundary).toBe(DEFAULT_BOUNDARY); @@ -25,8 +25,8 @@ describe('buildMultipart()', () => { '', 'Hello\nWorld!', `--${boundary}--`, - '' - ].join('\r\n') + '', + ].join('\r\n'), ); }); @@ -35,7 +35,7 @@ describe('buildMultipart()', () => { const { filePath, boundary, contentLength } = await buildMultipart([ { name: 'foo', value: 'bar' }, { name: 'file', type: 'file', fileName: fileName }, - { name: 'baz', value: 'qux' } + { name: 'baz', value: 'qux' }, ]); expect(boundary).toBe(DEFAULT_BOUNDARY); @@ -56,8 +56,8 @@ describe('buildMultipart()', () => { '', 'qux', `--${boundary}--`, - '' - ].join('\r\n') + '', + ].join('\r\n'), ); }); @@ -66,7 +66,7 @@ describe('buildMultipart()', () => { { value: 'bar' }, { name: 'foo' }, { name: '', value: '' }, - { name: '', type: 'file', fileName: '' } + { name: '', type: 'file', fileName: '' }, ]); expect(boundary).toBe(DEFAULT_BOUNDARY); @@ -82,8 +82,8 @@ describe('buildMultipart()', () => { '', '', `--${boundary}--`, - '' - ].join('\r\n') + '', + ].join('\r\n'), ); }); }); diff --git a/packages/insomnia-app/app/network/__tests__/network.test.js b/packages/insomnia-app/app/network/__tests__/network.test.js index 37000b1f73..656e014f6b 100644 --- a/packages/insomnia-app/app/network/__tests__/network.test.js +++ b/packages/insomnia-app/app/network/__tests__/network.test.js @@ -10,7 +10,7 @@ import { CONTENT_TYPE_FILE, CONTENT_TYPE_FORM_DATA, CONTENT_TYPE_FORM_URLENCODED, - getAppVersion + getAppVersion, } from '../../common/constants'; import { filterHeaders } from '../../common/misc'; import { globalBeforeEach } from '../../__jest__/before-each'; @@ -32,7 +32,7 @@ describe('actuallySend()', () => { domain: 'notlocalhost', path: '/', hostOnly: true, - lastAccessed: new Date('2096-10-05T04:40:49.505Z') + lastAccessed: new Date('2096-10-05T04:40:49.505Z'), }, { creation: new Date('2016-10-05T04:40:49.505Z'), @@ -42,14 +42,14 @@ describe('actuallySend()', () => { domain: 'localhost', path: '/', hostOnly: true, - lastAccessed: new Date('2096-10-05T04:40:49.505Z') - } + lastAccessed: new Date('2096-10-05T04:40:49.505Z'), + }, ]; const cookieJar = await models.cookieJar.getOrCreateForParentId(workspace._id); await models.cookieJar.update(cookieJar, { parentId: workspace._id, - cookies + cookies, }); const request = Object.assign(models.request.init(), { @@ -60,14 +60,14 @@ describe('actuallySend()', () => { method: 'POST', body: { mimeType: CONTENT_TYPE_FORM_URLENCODED, - params: [{ name: 'foo', value: 'bar' }] + params: [{ name: 'foo', value: 'bar' }], }, url: 'http://localhost', authentication: { type: AUTH_BASIC, username: 'user', - password: 'pass' - } + password: 'pass', + }, }); const renderedRequest = await getRenderedRequest(request); @@ -75,7 +75,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); @@ -84,12 +84,12 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { COOKIELIST: [ 'notlocalhost\tFALSE\t/\tFALSE\t4000855249\tfoo\tbarrrrr', - 'localhost\tFALSE\t/\tFALSE\t4000855249\tfoo\tbar' + 'localhost\tFALSE\t/\tFALSE\t4000855249\tfoo\tbar', ], ACCEPT_ENCODING: '', COOKIEFILE: '', @@ -100,7 +100,7 @@ describe('actuallySend()', () => { 'Expect:', 'Transfer-Encoding:', 'Accept: */*', - 'Accept-Encoding:' + 'Accept-Encoding:', ], NOPROGRESS: false, USERNAME: 'user', @@ -111,8 +111,8 @@ describe('actuallySend()', () => { TIMEOUT_MS: 0, URL: 'http://localhost/?foo%20bar=hello%26world', USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); @@ -129,10 +129,10 @@ describe('actuallySend()', () => { params: [ { name: 'foo', value: 'bar' }, { name: 'bar', value: '' }, - { name: '', value: 'value' } - ] + { name: '', value: 'value' }, + ], }, - url: 'http://localhost' + url: 'http://localhost', }); const renderedRequest = await getRenderedRequest(request); @@ -140,7 +140,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); @@ -149,7 +149,7 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { POST: 1, @@ -161,7 +161,7 @@ describe('actuallySend()', () => { 'Expect:', 'Transfer-Encoding:', 'Accept: */*', - 'Accept-Encoding:' + 'Accept-Encoding:', ], NOPROGRESS: false, POSTFIELDS: 'foo=bar&bar=&=value', @@ -169,8 +169,8 @@ describe('actuallySend()', () => { TIMEOUT_MS: 0, URL: 'http://localhost/', USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); @@ -186,7 +186,7 @@ describe('actuallySend()', () => { domain: 'notlocalhost', path: '/', hostOnly: true, - lastAccessed: new Date('2096-10-05T04:40:49.505Z') + lastAccessed: new Date('2096-10-05T04:40:49.505Z'), }, { creation: new Date('2016-10-05T04:40:49.505Z'), @@ -196,13 +196,13 @@ describe('actuallySend()', () => { domain: 'localhost', path: '/', hostOnly: true, - lastAccessed: new Date('2096-10-05T04:40:49.505Z') - } + lastAccessed: new Date('2096-10-05T04:40:49.505Z'), + }, ]; await models.cookieJar.create({ parentId: workspace._id, - cookies + cookies, }); const request = Object.assign(models.request.init(), { @@ -213,16 +213,16 @@ describe('actuallySend()', () => { method: 'GET', body: { mimeType: CONTENT_TYPE_FORM_URLENCODED, - params: [{ name: 'foo', value: 'bar' }] + params: [{ name: 'foo', value: 'bar' }], }, url: 'http://localhost', authentication: { type: AUTH_BASIC, username: 'user', - password: 'pass' + password: 'pass', }, settingStoreCookies: false, - settingSendCookies: false + settingSendCookies: false, }); const renderedRequest = await getRenderedRequest(request); @@ -230,7 +230,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); @@ -239,7 +239,7 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { CUSTOMREQUEST: 'GET', @@ -250,7 +250,7 @@ describe('actuallySend()', () => { 'Expect:', 'Transfer-Encoding:', 'Accept: */*', - 'Accept-Encoding:' + 'Accept-Encoding:', ], NOPROGRESS: false, USERNAME: 'user', @@ -260,8 +260,8 @@ describe('actuallySend()', () => { TIMEOUT_MS: 0, URL: 'http://localhost/?foo%20bar=hello%26world', USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); @@ -277,7 +277,7 @@ describe('actuallySend()', () => { headers: [{ name: 'Content-Type', value: 'application/octet-stream' }], url: 'http://localhost', method: 'POST', - body: { mimeType: CONTENT_TYPE_FILE, fileName } + body: { mimeType: CONTENT_TYPE_FILE, fileName }, }); const renderedRequest = await getRenderedRequest(request); @@ -285,7 +285,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); @@ -295,7 +295,7 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { POST: 1, @@ -308,7 +308,7 @@ describe('actuallySend()', () => { 'Expect:', 'Transfer-Encoding:', 'Accept: */*', - 'Accept-Encoding:' + 'Accept-Encoding:', ], NOPROGRESS: false, INFILESIZE_LARGE: 26, @@ -318,8 +318,8 @@ describe('actuallySend()', () => { UPLOAD: 1, URL: 'http://localhost/', USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); @@ -343,9 +343,9 @@ describe('actuallySend()', () => { // Some extra params { name: 'a', value: 'AA' }, - { name: 'baz', value: 'qux', disabled: true } - ] - } + { name: 'baz', value: 'qux', disabled: true }, + ], + }, }); const renderedRequest = await getRenderedRequest(request); @@ -353,7 +353,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); const body = JSON.parse(bodyBuffer); @@ -361,7 +361,7 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { POST: 1, @@ -374,7 +374,7 @@ describe('actuallySend()', () => { 'Expect:', 'Transfer-Encoding:', 'Accept: */*', - 'Accept-Encoding:' + 'Accept-Encoding:', ], INFILESIZE_LARGE: 244, NOPROGRESS: false, @@ -389,15 +389,15 @@ describe('actuallySend()', () => { '', 'AA', `--${DEFAULT_BOUNDARY}--`, - '' + '', ].join('\r\n'), PROXY: '', TIMEOUT_MS: 0, URL: 'http://localhost/', UPLOAD: 1, USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); @@ -409,7 +409,7 @@ describe('actuallySend()', () => { _id: 'req_123', parentId: workspace._id, url: 'http://unix:/my/socket:/my/path', - method: 'GET' + method: 'GET', }); const renderedRequest = await getRenderedRequest(request); @@ -417,7 +417,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); @@ -426,7 +426,7 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { CUSTOMREQUEST: 'GET', @@ -440,8 +440,8 @@ describe('actuallySend()', () => { URL: 'http://my/path', UNIX_SOCKET_PATH: '/my/socket', USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); @@ -453,7 +453,7 @@ describe('actuallySend()', () => { _id: 'req_123', parentId: workspace._id, url: 'http://localhost:3000/foo/bar', - method: 'HEAD' + method: 'HEAD', }); const renderedRequest = await getRenderedRequest(request); @@ -461,7 +461,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); @@ -470,7 +470,7 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { NOBODY: 1, @@ -483,8 +483,8 @@ describe('actuallySend()', () => { TIMEOUT_MS: 0, URL: 'http://localhost:3000/foo/bar', USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); @@ -496,7 +496,7 @@ describe('actuallySend()', () => { _id: 'req_123', parentId: workspace._id, url: 'http://unix:3000/my/path', - method: 'GET' + method: 'GET', }); const renderedRequest = await getRenderedRequest(request); @@ -504,7 +504,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); @@ -513,7 +513,7 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { CUSTOMREQUEST: 'GET', @@ -526,8 +526,8 @@ describe('actuallySend()', () => { TIMEOUT_MS: 0, URL: 'http://unix:3000/my/path', USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); @@ -539,8 +539,8 @@ describe('actuallySend()', () => { _id: 'req_123', parentId: workspace._id, authentication: { - type: AUTH_NETRC - } + type: AUTH_NETRC, + }, }); const renderedRequest = await getRenderedRequest(request); @@ -548,7 +548,7 @@ describe('actuallySend()', () => { renderedRequest, CONTEXT, workspace, - settings + settings, ); const bodyBuffer = models.response.getBodyBuffer(response); @@ -557,7 +557,7 @@ describe('actuallySend()', () => { meta: {}, features: { NO_HEADER_PARSING: true, - NO_DATA_PARSING: true + NO_DATA_PARSING: true, }, options: { CUSTOMREQUEST: 'GET', @@ -571,8 +571,8 @@ describe('actuallySend()', () => { NETRC: 2, URL: '', USERAGENT: `insomnia/${getAppVersion()}`, - VERBOSE: true - } + VERBOSE: true, + }, }); }); }); @@ -585,29 +585,29 @@ describe('_getAwsAuthHeaders', () => { type: AUTH_AWS_IAM, accessKeyId: 'AKIA99999999', secretAccessKey: 'SAK9999999999999', - sessionToken: 'ST9999999999999999' + sessionToken: 'ST9999999999999999', }, headers: [{ name: 'content-type', value: 'application/json' }], body: { text: '{}' }, method: 'POST', - url: 'https://ec2.us-west-2.amazonaws.com/path?query=q1' + url: 'https://ec2.us-west-2.amazonaws.com/path?query=q1', }; const credentials = { accessKeyId: req.authentication.accessKeyId || '', secretAccessKey: req.authentication.secretAccessKey || '', - sessionToken: req.authentication.sessionToken || '' + sessionToken: req.authentication.sessionToken || '', }; const headers = networkUtils._getAwsAuthHeaders( credentials, req.headers, req.body.text, req.url, - req.method + req.method, ); expect(filterHeaders(headers, 'x-amz-date')[0].value).toMatch(/^\d{8}T\d{6}Z$/); expect(filterHeaders(headers, 'host')[0].value).toEqual('ec2.us-west-2.amazonaws.com'); expect(filterHeaders(headers, 'authorization')[0].value).toMatch( - /^AWS4-HMAC-SHA256 Credential=AKIA99999999\/\d{8}\/us-west-2\/ec2\/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[a-z0-9]*$/ + /^AWS4-HMAC-SHA256 Credential=AKIA99999999\/\d{8}\/us-west-2\/ec2\/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-security-token, Signature=[a-z0-9]*$/, ); expect(filterHeaders(headers, 'content-type')).toEqual([]); }); @@ -618,16 +618,16 @@ describe('_getAwsAuthHeaders', () => { type: AUTH_AWS_IAM, accessKeyId: 'AKIA99999999', secretAccessKey: 'SAK9999999999999', - sessionToken: 'ST99999999999999' + sessionToken: 'ST99999999999999', }, headers: ['Accept: */*', 'Accept-Encoding:'], url: 'https://example.com', - method: 'GET' + method: 'GET', }; const credentials = { accessKeyId: req.authentication.accessKeyId || '', secretAccessKey: req.authentication.secretAccessKey || '', - sessionToken: req.authentication.sessionToken || '' + sessionToken: req.authentication.sessionToken || '', }; const headers = networkUtils._getAwsAuthHeaders( credentials, @@ -636,13 +636,13 @@ describe('_getAwsAuthHeaders', () => { req.url, req.method, 'us-west-2', - 'ec2' + 'ec2', ); expect(filterHeaders(headers, 'x-amz-date')[0].value).toMatch(/^\d{8}T\d{6}Z$/); expect(filterHeaders(headers, 'host')[0].value).toEqual('example.com'); expect(filterHeaders(headers, 'authorization')[0].value).toMatch( - /^AWS4-HMAC-SHA256 Credential=AKIA99999999\/\d{8}\/us-west-2\/ec2\/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=[a-z0-9]*$/ + /^AWS4-HMAC-SHA256 Credential=AKIA99999999\/\d{8}\/us-west-2\/ec2\/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=[a-z0-9]*$/, ); expect(filterHeaders(headers, 'content-type')).toEqual([]); }); @@ -660,7 +660,7 @@ describe('_parseHeaders', () => { 'Duplicate: bar', 'Date: Mon, 13 Nov 2017 22:06:28 GMT', 'Foo', // Invalid header - '' + '', ]; const minimalHeaders = ['HTTP/1.1 301', '']; @@ -680,9 +680,9 @@ describe('_parseHeaders', () => { { name: 'Duplicate', value: 'foo' }, { name: 'Duplicate', value: 'bar' }, { name: 'Date', value: 'Mon, 13 Nov 2017 22:06:28 GMT' }, - { name: 'Foo', value: '' } - ] - } + { name: 'Foo', value: '' }, + ], + }, ]); }); @@ -701,9 +701,9 @@ describe('_parseHeaders', () => { { name: 'Duplicate', value: 'foo' }, { name: 'Duplicate', value: 'bar' }, { name: 'Date', value: 'Mon, 13 Nov 2017 22:06:28 GMT' }, - { name: 'Foo', value: '' } - ] - } + { name: 'Foo', value: '' }, + ], + }, ]); }); @@ -723,15 +723,15 @@ describe('_parseHeaders', () => { { name: 'Duplicate', value: 'foo' }, { name: 'Duplicate', value: 'bar' }, { name: 'Date', value: 'Mon, 13 Nov 2017 22:06:28 GMT' }, - { name: 'Foo', value: '' } - ] + { name: 'Foo', value: '' }, + ], }, { code: 301, headers: [], reason: '', - version: 'HTTP/1.1' - } + version: 'HTTP/1.1', + }, ]); }); }); diff --git a/packages/insomnia-app/app/network/authentication.js b/packages/insomnia-app/app/network/authentication.js index 7bfa3dadb2..0d9dc5da91 100644 --- a/packages/insomnia-app/app/network/authentication.js +++ b/packages/insomnia-app/app/network/authentication.js @@ -5,7 +5,7 @@ import { AUTH_BEARER, AUTH_HAWK, AUTH_OAUTH_1, - AUTH_OAUTH_2 + AUTH_OAUTH_2, } from '../common/constants'; import getOAuth2Token from './o-auth-2/get-token'; import getOAuth1Token from './o-auth-1/get-token'; @@ -17,14 +17,14 @@ import { getBearerAuthHeader } from './bearer-auth/get-header'; type Header = { name: string, - value: string + value: string, }; export async function getAuthHeader( requestId: string, url: string, method: string, - authentication: RequestAuthentication + authentication: RequestAuthentication, ): Promise
{ if (authentication.disabled) { return null; @@ -61,7 +61,7 @@ export async function getAuthHeader( if (oAuth1Token) { return { name: 'Authorization', - value: oAuth1Token.Authorization + value: oAuth1Token.Authorization, }; } else { return null; @@ -72,11 +72,11 @@ export async function getAuthHeader( const { id, key, algorithm, ext } = authentication; const header = Hawk.client.header(url, method, { credentials: { id, key, algorithm }, - ext: ext + ext: ext, }); return { name: 'Authorization', - value: header.field + value: header.field, }; } @@ -97,7 +97,7 @@ export async function getAuthHeader( if (parsedAdditionalClaims) { if (typeof parsedAdditionalClaims !== 'object') { throw new Error( - `additional-claims must be an object received: '${typeof parsedAdditionalClaims}' instead` + `additional-claims must be an object received: '${typeof parsedAdditionalClaims}' instead`, ); } @@ -106,7 +106,7 @@ export async function getAuthHeader( const options = { privateKey, - kid: keyId + kid: keyId, }; return new Promise((resolve, reject) => { @@ -116,7 +116,7 @@ export async function getAuthHeader( } else { resolve({ name: 'Authorization', - value: headerValue + value: headerValue, }); } }); diff --git a/packages/insomnia-app/app/network/basic-auth/__tests__/get-header.test.js b/packages/insomnia-app/app/network/basic-auth/__tests__/get-header.test.js index c723009329..11662a981a 100644 --- a/packages/insomnia-app/app/network/basic-auth/__tests__/get-header.test.js +++ b/packages/insomnia-app/app/network/basic-auth/__tests__/get-header.test.js @@ -7,7 +7,7 @@ describe('getBasicAuthHeader()', () => { const header = getBasicAuthHeader('user', 'password'); expect(header).toEqual({ name: 'Authorization', - value: 'Basic dXNlcjpwYXNzd29yZA==' + value: 'Basic dXNlcjpwYXNzd29yZA==', }); }); @@ -15,7 +15,7 @@ describe('getBasicAuthHeader()', () => { const header = getBasicAuthHeader(null, 'password'); expect(header).toEqual({ name: 'Authorization', - value: 'Basic OnBhc3N3b3Jk' + value: 'Basic OnBhc3N3b3Jk', }); }); @@ -23,7 +23,7 @@ describe('getBasicAuthHeader()', () => { const header = getBasicAuthHeader('user', ''); expect(header).toEqual({ name: 'Authorization', - value: 'Basic dXNlcjo=' + value: 'Basic dXNlcjo=', }); }); @@ -31,7 +31,7 @@ describe('getBasicAuthHeader()', () => { const header = getBasicAuthHeader('user', null); expect(header).toEqual({ name: 'Authorization', - value: 'Basic dXNlcjo=' + value: 'Basic dXNlcjo=', }); }); }); diff --git a/packages/insomnia-app/app/network/multipart.js b/packages/insomnia-app/app/network/multipart.js index 209e3da29d..aebfb733ac 100644 --- a/packages/insomnia-app/app/network/multipart.js +++ b/packages/insomnia-app/app/network/multipart.js @@ -28,7 +28,7 @@ export async function buildMultipart(params: Array) { }); stream.pipe( writeStream, - { end: false } + { end: false }, ); totalSize += size; }); @@ -58,7 +58,7 @@ export async function buildMultipart(params: Array) { addString( 'Content-Disposition: form-data; ' + `name="${name.replace(/"/g, '\\"')}"; ` + - `filename="${path.basename(fileName).replace(/"/g, '\\"')}"` + `filename="${path.basename(fileName).replace(/"/g, '\\"')}"`, ); addString(lineBreak); addString(`Content-Type: ${contentType}`); @@ -92,7 +92,7 @@ export async function buildMultipart(params: Array) { resolve({ boundary: DEFAULT_BOUNDARY, filePath, - contentLength: totalSize + contentLength: totalSize, }); }); diff --git a/packages/insomnia-app/app/network/network.js b/packages/insomnia-app/app/network/network.js index fd0f626cbc..81dd3f3c41 100644 --- a/packages/insomnia-app/app/network/network.js +++ b/packages/insomnia-app/app/network/network.js @@ -22,7 +22,7 @@ import { CONTENT_TYPE_FORM_URLENCODED, getAppVersion, getTempDir, - STATUS_CODE_PLUGIN_ERROR + STATUS_CODE_PLUGIN_ERROR, } from '../common/constants'; import { delay, @@ -37,13 +37,13 @@ import { hasContentTypeHeader, hasUserAgentHeader, waitForStreamToFinish, - getDataDirectory + getDataDirectory, } from '../common/misc'; import { buildQueryStringFromParams, joinUrlAndQueryString, setDefaultProtocol, - smartEncodeUrl + smartEncodeUrl, } from 'insomnia-url'; import fs from 'fs'; import * as db from '../common/database'; @@ -73,7 +73,7 @@ export type ResponsePatch = { parentId?: string, settingStoreCookies?: boolean, settingSendCookies?: boolean, - timeline?: Array + timeline?: Array, }; // Time since user's last keypress to wait before making the request @@ -95,7 +95,7 @@ export async function _actuallySend( renderedRequest: RenderedRequest, renderContext: Object, workspace: Workspace, - settings: Settings + settings: Settings, ): Promise { return new Promise(async resolve => { let timeline: Array = []; @@ -115,7 +115,7 @@ export async function _actuallySend( async function respond( patch: ResponsePatch, bodyPath: string | null, - noPlugins: boolean = false + noPlugins: boolean = false, ): Promise { const responsePatchBeforeHooks = Object.assign( ({ @@ -124,9 +124,9 @@ export async function _actuallySend( timeline: timeline, bodyPath: bodyPath || '', settingSendCookies: renderedRequest.settingSendCookies, - settingStoreCookies: renderedRequest.settingStoreCookies + settingStoreCookies: renderedRequest.settingStoreCookies, }: ResponsePatch), - patch + patch, ); if (noPlugins) { @@ -139,11 +139,11 @@ export async function _actuallySend( responsePatch = await _applyResponsePluginHooks( responsePatchBeforeHooks, renderedRequest, - renderContext + renderContext, ); } catch (err) { handleError( - new Error(`[plugin] Response hook failed plugin=${err.plugin.name} err=${err.message}`) + new Error(`[plugin] Response hook failed plugin=${err.plugin.name} err=${err.message}`), ); return; } @@ -161,10 +161,10 @@ export async function _actuallySend( elapsedTime: 0, statusMessage: 'Error', settingSendCookies: renderedRequest.settingSendCookies, - settingStoreCookies: renderedRequest.settingStoreCookies + settingStoreCookies: renderedRequest.settingStoreCookies, }, null, - true + true, ); } @@ -195,10 +195,10 @@ export async function _actuallySend( bytesRead: curl.getInfo(Curl.info.SIZE_DOWNLOAD), url: curl.getInfo(Curl.info.EFFECTIVE_URL), statusMessage: 'Cancelled', - error: 'Request was cancelled' + error: 'Request was cancelled', }, null, - true + true, ); // Kill it! @@ -297,7 +297,7 @@ export async function _actuallySend( return 0; }, - true + true, ); // Set the URL, including the query parameters @@ -376,8 +376,8 @@ export async function _actuallySend( cookie.secure ? 'TRUE' : 'FALSE', expiresTimestamp, cookie.key, - cookie.value - ].join('\t') + cookie.value, + ].join('\t'), ); } @@ -387,7 +387,7 @@ export async function _actuallySend( addTimelineText( 'Enable cookie sending with jar of ' + - `${cookies.length} cookie${cookies.length !== 1 ? 's' : ''}` + `${cookies.length} cookie${cookies.length !== 1 ? 's' : ''}`, ); } else { addTimelineText('Disable cookie sending due to user setting'); @@ -474,7 +474,7 @@ export async function _actuallySend( } else if (renderedRequest.body.mimeType === CONTENT_TYPE_FORM_DATA) { const params = renderedRequest.body.params || []; const { filePath: multipartBodyPath, boundary, contentLength } = await buildMultipart( - params + params, ); // Extend the Content-Type header @@ -484,7 +484,7 @@ export async function _actuallySend( } else { headers.push({ name: 'Content-Type', - value: `multipart/form-data; boundary=${boundary}` + value: `multipart/form-data; boundary=${boundary}`, }); } @@ -531,7 +531,7 @@ export async function _actuallySend( headers.push({ name: 'Expect', value: DISABLE_HEADER_VALUE }); headers.push({ name: 'Transfer-Encoding', - value: DISABLE_HEADER_VALUE + value: DISABLE_HEADER_VALUE, }); } @@ -560,14 +560,14 @@ export async function _actuallySend( } else if (renderedRequest.authentication.type === AUTH_AWS_IAM) { if (!noBody && !requestBody) { return handleError( - new Error('AWS authentication not supported for provided body type') + new Error('AWS authentication not supported for provided body type'), ); } const { authentication } = renderedRequest; const credentials = { accessKeyId: authentication.accessKeyId || '', secretAccessKey: authentication.secretAccessKey || '', - sessionToken: authentication.sessionToken || '' + sessionToken: authentication.sessionToken || '', }; const extraHeaders = _getAwsAuthHeaders( @@ -577,7 +577,7 @@ export async function _actuallySend( finalUrl, renderedRequest.method, authentication.region || '', - authentication.service || '' + authentication.service || '', ); for (const header of extraHeaders) { @@ -590,13 +590,13 @@ export async function _actuallySend( renderedRequest._id, finalUrl, renderedRequest.method, - renderedRequest.authentication + renderedRequest.authentication, ); if (authHeader) { headers.push({ name: authHeader.name, - value: authHeader.value + value: authHeader.value, }); } } @@ -721,7 +721,7 @@ export async function _actuallySend( elapsedTime: curl.getInfo(Curl.info.TOTAL_TIME) * 1000, bytesRead: curl.getInfo(Curl.info.SIZE_DOWNLOAD), bytesContent: responseBodyBytes, - url: curl.getInfo(Curl.info.EFFECTIVE_URL) + url: curl.getInfo(Curl.info.EFFECTIVE_URL), }; // Close the request @@ -754,7 +754,7 @@ export async function _actuallySend( export async function sendWithSettings( requestId: string, - requestPatch: Object + requestPatch: Object, ): Promise { const request = await models.request.getById(requestId); if (!request) { @@ -765,7 +765,7 @@ export async function sendWithSettings( const ancestors = await db.withAncestors(request, [ models.request.type, models.requestGroup.type, - models.workspace.type + models.workspace.type, ]); const workspaceDoc = ancestors.find(doc => doc.type === models.workspace.type); @@ -780,7 +780,7 @@ export async function sendWithSettings( const newRequest: Request = await models.initModel(models.request.type, requestPatch, { _id: request._id + '.other', - parentId: request._id + parentId: request._id, }); let renderResult: { request: RenderedRequest, context: Object }; @@ -814,7 +814,7 @@ export async function send(requestId: string, environmentId: string): Promise { const newRenderedRequest = clone(renderedRequest); for (const { plugin, hook } of await plugins.getRequestHooks()) { const context = { ...pluginContexts.app.init(), ...pluginContexts.store.init(plugin), - ...pluginContexts.request.init(newRenderedRequest, renderedContext) + ...pluginContexts.request.init(newRenderedRequest, renderedContext), }; try { @@ -883,7 +883,7 @@ async function _applyRequestPluginHooks( async function _applyResponsePluginHooks( response: ResponsePatch, request: RenderedRequest, - renderContext: Object + renderContext: Object, ): Promise { const newResponse = clone(response); const newRequest = clone(request); @@ -893,7 +893,7 @@ async function _applyResponsePluginHooks( ...pluginContexts.app.init(), ...pluginContexts.store.init(plugin), ...pluginContexts.response.init(newResponse), - ...pluginContexts.request.init(newRequest, renderContext, true) + ...pluginContexts.request.init(newRequest, renderContext, true), }; try { @@ -908,12 +908,12 @@ async function _applyResponsePluginHooks( } export function _parseHeaders( - buffer: Buffer + buffer: Buffer, ): Array<{ headers: Array, version: string, code: number, - reason: string + reason: string, }> { const results = []; @@ -936,7 +936,7 @@ export function _parseHeaders( version, code: parseInt(code, 10), reason: other.join(' '), - headers: [] + headers: [], }; } else { const [name, value] = line.split(/:\s(.+)/); @@ -953,14 +953,14 @@ export function _getAwsAuthHeaders( credentials: { accessKeyId: string, secretAccessKey: string, - sessionToken: string + sessionToken: string, }, headers: Array, body: string, url: string, method: string, region?: string, - service?: string + service?: string, ): Array<{ name: string, value: string, disabled?: boolean }> { const parsedUrl = urlParse(url); const contentTypeHeader = getContentTypeHeader(headers); @@ -976,7 +976,7 @@ export function _getAwsAuthHeaders( body, method, path: parsedUrl.path, - headers: contentTypeHeader ? { 'content-type': contentTypeHeader.value } : {} + headers: contentTypeHeader ? { 'content-type': contentTypeHeader.value } : {}, }; const signature = aws4.sign(awsSignOptions, credentials); diff --git a/packages/insomnia-app/app/network/o-auth-1/get-token.js b/packages/insomnia-app/app/network/o-auth-1/get-token.js index eda2d381db..acefefb83d 100644 --- a/packages/insomnia-app/app/network/o-auth-1/get-token.js +++ b/packages/insomnia-app/app/network/o-auth-1/get-token.js @@ -9,7 +9,7 @@ import { SIGNATURE_METHOD_HMAC_SHA1, SIGNATURE_METHOD_RSA_SHA1, SIGNATURE_METHOD_PLAINTEXT, - SIGNATURE_METHOD_HMAC_SHA256 + SIGNATURE_METHOD_HMAC_SHA256, } from './constants'; import type { OAuth1SignatureMethod } from './constants'; import type { RequestAuthentication } from '../../models/request'; @@ -54,17 +54,17 @@ function hashFunction(signatureMethod: OAuth1SignatureMethod) { export default async function( url: string, method: string, - authentication: RequestAuthentication + authentication: RequestAuthentication, ): { [string]: string } { const oauth = new OAuth1({ consumer: { key: authentication.consumerKey, - secret: authentication.consumerSecret + secret: authentication.consumerSecret, }, signature_method: authentication.signatureMethod, version: authentication.version, hash_function: hashFunction(authentication.signatureMethod), - realm: authentication.realm || null + realm: authentication.realm || null, }); const requestData = { @@ -72,7 +72,7 @@ export default async function( method: method, data: { // These are conditionally filled in below - } + }, }; if (authentication.callback) { @@ -95,7 +95,7 @@ export default async function( if (authentication.tokenKey && authentication.tokenSecret) { token = { key: authentication.tokenKey, - secret: authentication.tokenSecret + secret: authentication.tokenSecret, }; } else if (authentication.tokenKey) { token = { key: authentication.tokenKey }; diff --git a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-authorization-code.test.js b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-authorization-code.test.js index 5b4c2d8c5a..b94aa449ba 100644 --- a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-authorization-code.test.js +++ b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-authorization-code.test.js @@ -26,8 +26,8 @@ describe('authorization_code', () => { JSON.stringify({ access_token: 'token_123', token_type: 'token_type', - scope: SCOPE - }) + scope: SCOPE, + }), ); network.sendWithSettings = jest.fn(() => ({ @@ -35,7 +35,7 @@ describe('authorization_code', () => { bodyCompression: '', parentId: 'req_1', statusCode: 200, - headers: [{ name: 'Content-Type', value: 'application/json' }] + headers: [{ name: 'Content-Type', value: 'application/json' }], })); const result = await getToken( @@ -47,7 +47,7 @@ describe('authorization_code', () => { CLIENT_SECRET, REDIRECT_URI, SCOPE, - STATE + STATE, ); // Check the request to fetch the token @@ -63,25 +63,25 @@ describe('authorization_code', () => { { name: 'grant_type', value: 'authorization_code' }, { name: 'code', value: 'code_123' }, { name: 'redirect_uri', value: REDIRECT_URI }, - { name: 'state', value: STATE } - ] + { name: 'state', value: STATE }, + ], }, headers: [ { name: 'Content-Type', - value: 'application/x-www-form-urlencoded' + value: 'application/x-www-form-urlencoded', }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' + value: 'application/x-www-form-urlencoded, application/json', }, { name: 'Authorization', - value: 'Basic Y2xpZW50XzEyMzpzZWNyZXRfMTIzNDU0NTY2Nzc3NTYzNDM=' - } - ] - } - ] + value: 'Basic Y2xpZW50XzEyMzpzZWNyZXRfMTIzNDU0NTY2Nzc3NTYzNDM=', + }, + ], + }, + ], ]); // Check the expected value @@ -94,7 +94,7 @@ describe('authorization_code', () => { error: null, error_uri: null, error_description: null, - xResponseId: 'res_dd2ccc1a2745477a881a9e8ef9d42403' + xResponseId: 'res_dd2ccc1a2745477a881a9e8ef9d42403', }); }); @@ -107,8 +107,8 @@ describe('authorization_code', () => { JSON.stringify({ access_token: 'token_123', token_type: 'token_type', - scope: SCOPE - }) + scope: SCOPE, + }), ); network.sendWithSettings = jest.fn(() => ({ @@ -116,7 +116,7 @@ describe('authorization_code', () => { bodyCompression: '', parentId: 'req_1', statusCode: 200, - headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }] + headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }], })); const result = await getToken( @@ -128,7 +128,7 @@ describe('authorization_code', () => { CLIENT_SECRET, REDIRECT_URI, SCOPE, - STATE + STATE, ); // Check the request to fetch the token @@ -146,21 +146,21 @@ describe('authorization_code', () => { { name: 'redirect_uri', value: REDIRECT_URI }, { name: 'state', value: STATE }, { name: 'client_id', value: CLIENT_ID }, - { name: 'client_secret', value: CLIENT_SECRET } - ] + { name: 'client_secret', value: CLIENT_SECRET }, + ], }, headers: [ { name: 'Content-Type', - value: 'application/x-www-form-urlencoded' + value: 'application/x-www-form-urlencoded', }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' - } - ] - } - ] + value: 'application/x-www-form-urlencoded, application/json', + }, + ], + }, + ], ]); // Check the expected value @@ -173,7 +173,7 @@ describe('authorization_code', () => { error: null, error_uri: null, error_description: null, - xResponseId: 'res_e3e96e5fdd6842298b66dee1f0940f3d' + xResponseId: 'res_e3e96e5fdd6842298b66dee1f0940f3d', }); }); }); diff --git a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-client-credentials.test.js b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-client-credentials.test.js index 2a6ecb666c..32ec6bbcb3 100644 --- a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-client-credentials.test.js +++ b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-client-credentials.test.js @@ -25,8 +25,8 @@ describe('client_credentials', () => { token_type: 'token_type', scope: SCOPE, audience: AUDIENCE, - resource: RESOURCE - }) + resource: RESOURCE, + }), ); network.sendWithSettings = jest.fn(() => ({ @@ -34,7 +34,7 @@ describe('client_credentials', () => { bodyCompression: '', parentId: 'req_1', statusCode: 200, - headers: [{ name: 'Content-Type', value: 'application/json' }] + headers: [{ name: 'Content-Type', value: 'application/json' }], })); const result = await getToken( @@ -45,7 +45,7 @@ describe('client_credentials', () => { CLIENT_SECRET, SCOPE, AUDIENCE, - RESOURCE + RESOURCE, ); // Check the request to fetch the token @@ -61,25 +61,25 @@ describe('client_credentials', () => { { name: 'grant_type', value: 'client_credentials' }, { name: 'scope', value: SCOPE }, { name: 'audience', value: AUDIENCE }, - { name: 'resource', value: RESOURCE } - ] + { name: 'resource', value: RESOURCE }, + ], }, headers: [ { name: 'Content-Type', - value: 'application/x-www-form-urlencoded' + value: 'application/x-www-form-urlencoded', }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' + value: 'application/x-www-form-urlencoded, application/json', }, { name: 'Authorization', - value: 'Basic Y2xpZW50XzEyMzpzZWNyZXRfMTIzNDU0NTY2Nzc3NTYzNDM=' - } - ] - } - ] + value: 'Basic Y2xpZW50XzEyMzpzZWNyZXRfMTIzNDU0NTY2Nzc3NTYzNDM=', + }, + ], + }, + ], ]); // Check the expected value @@ -93,7 +93,7 @@ describe('client_credentials', () => { error: null, error_uri: null, error_description: null, - xResponseId: 'res_dd2ccc1a2745477a881a9e8ef9d42403' + xResponseId: 'res_dd2ccc1a2745477a881a9e8ef9d42403', }); }); @@ -107,8 +107,8 @@ describe('client_credentials', () => { token_type: 'token_type', scope: SCOPE, audience: AUDIENCE, - resource: RESOURCE - }) + resource: RESOURCE, + }), ); network.sendWithSettings = jest.fn(() => ({ @@ -116,7 +116,7 @@ describe('client_credentials', () => { bodyCompression: '', parentId: 'req_1', statusCode: 200, - headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }] + headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }], })); const result = await getToken( @@ -127,7 +127,7 @@ describe('client_credentials', () => { CLIENT_SECRET, SCOPE, AUDIENCE, - RESOURCE + RESOURCE, ); // Check the request to fetch the token @@ -145,21 +145,21 @@ describe('client_credentials', () => { { name: 'audience', value: AUDIENCE }, { name: 'resource', value: RESOURCE }, { name: 'client_id', value: CLIENT_ID }, - { name: 'client_secret', value: CLIENT_SECRET } - ] + { name: 'client_secret', value: CLIENT_SECRET }, + ], }, headers: [ { name: 'Content-Type', - value: 'application/x-www-form-urlencoded' + value: 'application/x-www-form-urlencoded', }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' - } - ] - } - ] + value: 'application/x-www-form-urlencoded, application/json', + }, + ], + }, + ], ]); // Check the expected value @@ -173,7 +173,7 @@ describe('client_credentials', () => { error: null, error_uri: null, error_description: null, - xResponseId: 'res_e3e96e5fdd6842298b66dee1f0940f3d' + xResponseId: 'res_e3e96e5fdd6842298b66dee1f0940f3d', }); }); }); diff --git a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-implicit.test.js b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-implicit.test.js index 90b084f546..dd99d1a1d3 100644 --- a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-implicit.test.js +++ b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-implicit.test.js @@ -25,7 +25,7 @@ describe('implicit', () => { state: STATE, error: null, error_description: null, - error_uri: null + error_uri: null, }); }); }); diff --git a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-password.test.js b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-password.test.js index 30680f0e87..9e26ec0cfc 100644 --- a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-password.test.js +++ b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-password.test.js @@ -23,8 +23,8 @@ describe('password', () => { JSON.stringify({ access_token: 'token_123', token_type: 'token_type', - scope: SCOPE - }) + scope: SCOPE, + }), ); network.sendWithSettings = jest.fn(() => ({ @@ -32,7 +32,7 @@ describe('password', () => { bodyCompression: '', parentId: 'req_1', statusCode: 200, - headers: [{ name: 'Content-Type', value: 'application/json' }] + headers: [{ name: 'Content-Type', value: 'application/json' }], })); const result = await getToken( @@ -43,7 +43,7 @@ describe('password', () => { CLIENT_SECRET, USERNAME, PASSWORD, - SCOPE + SCOPE, ); // Check the request to fetch the token @@ -59,25 +59,25 @@ describe('password', () => { { name: 'grant_type', value: 'password' }, { name: 'username', value: USERNAME }, { name: 'password', value: PASSWORD }, - { name: 'scope', value: SCOPE } - ] + { name: 'scope', value: SCOPE }, + ], }, headers: [ { name: 'Content-Type', - value: 'application/x-www-form-urlencoded' + value: 'application/x-www-form-urlencoded', }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' + value: 'application/x-www-form-urlencoded, application/json', }, { name: 'Authorization', - value: 'Basic Y2xpZW50XzEyMzpzZWNyZXRfMTIzNDU0NTY2Nzc3NTYzNDM=' - } - ] - } - ] + value: 'Basic Y2xpZW50XzEyMzpzZWNyZXRfMTIzNDU0NTY2Nzc3NTYzNDM=', + }, + ], + }, + ], ]); // Check the expected value @@ -90,7 +90,7 @@ describe('password', () => { error: null, error_uri: null, error_description: null, - xResponseId: 'res_dd2ccc1a2745477a881a9e8ef9d42403' + xResponseId: 'res_dd2ccc1a2745477a881a9e8ef9d42403', }); }); @@ -102,8 +102,8 @@ describe('password', () => { JSON.stringify({ access_token: 'token_123', token_type: 'token_type', - scope: SCOPE - }) + scope: SCOPE, + }), ); network.sendWithSettings = jest.fn(() => ({ @@ -111,7 +111,7 @@ describe('password', () => { bodyCompression: '', parentId: 'req_1', statusCode: 200, - headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }] + headers: [{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }], })); const result = await getToken( @@ -122,7 +122,7 @@ describe('password', () => { CLIENT_SECRET, USERNAME, PASSWORD, - SCOPE + SCOPE, ); // Check the request to fetch the token @@ -140,21 +140,21 @@ describe('password', () => { { name: 'password', value: PASSWORD }, { name: 'scope', value: SCOPE }, { name: 'client_id', value: CLIENT_ID }, - { name: 'client_secret', value: CLIENT_SECRET } - ] + { name: 'client_secret', value: CLIENT_SECRET }, + ], }, headers: [ { name: 'Content-Type', - value: 'application/x-www-form-urlencoded' + value: 'application/x-www-form-urlencoded', }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' - } - ] - } - ] + value: 'application/x-www-form-urlencoded, application/json', + }, + ], + }, + ], ]); // Check the expected value @@ -167,7 +167,7 @@ describe('password', () => { error: null, error_uri: null, error_description: null, - xResponseId: 'res_e3e96e5fdd6842298b66dee1f0940f3d' + xResponseId: 'res_e3e96e5fdd6842298b66dee1f0940f3d', }); }); }); diff --git a/packages/insomnia-app/app/network/o-auth-2/get-token.js b/packages/insomnia-app/app/network/o-auth-2/get-token.js index 11acc195a2..6a0d039cf8 100644 --- a/packages/insomnia-app/app/network/o-auth-2/get-token.js +++ b/packages/insomnia-app/app/network/o-auth-2/get-token.js @@ -16,7 +16,7 @@ import { P_EXPIRES_IN, P_REFRESH_TOKEN, X_RESPONSE_ID, - X_ERROR + X_ERROR, } from './constants'; import * as models from '../../models'; import type { RequestAuthentication } from '../../models/request'; @@ -26,7 +26,7 @@ import type { OAuth2Token } from '../../models/o-auth-2-token'; export default async function( requestId: string, authentication: RequestAuthentication, - forceRefresh: boolean = false + forceRefresh: boolean = false, ): Promise { switch (authentication.grantType) { case GRANT_TYPE_AUTHORIZATION_CODE: @@ -45,7 +45,7 @@ export default async function( async function _getOAuth2AuthorizationCodeHeader( requestId: string, authentication: RequestAuthentication, - forceRefresh: boolean + forceRefresh: boolean, ): Promise { const oAuth2Token = await _getAccessToken(requestId, authentication, forceRefresh); @@ -62,7 +62,7 @@ async function _getOAuth2AuthorizationCodeHeader( authentication.clientSecret, authentication.redirectUrl, authentication.scope, - authentication.state + authentication.state, ); return _updateOAuth2Token(requestId, results); @@ -71,7 +71,7 @@ async function _getOAuth2AuthorizationCodeHeader( async function _getOAuth2ClientCredentialsHeader( requestId: string, authentication: RequestAuthentication, - forceRefresh: boolean + forceRefresh: boolean, ): Promise { const oAuth2Token = await _getAccessToken(requestId, authentication, forceRefresh); @@ -87,7 +87,7 @@ async function _getOAuth2ClientCredentialsHeader( authentication.clientSecret, authentication.scope, authentication.audience, - authentication.resource + authentication.resource, ); return _updateOAuth2Token(requestId, results); @@ -96,7 +96,7 @@ async function _getOAuth2ClientCredentialsHeader( async function _getOAuth2ImplicitHeader( requestId: string, authentication: RequestAuthentication, - forceRefresh: boolean + forceRefresh: boolean, ): Promise { const oAuth2Token = await _getAccessToken(requestId, authentication, forceRefresh); @@ -112,7 +112,7 @@ async function _getOAuth2ImplicitHeader( authentication.redirectUrl, authentication.scope, authentication.state, - authentication.audience + authentication.audience, ); return _updateOAuth2Token(requestId, results); @@ -121,7 +121,7 @@ async function _getOAuth2ImplicitHeader( async function _getOAuth2PasswordHeader( requestId: string, authentication: RequestAuthentication, - forceRefresh: boolean + forceRefresh: boolean, ): Promise { const oAuth2Token = await _getAccessToken(requestId, authentication, forceRefresh); @@ -137,7 +137,7 @@ async function _getOAuth2PasswordHeader( authentication.clientSecret, authentication.username, authentication.password, - authentication.scope + authentication.scope, ); return _updateOAuth2Token(requestId, results); @@ -146,7 +146,7 @@ async function _getOAuth2PasswordHeader( async function _getAccessToken( requestId: string, authentication: RequestAuthentication, - forceRefresh: boolean + forceRefresh: boolean, ): Promise { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // See if we have a token already // @@ -187,7 +187,7 @@ async function _getAccessToken( authentication.clientId, authentication.clientSecret, token.refreshToken, - authentication.scope + authentication.scope, ); // ~~~~~~~~~~~~~ // @@ -214,6 +214,6 @@ async function _updateOAuth2Token(requestId: string, authResults: Object): Promi // Special Cases xResponseId: authResults[X_RESPONSE_ID] || null, - xError: authResults[X_ERROR] || null + xError: authResults[X_ERROR] || null, }); } diff --git a/packages/insomnia-app/app/network/o-auth-2/grant-authorization-code.js b/packages/insomnia-app/app/network/o-auth-2/grant-authorization-code.js index 744af4a75b..0e6dee7d35 100644 --- a/packages/insomnia-app/app/network/o-auth-2/grant-authorization-code.js +++ b/packages/insomnia-app/app/network/o-auth-2/grant-authorization-code.js @@ -17,7 +17,7 @@ export default async function( clientSecret: string, redirectUri: string = '', scope: string = '', - state: string = '' + state: string = '', ): Promise { if (!authorizeUrl) { throw new Error('Invalid authorization URL'); @@ -45,14 +45,14 @@ export default async function( clientSecret, authorizeResults[c.P_CODE], redirectUri, - state + state, ); } async function _authorize(url, clientId, redirectUri = '', scope = '', state = '') { const params = [ { name: c.P_RESPONSE_TYPE, value: c.RESPONSE_TYPE_CODE }, - { name: c.P_CLIENT_ID, value: clientId } + { name: c.P_CLIENT_ID, value: clientId }, ]; // Add optional params @@ -76,7 +76,7 @@ async function _authorize(url, clientId, redirectUri = '', scope = '', state = ' c.P_STATE, c.P_ERROR, c.P_ERROR_DESCRIPTION, - c.P_ERROR_URI + c.P_ERROR_URI, ]); } @@ -88,11 +88,11 @@ async function _getToken( clientSecret: string, code: string, redirectUri: string = '', - state: string = '' + state: string = '', ): Promise { const params = [ { name: c.P_GRANT_TYPE, value: c.GRANT_TYPE_AUTHORIZATION_CODE }, - { name: c.P_CODE, value: code } + { name: c.P_CODE, value: code }, ]; // Add optional params @@ -103,8 +103,8 @@ async function _getToken( { name: 'Content-Type', value: 'application/x-www-form-urlencoded' }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' - } + value: 'application/x-www-form-urlencoded, application/json', + }, ]; if (credentialsInBody) { @@ -118,7 +118,7 @@ async function _getToken( headers, url, method: 'POST', - body: models.request.newBodyFormUrlEncoded(params) + body: models.request.newBodyFormUrlEncoded(params), }); const response = await models.response.create(responsePatch); @@ -127,7 +127,7 @@ async function _getToken( if (!bodyBuffer) { return { [c.X_ERROR]: `No body returned from ${url}`, - [c.X_RESPONSE_ID]: response._id + [c.X_RESPONSE_ID]: response._id, }; } @@ -135,7 +135,7 @@ async function _getToken( if (statusCode < 200 || statusCode >= 300) { return { [c.X_ERROR]: `Failed to fetch token url=${url} status=${statusCode}`, - [c.X_RESPONSE_ID]: response._id + [c.X_RESPONSE_ID]: response._id, }; } @@ -147,7 +147,7 @@ async function _getToken( c.P_SCOPE, c.P_ERROR, c.P_ERROR_URI, - c.P_ERROR_DESCRIPTION + c.P_ERROR_DESCRIPTION, ]); results[c.X_RESPONSE_ID] = response._id; diff --git a/packages/insomnia-app/app/network/o-auth-2/grant-client-credentials.js b/packages/insomnia-app/app/network/o-auth-2/grant-client-credentials.js index ba349549e2..a4f0a03e4b 100644 --- a/packages/insomnia-app/app/network/o-auth-2/grant-client-credentials.js +++ b/packages/insomnia-app/app/network/o-auth-2/grant-client-credentials.js @@ -14,7 +14,7 @@ export default async function( clientSecret: string, scope: string = '', audience: string = '', - resource: string = '' + resource: string = '', ): Promise { const params = [{ name: c.P_GRANT_TYPE, value: c.GRANT_TYPE_CLIENT_CREDENTIALS }]; @@ -27,8 +27,8 @@ export default async function( { name: 'Content-Type', value: 'application/x-www-form-urlencoded' }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' - } + value: 'application/x-www-form-urlencoded, application/json', + }, ]; if (credentialsInBody) { @@ -44,7 +44,7 @@ export default async function( headers, url, method: 'POST', - body: models.request.newBodyFormUrlEncoded(params) + body: models.request.newBodyFormUrlEncoded(params), }); const response = await models.response.create(responsePatch); @@ -53,7 +53,7 @@ export default async function( if (!bodyBuffer) { return { [c.X_ERROR]: `No body returned from ${url}`, - [c.X_RESPONSE_ID]: response._id + [c.X_RESPONSE_ID]: response._id, }; } @@ -61,7 +61,7 @@ export default async function( if (statusCode < 200 || statusCode >= 300) { return { [c.X_ERROR]: `Failed to fetch token url=${url} status=${statusCode}`, - [c.X_RESPONSE_ID]: response._id + [c.X_RESPONSE_ID]: response._id, }; } @@ -74,7 +74,7 @@ export default async function( c.P_RESOURCE, c.P_ERROR, c.P_ERROR_URI, - c.P_ERROR_DESCRIPTION + c.P_ERROR_DESCRIPTION, ]); results[c.X_RESPONSE_ID] = response._id; diff --git a/packages/insomnia-app/app/network/o-auth-2/grant-implicit.js b/packages/insomnia-app/app/network/o-auth-2/grant-implicit.js index 91d34c440f..979fe4e530 100644 --- a/packages/insomnia-app/app/network/o-auth-2/grant-implicit.js +++ b/packages/insomnia-app/app/network/o-auth-2/grant-implicit.js @@ -11,11 +11,11 @@ export default async function( redirectUri: string = '', scope: string = '', state: string = '', - audience: string = '' + audience: string = '', ): Promise { const params = [ { name: c.P_RESPONSE_TYPE, value: responseType }, - { name: c.P_CLIENT_ID, value: clientId } + { name: c.P_CLIENT_ID, value: clientId }, ]; // Add optional params @@ -48,7 +48,7 @@ export default async function( c.P_STATE, c.P_ERROR, c.P_ERROR_DESCRIPTION, - c.P_ERROR_URI + c.P_ERROR_URI, ]); } else { // Bad redirect diff --git a/packages/insomnia-app/app/network/o-auth-2/grant-password.js b/packages/insomnia-app/app/network/o-auth-2/grant-password.js index c3b5212ad5..7dccc0e2e4 100644 --- a/packages/insomnia-app/app/network/o-auth-2/grant-password.js +++ b/packages/insomnia-app/app/network/o-auth-2/grant-password.js @@ -14,12 +14,12 @@ export default async function( clientSecret: string, username: string, password: string, - scope: string = '' + scope: string = '', ): Promise { const params = [ { name: c.P_GRANT_TYPE, value: c.GRANT_TYPE_PASSWORD }, { name: c.P_USERNAME, value: username }, - { name: c.P_PASSWORD, value: password } + { name: c.P_PASSWORD, value: password }, ]; // Add optional params @@ -29,8 +29,8 @@ export default async function( { name: 'Content-Type', value: 'application/x-www-form-urlencoded' }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' - } + value: 'application/x-www-form-urlencoded, application/json', + }, ]; if (credentialsInBody) { @@ -46,7 +46,7 @@ export default async function( url, headers, method: 'POST', - body: models.request.newBodyFormUrlEncoded(params) + body: models.request.newBodyFormUrlEncoded(params), }); const response = await models.response.create(responsePatch); @@ -55,7 +55,7 @@ export default async function( if (!bodyBuffer) { return { [c.X_ERROR]: `No body returned from ${url}`, - [c.X_RESPONSE_ID]: response._id + [c.X_RESPONSE_ID]: response._id, }; } @@ -63,7 +63,7 @@ export default async function( if (statusCode < 200 || statusCode >= 300) { return { [c.X_ERROR]: `Failed to fetch token url=${url} status=${statusCode}`, - [c.X_RESPONSE_ID]: response._id + [c.X_RESPONSE_ID]: response._id, }; } @@ -75,7 +75,7 @@ export default async function( c.P_SCOPE, c.P_ERROR, c.P_ERROR_URI, - c.P_ERROR_DESCRIPTION + c.P_ERROR_DESCRIPTION, ]); results[c.X_RESPONSE_ID] = response._id; diff --git a/packages/insomnia-app/app/network/o-auth-2/misc.js b/packages/insomnia-app/app/network/o-auth-2/misc.js index 6220403ae0..d11c723b1e 100644 --- a/packages/insomnia-app/app/network/o-auth-2/misc.js +++ b/packages/insomnia-app/app/network/o-auth-2/misc.js @@ -27,7 +27,7 @@ export function responseToObject(body, keys) { export function authorizeUserInWindow( url, urlSuccessRegex = /(code=).*/, - urlFailureRegex = /(error=).*/ + urlFailureRegex = /(error=).*/, ) { return new Promise((resolve, reject) => { let finalUrl = null; @@ -35,13 +35,13 @@ export function authorizeUserInWindow( function _parseUrl(currentUrl) { if (currentUrl.match(urlSuccessRegex)) { console.log( - `[oauth2] Matched success redirect to "${currentUrl}" with ${urlSuccessRegex.toString()}` + `[oauth2] Matched success redirect to "${currentUrl}" with ${urlSuccessRegex.toString()}`, ); finalUrl = currentUrl; child.close(); } else if (currentUrl.match(urlFailureRegex)) { console.log( - `[oauth2] Matched error redirect to "${currentUrl}" with ${urlFailureRegex.toString()}` + `[oauth2] Matched error redirect to "${currentUrl}" with ${urlFailureRegex.toString()}`, ); finalUrl = currentUrl; child.close(); @@ -50,7 +50,7 @@ export function authorizeUserInWindow( console.log(`[oauth2] Loaded "${currentUrl}"`); } else { console.log( - `[oauth2] Ignoring URL "${currentUrl}". Didn't match ${urlSuccessRegex.toString()}` + `[oauth2] Ignoring URL "${currentUrl}". Didn't match ${urlSuccessRegex.toString()}`, ); } } @@ -59,9 +59,9 @@ export function authorizeUserInWindow( const child = new electron.remote.BrowserWindow({ webPreferences: { nodeIntegration: false, - partition: `oauth2_${AUTH_WINDOW_SESSION_ID}` + partition: `oauth2_${AUTH_WINDOW_SESSION_ID}`, }, - show: false + show: false, }); // Finish on close diff --git a/packages/insomnia-app/app/network/o-auth-2/refresh-token.js b/packages/insomnia-app/app/network/o-auth-2/refresh-token.js index 34ca0608e3..4c6bdfd415 100644 --- a/packages/insomnia-app/app/network/o-auth-2/refresh-token.js +++ b/packages/insomnia-app/app/network/o-auth-2/refresh-token.js @@ -13,11 +13,11 @@ export default async function( clientId: string, clientSecret: string, refreshToken: string, - scope: string + scope: string, ): Promise { const params = [ { name: c.P_GRANT_TYPE, value: c.GRANT_TYPE_REFRESH }, - { name: c.P_REFRESH_TOKEN, value: refreshToken } + { name: c.P_REFRESH_TOKEN, value: refreshToken }, ]; // Add optional params @@ -27,8 +27,8 @@ export default async function( { name: 'Content-Type', value: 'application/x-www-form-urlencoded' }, { name: 'Accept', - value: 'application/x-www-form-urlencoded, application/json' - } + value: 'application/x-www-form-urlencoded, application/json', + }, ]; if (credentialsInBody) { @@ -44,7 +44,7 @@ export default async function( headers, url, method: 'POST', - body: models.request.newBodyFormUrlEncoded(params) + body: models.request.newBodyFormUrlEncoded(params), }); const statusCode = response.statusCode || 0; @@ -65,7 +65,7 @@ export default async function( c.P_SCOPE, c.P_ERROR, c.P_ERROR_URI, - c.P_ERROR_DESCRIPTION + c.P_ERROR_DESCRIPTION, ]); return results; diff --git a/packages/insomnia-app/app/plugins/context/__tests__/app.test.js b/packages/insomnia-app/app/plugins/context/__tests__/app.test.js index 8641afd157..e0af8d663f 100644 --- a/packages/insomnia-app/app/plugins/context/__tests__/app.test.js +++ b/packages/insomnia-app/app/plugins/context/__tests__/app.test.js @@ -12,7 +12,7 @@ describe('init()', () => { 'alert', 'getPath', 'prompt', - 'showSaveDialog' + 'showSaveDialog', ]); }); }); @@ -40,7 +40,7 @@ describe('app.alert()', () => { // Make sure it passes correct arguments expect(modals.showAlert.mock.calls).toEqual([ [{ title: 'Title' }], - [{ title: 'Title', message: 'Message' }] + [{ title: 'Title', message: 'Message' }], ]); }); }); @@ -71,17 +71,17 @@ describe('app.prompt()', () => { { title: 'Title', onComplete: expect.any(Function), - onCancel: expect.any(Function) - } + onCancel: expect.any(Function), + }, ], [ { title: 'Title', label: 'Label', onComplete: expect.any(Function), - onCancel: expect.any(Function) - } - ] + onCancel: expect.any(Function), + }, + ], ]); }); }); diff --git a/packages/insomnia-app/app/plugins/context/__tests__/data.test.js b/packages/insomnia-app/app/plugins/context/__tests__/data.test.js index e0d463aac4..a614c93126 100644 --- a/packages/insomnia-app/app/plugins/context/__tests__/data.test.js +++ b/packages/insomnia-app/app/plugins/context/__tests__/data.test.js @@ -11,7 +11,7 @@ const PLUGIN = { name: 'my-plugin', version: '1.0.0', directory: '/plugins/my-plugin', - module: {} + module: {}, }; describe('init()', () => { @@ -30,7 +30,7 @@ describe('app.import.*', () => { await models.workspace.create({ _id: 'wrk_1', created: 111, - modified: 222 + modified: 222, }); }); it('uri', async () => { @@ -53,8 +53,8 @@ describe('app.import.*', () => { description: '', name: 'New', parentId: null, - type: 'Workspace' - } + type: 'Workspace', + }, ]); expect(await db.all(models.request.type)).toEqual([ { @@ -78,8 +78,8 @@ describe('app.import.*', () => { settingRebuildPath: true, settingMaxTimelineDataSize: 1000, type: 'Request', - url: 'https://insomnia.rest' - } + url: 'https://insomnia.rest', + }, ]); }); @@ -103,8 +103,8 @@ describe('app.import.*', () => { description: '', name: 'New', parentId: null, - type: 'Workspace' - } + type: 'Workspace', + }, ]); expect(await db.all(models.request.type)).toEqual([ { @@ -128,8 +128,8 @@ describe('app.import.*', () => { settingRebuildPath: true, settingMaxTimelineDataSize: 1000, type: 'Request', - url: 'https://insomnia.rest' - } + url: 'https://insomnia.rest', + }, ]); }); }); @@ -140,7 +140,7 @@ describe('app.export.*', () => { await models.workspace.create({ _id: 'wrk_1', created: 111, - modified: 222 + modified: 222, }); await models.request.create({ _id: 'req_1', @@ -148,13 +148,13 @@ describe('app.export.*', () => { created: 111, modified: 222, metaSortKey: 0, - url: 'https://insomnia.rest' + url: 'https://insomnia.rest', }); await models.response.create({ _id: 'res_1', parentId: 'req_1', statusCode: 200, - body: 'foo' + body: 'foo', }); }); @@ -179,7 +179,7 @@ describe('app.export.*', () => { description: '', modified: 222, name: 'New Workspace', - parentId: null + parentId: null, }, { _id: 'req_1', @@ -202,9 +202,9 @@ describe('app.export.*', () => { settingStoreCookies: true, settingRebuildPath: true, settingMaxTimelineDataSize: 1000, - url: 'https://insomnia.rest' - } - ] + url: 'https://insomnia.rest', + }, + ], }); }); @@ -219,7 +219,7 @@ describe('app.export.*', () => { log: { creator: { name: 'Insomnia REST Client', - version: `insomnia.desktop.app:v${getAppVersion()}` + version: `insomnia.desktop.app:v${getAppVersion()}`, }, entries: [ { @@ -235,18 +235,18 @@ describe('app.export.*', () => { postData: { mimeType: '', params: [], - text: '' + text: '', }, queryString: [], url: 'https://insomnia.rest/', - settingEncodeUrl: true + settingEncodeUrl: true, }, response: { bodySize: -1, content: { mimeType: '', size: 3, - text: 'foo' + text: 'foo', }, cookies: [], headers: [], @@ -254,7 +254,7 @@ describe('app.export.*', () => { httpVersion: 'HTTP/1.1', redirectURL: '', status: 200, - statusText: '' + statusText: '', }, startedDateTime: '2017-11-24T18:12:12.849Z', time: 0, @@ -265,12 +265,12 @@ describe('app.export.*', () => { receive: 0, send: 0, ssl: -1, - wait: 0 - } - } + wait: 0, + }, + }, ], - version: '1.2' - } + version: '1.2', + }, }); }); }); diff --git a/packages/insomnia-app/app/plugins/context/__tests__/request.test.js b/packages/insomnia-app/app/plugins/context/__tests__/request.test.js index f9f9c23343..e699bca59b 100644 --- a/packages/insomnia-app/app/plugins/context/__tests__/request.test.js +++ b/packages/insomnia-app/app/plugins/context/__tests__/request.test.js @@ -7,7 +7,7 @@ const CONTEXT = { hello: 'world', array_test: ['a', 'b'], object_test: { a: 'A', b: 'B' }, - null_test: null + null_test: null, }; describe('init()', () => { @@ -17,7 +17,7 @@ describe('init()', () => { await models.request.create({ _id: 'req_1', parentId: 'wrk_1', - name: 'My Request' + name: 'My Request', }); }); @@ -49,7 +49,7 @@ describe('init()', () => { 'settingDisableRenderRequestBody', 'settingEncodeUrl', 'settingSendCookies', - 'settingStoreCookies' + 'settingStoreCookies', ]); }); @@ -69,7 +69,7 @@ describe('init()', () => { 'getParameters', 'getUrl', 'hasHeader', - 'hasParameter' + 'hasParameter', ]); }); @@ -89,9 +89,9 @@ describe('request.*', () => { body: { text: 'body' }, headers: [ { name: 'hello', value: 'world' }, - { name: 'Content-Type', value: 'application/json' } + { name: 'Content-Type', value: 'application/json' }, ], - parameters: [{ name: 'foo', value: 'bar' }, { name: 'message', value: 'Hello World!' }] + parameters: [{ name: 'foo', value: 'bar' }, { name: 'message', value: 'Hello World!' }], }); }); @@ -110,7 +110,7 @@ describe('request.*', () => { // getParameters() expect(result.request.getParameters()).toEqual([ { name: 'foo', value: 'bar' }, - { name: 'message', value: 'Hello World!' } + { name: 'message', value: 'Hello World!' }, ]); // getParameter() @@ -141,7 +141,7 @@ describe('request.*', () => { // getHeaders() expect(result.request.getHeaders()).toEqual([ { name: 'hello', value: 'world' }, - { name: 'Content-Type', value: 'application/json' } + { name: 'Content-Type', value: 'application/json' }, ]); // getHeader() @@ -189,7 +189,7 @@ describe('request.*', () => { hello: 'world', array_test: ['a', 'b'], object_test: { a: 'A', b: 'B' }, - null_test: null + null_test: null, }); // getEnvironmentVariable @@ -198,7 +198,7 @@ describe('request.*', () => { expect(result.request.getEnvironmentVariable('array_test')).toEqual(['a', 'b']); expect(result.request.getEnvironmentVariable('object_test')).toEqual({ a: 'A', - b: 'B' + b: 'B', }); expect(result.request.getEnvironmentVariable('null_test')).toBe(null); expect(result.request.getEnvironmentVariable('bad')).toBeUndefined(); diff --git a/packages/insomnia-app/app/plugins/context/__tests__/response.test.js b/packages/insomnia-app/app/plugins/context/__tests__/response.test.js index 12afaa9f2e..027bb5ce5e 100644 --- a/packages/insomnia-app/app/plugins/context/__tests__/response.test.js +++ b/packages/insomnia-app/app/plugins/context/__tests__/response.test.js @@ -20,7 +20,7 @@ describe('init()', () => { 'getStatusMessage', 'getTime', 'hasHeader', - 'setBody' + 'setBody', ]); }); @@ -42,7 +42,7 @@ describe('response.*', () => { statusCode: 200, statusMessage: 'OK', bytesRead: 123, - elapsedTime: 321 + elapsedTime: 321, }); const result = plugin.init(response); expect(result.response.getRequestId()).toBe('req_1'); @@ -66,8 +66,8 @@ describe('response.*', () => { headers: [ { name: 'content-type', value: 'application/json' }, { name: 'set-cookie', value: 'foo=bar' }, - { name: 'set-cookie', value: 'baz=qux' } - ] + { name: 'set-cookie', value: 'baz=qux' }, + ], }; const result = plugin.init(response); expect(result.response.getHeader('Does-Not-Exist')).toBeNull(); diff --git a/packages/insomnia-app/app/plugins/context/__tests__/store.test.js b/packages/insomnia-app/app/plugins/context/__tests__/store.test.js index dba9a212d1..718cc1ccbf 100644 --- a/packages/insomnia-app/app/plugins/context/__tests__/store.test.js +++ b/packages/insomnia-app/app/plugins/context/__tests__/store.test.js @@ -5,7 +5,7 @@ const PLUGIN = { name: 'my-plugin', version: '1.0.0', directory: '/plugins/my-plugin', - module: {} + module: {}, }; describe('init()', () => { @@ -18,7 +18,7 @@ describe('init()', () => { 'getItem', 'hasItem', 'removeItem', - 'setItem' + 'setItem', ]); }); }); @@ -49,7 +49,7 @@ describe('store.*', () => { expect(all.sort((a, b) => (a.key < b.key ? -1 : 1))).toEqual([ { key: 'a', value: 'aaa' }, { key: 'b', value: 'bbb' }, - { key: 'c', value: 'ccc' } + { key: 'c', value: 'ccc' }, ]); // Clear it diff --git a/packages/insomnia-app/app/plugins/context/app.js b/packages/insomnia-app/app/plugins/context/app.js index 1e2060edb2..f0fce61767 100644 --- a/packages/insomnia-app/app/plugins/context/app.js +++ b/packages/insomnia-app/app/plugins/context/app.js @@ -20,8 +20,8 @@ export function init(renderPurpose: RenderPurpose = RENDER_PURPOSE_GENERAL): { a label?: string, defaultValue?: string, submitName?: string, - cancelable?: boolean - } + cancelable?: boolean, + }, ): Promise { options = options || {}; @@ -38,7 +38,7 @@ export function init(renderPurpose: RenderPurpose = RENDER_PURPOSE_GENERAL): { a }, onComplete(value: string) { resolve(value); - } + }, }); }); }, @@ -59,14 +59,14 @@ export function init(renderPurpose: RenderPurpose = RENDER_PURPOSE_GENERAL): { a const saveOptions = { title: 'Save File', buttonLabel: 'Save', - defaultPath: options.defaultPath + defaultPath: options.defaultPath, }; electron.remote.dialog.showSaveDialog(saveOptions, filename => { resolve(filename || null); }); }); - } - } + }, + }, }; } diff --git a/packages/insomnia-app/app/plugins/context/data.js b/packages/insomnia-app/app/plugins/context/data.js index ef2f5d0c87..a92dee8871 100644 --- a/packages/insomnia-app/app/plugins/context/data.js +++ b/packages/insomnia-app/app/plugins/context/data.js @@ -9,7 +9,7 @@ export function init(): { import: Object, export: Object } { }, async raw(text: string, options: { workspaceId?: string } = {}): Promise { await importRaw(options.workspaceId || null, text); - } + }, }, export: { async insomnia(options: { includePrivate?: boolean } = {}): Promise { @@ -18,7 +18,7 @@ export function init(): { import: Object, export: Object } { }, async har(options: { includePrivate?: boolean } = {}): Promise { return exportHAR(null, options.includePrivate); - } - } + }, + }, }; } diff --git a/packages/insomnia-app/app/plugins/context/request.js b/packages/insomnia-app/app/plugins/context/request.js index 273d1399f9..16f9911626 100644 --- a/packages/insomnia-app/app/plugins/context/request.js +++ b/packages/insomnia-app/app/plugins/context/request.js @@ -5,7 +5,7 @@ import * as misc from '../../common/misc'; export function init( renderedRequest: RenderedRequest, renderedContext: Object, - readOnly: boolean = false + readOnly: boolean = false, ): { request: Object } { if (!renderedRequest) { throw new Error('contexts.request initialized without request'); @@ -69,7 +69,7 @@ export function init( getHeaders(): Array<{ name: string, value: string }> { return renderedRequest.headers.map(h => ({ name: h.name, - value: h.value + value: h.value, })); }, hasHeader(name: string): boolean { @@ -106,7 +106,7 @@ export function init( getParameters(): Array<{ name: string, value: string }> { return renderedRequest.parameters.map(p => ({ name: p.name, - value: p.value + value: p.value, })); }, hasParameter(name: string): boolean { @@ -129,7 +129,7 @@ export function init( if (!parameter) { renderedRequest.parameters.push({ name, value }); } - } + }, // NOTE: For these to make sense, we'd need to account for cookies in the jar as well // addCookie (name: string, value: string): void {} diff --git a/packages/insomnia-app/app/plugins/context/response.js b/packages/insomnia-app/app/plugins/context/response.js index bd22ae8fae..ad4d3f48f3 100644 --- a/packages/insomnia-app/app/plugins/context/response.js +++ b/packages/insomnia-app/app/plugins/context/response.js @@ -12,7 +12,7 @@ type MaybeResponse = { bytesContent?: number, bodyPath?: string, elapsedTime?: number, - headers?: Array + headers?: Array, }; export function init(response: MaybeResponse): { response: Object } { @@ -70,7 +70,7 @@ export function init(response: MaybeResponse): { response: Object } { }, hasHeader(name: string): boolean { return this.getHeader(name) !== null; - } - } + }, + }, }; } diff --git a/packages/insomnia-app/app/plugins/context/store.js b/packages/insomnia-app/app/plugins/context/store.js index 44054548e7..f6f90c7e70 100644 --- a/packages/insomnia-app/app/plugins/context/store.js +++ b/packages/insomnia-app/app/plugins/context/store.js @@ -26,9 +26,9 @@ export function init(plugin: Plugin) { const docs = await models.pluginData.all(plugin.name); return docs.map(d => ({ value: d.value, - key: d.key + key: d.key, })); - } - } + }, + }, }; } diff --git a/packages/insomnia-app/app/plugins/index.js b/packages/insomnia-app/app/plugins/index.js index fd0221560f..80de0dee7e 100644 --- a/packages/insomnia-app/app/plugins/index.js +++ b/packages/insomnia-app/app/plugins/index.js @@ -14,27 +14,27 @@ export type Plugin = { description: string, version: string, directory: string, - module: * + module: *, }; export type TemplateTag = { plugin: Plugin, - templateTag: PluginTemplateTag + templateTag: PluginTemplateTag, }; export type RequestHook = { plugin: Plugin, - hook: Function + hook: Function, }; export type ResponseHook = { plugin: Plugin, - hook: Function + hook: Function, }; export type Theme = { plugin: Plugin, - theme: PluginTheme + theme: PluginTheme, }; const CORE_PLUGINS = [ @@ -48,7 +48,7 @@ const CORE_PLUGINS = [ 'insomnia-plugin-response', 'insomnia-plugin-jsonpath', 'insomnia-plugin-cookie-jar', - 'insomnia-plugin-core-themes' + 'insomnia-plugin-core-themes', ]; let plugins: ?Array = null; @@ -108,7 +108,7 @@ async function _traversePluginPath(pluginMap: Object, allPaths: Array) { showError({ title: 'Plugin Error', message: 'Failed to load plugin ' + filename, - error: err + error: err, }); } } @@ -203,6 +203,6 @@ function _initPlugin(packageJSON: Object, module: any, path: ?string): Plugin { description: packageJSON.description || meta.description || '', version: packageJSON.version || 'unknown', directory: path || '', - module: module + module: module, }; } diff --git a/packages/insomnia-app/app/plugins/install.js b/packages/insomnia-app/app/plugins/install.js index c3bd3faba1..6d001904dc 100644 --- a/packages/insomnia-app/app/plugins/install.js +++ b/packages/insomnia-app/app/plugins/install.js @@ -32,7 +32,7 @@ export default async function(lookupName: string): Promise { // Move entire module to plugins folder fsx.moveSync(path.join(tmpDir, moduleName), pluginDir, { - overwrite: true + overwrite: true, }); // Move each dependency into node_modules folder @@ -66,7 +66,7 @@ async function _isInsomniaPlugin(lookupName: string): Promise { _getYarnPath(), 'info', lookupName, - '--json' + '--json', ], { timeout: 5 * 60 * 1000, @@ -74,8 +74,8 @@ async function _isInsomniaPlugin(lookupName: string): Promise { shell: true, env: { NODE_ENV: 'production', - ELECTRON_RUN_AS_NODE: 'true' - } + ELECTRON_RUN_AS_NODE: 'true', + }, }, (err, stdout, stderr) => { if (err) { @@ -110,10 +110,10 @@ async function _isInsomniaPlugin(lookupName: string): Promise { version: data.version, dist: { shasum: data.dist.shasum, - tarball: data.dist.tarball - } + tarball: data.dist.tarball, + }, }); - } + }, ); }); } @@ -136,7 +136,7 @@ async function _installPluginToTmpDir(lookupName: string): Promise<{ tmpDir: str tmpDir, '--no-lockfile', '--production', - '--no-progress' + '--no-progress', ], { timeout: 5 * 60 * 1000, @@ -145,8 +145,8 @@ async function _installPluginToTmpDir(lookupName: string): Promise<{ tmpDir: str shell: true, // Some package installs require a shell env: { NODE_ENV: 'production', - ELECTRON_RUN_AS_NODE: 'true' - } + ELECTRON_RUN_AS_NODE: 'true', + }, }, (err, stdout, stderr) => { if (err) { @@ -160,7 +160,7 @@ async function _installPluginToTmpDir(lookupName: string): Promise<{ tmpDir: str } resolve({ tmpDir }); - } + }, ); }); } diff --git a/packages/insomnia-app/app/plugins/misc.js b/packages/insomnia-app/app/plugins/misc.js index 7a854fe6ca..f0569b964b 100644 --- a/packages/insomnia-app/app/plugins/misc.js +++ b/packages/insomnia-app/app/plugins/misc.js @@ -11,7 +11,7 @@ type ThemeBlock = { warning?: string, danger?: string, surprise?: string, - info?: string + info?: string, }, foreground?: { default: string, @@ -20,7 +20,7 @@ type ThemeBlock = { warning?: string, danger?: string, surprise?: string, - info?: string + info?: string, }, highlight?: { default: string, @@ -29,8 +29,8 @@ type ThemeBlock = { sm?: string, md?: string, lg?: string, - xl?: string - } + xl?: string, + }, }; type ThemeInner = { @@ -50,14 +50,14 @@ type ThemeInner = { dialogHeader?: ThemeBlock, dialogFooter?: ThemeBlock, transparentOverlay?: ThemeBlock, - link?: ThemeBlock - } + link?: ThemeBlock, + }, }; export type PluginTheme = { name: string, displayName: string, - theme: ThemeInner + theme: ThemeInner, }; export async function generateThemeCSS(theme: PluginTheme): Promise { @@ -66,7 +66,7 @@ export async function generateThemeCSS(theme: PluginTheme): Promise { theme.theme, null, THROW_ON_ERROR, - theme.name + theme.name, ); const n = theme.name; @@ -88,7 +88,7 @@ export async function generateThemeCSS(theme: PluginTheme): Promise { css += wrapStyles( n, '.theme--transparent-overlay', - getThemeBlockCSS(styles.transparentOverlay) + getThemeBlockCSS(styles.transparentOverlay), ); // Dialogs @@ -191,7 +191,7 @@ function wrapStyles(theme: string, selector: string, styles: string) { styles, '}', '', - '' + '', ].join('\n'); } diff --git a/packages/insomnia-app/app/sync/__tests__/crypt.test.js b/packages/insomnia-app/app/sync/__tests__/crypt.test.js index c3f36b18ad..181cf5fe26 100644 --- a/packages/insomnia-app/app/sync/__tests__/crypt.test.js +++ b/packages/insomnia-app/app/sync/__tests__/crypt.test.js @@ -22,7 +22,7 @@ describe('encryptRSA', () => { ad: '6164646974696f6e616c2064617461', d: '48656c6c6f253230576f726c6421', iv: '616161616161616161616161', - t: '746167' + t: '746167', }; const expectedDecrypted = 'Hello World!'; diff --git a/packages/insomnia-app/app/sync/__tests__/sync.test.js b/packages/insomnia-app/app/sync/__tests__/sync.test.js index 7f10df4194..f1780c30b8 100644 --- a/packages/insomnia-app/app/sync/__tests__/sync.test.js +++ b/packages/insomnia-app/app/sync/__tests__/sync.test.js @@ -25,12 +25,12 @@ describe('Test push/pull behaviour', () => { await models.request.create({ _id: 'req_1', name: 'Request 1', - parentId: 'wrk_1' + parentId: 'wrk_1', }); await models.request.create({ _id: 'req_2', name: 'Request 2', - parentId: 'wrk_2' + parentId: 'wrk_2', }); // Create resources, resource groups, and configs @@ -49,10 +49,10 @@ describe('Test push/pull behaviour', () => { // Set up sync modes await sync.createOrUpdateConfig(resourceRequest.resourceGroupId, { - syncMode: syncStorage.SYNC_MODE_ON + syncMode: syncStorage.SYNC_MODE_ON, }); await sync.createOrUpdateConfig(resourceRequest2.resourceGroupId, { - syncMode: syncStorage.SYNC_MODE_UNSET + syncMode: syncStorage.SYNC_MODE_UNSET, }); await sync.push(); // Push only active configs @@ -75,14 +75,14 @@ describe('Test push/pull behaviour', () => { const request = await models.request.getById('req_1'); const resourceRequest = await syncStorage.getResourceByDocId(request._id); await sync.createOrUpdateConfig(resourceRequest.resourceGroupId, { - syncMode: syncStorage.SYNC_MODE_ON + syncMode: syncStorage.SYNC_MODE_ON, }); session.syncPush.mockReturnValueOnce({ updated: [], created: [{ id: request._id, version: 'new-version' }], removed: [], - conflicts: [] + conflicts: [], }); const resourceBefore = await syncStorage.getResourceByDocId(request._id); @@ -102,31 +102,31 @@ describe('Test push/pull behaviour', () => { const request2 = await models.request.getById('req_2'); const requestNew = Object.assign({}, request, { _id: 'req_new', - name: 'New Request' + name: 'New Request', }); const resourceBefore = await syncStorage.getResourceByDocId(request._id); const resource2Before = await syncStorage.getResourceByDocId(requestNew._id); await sync.createOrUpdateConfig(resourceBefore.resourceGroupId, { - syncMode: syncStorage.SYNC_MODE_ON + syncMode: syncStorage.SYNC_MODE_ON, }); const updatedRequest = Object.assign({}, request, { - name: 'Request Updated' + name: 'Request Updated', }); const updatedResource = Object.assign({}, resourceBefore, { version: 'ver1', - encContent: await sync.encryptDoc(resourceBefore.resourceGroupId, updatedRequest) + encContent: await sync.encryptDoc(resourceBefore.resourceGroupId, updatedRequest), }); const createdResourceNew = Object.assign({}, resourceBefore, { id: requestNew._id, resourceGroupId: 'rg_1', - encContent: await sync.encryptDoc(resourceBefore.resourceGroupId, requestNew) + encContent: await sync.encryptDoc(resourceBefore.resourceGroupId, requestNew), }); session.syncPull.mockReturnValueOnce({ updatedResources: [updatedResource], createdResources: [createdResourceNew], idsToPush: [], - idsToRemove: ['req_2'] + idsToRemove: ['req_2'], }); // Pull and get docs/resources @@ -136,7 +136,7 @@ describe('Test push/pull behaviour', () => { const requestNewAfter = await models.request.getById('req_new'); const resourceAfter = await syncStorage.getResourceByDocId( request._id, - resourceBefore.resourceGroupId + resourceBefore.resourceGroupId, ); const resource2After = await syncStorage.getResourceByDocId(request2._id); const resourceNewAfter = await syncStorage.getResourceByDocId(requestNewAfter._id); @@ -156,26 +156,26 @@ describe('Test push/pull behaviour', () => { it('Conflict: local version wins on modified before', async () => { const requestClient = await models.request.getById('req_1'); const requestServer = Object.assign({}, requestClient, { - name: 'Server Request' + name: 'Server Request', }); const resourceRequest = await syncStorage.getResourceByDocId(requestClient._id); const resourceConflict = Object.assign({}, resourceRequest, { version: 'ver-2', encContent: await sync.encryptDoc(resourceRequest.resourceGroupId, requestServer), - lastEdited: resourceRequest.lastEdited - 1000 // Same edited time + lastEdited: resourceRequest.lastEdited - 1000, // Same edited time }); session.syncPush.mockReturnValueOnce({ updated: [], created: [], removed: [], - conflicts: [resourceConflict] + conflicts: [resourceConflict], }); await sync.push(resourceRequest.resourceGroupId); const resourceAfter = await syncStorage.getResourceByDocId( requestClient._id, - resourceRequest.resourceGroupId + resourceRequest.resourceGroupId, ); const requestAfter = await models.request.getById(requestClient._id); @@ -193,26 +193,26 @@ describe('Test push/pull behaviour', () => { it('Conflict: local version wins on modified tie', async () => { const requestClient = await models.request.getById('req_1'); const requestServer = Object.assign({}, requestClient, { - name: 'Server Request' + name: 'Server Request', }); const resourceRequest = await syncStorage.getResourceByDocId(requestClient._id); const resourceConflict = Object.assign({}, resourceRequest, { version: 'ver-2', encContent: await sync.encryptDoc(resourceRequest.resourceGroupId, requestServer), - lastEdited: resourceRequest.lastEdited // Same edited time + lastEdited: resourceRequest.lastEdited, // Same edited time }); session.syncPush.mockReturnValueOnce({ updated: [], created: [], removed: [], - conflicts: [resourceConflict] + conflicts: [resourceConflict], }); await sync.push(resourceRequest.resourceGroupId); const resourceAfter = await syncStorage.getResourceByDocId( requestClient._id, - resourceRequest.resourceGroupId + resourceRequest.resourceGroupId, ); const requestAfter = await models.request.getById(requestClient._id); @@ -230,26 +230,26 @@ describe('Test push/pull behaviour', () => { it('Conflict: server version wins if modified after', async () => { const requestClient = await models.request.getById('req_1'); const requestServer = Object.assign({}, requestClient, { - name: 'Server Request' + name: 'Server Request', }); const resourceRequest = await syncStorage.getResourceByDocId(requestClient._id); const resourceConflict = Object.assign({}, resourceRequest, { version: 'ver-2', encContent: await sync.encryptDoc(resourceRequest.resourceGroupId, requestServer), - lastEdited: resourceRequest.lastEdited + 1000 + lastEdited: resourceRequest.lastEdited + 1000, }); session.syncPush.mockReturnValueOnce({ updated: [], created: [], removed: [], - conflicts: [resourceConflict] + conflicts: [resourceConflict], }); await sync.push(resourceRequest.resourceGroupId); const resourceAfter = await syncStorage.getResourceByDocId( requestClient._id, - resourceRequest.resourceGroupId + resourceRequest.resourceGroupId, ); const requestAfter = await models.request.getById(requestClient._id); @@ -284,29 +284,29 @@ describe('Integration tests for creating Resources and pushing', () => { // Add some data await models.workspace.create({ _id: 'wrk_empty', - name: 'Workspace Empty' + name: 'Workspace Empty', }); await models.workspace.create({ _id: 'wrk_1', name: 'Workspace 1' }); await models.request.create({ _id: 'req_1', name: 'Request 1', - parentId: 'wrk_1' + parentId: 'wrk_1', }); await models.request.create({ _id: 'req_2', name: 'Request 2', - parentId: 'wrk_1' + parentId: 'wrk_1', }); await models.request.create({ _id: 'req_3', name: 'Request 3', - parentId: 'wrk_1' + parentId: 'wrk_1', }); await models.environment.create({ _id: 'env_2', name: 'Env Prv', parentId: 'wrk_1', - isPrivate: true + isPrivate: true, }); // Flush changes just to be sure they won't affect our tests @@ -332,7 +332,7 @@ describe('Integration tests for creating Resources and pushing', () => { const configs = await syncStorage.allConfigs(); for (const config of configs) { await syncStorage.updateConfig(config, { - syncMode: syncStorage.SYNC_MODE_ON + syncMode: syncStorage.SYNC_MODE_ON, }); } @@ -349,7 +349,7 @@ describe('Integration tests for creating Resources and pushing', () => { await models.request.create({ _id: 'req_t', url: 'https://google.com', - parentId: 'wrk_1' + parentId: 'wrk_1', }); await db.flushChanges(); @@ -377,7 +377,7 @@ describe('Integration tests for creating Resources and pushing', () => { const request = await models.request.create({ _id: 'req_t', name: 'Original Request', - parentId: 'wrk_1' + parentId: 'wrk_1', }); await db.flushChanges(); await sync.writePendingChanges(); @@ -386,7 +386,7 @@ describe('Integration tests for creating Resources and pushing', () => { // Mark resource as removed const originalResource = await syncStorage.getResourceByDocId('req_t'); const updatedResource = await syncStorage.updateResource(originalResource, { - removed: true + removed: true, }); // Update it and push it again @@ -409,7 +409,7 @@ describe('Integration tests for creating Resources and pushing', () => { const resource = await syncStorage.getResourceByDocId(request._id); await db.bufferChanges(); const updatedRequest = await models.request.update(request, { - name: 'New Name' + name: 'New Name', }); // Drain and fetch new resource @@ -472,7 +472,7 @@ async function _setSessionData() { ext: true, k: '3-QU2OcQcpSyFIoL8idgclbImP3M8Y2d0oVAca3Vl4g', key_ops: ['encrypt', 'decrypt'], - kty: 'oct' + kty: 'oct', }; const publicKey = { @@ -481,7 +481,7 @@ async function _setSessionData() { ext: true, key_ops: ['encrypt'], kty: 'RSA', - n: 'aaaa' + n: 'aaaa', }; const { privateKey } = await crypt.generateKeyPairJWK(); @@ -489,7 +489,7 @@ async function _setSessionData() { ad: '', d: Buffer.from(JSON.stringify(privateKey)).toString('hex'), iv: '968f1d810efdaec58f9e313e', - t: '0e87a2e57a198ca79cb99585fe9c244a' + t: '0e87a2e57a198ca79cb99585fe9c244a', }; // Setup mocks and stuff @@ -501,7 +501,7 @@ async function _setSessionData() { 'gschier1990@gmail.com', symmetricKey, publicKey, - encPrivateKey + encPrivateKey, ); } @@ -524,8 +524,8 @@ async function _setupSessionMocks() { { parentResourceId: parentId, name: name, - encSymmetricKey: encSymmetricKey - } + encSymmetricKey: encSymmetricKey, + }, ); return resourceGroups[id]; }); @@ -544,13 +544,13 @@ async function _setupSessionMocks() { updatedResources: [], createdResources: [], idsToPush: [], - idsToRemove: [] + idsToRemove: [], })); session.syncPush = jest.fn(body => ({ conflicts: [], updated: [], created: [], - removed: [] + removed: [], })); } diff --git a/packages/insomnia-app/app/sync/crypt.js b/packages/insomnia-app/app/sync/crypt.js index 87650a69d4..91451068d4 100644 --- a/packages/insomnia-app/app/sync/crypt.js +++ b/packages/insomnia-app/app/sync/crypt.js @@ -40,7 +40,7 @@ export function encryptRSAWithJWK(publicKeyJWK, plaintext) { const publicKey = forge.rsa.setPublicKey(n, e); const encrypted = publicKey.encrypt(encodedPlaintext, 'RSA-OAEP', { - md: forge.md.sha256.create() + md: forge.md.sha256.create(), }); return forge.util.bytesToHex(encrypted); } @@ -58,7 +58,7 @@ export function decryptRSAWithJWK(privateJWK, encryptedBlob) { const privateKey = forge.rsa.setPrivateKey(n, e, d, p, q, dP, dQ, qInv); const bytes = forge.util.hexToBytes(encryptedBlob); const decrypted = privateKey.decrypt(bytes, 'RSA-OAEP', { - md: forge.md.sha256.create() + md: forge.md.sha256.create(), }); return decodeURIComponent(decrypted); @@ -96,7 +96,7 @@ export function encryptAES(jwkOrKey, plaintext, additionalData = '') { iv: forge.util.bytesToHex(iv), t: forge.util.bytesToHex(cipher.mode.tag), d: forge.util.bytesToHex(cipher.output), - ad: forge.util.bytesToHex(additionalData) + ad: forge.util.bytesToHex(additionalData), }; } @@ -121,7 +121,7 @@ export function decryptAES(jwkOrKey, message) { iv: forge.util.hexToBytes(message.iv), tagLength: message.t.length * 4, tag: forge.util.hexToBytes(message.t), - additionalData: forge.util.hexToBytes(message.ad) + additionalData: forge.util.hexToBytes(message.ad), }); decipher.update(forge.util.createBuffer(forge.util.hexToBytes(message.d))); @@ -179,7 +179,7 @@ export async function generateAES256Key() { console.log('[crypt] Using Native AES Key Generation'); const key = await subtle.generateKey({ name: 'AES-GCM', length: 256 }, true, [ 'encrypt', - 'decrypt' + 'decrypt', ]); return subtle.exportKey('jwk', key); } else { @@ -190,7 +190,7 @@ export async function generateAES256Key() { alg: 'A256GCM', ext: true, key_ops: ['encrypt', 'decrypt'], - k: _hexToB64Url(key) + k: _hexToB64Url(key), }; } } @@ -212,15 +212,15 @@ export async function generateKeyPairJWK() { name: 'RSA-OAEP', publicExponent: new Uint8Array([1, 0, 1]), modulusLength: 2048, - hash: 'SHA-256' + hash: 'SHA-256', }, true, - ['encrypt', 'decrypt'] + ['encrypt', 'decrypt'], ); return { publicKey: await subtle.exportKey('jwk', pair.publicKey), - privateKey: await subtle.exportKey('jwk', pair.privateKey) + privateKey: await subtle.exportKey('jwk', pair.privateKey), }; } else { console.log('[crypt] Using Forge RSA Generation'); @@ -238,7 +238,7 @@ export async function generateKeyPairJWK() { n: _bigIntToB64Url(pair.privateKey.n), p: _bigIntToB64Url(pair.privateKey.p), q: _bigIntToB64Url(pair.privateKey.q), - qi: _bigIntToB64Url(pair.privateKey.qInv) + qi: _bigIntToB64Url(pair.privateKey.qInv), }; const publicKey = { @@ -246,7 +246,7 @@ export async function generateKeyPairJWK() { kty: 'RSA', key_ops: ['encrypt'], e: _bigIntToB64Url(pair.publicKey.e), - n: _bigIntToB64Url(pair.publicKey.n) + n: _bigIntToB64Url(pair.publicKey.n), }; return { privateKey, publicKey }; @@ -315,14 +315,14 @@ async function _pbkdf2Passphrase(passphrase, salt) { Buffer.from(passphrase, 'utf8'), { name: 'PBKDF2' }, false, - ['deriveBits'] + ['deriveBits'], ); const algo = { name: 'PBKDF2', salt: Buffer.from(salt, 'hex'), iterations: DEFAULT_PBKDF2_ITERATIONS, - hash: 'SHA-256' + hash: 'SHA-256', }; const derivedKeyRaw = await window.crypto.subtle.deriveBits(algo, k, DEFAULT_BYTE_LENGTH * 8); @@ -334,7 +334,7 @@ async function _pbkdf2Passphrase(passphrase, salt) { forge.util.hexToBytes(salt), DEFAULT_PBKDF2_ITERATIONS, DEFAULT_BYTE_LENGTH, - forge.md.sha256.create() + forge.md.sha256.create(), ); return forge.util.bytesToHex(derivedKeyRaw); diff --git a/packages/insomnia-app/app/sync/index.js b/packages/insomnia-app/app/sync/index.js index db9ffb682b..c30a8e6e1b 100644 --- a/packages/insomnia-app/app/sync/index.js +++ b/packages/insomnia-app/app/sync/index.js @@ -19,7 +19,7 @@ const WHITE_LIST = { // These can be overridden in sync config [models.cookieJar.type]: true, - [models.clientCertificate.type]: true + [models.clientCertificate.type]: true, }; export const logger = new Logger(); @@ -43,7 +43,7 @@ export async function init() { db.onChange(async changes => { // To help prevent bugs, put Workspaces first const sortedChanges = changes.sort( - ([event, doc, fromSync]) => (doc.type === models.workspace.type ? 1 : -1) + ([event, doc, fromSync]) => (doc.type === models.workspace.type ? 1 : -1), ); for (const [event, doc, fromSync] of sortedChanges) { @@ -263,7 +263,7 @@ export async function push(resourceGroupId = null) { for (const serverResource of conflicts) { const localResource = await store.getResourceByDocId( serverResource.id, - serverResource.resourceGroupId + serverResource.resourceGroupId, ); // On conflict, choose last edited one @@ -274,7 +274,7 @@ export async function push(resourceGroupId = null) { // NOTE: using localResource as the base to make sure we have _id await store.updateResource(localResource, winner, { version: serverResource.version, // Act as the server resource no matter what - dirty: !serverIsNewer // It's dirty if we chose the local doc + dirty: !serverIsNewer, // It's dirty if we chose the local doc }); // Decrypt the docs from the resources. Don't fetch the local doc from the @@ -327,14 +327,14 @@ export async function pull(resourceGroupId = null, createMissingResources = true id: r.id, resourceGroupId: r.resourceGroupId, version: r.version, - removed: r.removed + removed: r.removed, })); const blacklistedResourceGroupIds = blacklistedConfigs.map(c => c.resourceGroupId); const body = { resources, - blacklist: blacklistedResourceGroupIds + blacklist: blacklistedResourceGroupIds, }; logger.debug(`Pulling with ${resources.length} resources`); @@ -431,7 +431,7 @@ export async function pull(resourceGroupId = null, createMissingResources = true // Update local resource const resource = await store.getResourceByDocId( serverResource.id, - serverResource.resourceGroupId + serverResource.resourceGroupId, ); await store.updateResource(resource, serverResource, { dirty: false }); } catch (e) { @@ -554,7 +554,7 @@ async function _handleChangeAndPush(event, doc, timestamp) { lastEditedBy: session.getAccountId(), encContent: await encryptDoc(resource.resourceGroupId, doc), removed: event === db.CHANGE_REMOVE, - dirty: true + dirty: true, }); // Debounce pushing of dirty resources @@ -643,7 +643,7 @@ async function _getResourceGroupSymmetricKey(resourceGroupId) { const symmetricKeyStr = crypt.decryptRSAWithJWK( accountPrivateKey, - resourceGroup.encSymmetricKey + resourceGroup.encSymmetricKey, ); key = JSON.parse(symmetricKeyStr); @@ -741,7 +741,7 @@ export async function createResource(doc, resourceGroupId) { removed: false, type: doc.type, encContent: await encryptDoc(resourceGroupId, doc), - dirty: true + dirty: true, }); } @@ -803,7 +803,7 @@ export async function getOrCreateAllActiveResources(resourceGroupId = null) { // Make sure Workspace is first, because the loop below depends on it const modelTypes = Object.keys(WHITE_LIST).sort( - (a, b) => (a.type === models.workspace.type ? 1 : -1) + (a, b) => (a.type === models.workspace.type ? 1 : -1), ); let created = 0; diff --git a/packages/insomnia-app/app/sync/session.js b/packages/insomnia-app/app/sync/session.js index 52344ebfd4..88b06db8ae 100644 --- a/packages/insomnia-app/app/sync/session.js +++ b/packages/insomnia-app/app/sync/session.js @@ -23,12 +23,12 @@ export async function login(rawEmail, rawPassphrase) { Buffer.from(saltAuth, 'hex'), Buffer.from(email, 'utf8'), Buffer.from(authSecret, 'hex'), - Buffer.from(secret1, 'hex') + Buffer.from(secret1, 'hex'), ); const srpA = c.computeA().toString('hex'); const { sessionStarterId, srpB } = await util.post('/auth/login-a', { srpA, - email + email, }); // ~~~~~~~~~~~~~~~~~~~~~ // @@ -39,7 +39,7 @@ export async function login(rawEmail, rawPassphrase) { const srpM1 = c.computeM1().toString('hex'); const { srpM2 } = await util.post('/auth/login-m1', { srpM1, - sessionStarterId + sessionStarterId, }); // ~~~~~~~~~~~~~~~~~~~~~~~~~ // @@ -63,7 +63,7 @@ export async function login(rawEmail, rawPassphrase) { saltEnc, accountId, firstName, - lastName + lastName, } = await whoami(sessionId); const derivedSymmetricKey = await crypt.deriveKey(passphrase, email, saltEnc); @@ -78,7 +78,7 @@ export async function login(rawEmail, rawPassphrase) { email, JSON.parse(symmetricKeyStr), JSON.parse(publicKey), - JSON.parse(encPrivateKey) + JSON.parse(encPrivateKey), ); } @@ -86,7 +86,7 @@ export function syncCreateResourceGroup(parentResourceId, name, encSymmetricKey) return util.post('/api/resource_groups', { parentResourceId, name, - encSymmetricKey + encSymmetricKey, }); } @@ -117,7 +117,7 @@ export function unshareWithAllTeams(resourceGroupId) { export async function shareWithTeam(resourceGroupId, teamId, rawPassphrase) { // Ask the server what we need to do to invite the member const instructions = await util.post(`/api/resource_groups/${resourceGroupId}/share-a`, { - teamId + teamId, }); // Compute keys necessary to invite the member @@ -134,7 +134,7 @@ export async function shareWithTeam(resourceGroupId, teamId, rawPassphrase) { const privateKeyJWK = JSON.parse(privateKey); const resourceGroupSymmetricKey = crypt.decryptRSAWithJWK( privateKeyJWK, - instructions.encSymmetricKey + instructions.encSymmetricKey, ); // Build the invite data request @@ -147,7 +147,7 @@ export async function shareWithTeam(resourceGroupId, teamId, rawPassphrase) { // Actually share it with the team await util.post(`/api/resource_groups/${resourceGroupId}/share-b`, { teamId, - keys: newKeys + keys: newKeys, }); } @@ -209,7 +209,7 @@ export function setSessionData( email, symmetricKey, publicKey, - encPrivateKey + encPrivateKey, ) { const dataStr = JSON.stringify({ id: sessionId, @@ -219,7 +219,7 @@ export function setSessionData( encPrivateKey: encPrivateKey, email: email, firstName: firstName, - lastName: lastName + lastName: lastName, }); window.localStorage.setItem(getSessionKey(sessionId), dataStr); diff --git a/packages/insomnia-app/app/sync/storage.js b/packages/insomnia-app/app/sync/storage.js index 4cef287f87..386cf48740 100644 --- a/packages/insomnia-app/app/sync/storage.js +++ b/packages/insomnia-app/app/sync/storage.js @@ -112,7 +112,7 @@ export async function insertResource(resource) { h.update(resource.resourceGroupId); h.update(resource.id); const newResource = Object.assign({}, resource, { - _id: `rs_${h.digest('hex')}` + _id: `rs_${h.digest('hex')}`, }); await _execDB(TYPE_RESOURCE, 'insert', newResource); _notifyChange(); @@ -122,7 +122,7 @@ export async function insertResource(resource) { export async function updateResource(resource, ...patches) { const newDoc = Object.assign({}, resource, ...patches); await _execDB(TYPE_RESOURCE, 'update', { _id: resource._id }, newDoc, { - multi: true + multi: true, }); _notifyChange(); return newDoc; @@ -148,7 +148,7 @@ export function allConfigs() { export function findInactiveConfigs(excludedResourceGroupId = null) { if (excludedResourceGroupId) { return findConfigs({ - $not: { syncMode: SYNC_MODE_ON, excludedResourceGroupId } + $not: { syncMode: SYNC_MODE_ON, excludedResourceGroupId }, }); } else { return findConfigs({ $not: { syncMode: SYNC_MODE_ON } }); @@ -189,9 +189,9 @@ function _initConfig(data) { { _id: util.generateId('scf'), syncMode: SYNC_MODE_UNSET, - resourceGroupId: null + resourceGroupId: null, }, - data + data, ); } @@ -206,7 +206,7 @@ export function initDB(config, forceReset) { // Fill in the defaults _database['Resource'] = new NeDB( - Object.assign({ filename: resourcePath, autoload: true }, config) + Object.assign({ filename: resourcePath, autoload: true }, config), ); _database['Config'] = new NeDB(Object.assign({ filename: configPath, autoload: true }, config)); diff --git a/packages/insomnia-app/app/templating/__tests__/utils.test.js b/packages/insomnia-app/app/templating/__tests__/utils.test.js index 02d2e052d4..ed1f51bb0a 100644 --- a/packages/insomnia-app/app/templating/__tests__/utils.test.js +++ b/packages/insomnia-app/app/templating/__tests__/utils.test.js @@ -10,7 +10,7 @@ describe('getKeys()', () => { null: null, undefined: undefined, false: false, - array: ['hello', { hi: 'there' }, true, ['x', 'y', 'z']] + array: ['hello', { hi: 'there' }, true, ['x', 'y', 'z']], }; const keys = utils.getKeys(obj).sort((a, b) => (a.name > b.name ? 1 : -1)); @@ -25,7 +25,7 @@ describe('getKeys()', () => { { name: 'false', value: obj.false }, { name: 'foo', value: obj.foo }, { name: 'null', value: obj.null }, - { name: 'undefined', value: obj.undefined } + { name: 'undefined', value: obj.undefined }, ]); }); @@ -34,7 +34,7 @@ describe('getKeys()', () => { foo: 'bar', toString: function() { // Nothing - } + }, }; const keys = utils.getKeys(obj); @@ -52,8 +52,8 @@ describe('tokenizeTag()', () => { args: [ { type: 'variable', value: 'bar' }, { type: 'string', value: 'baz "qux"', quotedBy: '"' }, - { type: 'expression', value: '1 + 5 | default("foo")' } - ] + { type: 'expression', value: '1 + 5 | default("foo")' }, + ], }; expect(actual).toEqual(expected); @@ -65,7 +65,7 @@ describe('tokenizeTag()', () => { const expected = { name: 'name', - args: [{ type: 'string', value: 'foo', quotedBy: "'" }, { type: 'variable', value: 'bar' }] + args: [{ type: 'string', value: 'foo', quotedBy: "'" }, { type: 'variable', value: 'bar' }], }; expect(minimal).toEqual(expected); @@ -77,7 +77,7 @@ describe('tokenizeTag()', () => { const expected = { name: 'name', - args: [{ type: 'string', value: 'foo', quotedBy: "'" }] + args: [{ type: 'string', value: 'foo', quotedBy: "'" }], }; expect(actual).toEqual(expected); @@ -91,8 +91,8 @@ describe('tokenizeTag()', () => { args: [ { type: 'number', value: '9.324' }, { type: 'number', value: '8' }, - { type: 'number', value: '7' } - ] + { type: 'number', value: '7' }, + ], }; expect(actual).toEqual(expected); @@ -103,7 +103,7 @@ describe('tokenizeTag()', () => { const expected = { name: 'name', - args: [{ type: 'boolean', value: true }, { type: 'boolean', value: false }] + args: [{ type: 'boolean', value: true }, { type: 'boolean', value: false }], }; expect(actual).toEqual(expected); @@ -114,7 +114,7 @@ describe('tokenizeTag()', () => { const expected = { name: 'name', - args: [{ type: 'expression', value: `5 * 10 + 'hello' | default(2 - 3)` }] + args: [{ type: 'expression', value: `5 * 10 + 'hello' | default(2 - 3)` }], }; expect(actual).toEqual(expected); @@ -129,7 +129,7 @@ describe('tokenizeTag()', () => { const expected = { name: 'name', - args: [{ type: 'expression', value: 'foo bar baz' }] + args: [{ type: 'expression', value: 'foo bar baz' }], }; expect(actual).toEqual(expected); @@ -150,7 +150,7 @@ describe('unTokenizeTag()', () => { it('fixes missing quotedBy attribute', () => { const tagData = { name: 'name', - args: [{ type: 'file', value: 'foo/bar/baz' }, { type: 'model', value: 'foo' }] + args: [{ type: 'file', value: 'foo/bar/baz' }, { type: 'model', value: 'foo' }], }; const result = utils.unTokenizeTag(tagData); diff --git a/packages/insomnia-app/app/templating/base-extension.js b/packages/insomnia-app/app/templating/base-extension.js index 9ef12c39f5..f223e21ec5 100644 --- a/packages/insomnia-app/app/templating/base-extension.js +++ b/packages/insomnia-app/app/templating/base-extension.js @@ -83,24 +83,24 @@ export default class BaseExtension { getAncestors: async request => { const ancestors = await db.withAncestors(request, [ models.requestGroup.type, - models.workspace.type + models.workspace.type, ]); return ancestors.filter(doc => doc._id !== request._id); - } + }, }, workspace: { getById: models.workspace.getById }, oAuth2Token: { getByRequestId: models.oAuth2Token.getByParentId }, cookieJar: { getOrCreateForWorkspace: workspace => { return models.cookieJar.getOrCreateForParentId(workspace._id); - } + }, }, response: { getLatestForRequestId: models.response.getLatestForRequest, - getBodyBuffer: models.response.getBodyBuffer - } - } - } + getBodyBuffer: models.response.getBodyBuffer, + }, + }, + }, }; let result; diff --git a/packages/insomnia-app/app/templating/extensions/index.js b/packages/insomnia-app/app/templating/extensions/index.js index 3beee1b881..b1febcf52f 100644 --- a/packages/insomnia-app/app/templating/extensions/index.js +++ b/packages/insomnia-app/app/templating/extensions/index.js @@ -10,47 +10,47 @@ type PluginArgumentBase = { displayName: DisplayName, description?: string, help?: string, - hide?: (args: Array) => boolean + hide?: (args: Array) => boolean, }; export type PluginArgumentEnumOption = { displayName: DisplayName, value: PluginArgumentValue, description?: string, - placeholder?: string + placeholder?: string, }; export type PluginArgumentEnum = PluginArgumentBase & { type: 'enum', options: Array, - defaultValue?: PluginArgumentValue + defaultValue?: PluginArgumentValue, }; export type PluginArgumentModel = PluginArgumentBase & { type: 'model', model: string, - defaultValue?: string + defaultValue?: string, }; export type PluginArgumentString = PluginArgumentBase & { type: 'string', placeholder?: string, - defaultValue?: string + defaultValue?: string, }; export type PluginArgumentBoolean = PluginArgumentBase & { type: 'boolean', - defaultValue?: boolean + defaultValue?: boolean, }; export type PluginArgumentFile = PluginArgumentBase & { - type: 'file' + type: 'file', }; export type PluginArgumentNumber = PluginArgumentBase & { type: 'number', placeholder?: string, - defaultValue?: number + defaultValue?: number, }; export type PluginArgument = @@ -65,14 +65,14 @@ export type PluginTemplateTagContext = { util: { models: { request: { - getById: (id: string) => Promise + getById: (id: string) => Promise, }, response: { getLatestForRequestId: (id: string) => Promise, - getBodyBuffer: (response: Response, fallback?: any) => Promise - } - } - } + getBodyBuffer: (response: Response, fallback?: any) => Promise, + }, + }, + }, }; export type PluginTemplateTag = { @@ -83,5 +83,5 @@ export type PluginTemplateTag = { run: (context: PluginTemplateTagContext, ...arg: Array) => Promise | any, deprecated?: boolean, validate?: (value: any) => ?string, - priority?: number + priority?: number, }; diff --git a/packages/insomnia-app/app/templating/index.js b/packages/insomnia-app/app/templating/index.js index 6ecbcad926..482c178734 100644 --- a/packages/insomnia-app/app/templating/index.js +++ b/packages/insomnia-app/app/templating/index.js @@ -32,7 +32,7 @@ let nunjucksAll = null; */ export function render( text: string, - config: { context?: Object, path?: string, renderMode?: string } = {} + config: { context?: Object, path?: string, renderMode?: string } = {}, ): Promise { const context = config.context || {}; const path = config.path || null; @@ -93,7 +93,7 @@ export async function getTagDefinitions(): Promise> { name: ext.getTag(), displayName: ext.getName(), description: ext.getDescription(), - args: ext.getArgs() + args: ext.getArgs(), })); } @@ -123,8 +123,8 @@ async function getNunjucks(renderMode: string) { variableStart: '{{', variableEnd: '}}', commentStart: '{#', - commentEnd: '#}' - } + commentEnd: '#}', + }, }; if (renderMode === RENDER_VARS) { diff --git a/packages/insomnia-app/app/templating/utils.js b/packages/insomnia-app/app/templating/utils.js index 5b2d9e14c6..5aa4f30f36 100644 --- a/packages/insomnia-app/app/templating/utils.js +++ b/packages/insomnia-app/app/templating/utils.js @@ -10,13 +10,13 @@ export type NunjucksParsedTagArg = { displayName?: string, quotedBy?: '"' | "'", validate?: (value: any) => string, - hide?: (Array) => boolean + hide?: (Array) => boolean, }; export type NunjucksParsedTag = { name: string, args: Array, - rawValue?: string + rawValue?: string, }; /** diff --git a/packages/insomnia-app/app/ui/components/base/button.js b/packages/insomnia-app/app/ui/components/base/button.js index c9fec7f10c..9324746c8a 100644 --- a/packages/insomnia-app/app/ui/components/base/button.js +++ b/packages/insomnia-app/app/ui/components/base/button.js @@ -44,7 +44,7 @@ Button.propTypes = { disabled: PropTypes.bool, tabIndex: PropTypes.number, type: PropTypes.string, - id: PropTypes.string + id: PropTypes.string, }; export default Button; diff --git a/packages/insomnia-app/app/ui/components/base/copy-button.js b/packages/insomnia-app/app/ui/components/base/copy-button.js index 506a11a417..5d38ac7deb 100644 --- a/packages/insomnia-app/app/ui/components/base/copy-button.js +++ b/packages/insomnia-app/app/ui/components/base/copy-button.js @@ -8,7 +8,7 @@ class CopyButton extends PureComponent { constructor(props) { super(props); this.state = { - showConfirmation: false + showConfirmation: false, }; } @@ -67,7 +67,7 @@ CopyButton.propTypes = { // Optional children: PropTypes.node, title: PropTypes.string, - confirmMessage: PropTypes.string + confirmMessage: PropTypes.string, }; export default CopyButton; diff --git a/packages/insomnia-app/app/ui/components/base/debounced-input.js b/packages/insomnia-app/app/ui/components/base/debounced-input.js index 6b68e4a7a3..ab08c95e12 100644 --- a/packages/insomnia-app/app/ui/components/base/debounced-input.js +++ b/packages/insomnia-app/app/ui/components/base/debounced-input.js @@ -142,7 +142,7 @@ DebouncedInput.propTypes = { onFocus: PropTypes.func, onBlur: PropTypes.func, textarea: PropTypes.bool, - delay: PropTypes.number + delay: PropTypes.number, }; export default DebouncedInput; diff --git a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-button.js b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-button.js index ec8bad1992..3e0ead8f6e 100644 --- a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-button.js +++ b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-button.js @@ -13,7 +13,7 @@ class DropdownButton extends PureComponent { } DropdownButton.propTypes = { - children: PropTypes.node + children: PropTypes.node, }; export default DropdownButton; diff --git a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-divider.js b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-divider.js index 89fae1634b..6d26b66fd7 100644 --- a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-divider.js +++ b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-divider.js @@ -7,7 +7,7 @@ class DropdownDivider extends PureComponent { const { children } = this.props; const classes = classnames('dropdown__divider', { - 'dropdown__divider--no-name': !children + 'dropdown__divider--no-name': !children, }); return ( @@ -19,7 +19,7 @@ class DropdownDivider extends PureComponent { } DropdownDivider.propTypes = { - children: PropTypes.node + children: PropTypes.node, }; export default DropdownDivider; diff --git a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-hint.js b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-hint.js index 96c3fcb5a8..703ab27389 100644 --- a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-hint.js +++ b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-hint.js @@ -4,7 +4,7 @@ import type { Hotkey as HotkeyType } from '../../../../common/hotkeys'; import Hotkey from '../../hotkey'; type Props = { - hotkey: HotkeyType + hotkey: HotkeyType, }; class DropdownHint extends React.PureComponent { diff --git a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-item.js b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-item.js index d95ca0b409..3169499b0b 100644 --- a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-item.js +++ b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-item.js @@ -47,7 +47,7 @@ class DropdownItem extends PureComponent { const buttonProps = { type: 'button', onClick: this._handleClick, - ...props + ...props, }; return React.createElement(buttonClass || 'button', buttonProps, inner); @@ -62,7 +62,7 @@ DropdownItem.propTypes = { onClick: PropTypes.func, children: PropTypes.node, className: PropTypes.string, - color: PropTypes.string + color: PropTypes.string, }; export default DropdownItem; diff --git a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-right.js b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-right.js index c004027982..273f736c44 100644 --- a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-right.js +++ b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown-right.js @@ -15,7 +15,7 @@ class DropdownRight extends PureComponent { DropdownRight.propTypes = { children: PropTypes.node, - className: PropTypes.string + className: PropTypes.string, }; export default DropdownRight; diff --git a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown.js b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown.js index 1357496ff1..c649ddd3e0 100644 --- a/packages/insomnia-app/app/ui/components/base/dropdown/dropdown.js +++ b/packages/insomnia-app/app/ui/components/base/dropdown/dropdown.js @@ -28,7 +28,7 @@ class Dropdown extends PureComponent { filterActiveIndex: 0, // Use this to force new menu every time dropdown opens - uniquenessKey: 0 + uniquenessKey: 0, }; } @@ -72,7 +72,7 @@ class Dropdown extends PureComponent { filter: newFilter, filterItems: newFilter ? filterItems : null, filterActiveIndex: filterItems[0] || -1, - filterVisible: this.state.filterVisible ? true : newFilter.length > 0 + filterVisible: this.state.filterVisible ? true : newFilter.length > 0, }); } @@ -181,7 +181,7 @@ class Dropdown extends PureComponent { this._dropdownList.style.left = `${left + offset}px`; this._dropdownList.style.maxWidth = `${Math.min( dropdownListRect.width, - bodyRect.width - left - offset + bodyRect.width - left - offset, )}px`; } @@ -268,7 +268,7 @@ class Dropdown extends PureComponent { filter: '', filterItems: null, filterActiveIndex: -1, - uniquenessKey: this.state.uniquenessKey + 1 + uniquenessKey: this.state.uniquenessKey + 1, }); this.props.onOpen && this.props.onOpen(); @@ -292,12 +292,12 @@ class Dropdown extends PureComponent { filterVisible, filterActiveIndex, filterItems, - filter + filter, } = this.state; const classes = classnames('dropdown', className, { 'dropdown--wide': wide, - 'dropdown--open': open + 'dropdown--open': open, }); const menuClasses = classnames({ @@ -306,7 +306,7 @@ class Dropdown extends PureComponent { 'dropdown__menu--open': open, 'dropdown__menu--outlined': outline, 'dropdown__menu--up': dropUp, - 'dropdown__menu--right': right + 'dropdown__menu--right': right, }); const dropdownButtons = []; @@ -334,7 +334,7 @@ class Dropdown extends PureComponent { dropdownItems.push(
  • {child} -
  • + , ); } else if (child.type.name === DropdownDivider.name) { const currentIndex = visibleChildren.indexOf(child); @@ -350,7 +350,7 @@ class Dropdown extends PureComponent { let finalChildren = []; if (dropdownButtons.length !== 1) { console.error(`Dropdown needs exactly one DropdownButton! Got ${dropdownButtons.length}`, { - allChildren + allChildren, }); } else { const noResults = filter && filterItems && filterItems.length === 0; @@ -364,7 +364,7 @@ class Dropdown extends PureComponent { ref={this._addDropdownListRef} tabIndex="-1" className={classnames('dropdown__list', { - 'dropdown__list--filtering': filterVisible + 'dropdown__list--filtering': filterVisible, })}>
    @@ -379,8 +379,8 @@ class Dropdown extends PureComponent {
      {dropdownItems}
    , - dropdownsContainer - ) + dropdownsContainer, + ), ]; } @@ -412,7 +412,7 @@ Dropdown.propTypes = { onHide: PropTypes.func, className: PropTypes.string, style: PropTypes.string, - beside: PropTypes.bool + beside: PropTypes.bool, }; export default Dropdown; diff --git a/packages/insomnia-app/app/ui/components/base/editable.js b/packages/insomnia-app/app/ui/components/base/editable.js index a4239ff30f..a3fa4be29c 100644 --- a/packages/insomnia-app/app/ui/components/base/editable.js +++ b/packages/insomnia-app/app/ui/components/base/editable.js @@ -7,7 +7,7 @@ class Editable extends PureComponent { constructor(props) { super(props); this.state = { - editing: false + editing: false, }; } @@ -90,7 +90,7 @@ class Editable extends PureComponent { title: singleClick ? 'Click to edit' : 'Double click to edit', onClick: this._handleSingleClickEditStart, onDoubleClick: this._handleEditStart, - ...extra + ...extra, }; if (renderReadView) { @@ -110,7 +110,7 @@ Editable.propTypes = { renderReadView: PropTypes.func, singleClick: PropTypes.bool, onEditStart: PropTypes.func, - className: PropTypes.string + className: PropTypes.string, }; export default Editable; diff --git a/packages/insomnia-app/app/ui/components/base/file-input-button.js b/packages/insomnia-app/app/ui/components/base/file-input-button.js index c6f132f609..5a108043d7 100644 --- a/packages/insomnia-app/app/ui/components/base/file-input-button.js +++ b/packages/insomnia-app/app/ui/components/base/file-input-button.js @@ -14,7 +14,7 @@ type Props = { extensions?: Array, showFileName?: boolean, showFileIcon?: boolean, - name?: string + name?: string, }; @autobind @@ -56,7 +56,7 @@ class FileInputButton extends React.PureComponent { return 'openDirectory'; } }), - filters: [] + filters: [], }; // If extensions are provided then filter for just those extensions diff --git a/packages/insomnia-app/app/ui/components/base/highlight.js b/packages/insomnia-app/app/ui/components/base/highlight.js index 7af6343083..de85e0e211 100644 --- a/packages/insomnia-app/app/ui/components/base/highlight.js +++ b/packages/insomnia-app/app/ui/components/base/highlight.js @@ -6,7 +6,7 @@ import { fuzzyMatch } from '../../../common/misc'; type Props = {| search: string, - text: string + text: string, |}; @autobind @@ -28,8 +28,8 @@ class Highlight extends React.PureComponent { __html: fuzzySort.highlight( result, '', - '' - ) + '', + ), }} /> ); diff --git a/packages/insomnia-app/app/ui/components/base/lazy.js b/packages/insomnia-app/app/ui/components/base/lazy.js index ae7ecfa74e..9eec454d24 100644 --- a/packages/insomnia-app/app/ui/components/base/lazy.js +++ b/packages/insomnia-app/app/ui/components/base/lazy.js @@ -29,7 +29,7 @@ class Lazy extends PureComponent { Lazy.propTypes = { delay: PropTypes.number, - children: PropTypes.node + children: PropTypes.node, }; export default Lazy; diff --git a/packages/insomnia-app/app/ui/components/base/link.js b/packages/insomnia-app/app/ui/components/base/link.js index e2e722cffa..2817e337d7 100644 --- a/packages/insomnia-app/app/ui/components/base/link.js +++ b/packages/insomnia-app/app/ui/components/base/link.js @@ -9,7 +9,7 @@ type Props = {| button?: boolean, onClick?: Function, className?: string, - children?: React.Node + children?: React.Node, |}; @autobind diff --git a/packages/insomnia-app/app/ui/components/base/mailto.js b/packages/insomnia-app/app/ui/components/base/mailto.js index 0a0e4a1936..02d033fc6f 100644 --- a/packages/insomnia-app/app/ui/components/base/mailto.js +++ b/packages/insomnia-app/app/ui/components/base/mailto.js @@ -8,7 +8,7 @@ type Props = {| email: string, children?: React.Node, subject?: string, - body?: string + body?: string, |}; @autobind diff --git a/packages/insomnia-app/app/ui/components/base/modal-body.js b/packages/insomnia-app/app/ui/components/base/modal-body.js index 859cbbaa1d..97646a01cc 100644 --- a/packages/insomnia-app/app/ui/components/base/modal-body.js +++ b/packages/insomnia-app/app/ui/components/base/modal-body.js @@ -6,7 +6,7 @@ class ModalBody extends PureComponent { render() { const { className, children, noScroll, ...props } = this.props; const classes = classnames(className, 'modal__body theme--dialog__body', { - 'modal__body--no-scroll': noScroll + 'modal__body--no-scroll': noScroll, }); return ( @@ -20,7 +20,7 @@ class ModalBody extends PureComponent { ModalBody.propTypes = { noScroll: PropTypes.bool, className: PropTypes.string, - children: PropTypes.node + children: PropTypes.node, }; export default ModalBody; diff --git a/packages/insomnia-app/app/ui/components/base/modal-footer.js b/packages/insomnia-app/app/ui/components/base/modal-footer.js index 99d9fb6b8b..b0330dfc27 100644 --- a/packages/insomnia-app/app/ui/components/base/modal-footer.js +++ b/packages/insomnia-app/app/ui/components/base/modal-footer.js @@ -16,7 +16,7 @@ ModalFooter.propTypes = { children: PropTypes.node.isRequired, // Optional - className: PropTypes.string + className: PropTypes.string, }; export default ModalFooter; diff --git a/packages/insomnia-app/app/ui/components/base/modal-header.js b/packages/insomnia-app/app/ui/components/base/modal-header.js index b98924cba6..b0d78ac5e3 100644 --- a/packages/insomnia-app/app/ui/components/base/modal-header.js +++ b/packages/insomnia-app/app/ui/components/base/modal-header.js @@ -30,7 +30,7 @@ ModalHeader.propTypes = { // Optional hideCloseButton: PropTypes.bool, - className: PropTypes.string + className: PropTypes.string, }; export default ModalHeader; diff --git a/packages/insomnia-app/app/ui/components/base/modal.js b/packages/insomnia-app/app/ui/components/base/modal.js index cc2a3ac86d..7afb6e662b 100644 --- a/packages/insomnia-app/app/ui/components/base/modal.js +++ b/packages/insomnia-app/app/ui/components/base/modal.js @@ -17,7 +17,7 @@ class Modal extends PureComponent { this.state = { open: false, forceRefreshCounter: 0, - zIndex: globalZIndex + zIndex: globalZIndex, }; } @@ -81,7 +81,7 @@ class Modal extends PureComponent { this.setState({ open: true, zIndex: globalZIndex++, - forceRefreshCounter: forceRefreshCounter + (freshState ? 1 : 0) + forceRefreshCounter: forceRefreshCounter + (freshState ? 1 : 0), }); if (this.props.dontFocus) { @@ -122,7 +122,7 @@ class Modal extends PureComponent { className, { 'modal--fixed-height': tall }, { 'modal--noescape': noEscape }, - { 'modal--wide': wide } + { 'modal--wide': wide }, ); const styles = {}; @@ -160,7 +160,7 @@ Modal.propTypes = { onCancel: PropTypes.func, freshState: PropTypes.bool, children: PropTypes.node, - className: PropTypes.string + className: PropTypes.string, }; export default Modal; diff --git a/packages/insomnia-app/app/ui/components/base/prompt-button.js b/packages/insomnia-app/app/ui/components/base/prompt-button.js index 5c24db3794..b5be183870 100644 --- a/packages/insomnia-app/app/ui/components/base/prompt-button.js +++ b/packages/insomnia-app/app/ui/components/base/prompt-button.js @@ -13,7 +13,7 @@ class PromptButton extends PureComponent { super(props); this.state = { - state: STATE_DEFAULT + state: STATE_DEFAULT, }; } @@ -120,7 +120,7 @@ PromptButton.propTypes = { confirmMessage: PropTypes.string, doneMessage: PropTypes.string, value: PropTypes.any, - tabIndex: PropTypes.number + tabIndex: PropTypes.number, }; export default PromptButton; diff --git a/packages/insomnia-app/app/ui/components/check-for-updates-button.js b/packages/insomnia-app/app/ui/components/check-for-updates-button.js index c18b3555dd..6f16443c87 100644 --- a/packages/insomnia-app/app/ui/components/check-for-updates-button.js +++ b/packages/insomnia-app/app/ui/components/check-for-updates-button.js @@ -5,13 +5,13 @@ import * as electron from 'electron'; type Props = { children: React.Node, - className: ?string + className: ?string, }; type State = { status: string, checking: boolean, - updateAvailable: boolean + updateAvailable: boolean, }; @autobind @@ -21,7 +21,7 @@ class CheckForUpdatesButton extends React.PureComponent { this.state = { status: '', checking: false, - updateAvailable: false + updateAvailable: false, }; } diff --git a/packages/insomnia-app/app/ui/components/codemirror/code-editor.js b/packages/insomnia-app/app/ui/components/codemirror/code-editor.js index 1e370586f6..97c52a40da 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/code-editor.js +++ b/packages/insomnia-app/app/ui/components/codemirror/code-editor.js @@ -61,12 +61,12 @@ const BASE_CODEMIRROR_OPTIONS = { // Change default find command from "find" to "findPersistent" so the // search box stays open after pressing Enter - [isMac() ? 'Cmd-F' : 'Ctrl-F']: 'findPersistent' + [isMac() ? 'Cmd-F' : 'Ctrl-F']: 'findPersistent', }), // NOTE: Because the lint mode is initialized immediately, the lint gutter needs to // be in the default options. DO NOT REMOVE THIS. - gutters: ['CodeMirror-lint-markers'] + gutters: ['CodeMirror-lint-markers'], }; @autobind @@ -75,7 +75,7 @@ class CodeEditor extends React.Component { super(props); this.state = { - filter: props.filter || '' + filter: props.filter || '', }; this._originalCode = ''; @@ -129,7 +129,7 @@ class CodeEditor extends React.Component { if (this.codeMirror) { this.codeMirror.setSelection( { line: 0, ch: 0 }, - { line: this.codeMirror.lineCount(), ch: 0 } + { line: this.codeMirror.lineCount(), ch: 0 }, ); } } @@ -233,7 +233,7 @@ class CodeEditor extends React.Component { scroll: this.codeMirror.getScrollInfo(), selections: this.codeMirror.listSelections(), cursor: this.codeMirror.getCursor(), - history: this.codeMirror.getHistory() + history: this.codeMirror.getHistory(), }; } @@ -295,7 +295,7 @@ class CodeEditor extends React.Component { Tab: cm => { const spaces = this._indentChars(); cm.replaceSelection(spaces); - } + }, }); } @@ -314,7 +314,7 @@ class CodeEditor extends React.Component { this.codeMirror.enableNunjucksTags( this.props.render, this.props.getRenderContext, - this.props.isVariableUncovered + this.props.isVariableUncovered, ); } @@ -458,7 +458,7 @@ class CodeEditor extends React.Component { hintOptions, infoOptions, jumpOptions, - lintOptions + lintOptions, } = this.props; let mode; @@ -483,7 +483,7 @@ class CodeEditor extends React.Component { indentWithTabs: indentWithTabs, matchBrackets: !noMatchBrackets, lint: !noLint && !readOnly, - gutters: [] + gutters: [], }; // Only set keyMap if we're not read-only. This is so things like @@ -566,7 +566,7 @@ class CodeEditor extends React.Component { options.environmentAutocomplete = { getVariables, getTags, - getConstants: getAutocompleteConstants + getConstants: getAutocompleteConstants, }; } @@ -780,13 +780,13 @@ class CodeEditor extends React.Component { dynamicHeight, style, type, - isVariableUncovered + isVariableUncovered, } = this.props; const classes = classnames(className, { editor: true, 'editor--dynamic-height': dynamicHeight, - 'editor--readonly': readOnly + 'editor--readonly': readOnly, }); const toolbarChildren = []; @@ -800,7 +800,7 @@ class CodeEditor extends React.Component { defaultValue={filter || ''} placeholder={CodeEditor._isJSON(mode) ? '$.store.books[*].author' : '/store/books/author'} onChange={this._handleFilterChange} - /> + />, ); if (filterHistory && filterHistory.length) { @@ -814,14 +814,14 @@ class CodeEditor extends React.Component { {filter} ))} - + , ); } toolbarChildren.push( + , ); } @@ -842,7 +842,7 @@ class CodeEditor extends React.Component { title="Auto-format request body whitespace" onClick={this._handleBeautify}> Beautify {contentTypeName} - + , ); } @@ -932,7 +932,7 @@ CodeEditor.propTypes = { infoOptions: PropTypes.object, jumpOptions: PropTypes.object, uniquenessKey: PropTypes.any, - isVariableUncovered: PropTypes.bool + isVariableUncovered: PropTypes.bool, }; export default CodeEditor; diff --git a/packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js b/packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js index 00b1288fad..310013fcc8 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js +++ b/packages/insomnia-app/app/ui/components/codemirror/extensions/autocomplete.js @@ -22,7 +22,7 @@ const MAX_TAGS = -1; const ICONS = { [TYPE_CONSTANT]: { char: '𝒄', title: 'Constant' }, [TYPE_VARIABLE]: { char: '𝑥', title: 'Environment Variable' }, - [TYPE_TAG]: { char: 'ƒ', title: 'Generator Tag' } + [TYPE_TAG]: { char: 'ƒ', title: 'Generator Tag' }, }; CodeMirror.defineExtension('isHintDropdownActive', function() { @@ -85,8 +85,8 @@ CodeMirror.defineOption('environmentAutocomplete', null, (cm, options) => { // Override default behavior and don't select hint on Tab widget.close(); return CodeMirror.Pass; - } - } + }, + }, // Good for debugging // ,closeOnUnfocus: false @@ -113,7 +113,7 @@ CodeMirror.defineOption('environmentAutocomplete', null, (cm, options) => { const range = cm.getRange(pos, cur); return range.match(COMPLETE_AFTER_CURLIES); }, - true + true, ); return CodeMirror.Pass; @@ -163,7 +163,7 @@ CodeMirror.defineOption('environmentAutocomplete', null, (cm, options) => { cm.addKeyMap({ name: 'autocomplete-keymap', 'Ctrl-Space': completeForce, // Force autocomplete on hotkey - "' '": completeIfAfterTagOrVarOpen + "' '": completeIfAfterTagOrVarOpen, }); }); @@ -215,10 +215,10 @@ function hint(cm, options) { // Match variables if (allowMatchingVariables) { matchSegments(variablesToMatch, nameSegment, TYPE_VARIABLE, MAX_VARIABLES).forEach(m => - lowPriorityMatches.push(m) + lowPriorityMatches.push(m), ); matchSegments(variablesToMatch, nameSegmentLong, TYPE_VARIABLE, MAX_VARIABLES).forEach(m => - highPriorityMatches.push(m) + highPriorityMatches.push(m), ); } @@ -236,7 +236,7 @@ function hint(cm, options) { if (token.type === 'variable') { // We're inside a JSON key matchSegments(constantsToMatch, segment, TYPE_CONSTANT, MAX_CONSTANTS).forEach(m => - highPriorityMatches.push(m) + highPriorityMatches.push(m), ); } else if ( token.type === 'invalidchar' || @@ -245,13 +245,13 @@ function hint(cm, options) { ) { // We're outside of a JSON key matchSegments(constantsToMatch, segment, TYPE_CONSTANT, MAX_CONSTANTS).forEach(m => - highPriorityMatches.push({ ...m, text: '"' + m.text + '": ' }) + highPriorityMatches.push({ ...m, text: '"' + m.text + '": ' }), ); } } else { // Otherwise match full segments matchSegments(constantsToMatch, nameSegmentFull, TYPE_CONSTANT, MAX_CONSTANTS).forEach(m => - highPriorityMatches.push(m) + highPriorityMatches.push(m), ); } } @@ -259,10 +259,10 @@ function hint(cm, options) { // Match tags if (allowMatchingTags) { matchSegments(tagsToMatch, nameSegment, TYPE_TAG, MAX_TAGS).forEach(m => - lowPriorityMatches.push(m) + lowPriorityMatches.push(m), ); matchSegments(tagsToMatch, nameSegmentLong, TYPE_TAG, MAX_TAGS).forEach(m => - highPriorityMatches.push(m) + highPriorityMatches.push(m), ); } @@ -273,13 +273,13 @@ function hint(cm, options) { const uniqueMatches = matches.reduce( (arr, v) => (arr.find(a => a.text === v.text) ? arr : [...arr, v]), - [] // Default value + [], // Default value ); return { list: uniqueMatches, from: CodeMirror.Pos(cur.line, cur.ch - segment.length), - to: CodeMirror.Pos(cur.line, cur.ch) + to: CodeMirror.Pos(cur.line, cur.ch), }; } @@ -372,7 +372,7 @@ function matchSegments(listOfThings, segment, type, limit = -1) { text: defaultFill, displayText: displayName, render: renderHintMatch, - hint: replaceHintMatch + hint: replaceHintMatch, }); } diff --git a/packages/insomnia-app/app/ui/components/codemirror/extensions/clickable.js b/packages/insomnia-app/app/ui/components/codemirror/extensions/clickable.js index 27c6636d9a..3a2a1d46ad 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/extensions/clickable.js +++ b/packages/insomnia-app/app/ui/components/codemirror/extensions/clickable.js @@ -18,7 +18,7 @@ CodeMirror.defineExtension('makeLinksClickable', function(handleClick) { } return null; - } + }, }); this.getWrapperElement().addEventListener('click', e => { diff --git a/packages/insomnia-app/app/ui/components/codemirror/extensions/nunjucks-tags.js b/packages/insomnia-app/app/ui/components/codemirror/extensions/nunjucks-tags.js index d71997eef6..9dc111bb1e 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/extensions/nunjucks-tags.js +++ b/packages/insomnia-app/app/ui/components/codemirror/extensions/nunjucks-tags.js @@ -8,7 +8,7 @@ import { getTagDefinitions } from '../../../../templating/index'; CodeMirror.defineExtension('enableNunjucksTags', function( handleRender, handleGetRenderContext, - isVariableUncovered = false + isVariableUncovered = false, ) { if (!handleRender) { console.warn("enableNunjucksTags wasn't passed a render function"); @@ -19,7 +19,7 @@ CodeMirror.defineExtension('enableNunjucksTags', function( this, handleRender, handleGetRenderContext, - isVariableUncovered + isVariableUncovered, ); const debouncedRefreshFn = misc.debounce(refreshFn); @@ -116,7 +116,7 @@ async function _highlightNunjucksTags(render, renderContext, isVariableUncovered __nunjucks: true, // Mark that we created it __template: tok.string, handleMouseEvents: false, - replacedWith: el + replacedWith: el, }); (async function() { @@ -125,7 +125,7 @@ async function _highlightNunjucksTags(render, renderContext, isVariableUncovered mark, tok.string, renderContext, - isVariableUncovered + isVariableUncovered, ); })(); @@ -136,7 +136,7 @@ async function _highlightNunjucksTags(render, renderContext, isVariableUncovered mark, tok.string, renderContext, - isVariableUncovered + isVariableUncovered, ); }); @@ -154,7 +154,7 @@ async function _highlightNunjucksTags(render, renderContext, isVariableUncovered } else { console.warn('Tried to replace mark that did not exist', mark); } - } + }, }); }); diff --git a/packages/insomnia-app/app/ui/components/codemirror/modes/curl.js b/packages/insomnia-app/app/ui/components/codemirror/modes/curl.js index 7c8b5f7001..6606ed6a13 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/modes/curl.js +++ b/packages/insomnia-app/app/ui/components/codemirror/modes/curl.js @@ -6,21 +6,21 @@ CodeMirror.defineSimpleMode('curl', { // Regular key-value header tokens { regex: /^(> )(.*:)(.*)$/, - token: ['curl-prefix curl-out', 'curl-out', 'curl-out curl-value'] + token: ['curl-prefix curl-out', 'curl-out', 'curl-out curl-value'], }, { regex: /^(< )(.*:)(.*)$/, - token: ['curl-prefix curl-in', 'curl-in', 'curl-in curl-value'] + token: ['curl-prefix curl-in', 'curl-in', 'curl-in curl-value'], }, // Header fields ("POST /foo/bar HTTP/1.1") { regex: /^(> )([^:]+ .*)$/, - token: ['curl-prefix curl-out curl-header', 'curl-out curl-header'] + token: ['curl-prefix curl-out curl-header', 'curl-out curl-header'], }, { regex: /^(< )([^:]+ .*)$/, - token: ['curl-prefix curl-in curl-header', 'curl-in curl-header'] + token: ['curl-prefix curl-in curl-header', 'curl-in curl-header'], }, // Data @@ -29,9 +29,9 @@ CodeMirror.defineSimpleMode('curl', { // Informational text { regex: /^(\* )(.*)$/, - token: ['curl-prefix curl-comment', 'curl-comment'] - } + token: ['curl-prefix curl-comment', 'curl-comment'], + }, ], comment: [], - meta: {} + meta: {}, }); diff --git a/packages/insomnia-app/app/ui/components/codemirror/modes/nunjucks.js b/packages/insomnia-app/app/ui/components/codemirror/modes/nunjucks.js index 7a871c42ca..9446b1f88f 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/modes/nunjucks.js +++ b/packages/insomnia-app/app/ui/components/codemirror/modes/nunjucks.js @@ -58,6 +58,6 @@ function _nunjucksMode() { } return null; - } + }, }; } diff --git a/packages/insomnia-app/app/ui/components/codemirror/one-line-editor.js b/packages/insomnia-app/app/ui/components/codemirror/one-line-editor.js index c568589faf..68b6c433f5 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/one-line-editor.js +++ b/packages/insomnia-app/app/ui/components/codemirror/one-line-editor.js @@ -28,7 +28,7 @@ class OneLineEditor extends PureComponent { } this.state = { - mode + mode, }; } @@ -302,7 +302,7 @@ class OneLineEditor extends PureComponent { getAutocompleteConstants, isVariableUncovered, mode: syntaxMode, - type: originalType + type: originalType, } = this.props; const { mode } = this.state; @@ -385,7 +385,7 @@ class OneLineEditor extends PureComponent { className={className} style={{ // background: 'rgba(255, 0, 0, 0.05)', // For debugging - width: '100%' + width: '100%', }} placeholder={placeholder} defaultValue={defaultValue} @@ -423,7 +423,7 @@ OneLineEditor.propTypes = { className: PropTypes.string, forceEditor: PropTypes.bool, forceInput: PropTypes.bool, - isVariableUncovered: PropTypes.bool + isVariableUncovered: PropTypes.bool, }; export default OneLineEditor; diff --git a/packages/insomnia-app/app/ui/components/cookie-list.js b/packages/insomnia-app/app/ui/components/cookie-list.js index e1d1ab1603..edd8f6dc4c 100644 --- a/packages/insomnia-app/app/ui/components/cookie-list.js +++ b/packages/insomnia-app/app/ui/components/cookie-list.js @@ -16,7 +16,7 @@ type Props = { cookies: Array, newCookieDomainName: string, handleShowModifyCookieModal: Function, - handleRender: Function + handleRender: Function, }; @autobind @@ -30,7 +30,7 @@ class CookieList extends React.PureComponent { expires: null, path: '/', secure: false, - httpOnly: false + httpOnly: false, }; this.props.handleCookieAdd(newCookie); diff --git a/packages/insomnia-app/app/ui/components/dropdowns/auth-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/auth-dropdown.js index 98498d9d50..93371d52f9 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/auth-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/auth-dropdown.js @@ -17,7 +17,7 @@ import { AUTH_AWS_IAM, AUTH_NETRC, AUTH_ASAP, - getAuthTypeName + getAuthTypeName, } from '../../../common/constants'; @autobind @@ -45,7 +45,7 @@ class AuthDropdown extends PureComponent { await showModal(AlertModal, { title: 'Switch Authentication?', message: 'Current authentication settings will be lost', - addCancel: true + addCancel: true, }); break; } @@ -93,7 +93,7 @@ AuthDropdown.propTypes = { // Optional className: PropTypes.string, - children: PropTypes.node + children: PropTypes.node, }; export default AuthDropdown; diff --git a/packages/insomnia-app/app/ui/components/dropdowns/content-type-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/content-type-dropdown.js index 673726ae7f..adac14a9b5 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/content-type-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/content-type-dropdown.js @@ -11,7 +11,7 @@ import { CONTENT_TYPE_OTHER, CONTENT_TYPE_XML, CONTENT_TYPE_EDN, - getContentTypeName + getContentTypeName, } from '../../../common/constants'; import { showModal } from '../modals/index'; import AlertModal from '../modals/alert-modal'; @@ -24,7 +24,7 @@ type Props = { // Optional className?: string, - request?: Request + request?: Request, }; const EMPTY_MIME_TYPE = null; @@ -58,7 +58,7 @@ class ContentTypeDropdown extends React.PureComponent { await showModal(AlertModal, { title: 'Switch Body Type?', message: 'Current body will be lost. Are you sure you want to continue?', - addCancel: true + addCancel: true, }); } } diff --git a/packages/insomnia-app/app/ui/components/dropdowns/environments-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/environments-dropdown.js index fe51c57516..1ac8a95a39 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/environments-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/environments-dropdown.js @@ -7,7 +7,7 @@ import { DropdownButton, DropdownDivider, DropdownHint, - DropdownItem + DropdownItem, } from '../base/dropdown'; import { showModal } from '../modals/index'; import Tooltip from '../tooltip'; @@ -25,7 +25,7 @@ type Props = { // Optional className?: string, - activeEnvironment: Environment | null + activeEnvironment: Environment | null, }; @autobind diff --git a/packages/insomnia-app/app/ui/components/dropdowns/method-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/method-dropdown.js index 14a3214441..245a09f0d3 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/method-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/method-dropdown.js @@ -55,7 +55,7 @@ class MethodDropdown extends PureComponent { // Invoke callback this.props.onChange(method); - } + }, }); } @@ -106,7 +106,7 @@ MethodDropdown.propTypes = { method: PropTypes.string.isRequired, // Optional - right: PropTypes.bool + right: PropTypes.bool, }; export default MethodDropdown; diff --git a/packages/insomnia-app/app/ui/components/dropdowns/preview-mode-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/preview-mode-dropdown.js index 858926ebb1..f4135a6ebe 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/preview-mode-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/preview-mode-dropdown.js @@ -51,7 +51,7 @@ PreviewModeDropdown.propTypes = { fullDownload: PropTypes.func.isRequired, // Required - previewMode: PropTypes.string.isRequired + previewMode: PropTypes.string.isRequired, }; export default PreviewModeDropdown; diff --git a/packages/insomnia-app/app/ui/components/dropdowns/request-actions-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/request-actions-dropdown.js index c9613574f6..c515f8d3f1 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/request-actions-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/request-actions-dropdown.js @@ -7,7 +7,7 @@ import { DropdownButton, DropdownDivider, DropdownHint, - DropdownItem + DropdownItem, } from '../base/dropdown/index'; import * as models from '../../../models'; import * as hotkeys from '../../../common/hotkeys'; @@ -83,7 +83,7 @@ RequestActionsDropdown.propTypes = { handleGenerateCode: PropTypes.func.isRequired, handleCopyAsCurl: PropTypes.func.isRequired, handleShowSettings: PropTypes.func.isRequired, - request: PropTypes.object.isRequired + request: PropTypes.object.isRequired, }; export default RequestActionsDropdown; diff --git a/packages/insomnia-app/app/ui/components/dropdowns/request-group-actions-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/request-group-actions-dropdown.js index 4119fa255b..5134ae3085 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/request-group-actions-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/request-group-actions-dropdown.js @@ -7,7 +7,7 @@ import { DropdownButton, DropdownDivider, DropdownHint, - DropdownItem + DropdownItem, } from '../base/dropdown'; import EnvironmentEditModal from '../modals/environment-edit-modal'; import * as models from '../../../models'; @@ -28,7 +28,7 @@ class RequestGroupActionsDropdown extends PureComponent { defaultValue: requestGroup.name, onComplete: name => { models.requestGroup.update(requestGroup, { name }); - } + }, }); } @@ -108,7 +108,7 @@ RequestGroupActionsDropdown.propTypes = { handleMoveRequestGroup: PropTypes.func.isRequired, // Optional - requestGroup: PropTypes.object + requestGroup: PropTypes.object, }; export default RequestGroupActionsDropdown; diff --git a/packages/insomnia-app/app/ui/components/dropdowns/response-history-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/response-history-dropdown.js index 191e8755fa..d1fec75add 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/response-history-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/response-history-dropdown.js @@ -118,7 +118,7 @@ ResponseHistoryDropdown.propTypes = { responses: PropTypes.arrayOf(PropTypes.object).isRequired, // Optional - activeResponse: PropTypes.object + activeResponse: PropTypes.object, }; export default ResponseHistoryDropdown; diff --git a/packages/insomnia-app/app/ui/components/dropdowns/sync-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/sync-dropdown.js index f1906b94d3..27272cccee 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/sync-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/sync-dropdown.js @@ -14,7 +14,7 @@ type Props = { workspace: Workspace, // Optional - className?: string + className?: string, }; type State = { @@ -23,7 +23,7 @@ type State = { resourceGroupId: string | null, syncMode: string | null, syncPercent: number, - workspaceName: string + workspaceName: string, }; @autobind @@ -43,7 +43,7 @@ class SyncDropdown extends React.PureComponent { resourceGroupId: null, syncMode: null, syncPercent: 0, - workspaceName: '' + workspaceName: '', }; } @@ -94,7 +94,7 @@ class SyncDropdown extends React.PureComponent { resourceGroupId, syncPercent, syncMode: config.syncMode, - workspaceName: workspace.name + workspaceName: workspace.name, }); } } @@ -103,7 +103,7 @@ class SyncDropdown extends React.PureComponent { showModal(SetupSyncModal, { onSelectSyncMode: async syncMode => { await this._reloadData(); - } + }, }); } diff --git a/packages/insomnia-app/app/ui/components/dropdowns/workspace-dropdown.js b/packages/insomnia-app/app/ui/components/dropdowns/workspace-dropdown.js index 5ae31cbf6c..fa55637be1 100644 --- a/packages/insomnia-app/app/ui/components/dropdowns/workspace-dropdown.js +++ b/packages/insomnia-app/app/ui/components/dropdowns/workspace-dropdown.js @@ -25,7 +25,7 @@ class WorkspaceDropdown extends PureComponent { constructor(props) { super(props); this.state = { - loggedIn: false + loggedIn: false, }; } @@ -63,13 +63,13 @@ class WorkspaceDropdown extends PureComponent { _handleShowWorkspaceSettings() { showModal(WorkspaceSettingsModal, { - workspace: this.props.activeWorkspace + workspace: this.props.activeWorkspace, }); } _handleShowShareSettings() { showModal(WorkspaceShareSettingsModal, { - workspace: this.props.activeWorkspace + workspace: this.props.activeWorkspace, }); } @@ -86,7 +86,7 @@ class WorkspaceDropdown extends PureComponent { onComplete: async name => { const workspace = await models.workspace.create({ name }); this.props.handleSetActiveWorkspace(workspace._id); - } + }, }); } @@ -217,7 +217,7 @@ WorkspaceDropdown.propTypes = { activeWorkspace: PropTypes.object.isRequired, // Optional - className: PropTypes.string + className: PropTypes.string, }; export default WorkspaceDropdown; diff --git a/packages/insomnia-app/app/ui/components/editors/auth/asap-auth.js b/packages/insomnia-app/app/ui/components/editors/auth/asap-auth.js index 0de02b0611..9a0860c6e6 100644 --- a/packages/insomnia-app/app/ui/components/editors/auth/asap-auth.js +++ b/packages/insomnia-app/app/ui/components/editors/auth/asap-auth.js @@ -16,7 +16,7 @@ type Props = { handleGetRenderContext: Function, nunjucksPowerUserMode: boolean, isVariableUncovered: boolean, - onChange: Function + onChange: Function, }; const PRIVATE_KEY_PLACEHOLDER = ` @@ -54,26 +54,26 @@ class AsapAuth extends React.PureComponent { renderAsapAuthenticationFields(): React.Node { const asapIssuer = this.renderTextInput('Issuer (iss)', 'issuer', 'text/plain', value => - this._handleChangeProperty('issuer', value) + this._handleChangeProperty('issuer', value), ); const asapSubject = this.renderTextInput('Subject (sub)', 'subject', 'text/plain', value => - this._handleChangeProperty('subject', value) + this._handleChangeProperty('subject', value), ); const asapAudience = this.renderTextInput('Audience (aud)', 'audience', 'text/plain', value => - this._handleChangeProperty('audience', value) + this._handleChangeProperty('audience', value), ); const asapAdditionalClaims = this.renderTextInput( 'Additional Claims', 'additionalClaims', 'application/json', - value => this._handleChangeProperty('additionalClaims', value) + value => this._handleChangeProperty('additionalClaims', value), ); const asapKeyId = this.renderTextInput('Key ID (kid)', 'keyId', 'text/plain', value => - this._handleChangeProperty('keyId', value) + this._handleChangeProperty('keyId', value), ); const asapPrivateKey = this.renderPrivateKeyInput('Private Key'); @@ -85,14 +85,14 @@ class AsapAuth extends React.PureComponent { label: string, property: string, mode: string, - onChange: Function + onChange: Function, ): React.Element<*> { const { handleRender, handleGetRenderContext, authentication, nunjucksPowerUserMode, - isVariableUncovered + isVariableUncovered, } = this.props; const id = label.replace(/ /g, '-'); return ( @@ -105,7 +105,7 @@ class AsapAuth extends React.PureComponent {
    { enableRender: handleRender || handleGetRenderContext, placeholder: PRIVATE_KEY_PLACEHOLDER, mode: 'text/plain', - hideMode: true + hideMode: true, }); } @@ -156,8 +156,8 @@ class AsapAuth extends React.PureComponent { className={classnames( 'form-control form-control--underlined form-control--tall no-margin', { - 'form-control--inactive': authentication.disabled - } + 'form-control--inactive': authentication.disabled, + }, )}>