From b304acaaba45cf7f5201f66b389cc91abde198a8 Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Mon, 15 Jan 2024 13:02:06 +0100 Subject: [PATCH] docs: Use .js file extension --- packages/docs/pages/advanced/telemetry.md | 2 +- .../docs/pages/build-integrations/actions.md | 10 ++-- packages/docs/pages/build-integrations/app.md | 6 +- .../docs/pages/build-integrations/auth.md | 18 +++--- .../docs/pages/build-integrations/examples.md | 60 +++++++++---------- .../build-integrations/folder-structure.md | 4 +- .../build-integrations/global-variable.md | 2 +- .../docs/pages/build-integrations/triggers.md | 8 +-- .../pages/contributing/development-setup.md | 2 +- 9 files changed, 56 insertions(+), 56 deletions(-) diff --git a/packages/docs/pages/advanced/telemetry.md b/packages/docs/pages/advanced/telemetry.md index 2e1d6ba8..d1bdb8e6 100644 --- a/packages/docs/pages/advanced/telemetry.md +++ b/packages/docs/pages/advanced/telemetry.md @@ -1,7 +1,7 @@ # Telemetry :::info -We want to be very transparent about the data we collect and how we use it. Therefore, we have abstracted all of the code we use with our telemetry system into a single, easily accessible place. You can check the code [here](https://github.com/automatisch/automatisch/blob/main/packages/backend/src/helpers/telemetry/index.ts) and let us know if you have any suggestions for changes. +We want to be very transparent about the data we collect and how we use it. Therefore, we have abstracted all of the code we use with our telemetry system into a single, easily accessible place. You can check the code [here](https://github.com/automatisch/automatisch/blob/main/packages/backend/src/helpers/telemetry/index.js) and let us know if you have any suggestions for changes. ::: Automatisch comes with a built-in telemetry system that collects anonymous usage data. This data is used to help us improve the product and to make sure we are focusing on the right features. While we're doing it, we don't collect any personal information. You can also disable the telemetry system by setting the `TELEMETRY_ENABLED` environment variable. See the [environment variables](/advanced/configuration#environment-variables) section for more information. diff --git a/packages/docs/pages/build-integrations/actions.md b/packages/docs/pages/build-integrations/actions.md index 0ee90ca4..9c7a0c32 100644 --- a/packages/docs/pages/build-integrations/actions.md +++ b/packages/docs/pages/build-integrations/actions.md @@ -16,7 +16,7 @@ The build integrations section is best understood when read from beginning to en ## Add actions to the app. -Open the `thecatapi/index.ts` file and add the highlighted lines for actions. +Open the `thecatapi/index.js` file and add the highlighted lines for actions. ```javascript{4,17} import defineApp from '../../helpers/define-app'; @@ -41,7 +41,7 @@ export default defineApp({ ## Define actions -Create the `actions/index.ts` file inside of the `thecatapi` folder. +Create the `actions/index.js` file inside of the `thecatapi` folder. ```javascript import markCatImageAsFavorite from './mark-cat-image-as-favorite'; @@ -50,12 +50,12 @@ export default [markCatImageAsFavorite]; ``` :::tip -If you add new actions, you need to add them to the actions/index.ts file and export all actions as an array. +If you add new actions, you need to add them to the actions/index.js file and export all actions as an array. ::: ## Add metadata -Create the `actions/mark-cat-image-as-favorite/index.ts` file inside the `thecatapi` folder. +Create the `actions/mark-cat-image-as-favorite/index.js` file inside the `thecatapi` folder. ```javascript import defineAction from '../../../../helpers/define-action'; @@ -91,7 +91,7 @@ Let's briefly explain what we defined here. ## Implement the action -Open the `actions/mark-cat-image-as-favorite.ts` file and add the highlighted lines. +Open the `actions/mark-cat-image-as-favorite.js` file and add the highlighted lines. ```javascript{7-20} import defineAction from '../../../../helpers/define-action'; diff --git a/packages/docs/pages/build-integrations/app.md b/packages/docs/pages/build-integrations/app.md index 45692fcd..51965b71 100644 --- a/packages/docs/pages/build-integrations/app.md +++ b/packages/docs/pages/build-integrations/app.md @@ -27,14 +27,14 @@ cd packages/backend/src/apps mkdir thecatapi ``` -We need to create an `index.ts` file inside of the `thecatapi` folder. +We need to create an `index.js` file inside of the `thecatapi` folder. ```bash cd thecatapi -touch index.ts +touch index.js ``` -Then let's define the app inside of the `index.ts` file as follows: +Then let's define the app inside of the `index.js` file as follows: ```javascript import defineApp from '../../helpers/define-app'; diff --git a/packages/docs/pages/build-integrations/auth.md b/packages/docs/pages/build-integrations/auth.md index 52edd572..44993abd 100644 --- a/packages/docs/pages/build-integrations/auth.md +++ b/packages/docs/pages/build-integrations/auth.md @@ -24,7 +24,7 @@ You can find detailed documentation of the cat API [here](https://docs.thecatapi ## Add auth to the app -Open the `thecatapi/index.ts` file and add the highlighted lines for authentication. +Open the `thecatapi/index.js` file and add the highlighted lines for authentication. ```javascript{2,13} import defineApp from '../../helpers/define-app'; @@ -45,14 +45,14 @@ export default defineApp({ ## Define auth fields -Let's create the `auth/index.ts` file inside of the `thecatapi` folder. +Let's create the `auth/index.js` file inside of the `thecatapi` folder. ```bash mkdir auth -touch auth/index.ts +touch auth/index.js ``` -Then let's start with defining fields the auth inside of the `auth/index.ts` file as follows: +Then let's start with defining fields the auth inside of the `auth/index.js` file as follows: ```javascript export default { @@ -101,7 +101,7 @@ If the third-party service you use provides both an API key and OAuth for the au So until now, we integrated auth folder with the app definition and defined the auth fields. Now we need to verify the credentials that the user entered. We will do that by defining the `verifyCredentials` method. -Start with adding the `verifyCredentials` method to the `auth/index.ts` file. +Start with adding the `verifyCredentials` method to the `auth/index.js` file. ```javascript{1,8} import verifyCredentials from './verify-credentials'; @@ -115,7 +115,7 @@ export default { }; ``` -Let's create the `verify-credentials.ts` file inside the `auth` folder. +Let's create the `verify-credentials.js` file inside the `auth` folder. ```javascript const verifyCredentials = async ($: IGlobalVariable) => { @@ -127,7 +127,7 @@ export default verifyCredentials; We generally use the `users/me` endpoint or any other endpoint that we can validate the API key or any other credentials that the user provides. For our example, we don't have a specific API endpoint to check whether the credentials are correct or not. So we will randomly pick one of the API endpoints, which will be the `GET /v1/images/search` endpoint. We will send a request to this endpoint with the API key. If the API key is correct, we will get a response from the API. If the API key is incorrect, we will get an error response from the API. -Let's implement the authentication logic that we mentioned above in the `verify-credentials.ts` file. +Let's implement the authentication logic that we mentioned above in the `verify-credentials.js` file. ```javascript const verifyCredentials = async ($: IGlobalVariable) => { @@ -151,7 +151,7 @@ You must always provide a `screenName` field to auth data in the `verifyCredenti We have implemented the `verifyCredentials` method. Now we need to check whether the credentials are still valid or not for the test connection functionality in Automatisch. We will do that by defining the `isStillVerified` method. -Start with adding the `isStillVerified` method to the `auth/index.ts` file. +Start with adding the `isStillVerified` method to the `auth/index.js` file. ```javascript{2,10} import verifyCredentials from './verify-credentials'; @@ -167,7 +167,7 @@ export default { }; ``` -Let's create the `is-still-verified.ts` file inside the `auth` folder. +Let's create the `is-still-verified.js` file inside the `auth` folder. ```javascript import verifyCredentials from './verify-credentials'; diff --git a/packages/docs/pages/build-integrations/examples.md b/packages/docs/pages/build-integrations/examples.md index 3acb1c80..d8c89ccd 100644 --- a/packages/docs/pages/build-integrations/examples.md +++ b/packages/docs/pages/build-integrations/examples.md @@ -18,35 +18,35 @@ The build integrations section is best understood when read from beginning to en ### 3-legged OAuth -- [Discord](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/discord/auth/index.ts) -- [Flickr](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/flickr/auth/index.ts) -- [Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/auth/index.ts) -- [Salesforce](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/salesforce/auth/index.ts) -- [Slack](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/slack/auth/index.ts) -- [Twitter](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twitter/auth/index.ts) +- [Discord](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/discord/auth/index.js) +- [Flickr](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/flickr/auth/index.js) +- [Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/auth/index.js) +- [Salesforce](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/salesforce/auth/index.js) +- [Slack](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/slack/auth/index.js) +- [Twitter](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twitter/auth/index.js) ### OAuth with the refresh token -- [Salesforce](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/salesforce/auth/index.ts) +- [Salesforce](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/salesforce/auth/index.js) ### API key -- [DeepL](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/deepl/auth/index.ts) -- [Twilio](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twilio/auth/index.ts) -- [SignalWire](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/signalwire/auth/index.ts) -- [SMTP](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/smtp/auth/index.ts) +- [DeepL](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/deepl/auth/index.js) +- [Twilio](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twilio/auth/index.js) +- [SignalWire](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/signalwire/auth/index.js) +- [SMTP](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/smtp/auth/index.js) ### Without authentication -- [RSS](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/rss/index.ts) -- [Scheduler](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/scheduler/index.ts) +- [RSS](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/rss/index.js) +- [Scheduler](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/scheduler/index.js) ## Triggers ### Polling-based triggers -- [Search tweets - Twitter](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twitter/triggers/search-tweets/index.ts) -- [New issues - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/triggers/new-issues/index.ts) +- [Search tweets - Twitter](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twitter/triggers/search-tweets/index.js) +- [New issues - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/triggers/new-issues/index.js) ### Webhook-based triggers @@ -54,27 +54,27 @@ The build integrations section is best understood when read from beginning to en If you are developing a webhook-based trigger, you need to ensure that the webhook is publicly accessible. You can use [ngrok](https://ngrok.com) for this purpose and override the webhook URL by setting the **WEBHOOK_URL** environment variable. ::: -- [New entry - Typeform](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/typeform/triggers/new-entry/index.ts) +- [New entry - Typeform](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/typeform/triggers/new-entry/index.js) ### Pagination with descending order -- [Search tweets - Twitter](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twitter/triggers/search-tweets/index.ts) -- [New issues - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/triggers/new-issues/index.ts) -- [Receive SMS - Twilio](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twilio/triggers/receive-sms/index.ts) -- [Receive SMS - SignalWire](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/signalwire/triggers/receive-sms/index.ts) -- [New photos - Flickr](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/flickr/triggers/new-photos/index.ts) +- [Search tweets - Twitter](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twitter/triggers/search-tweets/index.js) +- [New issues - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/triggers/new-issues/index.js) +- [Receive SMS - Twilio](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twilio/triggers/receive-sms/index.js) +- [Receive SMS - SignalWire](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/signalwire/triggers/receive-sms/index.js) +- [New photos - Flickr](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/flickr/triggers/new-photos/index.js) ### Pagination with ascending order -- [New stargazers - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/triggers/new-stargazers/index.ts) -- [New watchers - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/triggers/new-watchers/index.ts) +- [New stargazers - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/triggers/new-stargazers/index.js) +- [New watchers - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/triggers/new-watchers/index.js) ## Actions -- [Send a message to channel - Slack](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/slack/actions/send-a-message-to-channel/index.ts) -- [Send SMS - Twilio](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twilio/actions/send-sms/index.ts) -- [Send a message to channel - Discord](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/discord/actions/send-message-to-channel/index.ts) -- [Create issue - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/actions/create-issue/index.ts) -- [Send an email - SMTP](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/smtp/actions/send-email/index.ts) -- [Create tweet - Twitter](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twitter/actions/create-tweet/index.ts) -- [Translate text - DeepL](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/deepl/actions/translate-text/index.ts) +- [Send a message to channel - Slack](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/slack/actions/send-a-message-to-channel/index.js) +- [Send SMS - Twilio](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twilio/actions/send-sms/index.js) +- [Send a message to channel - Discord](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/discord/actions/send-message-to-channel/index.js) +- [Create issue - Github](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/github/actions/create-issue/index.js) +- [Send an email - SMTP](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/smtp/actions/send-email/index.js) +- [Create tweet - Twitter](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/twitter/actions/create-tweet/index.js) +- [Translate text - DeepL](https://github.com/automatisch/automatisch/tree/main/packages/backend/src/apps/deepl/actions/translate-text/index.js) diff --git a/packages/docs/pages/build-integrations/folder-structure.md b/packages/docs/pages/build-integrations/folder-structure.md index 6ed85e4a..bfaa49e3 100644 --- a/packages/docs/pages/build-integrations/folder-structure.md +++ b/packages/docs/pages/build-integrations/folder-structure.md @@ -35,13 +35,13 @@ Here, you can see the folder structure of an example app. We will briefly walk t ├── auth ├── common ├── dynamic-data -├── index.ts +├── index.js └── triggers ``` ## App -The `index.ts` file is the entry point of the app. It contains the definition of the app and the app's metadata. It also includes the list of triggers, actions, and data sources that the app provides. So, whatever you build inside the app, you need to associate it within the `index.ts` file. +The `index.js` file is the entry point of the app. It contains the definition of the app and the app's metadata. It also includes the list of triggers, actions, and data sources that the app provides. So, whatever you build inside the app, you need to associate it within the `index.js` file. ## Auth diff --git a/packages/docs/pages/build-integrations/global-variable.md b/packages/docs/pages/build-integrations/global-variable.md index ea591892..4128627a 100644 --- a/packages/docs/pages/build-integrations/global-variable.md +++ b/packages/docs/pages/build-integrations/global-variable.md @@ -80,7 +80,7 @@ Keep in mind that the HTTP client handles the error with the status code that fa $.step.parameters; // { key: 'value' } ``` -It refers to the parameters that are set by users in the UI. We use this property when we need to get the parameters for corresponding triggers and actions. For example [Send a message to channel](https://github.com/automatisch/automatisch/blob/main/packages/backend/src/apps/slack/actions/send-a-message-to-channel/post-message.ts) action from Slack integration, we have a step parameter called `message` that we need to use in the action. We can use `$.step.parameters.message` to get the value of the message to send a message to the Slack channel. +It refers to the parameters that are set by users in the UI. We use this property when we need to get the parameters for corresponding triggers and actions. For example [Send a message to channel](https://github.com/automatisch/automatisch/blob/main/packages/backend/src/apps/slack/actions/send-a-message-to-channel/post-message.js) action from Slack integration, we have a step parameter called `message` that we need to use in the action. We can use `$.step.parameters.message` to get the value of the message to send a message to the Slack channel. ## $.pushTriggerItem diff --git a/packages/docs/pages/build-integrations/triggers.md b/packages/docs/pages/build-integrations/triggers.md index 45a432e3..92b4bb59 100644 --- a/packages/docs/pages/build-integrations/triggers.md +++ b/packages/docs/pages/build-integrations/triggers.md @@ -20,7 +20,7 @@ We used a polling-based HTTP trigger in our example but if you need to use a web ## Add triggers to the app -Open the `thecatapi/index.ts` file and add the highlighted lines for triggers. +Open the `thecatapi/index.js` file and add the highlighted lines for triggers. ```javascript{3,15} import defineApp from '../../helpers/define-app'; @@ -43,7 +43,7 @@ export default defineApp({ ## Define triggers -Create the `triggers/index.ts` file inside of the `thecatapi` folder. +Create the `triggers/index.js` file inside of the `thecatapi` folder. ```javascript import searchCatImages from './search-cat-images'; @@ -52,12 +52,12 @@ export default [searchCatImages]; ``` :::tip -If you add new triggers, you need to add them to the `triggers/index.ts` file and export all triggers as an array. The order of triggers in this array will be reflected in the Automatisch user interface. +If you add new triggers, you need to add them to the `triggers/index.js` file and export all triggers as an array. The order of triggers in this array will be reflected in the Automatisch user interface. ::: ## Add metadata -Create the `triggers/search-cat-images/index.ts` file inside of the `thecatapi` folder. +Create the `triggers/search-cat-images/index.js` file inside of the `thecatapi` folder. ```javascript import defineTrigger from '../../../../helpers/define-trigger'; diff --git a/packages/docs/pages/contributing/development-setup.md b/packages/docs/pages/contributing/development-setup.md index 6008a323..2863c2d3 100644 --- a/packages/docs/pages/contributing/development-setup.md +++ b/packages/docs/pages/contributing/development-setup.md @@ -35,7 +35,7 @@ yarn db:create ``` :::warning -`yarn db:create` commands expect that you have the `postgres` superuser. If not, you can create a superuser called `postgres` manually or you can create the database manually by checking PostgreSQL-related default values from the [app config](https://github.com/automatisch/automatisch/blob/main/packages/backend/src/config/app.ts). +`yarn db:create` commands expect that you have the `postgres` superuser. If not, you can create a superuser called `postgres` manually or you can create the database manually by checking PostgreSQL-related default values from the [app config](https://github.com/automatisch/automatisch/blob/main/packages/backend/src/config/app.js). ::: Run the database migrations in the backend folder.