@flowcore/pathways 0.11.0 → 0.13.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +102 -58
  2. package/README.md +133 -126
  3. package/esm/common/index.d.ts.map +1 -1
  4. package/esm/contracts/index.d.ts.map +1 -1
  5. package/esm/mod.d.ts.map +1 -1
  6. package/esm/pathways/builder.d.ts +66 -5
  7. package/esm/pathways/builder.d.ts.map +1 -1
  8. package/esm/pathways/builder.js +67 -8
  9. package/esm/pathways/index.d.ts.map +1 -1
  10. package/esm/pathways/internal-pathway.state.d.ts.map +1 -1
  11. package/esm/pathways/kv/bun-kv-adapter.d.ts.map +1 -1
  12. package/esm/pathways/kv/kv-adapter.d.ts +2 -2
  13. package/esm/pathways/kv/kv-adapter.d.ts.map +1 -1
  14. package/esm/pathways/kv/node-kv-adapter.d.ts.map +1 -1
  15. package/esm/pathways/kv/node-kv-adapter.js +1 -1
  16. package/esm/pathways/logger.js +7 -7
  17. package/esm/pathways/postgres/index.d.ts.map +1 -1
  18. package/esm/pathways/postgres/postgres-adapter.d.ts.map +1 -1
  19. package/esm/pathways/postgres/postgres-adapter.js +3 -2
  20. package/esm/pathways/session-pathway.d.ts.map +1 -1
  21. package/esm/pathways/session-pathway.js +3 -3
  22. package/esm/router/index.d.ts.map +1 -1
  23. package/esm/router/index.js +4 -4
  24. package/package.json +1 -1
  25. package/script/common/index.d.ts.map +1 -1
  26. package/script/contracts/index.d.ts.map +1 -1
  27. package/script/mod.d.ts.map +1 -1
  28. package/script/pathways/builder.d.ts +66 -5
  29. package/script/pathways/builder.d.ts.map +1 -1
  30. package/script/pathways/builder.js +69 -9
  31. package/script/pathways/index.d.ts.map +1 -1
  32. package/script/pathways/internal-pathway.state.d.ts.map +1 -1
  33. package/script/pathways/kv/bun-kv-adapter.d.ts.map +1 -1
  34. package/script/pathways/kv/kv-adapter.d.ts +2 -2
  35. package/script/pathways/kv/kv-adapter.d.ts.map +1 -1
  36. package/script/pathways/kv/node-kv-adapter.d.ts.map +1 -1
  37. package/script/pathways/kv/node-kv-adapter.js +1 -1
  38. package/script/pathways/logger.js +7 -7
  39. package/script/pathways/postgres/index.d.ts.map +1 -1
  40. package/script/pathways/postgres/postgres-adapter.d.ts.map +1 -1
  41. package/script/pathways/postgres/postgres-adapter.js +3 -2
  42. package/script/pathways/session-pathway.d.ts.map +1 -1
  43. package/script/pathways/session-pathway.js +3 -3
  44. package/script/router/index.d.ts.map +1 -1
  45. package/script/router/index.js +4 -4
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PathwaysBuilder = void 0;
3
+ exports.PathwaysBuilder = exports.SessionUser = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  const value_1 = require("@sinclair/typebox/value");
6
6
  const rxjs_1 = require("rxjs");
@@ -23,6 +23,61 @@ const DEFAULT_RETRY_DELAY_MS = 500;
23
23
  * Default TTL for session-specific user resolvers in milliseconds (10seconds)
24
24
  */
25
25
  const DEFAULT_SESSION_USER_RESOLVER_TTL_MS = 10 * 1000;
