@rotorsoft/act 1.23.4 → 1.23.6
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.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts +4 -8
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +7 -1
- package/dist/@types/types/action.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +12 -8
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-ZG7IC6N6.js → chunk-C7H3GARW.js} +16 -12
- package/dist/chunk-C7H3GARW.js.map +1 -0
- package/dist/index.cjs +27 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -18
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +15 -11
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-ZG7IC6N6.js.map +0 -1
package/dist/test/index.cjs
CHANGED
|
@@ -576,11 +576,12 @@ var InMemoryStream = class {
|
|
|
576
576
|
if (this._leased_by === lease.by) {
|
|
577
577
|
this._leased_by = void 0;
|
|
578
578
|
this._leased_until = void 0;
|
|
579
|
-
this._retry = -1;
|
|
580
579
|
if (lease.due !== void 0) {
|
|
580
|
+
this._retry = lease.retry;
|
|
581
581
|
this._deferred_at = lease.due;
|
|
582
582
|
return void 0;
|
|
583
583
|
}
|
|
584
|
+
this._retry = -1;
|
|
584
585
|
this._at = lease.at;
|
|
585
586
|
this._deferred_at = void 0;
|
|
586
587
|
return {
|
|
@@ -742,7 +743,18 @@ var InMemoryStore = class {
|
|
|
742
743
|
async query(callback, query) {
|
|
743
744
|
await sleep();
|
|
744
745
|
let count = 0;
|
|
746
|
+
let floor_index = -1;
|
|
747
|
+
if (query?.with_snaps && query.stream_exact && query.stream !== void 0 && query.after === void 0) {
|
|
748
|
+
for (let j = this._events.length - 1; j >= 0; j--) {
|
|
749
|
+
const e = this._events[j];
|
|
750
|
+
if (e.stream === query.stream && e.name === SNAP_EVENT) {
|
|
751
|
+
floor_index = j;
|
|
752
|
+
break;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
745
756
|
if (query?.backward) {
|
|
757
|
+
const floor_id = floor_index >= 0 ? this._events[floor_index].id : -1;
|
|
746
758
|
let i = (query?.before !== void 0 ? this._first_index_after(query.before - 1) : this._events.length) - 1;
|
|
747
759
|
while (i >= 0) {
|
|
748
760
|
const e = this._events[i--];
|
|
@@ -750,6 +762,7 @@ var InMemoryStore = class {
|
|
|
750
762
|
if (query?.created_before && e.created >= query.created_before)
|
|
751
763
|
continue;
|
|
752
764
|
if (query.after !== void 0 && e.id <= query.after) break;
|
|
765
|
+
if (floor_id >= 0 && e.id < floor_id) break;
|
|
753
766
|
if (query.created_after && e.created <= query.created_after) continue;
|
|
754
767
|
await Promise.resolve(
|
|
755
768
|
callback(this._with_pii(e))
|
|
@@ -758,16 +771,7 @@ var InMemoryStore = class {
|
|
|
758
771
|
if (query?.limit && count >= query.limit) break;
|
|
759
772
|
}
|
|
760
773
|
} else {
|
|
761
|
-
let i = this._first_index_after(query?.after ?? -1);
|
|
762
|
-
if (query?.with_snaps && query.stream_exact && query.stream !== void 0 && query.after === void 0 && query.created_before === void 0 && query.created_after === void 0) {
|
|
763
|
-
for (let j = this._events.length - 1; j >= 0; j--) {
|
|
764
|
-
const e = this._events[j];
|
|
765
|
-
if (e.stream === query.stream && e.name === SNAP_EVENT) {
|
|
766
|
-
i = j;
|
|
767
|
-
break;
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}
|
|
774
|
+
let i = floor_index >= 0 ? floor_index : this._first_index_after(query?.after ?? -1);
|
|
771
775
|
while (i < this._events.length) {
|
|
772
776
|
const e = this._events[i++];
|
|
773
777
|
if (query && !this.in_query(query, e)) continue;
|