@flowcore/pathways 0.13.1 → 0.14.0
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/CHANGELOG.md +20 -0
- package/README.md +14 -14
- package/esm/contracts/event.d.ts +11 -19
- package/esm/contracts/event.d.ts.map +1 -1
- package/esm/contracts/event.js +1 -15
- package/esm/pathways/builder.d.ts +37 -18
- package/esm/pathways/builder.d.ts.map +1 -1
- package/esm/pathways/builder.js +30 -13
- package/esm/pathways/session-pathway.d.ts +5 -2
- package/esm/pathways/session-pathway.d.ts.map +1 -1
- package/esm/pathways/types.d.ts +2 -2
- package/esm/pathways/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/script/contracts/event.d.ts +11 -19
- package/script/contracts/event.d.ts.map +1 -1
- package/script/contracts/event.js +0 -16
- package/script/pathways/builder.d.ts +37 -18
- package/script/pathways/builder.d.ts.map +1 -1
- package/script/pathways/builder.js +30 -13
- package/script/pathways/session-pathway.d.ts +5 -2
- package/script/pathways/session-pathway.d.ts.map +1 -1
- package/script/pathways/types.d.ts +2 -2
- package/script/pathways/types.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.14.0](https://github.com/flowcore-io/flowcore-pathways/compare/v0.13.2...v0.14.0) (2025-05-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* switch from typebox to zod ([e20e8f8](https://github.com/flowcore-io/flowcore-pathways/commit/e20e8f81a9cf68eaa598be5d43ef34f346f136ea))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fix tests ([05496b9](https://github.com/flowcore-io/flowcore-pathways/commit/05496b993669449d8bfe758e2647d4f2a2dbbf06))
|
|
14
|
+
* set defaults on write and process ([c01ac59](https://github.com/flowcore-io/flowcore-pathways/commit/c01ac59cd4097d832c009e90e7259644e84a9612))
|
|
15
|
+
|
|
16
|
+
## [0.13.2](https://github.com/flowcore-io/flowcore-pathways/compare/v0.13.1...v0.13.2) (2025-05-14)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Performance Improvements
|
|
20
|
+
|
|
21
|
+
* ability to adjust the log level of internal logs ([eaeb9c5](https://github.com/flowcore-io/flowcore-pathways/commit/eaeb9c58a53be3effb6ba54621535a531b11e82e))
|
|
22
|
+
|
|
3
23
|
## [0.13.1](https://github.com/flowcore-io/flowcore-pathways/compare/v0.13.0...v0.13.1) (2025-04-22)
|
|
4
24
|
|
|
5
25
|
|
package/README.md
CHANGED
|
@@ -55,14 +55,14 @@ yarn add @flowcore/pathways
|
|
|
55
55
|
Here's a basic example to get you started with Flowcore Pathways:
|
|
56
56
|
|
|
57
57
|
```typescript
|
|
58
|
-
import {
|
|
58
|
+
import { z } from "zod"
|
|
59
59
|
import { PathwaysBuilder } from "@flowcore/pathways"
|
|
60
60
|
|
|
61
61
|
// Define your event schema
|
|
62
|
-
const userSchema =
|
|
63
|
-
id:
|
|
64
|
-
name:
|
|
65
|
-
email:
|
|
62
|
+
const userSchema = z.object({
|
|
63
|
+
id: z.string(),
|
|
64
|
+
name: z.string(),
|
|
65
|
+
email: z.string(),
|
|
66
66
|
})
|
|
67
67
|
|
|
68
68
|
// Create a pathways builder
|
|
@@ -130,17 +130,17 @@ const pathways = new PathwaysBuilder({
|
|
|
130
130
|
Register pathways with their schemas for type-safe event handling:
|
|
131
131
|
|
|
132
132
|
```typescript
|
|
133
|
-
import {
|
|
133
|
+
import { z } from "zod"
|
|
134
134
|
|
|
135
135
|
// Define your event schema
|
|
136
|
-
const orderSchema =
|
|
137
|
-
orderId:
|
|
138
|
-
userId:
|
|
139
|
-
total:
|
|
140
|
-
items:
|
|
141
|
-
|
|
142
|
-
id:
|
|
143
|
-
quantity:
|
|
136
|
+
const orderSchema = z.object({
|
|
137
|
+
orderId: z.string(),
|
|
138
|
+
userId: z.string(),
|
|
139
|
+
total: z.number(),
|
|
140
|
+
items: z.array(
|
|
141
|
+
z.Object({
|
|
142
|
+
id: z.string(),
|
|
143
|
+
quantity: z.number(),
|
|
144
144
|
}),
|
|
145
145
|
),
|
|
146
146
|
})
|
package/esm/contracts/event.d.ts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
metadata: TRecord<TString, TUnknown>;
|
|
13
|
-
payload: TRecord<TString, TUnknown>;
|
|
14
|
-
validTime: TString;
|
|
15
|
-
}>;
|
|
16
|
-
/**
|
|
17
|
-
* The type for an event
|
|
18
|
-
*/
|
|
19
|
-
export type FlowcoreEvent = Static<typeof FlowcoreEventSchema>;
|
|
1
|
+
export interface FlowcoreEvent<Payload = unknown, Metadata = Record<string, unknown>> {
|
|
2
|
+
eventId: string;
|
|
3
|
+
timeBucket: string;
|
|
4
|
+
tenant: string;
|
|
5
|
+
dataCoreId: string;
|
|
6
|
+
flowType: string;
|
|
7
|
+
eventType: string;
|
|
8
|
+
metadata: Metadata;
|
|
9
|
+
payload: Payload;
|
|
10
|
+
validTime: string;
|
|
11
|
+
}
|
|
20
12
|
//# sourceMappingURL=event.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/contracts/event.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/contracts/event.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa,CAAC,OAAO,GAAG,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClF,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
package/esm/contracts/event.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* The schema for an event
|
|
4
|
-
*/
|
|
5
|
-
export const FlowcoreEventSchema = Type.Object({
|
|
6
|
-
eventId: Type.String(),
|
|
7
|
-
timeBucket: Type.String(),
|
|
8
|
-
tenant: Type.String(),
|
|
9
|
-
dataCoreId: Type.String(),
|
|
10
|
-
flowType: Type.String(),
|
|
11
|
-
eventType: Type.String(),
|
|
12
|
-
metadata: Type.Record(Type.String(), Type.Unknown()),
|
|
13
|
-
payload: Type.Record(Type.String(), Type.Unknown()),
|
|
14
|
-
validTime: Type.String(),
|
|
15
|
-
});
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z, type ZodTypeAny } from "zod";
|
|
2
2
|
import type { WebhookSendOptions } from "@flowcore/sdk-transformer-core";
|
|
3
3
|
import type { FlowcoreEvent } from "../contracts/event.js";
|
|
4
4
|
import type { Logger } from "./logger.js";
|
|
@@ -38,6 +38,21 @@ export interface AuditWebhookSendOptions extends WebhookSendOptions {
|
|
|
38
38
|
*/
|
|
39
39
|
headers?: Record<string, string>;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents the set log level for different internal log messages
|
|
43
|
+
* @property debug Log level for debug messages
|
|
44
|
+
* @property info Log level for info messages
|
|
45
|
+
* @property warn Log level for warn messages
|
|
46
|
+
* @property error Log level for error messages
|
|
47
|
+
*/
|
|
48
|
+
export type LogLevel = keyof Pick<Logger, "debug" | "info" | "warn" | "error">;
|
|
49
|
+
/**
|
|
50
|
+
* Configuration for log levels
|
|
51
|
+
* @property writeSuccess Log level used when a write operation is successful. Defaults to 'info'.
|
|
52
|
+
*/
|
|
53
|
+
export type LogLevelConfig = {
|
|
54
|
+
writeSuccess?: LogLevel;
|
|
55
|
+
};
|
|
41
56
|
/**
|
|
42
57
|
* SessionUserResolver is a key-value store for storing and retrieving UserIdResolver functions
|
|
43
58
|
* with a TTL (time to live).
|
|
@@ -103,7 +118,10 @@ export declare class SessionUser implements SessionUserResolver {
|
|
|
103
118
|
* @template TPathway Record type that maps pathway keys to their payload types
|
|
104
119
|
* @template TWritablePaths Union type of pathway keys that can be written to
|
|
105
120
|
*/
|
|
106
|
-
export declare class PathwaysBuilder<TPathway extends Record<string,
|
|
121
|
+
export declare class PathwaysBuilder<TPathway extends Record<string, {
|
|
122
|
+
input: unknown;
|
|
123
|
+
output: unknown;
|
|
124
|
+
}> = {}, TWritablePaths extends keyof TPathway = never> {
|
|
107
125
|
private readonly pathways;
|
|
108
126
|
private readonly handlers;
|
|
109
127
|
private readonly beforeObservable;
|
|
@@ -129,6 +147,7 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
129
147
|
private readonly tenant;
|
|
130
148
|
private readonly dataCore;
|
|
131
149
|
private readonly apiKey;
|
|
150
|
+
private readonly logLevel;
|
|
132
151
|
/**
|
|
133
152
|
* Creates a new PathwaysBuilder instance
|
|
134
153
|
* @param options Configuration options for the PathwaysBuilder
|
|
@@ -140,8 +159,10 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
140
159
|
* @param options.logger Optional logger instance
|
|
141
160
|
* @param options.enableSessionUserResolvers Whether to enable session user resolvers
|
|
142
161
|
* @param options.overrideSessionUserResolvers Optional SessionUserResolver instance to override the default
|
|
162
|
+
* @param options.logLevel Optional configuration for log levels
|
|
163
|
+
* @param options.logLevel.writeSuccess Log level for write success messages ('info' or 'debug'). Defaults to 'info'.
|
|
143
164
|
*/
|
|
144
|
-
constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, }: {
|
|
165
|
+
constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, logLevel, }: {
|
|
145
166
|
baseUrl: string;
|
|
146
167
|
tenant: string;
|
|
147
168
|
dataCore: string;
|
|
@@ -150,6 +171,7 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
150
171
|
logger?: Logger;
|
|
151
172
|
enableSessionUserResolvers?: boolean;
|
|
152
173
|
overrideSessionUserResolvers?: SessionUserResolver;
|
|
174
|
+
logLevel?: LogLevelConfig;
|
|
153
175
|
});
|
|
154
176
|
/**
|
|
155
177
|
* Configures the PathwaysBuilder to use a custom pathway state implementation
|
|
@@ -220,16 +242,19 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
220
242
|
* Registers a new pathway with the given contract
|
|
221
243
|
* @template F The flow type string
|
|
222
244
|
* @template E The event type string
|
|
223
|
-
* @template S The schema type extending
|
|
245
|
+
* @template S The schema type extending ZodTypeAny
|
|
224
246
|
* @template W Boolean indicating if the pathway is writable (defaults to true)
|
|
225
247
|
* @param contract The pathway contract describing the pathway
|
|
226
248
|
* @returns The PathwaysBuilder instance with the new pathway registered
|
|
227
249
|
*/
|
|
228
|
-
register<F extends string, E extends string, S extends
|
|
250
|
+
register<F extends string, E extends string, S extends ZodTypeAny, W extends boolean = true>(contract: PathwayContract<F, E, S> & {
|
|
229
251
|
writable?: W;
|
|
230
252
|
maxRetries?: number;
|
|
231
253
|
retryDelayMs?: number;
|
|
232
|
-
}): PathwaysBuilder<TPathway & Record<PathwayKey<F, E>,
|
|
254
|
+
}): PathwaysBuilder<TPathway & Record<PathwayKey<F, E>, {
|
|
255
|
+
output: z.infer<S>;
|
|
256
|
+
input: z.input<S>;
|
|
257
|
+
}>, TWritablePaths | WritablePathway<PathwayKey<F, E>, W>>;
|
|
233
258
|
/**
|
|
234
259
|
* Gets a pathway instance by its path
|
|
235
260
|
*
|
|
@@ -237,7 +262,7 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
237
262
|
* @param path The pathway key to get
|
|
238
263
|
* @returns The pathway instance
|
|
239
264
|
*/
|
|
240
|
-
get<TPath extends keyof TPathway>(path: TPath): TPathway[TPath];
|
|
265
|
+
get<TPath extends keyof TPathway>(path: TPath): TPathway[TPath]["output"];
|
|
241
266
|
/**
|
|
242
267
|
* Sets a handler function for a pathway
|
|
243
268
|
*
|
|
@@ -249,26 +274,20 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
249
274
|
* @param handler The function that will process events for this pathway
|
|
250
275
|
* @throws Error if the pathway doesn't exist or already has a handler
|
|
251
276
|
*/
|
|
252
|
-
handle<TPath extends keyof TPathway>(path: TPath, handler: (event:
|
|
253
|
-
payload: TPathway[TPath];
|
|
254
|
-
}) => Promise<void> | void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
277
|
+
handle<TPath extends keyof TPathway>(path: TPath, handler: (event: FlowcoreEvent<TPathway[TPath]["output"]>) => Promise<void> | void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
255
278
|
/**
|
|
256
279
|
* Subscribe to pathway events (before or after processing)
|
|
257
280
|
* @param path The pathway to subscribe to
|
|
258
281
|
* @param handler The handler function for the events
|
|
259
282
|
* @param type The event type to subscribe to (before, after, or all)
|
|
260
283
|
*/
|
|
261
|
-
subscribe<TPath extends keyof TPathway>(path: TPath, handler: (event:
|
|
262
|
-
payload: TPathway[TPath];
|
|
263
|
-
}) => void, type?: "before" | "after" | "all"): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
284
|
+
subscribe<TPath extends keyof TPathway>(path: TPath, handler: (event: FlowcoreEvent<TPathway[TPath]["output"]>) => void, type?: "before" | "after" | "all"): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
264
285
|
/**
|
|
265
286
|
* Subscribe to errors for a specific pathway
|
|
266
287
|
* @param path The pathway to subscribe to errors for
|
|
267
288
|
* @param handler The handler function that receives the error and event
|
|
268
289
|
*/
|
|
269
|
-
onError<TPath extends keyof TPathway>(path: TPath, handler: (error: Error, event:
|
|
270
|
-
payload: TPathway[TPath];
|
|
271
|
-
}) => void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
290
|
+
onError<TPath extends keyof TPathway>(path: TPath, handler: (error: Error, event: FlowcoreEvent<TPathway[TPath]["output"]>) => void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
272
291
|
/**
|
|
273
292
|
* Subscribe to errors for all pathways
|
|
274
293
|
* @param handler The handler function that receives the error, event, and pathway name
|
|
@@ -282,8 +301,8 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
282
301
|
* @param options Optional write options
|
|
283
302
|
* @returns A promise that resolves to the event ID(s)
|
|
284
303
|
*/
|
|
285
|
-
write<TPath extends TWritablePaths>(path: TPath,
|
|
286
|
-
writeBatch<TPath extends TWritablePaths>(path: TPath,
|
|
304
|
+
write<TPath extends TWritablePaths>(path: TPath, inputData: TPathway[TPath]["input"], metadata?: EventMetadata, options?: PathwayWriteOptions): Promise<string | string[]>;
|
|
305
|
+
writeBatch<TPath extends TWritablePaths>(path: TPath, inputData: TPathway[TPath]["input"][], metadata?: EventMetadata, options?: PathwayWriteOptions): Promise<string | string[]>;
|
|
287
306
|
/**
|
|
288
307
|
* Waits for a specific event to be processed
|
|
289
308
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/pathways/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/pathways/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,gCAA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EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,EACrC,QAAQ,CAAC,EAAE,aAAa,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;IA8H7B;;;;;;;;;;OAUG;YACW,2BAA2B;CA4C1C"}
|
package/esm/pathways/builder.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Value } from "@sinclair/typebox/value";
|
|
1
|
+
import { z } from "zod";
|
|
3
2
|
import { Subject } from "rxjs";
|
|
4
3
|
import { WebhookBuilder } from "../compatibility/flowcore-transformer-core.sdk.js";
|
|
5
4
|
import { InternalPathwayState } from "./internal-pathway.state.js";
|
|
@@ -101,8 +100,10 @@ export class PathwaysBuilder {
|
|
|
101
100
|
* @param options.logger Optional logger instance
|
|
102
101
|
* @param options.enableSessionUserResolvers Whether to enable session user resolvers
|
|
103
102
|
* @param options.overrideSessionUserResolvers Optional SessionUserResolver instance to override the default
|
|
103
|
+
* @param options.logLevel Optional configuration for log levels
|
|
104
|
+
* @param options.logLevel.writeSuccess Log level for write success messages ('info' or 'debug'). Defaults to 'info'.
|
|
104
105
|
*/
|
|
105
|
-
constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, }) {
|
|
106
|
+
constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, logLevel, }) {
|
|
106
107
|
Object.defineProperty(this, "pathways", {
|
|
107
108
|
enumerable: true,
|
|
108
109
|
configurable: true,
|
|
@@ -257,8 +258,18 @@ export class PathwaysBuilder {
|
|
|
257
258
|
writable: true,
|
|
258
259
|
value: void 0
|
|
259
260
|
});
|
|
261
|
+
Object.defineProperty(this, "logLevel", {
|
|
262
|
+
enumerable: true,
|
|
263
|
+
configurable: true,
|
|
264
|
+
writable: true,
|
|
265
|
+
value: void 0
|
|
266
|
+
});
|
|
260
267
|
// Initialize logger (use NoopLogger if none provided)
|
|
261
268
|
this.logger = logger ?? new NoopLogger();
|
|
269
|
+
// Initialize log levels with defaults
|
|
270
|
+
this.logLevel = {
|
|
271
|
+
writeSuccess: logLevel?.writeSuccess ?? "info",
|
|
272
|
+
};
|
|
262
273
|
// Store configuration values for cloning
|
|
263
274
|
this.baseUrl = baseUrl;
|
|
264
275
|
this.tenant = tenant;
|
|
@@ -390,9 +401,9 @@ export class PathwaysBuilder {
|
|
|
390
401
|
}
|
|
391
402
|
// Validate event payload against schema if available
|
|
392
403
|
if (this.schemas[pathway]) {
|
|
404
|
+
const parsedPayload = this.schemas[pathway].safeParse(data.payload);
|
|
393
405
|
try {
|
|
394
|
-
|
|
395
|
-
if (!isValid) {
|
|
406
|
+
if (!parsedPayload.success) {
|
|
396
407
|
const error = `Event payload does not match schema for pathway ${pathwayStr}`;
|
|
397
408
|
this.logger.error(error);
|
|
398
409
|
throw new Error(error);
|
|
@@ -403,6 +414,7 @@ export class PathwaysBuilder {
|
|
|
403
414
|
this.logger.error(error);
|
|
404
415
|
throw new Error(error);
|
|
405
416
|
}
|
|
417
|
+
data.payload = parsedPayload.data;
|
|
406
418
|
}
|
|
407
419
|
// Call audit handler if configured
|
|
408
420
|
if (this.auditHandler) {
|
|
@@ -503,7 +515,7 @@ export class PathwaysBuilder {
|
|
|
503
515
|
* Registers a new pathway with the given contract
|
|
504
516
|
* @template F The flow type string
|
|
505
517
|
* @template E The event type string
|
|
506
|
-
* @template S The schema type extending
|
|
518
|
+
* @template S The schema type extending ZodTypeAny
|
|
507
519
|
* @template W Boolean indicating if the pathway is writable (defaults to true)
|
|
508
520
|
* @param contract The pathway contract describing the pathway
|
|
509
521
|
* @returns The PathwaysBuilder instance with the new pathway registered
|
|
@@ -536,7 +548,8 @@ export class PathwaysBuilder {
|
|
|
536
548
|
this.writers[path] = this.webhookBuilderFactory()
|
|
537
549
|
.buildWebhook(contract.flowType, contract.eventType).send;
|
|
538
550
|
this.batchWriters[path] = this.webhookBuilderFactory()
|
|
539
|
-
.buildWebhook(contract.flowType, contract.eventType)
|
|
551
|
+
.buildWebhook(contract.flowType, contract.eventType)
|
|
552
|
+
.sendBatch;
|
|
540
553
|
}
|
|
541
554
|
}
|
|
542
555
|
if (contract.timeoutMs) {
|
|
@@ -665,7 +678,7 @@ export class PathwaysBuilder {
|
|
|
665
678
|
* @param options Optional write options
|
|
666
679
|
* @returns A promise that resolves to the event ID(s)
|
|
667
680
|
*/
|
|
668
|
-
async write(path,
|
|
681
|
+
async write(path, inputData, metadata, options) {
|
|
669
682
|
const pathStr = String(path);
|
|
670
683
|
this.logger.debug(`Writing to pathway`, {
|
|
671
684
|
pathway: pathStr,
|
|
@@ -686,7 +699,8 @@ export class PathwaysBuilder {
|
|
|
686
699
|
throw new Error(error);
|
|
687
700
|
}
|
|
688
701
|
const schema = this.schemas[path];
|
|
689
|
-
|
|
702
|
+
const parsedData = schema.safeParse(inputData);
|
|
703
|
+
if (!parsedData.success) {
|
|
690
704
|
const errorMessage = `Invalid data for pathway ${pathStr}`;
|
|
691
705
|
this.logger.error(errorMessage, new Error(errorMessage), {
|
|
692
706
|
pathway: pathStr,
|
|
@@ -694,6 +708,7 @@ export class PathwaysBuilder {
|
|
|
694
708
|
});
|
|
695
709
|
throw new Error(errorMessage);
|
|
696
710
|
}
|
|
711
|
+
const data = parsedData.data;
|
|
697
712
|
// Create a copy of the metadata to avoid modifying the original
|
|
698
713
|
const finalMetadata = metadata ? { ...metadata } : {};
|
|
699
714
|
// Check for session-specific user resolver
|
|
@@ -756,7 +771,7 @@ export class PathwaysBuilder {
|
|
|
756
771
|
this.logger.debug(`Writing webhook data to pathway`, { pathway: pathStr });
|
|
757
772
|
eventIds = await this.writers[path](data, finalMetadata, options);
|
|
758
773
|
}
|
|
759
|
-
this.logger.
|
|
774
|
+
this.logger[this.logLevel.writeSuccess](`Successfully wrote to pathway`, {
|
|
760
775
|
pathway: pathStr,
|
|
761
776
|
eventIds: Array.isArray(eventIds) ? eventIds : [eventIds],
|
|
762
777
|
fireAndForget: options?.fireAndForget,
|
|
@@ -772,7 +787,7 @@ export class PathwaysBuilder {
|
|
|
772
787
|
}
|
|
773
788
|
return eventIds;
|
|
774
789
|
}
|
|
775
|
-
async writeBatch(path,
|
|
790
|
+
async writeBatch(path, inputData, metadata, options) {
|
|
776
791
|
const pathStr = String(path);
|
|
777
792
|
this.logger.debug(`Writing batch to pathway`, {
|
|
778
793
|
pathway: pathStr,
|
|
@@ -793,7 +808,8 @@ export class PathwaysBuilder {
|
|
|
793
808
|
throw new Error(error);
|
|
794
809
|
}
|
|
795
810
|
const schema = this.schemas[path];
|
|
796
|
-
|
|
811
|
+
const parsedData = z.array(schema).safeParse(inputData);
|
|
812
|
+
if (!parsedData.success) {
|
|
797
813
|
const errorMessage = `Invalid batch data for pathway ${pathStr}`;
|
|
798
814
|
this.logger.error(errorMessage, new Error(errorMessage), {
|
|
799
815
|
pathway: pathStr,
|
|
@@ -801,6 +817,7 @@ export class PathwaysBuilder {
|
|
|
801
817
|
});
|
|
802
818
|
throw new Error(errorMessage);
|
|
803
819
|
}
|
|
820
|
+
const data = parsedData.data;
|
|
804
821
|
// Create a copy of the metadata to avoid modifying the original
|
|
805
822
|
const finalMetadata = metadata ? { ...metadata } : {};
|
|
806
823
|
// Check for session-specific user resolver
|
|
@@ -856,7 +873,7 @@ export class PathwaysBuilder {
|
|
|
856
873
|
let eventIds = [];
|
|
857
874
|
this.logger.debug(`Writing batch webhook data to pathway`, { pathway: pathStr });
|
|
858
875
|
eventIds = await this.batchWriters[path](data, finalMetadata, options);
|
|
859
|
-
this.logger.
|
|
876
|
+
this.logger[this.logLevel.writeSuccess](`Successfully wrote to pathway`, {
|
|
860
877
|
pathway: pathStr,
|
|
861
878
|
eventIds: Array.isArray(eventIds) ? eventIds : [eventIds],
|
|
862
879
|
fireAndForget: options?.fireAndForget,
|
|
@@ -39,7 +39,10 @@ import type { EventMetadata, PathwayWriteOptions } from "./types.js";
|
|
|
39
39
|
* // All events will be associated with the same session ID
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export declare class SessionPathwayBuilder<TPathway extends Record<string,
|
|
42
|
+
export declare class SessionPathwayBuilder<TPathway extends Record<string, {
|
|
43
|
+
input: unknown;
|
|
44
|
+
output: unknown;
|
|
45
|
+
}> = {}, TWritablePaths extends keyof TPathway = never> {
|
|
43
46
|
private readonly pathwaysBuilder;
|
|
44
47
|
private readonly sessionId;
|
|
45
48
|
/**
|
|
@@ -94,6 +97,6 @@ export declare class SessionPathwayBuilder<TPathway extends Record<string, unkno
|
|
|
94
97
|
* @param options Optional write options
|
|
95
98
|
* @returns A promise that resolves to the event ID(s)
|
|
96
99
|
*/
|
|
97
|
-
write<TPath extends TWritablePaths>(path: TPath, data: TPathway[TPath], metadata?: EventMetadata, options?: PathwayWriteOptions): Promise<string | string[]>;
|
|
100
|
+
write<TPath extends TWritablePaths>(path: TPath, data: TPathway[TPath]["input"], metadata?: EventMetadata, options?: PathwayWriteOptions): Promise<string | string[]>;
|
|
98
101
|
}
|
|
99
102
|
//# sourceMappingURL=session-pathway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-pathway.d.ts","sourceRoot":"","sources":["../../src/pathways/session-pathway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAqBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,qBAAqB,CAEhC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"session-pathway.d.ts","sourceRoot":"","sources":["../../src/pathways/session-pathway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAqBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,qBAAqB,CAEhC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,EAAE,EACzE,cAAc,SAAS,MAAM,QAAQ,GAAG,KAAK;IAE7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2C;IAC3E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAElC;;;;;OAKG;gBAED,eAAe,EAAE,eAAe,CAAC,QAAQ,EAAE,cAAc,CAAC,EAC1D,SAAS,CAAC,EAAE,MAAM;IAMpB;;;;OAIG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAKhD;;;;;;;;OAQG;IACG,KAAK,CAAC,KAAK,SAAS,cAAc,EACtC,IAAI,EAAE,KAAK,EACX,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAC9B,QAAQ,CAAC,EAAE,aAAa,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;CAU9B"}
|
package/esm/pathways/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ZodTypeAny } from "zod";
|
|
2
2
|
import type { WebhookFileData, WebhookSendOptions } from "@flowcore/sdk-transformer-core";
|
|
3
3
|
/**
|
|
4
4
|
* Helper type to create a custom type error for non-writable pathways
|
|
@@ -13,7 +13,7 @@ type NonWritablePathwayError<T extends string> = T & {
|
|
|
13
13
|
* @template E The event type
|
|
14
14
|
* @template T The schema type
|
|
15
15
|
*/
|
|
16
|
-
export interface PathwayContract<F extends string, E extends string, T extends
|
|
16
|
+
export interface PathwayContract<F extends string, E extends string, T extends ZodTypeAny> {
|
|
17
17
|
/**
|
|
18
18
|
* The flow type for this pathway
|
|
19
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pathways/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pathways/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAEzF;;;GAGG;AACH,KAAK,uBAAuB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;IACnD,QAAQ,CAAC,yBAAyB,EAChC,wGAAwG,CAAA;CAC3G,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,UAAU;IACvF;;OAEG;IACH,QAAQ,EAAE,CAAC,CAAA;IAEX;;OAEG;IACH,SAAS,EAAE,CAAC,CAAA;IAEZ;;OAEG;IACH,MAAM,EAAE,CAAC,CAAA;IAET;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,aAAa,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AACH,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG;IACrD;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEhC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IAE7B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowcore/pathways",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "A TypeScript Library for creating Flowcore Pathways, simplifying the integration with the flowcore platform",
|
|
5
5
|
"homepage": "https://github.com/flowcore-io/flowcore-pathways#readme",
|
|
6
6
|
"repository": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@flowcore/sdk-transformer-core": "^2.3.6",
|
|
27
|
-
"@sinclair/typebox": "^0.34.27",
|
|
28
27
|
"node-cache": "5.1.2",
|
|
29
28
|
"postgres": "^3.4.3",
|
|
30
|
-
"rxjs": "^7.8.1"
|
|
29
|
+
"rxjs": "^7.8.1",
|
|
30
|
+
"zod": "^3.25.23"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^20.9.0",
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
metadata: TRecord<TString, TUnknown>;
|
|
13
|
-
payload: TRecord<TString, TUnknown>;
|
|
14
|
-
validTime: TString;
|
|
15
|
-
}>;
|
|
16
|
-
/**
|
|
17
|
-
* The type for an event
|
|
18
|
-
*/
|
|
19
|
-
export type FlowcoreEvent = Static<typeof FlowcoreEventSchema>;
|
|
1
|
+
export interface FlowcoreEvent<Payload = unknown, Metadata = Record<string, unknown>> {
|
|
2
|
+
eventId: string;
|
|
3
|
+
timeBucket: string;
|
|
4
|
+
tenant: string;
|
|
5
|
+
dataCoreId: string;
|
|
6
|
+
flowType: string;
|
|
7
|
+
eventType: string;
|
|
8
|
+
metadata: Metadata;
|
|
9
|
+
payload: Payload;
|
|
10
|
+
validTime: string;
|
|
11
|
+
}
|
|
20
12
|
//# sourceMappingURL=event.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/contracts/event.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/contracts/event.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa,CAAC,OAAO,GAAG,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClF,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowcoreEventSchema = void 0;
|
|
4
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
-
/**
|
|
6
|
-
* The schema for an event
|
|
7
|
-
*/
|
|
8
|
-
exports.FlowcoreEventSchema = typebox_1.Type.Object({
|
|
9
|
-
eventId: typebox_1.Type.String(),
|
|
10
|
-
timeBucket: typebox_1.Type.String(),
|
|
11
|
-
tenant: typebox_1.Type.String(),
|
|
12
|
-
dataCoreId: typebox_1.Type.String(),
|
|
13
|
-
flowType: typebox_1.Type.String(),
|
|
14
|
-
eventType: typebox_1.Type.String(),
|
|
15
|
-
metadata: typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown()),
|
|
16
|
-
payload: typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Unknown()),
|
|
17
|
-
validTime: typebox_1.Type.String(),
|
|
18
|
-
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z, type ZodTypeAny } from "zod";
|
|
2
2
|
import type { WebhookSendOptions } from "@flowcore/sdk-transformer-core";
|
|
3
3
|
import type { FlowcoreEvent } from "../contracts/event.js";
|
|
4
4
|
import type { Logger } from "./logger.js";
|
|
@@ -38,6 +38,21 @@ export interface AuditWebhookSendOptions extends WebhookSendOptions {
|
|
|
38
38
|
*/
|
|
39
39
|
headers?: Record<string, string>;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents the set log level for different internal log messages
|
|
43
|
+
* @property debug Log level for debug messages
|
|
44
|
+
* @property info Log level for info messages
|
|
45
|
+
* @property warn Log level for warn messages
|
|
46
|
+
* @property error Log level for error messages
|
|
47
|
+
*/
|
|
48
|
+
export type LogLevel = keyof Pick<Logger, "debug" | "info" | "warn" | "error">;
|
|
49
|
+
/**
|
|
50
|
+
* Configuration for log levels
|
|
51
|
+
* @property writeSuccess Log level used when a write operation is successful. Defaults to 'info'.
|
|
52
|
+
*/
|
|
53
|
+
export type LogLevelConfig = {
|
|
54
|
+
writeSuccess?: LogLevel;
|
|
55
|
+
};
|
|
41
56
|
/**
|
|
42
57
|
* SessionUserResolver is a key-value store for storing and retrieving UserIdResolver functions
|
|
43
58
|
* with a TTL (time to live).
|
|
@@ -103,7 +118,10 @@ export declare class SessionUser implements SessionUserResolver {
|
|
|
103
118
|
* @template TPathway Record type that maps pathway keys to their payload types
|
|
104
119
|
* @template TWritablePaths Union type of pathway keys that can be written to
|
|
105
120
|
*/
|
|
106
|
-
export declare class PathwaysBuilder<TPathway extends Record<string,
|
|
121
|
+
export declare class PathwaysBuilder<TPathway extends Record<string, {
|
|
122
|
+
input: unknown;
|
|
123
|
+
output: unknown;
|
|
124
|
+
}> = {}, TWritablePaths extends keyof TPathway = never> {
|
|
107
125
|
private readonly pathways;
|
|
108
126
|
private readonly handlers;
|
|
109
127
|
private readonly beforeObservable;
|
|
@@ -129,6 +147,7 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
129
147
|
private readonly tenant;
|
|
130
148
|
private readonly dataCore;
|
|
131
149
|
private readonly apiKey;
|
|
150
|
+
private readonly logLevel;
|
|
132
151
|
/**
|
|
133
152
|
* Creates a new PathwaysBuilder instance
|
|
134
153
|
* @param options Configuration options for the PathwaysBuilder
|
|
@@ -140,8 +159,10 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
140
159
|
* @param options.logger Optional logger instance
|
|
141
160
|
* @param options.enableSessionUserResolvers Whether to enable session user resolvers
|
|
142
161
|
* @param options.overrideSessionUserResolvers Optional SessionUserResolver instance to override the default
|
|
162
|
+
* @param options.logLevel Optional configuration for log levels
|
|
163
|
+
* @param options.logLevel.writeSuccess Log level for write success messages ('info' or 'debug'). Defaults to 'info'.
|
|
143
164
|
*/
|
|
144
|
-
constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, }: {
|
|
165
|
+
constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, logLevel, }: {
|
|
145
166
|
baseUrl: string;
|
|
146
167
|
tenant: string;
|
|
147
168
|
dataCore: string;
|
|
@@ -150,6 +171,7 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
150
171
|
logger?: Logger;
|
|
151
172
|
enableSessionUserResolvers?: boolean;
|
|
152
173
|
overrideSessionUserResolvers?: SessionUserResolver;
|
|
174
|
+
logLevel?: LogLevelConfig;
|
|
153
175
|
});
|
|
154
176
|
/**
|
|
155
177
|
* Configures the PathwaysBuilder to use a custom pathway state implementation
|
|
@@ -220,16 +242,19 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
220
242
|
* Registers a new pathway with the given contract
|
|
221
243
|
* @template F The flow type string
|
|
222
244
|
* @template E The event type string
|
|
223
|
-
* @template S The schema type extending
|
|
245
|
+
* @template S The schema type extending ZodTypeAny
|
|
224
246
|
* @template W Boolean indicating if the pathway is writable (defaults to true)
|
|
225
247
|
* @param contract The pathway contract describing the pathway
|
|
226
248
|
* @returns The PathwaysBuilder instance with the new pathway registered
|
|
227
249
|
*/
|
|
228
|
-
register<F extends string, E extends string, S extends
|
|
250
|
+
register<F extends string, E extends string, S extends ZodTypeAny, W extends boolean = true>(contract: PathwayContract<F, E, S> & {
|
|
229
251
|
writable?: W;
|
|
230
252
|
maxRetries?: number;
|
|
231
253
|
retryDelayMs?: number;
|
|
232
|
-
}): PathwaysBuilder<TPathway & Record<PathwayKey<F, E>,
|
|
254
|
+
}): PathwaysBuilder<TPathway & Record<PathwayKey<F, E>, {
|
|
255
|
+
output: z.infer<S>;
|
|
256
|
+
input: z.input<S>;
|
|
257
|
+
}>, TWritablePaths | WritablePathway<PathwayKey<F, E>, W>>;
|
|
233
258
|
/**
|
|
234
259
|
* Gets a pathway instance by its path
|
|
235
260
|
*
|
|
@@ -237,7 +262,7 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
237
262
|
* @param path The pathway key to get
|
|
238
263
|
* @returns The pathway instance
|
|
239
264
|
*/
|
|
240
|
-
get<TPath extends keyof TPathway>(path: TPath): TPathway[TPath];
|
|
265
|
+
get<TPath extends keyof TPathway>(path: TPath): TPathway[TPath]["output"];
|
|
241
266
|
/**
|
|
242
267
|
* Sets a handler function for a pathway
|
|
243
268
|
*
|
|
@@ -249,26 +274,20 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
249
274
|
* @param handler The function that will process events for this pathway
|
|
250
275
|
* @throws Error if the pathway doesn't exist or already has a handler
|
|
251
276
|
*/
|
|
252
|
-
handle<TPath extends keyof TPathway>(path: TPath, handler: (event:
|
|
253
|
-
payload: TPathway[TPath];
|
|
254
|
-
}) => Promise<void> | void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
277
|
+
handle<TPath extends keyof TPathway>(path: TPath, handler: (event: FlowcoreEvent<TPathway[TPath]["output"]>) => Promise<void> | void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
255
278
|
/**
|
|
256
279
|
* Subscribe to pathway events (before or after processing)
|
|
257
280
|
* @param path The pathway to subscribe to
|
|
258
281
|
* @param handler The handler function for the events
|
|
259
282
|
* @param type The event type to subscribe to (before, after, or all)
|
|
260
283
|
*/
|
|
261
|
-
subscribe<TPath extends keyof TPathway>(path: TPath, handler: (event:
|
|
262
|
-
payload: TPathway[TPath];
|
|
263
|
-
}) => void, type?: "before" | "after" | "all"): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
284
|
+
subscribe<TPath extends keyof TPathway>(path: TPath, handler: (event: FlowcoreEvent<TPathway[TPath]["output"]>) => void, type?: "before" | "after" | "all"): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
264
285
|
/**
|
|
265
286
|
* Subscribe to errors for a specific pathway
|
|
266
287
|
* @param path The pathway to subscribe to errors for
|
|
267
288
|
* @param handler The handler function that receives the error and event
|
|
268
289
|
*/
|
|
269
|
-
onError<TPath extends keyof TPathway>(path: TPath, handler: (error: Error, event:
|
|
270
|
-
payload: TPathway[TPath];
|
|
271
|
-
}) => void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
290
|
+
onError<TPath extends keyof TPathway>(path: TPath, handler: (error: Error, event: FlowcoreEvent<TPathway[TPath]["output"]>) => void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
272
291
|
/**
|
|
273
292
|
* Subscribe to errors for all pathways
|
|
274
293
|
* @param handler The handler function that receives the error, event, and pathway name
|
|
@@ -282,8 +301,8 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
282
301
|
* @param options Optional write options
|
|
283
302
|
* @returns A promise that resolves to the event ID(s)
|
|
284
303
|
*/
|
|
285
|
-
write<TPath extends TWritablePaths>(path: TPath,
|
|
286
|
-
writeBatch<TPath extends TWritablePaths>(path: TPath,
|
|
304
|
+
write<TPath extends TWritablePaths>(path: TPath, inputData: TPathway[TPath]["input"], metadata?: EventMetadata, options?: PathwayWriteOptions): Promise<string | string[]>;
|
|
305
|
+
writeBatch<TPath extends TWritablePaths>(path: TPath, inputData: TPathway[TPath]["input"][], metadata?: EventMetadata, options?: PathwayWriteOptions): Promise<string | string[]>;
|
|
287
306
|
/**
|
|
288
307
|
* Waits for a specific event to be processed
|
|
289
308
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/pathways/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/pathways/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,gCAAgC,CAAA;AAGvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EAInB,eAAe,EAChB,MAAM,YAAY,CAAA;AA8BnB;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEzC;;;;G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PathwaysBuilder = exports.SessionUser = void 0;
|
|
4
|
-
const
|
|
5
|
-
const value_1 = require("@sinclair/typebox/value");
|
|
4
|
+
const zod_1 = require("zod");
|
|
6
5
|
const rxjs_1 = require("rxjs");
|
|
7
6
|
const flowcore_transformer_core_sdk_js_1 = require("../compatibility/flowcore-transformer-core.sdk.js");
|
|
8
7
|
const internal_pathway_state_js_1 = require("./internal-pathway.state.js");
|
|
@@ -105,8 +104,10 @@ class PathwaysBuilder {
|
|
|
105
104
|
* @param options.logger Optional logger instance
|
|
106
105
|
* @param options.enableSessionUserResolvers Whether to enable session user resolvers
|
|
107
106
|
* @param options.overrideSessionUserResolvers Optional SessionUserResolver instance to override the default
|
|
107
|
+
* @param options.logLevel Optional configuration for log levels
|
|
108
|
+
* @param options.logLevel.writeSuccess Log level for write success messages ('info' or 'debug'). Defaults to 'info'.
|
|
108
109
|
*/
|
|
109
|
-
constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, }) {
|
|
110
|
+
constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, logLevel, }) {
|
|
110
111
|
Object.defineProperty(this, "pathways", {
|
|
111
112
|
enumerable: true,
|
|
112
113
|
configurable: true,
|
|
@@ -261,8 +262,18 @@ class PathwaysBuilder {
|
|
|
261
262
|
writable: true,
|
|
262
263
|
value: void 0
|
|
263
264
|
});
|
|
265
|
+
Object.defineProperty(this, "logLevel", {
|
|
266
|
+
enumerable: true,
|
|
267
|
+
configurable: true,
|
|
268
|
+
writable: true,
|
|
269
|
+
value: void 0
|
|
270
|
+
});
|
|
264
271
|
// Initialize logger (use NoopLogger if none provided)
|
|
265
272
|
this.logger = logger ?? new logger_js_1.NoopLogger();
|
|
273
|
+
// Initialize log levels with defaults
|
|
274
|
+
this.logLevel = {
|
|
275
|
+
writeSuccess: logLevel?.writeSuccess ?? "info",
|
|
276
|
+
};
|
|
266
277
|
// Store configuration values for cloning
|
|
267
278
|
this.baseUrl = baseUrl;
|
|
268
279
|
this.tenant = tenant;
|
|
@@ -394,9 +405,9 @@ class PathwaysBuilder {
|
|
|
394
405
|
}
|
|
395
406
|
// Validate event payload against schema if available
|
|
396
407
|
if (this.schemas[pathway]) {
|
|
408
|
+
const parsedPayload = this.schemas[pathway].safeParse(data.payload);
|
|
397
409
|
try {
|
|
398
|
-
|
|
399
|
-
if (!isValid) {
|
|
410
|
+
if (!parsedPayload.success) {
|
|
400
411
|
const error = `Event payload does not match schema for pathway ${pathwayStr}`;
|
|
401
412
|
this.logger.error(error);
|
|
402
413
|
throw new Error(error);
|
|
@@ -407,6 +418,7 @@ class PathwaysBuilder {
|
|
|
407
418
|
this.logger.error(error);
|
|
408
419
|
throw new Error(error);
|
|
409
420
|
}
|
|
421
|
+
data.payload = parsedPayload.data;
|
|
410
422
|
}
|
|
411
423
|
// Call audit handler if configured
|
|
412
424
|
if (this.auditHandler) {
|
|
@@ -507,7 +519,7 @@ class PathwaysBuilder {
|
|
|
507
519
|
* Registers a new pathway with the given contract
|
|
508
520
|
* @template F The flow type string
|
|
509
521
|
* @template E The event type string
|
|
510
|
-
* @template S The schema type extending
|
|
522
|
+
* @template S The schema type extending ZodTypeAny
|
|
511
523
|
* @template W Boolean indicating if the pathway is writable (defaults to true)
|
|
512
524
|
* @param contract The pathway contract describing the pathway
|
|
513
525
|
* @returns The PathwaysBuilder instance with the new pathway registered
|
|
@@ -540,7 +552,8 @@ class PathwaysBuilder {
|
|
|
540
552
|
this.writers[path] = this.webhookBuilderFactory()
|
|
541
553
|
.buildWebhook(contract.flowType, contract.eventType).send;
|
|
542
554
|
this.batchWriters[path] = this.webhookBuilderFactory()
|
|
543
|
-
.buildWebhook(contract.flowType, contract.eventType)
|
|
555
|
+
.buildWebhook(contract.flowType, contract.eventType)
|
|
556
|
+
.sendBatch;
|
|
544
557
|
}
|
|
545
558
|
}
|
|
546
559
|
if (contract.timeoutMs) {
|
|
@@ -669,7 +682,7 @@ class PathwaysBuilder {
|
|
|
669
682
|
* @param options Optional write options
|
|
670
683
|
* @returns A promise that resolves to the event ID(s)
|
|
671
684
|
*/
|
|
672
|
-
async write(path,
|
|
685
|
+
async write(path, inputData, metadata, options) {
|
|
673
686
|
const pathStr = String(path);
|
|
674
687
|
this.logger.debug(`Writing to pathway`, {
|
|
675
688
|
pathway: pathStr,
|
|
@@ -690,7 +703,8 @@ class PathwaysBuilder {
|
|
|
690
703
|
throw new Error(error);
|
|
691
704
|
}
|
|
692
705
|
const schema = this.schemas[path];
|
|
693
|
-
|
|
706
|
+
const parsedData = schema.safeParse(inputData);
|
|
707
|
+
if (!parsedData.success) {
|
|
694
708
|
const errorMessage = `Invalid data for pathway ${pathStr}`;
|
|
695
709
|
this.logger.error(errorMessage, new Error(errorMessage), {
|
|
696
710
|
pathway: pathStr,
|
|
@@ -698,6 +712,7 @@ class PathwaysBuilder {
|
|
|
698
712
|
});
|
|
699
713
|
throw new Error(errorMessage);
|
|
700
714
|
}
|
|
715
|
+
const data = parsedData.data;
|
|
701
716
|
// Create a copy of the metadata to avoid modifying the original
|
|
702
717
|
const finalMetadata = metadata ? { ...metadata } : {};
|
|
703
718
|
// Check for session-specific user resolver
|
|
@@ -760,7 +775,7 @@ class PathwaysBuilder {
|
|
|
760
775
|
this.logger.debug(`Writing webhook data to pathway`, { pathway: pathStr });
|
|
761
776
|
eventIds = await this.writers[path](data, finalMetadata, options);
|
|
762
777
|
}
|
|
763
|
-
this.logger.
|
|
778
|
+
this.logger[this.logLevel.writeSuccess](`Successfully wrote to pathway`, {
|
|
764
779
|
pathway: pathStr,
|
|
765
780
|
eventIds: Array.isArray(eventIds) ? eventIds : [eventIds],
|
|
766
781
|
fireAndForget: options?.fireAndForget,
|
|
@@ -776,7 +791,7 @@ class PathwaysBuilder {
|
|
|
776
791
|
}
|
|
777
792
|
return eventIds;
|
|
778
793
|
}
|
|
779
|
-
async writeBatch(path,
|
|
794
|
+
async writeBatch(path, inputData, metadata, options) {
|
|
780
795
|
const pathStr = String(path);
|
|
781
796
|
this.logger.debug(`Writing batch to pathway`, {
|
|
782
797
|
pathway: pathStr,
|
|
@@ -797,7 +812,8 @@ class PathwaysBuilder {
|
|
|
797
812
|
throw new Error(error);
|
|
798
813
|
}
|
|
799
814
|
const schema = this.schemas[path];
|
|
800
|
-
|
|
815
|
+
const parsedData = zod_1.z.array(schema).safeParse(inputData);
|
|
816
|
+
if (!parsedData.success) {
|
|
801
817
|
const errorMessage = `Invalid batch data for pathway ${pathStr}`;
|
|
802
818
|
this.logger.error(errorMessage, new Error(errorMessage), {
|
|
803
819
|
pathway: pathStr,
|
|
@@ -805,6 +821,7 @@ class PathwaysBuilder {
|
|
|
805
821
|
});
|
|
806
822
|
throw new Error(errorMessage);
|
|
807
823
|
}
|
|
824
|
+
const data = parsedData.data;
|
|
808
825
|
// Create a copy of the metadata to avoid modifying the original
|
|
809
826
|
const finalMetadata = metadata ? { ...metadata } : {};
|
|
810
827
|
// Check for session-specific user resolver
|
|
@@ -860,7 +877,7 @@ class PathwaysBuilder {
|
|
|
860
877
|
let eventIds = [];
|
|
861
878
|
this.logger.debug(`Writing batch webhook data to pathway`, { pathway: pathStr });
|
|
862
879
|
eventIds = await this.batchWriters[path](data, finalMetadata, options);
|
|
863
|
-
this.logger.
|
|
880
|
+
this.logger[this.logLevel.writeSuccess](`Successfully wrote to pathway`, {
|
|
864
881
|
pathway: pathStr,
|
|
865
882
|
eventIds: Array.isArray(eventIds) ? eventIds : [eventIds],
|
|
866
883
|
fireAndForget: options?.fireAndForget,
|
|
@@ -39,7 +39,10 @@ import type { EventMetadata, PathwayWriteOptions } from "./types.js";
|
|
|
39
39
|
* // All events will be associated with the same session ID
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export declare class SessionPathwayBuilder<TPathway extends Record<string,
|
|
42
|
+
export declare class SessionPathwayBuilder<TPathway extends Record<string, {
|
|
43
|
+
input: unknown;
|
|
44
|
+
output: unknown;
|
|
45
|
+
}> = {}, TWritablePaths extends keyof TPathway = never> {
|
|
43
46
|
private readonly pathwaysBuilder;
|
|
44
47
|
private readonly sessionId;
|
|
45
48
|
/**
|
|
@@ -94,6 +97,6 @@ export declare class SessionPathwayBuilder<TPathway extends Record<string, unkno
|
|
|
94
97
|
* @param options Optional write options
|
|
95
98
|
* @returns A promise that resolves to the event ID(s)
|
|
96
99
|
*/
|
|
97
|
-
write<TPath extends TWritablePaths>(path: TPath, data: TPathway[TPath], metadata?: EventMetadata, options?: PathwayWriteOptions): Promise<string | string[]>;
|
|
100
|
+
write<TPath extends TWritablePaths>(path: TPath, data: TPathway[TPath]["input"], metadata?: EventMetadata, options?: PathwayWriteOptions): Promise<string | string[]>;
|
|
98
101
|
}
|
|
99
102
|
//# sourceMappingURL=session-pathway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-pathway.d.ts","sourceRoot":"","sources":["../../src/pathways/session-pathway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAqBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,qBAAqB,CAEhC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"session-pathway.d.ts","sourceRoot":"","sources":["../../src/pathways/session-pathway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAqBpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,qBAAqB,CAEhC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,EAAE,EACzE,cAAc,SAAS,MAAM,QAAQ,GAAG,KAAK;IAE7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2C;IAC3E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAElC;;;;;OAKG;gBAED,eAAe,EAAE,eAAe,CAAC,QAAQ,EAAE,cAAc,CAAC,EAC1D,SAAS,CAAC,EAAE,MAAM;IAMpB;;;;OAIG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAKhD;;;;;;;;OAQG;IACG,KAAK,CAAC,KAAK,SAAS,cAAc,EACtC,IAAI,EAAE,KAAK,EACX,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAC9B,QAAQ,CAAC,EAAE,aAAa,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;CAU9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ZodTypeAny } from "zod";
|
|
2
2
|
import type { WebhookFileData, WebhookSendOptions } from "@flowcore/sdk-transformer-core";
|
|
3
3
|
/**
|
|
4
4
|
* Helper type to create a custom type error for non-writable pathways
|
|
@@ -13,7 +13,7 @@ type NonWritablePathwayError<T extends string> = T & {
|
|
|
13
13
|
* @template E The event type
|
|
14
14
|
* @template T The schema type
|
|
15
15
|
*/
|
|
16
|
-
export interface PathwayContract<F extends string, E extends string, T extends
|
|
16
|
+
export interface PathwayContract<F extends string, E extends string, T extends ZodTypeAny> {
|
|
17
17
|
/**
|
|
18
18
|
* The flow type for this pathway
|
|
19
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pathways/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pathways/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAEzF;;;GAGG;AACH,KAAK,uBAAuB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;IACnD,QAAQ,CAAC,yBAAyB,EAChC,wGAAwG,CAAA;CAC3G,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,UAAU;IACvF;;OAEG;IACH,QAAQ,EAAE,CAAC,CAAA;IAEX;;OAEG;IACH,SAAS,EAAE,CAAC,CAAA;IAEZ;;OAEG;IACH,MAAM,EAAE,CAAC,CAAA;IAET;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,CAAA;AAExE;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAAG;A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