26
+ /**
27
+ * SessionUserResolver implementation that uses a Map to store UserIdResolver functions
28
+ * with a TTL (time to live).
29
+ */
30
+ class SessionUser {
31
+ /**
32
+ * Creates a new SessionUser instance
33
+ */
34
+ constructor() {
35
+ /**
36
+ * The underlying Map that stores UserIdResolver functions and their timeouts
37
+ * Using unknown for timeout to support both Node.js and Deno timer types
38
+ */
39
+ Object.defineProperty(this, "store", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+ this.store = new Map();
46
+ }
47
+ /**
48
+ * Retrieves a UserIdResolver from the session user resolver store
49
+ * @param key The key to retrieve the UserIdResolver for
50
+ * @returns The UserIdResolver or undefined if it doesn't exist
51
+ */
52
+ get(key) {
53
+ const entry = this.store.get(key);
54
+ if (!entry) {
55
+ return undefined;
56
+ }
57
+ return entry.value;
58
+ }
59
+ /**
60
+ * Stores a UserIdResolver in the session user resolver store
61
+ * @param key The key to store the UserIdResolver under
62
+ * @param value The UserIdResolver to store
63
+ * @param ttlMs The time to live for the UserIdResolver in milliseconds
64
+ * @default 5 minutes
65
+ */
66
+ set(key, value, ttlMs = 1000 * 60 * 5) {
67
+ // Clear any existing timeout for this key
68
+ const existingEntry = this.store.get(key);
69
+ if (existingEntry) {
70
+ clearTimeout(existingEntry.timeout);
71
+ }
72
+ // Set up new timeout
73
+ const timeout = setTimeout(() => {
74
+ this.store.delete(key);
75
+ }, ttlMs);
76
+ // Store the new value and its timeout
77
+ this.store.set(key, { value, timeout });
78
+ }
79
+ }
80
+ exports.SessionUser = SessionUser;
26
81
  /**
27
82
  * Main builder class for creating and managing Flowcore pathways
28
83
  *
@@ -47,9 +102,10 @@ class PathwaysBuilder {
47
102
  * @param options.apiKey The API key for authentication
48
103
  * @param options.pathwayTimeoutMs Optional timeout for pathway processing in milliseconds
49
104
  * @param options.logger Optional logger instance
50
- * @param options.sessionUserResolvers Optional KvAdapter instance for session-specific user resolvers
105
+ * @param options.enableSessionUserResolvers Whether to enable session user resolvers
106
+ * @param options.overrideSessionUserResolvers Optional SessionUserResolver instance to override the default
51
107
  */
52
- constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, sessionUserResolvers, }) {
108
+ constructor({ baseUrl, tenant, dataCore, apiKey, pathwayTimeoutMs, logger, enableSessionUserResolvers, overrideSessionUserResolvers, }) {
53
109
  Object.defineProperty(this, "pathways", {
54
110
  enumerable: true,
55
111
  configurable: true,
@@ -211,8 +267,8 @@ class PathwaysBuilder {
211
267
  this.tenant = tenant;
212
268
  this.dataCore = dataCore;
213
269
  this.apiKey = apiKey;
214
- if (sessionUserResolvers) {
215
- this.sessionUserResolvers = sessionUserResolvers;
270
+ if (enableSessionUserResolvers) {
271
+ this.sessionUserResolvers = overrideSessionUserResolvers ?? new SessionUser();
216
272
  }
217
273
  this.logger.debug("Initializing PathwaysBuilder", {
218
274
  baseUrl,
@@ -683,12 +739,14 @@ class PathwaysBuilder {
683
739
  // Add appropriate audit metadata based on mode
684
740
  if (auditMode === "system") {
685
741
  finalMetadata["audit/user-id"] = "system";
686
- finalMetadata["audit/on-behalf-of"] = userId;
742
+ finalMetadata["audit/on-behalf-of"] = userId.entityId;
687
743
  finalMetadata["audit/mode"] = "system";
744
+ finalMetadata["audit/entity-type"] = userId.entityType;
688
745
  }
689
746
  else {
690
- finalMetadata["audit/user-id"] = userId;
747
+ finalMetadata["audit/user-id"] = userId.entityId;
691
748
  finalMetadata["audit/mode"] = "user"; // Always set mode for user
749
+ finalMetadata["audit/entity-type"] = userId.entityType;
692
750
  }
693
751
  }
694
752
  let eventIds = [];
@@ -788,12 +846,14 @@ class PathwaysBuilder {
788
846
  // Add appropriate audit metadata based on mode
789
847
  if (auditMode === "system") {
790
848
  finalMetadata["audit/user-id"] = "system";
791
- finalMetadata["audit/on-behalf-of"] = userId;
849
+ finalMetadata["audit/on-behalf-of"] = userId.entityId;
792
850
  finalMetadata["audit/mode"] = "system";
851
+ finalMetadata["audit/entity-type"] = userId.entityType;
793
852
  }
794
853
  else {
795
- finalMetadata["audit/user-id"] = userId;
854
+ finalMetadata["audit/user-id"] = userId.entityId;
796
855
  finalMetadata["audit/mode"] = "user"; // Always set mode for user
856
+ finalMetadata["audit/entity-type"] = userId.entityType;
797
857
  }
798
858
  }
799
859
  let eventIds = [];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pathways/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pathways/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,cAAc,CAAA;AAC5B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"internal-pathway.state.d.ts","sourceRoot":"","sources":["../../src/pathways/internal-pathway.state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAEvD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAA0B;IAEpC;;;;;OAKG;YACW,KAAK;IAOnB;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMpD;;;;;OAKG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAInD"}
1
+ {"version":3,"file":"internal-pathway.state.d.ts","sourceRoot":"","sources":["../../src/pathways/internal-pathway.state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAEtD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAyB;IAEnC;;;;;OAKG;YACW,KAAK;IAOnB;;;;;OAKG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMpD;;;;;OAKG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAInD"}
@@ -1 +1 @@
1
- {"version":3,"file":"bun-kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/bun-kv-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,YAAa,YAAW,SAAS;IAC5C;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAoB;IAEjC;;OAEG;;IAKH;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAK7B;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAGtD"}
1
+ {"version":3,"file":"bun-kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/bun-kv-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;;GAIG;AACH,qBAAa,YAAa,YAAW,SAAS;IAC5C;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAmB;IAEhC;;OAEG;;IAKH;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAK7B;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAGtD"}
@@ -39,7 +39,7 @@ export interface KvAdapter {
39
39
  * @param key The key to retrieve
40
40
  * @returns The stored value or null if not found
41
41
  */
42
- get<T>(key: string): (Promise<T | null> | T | null);
42
+ get<T>(key: string): Promise<T | null> | T | null;
43
43
  /**
44
44
  * Stores a value in storage with the specified key and TTL
45
45
  *
@@ -48,7 +48,7 @@ export interface KvAdapter {
48
48
  * @param ttlMs Time-to-live in milliseconds
49
49
  * @returns Promise or void when the operation completes
50
50
  */
51
- set(key: string, value: unknown, ttlMs: number): (Promise<void> | void);
51
+ set(key: string, value: unknown, ttlMs: number): Promise<void> | void;
52
52
  }
53
53
  /**
54
54
  * Creates an appropriate KV adapter based on the runtime environment
@@ -1 +1 @@
1
- {"version":3,"file":"kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/kv-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAEpD;;;;;;;OAOG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;CACzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAU1D"}
1
+ {"version":3,"file":"kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/kv-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IAEjD;;;;;;;OAOG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CACtE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAU1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"node-kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/node-kv-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,aAAc,YAAW,SAAS;IAC7C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAmB;IAEtC;;;;;;OAMG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAK5C;;;;;;;OAOG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
1
+ {"version":3,"file":"node-kv-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/kv/node-kv-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;;GAIG;AACH,qBAAa,aAAc,YAAW,SAAS;IAC7C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAkB;IAErC;;;;;;OAMG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAK5C;;;;;;;OAOG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGrE"}
@@ -43,7 +43,7 @@ class NodeKvAdapter {
43
43
  * @returns Promise that resolves when the operation completes
44
44
  */
45
45
  async set(key, value, ttlMs) {
46
- await this.kv.set(key, value, (ttlMs / 1000));
46
+ await this.kv.set(key, value, ttlMs / 1000);
47
47
  }
48
48
  }
49
49
  exports.NodeKvAdapter = NodeKvAdapter;
@@ -14,7 +14,7 @@ class ConsoleLogger {
14
14
  * @param context Optional context data to include
15
15
  */
16
16
  debug(message, context) {
17
- console.debug(message, context ? JSON.stringify(context) : '');
17
+ console.debug(message, context ? JSON.stringify(context) : "");
18
18
  }
19
19
  /**
20
20
  * Log informational messages to the console
@@ -22,7 +22,7 @@ class ConsoleLogger {
22
22
  * @param context Optional context data to include
23
23
  */
24
24
  info(message, context) {
25
- console.info(message, context ? JSON.stringify(context) : '');
25
+ console.info(message, context ? JSON.stringify(context) : "");
26
26
  }
27
27
  /**
28
28
  * Log warning messages to the console
@@ -30,7 +30,7 @@ class ConsoleLogger {
30
30
  * @param context Optional context data to include
31
31
  */
32
32
  warn(message, context) {
33
- console.warn(message, context ? JSON.stringify(context) : '');
33
+ console.warn(message, context ? JSON.stringify(context) : "");
34
34
  }
35
35
  /**
36
36
  * Log error messages to the console
@@ -43,19 +43,19 @@ class ConsoleLogger {
43
43
  * @param context Optional context data (only for signature 1)
44
44
  */
45
45
  error(messageOrError, errorOrContext, context) {
46
- if (typeof messageOrError === 'string') {
46
+ if (typeof messageOrError === "string") {
47
47
  if (errorOrContext instanceof Error) {
48
48
  // Signature 1: error(message: string, error: Error, context?: LoggerMeta)
49
- console.error(messageOrError, errorOrContext, context ? JSON.stringify(context) : '');
49
+ console.error(messageOrError, errorOrContext, context ? JSON.stringify(context) : "");
50
50
  }
51
51
  else {
52
52
  // Signature 1 (no error) or Signature 2: error(message: string, context?: LoggerMeta)
53
- console.error(messageOrError, errorOrContext ? JSON.stringify(errorOrContext) : '');
53
+ console.error(messageOrError, errorOrContext ? JSON.stringify(errorOrContext) : "");
54
54
  }
55
55
  }
56
56
  else {
57
57
  // Signature 2: error(error: Error, context?: LoggerMeta)
58
- console.error(messageOrError, errorOrContext ? JSON.stringify(errorOrContext) : '');
58
+ console.error(messageOrError, errorOrContext ? JSON.stringify(errorOrContext) : "");
59
59
  }
60
60
  }
61
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-adapter.d.ts","sourceRoot":"","sources":["../../../src/pathways/postgres/postgres-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,gHAAgH;IAChH,gBAAgB,EAAE,MAAM,CAAC;IAEzB,yEAAyE;IACzE,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,GAAG,CAAC,EAAE,KAAK,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,KAAK,CAAC;IAEzB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;;GA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MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACxD;AAoBD;;GAEG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IACvD,8CAA8C;IAC9C,OAAO,CAAC,QAAQ,CAA8D;IAC9E,oCAAoC;IACpC,OAAO,CAAC,GAAG,CAA8B;IACzC,mCAAmC;IACnC,OAAO,CAAC,MAAM,CAAgB;IAC9B,yDAAyD;IACzD,OAAO,CAAC,gBAAgB,CAAQ;IAEhC;;;;OAIG;gBACS,MAAM,EAAE,cAAc;IAgBlC;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAW9B;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOjC;;;;;;OAMG;IACG,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAO/D;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAMlE;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAI5F"}
@@ -64,13 +64,14 @@ class PostgresJsAdapter {
64
64
  value: void 0
65
65
  });
66
66
  this.config = config;
67
- if ('connectionString' in config && config.connectionString) {
67
+ if ("connectionString" in config && config.connectionString) {
68
68
  // Use the provided connection string directly
69
69
  this.connectionString = config.connectionString;
70
70
  }
71
71
  else {
72
72
  // Build connection string from individual parameters
73
- this.connectionString = `postgres://${config.user}:${config.password}@${config.host}:${config.port}/${config.database}`;
73
+ this.connectionString =
74
+ `postgres://${config.user}:${config.password}@${config.host}:${config.port}/${config.database}`;
74
75
  if (config.ssl) {
75
76
  this.connectionString += "?sslmode=require";
76
77
  }
@@ -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,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAqBrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,qBAAqB,CAEhC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,EAC7C,cAAc,SAAS,MAAM,QAAQ,GAAG,KAAK;IAE7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA4C;IAC5E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC;;;;;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,EACrB,QAAQ,CAAC,EAAE,aAAa,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;CAU9B"}
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,EAC7C,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,EACrB,QAAQ,CAAC,EAAE,aAAa,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;CAU9B"}
@@ -7,14 +7,14 @@ exports.SessionPathwayBuilder = void 0;
7
7
  */
8
8
  function generateUUID() {
9
9
  // Check for Deno or browser crypto.randomUUID support
10
- if (typeof crypto !== 'undefined' && crypto.randomUUID) {
10
+ if (typeof crypto !== "undefined" && crypto.randomUUID) {
11
11
  return crypto.randomUUID();
12
12
  }
13
13
  // Fallback to manual UUID generation (compatible with all platforms)
14
14
  // Implementation based on RFC4122 version 4
15
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
15
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
16
16
  const r = Math.random() * 16 | 0;
17
- const v = c === 'x' ? r : (r & 0x3 | 0x8);
17
+ const v = c === "x" ? r : (r & 0x3 | 0x8);
18
18
  return v.toString(16);
19
19
  });
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAErE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBAAa,aAAa;IAatB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAb5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC;;;;;;;OAOG;gBAGgB,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAC9C,SAAS,EAAE,MAAM,EAClC,MAAM,CAAC,EAAE,MAAM;IAajB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,YAAY,CAAC,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAkDvH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAErE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBAAa,aAAa;IAatB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAb5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAE/B;;;;;;;OAOG;gBAGgB,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAC9C,SAAS,EAAE,MAAM,EAClC,MAAM,CAAC,EAAE,MAAM;IAajB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,YAAY,CAChB,KAAK,EAAE,mBAAmB,EAC1B,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAkDlD"}
@@ -145,7 +145,7 @@ class PathwayRouter {
145
145
  };
146
146
  const pathwayKey = `${compatibleEvent.flowType}/${compatibleEvent.eventType}`;
147
147
  this.logger.debug(`Processing event for pathway: ${pathwayKey}`, {
148
- eventId: compatibleEvent.eventId
148
+ eventId: compatibleEvent.eventId,
149
149
  });
150
150
  const pathway = this.pathways.get(pathwayKey);
151
151
  if (!pathway) {
@@ -156,19 +156,19 @@ class PathwayRouter {
156
156
  try {
157
157
  this.logger.debug(`Delegating event processing to pathway handler`, {
158
158
  pathwayKey,
159
- eventId: compatibleEvent.eventId
159
+ eventId: compatibleEvent.eventId,
160
160
  });
161
161
  await this.pathways.process(pathwayKey, compatibleEvent);
162
162
  this.logger.debug(`Event successfully processed through pathway`, {
163
163
  pathwayKey,
164
- eventId: compatibleEvent.eventId
164
+ eventId: compatibleEvent.eventId,
165
165
  });
166
166
  return { success: true, message: `Event processed through pathway ${pathwayKey}` };
167
167
  }
168
168
  catch (error) {
169
169
  const errorObj = error instanceof Error ? error : new Error(String(error));
170
170
  this.logger.error(`Error processing pathway ${pathwayKey}`, errorObj, {
171
- eventId: compatibleEvent.eventId
171
+ eventId: compatibleEvent.eventId,
172
172
  });
173
173
  // Rethrow the error with additional context
174
174
  throw new Error(`Failed to process event in pathway ${pathwayKey}: ${errorObj.message}`);