nango 0.60.3 → 0.60.4

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.
@@ -1,3 +1,45 @@
1
+ import ts from 'typescript';
1
2
  export declare function syncTsConfig({ fullPath }: {
2
3
  fullPath: string;
3
4
  }): Promise<void>;
5
+ export declare function fileErrorToText({ filePath, msg, line, character }: {
6
+ filePath: string;
7
+ msg: string;
8
+ line?: number;
9
+ character?: number;
10
+ }): string;
11
+ export declare function tsDiagnosticToText(fullPath: string): (diagnostic: ts.Diagnostic) => void;
12
+ export type CompileErrorType = 'nango_unsupported_export' | 'nango_invalid_function_param' | 'nango_invalid_default_export' | 'nango_invalid_export_constant' | 'failed_to_build_unknown' | 'method_need_await' | 'retryon_need_retries';
13
+ export declare const badExportCompilerError = "Invalid default export: should be createAction(), createSync() or createOnEvent()";
14
+ export declare abstract class ReadableError extends Error {
15
+ abstract toText(): string;
16
+ }
17
+ export declare class DefinitionError extends ReadableError {
18
+ filePath: string;
19
+ property: string[];
20
+ constructor(msg: string, filePath: string, property: string[]);
21
+ toText(): string;
22
+ }
23
+ export declare class CompileError extends ReadableError {
24
+ type: CompileErrorType;
25
+ customMessage: string;
26
+ lineNumber: number;
27
+ filePath: string | undefined;
28
+ constructor(type: CompileErrorType, lineNumber: number, message: string, filePath?: string);
29
+ toText(): string;
30
+ }
31
+ export declare class InvalidModelDefinitionError extends DefinitionError {
32
+ constructor(modelName: string, filePath: string, property: string[]);
33
+ }
34
+ export declare class DuplicateEndpointDefinitionError extends DefinitionError {
35
+ constructor(key: string, filePath: string, property: string[]);
36
+ }
37
+ export declare class EndpointMismatchDefinitionError extends DefinitionError {
38
+ constructor(filePath: string, property: string[]);
39
+ }
40
+ export declare class InvalidIntervalDefinitionError extends DefinitionError {
41
+ constructor(filePath: string, property: string[]);
42
+ }
43
+ export declare class DuplicateModelDefinitionError extends DefinitionError {
44
+ constructor(modelName: string, filePath: string, property: string[]);
45
+ }
@@ -1,7 +1,89 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
+ import chalk from 'chalk';
4
+ import ts from 'typescript';
3
5
  import { exampleFolder } from './constants.js';
4
6
  export async function syncTsConfig({ fullPath }) {
5
7
  await fs.promises.writeFile(path.join(fullPath, 'tsconfig.json'), await fs.promises.readFile(path.join(exampleFolder, 'tsconfig.json')));
6
8
  }
