nango 0.40.0 → 0.40.2

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.
Files changed (52) hide show
  1. package/dist/cli.d.ts +16 -4
  2. package/dist/cli.js +76 -124
  3. package/dist/cli.js.map +1 -1
  4. package/dist/constants.d.ts +0 -1
  5. package/dist/constants.js +0 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/index.js +38 -23
  8. package/dist/index.js.map +1 -1
  9. package/dist/services/compile.service.d.ts +14 -9
  10. package/dist/services/compile.service.js +71 -67
  11. package/dist/services/compile.service.js.map +1 -1
  12. package/dist/services/compile.service.unit.test.js +17 -7
  13. package/dist/services/compile.service.unit.test.js.map +1 -1
  14. package/dist/services/config.service.d.ts +16 -7
  15. package/dist/services/config.service.js +84 -55
  16. package/dist/services/config.service.js.map +1 -1
  17. package/dist/services/config.service.unit.test.d.ts +1 -0
  18. package/dist/services/config.service.unit.test.js +147 -0
  19. package/dist/services/config.service.unit.test.js.map +1 -0
  20. package/dist/services/deploy.service.d.ts +14 -5
  21. package/dist/services/deploy.service.js +81 -71
  22. package/dist/services/deploy.service.js.map +1 -1
  23. package/dist/services/dryrun.service.js +11 -11
  24. package/dist/services/dryrun.service.js.map +1 -1
  25. package/dist/services/migration.service.js +23 -26
  26. package/dist/services/migration.service.js.map +1 -1
  27. package/dist/services/model.service.d.ts +38 -8
  28. package/dist/services/model.service.js +129 -167
  29. package/dist/services/model.service.js.map +1 -1
  30. package/dist/services/model.service.unit.test.d.ts +1 -0
  31. package/dist/services/model.service.unit.test.js +138 -0
  32. package/dist/services/model.service.unit.test.js.map +1 -0
  33. package/dist/services/parser.service.d.ts +1 -2
  34. package/dist/services/parser.service.js +3 -4
  35. package/dist/services/parser.service.js.map +1 -1
  36. package/dist/services/verification.service.d.ts +9 -2
  37. package/dist/services/verification.service.js +20 -22
  38. package/dist/services/verification.service.js.map +1 -1
  39. package/dist/sync.unit.cli-test.js +157 -222
  40. package/dist/sync.unit.cli-test.js.map +1 -1
  41. package/dist/templates/action.ejs +2 -47
  42. package/dist/templates/nango.yaml +1 -2
  43. package/dist/templates/sync.ejs +1 -4
  44. package/dist/utils/layoutMode.d.ts +7 -0
  45. package/dist/utils/layoutMode.js +41 -0
  46. package/dist/utils/layoutMode.js.map +1 -0
  47. package/dist/utils.d.ts +0 -3
  48. package/dist/utils.js +4 -127
  49. package/dist/utils.js.map +1 -1
  50. package/lib/nango.yaml.schema.v2.json +183 -178
  51. package/package.json +7 -6
  52. package/dist/nango-sync.d.ts +0 -299
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "type": "object",
4
+ "additionalProperties": false,
4
5
  "properties": {
5
6
  "integrations": {
6
7
  "type": "object",
7
8
  "additionalProperties": {
8
9
  "type": "object",
10
+ "additionalProperties": false,
9
11
  "properties": {
10
12
  "post-connection-scripts": {
11
13
  "type": "array",
@@ -13,215 +15,218 @@
13
15
  "type": "string"
14
16
  },
15
17
  "errorMessage": {
16
- "_": "nango yaml schema validation error: post-connection-scripts must be an array of strings."
18
+ "_": "post-connection-scripts must be an array of strings."
17
19
  }
18
20
  },
19
21
  "syncs": {
20
- "errorMessage": {
21
- "_": " "
22
- },
23
- "anyOf": [
24
- {
22
+ "type": "object",
23
+ "patternProperties": {
24
+ "[a-zA-Z0-9-]+": {
25
25
  "type": "object",
26
26
  "additionalProperties": false,
27
- "errorMessage": {
28
- "_": " "
29
- }
30
- },
31
- {
32
- "type": "null",
33
- "errorMessage": {
34
- "_": " "
35
- }
36
- },
37
- {
38
- "type": "object",
39
- "additionalProperties": {
40
- "type": "object",
41
- "properties": {
42
- "description": {
43
- "type": "string",
44
- "errorMessage": {
45
- "type": "nango yaml schema validation error: description must be a string."
46
- }
47
- },
48
- "sync_type": {
49
- "type": "string",
50
- "enum": ["incremental", "full"],
51
- "errorMessage": {
52
- "enum": "nango yaml schema validation error: sync_type must be either 'incremental' or 'full'."
53
- }
54
- },
55
- "track_deletes": {
56
- "type": "boolean",
57
- "errorMessage": {
58
- "type": "nango yaml schema validation error: track_deletes must be a boolean."
59
- }
60
- },
61
- "auto_start": {
62
- "type": "boolean",
63
- "errorMessage": {
64
- "type": "nango yaml schema validation error: auto_start must be a boolean."
65
- }
66
- },
67
- "runs": {
68
- "type": "string",
69
- "errorMessage": {
70
- "type": "nango yaml schema validation error: runs must be a string and include the word \"every\"."
71
- }
72
- },
73
- "endpoint": {
74
- "oneOf": [
75
- { "type": "string" },
76
- {
77
- "type": "array",
78
- "items": { "type": "string" }
27
+ "properties": {
28
+ "description": {
29
+ "type": "string",
30
+ "errorMessage": {
31
+ "type": "description must be a string."
32
+ }
33
+ },
34
+ "sync_type": {
35
+ "type": "string",
36
+ "enum": ["incremental", "full"],
37
+ "errorMessage": {
38
+ "enum": "sync_type must be either 'incremental' or 'full'."
39
+ }
40
+ },
41
+ "track_deletes": {
42
+ "type": "boolean",
43
+ "errorMessage": {
44
+ "type": "track_deletes must be a boolean."
45
+ }
46
+ },
47
+ "auto_start": {
48
+ "type": "boolean",
49
+ "errorMessage": {
50
+ "type": "auto_start must be a boolean."
51
+ }
52
+ },
53
+ "runs": {
54
+ "type": "string",
55
+ "errorMessage": {
56
+ "type": "runs must be a string and include the word \"every\"."
57
+ }
58
+ },
59
+ "endpoint": {
60
+ "oneOf": [
61
+ {
62
+ "type": "string",
63
+ "pattern": "^(GET\\s)?/[a-zA-Z0-9-./_]+$",
64
+ "errorMessage": {
65
+ "_": " "
79
66
  }
80
- ],
81
- "errorMessage": {
82
- "_": "nango yaml schema validation error: endpoint must be a string or an array of strings."
83
- }
84
- },
85
- "scopes": {
86
- "oneOf": [
87
- { "type": "string" },
88
- {
89
- "type": "array",
90
- "items": { "type": "string" }
67
+ },
68
+ {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "string",
72
+ "pattern": "^(GET\\s)?/[a-zA-Z0-9-./_]+$",
73
+ "errorMessage": {
74
+ "_": " "
75
+ }
91
76
  }
92
- ],
93
- "errorMessage": {
94
- "_": "nango yaml schema validation error: scopes must be a string or an array of strings."
95
77
  }
96
- },
97
- "input": {
98
- "type": "string",
99
- "nullable": true,
100
- "errorMessage": {
101
- "type": "nango yaml schema validation error: input must be a string and should define any required metadata for the sync."
102
- }
103
- },
104
- "output": {
105
- "oneOf": [
106
- { "type": "string" },
107
- {
108
- "type": "array",
109
- "items": { "type": "string" }
78
+ ],
79
+ "errorMessage": {
80
+ "_": "endpoint must be a URL (or an array of URLs) with an HTTP verb, i.e: \"GET /tickets/ticket\""
81
+ }
82
+ },
83
+ "scopes": {
84
+ "oneOf": [
85
+ {
86
+ "type": "string"
87
+ },
88
+ {
89
+ "type": "array",
90
+ "items": {
91
+ "type": "string"
110
92
  }
111
- ],
112
- "errorMessage": {
113
- "_": "nango yaml schema validation error: output must be a string or an array of strings."
114
93
  }
115
- },
116
- "webhook-subscriptions": {
117
- "oneOf": [
118
- { "type": "string" },
119
- {
120
- "type": "array",
121
- "items": { "type": "string" }
94
+ ],
95
+ "errorMessage": {
96
+ "_": "scopes must be a string or an array of strings."
97
+ }
98
+ },
99
+ "input": {
100
+ "type": "string",
101
+ "nullable": true,
102
+ "errorMessage": {
103
+ "type": "input must be a string and should define any required metadata for the sync."
104
+ }
105
+ },
106
+ "output": {
107
+ "oneOf": [
108
+ {
109
+ "type": "string"
110
+ },
111
+ {
112
+ "type": "array",
113
+ "items": {
114
+ "type": "string"
122
115
  }
123
- ],
124
- "errorMessage": {
125
- "_": "nango yaml schema validation error: webhook-subscriptions must be a string or an array of strings."
126
116
  }
117
+ ],
118
+ "errorMessage": {
119
+ "_": "output must be a string or an array of strings."
127
120
  }
128
121
  },
129
- "required": ["endpoint", "output"],
130
- "errorMessage": {
131
- "required": {
132
- "endpoint": "nango yaml schema validation error: An endpoint property is required to specify how to retrieve the data from the sync.",
133
- "output": "nango yaml schema validation error: An output property is required to specify what is the outcome of the sync."
122
+ "webhook-subscriptions": {
123
+ "oneOf": [
124
+ {
125
+ "type": "string"
126
+ },
127
+ {
128
+ "type": "array",
129
+ "items": {
130
+ "type": "string"
131
+ }
132
+ }
133
+ ],
134
+ "errorMessage": {
135
+ "_": "webhook-subscriptions must be a string or an array of strings."
134
136
  }
135
137
  }
138
+ },
139
+ "required": ["endpoint", "output", "runs"],
140
+ "errorMessage": {
141
+ "required": {
142
+ "endpoint": "An endpoint property is required to specify how to retrieve the data from the sync.",
143
+ "output": "An output property is required to specify what is the outcome of the sync."
144
+ }
136
145
  }
137
146
  }
138
- ]
147
+ }
139
148
  },
140
149
  "actions": {
141
- "errorMessage": {
142
- "_": " "
143
- },
144
- "anyOf": [
145
- {
146
- "type": "null",
147
- "errorMessage": {
148
- "_": " "
149
- }
150
- },
151
- {
150
+ "type": "object",
151
+ "patternProperties": {
152
+ "[a-zA-Z0-9-]+": {
152
153
  "type": "object",
153
154
  "additionalProperties": false,
154
- "errorMessage": {
155
- "_": " "
156
- }
157
- },
158
- {
159
- "type": "object",
160
- "additionalProperties": {
161
- "type": "object",
162
- "properties": {
163
- "description": {
164
- "type": "string",
165
- "errorMessage": {
166
- "type": "nango yaml schema validation error: description must be a string."
167
- }
168
- },
169
- "endpoint": {
170
- "type": "string",
171
- "errorMessage": {
172
- "type": "nango yaml schema validation error: endpoint must be a string, for example \"POST /tickets/ticket\"."
173
- }
174
- },
175
- "scopes": {
176
- "oneOf": [
177
- { "type": "string" },
178
- {
179
- "type": "array",
180
- "items": { "type": "string" }
181
- }
182
- ],
183
- "errorMessage": {
184
- "_": "nango yaml schema validation error: scopes must be a string or an array of strings."
185
- }
186
- },
187
- "input": {
188
- "type": "string",
189
- "nullable": true,
190
- "errorMessage": {
191
- "type": "nango yaml schema validation error: input must be a string and should define any required metadata for the sync."
192
- }
193
- },
194
- "output": {
195
- "oneOf": [
196
- { "type": "string" },
197
- {
198
- "type": "array",
199
- "items": { "type": "string" }
155
+ "properties": {
156
+ "description": {
157
+ "type": "string",
158
+ "errorMessage": {
159
+ "type": "description must be a string."
160
+ }
161
+ },
162
+ "endpoint": {
163
+ "type": "string",
164
+ "pattern": "^((GET|POST|PUT|PATCH|DELETE)\\s)?/[a-zA-Z0-9-:{}./_]+$",
165
+ "errorMessage": {
166
+ "type": "endpoint must be a URI with an HTTP verb, i.e: \"POST /tickets/ticket\"",
167
+ "pattern": "endpoint must be a URI with an HTTP verb, i.e: \"POST /tickets/ticket\""
168
+ }
169
+ },
170
+ "scopes": {
171
+ "oneOf": [
172
+ {
173
+ "type": "string"
174
+ },
175
+ {
176
+ "type": "array",
177
+ "items": {
178
+ "type": "string"
200
179
  }
201
- ],
202
- "errorMessage": {
203
- "_": "nango yaml schema validation error: output must be a string or an array of strings."
204
180
  }
181
+ ],
182
+ "errorMessage": {
183
+ "_": "scopes must be a string or an array of strings."
205
184
  }
206
185
  },
207
- "required": ["endpoint"],
208
- "errorMessage": {
209
- "required": {
210
- "endpoint": "nango yaml schema validation error: An endpoint property is required to specify how to trigger the action."
211
- },
212
- "_": "nango yaml schema validation error: webhook-subscriptions is not a valid property for an action."
186
+ "input": {
187
+ "type": "string",
188
+ "nullable": true,
189
+ "errorMessage": {
190
+ "type": "input must be a string and should define any required input for the action."
191
+ }
213
192
  },
214
- "not": {
215
- "required": ["webhook-subscriptions"]
193
+ "output": {
194
+ "oneOf": [
195
+ {
196
+ "type": "string"
197
+ },
198
+ {
199
+ "type": "array",
200
+ "items": {
201
+ "type": "string"
202
+ }
203
+ }
204
+ ],
205
+ "errorMessage": {
206
+ "_": "output must be a string or an array of strings."
207
+ }
208
+ }
209
+ },
210
+ "required": ["endpoint"],
211
+ "errorMessage": {
212
+ "required": {
213
+ "endpoint": "An endpoint property is required to specify how to trigger the action."
216
214
  }
217
215
  }
218
216
  }
219
- ]
217
+ }
220
218
  }
221
- },
222
- "additionalProperties": false
219
+ }
220
+ }
221
+ },
222
+ "models": {
223
+ "type": "object",
224
+ "patternProperties": {
225
+ "[a-zA-Z0-9_-]": {
226
+ "type": "object",
227
+ "additionalProperties": true
228
+ }
223
229
  }
224
230
  }
225
- },
226
- "additionalProperties": true
231
+ }
227
232
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nango",
3
- "version": "0.40.0",
3
+ "version": "0.40.2",
4
4
  "description": "Nango's CLI tool.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,16 +17,15 @@
17
17
  },
18
18
  "license": "SEE LICENSE IN LICENSE FILE IN GIT REPOSITORY",
19
19
  "scripts": {
20
- "postbuild": "npm run copy:types",
21
20
  "copy:files": "copyfiles -u 1 lib/templates/* dist",
22
- "copy:types": "cp `node -p \"require.resolve('@nangohq/shared/dist/sdk/sync.d.ts')\"` './dist/nango-sync.d.ts'",
23
- "prepublishOnly": "npm run copy:files && npm run copy:types"
21
+ "prepublishOnly": "npm run copy:files"
24
22
  },
25
23
  "dependencies": {
26
24
  "@babel/parser": "^7.22.5",
27
25
  "@babel/traverse": "^7.22.5",
28
26
  "@babel/types": "^7.22.5",
29
- "@nangohq/shared": "^0.40.0",
27
+ "@nangohq/nango-yaml": "^0.40.2",
28
+ "@nangohq/shared": "^0.40.2",
30
29
  "@swc/core": "^1.5.25",
31
30
  "ajv": "^8.12.0",
32
31
  "ajv-errors": "^3.0.0",
@@ -41,6 +40,7 @@
41
40
  "ejs": "^3.1.10",
42
41
  "figlet": "^1.6.0",
43
42
  "glob": "^10.3.10",
43
+ "import-meta-resolve": "^4.1.0",
44
44
  "js-yaml": "^4.1.0",
45
45
  "memfs": "^3.5.1",
46
46
  "npm-package-arg": "^10.1.0",
@@ -56,7 +56,7 @@
56
56
  "@babel/core": "^7.22.1",
57
57
  "@babel/preset-env": "^7.22.4",
58
58
  "@babel/preset-typescript": "^7.21.5",
59
- "@nangohq/types": "^0.40.0",
59
+ "@nangohq/types": "^0.40.2",
60
60
  "@types/babel__traverse": "^7.20.1",
61
61
  "@types/babel-traverse": "^6.25.7",
62
62
  "@types/commander": "^2.12.2",
@@ -68,6 +68,7 @@
68
68
  "@types/promptly": "^3.0.2",
69
69
  "babel-loader": "^9.1.2",
70
70
  "esbuild": "^0.17.19",
71
+ "strip-ansi": "7.1.0",
71
72
  "vitest": "^0.33.0",
72
73
  "webpack": "^5.85.1",
73
74
  "webpack-cli": "^5.1.3",