@flowcore/data-pump 0.21.0 → 0.21.1
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 +7 -0
- package/esm/data-pump/notifier.d.ts +12 -0
- package/esm/data-pump/notifier.d.ts.map +1 -1
- package/esm/data-pump/notifier.js +23 -12
- package/package.json +1 -1
- package/script/data-pump/notifier.d.ts +12 -0
- package/script/data-pump/notifier.d.ts.map +1 -1
- package/script/data-pump/notifier.js +24 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.21.1](https://github.com/flowcore-io/data-pump/compare/v0.21.0...v0.21.1) (2026-05-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **notifier:** resolve waitWebSocket promise on WS error to prevent pull-loop wedge ([#72](https://github.com/flowcore-io/data-pump/issues/72)) ([d76ee0f](https://github.com/flowcore-io/data-pump/commit/d76ee0f0b5431f6a250a46948ad0c39693135c9c))
|
|
9
|
+
|
|
3
10
|
## [0.21.0](https://github.com/flowcore-io/data-pump/compare/v0.20.0...v0.21.0) (2026-04-24)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NotificationClient } from "../deps/jsr.io/@flowcore/sdk/1.79.0/src/mod.js";
|
|
1
2
|
import { NatsConnectionManager } from "./nats-connection.js";
|
|
2
3
|
import type { FlowcoreDataPumpAuth, FlowcoreDataPumpDataSource, FlowcoreLogger } from "./types.js";
|
|
3
4
|
export interface FlowcoreNotifierOptions {
|
|
@@ -27,4 +28,15 @@ export declare class FlowcoreNotifier {
|
|
|
27
28
|
private waitWebSocket;
|
|
28
29
|
private webSocketAuth;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Test seam for stubbing the NotificationClient constructor. Production code
|
|
33
|
+
* routes through `_internals.createNotificationClient`; tests replace this
|
|
34
|
+
* property with a fake factory to drive the subject manually. Not part of the
|
|
35
|
+
* public API.
|
|
36
|
+
*/
|
|
37
|
+
type NotificationClientFactory = (...args: any[]) => NotificationClient;
|
|
38
|
+
export declare const _internals: {
|
|
39
|
+
createNotificationClient: NotificationClientFactory;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
30
42
|
//# sourceMappingURL=notifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["../../src/data-pump/notifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["../../src/data-pump/notifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA0B,MAAM,gDAAgD,CAAA;AAG3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKlG,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,0BAA0B,CAAA;IACtC,IAAI,EAAE,oBAAoB,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,qBAAa,gBAAgB;IASf,OAAO,CAAC,QAAQ,CAAC,OAAO;IARpC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,WAAW,CAAC,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAC,CAA4B;IAC5C,OAAO,CAAC,kBAAkB,CAAC,CAAoB;IAC/C,OAAO,CAAC,aAAa,CAAC,CAAY;IAElC,OAAO,CAAC,KAAK,CAAC,CAAK;gBAEU,OAAO,EAAE,uBAAuB;IAetD,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW;YASlB,UAAU;YAUV,QAAQ;IAoCtB,OAAO,CAAC,gBAAgB;YAMV,aAAa;IA2C3B,OAAO,CAAC,aAAa;CAiBtB;AAED;;;;;GAKG;AAEH,KAAK,yBAAyB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,kBAAkB,CAAA;AACvE,eAAO,MAAM,UAAU,EAAE;IAAE,wBAAwB,EAAE,yBAAyB,CAAA;CAG7E,CAAA"}
|
|
@@ -113,12 +113,18 @@ export class FlowcoreNotifier {
|
|
|
113
113
|
}
|
|
114
114
|
async waitWebSocket(signal) {
|
|
115
115
|
this.options.logger?.debug("Waiting for web socket");
|
|
116
|
+
const promise = new Promise((resolve) => {
|
|
117
|
+
this.eventResolver = resolve;
|
|
118
|
+
});
|
|
116
119
|
this.subject = new Subject();
|
|
117
120
|
this.subject.subscribe({
|
|
118
121
|
next: this.onWebSocketEvent.bind(this),
|
|
119
|
-
error: (error) =>
|
|
122
|
+
error: (error) => {
|
|
123
|
+
this.options.logger?.error("Notification stream error:", { error });
|
|
124
|
+
this.eventResolver?.();
|
|
125
|
+
},
|
|
120
126
|
});
|
|
121
|
-
this.notificationClient =
|
|
127
|
+
this.notificationClient = _internals.createNotificationClient(this.subject, this.webSocketAuth(), {
|
|
122
128
|
tenant: this.dataSource.tenant,
|
|
123
129
|
dataCore: this.dataSource.dataCore,
|
|
124
130
|
flowType: this.dataSource.flowType,
|
|
@@ -126,16 +132,18 @@ export class FlowcoreNotifier {
|
|
|
126
132
|
logger: this.options.logger ?? noOpLogger,
|
|
127
133
|
reconnectInterval: 1000,
|
|
128
134
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
try {
|
|
136
|
+
await this.notificationClient.connect();
|
|
137
|
+
clearTimeout(this.timer);
|
|
138
|
+
this.timer = setTimeout(() => this.eventResolver?.(), this.options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
139
|
+
signal?.addEventListener("abort", () => this.eventResolver?.());
|
|
140
|
+
await promise;
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
clearTimeout(this.timer);
|
|
144
|
+
this.eventResolver = undefined;
|
|
145
|
+
this.notificationClient.disconnect();
|
|
146
|
+
}
|
|
139
147
|
}
|
|
140
148
|
webSocketAuth() {
|
|
141
149
|
if ("apiKey" in this.options.auth) {
|
|
@@ -155,3 +163,6 @@ export class FlowcoreNotifier {
|
|
|
155
163
|
};
|
|
156
164
|
}
|
|
157
165
|
}
|
|
166
|
+
export const _internals = {
|
|
167
|
+
createNotificationClient: (...args) => new NotificationClient(...args),
|
|
168
|
+
};
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NotificationClient } from "../deps/jsr.io/@flowcore/sdk/1.79.0/src/mod.js";
|
|
1
2
|
import { NatsConnectionManager } from "./nats-connection.js";
|
|
2
3
|
import type { FlowcoreDataPumpAuth, FlowcoreDataPumpDataSource, FlowcoreLogger } from "./types.js";
|
|
3
4
|
export interface FlowcoreNotifierOptions {
|
|
@@ -27,4 +28,15 @@ export declare class FlowcoreNotifier {
|
|
|
27
28
|
private waitWebSocket;
|
|
28
29
|
private webSocketAuth;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Test seam for stubbing the NotificationClient constructor. Production code
|
|
33
|
+
* routes through `_internals.createNotificationClient`; tests replace this
|
|
34
|
+
* property with a fake factory to drive the subject manually. Not part of the
|
|
35
|
+
* public API.
|
|
36
|
+
*/
|
|
37
|
+
type NotificationClientFactory = (...args: any[]) => NotificationClient;
|
|
38
|
+
export declare const _internals: {
|
|
39
|
+
createNotificationClient: NotificationClientFactory;
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
30
42
|
//# sourceMappingURL=notifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["../../src/data-pump/notifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["../../src/data-pump/notifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA0B,MAAM,gDAAgD,CAAA;AAG3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAKlG,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,0BAA0B,CAAA;IACtC,IAAI,EAAE,oBAAoB,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,qBAAa,gBAAgB;IASf,OAAO,CAAC,QAAQ,CAAC,OAAO;IARpC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,WAAW,CAAC,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAC,CAA4B;IAC5C,OAAO,CAAC,kBAAkB,CAAC,CAAoB;IAC/C,OAAO,CAAC,aAAa,CAAC,CAAY;IAElC,OAAO,CAAC,KAAK,CAAC,CAAK;gBAEU,OAAO,EAAE,uBAAuB;IAetD,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW;YASlB,UAAU;YAUV,QAAQ;IAoCtB,OAAO,CAAC,gBAAgB;YAMV,aAAa;IA2C3B,OAAO,CAAC,aAAa;CAiBtB;AAED;;;;;GAKG;AAEH,KAAK,yBAAyB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,kBAAkB,CAAA;AACvE,eAAO,MAAM,UAAU,EAAE;IAAE,wBAAwB,EAAE,yBAAyB,CAAA;CAG7E,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowcoreNotifier = void 0;
|
|
3
|
+
exports._internals = exports.FlowcoreNotifier = void 0;
|
|
4
4
|
const mod_js_1 = require("../deps/jsr.io/@flowcore/sdk/1.79.0/src/mod.js");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
6
|
const data_source_js_1 = require("./data-source.js");
|
|
@@ -116,12 +116,18 @@ class FlowcoreNotifier {
|
|
|
116
116
|
}
|
|
117
117
|
async waitWebSocket(signal) {
|
|
118
118
|
this.options.logger?.debug("Waiting for web socket");
|
|
119
|
+
const promise = new Promise((resolve) => {
|
|
120
|
+
this.eventResolver = resolve;
|
|
121
|
+
});
|
|
119
122
|
this.subject = new rxjs_1.Subject();
|
|
120
123
|
this.subject.subscribe({
|
|
121
124
|
next: this.onWebSocketEvent.bind(this),
|
|
122
|
-
error: (error) =>
|
|
125
|
+
error: (error) => {
|
|
126
|
+
this.options.logger?.error("Notification stream error:", { error });
|
|
127
|
+
this.eventResolver?.();
|
|
128
|
+
},
|
|
123
129
|
});
|
|
124
|
-
this.notificationClient =
|
|
130
|
+
this.notificationClient = exports._internals.createNotificationClient(this.subject, this.webSocketAuth(), {
|
|
125
131
|
tenant: this.dataSource.tenant,
|
|
126
132
|
dataCore: this.dataSource.dataCore,
|
|
127
133
|
flowType: this.dataSource.flowType,
|
|
@@ -129,16 +135,18 @@ class FlowcoreNotifier {
|
|
|
129
135
|
logger: this.options.logger ?? no_op_logger_js_1.noOpLogger,
|
|
130
136
|
reconnectInterval: 1000,
|
|
131
137
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
try {
|
|
139
|
+
await this.notificationClient.connect();
|
|
140
|
+
clearTimeout(this.timer);
|
|
141
|
+
this.timer = setTimeout(() => this.eventResolver?.(), this.options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
142
|
+
signal?.addEventListener("abort", () => this.eventResolver?.());
|
|
143
|
+
await promise;
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
clearTimeout(this.timer);
|
|
147
|
+
this.eventResolver = undefined;
|
|
148
|
+
this.notificationClient.disconnect();
|
|
149
|
+
}
|
|
142
150
|
}
|
|
143
151
|
webSocketAuth() {
|
|
144
152
|
if ("apiKey" in this.options.auth) {
|
|
@@ -159,3 +167,6 @@ class FlowcoreNotifier {
|
|
|
159
167
|
}
|
|
160
168
|
}
|
|
161
169
|
exports.FlowcoreNotifier = FlowcoreNotifier;
|
|
170
|
+
exports._internals = {
|
|
171
|
+
createNotificationClient: (...args) => new mod_js_1.NotificationClient(...args),
|
|
172
|
+
};
|