Skip to content

Commit

Permalink
Merge branch 'master' into sam/25_02_11/fix/sdk-sample-more
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel authored Feb 11, 2025
2 parents 43e8a3f + e4d8bd1 commit f4870d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/webflow-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths:
- packages/providers/providers.yaml
- docs-v2/integrations/all/*.md
- packages/shared/flows.yaml
workflow_dispatch:

concurrency:
Expand Down
26 changes: 22 additions & 4 deletions scripts/webflow-api-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import yaml from 'js-yaml';
import { setTimeout } from 'node:timers/promises';
import util from 'node:util';
import type { CollectionItem, CollectionItemList } from 'webflow-api/api';
import type { Provider } from '@nangohq/types';
import type { Provider, FlowsYaml } from '@nangohq/types';

const rateLimitSleep = 1000;

Expand All @@ -29,6 +29,10 @@ const providersPath = 'packages/providers/providers.yaml';
// eslint-disable-next-line import/no-named-as-default-member
const providers = yaml.load(await fs.readFile(providersPath, 'utf8')) as Record<string, Provider>;

const flowsPath = 'packages/shared/flows.yaml';
// eslint-disable-next-line import/no-named-as-default-member
const flows = yaml.load(await fs.readFile(flowsPath, 'utf8')) as FlowsYaml;

const docsPath = 'docs-v2/integrations/all';
const files = await fs.readdir(docsPath);

Expand Down Expand Up @@ -111,6 +115,17 @@ for (const [slug, provider] of Object.entries(neededProviders)) {
const logoPath = path.relative(process.cwd(), fullLogoPath);
const logo = `https://raw.githubusercontent.com/NangoHQ/nango/refs/heads/master/${logoPath}`;

let preBuiltCount = 0;
if (flows.integrations[slug]) {
if (flows.integrations[slug].actions) {
preBuiltCount += Object.keys(flows.integrations[slug].actions).length;
}

if (flows.integrations[slug].syncs) {
preBuiltCount += Object.keys(flows.integrations[slug].syncs).length;
}
}

if (apiItemsBySlug[slug]) {
const item = apiItemsBySlug[slug];
if (!item.id) {
Expand All @@ -121,7 +136,8 @@ for (const [slug, provider] of Object.entries(neededProviders)) {
fieldData: {
name: item.fieldData.name,
documentation: item.fieldData['documentation'],
'api-categories': item.fieldData['api-categories']
'api-categories': item.fieldData['api-categories'],
'pre-built-integrations-count': item.fieldData['pre-built-integrations-count']
}
};

Expand All @@ -132,7 +148,8 @@ for (const [slug, provider] of Object.entries(neededProviders)) {
fieldData: {
name: provider.display_name,
documentation: provider.docs,
'api-categories': apiCategories
'api-categories': apiCategories,
'pre-built-integrations-count': preBuiltCount
}
};

Expand Down Expand Up @@ -163,7 +180,8 @@ for (const [slug, provider] of Object.entries(neededProviders)) {
slug: slug,
documentation: provider.docs,
logo,
'api-categories': providerCategories.map((category) => categoriesBySlug[category]?.id)
'api-categories': providerCategories.map((category) => categoriesBySlug[category]?.id),
'pre-built-integrations-count': preBuiltCount
}
});
}
Expand Down

0 comments on commit f4870d5

Please sign in to comment.