nango 0.24.11 → 0.24.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,27 +3,22 @@
3
3
  * Copyright (c) 2023 Nango, all rights reserved.
4
4
  */
5
5
  import { Command } from 'commander';
6
- import fs from 'fs';
7
6
  import chalk from 'chalk';
8
7
  import figlet from 'figlet';
9
8
  import path from 'path';
10
9
  import * as dotenv from 'dotenv';
11
10
  import { nangoConfigFile, loadSimplifiedConfig } from '@nangohq/shared';
12
- import { init, dryRun, generate, tsc, tscWatch, configWatch, dockerRun, version, deploy } from './sync.js';
13
- import { upgradeAction, NANGO_INTEGRATIONS_LOCATION, verifyNecessaryFiles, printDebug } from './utils.js';
11
+ import { init, run, generate, tsc, tscWatch, configWatch, dockerRun, version, deploy } from './sync.js';
12
+ import { upgradeAction, NANGO_INTEGRATIONS_LOCATION, verifyNecessaryFiles } from './utils.js';
14
13
  class NangoCommand extends Command {
15
14
  createCommand(name) {
16
15
  const cmd = new Command(name);
16
+ cmd.option('--secret-key [secretKey]', 'Set the secret key. Overrides the `NANGO_SECRET_KEY` value set in the .env file');
17
+ cmd.option('--host [host]', 'Set the host. Overrides the `NANGO_HOSTPORT` value set in the .env file');
17
18
  cmd.option('--auto-confirm', 'Auto confirm yes to all prompts.');
18
19
  cmd.option('--debug', 'Run cli in debug mode, outputting verbose logs.');
19
20
  cmd.hook('preAction', async function (actionCommand) {
20
21
  const { debug } = actionCommand.opts();
21
- if (debug) {
22
- printDebug('Debug mode enabled');
23
- if (fs.existsSync('.env')) {
24
- printDebug('.env file detected and loaded');
25
- }
26
- }
27
22
  await upgradeAction(debug);
28
23
  });
29
24
  return cmd;
@@ -31,32 +26,27 @@ class NangoCommand extends Command {
31
26
  }
32
27
  const program = new NangoCommand();
33
28
  dotenv.config();
34
- program.name('nango').description(`The CLI requires that you set the NANGO_SECRET_KEY_DEV and NANGO_SECRET_KEY_PROD env variables.
29
+ program.name('nango').description(`By default, the CLI assumes that you are using Nango Cloud so you need to set the NANGO_SECRET_KEY env variable or pass in the --secret-key flag with each command.
35
30
 
36
- In addition for self-Hosting: set the NANGO_HOSTPORT env variable.
31
+ For Self-Hosting: set the NANGO_HOSTPORT env variable or pass in the --host flag with each command.
37
32
 
38
- Global flag: --auto-confirm - automatically confirm yes to all prompts.
33
+ Global flags: --secret-key, --host, --auto-confirm, --debug (output verbose logs for debugging purposes)
39
34
 
40
35
  Available environment variables available:
41
36
 
42
- # Recommendation: in a ".env" file in ./nango-integrations.
43
-
44
- # Authenticates the CLI (get the keys in the dashboard's Projects Settings).
45
- NANGO_SECRET_KEY_DEV=xxxx-xxx-xxxx
46
- NANGO_SECRET_KEY_PROD=xxxx-xxx-xxxx
47
-
48
- # Nango's instance URL (OSS: change to http://localhost:3003 or your instance URL).
49
- NANGO_HOSTPORT=https://api.nango.dev # Default value
50
-
51
- # How to handle CLI upgrades ("prompt", "auto" or "ignore").
52
- NANGO_CLI_UPGRADE_MODE=prompt # Default value
53
-
54
- # Whether to prompt before deployments.
55
- NANGO_DEPLOY_AUTO_CONFIRM=false # Default value
37
+ NANGO_HOSTPORT=https://api.nango.dev | http://localhost:3003 | your-self-hosted-address
38
+ NANGO_AUTO_UPGRADE=true // upgrade the CLI automatically
39
+ NANGO_NO_PROMPT_FOR_UPGRADE=false // don't prompt for upgrades
40
+ NANGO_DEPLOY_AUTO_CONFIRM=false // deploy without any prompts
41
+ NANGO_SECRET_KEY=xxxx-xxx-xxxx // Required for Nango Cloud to authenticate
42
+ NANGO_INTEGRATIONS_LOCATION=use-this-to-override-where-the-nango-integrations-directory-goes // set a custom location for the nango-integrations directory
43
+ NANGO_PORT=use-this-to-override-the-default-3003 // set a custom port for the Nango Server
44
+ NANGO_DB_PORT=use-this-to-override-the-default-5432 // set a custom port for the Nango database
56
45
  `);
57
46
  program.addHelpText('before', chalk.green(figlet.textSync('Nango CLI')));
58
47
  program
59
48
  .command('version')
49
+ .alias('v')
60
50
  .description('Print the version of the Nango CLI, Nango Worker, and Nango Server.')
61
51
  .action(function () {
62
52
  const { debug } = this.opts();
@@ -64,6 +54,7 @@ program
64
54
  });
65
55
  program
66
56
  .command('init')
57
+ .alias('i')
67
58
  .description('Initialize a new Nango project')
68
59
  .action(function () {
69
60
  const { debug } = this.opts();
@@ -71,6 +62,7 @@ program
71
62
  });
72
63
  program
73
64
  .command('generate')
65
+ .alias('g')
74
66
  .description('Generate a new Nango integration')
75
67
  .action(async function () {
76
68
  const { autoConfirm, debug } = this.opts();
@@ -78,18 +70,18 @@ program
78
70
  generate(debug);
79
71
  });
80
72
  program
81
- .command('dryrun')
82
- .description('Dry run the sync process to help with debugging against an existing connection in cloud.')
83
- .arguments('sync connection_id')
84
- .option('-e [environment]', 'The environment to dry run the sync in, defaults to dev.', 'dev')
85
- .option('-l, --lastSyncDate [lastSyncDate]', 'Optional: last sync date to retrieve records greater than this date')
86
- .action(async function (sync, connectionId) {
87
- const { autoConfirm, debug, e: environment } = this.opts();
73
+ .command('tsc')
74
+ .alias('compile')
75
+ .description('Compile the integration files to JavaScript')
76
+ .action(async function () {
77
+ const { autoConfirm, debug } = this.opts();
88
78
  await verifyNecessaryFiles(autoConfirm, debug);
89
- dryRun({ ...this.opts(), sync, connectionId }, environment, debug);
79
+ tsc(debug);
90
80
  });
91
81
  program
92
- .command('dev')
82
+ .command('tsc:watch')
83
+ .alias('compile:watch')
84
+ .alias('tscw')
93
85
  .description('Watch tsc files while developing. Set --no-compile-interfaces to disable watching the config file')
94
86
  .option('--no-compile-interfaces', `Watch the ${nangoConfigFile} and recompile the interfaces on change`, true)
95
87
  .action(async function () {
@@ -100,77 +92,64 @@ program
100
92
  }
101
93
  tscWatch(debug);
102
94
  });
95
+ program
96
+ .command('start')
97
+ .alias('dr')
98
+ .alias('docker:run')
99
+ .description('Run the docker container locally')
100
+ .action(async function () {
101
+ const { debug } = this.opts();
102
+ await dockerRun(debug);
103
+ });
104
+ program
105
+ .command('dev')
106
+ .alias('develop')
107
+ .alias('watch')
108
+ .description('Work locally to add integration code')
109
+ .option('--no-compile-interfaces', `Watch the ${nangoConfigFile} and recompile the interfaces on change`, true)
110
+ .action(async function () {
111
+ const { compileInterfaces, autoConfirm, debug } = this.opts();
112
+ await verifyNecessaryFiles(autoConfirm, debug);
113
+ if (compileInterfaces) {
114
+ configWatch(debug);
115
+ }
116
+ tscWatch(debug);
117
+ await dockerRun(debug);
118
+ });
103
119
  program
104
120
  .command('deploy')
121
+ .alias('d')
122
+ .alias('deploy:prod')
123
+ .alias('deploy:cloud')
105
124
  .description('Deploy a Nango integration')
106
- .arguments('environment')
125
+ .option('--staging', 'Deploy to the staging instance')
126
+ .option('--local', 'Deploy to the local instance')
107
127
  .option('-v, --version [version]', 'Optional: Set a version of this deployment to tag this integration with. Can be used for rollbacks.')
108
128
  .option('-s, --sync [syncName]', 'Optional deploy only this sync name.')
109
129
  .option('--no-compile-interfaces', `Don't compile the ${nangoConfigFile}`, true)
110
- .action(async function (environment) {
130
+ .action(async function () {
111
131
  const options = this.opts();
112
132
  (async (options) => {
113
- const { debug } = options;
114
- await deploy({ ...options, env: 'production' }, environment, debug);
133
+ const { staging, debug } = options;
134
+ let env = staging ? 'staging' : 'production';
135
+ env = options.local ? 'local' : env;
136
+ await deploy({ ...options, env: env }, debug);
115
137
  })(options);
116
138
  });
117
- // Hidden commands //
118
139
  program
119
- .command('deploy:local', { hidden: true })
140
+ .command('deploy:local')
120
141
  .alias('dl')
121
142
  .description('Deploy a Nango integration to local')
122
- .arguments('environment')
123
- .option('-v, --version [version]', 'Optional: Set a version of this deployment to tag this integration with. Can be used for rollbacks.')
124
- .option('--no-compile-interfaces', `Don't compile the ${nangoConfigFile}`, true)
125
- .action(async function (environment) {
126
- const options = this.opts();
127
- (async (options) => {
128
- await deploy({ ...options, env: 'local' }, environment, options.debug);
129
- })(options);
130
- });
131
- program
132
- .command('deploy:staging', { hidden: true })
133
- .alias('ds')
134
- .description('Deploy a Nango integration to local')
135
- .arguments('environment')
136
143
  .option('-v, --version [version]', 'Optional: Set a version of this deployment to tag this integration with. Can be used for rollbacks.')
137
144
  .option('--no-compile-interfaces', `Don't compile the ${nangoConfigFile}`, true)
138
- .action(async function (environment) {
145
+ .action(async function () {
139
146
  const options = this.opts();
140
147
  (async (options) => {
141
- await deploy({ ...options, env: 'staging' }, environment, options.debug);
148
+ await deploy({ ...options, env: 'local' }, options.debug);
142
149
  })(options);
143
150
  });
144
151
  program
145
- .command('compile', { hidden: true })
146
- .description('Compile the integration files to JavaScript')
147
- .action(async function () {
148
- const { autoConfirm, debug } = this.opts();
149
- await verifyNecessaryFiles(autoConfirm, debug);
150
- tsc(debug);
151
- });
152
- program
153
- .command('sync:dev', { hidden: true })
154
- .description('Work locally to develop integration code')
155
- .option('--no-compile-interfaces', `Watch the ${nangoConfigFile} and recompile the interfaces on change`, true)
156
- .action(async function () {
157
- const { compileInterfaces, autoConfirm, debug } = this.opts();
158
- await verifyNecessaryFiles(autoConfirm, debug);
159
- if (compileInterfaces) {
160
- configWatch(debug);
161
- }
162
- tscWatch(debug);
163
- await dockerRun(debug);
164
- });
165
- program
166
- .command('sync:docker.run', { hidden: true })
167
- .description('Run the docker container locally')
168
- .action(async function () {
169
- const { debug } = this.opts();
170
- await dockerRun(debug);
171
- });
172
- program
173
- .command('sync:config.check', { hidden: true })
152
+ .command('sync:config.check')
174
153
  .alias('scc')
175
154
  .description('Verify the parsed sync config and output the object for verification')
176
155
  .action(async function () {
@@ -180,5 +159,18 @@ program
180
159
  const config = await loadSimplifiedConfig(path.resolve(cwd, NANGO_INTEGRATIONS_LOCATION));
181
160
  console.log(chalk.green(JSON.stringify(config, null, 2)));
182
161
  });
162
+ program
163
+ .command('sync:run')
164
+ .alias('sr')
165
+ .description('Run the sync process to help with debugging. Assumes local development environment.')
166
+ .option('-s, --sync <syncName>', 'The name of the sync (e.g. account-sync).')
167
+ .option('-p, --provider <provider_config_key>', 'The unique key of the provider configuration (chosen by you upon creating this provider configuration).')
168
+ .option('-c, --connection <connection_id>', 'The ID of the Connection.')
169
+ .option('-l, --lastSyncDate [lastSyncDate]', 'Optional: last sync date to retrieve records greater than this date')
170
+ .action(async function () {
171
+ const { autoConfirm, debug } = this.opts();
172
+ await verifyNecessaryFiles(autoConfirm, debug);
173
+ run(this.args, this.opts(), debug);
174
+ });
183
175
  program.parse();
184
176
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG1G,MAAM,YAAa,SAAQ,OAAO;IACrB,aAAa,CAAC,IAAY;QAC/B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,gBAAgB,EAAE,kCAAkC,CAAC,CAAC;QACjE,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,iDAAiD,CAAC,CAAC;QACzE,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,WAA0B,aAAsB;YACvE,MAAM,EA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mC,EAAE,qEAAqE,CAAC;KAClH,MAAM,CAAC,KAAK;IACT,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC3C,MAAM,oBAAoB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAC/C,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AAEP,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -50,9 +50,9 @@ declare enum AuthModes {
50
50
  OAuth1 = "OAUTH1",
51
51
  OAuth2 = "OAUTH2"
52
52
  }
53
- interface CredentialsCommon<T = Record<string, any>> {
53
+ interface CredentialsCommon {
54
54
  type: AuthModes;
55
- raw: T;
55
+ raw: Record<string, string>;
56
56
  }
57
57
  interface OAuth2Credentials extends CredentialsCommon {
58
58
  type: AuthModes.OAuth2;
@@ -73,7 +73,7 @@ interface Connection {
73
73
  provider_config_key: string;
74
74
  connection_id: string;
75
75
  connection_config: Record<string, string>;
76
- environment_id: number;
76
+ account_id: number;
77
77
  metadata: Record<string, string>;
78
78
  credentials_iv?: string | null;
79
79
  credentials_tag?: string | null;
@@ -82,7 +82,7 @@ interface Connection {
82
82
  }
83
83
  interface NangoProps {
84
84
  host?: string;
85
- secretKey: string;
85
+ secretKey?: string;
86
86
  connectionId?: string;
87
87
  activityLogId?: number;
88
88
  providerConfigKey?: string;
@@ -105,7 +105,7 @@ export declare class NangoSync {
105
105
  dryRun?: boolean;
106
106
  connectionId?: string;
107
107
  providerConfigKey?: string;
108
- constructor(config: NangoProps);
108
+ constructor(config?: NangoProps);
109
109
  setLastSyncDate(date: Date): void;
110
110
  proxy(config: ProxyConfiguration): Promise<AxiosResponse<any, any>>;
111
111
  getConnection(): Promise<Connection>;
package/dist/sync.d.ts CHANGED
@@ -1,20 +1,16 @@
1
1
  import type { DeployOptions, GlobalOptions } from './types.js';
2
2
  interface RunArgs extends GlobalOptions {
3
3
  sync: string;
4
- connectionId: string;
4
+ provider: string;
5
+ connection: string;
5
6
  lastSyncDate?: string;
6
7
  useServerLastSyncDate?: boolean;
7
8
  }
9
+ export declare const deploy: (options: DeployOptions, debug?: boolean) => Promise<void>;
8
10
  export declare const version: (debug: boolean) => void;
9
- /**
10
- * Init
11
- * If we're not currently in the nango-integrations directory create one
12
- * and create an example nango.yaml file
13
- */
14
11
  export declare const init: (debug?: boolean) => void;
15
12
  export declare const generate: (debug?: boolean) => Promise<void>;
16
- export declare const deploy: (options: DeployOptions, environment: string, debug?: boolean) => Promise<void>;
17
- export declare const dryRun: (options: RunArgs, environment: string, debug?: boolean) => Promise<void>;
13
+ export declare const run: (args: string[], options: RunArgs, debug?: boolean) => Promise<void>;
18
14
  export declare const tsc: (debug?: boolean) => void;
19
15
  export declare const tscWatch: (debug?: boolean) => void;
20
16
  export declare const configWatch: (debug?: boolean) => void;