@rotorsoft/act 1.32.22 → 1.32.23
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/dist/.tsbuildinfo +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts +16 -10
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/{chunk-T3CWXVGT.js → chunk-OG5O36AJ.js} +37 -87
- package/dist/chunk-OG5O36AJ.js.map +1 -0
- package/dist/index.cjs +36 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/test/index.cjs +36 -86
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-T3CWXVGT.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1142,25 +1142,19 @@ var InMemoryStore = class {
|
|
|
1142
1142
|
*/
|
|
1143
1143
|
async defer(input, deferred_at) {
|
|
1144
1144
|
await sleep();
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
s.defer(deferred_at);
|
|
1159
|
-
count++;
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
return count;
|
|
1145
|
+
const selected = this._select(input);
|
|
1146
|
+
for (const s of selected) s.defer(deferred_at);
|
|
1147
|
+
return selected.length;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* The streams named by `input`: an explicit list (de-duplicated, so a
|
|
1151
|
+
* repeated name counts once, matching the SQL adapters' set-based
|
|
1152
|
+
* `stream = ANY(...)`; unknown names are skipped) or a {@link StreamFilter}.
|
|
1153
|
+
*/
|
|
1154
|
+
_select(input) {
|
|
1155
|
+
if (Array.isArray(input))
|
|
1156
|
+
return [...new Set(input)].map((name) => this._streams.get(name)).filter((s) => s !== void 0);
|
|
1157
|
+
return [...this._streams.values()].filter(this._filter_predicate(input));
|
|
1164
1158
|
}
|
|
1165
1159
|
/**
|
|
1166
1160
|
* Build a predicate from a {@link StreamFilter}. Compiled regexes are
|
|
@@ -1196,37 +1190,10 @@ var InMemoryStore = class {
|
|
|
1196
1190
|
*/
|
|
1197
1191
|
async reset(input) {
|
|
1198
1192
|
await sleep();
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
const s = this._streams.get(name);
|
|
1203
|
-
if (s) {
|
|
1204
|
-
s.reset();
|
|
1205
|
-
count++;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
} else {
|
|
1209
|
-
const matches = this._filter_predicate(input);
|
|
1210
|
-
for (const s of this._streams.values()) {
|
|
1211
|
-
if (matches(s)) {
|
|
1212
|
-
s.reset();
|
|
1213
|
-
count++;
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
return count;
|
|
1193
|
+
const selected = this._select(input);
|
|
1194
|
+
for (const s of selected) s.reset();
|
|
1195
|
+
return selected.length;
|
|
1218
1196
|
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Clear the blocked flag (and retry / error / lease) on the matched
|
|
1221
|
-
* streams without touching the watermark. Streams that aren't blocked
|
|
1222
|
-
* at call time are silently skipped. Accepts either an explicit list
|
|
1223
|
-
* of names or a {@link StreamFilter}. The filter form always restricts
|
|
1224
|
-
* to blocked streams — passing `blocked: false` matches nothing.
|
|
1225
|
-
* See {@link Store.unblock}.
|
|
1226
|
-
*
|
|
1227
|
-
* @param input - Stream names or a filter selecting the streams to unblock.
|
|
1228
|
-
* @returns Count of streams that were actually flipped (were blocked).
|
|
1229
|
-
*/
|
|
1230
1197
|
/**
|
|
1231
1198
|
* Wipe the sensitive-data payload for every event on the stream — see
|
|
1232
1199
|
* {@link Store.forget_pii}. O(1) drop of the stream's inner Map; the size of
|
|
@@ -1242,21 +1209,23 @@ var InMemoryStore = class {
|
|
|
1242
1209
|
this._pii.delete(stream);
|
|
1243
1210
|
return count;
|
|
1244
1211
|
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Clear the blocked flag (and retry / error / lease) on the matched
|
|
1214
|
+
* streams without touching the watermark. Streams that aren't blocked
|
|
1215
|
+
* at call time are silently skipped. Accepts either an explicit list
|
|
1216
|
+
* of names or a {@link StreamFilter}. The filter form always restricts
|
|
1217
|
+
* to blocked streams — passing `blocked: false` matches nothing.
|
|
1218
|
+
* See {@link Store.unblock}.
|
|
1219
|
+
*
|
|
1220
|
+
* @param input - Stream names or a filter selecting the streams to unblock.
|
|
1221
|
+
* @returns Count of streams that were actually flipped (were blocked).
|
|
1222
|
+
*/
|
|
1245
1223
|
async unblock(input) {
|
|
1246
1224
|
await sleep();
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
if (s?.unblock()) count++;
|
|
1252
|
-
}
|
|
1253
|
-
} else {
|
|
1254
|
-
const matches = this._filter_predicate({ ...input, blocked: true });
|
|
1255
|
-
for (const s of this._streams.values()) {
|
|
1256
|
-
if (matches(s) && s.unblock()) count++;
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
return count;
|
|
1225
|
+
const selected = this._select(
|
|
1226
|
+
Array.isArray(input) ? input : { ...input, blocked: true }
|
|
1227
|
+
);
|
|
1228
|
+
return selected.filter((s) => s.unblock()).length;
|
|
1260
1229
|
}
|
|
1261
1230
|
/**
|
|
1262
1231
|
* Bulk-update priority of streams matching `filter`. Mirrors
|
|
@@ -1269,16 +1238,9 @@ var InMemoryStore = class {
|
|
|
1269
1238
|
*/
|
|
1270
1239
|
async prioritize(filter, priority) {
|
|
1271
1240
|
await sleep();
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
if (!matches(s)) continue;
|
|
1276
|
-
if (s.priority !== priority) {
|
|
1277
|
-
s.set_priority(priority);
|
|
1278
|
-
count++;
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
return count;
|
|
1241
|
+
const changed = this._select(filter).filter((s) => s.priority !== priority);
|
|
1242
|
+
for (const s of changed) s.set_priority(priority);
|
|
1243
|
+
return changed.length;
|
|
1282
1244
|
}
|
|
1283
1245
|
/**
|
|
1284
1246
|
* Streams registered subscription positions to the callback, ordered by
|
|
@@ -1289,10 +1251,8 @@ var InMemoryStore = class {
|
|
|
1289
1251
|
await sleep();
|
|
1290
1252
|
const limit = query?.limit ?? 100;
|
|
1291
1253
|
const after = query?.after;
|
|
1292
|
-
const blocked = query?.blocked;
|
|
1293
1254
|
const source_matches = query?.source_matches;
|
|
1294
|
-
const
|
|
1295
|
-
const source_re = query?.source !== void 0 && !query.source_exact ? new RegExp(query.source) : void 0;
|
|
1255
|
+
const matches = this._filter_predicate(query ?? {});
|
|
1296
1256
|
const reverse_cache = /* @__PURE__ */ new Map();
|
|
1297
1257
|
const reverse_match = (source) => {
|
|
1298
1258
|
let re = reverse_cache.get(source);
|
|
@@ -1306,20 +1266,10 @@ var InMemoryStore = class {
|
|
|
1306
1266
|
let count = 0;
|
|
1307
1267
|
for (const s of sorted) {
|
|
1308
1268
|
if (after !== void 0 && s.stream <= after) continue;
|
|
1309
|
-
if (
|
|
1310
|
-
if (query.stream_exact ? s.stream !== query.stream : !stream_re.test(s.stream))
|
|
1311
|
-
continue;
|
|
1312
|
-
}
|
|
1313
|
-
if (query?.source !== void 0) {
|
|
1314
|
-
if (s.source === void 0) continue;
|
|
1315
|
-
if (query.source_exact ? s.source !== query.source : !source_re.test(s.source))
|
|
1316
|
-
continue;
|
|
1317
|
-
}
|
|
1269
|
+
if (!matches(s)) continue;
|
|
1318
1270
|
if (source_matches !== void 0) {
|
|
1319
1271
|
if (s.source && !reverse_match(s.source)) continue;
|
|
1320
1272
|
}
|
|
1321
|
-
if (blocked !== void 0 && s.blocked !== blocked) continue;
|
|
1322
|
-
if (query?.lane !== void 0 && s.lane !== query.lane) continue;
|
|
1323
1273
|
if (count >= limit) break;
|
|
1324
1274
|
callback({
|
|
1325
1275
|
stream: s.stream,
|