@flowcore/pathways 0.13.2 → 0.15.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 +29 -0
- package/README.md +48 -45
- 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 +26 -18
- package/esm/pathways/builder.d.ts.map +1 -1
- package/esm/pathways/builder.js +57 -117
- package/esm/pathways/session-pathway.d.ts +5 -2
- package/esm/pathways/session-pathway.d.ts.map +1 -1
- package/esm/pathways/session-pathway.js +1 -1
- package/esm/pathways/types.d.ts +20 -3
- package/esm/pathways/types.d.ts.map +1 -1
- package/esm/pathways/types.js +18 -1
- package/package.json +4 -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 +26 -18
- package/script/pathways/builder.d.ts.map +1 -1
- package/script/pathways/builder.js +57 -117
- package/script/pathways/session-pathway.d.ts +5 -2
- package/script/pathways/session-pathway.d.ts.map +1 -1
- package/script/pathways/session-pathway.js +1 -1
- package/script/pathways/types.d.ts +20 -3
- package/script/pathways/types.d.ts.map +1 -1
- package/script/pathways/types.js +19 -0
package/esm/pathways/builder.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { fileTypeFromBuffer } from "file-type";
|
|
3
3
|
import { Subject } from "rxjs";
|
|
4
4
|
import { WebhookBuilder } from "../compatibility/flowcore-transformer-core.sdk.js";
|
|
5
5
|
import { InternalPathwayState } from "./internal-pathway.state.js";
|
|
6
6
|
import { NoopLogger } from "./logger.js";
|
|
7
7
|
import { AUDIT_ENTITY_TYPE, AUDIT_MODE, AUDIT_ON_BEHALF_OF, AUDIT_SYSTEM_MODE, AUDIT_USER_ID, AUDIT_USER_MODE, } from "./constants.js";
|
|
8
|
+
import { FileEventSchema, FileInputSchema } from "./types.js";
|
|
8
9
|
/**
|
|
9
10
|
* Default timeout for pathway processing in milliseconds (10 seconds)
|
|
10
11
|
*/
|
|
@@ -153,12 +154,24 @@ export class PathwaysBuilder {
|
|
|
153
154
|
writable: true,
|
|
154
155
|
value: {}
|
|
155
156
|
});
|
|
157
|
+
Object.defineProperty(this, "fileWriters", {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
configurable: true,
|
|
160
|
+
writable: true,
|
|
161
|
+
value: {}
|
|
162
|
+
});
|
|
156
163
|
Object.defineProperty(this, "schemas", {
|
|
157
164
|
enumerable: true,
|
|
158
165
|
configurable: true,
|
|
159
166
|
writable: true,
|
|
160
167
|
value: {}
|
|
161
168
|
});
|
|
169
|
+
Object.defineProperty(this, "inputSchemas", {
|
|
170
|
+
enumerable: true,
|
|
171
|
+
configurable: true,
|
|
172
|
+
writable: true,
|
|
173
|
+
value: {}
|
|
174
|
+
});
|
|
162
175
|
Object.defineProperty(this, "writable", {
|
|
163
176
|
enumerable: true,
|
|
164
177
|
configurable: true,
|
|
@@ -269,7 +282,7 @@ export class PathwaysBuilder {
|
|
|
269
282
|
this.logger = logger ?? new NoopLogger();
|
|
270
283
|
// Initialize log levels with defaults
|
|
271
284
|
this.logLevel = {
|
|
272
|
-
writeSuccess: logLevel?.writeSuccess ??
|
|
285
|
+
writeSuccess: logLevel?.writeSuccess ?? "info",
|
|
273
286
|
};
|
|
274
287
|
// Store configuration values for cloning
|
|
275
288
|
this.baseUrl = baseUrl;
|
|
@@ -402,9 +415,9 @@ export class PathwaysBuilder {
|
|
|
402
415
|
}
|
|
403
416
|
// Validate event payload against schema if available
|
|
404
417
|
if (this.schemas[pathway]) {
|
|
418
|
+
const parsedPayload = this.schemas[pathway].safeParse(data.payload);
|
|
405
419
|
try {
|
|
406
|
-
|
|
407
|
-
if (!isValid) {
|
|
420
|
+
if (!parsedPayload.success) {
|
|
408
421
|
const error = `Event payload does not match schema for pathway ${pathwayStr}`;
|
|
409
422
|
this.logger.error(error);
|
|
410
423
|
throw new Error(error);
|
|
@@ -415,6 +428,7 @@ export class PathwaysBuilder {
|
|
|
415
428
|
this.logger.error(error);
|
|
416
429
|
throw new Error(error);
|
|
417
430
|
}
|
|
431
|
+
data.payload = parsedPayload.data;
|
|
418
432
|
}
|
|
419
433
|
// Call audit handler if configured
|
|
420
434
|
if (this.auditHandler) {
|
|
@@ -515,7 +529,7 @@ export class PathwaysBuilder {
|
|
|
515
529
|
* Registers a new pathway with the given contract
|
|
516
530
|
* @template F The flow type string
|
|
517
531
|
* @template E The event type string
|
|
518
|
-
* @template S The schema type extending
|
|
532
|
+
* @template S The schema type extending ZodTypeAny
|
|
519
533
|
* @template W Boolean indicating if the pathway is writable (defaults to true)
|
|
520
534
|
* @param contract The pathway contract describing the pathway
|
|
521
535
|
* @returns The PathwaysBuilder instance with the new pathway registered
|
|
@@ -541,14 +555,15 @@ export class PathwaysBuilder {
|
|
|
541
555
|
if (writable) {
|
|
542
556
|
if (contract.isFilePathway) {
|
|
543
557
|
this.filePathways.add(path);
|
|
544
|
-
this.
|
|
558
|
+
this.fileWriters[path] = this.webhookBuilderFactory()
|
|
545
559
|
.buildFileWebhook(contract.flowType, contract.eventType).send;
|
|
546
560
|
}
|
|
547
561
|
else {
|
|
548
562
|
this.writers[path] = this.webhookBuilderFactory()
|
|
549
563
|
.buildWebhook(contract.flowType, contract.eventType).send;
|
|
550
564
|
this.batchWriters[path] = this.webhookBuilderFactory()
|
|
551
|
-
.buildWebhook(contract.flowType, contract.eventType)
|
|
565
|
+
.buildWebhook(contract.flowType, contract.eventType)
|
|
566
|
+
.sendBatch;
|
|
552
567
|
}
|
|
553
568
|
}
|
|
554
569
|
if (contract.timeoutMs) {
|
|
@@ -560,13 +575,21 @@ export class PathwaysBuilder {
|
|
|
560
575
|
if (contract.retryDelayMs !== undefined) {
|
|
561
576
|
this.retryDelays[path] = contract.retryDelayMs;
|
|
562
577
|
}
|
|
563
|
-
|
|
578
|
+
if (contract.isFilePathway) {
|
|
579
|
+
this.schemas[path] = (contract.schema ?? z.object({})).merge(FileEventSchema);
|
|
580
|
+
this.inputSchemas[path] = (contract.schema ?? z.object({})).merge(FileInputSchema);
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
this.schemas[path] = contract.schema ?? z.object({});
|
|
584
|
+
this.inputSchemas[path] = contract.schema ?? z.object({});
|
|
585
|
+
}
|
|
564
586
|
this.writable[path] = writable;
|
|
565
587
|
this.logger.info(`Pathway registered successfully`, {
|
|
566
588
|
pathway: path,
|
|
567
589
|
flowType: contract.flowType,
|
|
568
590
|
eventType: contract.eventType,
|
|
569
591
|
writable,
|
|
592
|
+
isFilePathway: contract.isFilePathway,
|
|
570
593
|
});
|
|
571
594
|
return this;
|
|
572
595
|
}
|
|
@@ -677,8 +700,14 @@ export class PathwaysBuilder {
|
|
|
677
700
|
* @param options Optional write options
|
|
678
701
|
* @returns A promise that resolves to the event ID(s)
|
|
679
702
|
*/
|
|
680
|
-
async write(path,
|
|
703
|
+
async write(path, input) {
|
|
681
704
|
const pathStr = String(path);
|
|
705
|
+
const { data: inputData, metadata, options, batch } = input;
|
|
706
|
+
if (batch && this.filePathways.has(path)) {
|
|
707
|
+
const error = `Batch is not possible for file pathways. Pathway ${pathStr} is a file pathway`;
|
|
708
|
+
this.logger.error(error);
|
|
709
|
+
throw new Error(error);
|
|
710
|
+
}
|
|
682
711
|
this.logger.debug(`Writing to pathway`, {
|
|
683
712
|
pathway: pathStr,
|
|
684
713
|
metadata,
|
|
@@ -697,8 +726,9 @@ export class PathwaysBuilder {
|
|
|
697
726
|
this.logger.error(error);
|
|
698
727
|
throw new Error(error);
|
|
699
728
|
}
|
|
700
|
-
const schema = this.
|
|
701
|
-
|
|
729
|
+
const schema = batch ? z.array(this.inputSchemas[path]) : this.inputSchemas[path];
|
|
730
|
+
const parsedData = schema.safeParse(inputData);
|
|
731
|
+
if (!parsedData.success) {
|
|
702
732
|
const errorMessage = `Invalid data for pathway ${pathStr}`;
|
|
703
733
|
this.logger.error(errorMessage, new Error(errorMessage), {
|
|
704
734
|
pathway: pathStr,
|
|
@@ -706,6 +736,7 @@ export class PathwaysBuilder {
|
|
|
706
736
|
});
|
|
707
737
|
throw new Error(errorMessage);
|
|
708
738
|
}
|
|
739
|
+
const data = parsedData.data;
|
|
709
740
|
// Create a copy of the metadata to avoid modifying the original
|
|
710
741
|
const finalMetadata = metadata ? { ...metadata } : {};
|
|
711
742
|
// Check for session-specific user resolver
|
|
@@ -759,13 +790,22 @@ export class PathwaysBuilder {
|
|
|
759
790
|
}
|
|
760
791
|
}
|
|
761
792
|
let eventIds = [];
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
793
|
+
this.logger.debug(`Writing webhook data to pathway`, { pathway: pathStr, batch });
|
|
794
|
+
if (batch) {
|
|
795
|
+
eventIds = await this.batchWriters[path](data, finalMetadata, options);
|
|
796
|
+
}
|
|
797
|
+
else if (this.filePathways.has(path)) {
|
|
798
|
+
const { fileId, fileName, fileContent, ...additionalProperties } = data;
|
|
799
|
+
const fileType = await fileTypeFromBuffer(fileContent);
|
|
800
|
+
eventIds = await this.fileWriters[path]({
|
|
801
|
+
fileId,
|
|
802
|
+
fileName,
|
|
803
|
+
fileType: fileType?.mime ?? "application/octet-stream",
|
|
804
|
+
fileContent: new Blob([fileContent]),
|
|
805
|
+
additionalProperties,
|
|
806
|
+
}, finalMetadata, options);
|
|
766
807
|
}
|
|
767
808
|
else {
|
|
768
|
-
this.logger.debug(`Writing webhook data to pathway`, { pathway: pathStr });
|
|
769
809
|
eventIds = await this.writers[path](data, finalMetadata, options);
|
|
770
810
|
}
|
|
771
811
|
this.logger[this.logLevel.writeSuccess](`Successfully wrote to pathway`, {
|
|
@@ -784,106 +824,6 @@ export class PathwaysBuilder {
|
|
|
784
824
|
}
|
|
785
825
|
return eventIds;
|
|
786
826
|
}
|
|
787
|
-
async writeBatch(path, data, metadata, options) {
|
|
788
|
-
const pathStr = String(path);
|
|
789
|
-
this.logger.debug(`Writing batch to pathway`, {
|
|
790
|
-
pathway: pathStr,
|
|
791
|
-
metadata,
|
|
792
|
-
options: {
|
|
793
|
-
fireAndForget: options?.fireAndForget,
|
|
794
|
-
sessionId: options?.sessionId,
|
|
795
|
-
},
|
|
796
|
-
});
|
|
797
|
-
if (!this.pathways[path]) {
|
|
798
|
-
const error = `Pathway ${pathStr} not found`;
|
|
799
|
-
this.logger.error(error);
|
|
800
|
-
throw new Error(error);
|
|
801
|
-
}
|
|
802
|
-
if (!this.writable[path]) {
|
|
803
|
-
const error = `Pathway ${pathStr} is not writable`;
|
|
804
|
-
this.logger.error(error);
|
|
805
|
-
throw new Error(error);
|
|
806
|
-
}
|
|
807
|
-
const schema = this.schemas[path];
|
|
808
|
-
if (!Value.Check(Type.Array(schema), data)) {
|
|
809
|
-
const errorMessage = `Invalid batch data for pathway ${pathStr}`;
|
|
810
|
-
this.logger.error(errorMessage, new Error(errorMessage), {
|
|
811
|
-
pathway: pathStr,
|
|
812
|
-
schema: schema.toString(),
|
|
813
|
-
});
|
|
814
|
-
throw new Error(errorMessage);
|
|
815
|
-
}
|
|
816
|
-
// Create a copy of the metadata to avoid modifying the original
|
|
817
|
-
const finalMetadata = metadata ? { ...metadata } : {};
|
|
818
|
-
// Check for session-specific user resolver
|
|
819
|
-
let userId;
|
|
820
|
-
if (options?.sessionId) {
|
|
821
|
-
const sessionUserResolver = this.getSessionUserResolver(options.sessionId);
|
|
822
|
-
if (sessionUserResolver) {
|
|
823
|
-
try {
|
|
824
|
-
userId = await sessionUserResolver();
|
|
825
|
-
this.logger.debug(`Using session-specific user resolver`, {
|
|
826
|
-
pathway: pathStr,
|
|
827
|
-
sessionId: options.sessionId,
|
|
828
|
-
userId,
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
catch (error) {
|
|
832
|
-
this.logger.error(`Error resolving session user ID`, error instanceof Error ? error : new Error(String(error)), {
|
|
833
|
-
pathway: pathStr,
|
|
834
|
-
sessionId: options.sessionId,
|
|
835
|
-
});
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
// Process audit metadata if audit is configured
|
|
840
|
-
if (this.userIdResolver) {
|
|
841
|
-
// Only use global resolver if we don't already have a user ID from a session resolver
|
|
842
|
-
if (!userId) {
|
|
843
|
-
this.logger.debug(`Resolving user ID for audit metadata`, { pathway: pathStr });
|
|
844
|
-
userId = await this.userIdResolver();
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
// Determine the audit mode: default is "user" unless explicitly specified as "system"
|
|
848
|
-
const auditMode = options?.auditMode ?? "user";
|
|
849
|
-
this.logger.debug(`Adding audit metadata`, {
|
|
850
|
-
pathway: pathStr,
|
|
851
|
-
auditMode,
|
|
852
|
-
userId,
|
|
853
|
-
});
|
|
854
|
-
if (userId) {
|
|
855
|
-
// Add appropriate audit metadata based on mode
|
|
856
|
-
if (auditMode === AUDIT_SYSTEM_MODE) {
|
|
857
|
-
finalMetadata[AUDIT_USER_ID] = "system";
|
|
858
|
-
finalMetadata[AUDIT_ON_BEHALF_OF] = userId.entityId;
|
|
859
|
-
finalMetadata[AUDIT_MODE] = "system";
|
|
860
|
-
finalMetadata[AUDIT_ENTITY_TYPE] = userId.entityType;
|
|
861
|
-
}
|
|
862
|
-
else {
|
|
863
|
-
finalMetadata[AUDIT_USER_ID] = userId.entityId;
|
|
864
|
-
finalMetadata[AUDIT_MODE] = AUDIT_USER_MODE; // Always set mode for user
|
|
865
|
-
finalMetadata[AUDIT_ENTITY_TYPE] = userId.entityType;
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
let eventIds = [];
|
|
869
|
-
this.logger.debug(`Writing batch webhook data to pathway`, { pathway: pathStr });
|
|
870
|
-
eventIds = await this.batchWriters[path](data, finalMetadata, options);
|
|
871
|
-
this.logger[this.logLevel.writeSuccess](`Successfully wrote to pathway`, {
|
|
872
|
-
pathway: pathStr,
|
|
873
|
-
eventIds: Array.isArray(eventIds) ? eventIds : [eventIds],
|
|
874
|
-
fireAndForget: options?.fireAndForget,
|
|
875
|
-
});
|
|
876
|
-
if (!options?.fireAndForget) {
|
|
877
|
-
this.logger.debug(`Waiting for pathway to be processed`, {
|
|
878
|
-
pathway: pathStr,
|
|
879
|
-
eventIds: Array.isArray(eventIds) ? eventIds : [eventIds],
|
|
880
|
-
});
|
|
881
|
-
await Promise.all(Array.isArray(eventIds)
|
|
882
|
-
? eventIds.map((id) => this.waitForPathwayToBeProcessed(id))
|
|
883
|
-
: [this.waitForPathwayToBeProcessed(eventIds)]);
|
|
884
|
-
}
|
|
885
|
-
return eventIds;
|
|
886
|
-
}
|
|
887
827
|
/**
|
|
888
828
|
* Waits for a specific event to be processed
|
|
889
829
|
*
|
|
@@ -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"}
|
|
@@ -133,6 +133,6 @@ export class SessionPathwayBuilder {
|
|
|
133
133
|
// Always include the session ID in the options
|
|
134
134
|
finalOptions.sessionId = options?.sessionId ?? this.sessionId;
|
|
135
135
|
// The PathwaysBuilder will handle session-specific user resolvers
|
|
136
|
-
return await this.pathwaysBuilder.write(path, data, metadata, finalOptions);
|
|
136
|
+
return await this.pathwaysBuilder.write(path, { data, metadata, options: finalOptions });
|
|
137
137
|
}
|
|
138
138
|
}
|
package/esm/pathways/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AnyZodObject, z } from "zod";
|
|
2
2
|
import type { WebhookFileData, WebhookSendOptions } from "@flowcore/sdk-transformer-core";
|
|
3
|
+
import { Buffer } from "node:buffer";
|
|
3
4
|
/**
|
|
4
5
|
* Helper type to create a custom type error for non-writable pathways
|
|
5
6
|
* @template T The string type to create an error for
|
|
@@ -13,7 +14,7 @@ type NonWritablePathwayError<T extends string> = T & {
|
|
|
13
14
|
* @template E The event type
|
|
14
15
|
* @template T The schema type
|
|
15
16
|
*/
|
|
16
|
-
export interface PathwayContract<F extends string, E extends string, T extends
|
|
17
|
+
export interface PathwayContract<F extends string, E extends string, T extends AnyZodObject> {
|
|
17
18
|
/**
|
|
18
19
|
* The flow type for this pathway
|
|
19
20
|
*/
|
|
@@ -25,7 +26,7 @@ export interface PathwayContract<F extends string, E extends string, T extends T
|
|
|
25
26
|
/**
|
|
26
27
|
* The schema that defines the structure of events for this pathway
|
|
27
28
|
*/
|
|
28
|
-
schema
|
|
29
|
+
schema?: T;
|
|
29
30
|
/**
|
|
30
31
|
* Whether the pathway is writable. Use `false as const` to make the pathway non-writable at compile time.
|
|
31
32
|
* @example
|
|
@@ -143,5 +144,21 @@ export type PathwayWriteOptions = WebhookSendOptions & {
|
|
|
143
144
|
*/
|
|
144
145
|
sessionId?: string;
|
|
145
146
|
};
|
|
147
|
+
export declare const FileInputSchema: z.ZodObject<{
|
|
148
|
+
fileId: z.ZodString;
|
|
149
|
+
fileName: z.ZodString;
|
|
150
|
+
fileContent: z.ZodType<Buffer>;
|
|
151
|
+
}>;
|
|
152
|
+
export declare const FileEventSchema: z.ZodObject<{
|
|
153
|
+
fileName: z.ZodString;
|
|
154
|
+
fileType: z.ZodString;
|
|
155
|
+
fileSize: z.ZodNumber;
|
|
156
|
+
data: z.ZodString;
|
|
157
|
+
part: z.ZodNumber;
|
|
158
|
+
totalParts: z.ZodNumber;
|
|
159
|
+
checksum: z.ZodString;
|
|
160
|
+
hashType: z.ZodString;
|
|
161
|
+
fileId: z.ZodString;
|
|
162
|
+
}>;
|
|
146
163
|
export {};
|
|
147
164
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -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,EAAE,KAAK,YAAY,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC;;;GAGG;AACH,KAAK,uBAAuB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;IACnD,QAAQ,CAAC,yBAAyB,EAChC,wGAAwG,CAAA;CAC3G,CAA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AC,CAAC,SAAS,CAAA;IACrB,IAAI,EAAE,CAAC,CAAC,SAAS,CAAA;IACjB,IAAI,EAAE,CAAC,CAAC,SAAS,CAAA;IACjB,UAAU,EAAE,CAAC,CAAC,SAAS,CAAA;IACvB,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAA;IACrB,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAA;IACrB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAA;CACpB,CAUC,CAAA"}
|
package/esm/pathways/types.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Buffer } from "node:buffer";
|
|
3
|
+
export const FileInputSchema = z.object({
|
|
4
|
+
fileId: z.string(),
|
|
5
|
+
fileName: z.string(),
|
|
6
|
+
fileContent: z.instanceof(Buffer),
|
|
7
|
+
});
|
|
8
|
+
export const FileEventSchema = z.object({
|
|
9
|
+
fileName: z.string(),
|
|
10
|
+
fileType: z.string(),
|
|
11
|
+
fileSize: z.number(),
|
|
12
|
+
data: z.string(),
|
|
13
|
+
part: z.number(),
|
|
14
|
+
totalParts: z.number(),
|
|
15
|
+
checksum: z.string(),
|
|
16
|
+
hashType: z.string(),
|
|
17
|
+
fileId: z.string(),
|
|
18
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowcore/pathways",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@flowcore/sdk-transformer-core": "^2.3.6",
|
|
27
|
-
"
|
|
27
|
+
"file-type": "^21.0.0",
|
|
28
28
|
"node-cache": "5.1.2",
|
|
29
29
|
"postgres": "^3.4.3",
|
|
30
|
-
"rxjs": "^7.8.1"
|
|
30
|
+
"rxjs": "^7.8.1",
|
|
31
|
+
"zod": "^3.25.23"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@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,8 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AnyZodObject, z } 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";
|
|
5
5
|
import type { EventMetadata, PathwayContract, PathwayKey, PathwayState, PathwayWriteOptions, WritablePathway } from "./types.js";
|
|
6
|
+
import { FileEventSchema, FileInputSchema } from "./types.js";
|
|
6
7
|
/**
|
|
7
8
|
* Defines the mode for auditing pathway operations
|
|
8
9
|
* - "user": Normal user-initiated operations
|
|
@@ -45,7 +46,7 @@ export interface AuditWebhookSendOptions extends WebhookSendOptions {
|
|
|
45
46
|
* @property warn Log level for warn messages
|
|
46
47
|
* @property error Log level for error messages
|
|
47
48
|
*/
|
|
48
|
-
export type LogLevel = keyof Pick<Logger,
|
|
49
|
+
export type LogLevel = keyof Pick<Logger, "debug" | "info" | "warn" | "error">;
|
|
49
50
|
/**
|
|
50
51
|
* Configuration for log levels
|
|
51
52
|
* @property writeSuccess Log level used when a write operation is successful. Defaults to 'info'.
|
|
@@ -118,7 +119,10 @@ export declare class SessionUser implements SessionUserResolver {
|
|
|
118
119
|
* @template TPathway Record type that maps pathway keys to their payload types
|
|
119
120
|
* @template TWritablePaths Union type of pathway keys that can be written to
|
|
120
121
|
*/
|
|
121
|
-
export declare class PathwaysBuilder<TPathway extends Record<string,
|
|
122
|
+
export declare class PathwaysBuilder<TPathway extends Record<string, {
|
|
123
|
+
input: unknown;
|
|
124
|
+
output: unknown;
|
|
125
|
+
}> = {}, TWritablePaths extends keyof TPathway = never> {
|
|
122
126
|
private readonly pathways;
|
|
123
127
|
private readonly handlers;
|
|
124
128
|
private readonly beforeObservable;
|
|
@@ -127,7 +131,9 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
127
131
|
private readonly globalErrorSubject;
|
|
128
132
|
private readonly writers;
|
|
129
133
|
private readonly batchWriters;
|
|
134
|
+
private readonly fileWriters;
|
|
130
135
|
private readonly schemas;
|
|
136
|
+
private readonly inputSchemas;
|
|
131
137
|
private readonly writable;
|
|
132
138
|
private readonly timeouts;
|
|
133
139
|
private readonly maxRetries;
|
|
@@ -239,16 +245,20 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
239
245
|
* Registers a new pathway with the given contract
|
|
240
246
|
* @template F The flow type string
|
|
241
247
|
* @template E The event type string
|
|
242
|
-
* @template S The schema type extending
|
|
248
|
+
* @template S The schema type extending ZodTypeAny
|
|
243
249
|
* @template W Boolean indicating if the pathway is writable (defaults to true)
|
|
244
250
|
* @param contract The pathway contract describing the pathway
|
|
245
251
|
* @returns The PathwaysBuilder instance with the new pathway registered
|
|
246
252
|
*/
|
|
247
|
-
register<F extends string, E extends string, S extends
|
|
253
|
+
register<F extends string, E extends string, S extends AnyZodObject = AnyZodObject, W extends boolean = true, FP extends boolean = false>(contract: PathwayContract<F, E, S> & {
|
|
248
254
|
writable?: W;
|
|
249
255
|
maxRetries?: number;
|
|
250
256
|
retryDelayMs?: number;
|
|
251
|
-
|
|
257
|
+
isFilePathway?: FP;
|
|
258
|
+
}): PathwaysBuilder<TPathway & Record<PathwayKey<F, E>, {
|
|
259
|
+
output: FP extends true ? z.infer<typeof FileEventSchema> & z.infer<S> : z.infer<S>;
|
|
260
|
+
input: FP extends true ? z.input<typeof FileInputSchema> & z.input<S> : z.input<S>;
|
|
261
|
+
}>, TWritablePaths | WritablePathway<PathwayKey<F, E>, W>>;
|
|
252
262
|
/**
|
|
253
263
|
* Gets a pathway instance by its path
|
|
254
264
|
*
|
|
@@ -256,7 +266,7 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
256
266
|
* @param path The pathway key to get
|
|
257
267
|
* @returns The pathway instance
|
|
258
268
|
*/
|
|
259
|
-
get<TPath extends keyof TPathway>(path: TPath): TPathway[TPath];
|
|
269
|
+
get<TPath extends keyof TPathway>(path: TPath): TPathway[TPath]["output"];
|
|
260
270
|
/**
|
|
261
271
|
* Sets a handler function for a pathway
|
|
262
272
|
*
|
|
@@ -268,26 +278,20 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
268
278
|
* @param handler The function that will process events for this pathway
|
|
269
279
|
* @throws Error if the pathway doesn't exist or already has a handler
|
|
270
280
|
*/
|
|
271
|
-
handle<TPath extends keyof TPathway>(path: TPath, handler: (event:
|
|
272
|
-
payload: TPathway[TPath];
|
|
273
|
-
}) => Promise<void> | void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
281
|
+
handle<TPath extends keyof TPathway>(path: TPath, handler: (event: FlowcoreEvent<TPathway[TPath]["output"]>) => Promise<void> | void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
274
282
|
/**
|
|
275
283
|
* Subscribe to pathway events (before or after processing)
|
|
276
284
|
* @param path The pathway to subscribe to
|
|
277
285
|
* @param handler The handler function for the events
|
|
278
286
|
* @param type The event type to subscribe to (before, after, or all)
|
|
279
287
|
*/
|
|
280
|
-
subscribe<TPath extends keyof TPathway>(path: TPath, handler: (event:
|
|
281
|
-
payload: TPathway[TPath];
|
|
282
|
-
}) => void, type?: "before" | "after" | "all"): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
288
|
+
subscribe<TPath extends keyof TPathway>(path: TPath, handler: (event: FlowcoreEvent<TPathway[TPath]["output"]>) => void, type?: "before" | "after" | "all"): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
283
289
|
/**
|
|
284
290
|
* Subscribe to errors for a specific pathway
|
|
285
291
|
* @param path The pathway to subscribe to errors for
|
|
286
292
|
* @param handler The handler function that receives the error and event
|
|
287
293
|
*/
|
|
288
|
-
onError<TPath extends keyof TPathway>(path: TPath, handler: (error: Error, event:
|
|
289
|
-
payload: TPathway[TPath];
|
|
290
|
-
}) => void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
294
|
+
onError<TPath extends keyof TPathway>(path: TPath, handler: (error: Error, event: FlowcoreEvent<TPathway[TPath]["output"]>) => void): PathwaysBuilder<TPathway, TWritablePaths>;
|
|
291
295
|
/**
|
|
292
296
|
* Subscribe to errors for all pathways
|
|
293
297
|
* @param handler The handler function that receives the error, event, and pathway name
|
|
@@ -301,8 +305,12 @@ export declare class PathwaysBuilder<TPathway extends Record<string, unknown> =
|
|
|
301
305
|
* @param options Optional write options
|
|
302
306
|
* @returns A promise that resolves to the event ID(s)
|
|
303
307
|
*/
|
|
304
|
-
write<TPath extends TWritablePaths>(path: TPath,
|
|
305
|
-
|
|
308
|
+
write<TPath extends TWritablePaths, B extends boolean = false>(path: TPath, input: {
|
|
309
|
+
batch?: B;
|
|
310
|
+
data: B extends true ? TPathway[TPath]["input"][] : TPathway[TPath]["input"];
|
|
311
|
+
metadata?: EventMetadata;
|
|
312
|
+
options?: PathwayWriteOptions;
|
|
313
|
+
}): Promise<string | string[]>;
|
|
306
314
|
/**
|
|
307
315
|
* Waits for a specific event to be processed
|
|
308
316
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/pathways/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/pathways/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC1C,OAAO,KAAK,EAEV,kBAAkB,EACnB,MAAM,gCAAgC,CAAA;AAIvC,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;AASnB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAuB7D;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEzC;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;AAEvE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,KAAK,CAAA;CAC3B,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,O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