@nangohq/runner-sdk 0.48.3
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/action.d.ts +81 -0
- package/dist/action.js +243 -0
- package/dist/action.js.map +1 -0
- package/dist/dataValidation.d.ts +11 -0
- package/dist/dataValidation.js +56 -0
- package/dist/dataValidation.js.map +1 -0
- package/dist/dataValidation.unit.test.d.ts +1 -0
- package/dist/dataValidation.unit.test.js +140 -0
- package/dist/dataValidation.unit.test.js.map +1 -0
- package/dist/errors.d.ts +28 -0
- package/dist/errors.js +37 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/paginate.service.d.ts +12 -0
- package/dist/paginate.service.js +146 -0
- package/dist/paginate.service.js.map +1 -0
- package/dist/sdk.d.ts +111 -0
- package/dist/sdk.js +303 -0
- package/dist/sdk.js.map +1 -0
- package/dist/sync.d.ts +19 -0
- package/dist/sync.js +42 -0
- package/dist/sync.js.map +1 -0
- package/models.d.ts +422 -0
- package/package.json +26 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AxiosResponse } from 'axios';
|
|
2
|
+
import type { CursorPagination, LinkPagination, OffsetPagination, Pagination, UserProvidedProxyConfiguration } from '@nangohq/types';
|
|
3
|
+
declare class PaginationService {
|
|
4
|
+
validateConfiguration(paginationConfig: Pagination): void;
|
|
5
|
+
cursor<T>(config: UserProvidedProxyConfiguration, paginationConfig: CursorPagination, updatedBodyOrParams: Record<string, any>, passPaginationParamsInBody: boolean, proxy: (config: UserProvidedProxyConfiguration) => Promise<AxiosResponse>): AsyncGenerator<T[], undefined, void>;
|
|
6
|
+
link<T>(config: UserProvidedProxyConfiguration, paginationConfig: LinkPagination, updatedBodyOrParams: Record<string, any>, passPaginationParamsInBody: boolean, proxy: (config: UserProvidedProxyConfiguration) => Promise<AxiosResponse>): AsyncGenerator<T[], undefined, void>;
|
|
7
|
+
offset<T>(config: UserProvidedProxyConfiguration, paginationConfig: OffsetPagination, updatedBodyOrParams: Record<string, any>, passPaginationParamsInBody: boolean, proxy: (config: UserProvidedProxyConfiguration) => Promise<AxiosResponse>): AsyncGenerator<T[], undefined, void>;
|
|
8
|
+
private updateConfigBodyOrParams;
|
|
9
|
+
private getNextPageLinkFromBodyOrHeaders;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: PaginationService;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import parseLinksHeader from 'parse-link-header';
|
|
2
|
+
import get from 'lodash-es/get.js';
|
|
3
|
+
function isValidURL(str) {
|
|
4
|
+
try {
|
|
5
|
+
new URL(str); // TODO: replace with canParse after we drop node v18
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class PaginationService {
|
|
13
|
+
validateConfiguration(paginationConfig) {
|
|
14
|
+
if (!paginationConfig.type) {
|
|
15
|
+
throw new Error('Pagination type is required');
|
|
16
|
+
}
|
|
17
|
+
const { type } = paginationConfig;
|
|
18
|
+
if (paginationConfig.type === 'cursor') {
|
|
19
|
+
const cursorPagination = paginationConfig;
|
|
20
|
+
if (!cursorPagination.cursor_name_in_request) {
|
|
21
|
+
throw new Error('Param cursor_name_in_request is required for cursor pagination');
|
|
22
|
+
}
|
|
23
|
+
if (!cursorPagination.cursor_path_in_response) {
|
|
24
|
+
throw new Error('Param cursor_path_in_response is required for cursor pagination');
|
|
25
|
+
}
|
|
26
|
+
if (paginationConfig.limit && !paginationConfig.limit_name_in_request) {
|
|
27
|
+
throw new Error('Param limit_name_in_request is required for cursor pagination when limit is set');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (type === 'link') {
|
|
31
|
+
const linkPagination = paginationConfig;
|
|
32
|
+
if (!linkPagination.link_rel_in_response_header && !linkPagination.link_path_in_response_body) {
|
|
33
|
+
throw new Error('Either param link_rel_in_response_header or link_path_in_response_body is required for link pagination');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (type === 'offset') {
|
|
37
|
+
const offsetPagination = paginationConfig;
|
|
38
|
+
if (!offsetPagination.offset_name_in_request) {
|
|
39
|
+
throw new Error('Param offset_name_in_request is required for offset pagination');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw new Error(`Pagination type ${type} is not supported. Only cursor, link and offset pagination types are supported.`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async *cursor(config, paginationConfig, updatedBodyOrParams, passPaginationParamsInBody, proxy) {
|
|
47
|
+
const cursorPagination = paginationConfig;
|
|
48
|
+
let nextCursor;
|
|
49
|
+
do {
|
|
50
|
+
if (typeof nextCursor !== 'undefined') {
|
|
51
|
+
updatedBodyOrParams[cursorPagination.cursor_name_in_request] = nextCursor;
|
|
52
|
+
}
|
|
53
|
+
this.updateConfigBodyOrParams(passPaginationParamsInBody, config, updatedBodyOrParams);
|
|
54
|
+
const response = await proxy(config);
|
|
55
|
+
const responseData = cursorPagination.response_path ? get(response.data, cursorPagination.response_path) : response.data;
|
|
56
|
+
if (!responseData || !responseData.length) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
yield responseData;
|
|
60
|
+
nextCursor = get(response.data, cursorPagination.cursor_path_in_response);
|
|
61
|
+
if (typeof nextCursor === 'string') {
|
|
62
|
+
nextCursor = nextCursor.trim();
|
|
63
|
+
if (!nextCursor) {
|
|
64
|
+
nextCursor = undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (typeof nextCursor !== 'number') {
|
|
68
|
+
nextCursor = undefined;
|
|
69
|
+
}
|
|
70
|
+
} while (typeof nextCursor !== 'undefined');
|
|
71
|
+
}
|
|
72
|
+
async *link(config, paginationConfig, updatedBodyOrParams, passPaginationParamsInBody, proxy) {
|
|
73
|
+
const linkPagination = paginationConfig;
|
|
74
|
+
this.updateConfigBodyOrParams(passPaginationParamsInBody, config, updatedBodyOrParams);
|
|
75
|
+
while (true) {
|
|
76
|
+
const response = await proxy(config);
|
|
77
|
+
const responseData = paginationConfig.response_path ? get(response.data, paginationConfig.response_path) : response.data;
|
|
78
|
+
if (!responseData.length) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
yield responseData;
|
|
82
|
+
const nextPageLink = this.getNextPageLinkFromBodyOrHeaders(linkPagination, response, paginationConfig);
|
|
83
|
+
if (!nextPageLink) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!isValidURL(nextPageLink)) {
|
|
87
|
+
// some providers only send path+query params in the link so we can immediately assign those to the endpoint
|
|
88
|
+
config.endpoint = nextPageLink;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const url = new URL(nextPageLink);
|
|
92
|
+
config.endpoint = url.pathname + url.search;
|
|
93
|
+
}
|
|
94
|
+
delete config.params;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async *offset(config, paginationConfig, updatedBodyOrParams, passPaginationParamsInBody, proxy) {
|
|
98
|
+
const offsetPagination = paginationConfig;
|
|
99
|
+
const offsetParameterName = offsetPagination.offset_name_in_request;
|
|
100
|
+
const offsetCalculationMethod = offsetPagination.offset_calculation_method || 'by-response-size';
|
|
101
|
+
let offset = offsetPagination.offset_start_value || 0;
|
|
102
|
+
while (true) {
|
|
103
|
+
updatedBodyOrParams[offsetParameterName] = passPaginationParamsInBody ? offset : String(offset);
|
|
104
|
+
this.updateConfigBodyOrParams(passPaginationParamsInBody, config, updatedBodyOrParams);
|
|
105
|
+
const response = await proxy(config);
|
|
106
|
+
const responseData = paginationConfig.response_path ? get(response.data, paginationConfig.response_path) : response.data;
|
|
107
|
+
if (!responseData || !responseData.length) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
yield responseData;
|
|
111
|
+
if (paginationConfig['limit'] && responseData.length < paginationConfig['limit']) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (responseData.length < 1) {
|
|
115
|
+
// Last page was empty so no need to fetch further
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (offsetCalculationMethod === 'per-page') {
|
|
119
|
+
offset++;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
offset += responseData.length;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
updateConfigBodyOrParams(passPaginationParamsInBody, config, updatedBodyOrParams) {
|
|
127
|
+
if (passPaginationParamsInBody) {
|
|
128
|
+
config.data = updatedBodyOrParams;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
config.params = updatedBodyOrParams;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
getNextPageLinkFromBodyOrHeaders(linkPagination, response, paginationConfig) {
|
|
135
|
+
if (linkPagination.link_rel_in_response_header) {
|
|
136
|
+
const linkHeader = parseLinksHeader(response.headers['link']);
|
|
137
|
+
return linkHeader?.[linkPagination.link_rel_in_response_header]?.url;
|
|
138
|
+
}
|
|
139
|
+
else if (linkPagination.link_path_in_response_body) {
|
|
140
|
+
return get(response.data, linkPagination.link_path_in_response_body);
|
|
141
|
+
}
|
|
142
|
+
throw Error(`Either 'link_rel_in_response_header' or 'link_path_in_response_body' should be specified for '${paginationConfig.type}' pagination`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
export default new PaginationService();
|
|
146
|
+
//# sourceMappingURL=paginate.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginate.service.js","sourceRoot":"","sources":["../lib/paginate.service.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AACjD,OAAO,GAAG,MAAM,kBAAkB,CAAC;AAGnC,SAAS,UAAU,CAAC,GAAW;IAC3B,IAAI,CAAC;QACD,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,qDAAq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CAAC;QACL,CAAC;IACL,CAAC;IAEO,wBAAwB,CAAC,0BAAmC,EAAE,MAAsC,EAAE,mBAA2C;QACrJ,IAAI,0BAA0B,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,GAAG,mBAAmB,CAAC;QACtC,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,MAAM,GAAG,mBAAmB,CAAC;QACxC,CAAC;IACL,CAAC;IAEO,gCAAgC,CAAC,cAA8B,EAAE,QAAuB,EAAE,gBAA4B;QAC1H,IAAI,cAAc,CAAC,2BAA2B,EAAE,CAAC;YAC7C,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YAC9D,OAAO,UAAU,EAAE,CAAC,cAAc,CAAC,2BAA2B,CAAC,EAAE,GAAG,CAAC;QACzE,CAAC;aAAM,IAAI,cAAc,CAAC,0BAA0B,EAAE,CAAC;YACnD,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,0BAA0B,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,KAAK,CAAC,iGAAiG,gBAAgB,CAAC,IAAI,cAAc,CAAC,CAAC;IACtJ,CAAC;CACJ;AAED,eAAe,IAAI,iBAAiB,EAAE,CAAC"}
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Nango } from '@nangohq/node';
|
|
2
|
+
import type { AxiosResponse } from 'axios';
|
|
3
|
+
import type { ApiKeyCredentials, ApiPublicConnectionFull, AppCredentials, AppStoreCredentials, BasicApiCredentials, BillCredentials, CustomCredentials, EnvironmentVariable, GetPublicConnection, GetPublicIntegration, JwtCredentials, MaybePromise, Metadata, NangoProps, OAuth1Token, OAuth2ClientCredentials, SetMetadata, SignatureCredentials, TableauCredentials, TbaCredentials, TwoStepCredentials, UnauthCredentials, UpdateMetadata, UserLogParameters, UserProvidedProxyConfiguration } from '@nangohq/types';
|
|
4
|
+
import type { ValidateDataError } from './dataValidation.js';
|
|
5
|
+
export declare const oldLevelToNewLevel: {
|
|
6
|
+
readonly debug: "debug";
|
|
7
|
+
readonly info: "info";
|
|
8
|
+
readonly warn: "warn";
|
|
9
|
+
readonly error: "error";
|
|
10
|
+
readonly verbose: "debug";
|
|
11
|
+
readonly silly: "debug";
|
|
12
|
+
readonly http: "info";
|
|
13
|
+
};
|
|
14
|
+
export type ProxyConfiguration = Omit<UserProvidedProxyConfiguration, 'files' | 'providerConfigKey' | 'connectionId'> & {
|
|
15
|
+
providerConfigKey?: string;
|
|
16
|
+
connectionId?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare class ActionError<T = Record<string, unknown>> extends Error {
|
|
19
|
+
type: string;
|
|
20
|
+
payload?: Record<string, unknown>;
|
|
21
|
+
constructor(payload?: T);
|
|
22
|
+
}
|
|
23
|
+
export declare abstract class NangoActionBase {
|
|
24
|
+
abstract nango: Nango;
|
|
25
|
+
private attributes;
|
|
26
|
+
activityLogId?: string | undefined;
|
|
27
|
+
syncId?: string;
|
|
28
|
+
nangoConnectionId?: number;
|
|
29
|
+
environmentId: number;
|
|
30
|
+
environmentName?: string;
|
|
31
|
+
syncJobId?: number;
|
|
32
|
+
abortSignal?: NangoProps['abortSignal'];
|
|
33
|
+
syncConfig?: NangoProps['syncConfig'];
|
|
34
|
+
runnerFlags: NangoProps['runnerFlags'];
|
|
35
|
+
connectionId: string;
|
|
36
|
+
providerConfigKey: string;
|
|
37
|
+
provider?: string;
|
|
38
|
+
ActionError: typeof ActionError;
|
|
39
|
+
protected memoizedConnections: Map<string, {
|
|
40
|
+
connection: ApiPublicConnectionFull;
|
|
41
|
+
timestamp: number;
|
|
42
|
+
}>;
|
|
43
|
+
protected memoizedIntegration: Map<string, {
|
|
44
|
+
integration: GetPublicIntegration["Success"]["data"];
|
|
45
|
+
timestamp: number;
|
|
46
|
+
}>;
|
|
47
|
+
constructor(config: NangoProps);
|
|
48
|
+
protected stringify(): string;
|
|
49
|
+
protected proxyConfig(config: ProxyConfiguration): UserProvidedProxyConfiguration;
|
|
50
|
+
protected throwIfAborted(): void;
|
|
51
|
+
abstract proxy<T = any>(config: ProxyConfiguration): Promise<AxiosResponse<T>>;
|
|
52
|
+
get<T = any>(config: Omit<ProxyConfiguration, 'method'>): Promise<AxiosResponse<T>>;
|
|
53
|
+
post<T = any>(config: Omit<ProxyConfiguration, 'method'>): Promise<AxiosResponse<T>>;
|
|
54
|
+
put<T = any>(config: Omit<ProxyConfiguration, 'method'>): Promise<AxiosResponse<T>>;
|
|
55
|
+
patch<T = any>(config: Omit<ProxyConfiguration, 'method'>): Promise<AxiosResponse<T>>;
|
|
56
|
+
delete<T = any>(config: Omit<ProxyConfiguration, 'method'>): Promise<AxiosResponse<T>>;
|
|
57
|
+
getToken(): Promise<string | OAuth1Token | OAuth2ClientCredentials | BasicApiCredentials | ApiKeyCredentials | AppCredentials | AppStoreCredentials | UnauthCredentials | CustomCredentials | TbaCredentials | TableauCredentials | JwtCredentials | BillCredentials | TwoStepCredentials | SignatureCredentials>;
|
|
58
|
+
/**
|
|
59
|
+
* Get current integration
|
|
60
|
+
*/
|
|
61
|
+
getIntegration(queries?: GetPublicIntegration['Querystring']): Promise<GetPublicIntegration['Success']['data']>;
|
|
62
|
+
getConnection(providerConfigKeyOverride?: string, connectionIdOverride?: string): Promise<GetPublicConnection['Success']>;
|
|
63
|
+
setMetadata(metadata: Metadata): Promise<AxiosResponse<SetMetadata['Success']>>;
|
|
64
|
+
updateMetadata(metadata: Metadata): Promise<AxiosResponse<UpdateMetadata['Success']>>;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated please use setMetadata instead.
|
|
67
|
+
*/
|
|
68
|
+
setFieldMapping(fieldMapping: Record<string, string>): Promise<AxiosResponse<object>>;
|
|
69
|
+
getMetadata<T = Metadata>(): Promise<T>;
|
|
70
|
+
getWebhookURL(): Promise<string | null | undefined>;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated please use getMetadata instead.
|
|
73
|
+
*/
|
|
74
|
+
getFieldMapping(): Promise<Metadata>;
|
|
75
|
+
/**
|
|
76
|
+
* Log
|
|
77
|
+
* @desc Log a message to the activity log which shows up in the Nango Dashboard
|
|
78
|
+
* note that the last argument can be an object with a level property to specify the log level
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* await nango.log('This is a log message', { level: 'error' })
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
abstract log(message: any, options?: UserLogParameters | {
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
level?: never;
|
|
87
|
+
}): MaybePromise<void>;
|
|
88
|
+
abstract log(message: string, ...args: [any, UserLogParameters]): MaybePromise<void>;
|
|
89
|
+
abstract log(...args: [...any]): MaybePromise<void>;
|
|
90
|
+
getEnvironmentVariables(): Promise<EnvironmentVariable[] | null>;
|
|
91
|
+
getFlowAttributes<A = object>(): A | null;
|
|
92
|
+
paginate<T = any>(config: ProxyConfiguration): AsyncGenerator<T[], undefined, void>;
|
|
93
|
+
triggerAction<In = unknown, Out = object>(providerConfigKey: string, connectionId: string, actionName: string, input?: In): Promise<Out>;
|
|
94
|
+
abstract triggerSync(providerConfigKey: string, connectionId: string, syncName: string, fullResync?: boolean): Promise<void | string>;
|
|
95
|
+
}
|
|
96
|
+
export declare abstract class NangoSyncBase extends NangoActionBase {
|
|
97
|
+
lastSyncDate?: Date;
|
|
98
|
+
track_deletes: boolean;
|
|
99
|
+
constructor(config: NangoProps);
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated please use batchSave
|
|
102
|
+
*/
|
|
103
|
+
batchSend<T = any>(results: T[], model: string): Promise<boolean | null>;
|
|
104
|
+
abstract batchSave<T = any>(results: T[], model: string): MaybePromise<boolean>;
|
|
105
|
+
abstract batchDelete<T = any>(results: T[], model: string): MaybePromise<boolean>;
|
|
106
|
+
abstract batchUpdate<T = any>(results: T[], model: string): MaybePromise<boolean>;
|
|
107
|
+
protected validateRecords(model: string, records: unknown[]): {
|
|
108
|
+
data: any;
|
|
109
|
+
validation: ValidateDataError[];
|
|
110
|
+
}[];
|
|
111
|
+
}
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import paginateService from './paginate.service.js';
|
|
2
|
+
import { getProvider } from '@nangohq/providers';
|
|
3
|
+
import { AbortedSDKError, UnknownProviderSDKError } from './errors.js';
|
|
4
|
+
import { validateData } from './dataValidation.js';
|
|
5
|
+
export const oldLevelToNewLevel = {
|
|
6
|
+
debug: 'debug',
|
|
7
|
+
info: 'info',
|
|
8
|
+
warn: 'warn',
|
|
9
|
+
error: 'error',
|
|
10
|
+
verbose: 'debug',
|
|
11
|
+
silly: 'debug',
|
|
12
|
+
http: 'info'
|
|
13
|
+
};
|
|
14
|
+
export class ActionError extends Error {
|
|
15
|
+
type;
|
|
16
|
+
payload;
|
|
17
|
+
constructor(payload) {
|
|
18
|
+
super();
|
|
19
|
+
this.type = 'action_script_runtime_error';
|
|
20
|
+
if (payload) {
|
|
21
|
+
this.payload = payload;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const MEMOIZED_CONNECTION_TTL = 60000;
|
|
26
|
+
const MEMOIZED_INTEGRATION_TTL = 10 * 60 * 1000;
|
|
27
|
+
export class NangoActionBase {
|
|
28
|
+
attributes = {};
|
|
29
|
+
activityLogId;
|
|
30
|
+
syncId;
|
|
31
|
+
nangoConnectionId;
|
|
32
|
+
environmentId;
|
|
33
|
+
environmentName;
|
|
34
|
+
syncJobId;
|
|
35
|
+
abortSignal;
|
|
36
|
+
syncConfig;
|
|
37
|
+
runnerFlags;
|
|
38
|
+
connectionId;
|
|
39
|
+
providerConfigKey;
|
|
40
|
+
provider;
|
|
41
|
+
ActionError = ActionError;
|
|
42
|
+
memoizedConnections = new Map();
|
|
43
|
+
memoizedIntegration = new Map();
|
|
44
|
+
constructor(config) {
|
|
45
|
+
this.connectionId = config.connectionId;
|
|
46
|
+
this.environmentId = config.environmentId;
|
|
47
|
+
this.providerConfigKey = config.providerConfigKey;
|
|
48
|
+
this.runnerFlags = config.runnerFlags;
|
|
49
|
+
if (config.activityLogId) {
|
|
50
|
+
this.activityLogId = config.activityLogId;
|
|
51
|
+
}
|
|
52
|
+
if (config.syncId) {
|
|
53
|
+
this.syncId = config.syncId;
|
|
54
|
+
}
|
|
55
|
+
if (config.nangoConnectionId) {
|
|
56
|
+
this.nangoConnectionId = config.nangoConnectionId;
|
|
57
|
+
}
|
|
58
|
+
if (config.syncJobId) {
|
|
59
|
+
this.syncJobId = config.syncJobId;
|
|
60
|
+
}
|
|
61
|
+
if (config.environmentName) {
|
|
62
|
+
this.environmentName = config.environmentName;
|
|
63
|
+
}
|
|
64
|
+
if (config.provider) {
|
|
65
|
+
this.provider = config.provider;
|
|
66
|
+
}
|
|
67
|
+
if (config.attributes) {
|
|
68
|
+
this.attributes = config.attributes;
|
|
69
|
+
}
|
|
70
|
+
if (config.abortSignal) {
|
|
71
|
+
this.abortSignal = config.abortSignal;
|
|
72
|
+
}
|
|
73
|
+
if (config.syncConfig) {
|
|
74
|
+
this.syncConfig = config.syncConfig;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
stringify() {
|
|
78
|
+
return JSON.stringify(this, (key, value) => {
|
|
79
|
+
if (key === 'secretKey') {
|
|
80
|
+
return '********';
|
|
81
|
+
}
|
|
82
|
+
return value;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
proxyConfig(config) {
|
|
86
|
+
if (!config.connectionId && this.connectionId) {
|
|
87
|
+
config.connectionId = this.connectionId;
|
|
88
|
+
}
|
|
89
|
+
if (!config.providerConfigKey && this.providerConfigKey) {
|
|
90
|
+
config.providerConfigKey = this.providerConfigKey;
|
|
91
|
+
}
|
|
92
|
+
if (!config.connectionId) {
|
|
93
|
+
throw new Error('Missing connection id');
|
|
94
|
+
}
|
|
95
|
+
if (!config.providerConfigKey) {
|
|
96
|
+
throw new Error('Missing provider config key');
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
method: 'GET',
|
|
100
|
+
...config,
|
|
101
|
+
providerConfigKey: config.providerConfigKey,
|
|
102
|
+
connectionId: config.connectionId,
|
|
103
|
+
headers: {
|
|
104
|
+
...(config.headers || {}),
|
|
105
|
+
'user-agent': this.nango.userAgent
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
throwIfAborted() {
|
|
110
|
+
if (this.abortSignal?.aborted) {
|
|
111
|
+
throw new AbortedSDKError();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async get(config) {
|
|
115
|
+
return this.proxy({
|
|
116
|
+
...config,
|
|
117
|
+
method: 'GET'
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async post(config) {
|
|
121
|
+
return this.proxy({
|
|
122
|
+
...config,
|
|
123
|
+
method: 'POST'
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
async put(config) {
|
|
127
|
+
return this.proxy({
|
|
128
|
+
...config,
|
|
129
|
+
method: 'PUT'
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async patch(config) {
|
|
133
|
+
return this.proxy({
|
|
134
|
+
...config,
|
|
135
|
+
method: 'PATCH'
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async delete(config) {
|
|
139
|
+
return this.proxy({
|
|
140
|
+
...config,
|
|
141
|
+
method: 'DELETE'
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async getToken() {
|
|
145
|
+
this.throwIfAborted();
|
|
146
|
+
return this.nango.getToken(this.providerConfigKey, this.connectionId);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get current integration
|
|
150
|
+
*/
|
|
151
|
+
async getIntegration(queries) {
|
|
152
|
+
this.throwIfAborted();
|
|
153
|
+
const key = queries?.include?.join(',') || 'default';
|
|
154
|
+
const has = this.memoizedIntegration.get(key);
|
|
155
|
+
if (has && MEMOIZED_INTEGRATION_TTL > Date.now() - has.timestamp) {
|
|
156
|
+
return has.integration;
|
|
157
|
+
}
|
|
158
|
+
const { data: integration } = await this.nango.getIntegration({ uniqueKey: this.providerConfigKey }, queries);
|
|
159
|
+
this.memoizedIntegration.set(key, { integration, timestamp: Date.now() });
|
|
160
|
+
return integration;
|
|
161
|
+
}
|
|
162
|
+
async getConnection(providerConfigKeyOverride, connectionIdOverride) {
|
|
163
|
+
this.throwIfAborted();
|
|
164
|
+
const providerConfigKey = providerConfigKeyOverride || this.providerConfigKey;
|
|
165
|
+
const connectionId = connectionIdOverride || this.connectionId;
|
|
166
|
+
const credentialsPair = `${providerConfigKey}${connectionId}`;
|
|
167
|
+
const cachedConnection = this.memoizedConnections.get(credentialsPair);
|
|
168
|
+
if (!cachedConnection || Date.now() - cachedConnection.timestamp > MEMOIZED_CONNECTION_TTL) {
|
|
169
|
+
const connection = await this.nango.getConnection(providerConfigKey, connectionId);
|
|
170
|
+
this.memoizedConnections.set(credentialsPair, { connection, timestamp: Date.now() });
|
|
171
|
+
return connection;
|
|
172
|
+
}
|
|
173
|
+
return cachedConnection.connection;
|
|
174
|
+
}
|
|
175
|
+
async setMetadata(metadata) {
|
|
176
|
+
this.throwIfAborted();
|
|
177
|
+
try {
|
|
178
|
+
return await this.nango.setMetadata(this.providerConfigKey, this.connectionId, metadata);
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
this.memoizedConnections.delete(`${this.providerConfigKey}${this.connectionId}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async updateMetadata(metadata) {
|
|
185
|
+
this.throwIfAborted();
|
|
186
|
+
try {
|
|
187
|
+
return await this.nango.updateMetadata(this.providerConfigKey, this.connectionId, metadata);
|
|
188
|
+
}
|
|
189
|
+
finally {
|
|
190
|
+
this.memoizedConnections.delete(`${this.providerConfigKey}${this.connectionId}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* @deprecated please use setMetadata instead.
|
|
195
|
+
*/
|
|
196
|
+
async setFieldMapping(fieldMapping) {
|
|
197
|
+
console.warn('setFieldMapping is deprecated. Please use setMetadata instead.');
|
|
198
|
+
return this.setMetadata(fieldMapping);
|
|
199
|
+
}
|
|
200
|
+
async getMetadata() {
|
|
201
|
+
this.throwIfAborted();
|
|
202
|
+
return (await this.getConnection(this.providerConfigKey, this.connectionId)).metadata;
|
|
203
|
+
}
|
|
204
|
+
async getWebhookURL() {
|
|
205
|
+
this.throwIfAborted();
|
|
206
|
+
const integration = await this.getIntegration({ include: ['webhook'] });
|
|
207
|
+
return integration.webhook_url;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* @deprecated please use getMetadata instead.
|
|
211
|
+
*/
|
|
212
|
+
async getFieldMapping() {
|
|
213
|
+
console.warn('getFieldMapping is deprecated. Please use getMetadata instead.');
|
|
214
|
+
const metadata = await this.getMetadata();
|
|
215
|
+
return metadata['fieldMapping'] || {};
|
|
216
|
+
}
|
|
217
|
+
async getEnvironmentVariables() {
|
|
218
|
+
return await this.nango.getEnvironmentVariables();
|
|
219
|
+
}
|
|
220
|
+
getFlowAttributes() {
|
|
221
|
+
if (!this.syncJobId) {
|
|
222
|
+
throw new Error('There is no current sync to get attributes from');
|
|
223
|
+
}
|
|
224
|
+
return this.attributes;
|
|
225
|
+
}
|
|
226
|
+
async *paginate(config) {
|
|
227
|
+
const provider = getProvider(this.provider);
|
|
228
|
+
if (!provider) {
|
|
229
|
+
throw new UnknownProviderSDKError({ provider: this.provider });
|
|
230
|
+
}
|
|
231
|
+
const templatePaginationConfig = provider.proxy?.paginate;
|
|
232
|
+
if (!templatePaginationConfig && (!config.paginate || !config.paginate.type)) {
|
|
233
|
+
throw Error('There was no pagination configuration for this integration or configuration passed in.');
|
|
234
|
+
}
|
|
235
|
+
const paginationConfig = {
|
|
236
|
+
...(templatePaginationConfig || {}),
|
|
237
|
+
...(config.paginate || {})
|
|
238
|
+
};
|
|
239
|
+
paginateService.validateConfiguration(paginationConfig);
|
|
240
|
+
config.method = config.method || 'GET';
|
|
241
|
+
const configMethod = config.method.toLocaleLowerCase();
|
|
242
|
+
const passPaginationParamsInBody = ['post', 'put', 'patch'].includes(configMethod);
|
|
243
|
+
const updatedBodyOrParams = (passPaginationParamsInBody ? config.data : config.params) ?? {};
|
|
244
|
+
const limitParameterName = paginationConfig.limit_name_in_request;
|
|
245
|
+
if (paginationConfig['limit']) {
|
|
246
|
+
updatedBodyOrParams[limitParameterName] = paginationConfig['limit'];
|
|
247
|
+
}
|
|
248
|
+
const proxyConfig = this.proxyConfig(config);
|
|
249
|
+
switch (paginationConfig.type) {
|
|
250
|
+
case 'cursor':
|
|
251
|
+
return yield* paginateService.cursor(proxyConfig, paginationConfig, updatedBodyOrParams, passPaginationParamsInBody, this.proxy.bind(this));
|
|
252
|
+
case 'link':
|
|
253
|
+
return yield* paginateService.link(proxyConfig, paginationConfig, updatedBodyOrParams, passPaginationParamsInBody, this.proxy.bind(this));
|
|
254
|
+
case 'offset':
|
|
255
|
+
return yield* paginateService.offset(proxyConfig, paginationConfig, updatedBodyOrParams, passPaginationParamsInBody, this.proxy.bind(this));
|
|
256
|
+
default:
|
|
257
|
+
throw Error(`'${paginationConfig['type']}' pagination is not supported.}`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
async triggerAction(providerConfigKey, connectionId, actionName, input) {
|
|
261
|
+
return await this.nango.triggerAction(providerConfigKey, connectionId, actionName, input);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
export class NangoSyncBase extends NangoActionBase {
|
|
265
|
+
lastSyncDate;
|
|
266
|
+
track_deletes = false;
|
|
267
|
+
constructor(config) {
|
|
268
|
+
super(config);
|
|
269
|
+
if (config.lastSyncDate) {
|
|
270
|
+
this.lastSyncDate = config.lastSyncDate;
|
|
271
|
+
}
|
|
272
|
+
if (config.track_deletes) {
|
|
273
|
+
this.track_deletes = config.track_deletes;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @deprecated please use batchSave
|
|
278
|
+
*/
|
|
279
|
+
async batchSend(results, model) {
|
|
280
|
+
return this.batchSave(results, model);
|
|
281
|
+
}
|
|
282
|
+
validateRecords(model, records) {
|
|
283
|
+
// Validate records
|
|
284
|
+
const hasErrors = [];
|
|
285
|
+
for (const record of records) {
|
|
286
|
+
const validation = validateData({
|
|
287
|
+
version: this.syncConfig?.version || '1',
|
|
288
|
+
input: JSON.parse(JSON.stringify(record)),
|
|
289
|
+
jsonSchema: this.syncConfig.models_json_schema,
|
|
290
|
+
modelName: model
|
|
291
|
+
});
|
|
292
|
+
if (validation === true) {
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
hasErrors.push({ data: record, validation });
|
|
296
|
+
if (this.runnerFlags?.validateSyncRecords) {
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return hasErrors;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=sdk.js.map
|
package/dist/sdk.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../lib/sdk.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,uBAAuB,CAAC;AA8BpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACN,CAAC;AAOX,MAAM,OAAO,WAAyC,SAAQ,KAAK;IAC/D,IAAI,CAAS;IACb,OAAO,CAA2B;I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C,CAAC;QAED,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC9C,CAAC;IACL,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,SAAS,CAAU,OAAY,EAAE,KAAa;QACvD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAQS,eAAe,CAAC,KAAa,EAAE,OAAkB;QACvD,mBAAmB;QACnB,MAAM,SAAS,GAAqD,EAAE,CAAC;QACvE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,YAAY,CAAC;gBAC5B,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,IAAI,GAAG;gBACxC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;gBACzC,UAAU,EAAE,IAAI,CAAC,UAAW,CAAC,kBAAkB;gBAC/C,SAAS,EAAE,KAAK;aACnB,CAAC,CAAC;YACH,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;gBACtB,SAAS;YACb,CAAC;YAED,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;YAE7C,IAAI,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,CAAC;gBACxC,MAAM;YACV,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ"}
|
package/dist/sync.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MaybePromise, NangoProps } from '@nangohq/types';
|
|
2
|
+
import type { ValidateDataError } from './dataValidation.js';
|
|
3
|
+
import { NangoActionBase } from './action.js';
|
|
4
|
+
export declare abstract class NangoSyncBase extends NangoActionBase {
|
|
5
|
+
lastSyncDate?: Date;
|
|
6
|
+
track_deletes: boolean;
|
|
7
|
+
constructor(config: NangoProps);
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated please use batchSave
|
|
10
|
+
*/
|
|
11
|
+
batchSend<T = any>(results: T[], model: string): Promise<boolean | null>;
|
|
12
|
+
abstract batchSave<T = any>(results: T[], model: string): MaybePromise<boolean>;
|
|
13
|
+
abstract batchDelete<T = any>(results: T[], model: string): MaybePromise<boolean>;
|
|
14
|
+
abstract batchUpdate<T = any>(results: T[], model: string): MaybePromise<boolean>;
|
|
15
|
+
protected validateRecords(model: string, records: unknown[]): {
|
|
16
|
+
data: any;
|
|
17
|
+
validation: ValidateDataError[];
|
|
18
|
+
}[];
|
|
19
|
+
}
|
package/dist/sync.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { validateData } from './dataValidation.js';
|
|
2
|
+
import { NangoActionBase } from './action.js';
|
|
3
|
+
export class NangoSyncBase extends NangoActionBase {
|
|
4
|
+
lastSyncDate;
|
|
5
|
+
track_deletes = false;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
super(config);
|
|
8
|
+
if (config.lastSyncDate) {
|
|
9
|
+
this.lastSyncDate = config.lastSyncDate;
|
|
10
|
+
}
|
|
11
|
+
if (config.track_deletes) {
|
|
12
|
+
this.track_deletes = config.track_deletes;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated please use batchSave
|
|
17
|
+
*/
|
|
18
|
+
async batchSend(results, model) {
|
|
19
|
+
return this.batchSave(results, model);
|
|
20
|
+
}
|
|
21
|
+
validateRecords(model, records) {
|
|
22
|
+
// Validate records
|
|
23
|
+
const hasErrors = [];
|
|
24
|
+
for (const record of records) {
|
|
25
|
+
const validation = validateData({
|
|
26
|
+
version: this.syncConfig?.version || '1',
|
|
27
|
+
input: JSON.parse(JSON.stringify(record)),
|
|
28
|
+
jsonSchema: this.syncConfig.models_json_schema,
|
|
29
|
+
modelName: model
|
|
30
|
+
});
|
|
31
|
+
if (validation === true) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
hasErrors.push({ data: record, validation });
|
|
35
|
+
if (this.runnerFlags?.validateSyncRecords) {
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return hasErrors;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=sync.js.map
|