@rotorsoft/act 0.42.0 → 0.44.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +57 -3
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts +43 -6
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/internal/reactions.d.ts +1 -1
- package/dist/@types/internal/reactions.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +12 -3
- package/dist/@types/types/action.d.ts.map +1 -1
- package/dist/@types/types/errors.d.ts +56 -0
- package/dist/@types/types/errors.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +274 -8
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-M5YFKVRV.js → chunk-LKRNWD7C.js} +160 -24
- package/dist/chunk-LKRNWD7C.js.map +1 -0
- package/dist/{chunk-AGWZY6YT.js → chunk-VMX7RPTC.js} +13 -2
- package/dist/chunk-VMX7RPTC.js.map +1 -0
- package/dist/index.cjs +257 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +90 -23
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +162 -25
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +4 -4
- package/dist/test/index.js.map +1 -1
- package/dist/types/index.cjs +13 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js +3 -1
- package/package.json +2 -2
- package/dist/chunk-AGWZY6YT.js.map +0 -1
- package/dist/chunk-M5YFKVRV.js.map +0 -1
package/dist/test/index.cjs
CHANGED
|
@@ -3831,7 +3831,7 @@ function manageArtifactAttachment(attachment) {
|
|
|
3831
3831
|
}
|
|
3832
3832
|
}
|
|
3833
3833
|
|
|
3834
|
-
// ../../node_modules/.pnpm/vite@7.3.3_@types+node@25.7.0_jiti@2.6.1_lightningcss@1.32.0_terser@5.46.1_tsx@4.
|
|
3834
|
+
// ../../node_modules/.pnpm/vite@7.3.3_@types+node@25.7.0_jiti@2.6.1_lightningcss@1.32.0_terser@5.46.1_tsx@4.22.1_yaml@2.9.0/node_modules/vite/dist/node/module-runner.js
|
|
3835
3835
|
var SOURCEMAPPING_URL = "sourceMa";
|
|
3836
3836
|
SOURCEMAPPING_URL += "ppingURL";
|
|
3837
3837
|
var isWindows = typeof process < "u" && process.platform === "win32";
|
|
@@ -3876,7 +3876,7 @@ var envProxy = new Proxy({}, { get(_, p) {
|
|
|
3876
3876
|
throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
|
|
3877
3877
|
} });
|
|
3878
3878
|
|
|
3879
|
-
// ../../node_modules/.pnpm/vitest@4.1.6_@opentelemetry+api@1.9.0_@types+node@25.7.0_@vitest+coverage-v8@4.1.
|
|
3879
|
+
// ../../node_modules/.pnpm/vitest@4.1.6_@opentelemetry+api@1.9.0_@types+node@25.7.0_@vitest+coverage-v8@4.1.6_vite_5a29b11e99a57208a40f952e13f6979b/node_modules/vitest/dist/index.js
|
|
3880
3880
|
var import_expect_type = __toESM(require_dist(), 1);
|
|
3881
3881
|
|
|
3882
3882
|
// src/internal/lru-map.ts
|
|
@@ -4076,7 +4076,8 @@ var Errors = {
|
|
|
4076
4076
|
ValidationError: "ERR_VALIDATION",
|
|
4077
4077
|
InvariantError: "ERR_INVARIANT",
|
|
4078
4078
|
ConcurrencyError: "ERR_CONCURRENCY",
|
|
4079
|
-
StreamClosedError: "ERR_STREAM_CLOSED"
|
|
4079
|
+
StreamClosedError: "ERR_STREAM_CLOSED",
|
|
4080
|
+
NonRetryableError: "ERR_NON_RETRYABLE"
|
|
4080
4081
|
};
|
|
4081
4082
|
var ValidationError = class extends Error {
|
|
4082
4083
|
constructor(target, payload, details) {
|
|
@@ -4392,6 +4393,20 @@ var InMemoryStream = class {
|
|
|
4392
4393
|
this._leased_by = void 0;
|
|
4393
4394
|
this._leased_until = void 0;
|
|
4394
4395
|
}
|
|
4396
|
+
/**
|
|
4397
|
+
* Clear the blocked flag and lease bookkeeping without touching the
|
|
4398
|
+
* watermark. Returns true if the stream was actually blocked (and is
|
|
4399
|
+
* now flipped); false otherwise.
|
|
4400
|
+
*/
|
|
4401
|
+
unblock() {
|
|
4402
|
+
if (!this._blocked) return false;
|
|
4403
|
+
this._blocked = false;
|
|
4404
|
+
this._retry = -1;
|
|
4405
|
+
this._error = "";
|
|
4406
|
+
this._leased_by = void 0;
|
|
4407
|
+
this._leased_until = void 0;
|
|
4408
|
+
return true;
|
|
4409
|
+
}
|
|
4395
4410
|
};
|
|
4396
4411
|
var InMemoryStore = class {
|
|
4397
4412
|
// stored events
|
|
@@ -4627,19 +4642,81 @@ var InMemoryStore = class {
|
|
|
4627
4642
|
return leases.map((l) => this._streams.get(l.stream)?.block(l, l.error)).filter((l) => !!l);
|
|
4628
4643
|
}
|
|
4629
4644
|
/**
|
|
4630
|
-
*
|
|
4631
|
-
*
|
|
4632
|
-
*
|
|
4645
|
+
* Build a predicate from a {@link StreamFilter}. Compiled regexes are
|
|
4646
|
+
* cached in the closure so callers can apply it across the streams
|
|
4647
|
+
* map without re-compiling per iteration.
|
|
4648
|
+
*/
|
|
4649
|
+
_filterPredicate(filter) {
|
|
4650
|
+
const streamRe = filter.stream && !filter.stream_exact ? new RegExp(filter.stream) : void 0;
|
|
4651
|
+
const sourceRe = filter.source && !filter.source_exact ? new RegExp(filter.source) : void 0;
|
|
4652
|
+
return (s) => {
|
|
4653
|
+
if (filter.stream !== void 0) {
|
|
4654
|
+
if (filter.stream_exact ? s.stream !== filter.stream : !streamRe.test(s.stream))
|
|
4655
|
+
return false;
|
|
4656
|
+
}
|
|
4657
|
+
if (filter.source !== void 0) {
|
|
4658
|
+
if (s.source === void 0) return false;
|
|
4659
|
+
if (filter.source_exact ? s.source !== filter.source : !sourceRe.test(s.source))
|
|
4660
|
+
return false;
|
|
4661
|
+
}
|
|
4662
|
+
if (filter.blocked !== void 0 && s.blocked !== filter.blocked)
|
|
4663
|
+
return false;
|
|
4664
|
+
return true;
|
|
4665
|
+
};
|
|
4666
|
+
}
|
|
4667
|
+
/**
|
|
4668
|
+
* Reset watermarks to -1, clearing retry, blocked, error, and lease
|
|
4669
|
+
* state so the matched streams can be replayed from the beginning.
|
|
4670
|
+
* Accepts either an explicit list of names or a {@link StreamFilter}.
|
|
4671
|
+
*
|
|
4672
|
+
* @param input - Stream names or a filter selecting the streams to reset.
|
|
4633
4673
|
* @returns Count of streams that were actually reset.
|
|
4634
4674
|
*/
|
|
4635
|
-
async reset(
|
|
4675
|
+
async reset(input) {
|
|
4636
4676
|
await sleep();
|
|
4637
4677
|
let count = 0;
|
|
4638
|
-
|
|
4639
|
-
const
|
|
4640
|
-
|
|
4641
|
-
s
|
|
4642
|
-
|
|
4678
|
+
if (Array.isArray(input)) {
|
|
4679
|
+
for (const name of input) {
|
|
4680
|
+
const s = this._streams.get(name);
|
|
4681
|
+
if (s) {
|
|
4682
|
+
s.reset();
|
|
4683
|
+
count++;
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
} else {
|
|
4687
|
+
const matches = this._filterPredicate(input);
|
|
4688
|
+
for (const s of this._streams.values()) {
|
|
4689
|
+
if (matches(s)) {
|
|
4690
|
+
s.reset();
|
|
4691
|
+
count++;
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
return count;
|
|
4696
|
+
}
|
|
4697
|
+
/**
|
|
4698
|
+
* Clear the blocked flag (and retry / error / lease) on the matched
|
|
4699
|
+
* streams without touching the watermark. Streams that aren't blocked
|
|
4700
|
+
* at call time are silently skipped. Accepts either an explicit list
|
|
4701
|
+
* of names or a {@link StreamFilter}. The filter form always restricts
|
|
4702
|
+
* to blocked streams — passing `blocked: false` matches nothing.
|
|
4703
|
+
* See {@link Store.unblock}.
|
|
4704
|
+
*
|
|
4705
|
+
* @param input - Stream names or a filter selecting the streams to unblock.
|
|
4706
|
+
* @returns Count of streams that were actually flipped (were blocked).
|
|
4707
|
+
*/
|
|
4708
|
+
async unblock(input) {
|
|
4709
|
+
await sleep();
|
|
4710
|
+
let count = 0;
|
|
4711
|
+
if (Array.isArray(input)) {
|
|
4712
|
+
for (const name of input) {
|
|
4713
|
+
const s = this._streams.get(name);
|
|
4714
|
+
if (s?.unblock()) count++;
|
|
4715
|
+
}
|
|
4716
|
+
} else {
|
|
4717
|
+
const matches = this._filterPredicate({ ...input, blocked: true });
|
|
4718
|
+
for (const s of this._streams.values()) {
|
|
4719
|
+
if (matches(s) && s.unblock()) count++;
|
|
4643
4720
|
}
|
|
4644
4721
|
}
|
|
4645
4722
|
return count;
|
|
@@ -4655,21 +4732,10 @@ var InMemoryStore = class {
|
|
|
4655
4732
|
*/
|
|
4656
4733
|
async prioritize(filter, priority) {
|
|
4657
4734
|
await sleep();
|
|
4658
|
-
const
|
|
4659
|
-
const sourceRe = filter.source && !filter.source_exact ? new RegExp(filter.source) : void 0;
|
|
4735
|
+
const matches = this._filterPredicate(filter);
|
|
4660
4736
|
let count = 0;
|
|
4661
4737
|
for (const s of this._streams.values()) {
|
|
4662
|
-
if (
|
|
4663
|
-
if (filter.stream_exact ? s.stream !== filter.stream : !streamRe.test(s.stream))
|
|
4664
|
-
continue;
|
|
4665
|
-
}
|
|
4666
|
-
if (filter.source !== void 0) {
|
|
4667
|
-
if (s.source === void 0) continue;
|
|
4668
|
-
if (filter.source_exact ? s.source !== filter.source : !sourceRe.test(s.source))
|
|
4669
|
-
continue;
|
|
4670
|
-
}
|
|
4671
|
-
if (filter.blocked !== void 0 && s.blocked !== filter.blocked)
|
|
4672
|
-
continue;
|
|
4738
|
+
if (!matches(s)) continue;
|
|
4673
4739
|
if (s.priority !== priority) {
|
|
4674
4740
|
s.setPriority(priority);
|
|
4675
4741
|
count++;
|
|
@@ -4721,6 +4787,77 @@ var InMemoryStore = class {
|
|
|
4721
4787
|
}
|
|
4722
4788
|
return { maxEventId: this._events.length - 1, count };
|
|
4723
4789
|
}
|
|
4790
|
+
/**
|
|
4791
|
+
* Per-stream aggregated stats — see {@link Store.query_stats}.
|
|
4792
|
+
*
|
|
4793
|
+
* Single forward scan over the in-memory event list, accumulating per
|
|
4794
|
+
* stream. The "cheap heads" cost tier from durable adapters doesn't
|
|
4795
|
+
* apply here (InMemory has no indexes); correctness is the goal, perf
|
|
4796
|
+
* is a non-issue.
|
|
4797
|
+
*
|
|
4798
|
+
* Scope rules:
|
|
4799
|
+
* - Array `input` — explicit stream names, regardless of subscription.
|
|
4800
|
+
* - Filter `input` — `stream`/`stream_exact` match against event-bearing
|
|
4801
|
+
* stream names; `source`/`source_exact`/`blocked` require a
|
|
4802
|
+
* corresponding subscription in `_streams` (those are subscription
|
|
4803
|
+
* concepts, not event concepts). Empty filter `{}` matches every
|
|
4804
|
+
* event-bearing stream.
|
|
4805
|
+
*/
|
|
4806
|
+
async query_stats(input, options) {
|
|
4807
|
+
await sleep();
|
|
4808
|
+
const exclude = new Set(options?.exclude ?? []);
|
|
4809
|
+
const wantTail = options?.tail ?? false;
|
|
4810
|
+
const wantCount = options?.count ?? false;
|
|
4811
|
+
const wantNames = options?.names ?? false;
|
|
4812
|
+
const before = options?.before;
|
|
4813
|
+
const arrayTargets = Array.isArray(input) ? new Set(input) : null;
|
|
4814
|
+
const filter = Array.isArray(input) ? null : input;
|
|
4815
|
+
const streamRe = filter?.stream && !filter.stream_exact ? new RegExp(filter.stream) : void 0;
|
|
4816
|
+
const scopeCache = /* @__PURE__ */ new Map();
|
|
4817
|
+
const inScope = (stream) => {
|
|
4818
|
+
const cached = scopeCache.get(stream);
|
|
4819
|
+
if (cached !== void 0) return cached;
|
|
4820
|
+
let ok = true;
|
|
4821
|
+
if (arrayTargets) {
|
|
4822
|
+
ok = arrayTargets.has(stream);
|
|
4823
|
+
} else if (filter?.stream !== void 0) {
|
|
4824
|
+
ok = filter.stream_exact ? stream === filter.stream : (
|
|
4825
|
+
// biome-ignore lint/style/noNonNullAssertion: streamRe set when stream is regex
|
|
4826
|
+
streamRe.test(stream)
|
|
4827
|
+
);
|
|
4828
|
+
}
|
|
4829
|
+
scopeCache.set(stream, ok);
|
|
4830
|
+
return ok;
|
|
4831
|
+
};
|
|
4832
|
+
const acc = /* @__PURE__ */ new Map();
|
|
4833
|
+
for (const e of this._events) {
|
|
4834
|
+
if (before !== void 0 && e.id >= before) continue;
|
|
4835
|
+
if (!inScope(e.stream)) continue;
|
|
4836
|
+
if (exclude.has(e.name)) continue;
|
|
4837
|
+
let a = acc.get(e.stream);
|
|
4838
|
+
if (!a) {
|
|
4839
|
+
a = { head: e, count: 0 };
|
|
4840
|
+
if (wantTail) a.tail = e;
|
|
4841
|
+
if (wantNames) a.names = {};
|
|
4842
|
+
acc.set(e.stream, a);
|
|
4843
|
+
}
|
|
4844
|
+
a.head = e;
|
|
4845
|
+
a.count++;
|
|
4846
|
+
if (wantNames) {
|
|
4847
|
+
const n = String(e.name);
|
|
4848
|
+
a.names[n] = (a.names[n] ?? 0) + 1;
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4851
|
+
const out = /* @__PURE__ */ new Map();
|
|
4852
|
+
for (const [stream, a] of acc) {
|
|
4853
|
+
const stats = { head: a.head };
|
|
4854
|
+
if (wantTail) stats.tail = a.tail;
|
|
4855
|
+
if (wantCount) stats.count = a.count;
|
|
4856
|
+
if (wantNames) stats.names = a.names;
|
|
4857
|
+
out.set(stream, stats);
|
|
4858
|
+
}
|
|
4859
|
+
return out;
|
|
4860
|
+
}
|
|
4724
4861
|
/**
|
|
4725
4862
|
* Atomically truncates streams and seeds each with a snapshot or tombstone.
|
|
4726
4863
|
* @param targets - Streams to truncate with optional snapshot state and meta.
|