nango 0.23.31 → 0.24.0

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,22 +3,27 @@
3
3
  * Copyright (c) 2023 Nango, all rights reserved.
4
4
  */
5
5
  import { Command } from 'commander';
6
+ import fs from 'fs';
6
7
  import chalk from 'chalk';
7
8
  import figlet from 'figlet';
8
9
  import path from 'path';
9
10
  import * as dotenv from 'dotenv';
10
11
  import { nangoConfigFile, loadSimplifiedConfig } from '@nangohq/shared';
11
- import { init, run, generate, tsc, tscWatch, configWatch, dockerRun, version, deploy } from './sync.js';
12
- import { upgradeAction, NANGO_INTEGRATIONS_LOCATION, verifyNecessaryFiles } from './utils.js';
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';
13
14
  class NangoCommand extends Command {
14
15
  createCommand(name) {
15
16
  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');
18
17
  cmd.option('--auto-confirm', 'Auto confirm yes to all prompts.');
19
18
  cmd.option('--debug', 'Run cli in debug mode, outputting verbose logs.');
20
19
  cmd.hook('preAction', async function (actionCommand) {
21
20
  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
+ }
22
27
  await upgradeAction(debug);
23
28
  });
24
29
  return cmd;
@@ -26,27 +31,32 @@ class NangoCommand extends Command {
26
31
  }
27
32
  const program = new NangoCommand();
28
33
  dotenv.config();
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.
34
+ program.name('nango').description(`The CLI requires that you set the NANGO_SECRET_KEY_DEV and NANGO_SECRET_KEY_PROD env variables.
30
35
 
31
- For Self-Hosting: set the NANGO_HOSTPORT env variable or pass in the --host flag with each command.
36
+ In addition for self-Hosting: set the NANGO_HOSTPORT env variable.
32
37
 
33
- Global flags: --secret-key, --host, --auto-confirm, --debug (output verbose logs for debugging purposes)
38
+ Global flag: --auto-confirm - automatically confirm yes to all prompts.
34
39
 
35
40
  Available environment variables available:
36
41
 
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
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
45
56
  `);
46
57
  program.addHelpText('before', chalk.green(figlet.textSync('Nango CLI')));
47
58
  program
48
59
  .command('version')
49
- .alias('v')
50
60
  .description('Print the version of the Nango CLI, Nango Worker, and Nango Server.')
51
61
  .action(function () {
52
62
  const { debug } = this.opts();
@@ -54,7 +64,6 @@ program
54
64
  });
55
65
  program
56
66
  .command('init')
57
- .alias('i')
58
67
  .description('Initialize a new Nango project')
59
68
  .action(function () {
60
69
  const { debug } = this.opts();
@@ -62,7 +71,6 @@ program
62
71
  });
63
72
  program
64
73
  .command('generate')
65
- .alias('g')
66
74
  .description('Generate a new Nango integration')
67
75
  .action(async function () {
68
76
  const { autoConfirm, debug } = this.opts();
@@ -70,42 +78,19 @@ program
70
78
  generate(debug);
71
79
  });
72
80
  program
73
- .command('tsc')
74
- .alias('compile')
75
- .description('Compile the integration files to JavaScript')
76
- .action(async function () {
77
- const { autoConfirm, debug } = this.opts();
78
- await verifyNecessaryFiles(autoConfirm, debug);
79
- tsc(debug);
80
- });
81
- program
82
- .command('tsc:watch')
83
- .alias('compile:watch')
84
- .alias('tscw')
85
- .description('Watch tsc files while developing. Set --no-compile-interfaces to disable watching the config file')
86
- .option('--no-compile-interfaces', `Watch the ${nangoConfigFile} and recompile the interfaces on change`, true)
87
- .action(async function () {
88
- const { compileInterfaces, autoConfirm, debug } = this.opts();
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();
89
88
  await verifyNecessaryFiles(autoConfirm, debug);
90
- if (compileInterfaces) {
91
- configWatch(debug);
92
- }
93
- tscWatch(debug);
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);
89
+ dryRun({ ...this.opts(), sync, connectionId }, environment, debug);
103
90
  });
104
91
  program
105
92
  .command('dev')
106
- .alias('develop')
107
- .alias('watch')
108
- .description('Work locally to add integration code')
93
+ .description('Watch tsc files while developing. Set --no-compile-interfaces to disable watching the config file')
109
94
  .option('--no-compile-interfaces', `Watch the ${nangoConfigFile} and recompile the interfaces on change`, true)
