@nangohq/nango-yaml
Advanced tools
Comparing version 0.42.22 to 0.43.0
import type { StringValue } from 'ms'; | ||
import type { HTTP_METHOD, NangoSyncEndpointV2, NangoYaml, NangoYamlParsed, NangoYamlParsedIntegration } from '@nangohq/types'; | ||
import type { HTTP_METHOD, NangoSyncEndpointV2, NangoYaml, NangoYamlParsed, NangoYamlParsedIntegration, NangoYamlV2Endpoint } from '@nangohq/types'; | ||
interface IntervalResponse { | ||
@@ -33,3 +33,3 @@ interval: StringValue; | ||
}): NangoYamlParsedIntegration | null; | ||
export declare function parseEndpoint(rawEndpoint: string | NangoSyncEndpointV2, defaultMethod: HTTP_METHOD): NangoSyncEndpointV2; | ||
export declare function parseEndpoint(rawEndpoint: string | NangoSyncEndpointV2 | NangoYamlV2Endpoint, defaultMethod: HTTP_METHOD): NangoSyncEndpointV2; | ||
export {}; |
@@ -166,4 +166,4 @@ import path from 'node:path'; | ||
} | ||
return rawEndpoint; | ||
return { method: rawEndpoint.method || defaultMethod, path: rawEndpoint.path, entity: rawEndpoint.entity }; | ||
} | ||
//# sourceMappingURL=helpers.js.map |
@@ -277,4 +277,53 @@ import { expect, describe, it } from 'vitest'; | ||
}); | ||
it('should handle endpoint new format (single)', () => { | ||
const v2 = { | ||
models: { Found: { id: 'string' } }, | ||
integrations: { | ||
provider: { actions: { getGithubIssue: { endpoint: { method: 'POST', path: '/ticketing/tickets/{Found:id}' } } } } | ||
} | ||
}; | ||
const parser = new NangoYamlParserV2({ raw: v2, yaml: '' }); | ||
parser.parse(); | ||
expect(parser.errors).toStrictEqual([]); | ||
expect(parser.warnings).toStrictEqual([]); | ||
expect(parser.parsed?.integrations[0]?.actions).toMatchObject([ | ||
{ | ||
endpoint: { method: 'POST', path: '/ticketing/tickets/{Found:id}' } | ||
} | ||
]); | ||
}); | ||
it('should handle endpoint new format (array)', () => { | ||
const v2 = { | ||
models: { Input: { id: 'string' }, Top: { id: 'string' }, Tip: { id: 'string' } }, | ||
integrations: { | ||
provider: { | ||
syncs: { | ||
top: { | ||
runs: 'every day', | ||
input: 'Input', | ||
output: ['Top', 'Tip'], | ||
endpoint: [ | ||
{ method: 'GET', path: '/provider/top' }, | ||
{ path: '/provider/tip', entity: 'Record' } | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
const parser = new NangoYamlParserV2({ raw: v2, yaml: '' }); | ||
parser.parse(); | ||
expect(parser.errors).toStrictEqual([]); | ||
expect(parser.warnings).toStrictEqual([]); | ||
expect(parser.parsed?.integrations[0]?.syncs).toMatchObject([ | ||
{ | ||
endpoints: [ | ||
{ method: 'GET', path: '/provider/top' }, | ||
{ method: 'GET', path: '/provider/tip', entity: 'Record' } | ||
] | ||
} | ||
]); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=parser.v2.unit.test.js.map |
{ | ||
"name": "@nangohq/nango-yaml", | ||
"version": "0.42.22", | ||
"version": "0.43.0", | ||
"type": "module", | ||
@@ -20,3 +20,3 @@ "main": "./dist/index.js", | ||
"devDependencies": { | ||
"@nangohq/types": "0.42.22", | ||
"@nangohq/types": "0.43.0", | ||
"vitest": "1.6.0" | ||
@@ -23,0 +23,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
174033
2089