9
+ export function fileErrorToText({ filePath, msg, line, character }) {
10
+ return `${chalk.red('err')} - ${chalk.blue(filePath)}${line ? chalk.yellow(`:${line + 1}${character ? `:${character + 1}` : ''}`) : ''} \r\n ${msg}\r\n`;
11
+ }
12
+ export function tsDiagnosticToText(fullPath) {
13
+ return (diagnostic) => {
14
+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
15
+ if (diagnostic.file && diagnostic.start !== null) {
16
+ const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
17
+ const fileName = diagnostic.file.fileName.replace(`${fullPath}/`, '');
18
+ console.log(fileErrorToText({ filePath: fileName, msg: message, line, character }));
19
+ }
20
+ else {
21
+ console.error(message);
22
+ }
23
+ };
24
+ }
25
+ export const badExportCompilerError = 'Invalid default export: should be createAction(), createSync() or createOnEvent()';
26
+ export class ReadableError extends Error {
27
+ }
28
+ export class DefinitionError extends ReadableError {
29
+ filePath;
30
+ property;
31
+ constructor(msg, filePath, property) {
32
+ super(msg);
33
+ this.filePath = filePath;
34
+ this.property = property;
35
+ }
36
+ toText() {
37
+ return fileErrorToText({
38
+ filePath: this.filePath,
39
+ msg: `${chalk.grey(this.property.join(' > '))} ${this.message}`
40
+ });
41
+ }
42
+ }
43
+ export class CompileError extends ReadableError {
44
+ type;
45
+ customMessage;
46
+ lineNumber;
47
+ filePath;
48
+ constructor(type, lineNumber, message, filePath) {
49
+ super(type);
50
+ this.type = type;
51
+ this.lineNumber = lineNumber;
52
+ this.customMessage = message ?? 'Unknown error';
53
+ this.filePath = filePath;
54
+ }
55
+ toText() {
56
+ return fileErrorToText({
57
+ filePath: this.filePath,
58
+ msg: this.customMessage,
59
+ // Incompatible with ts lineNumber
60
+ line: this.lineNumber > 0 ? this.lineNumber - 1 : 0
61
+ });
62
+ }
63
+ }
64
+ export class InvalidModelDefinitionError extends DefinitionError {
65
+ constructor(modelName, filePath, property) {
66
+ super(`Model "${modelName}" contains invalid characters. It should start with an uppercase and only contains alphanumeric characters`, filePath, property);
67
+ }
68
+ }
69
+ export class DuplicateEndpointDefinitionError extends DefinitionError {
70
+ constructor(key, filePath, property) {
71
+ super(`Endpoint "${key}" is used multiple times. Please make sure all endpoints are unique per integration.`, filePath, property);
72
+ }
73
+ }
74
+ export class EndpointMismatchDefinitionError extends DefinitionError {
75
+ constructor(filePath, property) {
76
+ super(`The number of endpoints doesn't match the number of models. You need as many endpoints as models`, filePath, property);
77
+ }
78
+ }
79
+ export class InvalidIntervalDefinitionError extends DefinitionError {
80
+ constructor(filePath, property) {
81
+ super('Interval is invalid, check syntax here https://github.com/vercel/ms', filePath, property);
82
+ }
83
+ }
84
+ export class DuplicateModelDefinitionError extends DefinitionError {
85
+ constructor(modelName, filePath, property) {
86
+ super(`Model "${modelName}" is defined multiple times. Please make sure all models are unique per integration.`, filePath, property);
87
+ }
88
+ }
7
89
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/zeroYaml/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAwB;IACjE,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC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QAAQ,CAAC,CAAC;IACrG,CAAC;CACJ;AAED,MAAM,OAAO,6BAA8B,SAAQ,eAAe;IAC9D,YAAY,SAAiB,EAAE,QAAgB,EAAE,QAAkB;QAC/D,KAAK,CAAC,UAAU,SAAS,sFAAsF,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACzI,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nango",
3
- "version": "0.60.3",
3
+ "version": "0.60.4",
4
4
  "description": "Nango's CLI tool.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,9 +33,9 @@
33
33
  "@babel/traverse": "7.27.3",
34
34
  "@babel/types": "7.27.3",
35
35
  "@babel/preset-typescript": "7.27.1",
36
- "@nangohq/nango-yaml": "0.60.3",
37
- "@nangohq/node": "0.60.3",
38
- "@nangohq/runner-sdk": "0.60.3",
36
+ "@nangohq/nango-yaml": "0.60.4",
37
+ "@nangohq/node": "0.60.4",
38
+ "@nangohq/runner-sdk": "0.60.4",
39
39
  "@swc/core": "^1.5.25",
40
40
  "@types/unzipper": "^0.10.11",
41
41
  "ajv": "^8.17.1",
@@ -68,7 +68,7 @@
68
68
  "zod": "3.24.2"
69
69
  },
70
70
  "devDependencies": {
71
- "@nangohq/types": "0.60.3",
71
+ "@nangohq/types": "0.60.4",
72
72
  "@types/babel__core": "7.20.5",
73
73
  "@types/babel__traverse": "7.20.7",
74
74
  "@types/columnify": "1.5.4",