lakesync 0.1.0 → 0.1.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.
- package/dist/adapter.d.ts +3 -3
- package/dist/adapter.js +2 -2
- package/dist/analyst.js +1 -1
- package/dist/{base-poller-Qo_SmCZs.d.ts → base-poller-Dfaj05py.d.ts} +11 -2
- package/dist/catalogue.d.ts +1 -1
- package/dist/catalogue.js +2 -2
- package/dist/{chunk-5YOFCJQ7.js → chunk-35NGFKNN.js} +5 -5
- package/dist/{chunk-ICNT7I3K.js → chunk-DKFUPHCU.js} +37 -1
- package/dist/chunk-DKFUPHCU.js.map +1 -0
- package/dist/{src-QU2YLPZY.js → chunk-I5XWBDII.js} +83 -8
- package/dist/chunk-I5XWBDII.js.map +1 -0
- package/dist/{src-WZNPHANQ.js → chunk-KDRXVETO.js} +113 -6
- package/dist/chunk-KDRXVETO.js.map +1 -0
- package/dist/{chunk-X3RO5SYJ.js → chunk-OXF6RDTK.js} +2 -2
- package/dist/{chunk-P5DRFKIT.js → chunk-RBL3N5ND.js} +2 -2
- package/dist/{chunk-4ARO6KTJ.js → chunk-RDUDHNFX.js} +2 -2
- package/dist/{chunk-BNJOGBYK.js → chunk-X3UOVRV7.js} +2 -2
- package/dist/client.d.ts +70 -5
- package/dist/client.js +404 -366
- package/dist/client.js.map +1 -1
- package/dist/compactor.d.ts +1 -1
- package/dist/compactor.js +3 -3
- package/dist/connector-jira.d.ts +214 -0
- package/dist/connector-jira.js +23 -0
- package/dist/connector-salesforce.d.ts +246 -0
- package/dist/connector-salesforce.js +25 -0
- package/dist/connector-salesforce.js.map +1 -0
- package/dist/{coordinator-CxckTzYW.d.ts → coordinator-CSbsqp5C.d.ts} +37 -37
- package/dist/{db-types-BR6Kt4uf.d.ts → db-types-CPAPw8Ws.d.ts} +1 -1
- package/dist/{gateway-D5SaaMvT.d.ts → gateway-Cej8JUh9.d.ts} +3 -3
- package/dist/gateway-server.d.ts +4 -4
- package/dist/gateway-server.js +8 -8
- package/dist/gateway.d.ts +6 -6
- package/dist/gateway.js +5 -5
- package/dist/index.d.ts +32 -5
- package/dist/index.js +7 -1
- package/dist/parquet.d.ts +1 -1
- package/dist/parquet.js +2 -2
- package/dist/proto.d.ts +1 -1
- package/dist/proto.js +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{resolver-C3Wphi6O.d.ts → resolver-B10tk8Er.d.ts} +1 -1
- package/dist/{src-WYBF5LOI.js → src-3CWNXNX6.js} +8 -2
- package/dist/src-3CWNXNX6.js.map +1 -0
- package/dist/src-BAFKQNDC.js +23 -0
- package/dist/src-BAFKQNDC.js.map +1 -0
- package/dist/src-PFJ5BJZY.js +25 -0
- package/dist/src-PFJ5BJZY.js.map +1 -0
- package/dist/{types-V_jVu2sA.d.ts → types-BUzzVRD6.d.ts} +1 -1
- package/package.json +9 -1
- package/dist/chunk-ICNT7I3K.js.map +0 -1
- package/dist/src-QU2YLPZY.js.map +0 -1
- package/dist/src-WZNPHANQ.js.map +0 -1
- /package/dist/{chunk-5YOFCJQ7.js.map → chunk-35NGFKNN.js.map} +0 -0
- /package/dist/{chunk-X3RO5SYJ.js.map → chunk-OXF6RDTK.js.map} +0 -0
- /package/dist/{chunk-P5DRFKIT.js.map → chunk-RBL3N5ND.js.map} +0 -0
- /package/dist/{chunk-4ARO6KTJ.js.map → chunk-RDUDHNFX.js.map} +0 -0
- /package/dist/{chunk-BNJOGBYK.js.map → chunk-X3UOVRV7.js.map} +0 -0
- /package/dist/{src-WYBF5LOI.js.map → connector-jira.js.map} +0 -0
package/dist/compactor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { H as HLCTimestamp, R as Result, L as LakeSyncError, F as FlushError } from './result-CojzlFE2.js';
|
|
2
|
-
import { T as TableSchema } from './types-
|
|
2
|
+
import { T as TableSchema } from './types-BUzzVRD6.js';
|
|
3
3
|
import { L as LakeAdapter } from './types-DSC_EiwR.js';
|
|
4
4
|
|
|
5
5
|
/** Configuration for checkpoint generation */
|
package/dist/compactor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodeSyncResponse
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X3UOVRV7.js";
|
|
4
4
|
import {
|
|
5
5
|
readParquetToDeltas,
|
|
6
6
|
writeDeltasToParquet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RDUDHNFX.js";
|
|
8
8
|
import {
|
|
9
9
|
Err,
|
|
10
10
|
FlushError,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
LakeSyncError,
|
|
13
13
|
Ok,
|
|
14
14
|
rowKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DKFUPHCU.js";
|
|
16
16
|
import "./chunk-7D4SUZUM.js";
|
|
17
17
|
|
|
18
18
|
// ../compactor/src/checkpoint-generator.ts
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { L as LakeSyncError, R as Result } from './result-CojzlFE2.js';
|
|
2
|
+
import { B as BaseSourcePoller, P as PushTarget } from './base-poller-Dfaj05py.js';
|
|
3
|
+
import { T as TableSchema } from './types-BUzzVRD6.js';
|
|
4
|
+
import './hlc-DiD8QNG3.js';
|
|
5
|
+
|
|
6
|
+
/** HTTP error from the Jira REST API. */
|
|
7
|
+
declare class JiraApiError extends LakeSyncError {
|
|
8
|
+
/** HTTP status code returned by Jira. */
|
|
9
|
+
readonly statusCode: number;
|
|
10
|
+
/** Raw response body from Jira. */
|
|
11
|
+
readonly responseBody: string;
|
|
12
|
+
constructor(statusCode: number, responseBody: string, cause?: Error);
|
|
13
|
+
}
|
|
14
|
+
/** Rate limit error (HTTP 429) from the Jira REST API. */
|
|
15
|
+
declare class JiraRateLimitError extends LakeSyncError {
|
|
16
|
+
/** Milliseconds to wait before retrying. */
|
|
17
|
+
readonly retryAfterMs: number;
|
|
18
|
+
constructor(retryAfterMs: number, cause?: Error);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Connection configuration for a Jira Cloud source. */
|
|
22
|
+
interface JiraConnectorConfig {
|
|
23
|
+
/** Jira Cloud domain (e.g. "mycompany" for mycompany.atlassian.net). */
|
|
24
|
+
domain: string;
|
|
25
|
+
/** Email address for Basic auth. */
|
|
26
|
+
email: string;
|
|
27
|
+
/** API token paired with the email. */
|
|
28
|
+
apiToken: string;
|
|
29
|
+
/** Optional JQL filter to scope issue polling. */
|
|
30
|
+
jql?: string;
|
|
31
|
+
/** Whether to include comments (default true). */
|
|
32
|
+
includeComments?: boolean;
|
|
33
|
+
/** Whether to include projects (default true). */
|
|
34
|
+
includeProjects?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** Ingest configuration for the Jira poller. */
|
|
37
|
+
interface JiraIngestConfig {
|
|
38
|
+
/** Poll interval in milliseconds (default 30 000). */
|
|
39
|
+
intervalMs?: number;
|
|
40
|
+
/** Number of deltas per push chunk (default 500). */
|
|
41
|
+
chunkSize?: number;
|
|
42
|
+
/** Approximate memory budget in bytes — triggers flush at 70%. */
|
|
43
|
+
memoryBudgetBytes?: number;
|
|
44
|
+
}
|
|
45
|
+
/** Issue search response from POST /rest/api/3/search/jql. */
|
|
46
|
+
interface JiraSearchResponse {
|
|
47
|
+
issues: JiraIssue[];
|
|
48
|
+
/** Opaque token for fetching the next page (absent on last page). */
|
|
49
|
+
nextPageToken?: string;
|
|
50
|
+
/** True when this is the final page. */
|
|
51
|
+
isLast?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/** A single Jira issue. */
|
|
54
|
+
interface JiraIssue {
|
|
55
|
+
id: string;
|
|
56
|
+
key: string;
|
|
57
|
+
fields: {
|
|
58
|
+
summary: string | null;
|
|
59
|
+
description: unknown | null;
|
|
60
|
+
status: {
|
|
61
|
+
name: string;
|
|
62
|
+
} | null;
|
|
63
|
+
priority: {
|
|
64
|
+
name: string;
|
|
65
|
+
} | null;
|
|
66
|
+
issuetype: {
|
|
67
|
+
name: string;
|
|
68
|
+
} | null;
|
|
69
|
+
assignee: {
|
|
70
|
+
displayName: string;
|
|
71
|
+
emailAddress: string;
|
|
72
|
+
} | null;
|
|
73
|
+
reporter: {
|
|
74
|
+
displayName: string;
|
|
75
|
+
emailAddress: string;
|
|
76
|
+
} | null;
|
|
77
|
+
labels: string[] | null;
|
|
78
|
+
project: {
|
|
79
|
+
key: string;
|
|
80
|
+
name: string;
|
|
81
|
+
} | null;
|
|
82
|
+
created: string | null;
|
|
83
|
+
updated: string | null;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Paginated comment response from GET /rest/api/3/issue/{key}/comment. */
|
|
87
|
+
interface JiraCommentPage {
|
|
88
|
+
startAt: number;
|
|
89
|
+
maxResults: number;
|
|
90
|
+
total: number;
|
|
91
|
+
comments: JiraComment[];
|
|
92
|
+
}
|
|
93
|
+
/** A single Jira comment. */
|
|
94
|
+
interface JiraComment {
|
|
95
|
+
id: string;
|
|
96
|
+
body: unknown | null;
|
|
97
|
+
author: {
|
|
98
|
+
displayName: string;
|
|
99
|
+
emailAddress: string;
|
|
100
|
+
} | null;
|
|
101
|
+
created: string | null;
|
|
102
|
+
updated: string | null;
|
|
103
|
+
}
|
|
104
|
+
/** Paginated project response from GET /rest/api/3/project/search. */
|
|
105
|
+
interface JiraProjectPage {
|
|
106
|
+
startAt: number;
|
|
107
|
+
maxResults: number;
|
|
108
|
+
total: number;
|
|
109
|
+
values: JiraProject[];
|
|
110
|
+
}
|
|
111
|
+
/** A single Jira project. */
|
|
112
|
+
interface JiraProject {
|
|
113
|
+
id: string;
|
|
114
|
+
key: string;
|
|
115
|
+
name: string;
|
|
116
|
+
projectTypeKey: string | null;
|
|
117
|
+
lead: {
|
|
118
|
+
displayName: string;
|
|
119
|
+
} | null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* HTTP client for the Jira Cloud REST API v3.
|
|
124
|
+
*
|
|
125
|
+
* Uses Basic authentication (email + API token) and global `fetch`.
|
|
126
|
+
* All public methods return `Result<T, JiraApiError>`.
|
|
127
|
+
*/
|
|
128
|
+
declare class JiraClient {
|
|
129
|
+
private readonly baseUrl;
|
|
130
|
+
private readonly authHeader;
|
|
131
|
+
constructor(config: JiraConnectorConfig);
|
|
132
|
+
/**
|
|
133
|
+
* Search for issues via JQL with auto-pagination.
|
|
134
|
+
*
|
|
135
|
+
* Uses the `/rest/api/3/search/jql` endpoint with token-based pagination.
|
|
136
|
+
* When `updatedSince` is provided, appends `AND updated >= "date"` to the JQL.
|
|
137
|
+
* Empty JQL is replaced with `project is not EMPTY` (the new endpoint
|
|
138
|
+
* rejects unbounded queries).
|
|
139
|
+
*
|
|
140
|
+
* @param limit — optional cap on the total number of issues returned.
|
|
141
|
+
*/
|
|
142
|
+
searchIssues(jql: string, updatedSince?: string, limit?: number): Promise<Result<JiraIssue[], JiraApiError | JiraRateLimitError>>;
|
|
143
|
+
/**
|
|
144
|
+
* Fetch all comments for a given issue key with auto-pagination.
|
|
145
|
+
*/
|
|
146
|
+
getComments(issueKey: string): Promise<Result<JiraComment[], JiraApiError | JiraRateLimitError>>;
|
|
147
|
+
/**
|
|
148
|
+
* Fetch all projects with auto-pagination.
|
|
149
|
+
*/
|
|
150
|
+
getProjects(): Promise<Result<JiraProject[], JiraApiError | JiraRateLimitError>>;
|
|
151
|
+
/** Make an HTTP request with rate-limit retry logic. */
|
|
152
|
+
private request;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Map a Jira issue to a flat row for the `jira_issues` table.
|
|
157
|
+
*
|
|
158
|
+
* The row ID is the issue key (e.g. "PROJ-123").
|
|
159
|
+
*/
|
|
160
|
+
declare function mapIssue(issue: JiraIssue): {
|
|
161
|
+
rowId: string;
|
|
162
|
+
row: Record<string, unknown>;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Map a Jira comment to a flat row for the `jira_comments` table.
|
|
166
|
+
*
|
|
167
|
+
* The row ID is "{issueKey}:{commentId}".
|
|
168
|
+
*/
|
|
169
|
+
declare function mapComment(issueKey: string, comment: JiraComment): {
|
|
170
|
+
rowId: string;
|
|
171
|
+
row: Record<string, unknown>;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Map a Jira project to a flat row for the `jira_projects` table.
|
|
175
|
+
*
|
|
176
|
+
* The row ID is the project key (e.g. "PROJ").
|
|
177
|
+
*/
|
|
178
|
+
declare function mapProject(project: JiraProject): {
|
|
179
|
+
rowId: string;
|
|
180
|
+
row: Record<string, unknown>;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Polls Jira Cloud for issues, comments, and projects and pushes
|
|
185
|
+
* detected changes into a gateway via streaming accumulation.
|
|
186
|
+
*
|
|
187
|
+
* Uses {@link BaseSourcePoller.accumulateDelta} to push deltas in
|
|
188
|
+
* memory-bounded chunks instead of collecting all deltas in a single array.
|
|
189
|
+
*/
|
|
190
|
+
declare class JiraSourcePoller extends BaseSourcePoller {
|
|
191
|
+
private readonly connectionConfig;
|
|
192
|
+
private readonly client;
|
|
193
|
+
/** Cursor: max `fields.updated` value from the last issue poll. */
|
|
194
|
+
private lastUpdated;
|
|
195
|
+
/** In-memory snapshot for comment diff (keyed by rowId). */
|
|
196
|
+
private commentSnapshot;
|
|
197
|
+
/** In-memory snapshot for project diff (keyed by project key). */
|
|
198
|
+
private projectSnapshot;
|
|
199
|
+
/** Export cursor state as a JSON-serialisable object for external persistence. */
|
|
200
|
+
getCursorState(): Record<string, unknown>;
|
|
201
|
+
/** Restore cursor state from a previously exported snapshot. */
|
|
202
|
+
setCursorState(state: Record<string, unknown>): void;
|
|
203
|
+
constructor(connectionConfig: JiraConnectorConfig, ingestConfig: JiraIngestConfig | undefined, name: string, gateway: PushTarget, client?: JiraClient);
|
|
204
|
+
/** Execute a single poll cycle across all entity types. */
|
|
205
|
+
poll(): Promise<void>;
|
|
206
|
+
private pollIssues;
|
|
207
|
+
private pollComments;
|
|
208
|
+
private pollProjects;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** All table schemas produced by the Jira connector. */
|
|
212
|
+
declare const JIRA_TABLE_SCHEMAS: ReadonlyArray<TableSchema>;
|
|
213
|
+
|
|
214
|
+
export { JIRA_TABLE_SCHEMAS, JiraApiError, JiraClient, type JiraComment, type JiraCommentPage, type JiraConnectorConfig, type JiraIngestConfig, type JiraIssue, type JiraProject, type JiraProjectPage, JiraRateLimitError, type JiraSearchResponse, JiraSourcePoller, mapComment, mapIssue, mapProject };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JIRA_TABLE_SCHEMAS,
|
|
3
|
+
JiraApiError,
|
|
4
|
+
JiraClient,
|
|
5
|
+
JiraRateLimitError,
|
|
6
|
+
JiraSourcePoller,
|
|
7
|
+
mapComment,
|
|
8
|
+
mapIssue,
|
|
9
|
+
mapProject
|
|
10
|
+
} from "./chunk-I5XWBDII.js";
|
|
11
|
+
import "./chunk-DKFUPHCU.js";
|
|
12
|
+
import "./chunk-7D4SUZUM.js";
|
|
13
|
+
export {
|
|
14
|
+
JIRA_TABLE_SCHEMAS,
|
|
15
|
+
JiraApiError,
|
|
16
|
+
JiraClient,
|
|
17
|
+
JiraRateLimitError,
|
|
18
|
+
JiraSourcePoller,
|
|
19
|
+
mapComment,
|
|
20
|
+
mapIssue,
|
|
21
|
+
mapProject
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=connector-jira.js.map
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { L as LakeSyncError, R as Result } from './result-CojzlFE2.js';
|
|
2
|
+
import { B as BaseSourcePoller, P as PushTarget } from './base-poller-Dfaj05py.js';
|
|
3
|
+
import { T as TableSchema } from './types-BUzzVRD6.js';
|
|
4
|
+
import './hlc-DiD8QNG3.js';
|
|
5
|
+
|
|
6
|
+
/** HTTP error from the Salesforce REST API. */
|
|
7
|
+
declare class SalesforceApiError extends LakeSyncError {
|
|
8
|
+
/** HTTP status code returned by Salesforce. */
|
|
9
|
+
readonly statusCode: number;
|
|
10
|
+
/** Raw response body from Salesforce. */
|
|
11
|
+
readonly responseBody: string;
|
|
12
|
+
constructor(statusCode: number, responseBody: string, cause?: Error);
|
|
13
|
+
}
|
|
14
|
+
/** Authentication failure from the Salesforce OAuth token endpoint. */
|
|
15
|
+
declare class SalesforceAuthError extends LakeSyncError {
|
|
16
|
+
constructor(message: string, cause?: Error);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Connection configuration for a Salesforce CRM source. */
|
|
20
|
+
interface SalesforceConnectorConfig {
|
|
21
|
+
/** Salesforce instance URL (e.g. "https://mycompany.salesforce.com"). */
|
|
22
|
+
instanceUrl: string;
|
|
23
|
+
/** Connected App consumer key. */
|
|
24
|
+
clientId: string;
|
|
25
|
+
/** Connected App consumer secret. */
|
|
26
|
+
clientSecret: string;
|
|
27
|
+
/** Salesforce username. */
|
|
28
|
+
username: string;
|
|
29
|
+
/** Salesforce password + security token concatenated. */
|
|
30
|
+
password: string;
|
|
31
|
+
/** REST API version (default "v62.0"). */
|
|
32
|
+
apiVersion?: string;
|
|
33
|
+
/** Use test.salesforce.com for auth (default false). */
|
|
34
|
+
isSandbox?: boolean;
|
|
35
|
+
/** Optional WHERE clause fragment appended to all SOQL queries. */
|
|
36
|
+
soqlFilter?: string;
|
|
37
|
+
/** Whether to include Account objects (default true). */
|
|
38
|
+
includeAccounts?: boolean;
|
|
39
|
+
/** Whether to include Contact objects (default true). */
|
|
40
|
+
includeContacts?: boolean;
|
|
41
|
+
/** Whether to include Opportunity objects (default true). */
|
|
42
|
+
includeOpportunities?: boolean;
|
|
43
|
+
/** Whether to include Lead objects (default true). */
|
|
44
|
+
includeLeads?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Ingest configuration for the Salesforce poller. */
|
|
47
|
+
interface SalesforceIngestConfig {
|
|
48
|
+
/** Poll interval in milliseconds (default 30 000). */
|
|
49
|
+
intervalMs?: number;
|
|
50
|
+
/** Number of deltas per push chunk (default 500). */
|
|
51
|
+
chunkSize?: number;
|
|
52
|
+
/** Approximate memory budget in bytes — triggers flush at 70%. */
|
|
53
|
+
memoryBudgetBytes?: number;
|
|
54
|
+
}
|
|
55
|
+
/** OAuth 2.0 token response from the Salesforce token endpoint. */
|
|
56
|
+
interface SalesforceAuthResponse {
|
|
57
|
+
access_token: string;
|
|
58
|
+
instance_url: string;
|
|
59
|
+
token_type: string;
|
|
60
|
+
issued_at: string;
|
|
61
|
+
signature: string;
|
|
62
|
+
}
|
|
63
|
+
/** SOQL query response envelope. */
|
|
64
|
+
interface SalesforceQueryResponse<T> {
|
|
65
|
+
totalSize: number;
|
|
66
|
+
done: boolean;
|
|
67
|
+
nextRecordsUrl?: string;
|
|
68
|
+
records: T[];
|
|
69
|
+
}
|
|
70
|
+
/** Salesforce Account sObject (fields used by the connector). */
|
|
71
|
+
interface SfAccount {
|
|
72
|
+
Id: string;
|
|
73
|
+
Name: string | null;
|
|
74
|
+
Type: string | null;
|
|
75
|
+
Industry: string | null;
|
|
76
|
+
Website: string | null;
|
|
77
|
+
Phone: string | null;
|
|
78
|
+
BillingCity: string | null;
|
|
79
|
+
BillingState: string | null;
|
|
80
|
+
BillingCountry: string | null;
|
|
81
|
+
AnnualRevenue: number | null;
|
|
82
|
+
NumberOfEmployees: number | null;
|
|
83
|
+
Owner: {
|
|
84
|
+
Name: string;
|
|
85
|
+
} | null;
|
|
86
|
+
CreatedDate: string | null;
|
|
87
|
+
LastModifiedDate: string | null;
|
|
88
|
+
}
|
|
89
|
+
/** Salesforce Contact sObject (fields used by the connector). */
|
|
90
|
+
interface SfContact {
|
|
91
|
+
Id: string;
|
|
92
|
+
FirstName: string | null;
|
|
93
|
+
LastName: string | null;
|
|
94
|
+
Email: string | null;
|
|
95
|
+
Phone: string | null;
|
|
96
|
+
Title: string | null;
|
|
97
|
+
AccountId: string | null;
|
|
98
|
+
Account: {
|
|
99
|
+
Name: string;
|
|
100
|
+
} | null;
|
|
101
|
+
MailingCity: string | null;
|
|
102
|
+
MailingState: string | null;
|
|
103
|
+
MailingCountry: string | null;
|
|
104
|
+
Owner: {
|
|
105
|
+
Name: string;
|
|
106
|
+
} | null;
|
|
107
|
+
CreatedDate: string | null;
|
|
108
|
+
LastModifiedDate: string | null;
|
|
109
|
+
}
|
|
110
|
+
/** Salesforce Opportunity sObject (fields used by the connector). */
|
|
111
|
+
interface SfOpportunity {
|
|
112
|
+
Id: string;
|
|
113
|
+
Name: string | null;
|
|
114
|
+
StageName: string | null;
|
|
115
|
+
Amount: number | null;
|
|
116
|
+
CloseDate: string | null;
|
|
117
|
+
Probability: number | null;
|
|
118
|
+
AccountId: string | null;
|
|
119
|
+
Account: {
|
|
120
|
+
Name: string;
|
|
121
|
+
} | null;
|
|
122
|
+
Type: string | null;
|
|
123
|
+
LeadSource: string | null;
|
|
124
|
+
IsClosed: boolean | null;
|
|
125
|
+
IsWon: boolean | null;
|
|
126
|
+
Owner: {
|
|
127
|
+
Name: string;
|
|
128
|
+
} | null;
|
|
129
|
+
CreatedDate: string | null;
|
|
130
|
+
LastModifiedDate: string | null;
|
|
131
|
+
}
|
|
132
|
+
/** Salesforce Lead sObject (fields used by the connector). */
|
|
133
|
+
interface SfLead {
|
|
134
|
+
Id: string;
|
|
135
|
+
FirstName: string | null;
|
|
136
|
+
LastName: string | null;
|
|
137
|
+
Company: string | null;
|
|
138
|
+
Email: string | null;
|
|
139
|
+
Phone: string | null;
|
|
140
|
+
Title: string | null;
|
|
141
|
+
Status: string | null;
|
|
142
|
+
LeadSource: string | null;
|
|
143
|
+
IsConverted: boolean | null;
|
|
144
|
+
ConvertedAccountId: string | null;
|
|
145
|
+
ConvertedContactId: string | null;
|
|
146
|
+
ConvertedOpportunityId: string | null;
|
|
147
|
+
Owner: {
|
|
148
|
+
Name: string;
|
|
149
|
+
} | null;
|
|
150
|
+
CreatedDate: string | null;
|
|
151
|
+
LastModifiedDate: string | null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* HTTP client for the Salesforce REST API.
|
|
156
|
+
*
|
|
157
|
+
* Uses OAuth 2.0 Username-Password flow for authentication and global `fetch`.
|
|
158
|
+
* All public methods return `Result<T, SalesforceApiError | SalesforceAuthError>`.
|
|
159
|
+
*/
|
|
160
|
+
declare class SalesforceClient {
|
|
161
|
+
private readonly config;
|
|
162
|
+
private readonly apiVersion;
|
|
163
|
+
private readonly loginUrl;
|
|
164
|
+
private accessToken;
|
|
165
|
+
private instanceUrl;
|
|
166
|
+
constructor(config: SalesforceConnectorConfig);
|
|
167
|
+
/**
|
|
168
|
+
* Authenticate via OAuth 2.0 Username-Password flow.
|
|
169
|
+
*
|
|
170
|
+
* Stores access token and updates instance URL from the response.
|
|
171
|
+
*/
|
|
172
|
+
authenticate(): Promise<Result<void, SalesforceAuthError>>;
|
|
173
|
+
/**
|
|
174
|
+
* Execute a SOQL query with auto-pagination.
|
|
175
|
+
*
|
|
176
|
+
* Automatically authenticates on first call and re-authenticates on 401.
|
|
177
|
+
*/
|
|
178
|
+
query<T>(soql: string): Promise<Result<T[], SalesforceApiError | SalesforceAuthError>>;
|
|
179
|
+
/** Make an HTTP request with rate-limit retry logic. */
|
|
180
|
+
private request;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Map a Salesforce Account to a flat row for the `sf_accounts` table.
|
|
185
|
+
*
|
|
186
|
+
* The row ID is the Salesforce record Id.
|
|
187
|
+
*/
|
|
188
|
+
declare function mapAccount(account: SfAccount): {
|
|
189
|
+
rowId: string;
|
|
190
|
+
row: Record<string, unknown>;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Map a Salesforce Contact to a flat row for the `sf_contacts` table.
|
|
194
|
+
*
|
|
195
|
+
* The row ID is the Salesforce record Id.
|
|
196
|
+
*/
|
|
197
|
+
declare function mapContact(contact: SfContact): {
|
|
198
|
+
rowId: string;
|
|
199
|
+
row: Record<string, unknown>;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Map a Salesforce Opportunity to a flat row for the `sf_opportunities` table.
|
|
203
|
+
*
|
|
204
|
+
* The row ID is the Salesforce record Id.
|
|
205
|
+
*/
|
|
206
|
+
declare function mapOpportunity(opportunity: SfOpportunity): {
|
|
207
|
+
rowId: string;
|
|
208
|
+
row: Record<string, unknown>;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Map a Salesforce Lead to a flat row for the `sf_leads` table.
|
|
212
|
+
*
|
|
213
|
+
* The row ID is the Salesforce record Id.
|
|
214
|
+
*/
|
|
215
|
+
declare function mapLead(lead: SfLead): {
|
|
216
|
+
rowId: string;
|
|
217
|
+
row: Record<string, unknown>;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Polls Salesforce CRM for accounts, contacts, opportunities, and leads
|
|
222
|
+
* and pushes detected changes into a gateway via streaming accumulation.
|
|
223
|
+
*
|
|
224
|
+
* Uses {@link BaseSourcePoller.accumulateDelta} to push deltas in
|
|
225
|
+
* memory-bounded chunks instead of collecting all deltas in a single array.
|
|
226
|
+
*/
|
|
227
|
+
declare class SalesforceSourcePoller extends BaseSourcePoller {
|
|
228
|
+
private readonly connectionConfig;
|
|
229
|
+
private readonly client;
|
|
230
|
+
/** Per-entity cursors: max LastModifiedDate from the last poll. */
|
|
231
|
+
private cursors;
|
|
232
|
+
/** Export cursor state as a JSON-serialisable object for external persistence. */
|
|
233
|
+
getCursorState(): Record<string, unknown>;
|
|
234
|
+
/** Restore cursor state from a previously exported snapshot. */
|
|
235
|
+
setCursorState(state: Record<string, unknown>): void;
|
|
236
|
+
constructor(connectionConfig: SalesforceConnectorConfig, ingestConfig: SalesforceIngestConfig | undefined, name: string, gateway: PushTarget, client?: SalesforceClient);
|
|
237
|
+
/** Execute a single poll cycle across all enabled entity types. */
|
|
238
|
+
poll(): Promise<void>;
|
|
239
|
+
private pollEntity;
|
|
240
|
+
private buildSoql;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Table schemas for all Salesforce entity types synced by the connector. */
|
|
244
|
+
declare const SALESFORCE_TABLE_SCHEMAS: ReadonlyArray<TableSchema>;
|
|
245
|
+
|
|
246
|
+
export { SALESFORCE_TABLE_SCHEMAS, SalesforceApiError, SalesforceAuthError, type SalesforceAuthResponse, SalesforceClient, type SalesforceConnectorConfig, type SalesforceIngestConfig, type SalesforceQueryResponse, SalesforceSourcePoller, type SfAccount, type SfContact, type SfLead, type SfOpportunity, mapAccount, mapContact, mapLead, mapOpportunity };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SALESFORCE_TABLE_SCHEMAS,
|
|
3
|
+
SalesforceApiError,
|
|
4
|
+
SalesforceAuthError,
|
|
5
|
+
SalesforceClient,
|
|
6
|
+
SalesforceSourcePoller,
|
|
7
|
+
mapAccount,
|
|
8
|
+
mapContact,
|
|
9
|
+
mapLead,
|
|
10
|
+
mapOpportunity
|
|
11
|
+
} from "./chunk-KDRXVETO.js";
|
|
12
|
+
import "./chunk-DKFUPHCU.js";
|
|
13
|
+
import "./chunk-7D4SUZUM.js";
|
|
14
|
+
export {
|
|
15
|
+
SALESFORCE_TABLE_SCHEMAS,
|
|
16
|
+
SalesforceApiError,
|
|
17
|
+
SalesforceAuthError,
|
|
18
|
+
SalesforceClient,
|
|
19
|
+
SalesforceSourcePoller,
|
|
20
|
+
mapAccount,
|
|
21
|
+
mapContact,
|
|
22
|
+
mapLead,
|
|
23
|
+
mapOpportunity
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=connector-salesforce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { L as LakeSyncError, R as Result, H as HLCTimestamp } from './result-CojzlFE2.js';
|
|
2
2
|
import { A as Action, i as ActionPush, j as ActionResponse, d as ActionDiscovery, k as ActionResult, e as ActionErrorResult } from './types-Bs-QyOe-.js';
|
|
3
3
|
import { H as HLC } from './hlc-DiD8QNG3.js';
|
|
4
|
-
import { R as RowDelta,
|
|
4
|
+
import { R as RowDelta, S as SyncPush, b as SyncPull, c as SyncResponse } from './types-BUzzVRD6.js';
|
|
5
5
|
|
|
6
6
|
/** Configuration for opening a local database */
|
|
7
7
|
interface DbConfig {
|
|
@@ -83,41 +83,6 @@ declare class LocalDB {
|
|
|
83
83
|
close(): Promise<void>;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
/** Status of an action queue entry. */
|
|
87
|
-
type ActionQueueEntryStatus = "pending" | "sending" | "acked" | "failed";
|
|
88
|
-
/** A single entry in the action queue. */
|
|
89
|
-
interface ActionQueueEntry {
|
|
90
|
-
/** Unique entry identifier. */
|
|
91
|
-
id: string;
|
|
92
|
-
/** The action to be executed. */
|
|
93
|
-
action: Action;
|
|
94
|
-
/** Current processing status. */
|
|
95
|
-
status: ActionQueueEntryStatus;
|
|
96
|
-
/** Timestamp when the entry was created. */
|
|
97
|
-
createdAt: number;
|
|
98
|
-
/** Number of times this entry has been retried. */
|
|
99
|
-
retryCount: number;
|
|
100
|
-
/** Earliest time (ms since epoch) this entry should be retried. Undefined = immediately. */
|
|
101
|
-
retryAfter?: number;
|
|
102
|
-
}
|
|
103
|
-
/** Outbox-pattern action queue interface. */
|
|
104
|
-
interface ActionQueue {
|
|
105
|
-
/** Add an action to the queue. */
|
|
106
|
-
push(action: Action): Promise<Result<ActionQueueEntry, LakeSyncError>>;
|
|
107
|
-
/** Peek at pending entries (ordered by createdAt). */
|
|
108
|
-
peek(limit: number): Promise<Result<ActionQueueEntry[], LakeSyncError>>;
|
|
109
|
-
/** Mark entries as currently being sent. */
|
|
110
|
-
markSending(ids: string[]): Promise<Result<void, LakeSyncError>>;
|
|
111
|
-
/** Acknowledge successful delivery (removes entries). */
|
|
112
|
-
ack(ids: string[]): Promise<Result<void, LakeSyncError>>;
|
|
113
|
-
/** Negative acknowledge — reset to pending with incremented retryCount. */
|
|
114
|
-
nack(ids: string[]): Promise<Result<void, LakeSyncError>>;
|
|
115
|
-
/** Get the number of pending + sending entries. */
|
|
116
|
-
depth(): Promise<Result<number, LakeSyncError>>;
|
|
117
|
-
/** Remove all entries. */
|
|
118
|
-
clear(): Promise<Result<void, LakeSyncError>>;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
86
|
/** Status of a queue entry */
|
|
122
87
|
type QueueEntryStatus = "pending" | "sending" | "acked";
|
|
123
88
|
/** A single entry in the sync queue */
|
|
@@ -153,6 +118,41 @@ interface SyncQueue {
|
|
|
153
118
|
clear(): Promise<Result<void, LakeSyncError>>;
|
|
154
119
|
}
|
|
155
120
|
|
|
121
|
+
/** Status of an action queue entry. */
|
|
122
|
+
type ActionQueueEntryStatus = "pending" | "sending" | "acked" | "failed";
|
|
123
|
+
/** A single entry in the action queue. */
|
|
124
|
+
interface ActionQueueEntry {
|
|
125
|
+
/** Unique entry identifier. */
|
|
126
|
+
id: string;
|
|
127
|
+
/** The action to be executed. */
|
|
128
|
+
action: Action;
|
|
129
|
+
/** Current processing status. */
|
|
130
|
+
status: ActionQueueEntryStatus;
|
|
131
|
+
/** Timestamp when the entry was created. */
|
|
132
|
+
createdAt: number;
|
|
133
|
+
/** Number of times this entry has been retried. */
|
|
134
|
+
retryCount: number;
|
|
135
|
+
/** Earliest time (ms since epoch) this entry should be retried. Undefined = immediately. */
|
|
136
|
+
retryAfter?: number;
|
|
137
|
+
}
|
|
138
|
+
/** Outbox-pattern action queue interface. */
|
|
139
|
+
interface ActionQueue {
|
|
140
|
+
/** Add an action to the queue. */
|
|
141
|
+
push(action: Action): Promise<Result<ActionQueueEntry, LakeSyncError>>;
|
|
142
|
+
/** Peek at pending entries (ordered by createdAt). */
|
|
143
|
+
peek(limit: number): Promise<Result<ActionQueueEntry[], LakeSyncError>>;
|
|
144
|
+
/** Mark entries as currently being sent. */
|
|
145
|
+
markSending(ids: string[]): Promise<Result<void, LakeSyncError>>;
|
|
146
|
+
/** Acknowledge successful delivery (removes entries). */
|
|
147
|
+
ack(ids: string[]): Promise<Result<void, LakeSyncError>>;
|
|
148
|
+
/** Negative acknowledge — reset to pending with incremented retryCount. */
|
|
149
|
+
nack(ids: string[]): Promise<Result<void, LakeSyncError>>;
|
|
150
|
+
/** Get the number of pending + sending entries. */
|
|
151
|
+
depth(): Promise<Result<number, LakeSyncError>>;
|
|
152
|
+
/** Remove all entries. */
|
|
153
|
+
clear(): Promise<Result<void, LakeSyncError>>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
156
|
/**
|
|
157
157
|
* Tracks local mutations (insert, update, delete) and produces
|
|
158
158
|
* column-level deltas that are pushed to a SyncQueue.
|
|
@@ -393,4 +393,4 @@ declare class SyncCoordinator {
|
|
|
393
393
|
stopAutoSync(): void;
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
export { type ActionQueue as A, type CheckpointResponse as C, DbError as D, LocalDB as L, type QueueEntry as Q, type SyncQueue as S, type Transaction as T, type
|
|
396
|
+
export { type ActionQueue as A, type CheckpointResponse as C, DbError as D, LocalDB as L, type QueueEntry as Q, type SyncQueue as S, type Transaction as T, type SyncCoordinatorConfig as a, SyncCoordinator as b, type SyncTransport as c, type ActionQueueEntry as d, type ActionQueueEntryStatus as e, type DbConfig as f, type QueueEntryStatus as g, type SyncEvents as h, type SyncMode as i, SyncTracker as j };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { R as Result, A as AdapterError, H as HLCTimestamp } from './result-CojzlFE2.js';
|
|
2
|
-
import { R as RowDelta, T as TableSchema } from './types-
|
|
2
|
+
import { R as RowDelta, T as TableSchema } from './types-BUzzVRD6.js';
|
|
3
3
|
|
|
4
4
|
/** Configuration for a database adapter connection. */
|
|
5
5
|
interface DatabaseAdapterConfig {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { g as ActionHandler, i as ActionPush, l as AuthContext, j as ActionResponse, a as ActionValidationError, d as ActionDiscovery, b as SyncRulesContext } from './types-Bs-QyOe-.js';
|
|
2
2
|
import { H as HLCTimestamp, R as Result, S as SchemaError, b as ClockDriftError, B as BackpressureError, a as AdapterNotFoundError, A as AdapterError, F as FlushError } from './result-CojzlFE2.js';
|
|
3
|
-
import { I as IngestTarget } from './base-poller-
|
|
4
|
-
import { R as RowDelta, a as RowKey, T as TableSchema,
|
|
5
|
-
import { D as DatabaseAdapter } from './db-types-
|
|
3
|
+
import { I as IngestTarget } from './base-poller-Dfaj05py.js';
|
|
4
|
+
import { R as RowDelta, a as RowKey, T as TableSchema, S as SyncPush, b as SyncPull, c as SyncResponse } from './types-BUzzVRD6.js';
|
|
5
|
+
import { D as DatabaseAdapter } from './db-types-CPAPw8Ws.js';
|
|
6
6
|
import { L as LakeAdapter } from './types-DSC_EiwR.js';
|
|
7
7
|
import { N as NessieCatalogueClient } from './nessie-client-DrNikVXy.js';
|
|
8
8
|
|
package/dist/gateway-server.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { A as AuthClaims, a as AuthError, v as verifyToken } from './auth-CAVutXzx.js';
|
|
2
|
-
import { D as DatabaseAdapter } from './db-types-
|
|
3
|
-
import { S as SyncGateway } from './gateway-
|
|
4
|
-
import { R as RowDelta, c as SyncResponse } from './types-
|
|
2
|
+
import { D as DatabaseAdapter } from './db-types-CPAPw8Ws.js';
|
|
3
|
+
import { S as SyncGateway } from './gateway-Cej8JUh9.js';
|
|
4
|
+
import { R as RowDelta, c as SyncResponse } from './types-BUzzVRD6.js';
|
|
5
5
|
import { L as LakeAdapter } from './types-DSC_EiwR.js';
|
|
6
6
|
import { H as HLCTimestamp } from './result-CojzlFE2.js';
|
|
7
7
|
import './types-Bs-QyOe-.js';
|
|
8
|
-
import './base-poller-
|
|
8
|
+
import './base-poller-Dfaj05py.js';
|
|
9
9
|
import './hlc-DiD8QNG3.js';
|
|
10
10
|
import './nessie-client-DrNikVXy.js';
|
|
11
11
|
|