-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sam/24_11_17/feat/connection-create-v2
- Loading branch information
Showing
23 changed files
with
204 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const NANGO_VERSION = '0.45.0'; | ||
export const NANGO_VERSION = '0.45.1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/database/lib/migrations/20241122212401_integration_backfill_missing_fields.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const path = require('node:path'); | ||
const fs = require('node:fs'); | ||
const yaml = require('js-yaml'); | ||
|
||
exports.up = async function (knex) { | ||
let providers; | ||
const providersPath = path.join(__dirname, '..', '..', '..', 'shared', 'providers.yaml'); | ||
try { | ||
providers = yaml.load(fs.readFileSync(providersPath, 'utf8')); | ||
} catch (e) { | ||
console.error( | ||
`Warning: Failed to load providers.yaml. Skipping migration. Missing fields on existing integrations will not show warnings in the dashboard until they are saved again. Underlying error: ${e.message}. ` | ||
); | ||
return; | ||
} | ||
|
||
const needsClientId = ['OAUTH1', 'OAUTH2', 'TBA', 'APP']; | ||
const clientIdProviders = Object.entries(providers) | ||
.filter(([_, config]) => needsClientId.includes(config.auth_mode)) | ||
.map(([name]) => name); | ||
await knex | ||
.queryBuilder() | ||
.from('_nango_configs') | ||
.whereIn('provider', clientIdProviders) | ||
.whereRaw("NOT (missing_fields @> '{oauth_client_id}')") | ||
.update({ missing_fields: knex.raw("array_append(missing_fields, 'oauth_client_id')") }); | ||
|
||
const needsClientSecret = ['OAUTH1', 'OAUTH2', 'TBA', 'APP']; | ||
const clientSecretProviders = Object.entries(providers) | ||
.filter(([_, config]) => needsClientSecret.includes(config.auth_mode)) | ||
.map(([name]) => name); | ||
await knex | ||
.queryBuilder() | ||
.from('_nango_configs') | ||
.whereIn('provider', clientSecretProviders) | ||
.whereRaw("NOT (missing_fields @> '{oauth_client_secret}')") | ||
.update({ missing_fields: knex.raw("array_append(missing_fields, 'oauth_client_secret')") }); | ||
|
||
const needsAppLink = ['APP']; | ||
const appLinkProviders = Object.entries(providers) | ||
.filter(([_, config]) => needsAppLink.includes(config.auth_mode)) | ||
.map(([name]) => name); | ||
await knex | ||
.queryBuilder() | ||
.from('_nango_configs') | ||
.whereIn('provider', appLinkProviders) | ||
.whereRaw("NOT (missing_fields @> '{app_link}')") | ||
.update({ missing_fields: knex.raw("array_append(missing_fields, 'app_link')") }); | ||
}; | ||
|
||
exports.down = function () { | ||
// do nothing | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const NANGO_VERSION = '0.45.0'; | ||
export const NANGO_VERSION = '0.45.1'; |
Oops, something went wrong.