@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.js
CHANGED
package/dist/test/index.cjs
CHANGED
|
@@ -979,25 +979,19 @@ var InMemoryStore = class {
|
|
|
979
979
|
*/
|
|
980
980
|
async defer(input, deferred_at) {
|
|
981
981
|
await sleep();
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
s.defer(deferred_at);
|
|
996
|
-
count++;
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
return count;
|
|
982
|
+
const selected = this._select(input);
|
|
983
|
+
for (const s of selected) s.defer(deferred_at);
|
|
984
|
+
return selected.length;
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* The streams named by `input`: an explicit list (de-duplicated, so a
|
|
988
|
+
* repeated name counts once, matching the SQL adapters' set-based
|
|
989
|
+
* `stream = ANY(...)`; unknown names are skipped) or a {@link StreamFilter}.
|
|
990
|
+
*/
|
|
991
|
+
_select(input) {
|
|
992
|
+
if (Array.isArray(input))
|
|
993
|
+
return [...new Set(input)].map((name) => this._streams.get(name)).filter((s) => s !== void 0);
|
|
994
|
+
return [...this._streams.values()].filter(this._filter_predicate(input));
|
|
1001
995
|
}
|
|
1002
996
|
/**
|
|
1003
997
|
* Build a predicate from a {@link StreamFilter}. Compiled regexes are
|
|
@@ -1033,37 +1027,10 @@ var InMemoryStore = class {
|
|
|
1033
1027
|
*/
|
|
1034
1028
|
async reset(input) {
|
|
1035
1029
|
await sleep();
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
const s = this._streams.get(name);
|
|
1040
|
-
if (s) {
|
|
1041
|
-
s.reset();
|
|
1042
|
-
count++;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
} else {
|
|
1046
|
-
const matches = this._filter_predicate(input);
|
|
1047
|
-
for (const s of this._streams.values()) {
|
|
1048
|
-
if (matches(s)) {
|
|
1049
|
-
s.reset();
|
|
1050
|
-
count++;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
return count;
|
|
1030
|
+
const selected = this._select(input);
|
|
1031
|
+
for (const s of selected) s.reset();
|
|
1032
|
+
return selected.length;
|
|
1055
1033
|
}
|
|
1056
|
-
/**
|
|
1057
|
-
* Clear the blocked flag (and retry / error / lease) on the matched
|
|
1058
|
-
* streams without touching the watermark. Streams that aren't blocked
|
|
1059
|
-
* at call time are silently skipped. Accepts either an explicit list
|
|
1060
|
-
* of names or a {@link StreamFilter}. The filter form always restricts
|
|
1061
|
-
* to blocked streams — passing `blocked: false` matches nothing.
|
|
1062
|
-
* See {@link Store.unblock}.
|
|
1063
|
-
*
|
|
1064
|
-
* @param input - Stream names or a filter selecting the streams to unblock.
|
|
1065
|
-
* @returns Count of streams that were actually flipped (were blocked).
|
|
1066
|
-
*/
|
|
1067
1034
|
/**
|
|
1068
1035
|
* Wipe the sensitive-data payload for every event on the stream — see
|
|
1069
1036
|
* {@link Store.forget_pii}. O(1) drop of the stream's inner Map; the size of
|
|
@@ -1079,21 +1046,23 @@ var InMemoryStore = class {
|
|
|
1079
1046
|
this._pii.delete(stream);
|
|
1080
1047
|
return count;
|
|
1081
1048
|
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Clear the blocked flag (and retry / error / lease) on the matched
|
|
1051
|
+
* streams without touching the watermark. Streams that aren't blocked
|
|
1052
|
+
* at call time are silently skipped. Accepts either an explicit list
|
|
1053
|
+
* of names or a {@link StreamFilter}. The filter form always restricts
|
|
1054
|
+
* to blocked streams — passing `blocked: false` matches nothing.
|
|
1055
|
+
* See {@link Store.unblock}.
|
|
1056
|
+
*
|
|
1057
|
+
* @param input - Stream names or a filter selecting the streams to unblock.
|
|
1058
|
+
* @returns Count of streams that were actually flipped (were blocked).
|
|
1059
|
+
*/
|
|
1082
1060
|
async unblock(input) {
|
|
1083
1061
|
await sleep();
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
if (s?.unblock()) count++;
|
|
1089
|
-
}
|
|
1090
|
-
} else {
|
|
1091
|
-
const matches = this._filter_predicate({ ...input, blocked: true });
|
|
1092
|
-
for (const s of this._streams.values()) {
|
|
1093
|
-
if (matches(s) && s.unblock()) count++;
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
return count;
|
|
1062
|
+
const selected = this._select(
|
|
1063
|
+
Array.isArray(input) ? input : { ...input, blocked: true }
|
|
1064
|
+
);
|
|
1065
|
+
return selected.filter((s) => s.unblock()).length;
|
|
1097
1066
|
}
|
|
1098
1067
|
/**
|
|
1099
1068
|
* Bulk-update priority of streams matching `filter`. Mirrors
|
|
@@ -1106,16 +1075,9 @@ var InMemoryStore = class {
|
|
|
1106
1075
|
*/
|
|
1107
1076
|
async prioritize(filter, priority) {
|
|
1108
1077
|
await sleep();
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
if (!matches(s)) continue;
|
|
1113
|
-
if (s.priority !== priority) {
|
|
1114
|
-
s.set_priority(priority);
|
|
1115
|
-
count++;
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
return count;
|
|
1078
|
+
const changed = this._select(filter).filter((s) => s.priority !== priority);
|
|
1079
|
+
for (const s of changed) s.set_priority(priority);
|
|
1080
|
+
return changed.length;
|
|
1119
1081
|
}
|
|
1120
1082
|
/**
|
|
1121
1083
|
* Streams registered subscription positions to the callback, ordered by
|
|
@@ -1126,10 +1088,8 @@ var InMemoryStore = class {
|
|
|
1126
1088
|
await sleep();
|
|
1127
1089
|
const limit = query?.limit ?? 100;
|
|
1128
1090
|
const after = query?.after;
|
|
1129
|
-
const blocked = query?.blocked;
|
|
1130
1091
|
const source_matches = query?.source_matches;
|
|
1131
|
-
const
|
|
1132
|
-
const source_re = query?.source !== void 0 && !query.source_exact ? new RegExp(query.source) : void 0;
|
|
1092
|
+
const matches = this._filter_predicate(query ?? {});
|
|
1133
1093
|
const reverse_cache = /* @__PURE__ */ new Map();
|
|
1134
1094
|
const reverse_match = (source) => {
|
|
1135
1095
|
let re = reverse_cache.get(source);
|
|
@@ -1143,20 +1103,10 @@ var InMemoryStore = class {
|
|
|
1143
1103
|
let count = 0;
|
|
1144
1104
|
for (const s of sorted) {
|
|
1145
1105
|
if (after !== void 0 && s.stream <= after) continue;
|
|
1146
|
-
if (
|
|
1147
|
-
if (query.stream_exact ? s.stream !== query.stream : !stream_re.test(s.stream))
|
|
1148
|
-
continue;
|
|
1149
|
-
}
|
|
1150
|
-
if (query?.source !== void 0) {
|
|
1151
|
-
if (s.source === void 0) continue;
|
|
1152
|
-
if (query.source_exact ? s.source !== query.source : !source_re.test(s.source))
|
|
1153
|
-
continue;
|
|
1154
|
-
}
|
|
1106
|
+
if (!matches(s)) continue;
|
|
1155
1107
|
if (source_matches !== void 0) {
|
|
1156
1108
|
if (s.source && !reverse_match(s.source)) continue;
|
|
1157
1109
|
}
|
|
1158
|
-
if (blocked !== void 0 && s.blocked !== blocked) continue;
|
|
1159
|
-
if (query?.lane !== void 0 && s.lane !== query.lane) continue;
|
|
1160
1110
|
if (count >= limit) break;
|
|
1161
1111
|
callback({
|
|
1162
1112
|
stream: s.stream,
|