110
95
  .action(async function () {
111
96
  const { compileInterfaces, autoConfirm, debug } = this.opts();
@@ -114,42 +99,78 @@ program
114
99
  configWatch(debug);
115
100
  }
116
101
  tscWatch(debug);
117
- await dockerRun(debug);
118
102
  });
119
103
  program
120
104
  .command('deploy')
121
- .alias('d')
122
- .alias('deploy:prod')
123
- .alias('deploy:cloud')
124
105
  .description('Deploy a Nango integration')
125
- .option('--staging', 'Deploy to the staging instance')
126
- .option('--local', 'Deploy to the local instance')
106
+ .arguments('environment')
127
107
  .option('-v, --version [version]', 'Optional: Set a version of this deployment to tag this integration with. Can be used for rollbacks.')
128
108
  .option('-s, --sync [syncName]', 'Optional deploy only this sync name.')
129
109
  .option('--no-compile-interfaces', `Don't compile the ${nangoConfigFile}`, true)
130
- .action(async function () {
110
+ .action(async function (environment) {
131
111
  const options = this.opts();
132
112
  (async (options) => {
133
- const { staging, debug } = options;
134
- let env = staging ? 'staging' : 'production';
135
- env = options.local ? 'local' : env;
136
- await deploy({ ...options, env: env }, debug);
113
+ const { debug } = options;
114
+ await deploy({ ...options, env: 'production' }, environment, debug);
137
115
  })(options);
138
116
  });
117
+ // Hidden commands //
139
118
  program
140
- .command('deploy:local')
119
+ .command('deploy:local', { hidden: true })
141
120
  .alias('dl')
142
121
  .description('Deploy a Nango integration to local')
122
+ .arguments('environment')
143
123
  .option('-v, --version [version]', 'Optional: Set a version of this deployment to tag this integration with. Can be used for rollbacks.')
144
124
  .option('--no-compile-interfaces', `Don't compile the ${nangoConfigFile}`, true)
145
- .action(async function () {
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
+ .option('-v, --version [version]', 'Optional: Set a version of this deployment to tag this integration with. Can be used for rollbacks.')
137
+ .option('--no-compile-interfaces', `Don't compile the ${nangoConfigFile}`, true)
138
+ .action(async function (environment) {
146
139
  const options = this.opts();
147
140
  (async (options) => {
148
- await deploy({ ...options, env: 'local' }, options.debug);
141
+ await deploy({ ...options, env: 'staging' }, environment, options.debug);
149
142
  })(options);
150
143
  });
151
144
  program
152
- .command('sync:config.check')
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 })
153
174
  .alias('scc')
154
175
  .description('Verify the parsed sync config and output the object for verification')
155
176
  .action(async function () {
@@ -159,18 +180,5 @@ program
159
180
  const config = await loadSimplifiedConfig(path.resolve(cwd, NANGO_INTEGRATIONS_LOCATION));
160
181
  console.log(chalk.green(JSON.stringify(config, null, 2)));
161
182
  });
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
- });
175
183
  program.parse();
176
184
  //# 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,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,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxG,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAG9F,MAAM,YAAa,SAAQ,OAAO;IACrB,aAAa,CAAC,IAAY;QAC/B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,0BAA0B,EAAE,iFAAiF,CAAC,CAAC;QAC1H,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,yEAAyE,CAAC,CAAC;QACvG,GAAG,CAAC,MAAM,CAAC,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AI,CAAC,IAAI,EAAE,CAAC;IACpC,MAAM,oBAAoB,CAAC,WAAW,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC,CAAC;IAE1F,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC,CAAC;AAEP,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -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
- account_id: number;
76
+ environment_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,16 +1,20 @@
1
1
  import type { DeployOptions, GlobalOptions } from './types.js';
2
2
  interface RunArgs extends GlobalOptions {
3
3
  sync: string;
4
- provider: string;
5
- connection: string;
4
+ connectionId: string;
6
5
  lastSyncDate?: string;
7
6
  useServerLastSyncDate?: boolean;
8
7
  }
9
- export declare const deploy: (options: DeployOptions, debug?: boolean) => Promise<void>;
10
8
  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
+ */
11
14
  export declare const init: (debug?: boolean) => void;
12
15
  export declare const generate: (debug?: boolean) => Promise<void>;
13
- export declare const run: (args: string[], options: RunArgs, 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>;
14
18
  export declare const tsc: (debug?: boolean) => void;
15
19
  export declare const tscWatch: (debug?: boolean) => void;
16
20
  export declare const configWatch: (debug?: boolean) => void;