From e7ba7168e19e7dc3cf2be0da05d1bd86b6ab2839 Mon Sep 17 00:00:00 2001 From: nalanj <5594+nalanj@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:43:46 -0500 Subject: [PATCH] chore: Revert use-cases script (#150) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …ion (#142)" This reverts commit 390326aea66a79ca6713d81cf0359480b170d542. ## Describe your changes ## Issue ticket number and link ## Checklist before requesting a review (skip if just adding/editing APIs & templates) - [ ] I added tests, otherwise the reason is: - [ ] External API requests have `retries` - [ ] Pagination is used where appropriate - [ ] The built in `nango.paginate` call is used instead of a `while (true)` loop - [ ] Third party requests are NOT parallelized (this can cause issues with rate limits) - [ ] If a sync requires metadata the `nango.yaml` has `auto_start: false` - [ ] If the sync is a `full` sync then `track_deletes: true` is set - [ ] I followed the best practices and guidelines from the [Writing Integration Scripts](/NangoHQ/integration-templates/blob/main/WRITING_INTEGRATION_SCRIPTS.md) doc --- .gitignore | 3 -- scripts/generate-docs-use-cases.ts | 45 ------------------------------ tsconfig.json | 2 +- 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 scripts/generate-docs-use-cases.ts diff --git a/.gitignore b/.gitignore index 2ef725bb..2052683c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,3 @@ node_modules **/.nango **/models.ts .vscode/ - -// use-cases documentation dump -use-cases.json \ No newline at end of file diff --git a/scripts/generate-docs-use-cases.ts b/scripts/generate-docs-use-cases.ts deleted file mode 100644 index b5e92480..00000000 --- a/scripts/generate-docs-use-cases.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { promises as fs } from 'fs'; -import yaml from 'js-yaml'; - -interface UseCase { - method: string; - path: string; - description: string; - group: string; - script: string; -} - -const maybeIntegrations = await fs.readdir('integrations', { withFileTypes: true }); -const integrations = maybeIntegrations.filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name); - -const exportData: Record = {}; - -for (const integration of integrations) { - // eslint-disable-next-line @nangohq/custom-integrations-linting/no-object-casting - const yamlConfig = yaml.load(await fs.readFile(`integrations/${integration}/nango.yaml`, 'utf8')) as any; - const config = yamlConfig.integrations[integration] || yamlConfig.integrations['${PWD}']; - - exportData[integration] = readUseCases(config.syncs, integration).concat(readUseCases(config.actions, integration)); -} - -await fs.writeFile('use-cases.json', JSON.stringify(exportData, null, 2), 'utf-8'); - -function readUseCases(syncOrAction: any, integration: string) { - const endpoints: UseCase[] = []; - if (syncOrAction) { - for (const [key, item] of Object.entries(syncOrAction)) { - const syncEndpoints = Array.isArray(item.endpoint) ? item.endpoint : [item.endpoint]; - for (const endpoint of syncEndpoints) { - endpoints.push({ - method: endpoint.method, - path: endpoint.path, - description: item.description?.trim(), - group: endpoint.group, - script: `${integration}/actions/${key}` - }); - } - } - } - - return endpoints; -} diff --git a/tsconfig.json b/tsconfig.json index 408cdf93..06ae6f7c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,5 +7,5 @@ "composite": true, "checkJs": false }, - "include": ["integrations", "globals.d.ts", "scripts"] + "include": ["integrations", "globals.d.ts"] }