Skip to content

Commit

Permalink
fix(providers): allow fields to be marked as automated (#3094)
Browse files Browse the repository at this point in the history
## Changes

Fixes
https://linear.app/nango/issue/NAN-2280/ability-to-set-connectionconfig-as-automated

- Allow fields to be marked as automated
- Set salesforce instance url as automated

## Tests

I don't have a Salesforce account, if you have one I would appreciate a
local test please (@khaliqgant or @hassan254-prog)
  • Loading branch information
bodinsamuel authored Dec 2, 2024
1 parent 5fdae65 commit 58f2683
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/connect-ui/src/views/Go.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export const Go: React.FC = () => {
// Append connectionConfig object
const additionalFields: z.ZodRawShape = {};
for (const [name, schema] of Object.entries(provider.connection_config || [])) {
if (schema.automated) {
continue;
}

additionalFields[name] = jsonSchemaToZod(schema);

if (schema.order) {
Expand Down Expand Up @@ -345,7 +349,7 @@ export const Go: React.FC = () => {
name={name}
render={({ field }) => {
return (
<FormItem className={cn(isPreconfigured || definition?.hidden ? 'hidden' : null)}>
<FormItem className={cn(isPreconfigured || definition?.hidden || definition?.automated ? 'hidden' : null)}>
<div>
<div className="flex gap-2 items-center pb-1">
<FormLabel className="leading-5">
Expand Down
5 changes: 4 additions & 1 deletion packages/shared/providers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,7 @@ github-app:
title: Installation ID
description: The installation ID of your GitHub App
example: '38631545'
automated: true

github-app-oauth:
display_name: GitHub App (oauth)
Expand Down Expand Up @@ -2674,6 +2675,7 @@ github-app-oauth:
title: Installation ID
description: The installation ID of your GitHub App
example: '38631545'
automated: true

gitlab:
display_name: GitLab
Expand Down Expand Up @@ -5184,7 +5186,7 @@ salesforce:
description: The instance URL of your Salesforce account
format: uri
pattern: '^https?://.*$'
optional: true
automated: true

salesforce-sandbox:
display_name: Salesforce (sandbox)
Expand All @@ -5205,6 +5207,7 @@ salesforce-sandbox:
description: The instance URL of your Salesforce account
format: uri
pattern: '^https?://.*$'
automated: true

salesforce-experience-cloud:
display_name: Salesforce Experience Cloud
Expand Down
1 change: 1 addition & 0 deletions packages/types/lib/providers/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface SimplifiedJSONSchema {
suffix?: string;
doc_section?: string;
secret?: string;
automated: boolean;
}

export interface BaseProvider {
Expand Down
12 changes: 11 additions & 1 deletion scripts/validation/providers/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,14 @@
"enum": ["authorization_code", "client_credentials"]
},
"request": {
"anyOf": [{ "type": "string" }, { "type": "object" }]
"anyOf": [
{
"type": "string"
},
{
"type": "object"
}
]
}
}
},
Expand Down Expand Up @@ -462,6 +469,9 @@
"doc_section": {
"type": "string",
"pattern": "^#[a-z0-9-]+$"
},
"automated": {
"type": "boolean"
}
}
}
Expand Down

0 comments on commit 58f2683

Please sign in to comment.