From df8a16f5c4348a3be5d4ffeb2feb1a9822fa8ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Negr=C3=B3n?= Date: Mon, 2 Dec 2024 13:23:50 -0400 Subject: [PATCH] run prettier with trailingComma: es5 --- example-apps/babel/src/index.js | 4 +- example-apps/create/index.js | 4 +- example-apps/create/test/creates.js | 8 +-- example-apps/github/samples/sample_issue.js | 22 ++++---- .../github/samples/sample_repo_list.js | 8 +-- example-apps/middleware/test/triggers.js | 8 +-- example-apps/oauth1-tumblr/authentication.js | 22 ++++---- example-apps/oauth1-tumblr/index.js | 4 +- example-apps/oauth1-tumblr/test/index.js | 2 +- example-apps/oauth1-twitter/index.js | 4 +- example-apps/oauth1-twitter/triggers/like.js | 29 ++++++----- example-apps/onedrive/.eslintrc.json | 21 +++++--- example-apps/onedrive/before-handlers.js | 12 ++--- example-apps/onedrive/constants.js | 2 +- example-apps/onedrive/hydrators.js | 6 +-- example-apps/onedrive/index.js | 6 +-- example-apps/onedrive/test/authentication.js | 16 +++--- .../onedrive/test/creates/text-file.js | 18 +++---- example-apps/onedrive/test/hydrators.js | 6 +-- example-apps/onedrive/test/resources/file.js | 30 +++++------ .../onedrive/test/resources/folder.js | 50 +++++++++---------- example-apps/onedrive/test/test-utils.js | 16 +++--- example-apps/onedrive/test/utils.js | 10 ++-- example-apps/onedrive/utils.js | 5 +- example-apps/resource/index.js | 4 +- .../resource/test/resources/recipe.js | 32 ++++++------ example-apps/rest-hooks/index.js | 4 +- example-apps/rest-hooks/test/triggers.js | 20 ++++---- example-apps/search/index.js | 4 +- example-apps/search/test/searches.js | 8 +-- example-apps/trigger/index.js | 4 +- package.json | 5 +- .../cli/src/oclif/commands/canary/list.js | 12 ++--- packages/cli/src/oclif/commands/promote.js | 5 +- packages/cli/src/oclif/commands/team/add.js | 4 +- .../cli/src/oclif/commands/team/remove.js | 4 +- .../tests/fixtures/registerFieldChoices.js | 6 +-- packages/cli/src/utils/api.js | 23 ++++----- packages/cli/src/utils/build.js | 7 ++- packages/cli/src/utils/convert.js | 31 ++++++------ packages/cli/src/utils/misc.js | 13 +++-- packages/cli/src/utils/team.js | 4 +- packages/core/smoke-test/smoke-test.js | 5 +- .../src/app-middlewares/before/z-object.js | 8 +-- packages/core/src/tools/create-cache.js | 9 +++- .../test/fixtures/truncate-test-data.json | 11 +--- packages/core/test/misc-tools.js | 3 +- packages/core/test/test-tools.js | 14 ++++-- packages/core/test/userapp/helpers.js | 5 +- .../uniqueInputFieldKeys.js | 5 +- packages/schema/lib/schemas/AppSchema.js | 3 +- .../lib/schemas/BasicOperationSchema.js | 10 +++- .../lib/schemas/FieldChoiceWithLabelSchema.js | 2 +- 53 files changed, 291 insertions(+), 287 deletions(-) diff --git a/example-apps/babel/src/index.js b/example-apps/babel/src/index.js index 906adc904..b3babc1b1 100644 --- a/example-apps/babel/src/index.js +++ b/example-apps/babel/src/index.js @@ -14,14 +14,14 @@ const App = { afterResponse: [], resources: { - [Recipe.key]: Recipe + [Recipe.key]: Recipe, }, triggers: {}, searches: {}, - creates: {} + creates: {}, }; export default App; diff --git a/example-apps/create/index.js b/example-apps/create/index.js index dc26a8c91..8c4e023ea 100644 --- a/example-apps/create/index.js +++ b/example-apps/create/index.js @@ -21,8 +21,8 @@ const App = { // If you want your creates to show up, you better include it here! creates: { - [recipe.key]: recipe - } + [recipe.key]: recipe, + }, }; // Finally, export the app. diff --git a/example-apps/create/test/creates.js b/example-apps/create/test/creates.js index ee9dcd755..2b6f6e457 100644 --- a/example-apps/create/test/creates.js +++ b/example-apps/create/test/creates.js @@ -9,17 +9,17 @@ const appTester = zapier.createAppTester(App); describe('creates', () => { describe('create recipe create', () => { - it('should create a new recipe', done => { + it('should create a new recipe', (done) => { const bundle = { inputData: { name: 'Smith Family Recipe', directions: '1. Order out :)', - authorId: 1 - } + authorId: 1, + }, }; appTester(App.creates.recipe.operation.perform, bundle) - .then(result => { + .then((result) => { result.should.have.property('name'); done(); }) diff --git a/example-apps/github/samples/sample_issue.js b/example-apps/github/samples/sample_issue.js index 1a1e64fa0..1906f3ca9 100644 --- a/example-apps/github/samples/sample_issue.js +++ b/example-apps/github/samples/sample_issue.js @@ -31,7 +31,7 @@ module.exports = { events_url: 'https://api.github.com/users/octocat/events{/privacy}', received_events_url: 'https://api.github.com/users/octocat/received_events', type: 'User', - site_admin: false + site_admin: false, }, labels: [ { @@ -39,8 +39,8 @@ module.exports = { url: 'https://api.github.com/repos/octocat/Hello-World/labels/bug', name: 'bug', color: 'f29513', - default: true - } + default: true, + }, ], assignee: { login: 'octocat', @@ -60,7 +60,7 @@ module.exports = { events_url: 'https://api.github.com/users/octocat/events{/privacy}', received_events_url: 'https://api.github.com/users/octocat/received_events', type: 'User', - site_admin: false + site_admin: false, }, assignees: [ { @@ -83,8 +83,8 @@ module.exports = { received_events_url: 'https://api.github.com/users/octocat/received_events', type: 'User', - site_admin: false - } + site_admin: false, + }, ], milestone: { url: 'https://api.github.com/repos/octocat/Hello-World/milestones/1', @@ -116,14 +116,14 @@ module.exports = { received_events_url: 'https://api.github.com/users/octocat/received_events', type: 'User', - site_admin: false + site_admin: false, }, open_issues: 4, closed_issues: 8, created_at: '2011-04-10T20:09:31Z', updated_at: '2014-03-03T18:58:10Z', closed_at: '2013-02-12T13:22:01Z', - due_on: '2012-10-09T23:39:01Z' + due_on: '2012-10-09T23:39:01Z', }, locked: false, comments: 0, @@ -131,7 +131,7 @@ module.exports = { url: 'https://api.github.com/repos/octocat/Hello-World/pulls/1347', html_url: 'https://github.com/octocat/Hello-World/pull/1347', diff_url: 'https://github.com/octocat/Hello-World/pull/1347.diff', - patch_url: 'https://github.com/octocat/Hello-World/pull/1347.patch' + patch_url: 'https://github.com/octocat/Hello-World/pull/1347.patch', }, closed_at: null, created_at: '2011-04-22T13:33:48Z', @@ -154,6 +154,6 @@ module.exports = { events_url: 'https://api.github.com/users/octocat/events{/privacy}', received_events_url: 'https://api.github.com/users/octocat/received_events', type: 'User', - site_admin: false - } + site_admin: false, + }, }; diff --git a/example-apps/github/samples/sample_repo_list.js b/example-apps/github/samples/sample_repo_list.js index 5b0641da1..c9c03f4be 100644 --- a/example-apps/github/samples/sample_repo_list.js +++ b/example-apps/github/samples/sample_repo_list.js @@ -18,7 +18,7 @@ module.exports = { events_url: 'https://api.github.com/users/octocat/events{/privacy}', received_events_url: 'https://api.github.com/users/octocat/received_events', type: 'User', - site_admin: false + site_admin: false, }, name: 'Hello-World', full_name: 'octocat/Hello-World', @@ -109,7 +109,7 @@ module.exports = { permissions: { admin: false, push: false, - pull: true + pull: true, }, allow_rebase_merge: true, allow_squash_merge: true, @@ -121,6 +121,6 @@ module.exports = { name: 'MIT License', spdx_id: 'MIT', url: 'https://api.github.com/licenses/mit', - html_url: 'https://choosealicense.com/licenses/mit/' - } + html_url: 'https://choosealicense.com/licenses/mit/', + }, }; diff --git a/example-apps/middleware/test/triggers.js b/example-apps/middleware/test/triggers.js index ea9cb1c8c..be4b3c36d 100644 --- a/example-apps/middleware/test/triggers.js +++ b/example-apps/middleware/test/triggers.js @@ -9,9 +9,9 @@ const appTester = zapier.createAppTester(App); describe('triggers', () => { describe('new recipe trigger', () => { - it('should load recipes', done => { + it('should load recipes', (done) => { appTester(App.triggers.recipe.operation.perform) - .then(results => { + .then((results) => { results.should.be.an.Array(); results.length.should.be.above(1); @@ -31,9 +31,9 @@ describe('triggers', () => { }); describe('new movie trigger', () => { - it('should load movies', done => { + it('should load movies', (done) => { appTester(App.triggers.movie.operation.perform) - .then(results => { + .then((results) => { results.should.be.an.Array(); results.length.should.be.above(1); diff --git a/example-apps/oauth1-tumblr/authentication.js b/example-apps/oauth1-tumblr/authentication.js index e2ca50cd7..9cd9d7779 100644 --- a/example-apps/oauth1-tumblr/authentication.js +++ b/example-apps/oauth1-tumblr/authentication.js @@ -22,14 +22,14 @@ const config = { oauth_consumer_key: '{{process.env.CLIENT_ID}}', oauth_consumer_secret: '{{process.env.CLIENT_SECRET}}', oauth_signature_method: 'HMAC-SHA1', - oauth_callback: '{{bundle.inputData.redirect_uri}}' - } + oauth_callback: '{{bundle.inputData.redirect_uri}}', + }, }, authorizeUrl: { url: AUTHORIZE_URL, params: { - oauth_token: '{{bundle.inputData.oauth_token}}' - } + oauth_token: '{{bundle.inputData.oauth_token}}', + }, }, getAccessToken: { url: ACCESS_TOKEN_URL, @@ -39,14 +39,14 @@ const config = { oauth_consumer_secret: '{{process.env.CLIENT_SECRET}}', oauth_token: '{{bundle.inputData.oauth_token}}', oauth_token_secret: '{{bundle.inputData.oauth_token_secret}}', - oauth_verifier: '{{bundle.inputData.oauth_verifier}}' - } - } + oauth_verifier: '{{bundle.inputData.oauth_verifier}}', + }, + }, }, test: { - url: 'https://api.tumblr.com/v2/user/info' + url: 'https://api.tumblr.com/v2/user/info', }, - connectionLabel: getConnectionLabel + connectionLabel: getConnectionLabel, }; // A middleware that is run before z.request() actually makes the request. Here we're @@ -64,7 +64,7 @@ const includeAccessToken = (req, z, bundle) => { oauth_consumer_key: process.env.CLIENT_ID, oauth_consumer_secret: process.env.CLIENT_SECRET, oauth_token: bundle.authData.oauth_token, - oauth_token_secret: bundle.authData.oauth_token_secret + oauth_token_secret: bundle.authData.oauth_token_secret, }); } return req; @@ -72,5 +72,5 @@ const includeAccessToken = (req, z, bundle) => { module.exports = { config, - includeAccessToken + includeAccessToken, }; diff --git a/example-apps/oauth1-tumblr/index.js b/example-apps/oauth1-tumblr/index.js index 5186452fe..879dfaeda 100644 --- a/example-apps/oauth1-tumblr/index.js +++ b/example-apps/oauth1-tumblr/index.js @@ -20,14 +20,14 @@ const App = { // If you want your trigger to show up, you better include it here! triggers: { - [LikeTrigger.key]: LikeTrigger + [LikeTrigger.key]: LikeTrigger, }, // If you want your searches to show up, you better include it here! searches: {}, // If you want your creates to show up, you better include it here! - creates: {} + creates: {}, }; // Finally, export the app. diff --git a/example-apps/oauth1-tumblr/test/index.js b/example-apps/oauth1-tumblr/test/index.js index b215c3578..84cb64d92 100644 --- a/example-apps/oauth1-tumblr/test/index.js +++ b/example-apps/oauth1-tumblr/test/index.js @@ -9,7 +9,7 @@ require('should'); // const appTester = zapier.createAppTester(App); describe('My App', () => { - it('should test something', done => { + it('should test something', (done) => { const x = 1; x.should.eql(1); diff --git a/example-apps/oauth1-twitter/index.js b/example-apps/oauth1-twitter/index.js index 5186452fe..879dfaeda 100644 --- a/example-apps/oauth1-twitter/index.js +++ b/example-apps/oauth1-twitter/index.js @@ -20,14 +20,14 @@ const App = { // If you want your trigger to show up, you better include it here! triggers: { - [LikeTrigger.key]: LikeTrigger + [LikeTrigger.key]: LikeTrigger, }, // If you want your searches to show up, you better include it here! searches: {}, // If you want your creates to show up, you better include it here! - creates: {} + creates: {}, }; // Finally, export the app. diff --git a/example-apps/oauth1-twitter/triggers/like.js b/example-apps/oauth1-twitter/triggers/like.js index baf2727a5..b2cc4495b 100644 --- a/example-apps/oauth1-twitter/triggers/like.js +++ b/example-apps/oauth1-twitter/triggers/like.js @@ -4,12 +4,12 @@ module.exports = { display: { label: 'New Like', - description: 'Triggers when you like a tweet.' + description: 'Triggers when you like a tweet.', }, operation: { perform: { - url: 'https://api.twitter.com/1.1/favorites/list.json' + url: 'https://api.twitter.com/1.1/favorites/list.json', }, sample: { coordinates: null, @@ -21,10 +21,9 @@ module.exports = { entities: { urls: [], hashtags: [], - user_mentions: [] + user_mentions: [], }, - text: - "Note to self: don't die during off-peak hours on a holiday weekend.", + text: "Note to self: don't die during off-peak hours on a holiday weekend.", contributors: null, id: 243014525132091400, retweet_count: 0, @@ -49,8 +48,8 @@ module.exports = { profile_link_color: '2FC2EF', entities: { description: { - urls: [] - } + urls: [], + }, }, favourites_count: 594, url: null, @@ -82,7 +81,7 @@ module.exports = { statuses_count: 2629, following: true, screen_name: 'theSeanCook', - show_all_inline_media: true + show_all_inline_media: true, }, place: { name: 'San Francisco', @@ -97,15 +96,15 @@ module.exports = { [-122.51368188, 37.70813196], [-122.35845384, 37.70813196], [-122.35845384, 37.83245301], - [-122.51368188, 37.83245301] - ] + [-122.51368188, 37.83245301], + ], ], - type: 'Polygon' + type: 'Polygon', }, full_name: 'San Francisco, CA', - place_type: 'city' + place_type: 'city', }, - in_reply_to_status_id: null - } - } + in_reply_to_status_id: null, + }, + }, }; diff --git a/example-apps/onedrive/.eslintrc.json b/example-apps/onedrive/.eslintrc.json index 454c3349d..61203657d 100644 --- a/example-apps/onedrive/.eslintrc.json +++ b/example-apps/onedrive/.eslintrc.json @@ -11,19 +11,19 @@ "comma-spacing": 2, "consistent-return": 2, "curly": [2, "all"], - "dot-notation": [2, {"allowKeywords": true}], + "dot-notation": [2, { "allowKeywords": true }], "eol-last": 2, "eqeqeq": [2, "smart"], "indent": [2, 2], "jsx-quotes": [2, "prefer-double"], - "key-spacing": [2, {"beforeColon": false, "afterColon": true}], + "key-spacing": [2, { "beforeColon": false, "afterColon": true }], "keyword-spacing": 2, "new-cap": 0, "new-parens": 2, "no-alert": 2, "no-array-constructor": 2, "no-caller": 2, - "no-console": [2, {"allow": ["info", "warn", "error"]}], + "no-console": [2, { "allow": ["info", "warn", "error"] }], "no-delete-var": 2, "no-eval": 2, "no-extend-native": 2, @@ -59,14 +59,21 @@ "no-undef-init": 2, "no-underscore-dangle": 0, "no-unused-expressions": 2, - "no-unused-vars": [2, {"vars": "all", "args": "after-used", "varsIgnorePattern": "should"}], + "no-unused-vars": [ + 2, + { "vars": "all", "args": "after-used", "varsIgnorePattern": "should" } + ], "no-use-before-define": 2, "no-with": 2, - "quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}], + "quotes": [ + 2, + "single", + { "avoidEscape": true, "allowTemplateLiterals": true } + ], "semi": 2, - "semi-spacing": [2, {"before": false, "after": true}], + "semi-spacing": [2, { "before": false, "after": true }], "space-infix-ops": 2, - "space-unary-ops": [2, {"words": true, "nonwords": false}], + "space-unary-ops": [2, { "words": true, "nonwords": false }], "strict": [0, "never"], "yoda": [2, "never"] }, diff --git a/example-apps/onedrive/before-handlers.js b/example-apps/onedrive/before-handlers.js index 739bc9061..15d6d7bfb 100644 --- a/example-apps/onedrive/before-handlers.js +++ b/example-apps/onedrive/before-handlers.js @@ -1,14 +1,14 @@ -'use strict'; +'use strict' // This adds the needed auth header to a request. By registering this on the // app's `beforeRequest` section, every z.request() call will run this function. const includeBearerToken = (request, z, bundle) => { if (bundle.authData.access_token) { - request.headers.Authorization = `Bearer ${bundle.authData.access_token}`; + request.headers.Authorization = `Bearer ${bundle.authData.access_token}` } - return request; -}; + return request +} module.exports = { - includeBearerToken -}; + includeBearerToken, +} diff --git a/example-apps/onedrive/constants.js b/example-apps/onedrive/constants.js index 9c30b89cf..269f4b4fa 100644 --- a/example-apps/onedrive/constants.js +++ b/example-apps/onedrive/constants.js @@ -8,5 +8,5 @@ const BINARY_CONTENT_MSG = 'Binary contents unsupported.' module.exports = { BASE_ITEM_URL, BIG_FILE_MSG, - BINARY_CONTENT_MSG + BINARY_CONTENT_MSG, } diff --git a/example-apps/onedrive/hydrators.js b/example-apps/onedrive/hydrators.js index 653e5b373..c70a89872 100644 --- a/example-apps/onedrive/hydrators.js +++ b/example-apps/onedrive/hydrators.js @@ -6,12 +6,12 @@ const getStringByteSize = utils.getStringByteSize const { BASE_ITEM_URL, BIG_FILE_MSG, - BINARY_CONTENT_MSG + BINARY_CONTENT_MSG, } = require('./constants') const getFileContents = (z, bundle) => { const options = { - url: `${BASE_ITEM_URL}/me/drive/items/${bundle.inputData.id}/content` + url: `${BASE_ITEM_URL}/me/drive/items/${bundle.inputData.id}/content`, } return z @@ -46,5 +46,5 @@ const getFileContents = (z, bundle) => { } module.exports = { - getFileContents + getFileContents, } diff --git a/example-apps/onedrive/index.js b/example-apps/onedrive/index.js index ba33c3c33..9f35fa6e8 100644 --- a/example-apps/onedrive/index.js +++ b/example-apps/onedrive/index.js @@ -29,7 +29,7 @@ const App = { */ resources: { [folder.key]: folder, - [file.key]: file + [file.key]: file, }, triggers: {}, @@ -40,8 +40,8 @@ const App = { * allow users to create plain text files, so we register that create here. */ creates: { - [createTextFile.key]: createTextFile - } + [createTextFile.key]: createTextFile, + }, } module.exports = App diff --git a/example-apps/onedrive/test/authentication.js b/example-apps/onedrive/test/authentication.js index fcef218af..c72a8fba0 100644 --- a/example-apps/onedrive/test/authentication.js +++ b/example-apps/onedrive/test/authentication.js @@ -14,8 +14,8 @@ describe('Authentication', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' - } + accountType: 'personal', + }, } appTester(App.authentication.oauth2Config.refreshAccessToken, bundle) @@ -32,11 +32,11 @@ describe('Authentication', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - accountType: 'personal' - } + accountType: 'personal', + }, } appTester(App.authentication.test, bundle) @@ -55,12 +55,12 @@ describe('Authentication', () => { inputData: { state: '4444', redirect_uri: 'https://zapier.com/', - accountType: 'personal' + accountType: 'personal', }, environment: { CLIENT_ID: '1234', - CLIENT_SECRET: 'asdf' - } + CLIENT_SECRET: 'asdf', + }, } appTester(App.authentication.oauth2Config.authorizeUrl, bundle) diff --git a/example-apps/onedrive/test/creates/text-file.js b/example-apps/onedrive/test/creates/text-file.js index 10910e46a..94796c2ea 100644 --- a/example-apps/onedrive/test/creates/text-file.js +++ b/example-apps/onedrive/test/creates/text-file.js @@ -21,13 +21,13 @@ describe('Create Text File', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { folder: '', file, - name - } + name, + }, } appTester(App.creates.textFile.operation.perform, bundle) @@ -53,13 +53,13 @@ describe('Create Text File', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { folder: TEST_RESOURCES.folder.path, name, - file - } + file, + }, } appTester(App.creates.textFile.operation.perform, bundle) @@ -85,13 +85,13 @@ describe('Create Text File', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { folder: '', file, - name - } + name, + }, } appTester(App.creates.textFile.operation.perform, bundle) diff --git a/example-apps/onedrive/test/hydrators.js b/example-apps/onedrive/test/hydrators.js index e9191ab7e..67a2253e0 100644 --- a/example-apps/onedrive/test/hydrators.js +++ b/example-apps/onedrive/test/hydrators.js @@ -14,11 +14,11 @@ describe('Hydrators', () => { it('should get file contents', (done) => { const bundle = { authData: { - access_token: process.env.ACCESS_TOKEN + access_token: process.env.ACCESS_TOKEN, }, inputData: { - id: TEST_RESOURCES.root.id - } + id: TEST_RESOURCES.root.id, + }, } appTester(App.hydrators.getFileContents, bundle) diff --git a/example-apps/onedrive/test/resources/file.js b/example-apps/onedrive/test/resources/file.js index efbacba39..da5547f0a 100644 --- a/example-apps/onedrive/test/resources/file.js +++ b/example-apps/onedrive/test/resources/file.js @@ -18,11 +18,11 @@ describe('File Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - id: TEST_RESOURCES.root.id - } + id: TEST_RESOURCES.root.id, + }, } appTester(App.resources.file.get.operation.perform, bundle) @@ -49,11 +49,11 @@ describe('File Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - folder: '' - } + folder: '', + }, } appTester(App.resources.file.list.operation.perform, bundle) @@ -74,11 +74,11 @@ describe('File Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - folder: '' - } + folder: '', + }, } appTester(App.resources.file.list.operation.perform, bundle) @@ -106,13 +106,13 @@ describe('File Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { folder: '', file, - name - } + name, + }, } appTester(App.resources.file.create.operation.perform, bundle) @@ -150,12 +150,12 @@ describe('File Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { folder: '', - name: 'sample' - } + name: 'sample', + }, } appTester(App.resources.file.search.operation.perform, bundle) diff --git a/example-apps/onedrive/test/resources/folder.js b/example-apps/onedrive/test/resources/folder.js index e235c9cab..eed04c97b 100644 --- a/example-apps/onedrive/test/resources/folder.js +++ b/example-apps/onedrive/test/resources/folder.js @@ -18,11 +18,11 @@ describe('Folder Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - id: TEST_RESOURCES.folder.id - } + id: TEST_RESOURCES.folder.id, + }, } appTester(App.resources.folder.get.operation.perform, bundle) @@ -49,14 +49,14 @@ describe('Folder Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - folder: '' + folder: '', }, meta: { - prefill: false - } + prefill: false, + }, } appTester(App.resources.folder.list.operation.perform, bundle) @@ -80,14 +80,14 @@ describe('Folder Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - folder: TEST_RESOURCES.childFolder.path + folder: TEST_RESOURCES.childFolder.path, }, meta: { - prefill: false - } + prefill: false, + }, } appTester(App.resources.folder.list.operation.perform, bundle) @@ -116,14 +116,14 @@ describe('Folder Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - folder: TEST_RESOURCES.childFolder.path + folder: TEST_RESOURCES.childFolder.path, }, meta: { - prefill: true - } + prefill: true, + }, } appTester(App.resources.folder.list.operation.perform, bundle) @@ -152,14 +152,14 @@ describe('Folder Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { - folder: '' + folder: '', }, meta: { - prefill: false - } + prefill: false, + }, } appTester(App.resources.folder.list.operation.perform, bundle) @@ -185,12 +185,12 @@ describe('Folder Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { folder: '', - name - } + name, + }, } appTester(App.resources.folder.create.operation.perform, bundle) @@ -217,12 +217,12 @@ describe('Folder Resource', () => { authData: { access_token: process.env.ACCESS_TOKEN, refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' + accountType: 'personal', }, inputData: { folder: '', - name: 'Documents' - } + name: 'Documents', + }, } appTester(App.resources.folder.search.operation.perform, bundle) diff --git a/example-apps/onedrive/test/test-utils.js b/example-apps/onedrive/test/test-utils.js index 916131490..b5869250d 100644 --- a/example-apps/onedrive/test/test-utils.js +++ b/example-apps/onedrive/test/test-utils.js @@ -26,8 +26,8 @@ const globalBeforeSetup = (done) => { authData: { access_token: '', refresh_token: process.env.REFRESH_TOKEN, - accountType: 'personal' - } + accountType: 'personal', + }, } appTester(App.authentication.oauth2Config.refreshAccessToken, bundle) @@ -54,30 +54,30 @@ const TEST_RESOURCES = { id: '', name: 'sample.pdf', path: '/sample.pdf', - parent: '' + parent: '', }, nested: { id: '', name: 'test.txt', path: '/Documents/Testing/test.txt', - parent: '/Documents/Testing' + parent: '/Documents/Testing', }, folder: { id: '', name: 'Documents', path: '/Documents', - parent: '' + parent: '', }, childFolder: { id: '', name: 'Testing', path: '/Documents/Testing', - parent: '/Documents' - } + parent: '/Documents', + }, } module.exports = { globalBeforeSetup, - TEST_RESOURCES + TEST_RESOURCES, } diff --git a/example-apps/onedrive/test/utils.js b/example-apps/onedrive/test/utils.js index b78ac1148..e9194a21b 100644 --- a/example-apps/onedrive/test/utils.js +++ b/example-apps/onedrive/test/utils.js @@ -45,20 +45,20 @@ describe('Utils', () => { const tests = [ { string: 'asd', - expected: 3 + expected: 3, }, { string: '@€£¶‰dfg', - expected: 14 + expected: 14, }, { string: '÷¶[]÷d()ß-°ú', - expected: 18 + expected: 18, }, { string: 'ç€is-æ', - expected: 10 - } + expected: 10, + }, ] tests.forEach((test) => diff --git a/example-apps/onedrive/utils.js b/example-apps/onedrive/utils.js index 16d4a88af..d1ce36ad6 100644 --- a/example-apps/onedrive/utils.js +++ b/example-apps/onedrive/utils.js @@ -112,9 +112,8 @@ const getFileDetailsFromRequest = (url) => const disposition = response.headers.get('content-disposition') if (disposition) { - fileDetails.filename = contentDisposition.parse( - disposition - ).parameters.filename + fileDetails.filename = + contentDisposition.parse(disposition).parameters.filename } return response.buffer() diff --git a/example-apps/resource/index.js b/example-apps/resource/index.js index f3c3b2756..533994736 100644 --- a/example-apps/resource/index.js +++ b/example-apps/resource/index.js @@ -19,7 +19,7 @@ const App = { // If you want your resource to show up, you better include it here! resources: { - [Recipe.key]: Recipe + [Recipe.key]: Recipe, }, // If you want your trigger to show up, you better include it here! @@ -29,7 +29,7 @@ const App = { searches: {}, // If you want your creates to show up, you better include it here! - creates: {} + creates: {}, }; // Finally, export the app. diff --git a/example-apps/resource/test/resources/recipe.js b/example-apps/resource/test/resources/recipe.js index 30d1b9ec7..d891b8f30 100644 --- a/example-apps/resource/test/resources/recipe.js +++ b/example-apps/resource/test/resources/recipe.js @@ -8,15 +8,15 @@ const App = require('../../index'); const appTester = zapier.createAppTester(App); describe('recipe resource', () => { - it('should get an existing recipe', done => { + it('should get an existing recipe', (done) => { const bundle = { inputData: { - id: 1 - } + id: 1, + }, }; appTester(App.resources.recipe.get.operation.perform, bundle) - .then(results => { + .then((results) => { results.name.should.eql('name 1'); results.directions.should.eql('directions 1'); done(); @@ -24,15 +24,15 @@ describe('recipe resource', () => { .catch(done); }); - it('should list existing recipes', done => { + it('should list existing recipes', (done) => { const bundle = { inputData: { - style: 'style 2' - } + style: 'style 2', + }, }; appTester(App.resources.recipe.list.operation.perform, bundle) - .then(results => { + .then((results) => { results.length.should.above(0); const firstRecipe = results[0]; @@ -43,32 +43,32 @@ describe('recipe resource', () => { .catch(done); }); - it('should create a new recipe', done => { + it('should create a new recipe', (done) => { const bundle = { inputData: { name: 'Smith Family Recipe', directions: '1. Order out :)', - authorId: 1 - } + authorId: 1, + }, }; appTester(App.resources.recipe.create.operation.perform, bundle) - .then(results => { + .then((results) => { results.should.have.property('name'); done(); }) .catch(done); }); - it('should find a recipe', done => { + it('should find a recipe', (done) => { const bundle = { inputData: { - name: 'Smith Family Recipe' - } + name: 'Smith Family Recipe', + }, }; appTester(App.resources.recipe.search.operation.perform, bundle) - .then(results => { + .then((results) => { results[0].should.have.property('name'); done(); }) diff --git a/example-apps/rest-hooks/index.js b/example-apps/rest-hooks/index.js index e8b9756f4..a881da07b 100644 --- a/example-apps/rest-hooks/index.js +++ b/example-apps/rest-hooks/index.js @@ -15,14 +15,14 @@ const App = { // If you want your trigger to show up, you better include it here! triggers: { - [recipe.key]: recipe + [recipe.key]: recipe, }, // If you want your searches to show up, you better include it here! searches: {}, // If you want your creates to show up, you better include it here! - creates: {} + creates: {}, }; // Finally, export the app. diff --git a/example-apps/rest-hooks/test/triggers.js b/example-apps/rest-hooks/test/triggers.js index b9f880cc9..e4e83032b 100644 --- a/example-apps/rest-hooks/test/triggers.js +++ b/example-apps/rest-hooks/test/triggers.js @@ -9,20 +9,20 @@ const appTester = zapier.createAppTester(App); describe('triggers', () => { describe('new recipe trigger', () => { - it('should load recipe from fake hook', done => { + it('should load recipe from fake hook', (done) => { const bundle = { inputData: { - style: 'mediterranean' + style: 'mediterranean', }, cleanedRequest: { id: 1, name: 'name 1', - directions: 'directions 1' - } + directions: 'directions 1', + }, }; appTester(App.triggers.recipe.operation.perform, bundle) - .then(results => { + .then((results) => { results.length.should.eql(1); const firstRecipe = results[0]; @@ -34,18 +34,18 @@ describe('triggers', () => { .catch(done); }); - it('should load recipe from list', done => { + it('should load recipe from list', (done) => { const bundle = { inputData: { - style: 'mediterranean' + style: 'mediterranean', }, meta: { - frontend: true - } + frontend: true, + }, }; appTester(App.triggers.recipe.operation.performList, bundle) - .then(results => { + .then((results) => { results.length.should.be.greaterThan(1); const firstRecipe = results[0]; diff --git a/example-apps/search/index.js b/example-apps/search/index.js index 3e49a7100..20cd8a6d6 100644 --- a/example-apps/search/index.js +++ b/example-apps/search/index.js @@ -24,11 +24,11 @@ const App = { // If you want your searches to show up, you better include it here! searches: { - [search.key]: search + [search.key]: search, }, // If you want your creates to show up, you better include it here! - creates: {} + creates: {}, }; // Finally, export the app. diff --git a/example-apps/search/test/searches.js b/example-apps/search/test/searches.js index afab374c6..6a246f308 100644 --- a/example-apps/search/test/searches.js +++ b/example-apps/search/test/searches.js @@ -9,15 +9,15 @@ const appTester = zapier.createAppTester(App); describe('searches', () => { describe('search recipe', () => { - it('should find a recipe', done => { + it('should find a recipe', (done) => { const bundle = { inputData: { - style: 'style 2' - } + style: 'style 2', + }, }; appTester(App.searches.recipe.operation.perform, bundle) - .then(results => { + .then((results) => { results.length.should.be.aboveOrEqual(1); const firstRecipe = results[0]; diff --git a/example-apps/trigger/index.js b/example-apps/trigger/index.js index cd16d4067..92421461d 100644 --- a/example-apps/trigger/index.js +++ b/example-apps/trigger/index.js @@ -21,14 +21,14 @@ const App = { // If you want your trigger to show up, you better include it here! triggers: { - [recipe.key]: recipe + [recipe.key]: recipe, }, // If you want your searches to show up, you better include it here! searches: {}, // If you want your creates to show up, you better include it here! - creates: {} + creates: {}, }; // Finally, export the app. diff --git a/package.json b/package.json index 957e0e443..3edcfbb61 100644 --- a/package.json +++ b/package.json @@ -46,10 +46,11 @@ "eslint --fix --quiet" ], "*.{js,json}": [ - "prettier --write" + "prettier --write --ignore-path=.prettierignore" ] }, "prettier": { - "singleQuote": true + "singleQuote": true, + "trailingComma": "es5" } } diff --git a/packages/cli/src/oclif/commands/canary/list.js b/packages/cli/src/oclif/commands/canary/list.js index 587d4f567..c43c6f29f 100644 --- a/packages/cli/src/oclif/commands/canary/list.js +++ b/packages/cli/src/oclif/commands/canary/list.js @@ -7,11 +7,11 @@ class CanaryListCommand extends ZapierBaseCommand { async perform() { const canaries = await listCanaries(); - const formattedCanaries = canaries.objects.map(c => ({ + const formattedCanaries = canaries.objects.map((c) => ({ from_version: c.from_version, to_version: c.to_version, percent: c.percent, - seconds_remaining: c.until_timestamp - Math.floor(Date.now() / 1000) + seconds_remaining: c.until_timestamp - Math.floor(Date.now() / 1000), })); this.log(bold('Active Canaries') + '\n'); @@ -23,16 +23,14 @@ class CanaryListCommand extends ZapierBaseCommand { ['Traffic Amount', 'percent'], ['Seconds Remaining', 'seconds_remaining'], ], - emptyMessage: grey( - `No active canary deployments found.` - ), + emptyMessage: grey(`No active canary deployments found.`), }); } } CanaryListCommand.flags = buildFlags({ opts: { format: true } }); CanaryListCommand.description = 'List all active canary deployments'; -CanaryListCommand.examples = ['zapier canary:list'] +CanaryListCommand.examples = ['zapier canary:list']; CanaryListCommand.skipValidInstallCheck = true; -module.exports = CanaryListCommand; \ No newline at end of file +module.exports = CanaryListCommand; diff --git a/packages/cli/src/oclif/commands/promote.js b/packages/cli/src/oclif/commands/promote.js index 36b101716..9d46103e8 100644 --- a/packages/cli/src/oclif/commands/promote.js +++ b/packages/cli/src/oclif/commands/promote.js @@ -52,9 +52,8 @@ class PromoteCommand extends BaseCommand { const assumeYes = 'yes' in this.flags; let shouldContinue; - const { changelog, appMetadata, issueMetadata } = await getVersionChangelog( - version - ); + const { changelog, appMetadata, issueMetadata } = + await getVersionChangelog(version); const metadataPromptHelper = `Issues are indicated by ${colors.bold.underline( '#' diff --git a/packages/cli/src/oclif/commands/team/add.js b/packages/cli/src/oclif/commands/team/add.js index 1553b9184..a59b8b587 100644 --- a/packages/cli/src/oclif/commands/team/add.js +++ b/packages/cli/src/oclif/commands/team/add.js @@ -42,8 +42,8 @@ class TeamAddCommand extends ZapierBaseCommand { role === 'admin' ? `/apps/${id}/collaborators` : role === 'subscriber' - ? `${BASE_ENDPOINT}/api/platform/v3/integrations/${id}/subscribers` - : `/apps/${id}/limited_collaborators`; + ? `${BASE_ENDPOINT}/api/platform/v3/integrations/${id}/subscribers` + : `/apps/${id}/limited_collaborators`; await callAPI(url, { url: url.startsWith('http') ? url : undefined, diff --git a/packages/cli/src/oclif/commands/team/remove.js b/packages/cli/src/oclif/commands/team/remove.js index 3eac469eb..b8f924c45 100644 --- a/packages/cli/src/oclif/commands/team/remove.js +++ b/packages/cli/src/oclif/commands/team/remove.js @@ -49,8 +49,8 @@ class TeamRemoveCommand extends ZapierBaseCommand { role === 'admin' ? `/apps/${appId}/collaborators/${invitationId}` : role === 'subscriber' - ? `${BASE_ENDPOINT}/api/platform/v3/integrations/${appId}/subscribers/${invitationId}` - : `/apps/${appId}/limited_collaborators`; + ? `${BASE_ENDPOINT}/api/platform/v3/integrations/${appId}/subscribers/${invitationId}` + : `/apps/${appId}/limited_collaborators`; await callAPI(url, { url: url.startsWith('http') ? url : undefined, diff --git a/packages/cli/src/tests/fixtures/registerFieldChoices.js b/packages/cli/src/tests/fixtures/registerFieldChoices.js index afa5cbfb5..da6926833 100644 --- a/packages/cli/src/tests/fixtures/registerFieldChoices.js +++ b/packages/cli/src/tests/fixtures/registerFieldChoices.js @@ -2,13 +2,11 @@ module.exports = { intention: [ { value: 'global', - name: - "Public: I'm evaluating making my app available to the entire Zapier ecosystem", + name: "Public: I'm evaluating making my app available to the entire Zapier ecosystem", }, { value: 'private', - name: - "Private: I'm building an integration for personal use or to explore the Zapier platform", + name: "Private: I'm building an integration for personal use or to explore the Zapier platform", }, ], role: [ diff --git a/packages/cli/src/utils/api.js b/packages/cli/src/utils/api.js index 41208afe7..9544dfc3d 100644 --- a/packages/cli/src/utils/api.js +++ b/packages/cli/src/utils/api.js @@ -162,22 +162,19 @@ const createCanary = async (versionFrom, versionTo, percent, duration) => { method: 'POST', body: { percent, - duration - } + duration, + }, } - ) -} + ); +}; const listCanaries = async () => { const linkedAppId = (await getLinkedAppConfig(undefined, true))?.id; - return callAPI( - `/apps/${linkedAppId}/canaries`, - { - method: 'GET', - } - ) -} + return callAPI(`/apps/${linkedAppId}/canaries`, { + method: 'GET', + }); +}; const deleteCanary = async (versionFrom, versionTo) => { const linkedAppId = (await getLinkedAppConfig(undefined, true))?.id; @@ -187,8 +184,8 @@ const deleteCanary = async (versionFrom, versionTo) => { { method: 'DELETE', } - ) -} + ); +}; /** * read local `apprc` file diff --git a/packages/cli/src/utils/build.js b/packages/cli/src/utils/build.js index f5150e437..ac5c219ef 100644 --- a/packages/cli/src/utils/build.js +++ b/packages/cli/src/utils/build.js @@ -285,10 +285,9 @@ const maybeRunBuildScript = async (options = {}) => { // Make sure we don't accidentally call the Zapier build hook inside itself if (process.env.npm_lifecycle_event !== ZAPIER_BUILD_KEY) { - const pJson = require(path.resolve( - options.cwd || process.cwd(), - 'package.json' - )); + const pJson = require( + path.resolve(options.cwd || process.cwd(), 'package.json') + ); if (_.get(pJson, ['scripts', ZAPIER_BUILD_KEY])) { startSpinner(`Running ${ZAPIER_BUILD_KEY} script`); diff --git a/packages/cli/src/utils/convert.js b/packages/cli/src/utils/convert.js index 98f6c8686..937f1cd0c 100644 --- a/packages/cli/src/utils/convert.js +++ b/packages/cli/src/utils/convert.js @@ -49,12 +49,12 @@ const prettifyJSON = (origString) => JSON.stringify(origString, null, 2); const renderTemplate = async ( templateFile, templateContext, - prettify = true, + prettify = true ) => { const templateBuf = await readFile(templateFile); const template = templateBuf.toString(); let content = _.template(template, { interpolate: /<%=([\s\S]+?)%>/g })( - templateContext, + templateContext ); if (prettify) { @@ -101,7 +101,7 @@ const getAuthFieldKeys = (appDefinition) => { const renderPackageJson = async (appInfo, appDefinition) => { const name = _.kebabCase( - appInfo.title || _.get(appInfo, ['general', 'title']), + appInfo.title || _.get(appInfo, ['general', 'title']) ); // Not using escapeSpecialChars because we don't want to escape single quotes (not @@ -182,7 +182,7 @@ const renderSource = (definition, functions = {}) => { funcName = `${funcNameBase}${funcNum}`; } functions[funcName] = `const ${funcName} = async (${args.join( - ', ', + ', ' )}) => {\n${source}\n};`; this.parent.update(makePlaceholder(funcName)); @@ -197,7 +197,7 @@ const renderDefinitionSlice = async (definitionSlice, filename) => { renderSource(exportBlock, functionBlock); exportBlock = `module.exports = ${replacePlaceholders( - JSON.stringify(exportBlock), + JSON.stringify(exportBlock) )};\n`; functionBlock = Object.values(functionBlock).join('\n\n'); @@ -208,9 +208,8 @@ const renderDefinitionSlice = async (definitionSlice, filename) => { } catch (err) { console.warn( `Warning: Your code has syntax error in ${chalk.underline.bold( - filename, - )}. ` + - `It will be left as is and won't be prettified.\n\n${err.message}`, + filename + )}. ` + `It will be left as is and won't be prettified.\n\n${err.message}` ); return uglyCode; } @@ -241,7 +240,7 @@ const renderIndex = async (appDefinition) => { // replace version and platformVersion with dynamic reference exportBlock.version = makePlaceholder("require('./package.json').version"); exportBlock.platformVersion = makePlaceholder( - "require('zapier-platform-core').version", + "require('zapier-platform-core').version" ); if (appDefinition.authentication) { @@ -272,7 +271,7 @@ const renderIndex = async (appDefinition) => { exportBlock[stepType][makePlaceholder(`[${importName}.key]`)] = makePlaceholder(importName); }); - }, + } ); if (!_.isEmpty(appDefinition.hydrators)) { @@ -285,20 +284,20 @@ const renderIndex = async (appDefinition) => { if (appDefinition.legacy && appDefinition.legacy.scriptingSource) { importBlock.push("\nconst fs = require('fs');"); importBlock.push( - "const scriptingSource = fs.readFileSync('./scripting.js', { encoding: 'utf8' });", + "const scriptingSource = fs.readFileSync('./scripting.js', { encoding: 'utf8' });" ); exportBlock.legacy.scriptingSource = makePlaceholder('scriptingSource'); } exportBlock = `module.exports = ${replacePlaceholders( - JSON.stringify(exportBlock), + JSON.stringify(exportBlock) )};`; importBlock = importBlock.join('\n'); functionBlock = Object.values(functionBlock).join('\n\n'); return prettifyJs( - importBlock + '\n\n' + functionBlock + '\n\n' + exportBlock, + importBlock + '\n\n' + functionBlock + '\n\n' + exportBlock ); }; @@ -342,7 +341,7 @@ const writeScripting = async (appDefinition, newAppDir) => { await createFile( appDefinition.legacy.scriptingSource, 'scripting.js', - newAppDir, + newAppDir ); }; @@ -388,7 +387,7 @@ const convertApp = async (appInfo, appDefinition, newAppDir) => { _.each(appDefinition[stepType], (definition, key) => { promises.push( writeStep(stepType, definition, key, newAppDir), - writeStepTest(stepType, definition, key, newAppDir), + writeStepTest(stepType, definition, key, newAppDir) ); }); }); @@ -408,7 +407,7 @@ const convertApp = async (appInfo, appDefinition, newAppDir) => { writeIndex(appDefinition, newAppDir), writeEnvironment(appDefinition, newAppDir), writeGitIgnore(newAppDir), - writeZapierAppRc(appInfo, appDefinition, newAppDir), + writeZapierAppRc(appInfo, appDefinition, newAppDir) ); return Promise.all(promises); diff --git a/packages/cli/src/utils/misc.js b/packages/cli/src/utils/misc.js index 166d4d846..2fa669ca5 100644 --- a/packages/cli/src/utils/misc.js +++ b/packages/cli/src/utils/misc.js @@ -135,10 +135,9 @@ const isValidAppInstall = () => { }; } - const installedPackageJson = require(path.join( - corePackageDir, - 'package.json' - )); + const installedPackageJson = require( + path.join(corePackageDir, 'package.json') + ); const installedCoreVersion = installedPackageJson.version; if (installedCoreVersion !== dependedCoreVersion) { @@ -210,9 +209,9 @@ const printVersionInfo = (context) => { ) ) { // double check they have the right version installed - const installedPkgVersion = require(path.resolve( - `./node_modules/${PLATFORM_PACKAGE}/package.json` - )).version; + const installedPkgVersion = require( + path.resolve(`./node_modules/${PLATFORM_PACKAGE}/package.json`) + ).version; if (requiredVersion !== installedPkgVersion) { versions.push( diff --git a/packages/cli/src/utils/team.js b/packages/cli/src/utils/team.js index f64048ede..27d3fd49d 100644 --- a/packages/cli/src/utils/team.js +++ b/packages/cli/src/utils/team.js @@ -10,8 +10,8 @@ const transformUserRole = (role) => role === 'collaborator' ? 'admin' : role === 'subscriber' - ? 'subscriber' - : 'collaborator'; + ? 'subscriber' + : 'collaborator'; const listTeamMembers = async () => { return listEndpointMulti( diff --git a/packages/core/smoke-test/smoke-test.js b/packages/core/smoke-test/smoke-test.js index af8459831..f5dd41d02 100644 --- a/packages/core/smoke-test/smoke-test.js +++ b/packages/core/smoke-test/smoke-test.js @@ -83,9 +83,8 @@ const npmPackCore = (schemaPackagePath) => { encoding: 'utf8', }); const packageJson = JSON.parse(originalPackageJsonText); - packageJson.dependencies[ - 'zapier-platform-schema' - ] = `file:${schemaPackagePath}`; + packageJson.dependencies['zapier-platform-schema'] = + `file:${schemaPackagePath}`; fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson)); let filename; diff --git a/packages/core/src/app-middlewares/before/z-object.js b/packages/core/src/app-middlewares/before/z-object.js index 8f2c295ac..c8306db08 100644 --- a/packages/core/src/app-middlewares/before/z-object.js +++ b/packages/core/src/app-middlewares/before/z-object.js @@ -30,9 +30,11 @@ const injectZObject = (input) => { hash: hashing.hashify, JSON: createJSONtool(), require: (moduleName) => - require(require.resolve(moduleName, { - paths: module.paths.concat([process.cwd()]), - })), + require( + require.resolve(moduleName, { + paths: module.paths.concat([process.cwd()]), + }) + ), stashFile: createFileStasher(input), }; diff --git a/packages/core/src/tools/create-cache.js b/packages/core/src/tools/create-cache.js index f2d6e8513..09ba6c3bd 100644 --- a/packages/core/src/tools/create-cache.js +++ b/packages/core/src/tools/create-cache.js @@ -54,7 +54,14 @@ const createCache = (input) => { set: async (key, value, ttl = null, scope = null, nx = null) => { runValidationChecks(rpc, key, value, ttl, scope, nx); - return await rpc('zcache_set', key, JSON.stringify(value), ttl, scope, nx); + return await rpc( + 'zcache_set', + key, + JSON.stringify(value), + ttl, + scope, + nx + ); }, delete: async (key, scope = null) => { runValidationChecks(rpc, key, scope); diff --git a/packages/core/test/fixtures/truncate-test-data.json b/packages/core/test/fixtures/truncate-test-data.json index c4c1ccea8..ecd2e2d5e 100644 --- a/packages/core/test/fixtures/truncate-test-data.json +++ b/packages/core/test/fixtures/truncate-test-data.json @@ -41,15 +41,8 @@ { "description": "truncateData will do its best to truncate a big string that would push it past the maxLength, but in a case where the last evaluated item isn't a string, it will just 'drop' the last evaluated item and the output length won't match the maxLength. that's okay! here's an example.", "input": [ - 1234567890, - 2345678901, - 3456789012, - 4567890123, - 5678901234, - 6789012345, - 7890123456, - 8901234567, - 9012345678 + 1234567890, 2345678901, 3456789012, 4567890123, 5678901234, 6789012345, + 7890123456, 8901234567, 9012345678 ], "maxLength": 94, "output": [ diff --git a/packages/core/test/misc-tools.js b/packages/core/test/misc-tools.js index f55aaf14c..2c52b15e4 100644 --- a/packages/core/test/misc-tools.js +++ b/packages/core/test/misc-tools.js @@ -441,7 +441,8 @@ describe('Tools', () => { }, { name: 'TypeError', - message: "Type 'function' is not JSON-encodable (path: 'foo.1.hello')", + message: + "Type 'function' is not JSON-encodable (path: 'foo.1.hello')", } ); assert.throws( diff --git a/packages/core/test/test-tools.js b/packages/core/test/test-tools.js index 6e49684f8..d864819c6 100644 --- a/packages/core/test/test-tools.js +++ b/packages/core/test/test-tools.js @@ -63,17 +63,21 @@ describe('test-tools', () => { // retrieves custom fields from API appTester.zcacheTestObj.should.eql({}); const freshResults = await appTester( - appDefinition.resources.cachedcustominputfields.list.operation.inputFields, + appDefinition.resources.cachedcustominputfields.list.operation + .inputFields, {}, - true, + true ); freshResults.should.eql(customInputFields); // retrieves custom fields from cache - _.values(appTester.zcacheTestObj).should.containDeep([JSON.stringify(customInputFields)]); + _.values(appTester.zcacheTestObj).should.containDeep([ + JSON.stringify(customInputFields), + ]); const cachedResults = await appTester( - appDefinition.resources.cachedcustominputfields.list.operation.inputFields, - {}, + appDefinition.resources.cachedcustominputfields.list.operation + .inputFields, + {} ); cachedResults.should.eql(customInputFields); }); diff --git a/packages/core/test/userapp/helpers.js b/packages/core/test/userapp/helpers.js index ba5054daa..6e6d4f87f 100644 --- a/packages/core/test/userapp/helpers.js +++ b/packages/core/test/userapp/helpers.js @@ -5,10 +5,7 @@ module.exports = { getCustomFields: async (z, bundle) => { const expensiveCustomFieldsRequestMock = async () => { return { - data: [ - { key: 'custom-field-1' }, - { key: 'custom-field-2' }, - ], + data: [{ key: 'custom-field-1' }, { key: 'custom-field-2' }], }; }; diff --git a/packages/schema/lib/functional-constraints/uniqueInputFieldKeys.js b/packages/schema/lib/functional-constraints/uniqueInputFieldKeys.js index 4ccfab90d..5f5706124 100644 --- a/packages/schema/lib/functional-constraints/uniqueInputFieldKeys.js +++ b/packages/schema/lib/functional-constraints/uniqueInputFieldKeys.js @@ -52,9 +52,8 @@ const uniqueInputFieldKeys = (definition) => { ) ); } else { - existingKeys[ - subField.key - ] = `inputFields[${index}].children[${subFieldIndex}]`; + existingKeys[subField.key] = + `inputFields[${index}].children[${subFieldIndex}]`; } }); }); diff --git a/packages/schema/lib/schemas/AppSchema.js b/packages/schema/lib/schemas/AppSchema.js index 07c57597a..9385a0b54 100644 --- a/packages/schema/lib/schemas/AppSchema.js +++ b/packages/schema/lib/schemas/AppSchema.js @@ -107,8 +107,7 @@ module.exports = makeSchema( $ref: AppFlagsSchema.id, }, throttle: { - description: - `Zapier uses this configuration to apply throttling when the limit for the window is exceeded. When set here, it is the default throttle configuration used on each action of the integration. And when set in an action's operation object, it gets overwritten for that action only.`, + description: `Zapier uses this configuration to apply throttling when the limit for the window is exceeded. When set here, it is the default throttle configuration used on each action of the integration. And when set in an action's operation object, it gets overwritten for that action only.`, $ref: ThrottleObjectSchema.id, }, legacy: { diff --git a/packages/schema/lib/schemas/BasicOperationSchema.js b/packages/schema/lib/schemas/BasicOperationSchema.js index beaa37cb0..2a2d2faa5 100644 --- a/packages/schema/lib/schemas/BasicOperationSchema.js +++ b/packages/schema/lib/schemas/BasicOperationSchema.js @@ -81,5 +81,13 @@ module.exports = makeSchema( ], additionalProperties: false, }, - [DynamicFieldsSchema, FunctionSchema, KeySchema, LockObjectSchema, RequestSchema, ResultsSchema, ThrottleObjectSchema] + [ + DynamicFieldsSchema, + FunctionSchema, + KeySchema, + LockObjectSchema, + RequestSchema, + ResultsSchema, + ThrottleObjectSchema, + ] ); diff --git a/packages/schema/lib/schemas/FieldChoiceWithLabelSchema.js b/packages/schema/lib/schemas/FieldChoiceWithLabelSchema.js index e3e218a68..6b28cc138 100644 --- a/packages/schema/lib/schemas/FieldChoiceWithLabelSchema.js +++ b/packages/schema/lib/schemas/FieldChoiceWithLabelSchema.js @@ -17,7 +17,7 @@ module.exports = makeSchema({ }, sample: { description: - "A legacy field that is no longer used by the editor, but it is still required for now and should match the value.", + 'A legacy field that is no longer used by the editor, but it is still required for now and should match the value.', type: 'string', minLength: 1, },