nango 0.69.49 → 0.70.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.
@@ -1,182 +0,0 @@
1
- // When adding support for new Zod types,
2
- // check if rendering it is well supported in webapp functions input/output rendering and add support accordingly
3
- export function zodToNangoModelField(name, schema) {
4
- const optional = schema.safeParse(undefined).success;
5
- if (isZodObject(schema)) {
6
- const values = [];
7
- for (const [key, value] of Object.entries(schema.shape)) {
8
- values.push(zodToNangoModelField(key, value));
9
- }
10
- return { name, value: values, optional, description: schema.description };
11
- }
12
- else if (isZodString(schema)) {
13
- return { name, value: 'string', tsType: true, optional, description: schema.description };
14
- }
15
- else if (isZodLiteral(schema)) {
16
- if (schema.def.values.length > 1) {
17
- const values = [];
18
- for (const [key, value] of Object.entries(schema.def.values)) {
19
- values.push({ name: key.toString(), value: value, description: schema.description });
20
- }
21
- return { name, value: values, optional, union: true, description: schema.description };
22
- }
23
- return { name, value: schema.def.values[0], optional, description: schema.description };
24
- }
25
- else if (isZodNumber(schema)) {
26
- return { name, value: 'number', tsType: true, optional, description: schema.description };
27
- }
28
- else if (isZodBoolean(schema)) {
29
- return { name, value: 'boolean', tsType: true, optional, description: schema.description };
30
- }
31
- else if (isZodNull(schema)) {
32
- return { name, value: null, tsType: true, optional, description: schema.description };
33
- }
34
- else if (isZodNullable(schema)) {
35
- return { ...zodToNangoModelField(name, schema.def.innerType), optional, description: schema.description };
36
- }
37
- else if (isZodEnum(schema)) {
38
- const values = [];
39
- let i = 0;
40
- for (const value of Object.values(schema.def.entries)) {
41
- values.push({ name: i.toString(), value: value, description: schema.description });
42
- i++;
43
- }
44
- return { name, value: values, optional, union: true, description: schema.description };
45
- }
46
- else if (isZodAny(schema)) {
47
- return { name, value: 'any', tsType: true, optional, description: schema.description };
48
- }
49
- else if (isZodDate(schema)) {
50
- return { name, value: 'Date', tsType: true, optional, description: schema.description };
51
- }
52
- else if (isZodRecord(schema)) {
53
- return { name, value: [{ ...zodToNangoModelField('__string', schema.def.valueType), dynamic: true }], optional, description: schema.description };
54
- }
55
- else if (isZodArray(schema)) {
56
- // console.log('array', schema.def);
57
- const value = zodToNangoModelField('0', schema.def.element);
58
- if (isZodObject(schema.def.element)) {
59
- return { name, value: [value], array: true, optional, description: schema.description };
60
- }
61
- return { name, value: value.value, tsType: true, array: true, optional, description: schema.description };
62
- }
63
- else if (isZodUnion(schema) || isZodDiscriminatedUnion(schema)) {
64
- const values = [];
65
- for (const [key, value] of Object.entries(schema._zod.def.options)) {
66
- values.push(zodToNangoModelField(key, value));
67
- }
68
- return { name, value: values, tsType: true, union: true, optional, description: schema.description };
69
- }
70
- else if (isZodNever(schema)) {
71
- return { name, value: 'never', tsType: true, optional, description: schema.description };
72
- }
73
- else if (isZodVoid(schema)) {
74
- return { name, value: 'void', tsType: true, description: schema.description }; // No optional on purpose because void | undefined is not valid
75
- }
76
- else if (isZodOptional(schema)) {
77
- return { ...zodToNangoModelField(name, schema.def.innerType), optional, description: schema.description };
78
- }
79
- else if (isZodUndefined(schema)) {
80
- throw new Error('z.undefined() is not supported, please use z.null() or z.optional() instead');
81
- }
82
- else if (isZodUnknown(schema)) {
83
- return { name, value: 'unknown', tsType: true, optional, description: schema.description };
84
- }
85
- else if (isZodBigInt(schema)) {
86
- return { name, value: 'bigint', tsType: true, optional, description: schema.description };
87
- }
88
- else if (isZodEmail(schema)) {
89
- // Not supported yet by "ts-json-schema-generator" (2.4.0)
90
- // return { name, value: 'email', tsType: true, optional };
91
- throw new Error(`z.email() is not supported, please use z.string() instead`);
92
- }
93
- else if (isZodUrl(schema)) {
94
- // Not supported yet by "ts-json-schema-generator" (2.4.0)
95
- // return { name, value: 'url', tsType: true, optional };
96
- throw new Error(`z.url() is not supported, please use z.string() instead`);
97
- }
98
- else if (isZodTuple(schema)) {
99
- // const values: NangoModelField['value'] = [];
100
- // for (const [key, value] of Object.entries(schema._zod.def.items)) {
101
- // values.push(zodToNangoModelField(key, value));
102
- // }
103
- // return { name, value: values, tsType: true, array: true, optional };
104
- throw new Error(`z.tuple() is not supported, please use z.array() instead`);
105
- }
106
- else {
107
- throw new Error(`field "${name}" contains an unsupported Zod type, please change or reach out to Nango support, ${JSON.stringify(schema)}`);
108
- }
109
- }
110
- // We are using type guards because instanceof does not work
111
- // the files are compiled and the zod version loaded by the scripts is the not the same
112
- // (at least that's my interpretation, as it works in unit test)
113
- function isZodObject(schema) {
114
- return schema.constructor.name === 'ZodObject';
115
- }
116
- function isZodString(schema) {
117
- return schema.constructor.name === 'ZodString';
118
- }
119
- function isZodLiteral(schema) {
120
- return schema.constructor.name === 'ZodLiteral';
121
- }
122
- function isZodNumber(schema) {
123
- return schema.constructor.name === 'ZodNumber';
124
- }
125
- function isZodBoolean(schema) {
126
- return schema.constructor.name === 'ZodBoolean';
127
- }
128
- function isZodNull(schema) {
129
- return schema.constructor.name === 'ZodNull';
130
- }
131
- function isZodEnum(schema) {
132
- return schema.constructor.name === 'ZodEnum';
133
- }
134
- function isZodArray(schema) {
135
- return schema.constructor.name === 'ZodArray';
136
- }
137
- function isZodUnion(schema) {
138
- return schema.constructor.name === 'ZodUnion';
139
- }
140
- function isZodAny(schema) {
141
- return schema.constructor.name === 'ZodAny';
142
- }
143
- function isZodRecord(schema) {
144
- return schema.constructor.name === 'ZodRecord';
145
- }
146
- function isZodDate(schema) {
147
- return schema.constructor.name === 'ZodDate';
148
- }
149
- function isZodNever(schema) {
150
- return schema.constructor.name === 'ZodNever';
151
- }
152
- function isZodVoid(schema) {
153
- return schema.constructor.name === 'ZodVoid';
154
- }
155
- function isZodOptional(schema) {
156
- return schema.constructor.name === 'ZodOptional';
157
- }
158
- function isZodNullable(schema) {
159
- return schema.constructor.name === 'ZodNullable';
160
- }
161
- function isZodUndefined(schema) {
162
- return schema.constructor.name === 'ZodUndefined';
163
- }
164
- function isZodUnknown(schema) {
165
- return schema.constructor.name === 'ZodUnknown';
166
- }
167
- function isZodDiscriminatedUnion(schema) {
168
- return schema.constructor.name === 'ZodDiscriminatedUnion';
169
- }
170
- function isZodBigInt(schema) {
171
- return schema.constructor.name === 'ZodBigInt';
172
- }
173
- function isZodEmail(schema) {
174
- return schema.constructor.name === 'ZodEmail';
175
- }
176
- function isZodUrl(schema) {
177
- return schema.constructor.name === 'ZodURL';
178
- }
179
- function isZodTuple(schema) {
180
- return schema.constructor.name === 'ZodTuple';
181
- }
182
- //# sourceMappingURL=zodToNango.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zodToNango.js","sourceRoot":"","sources":["../../lib/zeroYaml/zodToNango.ts"],"names":[],"mappings":"AAGA,yCAAyC;AACzC,iHAAiH;AAEjH,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,MAAuB;IACtE,MAAM,QAAQ,GAAI,MAAoB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;IAEpE,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,MAAM,GAA6B,EAAE,CAAC;QAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACtD,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAwB,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;IAC9E,CAAC;SAAM,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;IAC9F,CAAC;SAAM,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,IAAI,MAAM,CAAC,GAAG,CAAC,M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K,YAAY,CAAC;AACpD,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAuB;IACpD,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,uBAAuB,CAAC;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,MAAuB;IACxC,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC;AACnD,CAAC;AAED,SAAS,UAAU,CAAC,MAAuB;IACvC,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC;AAClD,CAAC;AAED,SAAS,QAAQ,CAAC,MAAuB;IACrC,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,CAAC;AAChD,CAAC;AAED,SAAS,UAAU,CAAC,MAAuB;IACvC,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC;AAClD,CAAC"}
@@ -1,81 +0,0 @@
1
- You are an expert at building custom integrations for Nango. Follow the instructions below to build robust, well-tested integrations that follow Nango architecture and patterns.
2
-
3
- ## About Nango
4
-
5
- Nango is a platform for building and managing API integrations. You'll be working with:
6
- - **Syncs**: Continuous data synchronization from external APIs
7
- - **Actions**: One-time operations that interact with external APIs
8
- - **Providers**: External services (like GitHub, Slack, HubSpot, etc.)
9
-
10
- Official Nango documentation is available at https://nango.dev/docs
11
-
12
- ## Development Environment
13
-
14
- Before starting any integration work:
15
-
16
- 1. **Working Nango integrations folder**: Ensure you are in an existing `nango-integrations` directory or run `nango init`
17
- 2. **Environment setup**: `.env` file must be configured with development environment secret. If not, ask the user to provide the secret key (found in [dashboard settings](https://app.nango.dev/dev/environment-settings))
18
- 3. **Provider configured**: The provider should be configured in the [Nango dashboard](https://app.nango.dev/dev/integrations)
19
- 4. **Test connection**: If possible at least one working test connection for the target provider
20
-
21
- ## When Building Integrations
22
-
23
- ### Essential Information to Gather
24
-
25
- Before implementing, always ask for:
26
- - **Provider name** (e.g., "github", "slack", "hubspot")
27
- - **Integration name** (descriptive name for the specific integration. ex: create-contact, list-issues)
28
- - **Type**: sync or action. Try to infer from the instructions. if in doubt, ask the user
29
-
30
- If possible the users must also provide:
31
- - **Output schema**: Expected data structure
32
- - **Field mapping**: How API fields map to desired output
33
- - **API documentation links**
34
- - **Specific API endpoints** to call
35
- - **Test connection ID** (enables testing with `nango dryrun`)
36
-
37
- ### Effective Implementation Process
38
-
39
- 1. **Start simple**: For example, begin with basic data fetching
40
- 2. **Search the web for API documentation**: Retrieve details about how to use API endpoints from provider official documentation
41
- 3. **Test frequently**: Use `nango dryrun <integration-name> <connection-id> --validation [--input '{...}']` after each change
42
- 4. **Review thoroughly**: Check for code artifacts and ensure code quality
43
-
44
- ### DO NOT
45
-
46
- - Do NOT set Authorization header (Nango handles this automatically)
47
- - Do NOT run `nango deploy`
48
- - Do NOT edit the models.ts file. It is automatically generated at compilation time.
49
- - Do NOT prefix the integration name and/or folder with `integrations`
50
-
51
- ### Compile
52
-
53
- Run `nango compile` to generate the models and compile the typescript code.
54
-
55
- ### Testing Commands
56
-
57
- Always use these commands to validate your integration:
58
- ```bash
59
- # Basic test
60
- nango dryrun <integration-name> <connection-id>
61
-
62
- # Test with validation
63
- nango dryrun <integration-name> <connection-id> --validation
64
-
65
- # Test action with input
66
- nango dryrun <integration-name> <connection-id> --validation --input '{"key": "value"}'
67
- ```
68
-
69
- ### Code Quality Checklist
70
-
71
- Always verify:
72
- - [ ] Code is compiling without any error: `nango compile`
73
- - [ ] API endpoints are correctly implemented (search for actual API docs)
74
- - [ ] Proper query parameters and/or request body are used
75
- - [ ] Input and output validation is implemented
76
- - [ ] Error handling covers common failure scenarios
77
- - [ ] Pagination is implemented correctly if needed
78
- - [ ] Data models match the expected schema
79
- - [ ] All debugging code and artifacts are removed
80
- - [ ] `nango dryrun` run successfully without errors. If input are required, provider JSON input examples.
81
-