@kapeta/local-cluster-service 0.70.1 → 0.70.2
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/dist/cjs/src/storm/PageGenerator.d.ts +1 -0
- package/dist/cjs/src/storm/PageGenerator.js +7 -2
- package/dist/cjs/src/storm/PromiseQueue.d.ts +2 -0
- package/dist/cjs/src/storm/PromiseQueue.js +8 -1
- package/dist/cjs/src/storm/routes.js +3 -1
- package/dist/esm/src/storm/PageGenerator.d.ts +1 -0
- package/dist/esm/src/storm/PageGenerator.js +7 -2
- package/dist/esm/src/storm/PromiseQueue.d.ts +2 -0
- package/dist/esm/src/storm/PromiseQueue.js +8 -1
- package/dist/esm/src/storm/routes.js +3 -1
- package/package.json +1 -1
- package/src/storm/PageGenerator.ts +8 -2
- package/src/storm/PromiseQueue.ts +10 -1
- package/src/storm/routes.ts +3 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.70.2](https://github.com/kapetacom/local-cluster-service/compare/v0.70.1...v0.70.2) (2024-09-09)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Wait for last ([#237](https://github.com/kapetacom/local-cluster-service/issues/237)) ([071bf9e](https://github.com/kapetacom/local-cluster-service/commit/071bf9ea19cb5d5393d7f895c2131311b38325b6))
|
7
|
+
|
1
8
|
## [0.70.1](https://github.com/kapetacom/local-cluster-service/compare/v0.70.0...v0.70.1) (2024-09-09)
|
2
9
|
|
3
10
|
|
@@ -186,8 +186,13 @@ class PageQueue extends node_events_1.EventEmitter {
|
|
186
186
|
this.eventQueue.cancel();
|
187
187
|
}
|
188
188
|
async wait() {
|
189
|
-
|
190
|
-
|
189
|
+
while (!this.eventQueue.empty || !this.queue.empty) {
|
190
|
+
await this.eventQueue.wait();
|
191
|
+
await this.queue.wait();
|
192
|
+
}
|
193
|
+
}
|
194
|
+
get length() {
|
195
|
+
return this.queue.length + this.eventQueue.length;
|
191
196
|
}
|
192
197
|
async addImagePrompt(prompt) {
|
193
198
|
if (this.images.has(prompt.url)) {
|
@@ -83,8 +83,15 @@ class PromiseQueue {
|
|
83
83
|
}
|
84
84
|
async wait() {
|
85
85
|
while (this.queue.length > 0 || this.active.length > 0) {
|
86
|
-
await Promise.
|
86
|
+
await Promise.allSettled(this.active);
|
87
|
+
this.next();
|
87
88
|
}
|
88
89
|
}
|
90
|
+
get empty() {
|
91
|
+
return this.queue.length === 0 && this.active.length === 0;
|
92
|
+
}
|
93
|
+
get length() {
|
94
|
+
return this.queue.length + this.active.length;
|
95
|
+
}
|
89
96
|
}
|
90
97
|
exports.PromiseQueue = PromiseQueue;
|
@@ -420,7 +420,9 @@ router.post('/ui/edit', async (req, res) => {
|
|
420
420
|
const promises = [];
|
421
421
|
queue.on('page', (data) => {
|
422
422
|
if (systemId) {
|
423
|
-
|
423
|
+
const promise = sendPageEvent(systemId, data, res);
|
424
|
+
promises.push(promise);
|
425
|
+
return promise;
|
424
426
|
}
|
425
427
|
});
|
426
428
|
queue.on('event', (data) => {
|
@@ -186,8 +186,13 @@ class PageQueue extends node_events_1.EventEmitter {
|
|
186
186
|
this.eventQueue.cancel();
|
187
187
|
}
|
188
188
|
async wait() {
|
189
|
-
|
190
|
-
|
189
|
+
while (!this.eventQueue.empty || !this.queue.empty) {
|
190
|
+
await this.eventQueue.wait();
|
191
|
+
await this.queue.wait();
|
192
|
+
}
|
193
|
+
}
|
194
|
+
get length() {
|
195
|
+
return this.queue.length + this.eventQueue.length;
|
191
196
|
}
|
192
197
|
async addImagePrompt(prompt) {
|
193
198
|
if (this.images.has(prompt.url)) {
|
@@ -83,8 +83,15 @@ class PromiseQueue {
|
|
83
83
|
}
|
84
84
|
async wait() {
|
85
85
|
while (this.queue.length > 0 || this.active.length > 0) {
|
86
|
-
await Promise.
|
86
|
+
await Promise.allSettled(this.active);
|
87
|
+
this.next();
|
87
88
|
}
|
88
89
|
}
|
90
|
+
get empty() {
|
91
|
+
return this.queue.length === 0 && this.active.length === 0;
|
92
|
+
}
|
93
|
+
get length() {
|
94
|
+
return this.queue.length + this.active.length;
|
95
|
+
}
|
89
96
|
}
|
90
97
|
exports.PromiseQueue = PromiseQueue;
|
@@ -420,7 +420,9 @@ router.post('/ui/edit', async (req, res) => {
|
|
420
420
|
const promises = [];
|
421
421
|
queue.on('page', (data) => {
|
422
422
|
if (systemId) {
|
423
|
-
|
423
|
+
const promise = sendPageEvent(systemId, data, res);
|
424
|
+
promises.push(promise);
|
425
|
+
return promise;
|
424
426
|
}
|
425
427
|
});
|
426
428
|
queue.on('event', (data) => {
|
package/package.json
CHANGED
@@ -227,8 +227,14 @@ export class PageQueue extends EventEmitter {
|
|
227
227
|
}
|
228
228
|
|
229
229
|
public async wait() {
|
230
|
-
|
231
|
-
|
230
|
+
while (!this.eventQueue.empty || !this.queue.empty) {
|
231
|
+
await this.eventQueue.wait();
|
232
|
+
await this.queue.wait();
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
236
|
+
public get length() {
|
237
|
+
return this.queue.length + this.eventQueue.length;
|
232
238
|
}
|
233
239
|
|
234
240
|
private async addImagePrompt(prompt: ImagePrompt) {
|
@@ -114,7 +114,16 @@ export class PromiseQueue {
|
|
114
114
|
|
115
115
|
public async wait() {
|
116
116
|
while (this.queue.length > 0 || this.active.length > 0) {
|
117
|
-
await Promise.
|
117
|
+
await Promise.allSettled(this.active);
|
118
|
+
this.next();
|
118
119
|
}
|
119
120
|
}
|
121
|
+
|
122
|
+
public get empty() {
|
123
|
+
return this.queue.length === 0 && this.active.length === 0;
|
124
|
+
}
|
125
|
+
|
126
|
+
public get length() {
|
127
|
+
return this.queue.length + this.active.length;
|
128
|
+
}
|
120
129
|
}
|
package/src/storm/routes.ts
CHANGED
@@ -519,7 +519,9 @@ router.post('/ui/edit', async (req: KapetaBodyRequest, res: Response) => {
|
|
519
519
|
|
520
520
|
queue.on('page', (data) => {
|
521
521
|
if (systemId) {
|
522
|
-
|
522
|
+
const promise = sendPageEvent(systemId, data, res);
|
523
|
+
promises.push(promise);
|
524
|
+
return promise;
|
523
525
|
}
|
524
526
|
});
|
525
527
|
|