Skip to content

Commit b485973

Browse files
author
flowcore-platform
committed
feat: bumped sdk and data pump dependencies and added support for sensitive data event streams
1 parent b43898b commit b485973

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

bun.lock

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

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

57-
"@flowcore/data-pump": ["@flowcore/data-pump@0.3.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=="],
57+
"@flowcore/data-pump": ["@flowcore/data-pump@0.13.0", "", { "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-/k+bHfCFSeKtVm/JfgQ610Ww5bIJOjg4yGKpsbupTLaSUNFrnuUuIc9gTWSnsV+n/YQHwN0Ag157WP8K2Jikag=="],
5858

59-
"@flowcore/sdk": ["@flowcore/sdk@1.19.1", "", { "dependencies": { "@deno/shim-deno": "~0.18.0", "@sinclair/typebox": "0.32.15", "rxjs": "^7.8.1", "ws": "^8.13.0" } }, ""],
59+
"@flowcore/sdk": ["@flowcore/sdk@1.47.1", "", { "dependencies": { "@deno/shim-deno": "~0.18.0", "@sinclair/typebox": "0.32.15", "rxjs": "^7.8.1", "ws": "^8.13.0" } }, "sha512-Z92MoJUVuM3PKqI8jCFdv93DE16dcUG9eYJ/jOJt7bmufabTzHR0aSlLFfr7leUmJqIDTMaxqwh3a8LVWhDpvQ=="],
6060

6161
"@flowcore/sdk-oidc-client": ["@flowcore/[email protected]", "", {}, ""],
6262

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"typescript": "^5"
4242
},
4343
"dependencies": {
44-
"@flowcore/data-pump": "^0.3.5",
45-
"@flowcore/sdk": "^1.19.1",
44+
"@flowcore/data-pump": "^0.13.0",
45+
"@flowcore/sdk": "^1.47.1",
4646
"@flowcore/sdk-oidc-client": "^1.3.1",
4747
"@flowcore/time-uuid": "^0.2.0",
4848
"@modelcontextprotocol/sdk": "^1.7.0",

src/duckdb/stream.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ interface StreamInfo {
3030
maxParallelism?: number
3131
processedTimeBuckets: number
3232
totalTimeBuckets: number
33+
includeSensitiveData?: boolean
3334
}
3435

3536
/**
@@ -57,6 +58,7 @@ export async function startEventStreamProjection(
5758
projectorName: string,
5859
targetTable: string,
5960
maxParallelism = 5, // Default to 5 parallel time bucket processes
61+
includeSensitiveData = false,
6062
) {
6163
const streamId = `stream-${Date.now()}`
6264

@@ -75,6 +77,7 @@ export async function startEventStreamProjection(
7577
maxParallelism,
7678
processedTimeBuckets: 0,
7779
totalTimeBuckets: 0,
80+
includeSensitiveData,
7881
}
7982

8083
activeStreams[streamId] = streamInfo
@@ -110,6 +113,7 @@ async function processEventStream(getBearerToken: () => Promise<string>, streamI
110113
const endState = getState(streamInfo.endDate)
111114

112115
activeDataPumps[streamId] = FlowcoreDataPump.create({
116+
includeSensitiveData: streamInfo.includeSensitiveData ?? false,
113117
auth: {
114118
getBearerToken: async () => await getBearerToken(),
115119
},
@@ -238,6 +242,7 @@ export function getStreamInfo(streamId: string) {
238242
processedTimeBuckets: streamInfo.processedTimeBuckets,
239243
totalTimeBuckets: streamInfo.totalTimeBuckets,
240244
maxParallelism: streamInfo.maxParallelism,
245+
includeSensitiveData: streamInfo.includeSensitiveData ?? false,
241246
},
242247
}
243248
}
@@ -258,5 +263,6 @@ export function getAllStreams() {
258263
targetTable: stream.targetTable,
259264
processedTimeBuckets: stream.processedTimeBuckets,
260265
totalTimeBuckets: stream.totalTimeBuckets,
266+
includeSensitiveData: stream.includeSensitiveData ?? false,
261267
}))
262268
}

src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ module.exports = projectEvent;
180180

181181
server.tool(
182182
"start_event_stream_projection",
183-
"Start streaming events from Flowcore and projecting them to the database",
183+
"Start streaming events from Flowcore and projecting them to the database, Sensitive data should not be needed, but if you need it ask the user if they are sure they want to include sensitive data, is false by default",
184184
{
185185
tenant: z.string().describe("Tenant name"),
186186
dataCore: z.string().describe("Name of the data core"),
@@ -196,6 +196,12 @@ server.tool(
196196
.describe(
197197
"Maximum number of events to process in parallel (default: 100), this can be used to speed up the projection, but don't increase it too much as it will use more local resources",
198198
),
199+
includeSensitiveData: z
200+
.boolean()
201+
.optional()
202+
.describe(
203+
"Whether to include sensitive data in the response, CAUTION: This will return sensitive data from the event type, so use with caution, ask the user if they are sure they want to include sensitive data, is false by default",
204+
),
199205
},
200206
startEventStreamProjectionHandler(async () => exchangePat(username, pat)),
201207
)

src/tools/duckdb-tools.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export const startEventStreamProjectionHandler =
126126
projectorName,
127127
targetTable,
128128
maxParallelism,
129+
includeSensitiveData,
129130
}: {
130131
tenant: string
131132
dataCore: string
@@ -136,6 +137,7 @@ export const startEventStreamProjectionHandler =
136137
projectorName: string
137138
targetTable: string
138139
maxParallelism?: number
140+
includeSensitiveData?: boolean
139141
}) => {
140142
try {
141143
const result = await startEventStreamProjection(
@@ -149,6 +151,7 @@ export const startEventStreamProjectionHandler =
149151
projectorName,
150152
targetTable,
151153
maxParallelism,
154+
includeSensitiveData,
152155
)
153156

154157
return {

0 commit comments

Comments
 (0)