@rotorsoft/act 1.0.0 → 1.1.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/adapters/in-memory-store.d.ts +17 -1
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +138 -0
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-VC6MSVC3.js → chunk-TN4XS7WE.js} +82 -1
- package/dist/{chunk-VC6MSVC3.js.map → chunk-TN4XS7WE.js.map} +1 -1
- package/dist/index.cjs +81 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/test/index.cjs +83 -2
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +3 -3
- package/dist/test/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
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.
|
|
3834
|
+
// ../../node_modules/.pnpm/vite@7.3.3_@types+node@25.9.1_jiti@2.6.1_lightningcss@1.32.0_terser@5.46.1_tsx@4.22.3_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.7_@opentelemetry+api@1.9.0_@types+node@25.
|
|
3879
|
+
// ../../node_modules/.pnpm/vitest@4.1.7_@opentelemetry+api@1.9.0_@types+node@25.9.1_@vitest+coverage-v8@4.1.7_vite_a8a01b4003196882187ed5d804d1f0c5/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
|
|
@@ -4938,6 +4938,87 @@ var InMemoryStore = class {
|
|
|
4938
4938
|
this._maxNonSnapEventId = max;
|
|
4939
4939
|
return result;
|
|
4940
4940
|
}
|
|
4941
|
+
/**
|
|
4942
|
+
* Atomically rebuild the store from a stream of {@link RestoreRow}.
|
|
4943
|
+
*
|
|
4944
|
+
* Captures every index state up front, clears it, then iterates the
|
|
4945
|
+
* source. Any throw mid-iteration restores the snapshot, leaving
|
|
4946
|
+
* the store byte-for-byte unchanged from the operator's
|
|
4947
|
+
* perspective.
|
|
4948
|
+
*
|
|
4949
|
+
* `id`s are reassigned `0..N-1` as rows arrive (matching the
|
|
4950
|
+
* adapter's commit-id convention — InMemory uses `_events.length`).
|
|
4951
|
+
* `created` is preserved verbatim from the source. Causation
|
|
4952
|
+
* references in `meta.causation.event.id` are remapped via the
|
|
4953
|
+
* `old → new` table that's built as rows land — references to ids
|
|
4954
|
+
* not in the source pass through unchanged.
|
|
4955
|
+
*/
|
|
4956
|
+
async restore(source, _opts = {}) {
|
|
4957
|
+
await sleep();
|
|
4958
|
+
const started = Date.now();
|
|
4959
|
+
const prevEvents = this._events;
|
|
4960
|
+
const prevStreams = this._streams;
|
|
4961
|
+
const prevStreamVersions = this._streamVersions;
|
|
4962
|
+
const prevMaxEventIdByStream = this._maxEventIdByStream;
|
|
4963
|
+
const prevMaxNonSnapEventId = this._maxNonSnapEventId;
|
|
4964
|
+
this._events = [];
|
|
4965
|
+
this._streams = /* @__PURE__ */ new Map();
|
|
4966
|
+
this._streamVersions = /* @__PURE__ */ new Map();
|
|
4967
|
+
this._maxEventIdByStream = /* @__PURE__ */ new Map();
|
|
4968
|
+
this._maxNonSnapEventId = -1;
|
|
4969
|
+
const idMap = /* @__PURE__ */ new Map();
|
|
4970
|
+
try {
|
|
4971
|
+
let kept = 0;
|
|
4972
|
+
for await (const row of source) {
|
|
4973
|
+
const id = this._events.length;
|
|
4974
|
+
const created = row.created instanceof Date ? row.created : new Date(row.created);
|
|
4975
|
+
let meta = row.meta;
|
|
4976
|
+
const causedBy = meta.causation.event?.id;
|
|
4977
|
+
if (causedBy !== void 0) {
|
|
4978
|
+
const remapped = idMap.get(causedBy);
|
|
4979
|
+
if (remapped !== void 0 && remapped !== causedBy) {
|
|
4980
|
+
meta = {
|
|
4981
|
+
...meta,
|
|
4982
|
+
causation: {
|
|
4983
|
+
...meta.causation,
|
|
4984
|
+
event: { ...meta.causation.event, id: remapped }
|
|
4985
|
+
}
|
|
4986
|
+
};
|
|
4987
|
+
}
|
|
4988
|
+
}
|
|
4989
|
+
const committed = {
|
|
4990
|
+
id,
|
|
4991
|
+
stream: row.stream,
|
|
4992
|
+
version: row.version,
|
|
4993
|
+
created,
|
|
4994
|
+
name: row.name,
|
|
4995
|
+
data: row.data,
|
|
4996
|
+
meta
|
|
4997
|
+
};
|
|
4998
|
+
this._events.push(committed);
|
|
4999
|
+
idMap.set(row.id, id);
|
|
5000
|
+
this._streamVersions.set(row.stream, row.version);
|
|
5001
|
+
if (row.name !== SNAP_EVENT) {
|
|
5002
|
+
this._maxEventIdByStream.set(row.stream, id);
|
|
5003
|
+
this._maxNonSnapEventId = id;
|
|
5004
|
+
}
|
|
5005
|
+
kept++;
|
|
5006
|
+
}
|
|
5007
|
+
return {
|
|
5008
|
+
kept,
|
|
5009
|
+
duration_ms: Date.now() - started,
|
|
5010
|
+
dropped: { closed_streams: 0, snapshots: 0, empty_streams: 0 },
|
|
5011
|
+
dry_run: false
|
|
5012
|
+
};
|
|
5013
|
+
} catch (err) {
|
|
5014
|
+
this._events = prevEvents;
|
|
5015
|
+
this._streams = prevStreams;
|
|
5016
|
+
this._streamVersions = prevStreamVersions;
|
|
5017
|
+
this._maxEventIdByStream = prevMaxEventIdByStream;
|
|
5018
|
+
this._maxNonSnapEventId = prevMaxNonSnapEventId;
|
|
5019
|
+
throw err;
|
|
5020
|
+
}
|
|
5021
|
+
}
|
|
4941
5022
|
};
|
|
4942
5023
|
|
|
4943
5024
|
// src/test/sandbox.ts
|