Skip to content

Commit 70350ca

Browse files
author
flowcore-platform
committed
fix(package): ✨ Update @flowcore/data-pump to version 0.3.5
1 parent a2aaa89 commit 70350ca

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"": {
55
"name": "@flowcore/local-read-model-mcp-server",
66
"dependencies": {
7-
"@flowcore/data-pump": "^0.3.4",
7+
"@flowcore/data-pump": "^0.3.5",
88
"@flowcore/sdk": "^1.19.1",
99
"@flowcore/sdk-oidc-client": "^1.3.1",
1010
"@flowcore/time-uuid": "^0.2.0",
@@ -54,7 +54,7 @@
5454

5555
"@deno/shim-deno-test": ["@deno/[email protected]", "", {}, ""],
5656

57-
"@flowcore/data-pump": ["@flowcore/[email protected].4", "", { "dependencies": { "@date-fns/utc": "^2.1.0", "@deno/shim-deno": "~0.18.0", "@sinclair/typebox": "0.32.15", "date-fns": "^4.1.0", "long": "^5.3.1", "nats": "^2.29.1", "prom-client": "^15.1.3", "rxjs": "^7.8.1", "ws": "^8.13.0" } }, ""],
57+
"@flowcore/data-pump": ["@flowcore/[email protected].5", "", { "dependencies": { "@date-fns/utc": "^2.1.0", "@deno/shim-deno": "~0.18.0", "@sinclair/typebox": "0.32.15", "date-fns": "^4.1.0", "long": "^5.3.1", "nats": "^2.29.1", "prom-client": "^15.1.3", "rxjs": "^7.8.1", "ws": "^8.13.0" } }, "sha512-FNIjhydEWibG8fr1bSdP6JIpTBmPqVZaNfH9UB7rXnBAkjQBurB0nnMo3uvyjXjUKeVfZ/k7I2P5a8l84gKr1A=="],
5858

5959
"@flowcore/sdk": ["@flowcore/[email protected]", "", { "dependencies": { "@deno/shim-deno": "~0.18.0", "@sinclair/typebox": "0.32.15", "rxjs": "^7.8.1", "ws": "^8.13.0" } }, ""],
6060

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"typescript": "^5"
4242
},
4343
"dependencies": {
44-
"@flowcore/data-pump": "^0.3.4",
44+
"@flowcore/data-pump": "^0.3.5",
4545
"@flowcore/sdk": "^1.19.1",
4646
"@flowcore/sdk-oidc-client": "^1.3.1",
4747
"@flowcore/time-uuid": "^0.2.0",

src/duckdb/stream.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface StreamInfo {
1818
tenant: string
1919
dataCore: string
2020
flowTypeName: string
21-
eventTypeName: string
21+
eventTypeNames: string[]
2222
startDate: string
2323
endDate: string
2424
projectorName: string
@@ -51,7 +51,7 @@ export async function startEventStreamProjection(
5151
tenant: string,
5252
dataCore: string,
5353
flowTypeName: string,
54-
eventTypeName: string,
54+
eventTypeNames: string[],
5555
startDate: string,
5656
endDate: string,
5757
projectorName: string,
@@ -67,7 +67,7 @@ export async function startEventStreamProjection(
6767
tenant,
6868
dataCore,
6969
flowTypeName,
70-
eventTypeName,
70+
eventTypeNames,
7171
startDate,
7272
endDate,
7373
projectorName,
@@ -123,7 +123,7 @@ async function processEventStream(getBearerToken: () => Promise<string>, streamI
123123
tenant: streamInfo.tenant,
124124
dataCore: streamInfo.dataCore,
125125
flowType: streamInfo.flowTypeName,
126-
eventTypes: [streamInfo.eventTypeName],
126+
eventTypes: streamInfo.eventTypeNames,
127127
},
128128
processor: {
129129
concurrency: streamInfo.maxParallelism || 100,
@@ -146,9 +146,11 @@ async function processEventStream(getBearerToken: () => Promise<string>, streamI
146146
streamInfo.eventCount++
147147
} else {
148148
errorCount++
149+
streamInfo.error = `failed to project event ${event.eventId} with error: ${projectionResult.message}`
149150
}
150151
} catch (error) {
151152
errorCount++
153+
streamInfo.error = `failed to project event ${event.eventId} with error: ${error}`
152154
}
153155
}
154156
},
@@ -226,7 +228,7 @@ export function getStreamInfo(streamId: string) {
226228
eventCount: streamInfo.eventCount,
227229
dataCore: streamInfo.dataCore,
228230
flowTypeName: streamInfo.flowTypeName,
229-
eventTypeName: streamInfo.eventTypeName,
231+
eventTypeNames: streamInfo.eventTypeNames,
230232
startDate: streamInfo.startDate,
231233
endDate: streamInfo.endDate,
232234
projectorName: streamInfo.projectorName,
@@ -251,7 +253,7 @@ export function getAllStreams() {
251253
eventCount: stream.eventCount,
252254
dataCore: stream.dataCore,
253255
flowTypeName: stream.flowTypeName,
254-
eventTypeName: stream.eventTypeName,
256+
eventTypeNames: stream.eventTypeNames,
255257
projectorName: stream.projectorName,
256258
targetTable: stream.targetTable,
257259
processedTimeBuckets: stream.processedTimeBuckets,

src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ server.tool(
124124
125125
1. Function Structure:
126126
- Input: Flowcore event object containing event data
127-
- Output: Object matching the projection table schema
127+
- Output: Object matching a single projection table schema
128128
- Must be pure function with no side effects
129129
- Handle null/undefined values gracefully
130+
- Objects or array of object returned must match the projection table schema or it will fail to insert into the database
130131
131132
2. Data Type Formatting Requirements:
132133
- Timestamps: ISO 8601 format (YYYY-MM-DD'T'HH:mm:ss.sssZ)
@@ -148,6 +149,10 @@ server.tool(
148149
149150
4. Example Function Structure:
150151
152+
input: raw event object from Flowcore
153+
output: object or array of objects that match the projection table schema
154+
155+
***the function should only handle one table type output, if you need to project to multiple tables you can use the same function multiple times using a switch statement or if statements***
151156
The function must return a single object or an array of objects, it can also return a promise that resolves to a single object or an array of objects.
152157
153158
<example js code>
@@ -180,7 +185,7 @@ server.tool(
180185
tenant: z.string().describe("Tenant name"),
181186
dataCore: z.string().describe("Name of the data core"),
182187
flowTypeName: z.string().describe("Name of the flow type"),
183-
eventTypeName: z.string().describe("Name of the event type"),
188+
eventTypeNames: z.array(z.string()).describe("Name of the event types to project, can be multiple event types but only within the same flow type, this will maintain the ordering of the events"),
184189
startDate: z.string().describe("Start date for event streaming"),
185190
endDate: z.string().describe("End date for event streaming"),
186191
projectorName: z.string().describe("Name of the projector to use for events"),

src/tools/duckdb-tools.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const startEventStreamProjectionHandler =
120120
tenant,
121121
dataCore,
122122
flowTypeName,
123-
eventTypeName,
123+
eventTypeNames,
124124
startDate,
125125
endDate,
126126
projectorName,
@@ -130,7 +130,7 @@ export const startEventStreamProjectionHandler =
130130
tenant: string
131131
dataCore: string
132132
flowTypeName: string
133-
eventTypeName: string
133+
eventTypeNames: string[]
134134
startDate: string
135135
endDate: string
136136
projectorName: string
@@ -143,7 +143,7 @@ export const startEventStreamProjectionHandler =
143143
tenant,
144144
dataCore,
145145
flowTypeName,
146-
eventTypeName,
146+
eventTypeNames,
147147
startDate,
148148
endDate,
149149
projectorName,

0 commit comments

Comments
 (0)