//#region src/idempotency/testing.ts
var MemoryIdempotencyStore = class {
	records = /* @__PURE__ */ new Map();
	version = 0;
	async read(key) {
		const current = this.records.get(key);
		return current ? {
			version: current.version,
			record: { ...current.record }
		} : null;
	}
	async compareAndSwap(input) {
		if ((this.records.get(input.key)?.version ?? null) !== input.expectedVersion) return false;
		if (input.next === null) {
			this.records.delete(input.key);
			return true;
		}
		this.version += 1;
		this.records.set(input.key, {
			version: String(this.version),
			record: { ...input.next }
		});
		return true;
	}
	inspect(key) {
		const current = this.records.get(key);
		return current ? { ...current.record } : null;
	}
	clear() {
		this.records.clear();
	}
};
//#endregion
export { MemoryIdempotencyStore };
