@evolu/common 8.8.0 → 8.9.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.
@@ -162,7 +162,27 @@ export declare const assertFalse: (value: unknown) => asserts value is false;
162
162
  *
163
163
  * @group Assertions
164
164
  */
165
- export declare const assertConditionAfterMicrotasks: (condition: () => boolean, expectedMicrotaskCount: number) => Promise<void>;
165
+ export declare function assertConditionAfterMicrotasks(condition: () => boolean, expectedMicrotaskCount: number): Promise<void>;
166
+ /**
167
+ * Asserts that a Promise continuation runs after exactly the specified number
168
+ * of microtasks.
169
+ *
170
+ * Both fulfillment and rejection count as running the continuation. Use this in
171
+ * tests that intentionally specify async scheduling behavior. Application code
172
+ * must not depend on exact microtask counts. Maintainers should review count
173
+ * changes because they indicate that an async pipeline changed.
174
+ *
175
+ * ### Example
176
+ *
177
+ * ```ts
178
+ * import { assertContinuationAfterMicrotasks } from "@evolu/common";
179
+ *
180
+ * await assertContinuationAfterMicrotasks(Promise.resolve("ready"), 1);
181
+ * ```
182
+ *
183
+ * @group Assertions
184
+ */
185
+ export declare const assertContinuationAfterMicrotasks: (promise: Promise<unknown>, expectedMicrotaskCount: number) => Promise<void>;
166
186
  /**
167
187
  * Asserts that a function throws the expected value.
168
188
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Assert.d.ts","sourceRoot":"","sources":["../../src/Assert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAsC,KAAK,EAAE,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,KAAK,EAEV,GAAG,EACH,QAAQ,EACR,OAAO,EACP,EAAE,EACF,MAAM,EACP,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;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I,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7C,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EACzD,MAAM,EAAE,CAAC,EACT,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AA2B7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAC1D,MAAM,EAAE,CAAC,GACR,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAC9C,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAC1D,MAAM,EAAE,CAAC,EACT,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,EAC1B,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAClB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAC9C,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAC1D,MAAM,EAAE,CAAC,EACT,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC"}
@@ -150,38 +150,14 @@ export const assertFalse = (value) => {
150
150
  stackStartFn: assertFalse,
151
151
  });
152
152
  };
153
- /**
154
- * Asserts that a condition becomes true after exactly the specified number of
155
- * microtasks.
156
- *
157
- * Use this in tests that intentionally specify async scheduling behavior.
158
- * Application code must not depend on exact microtask counts. Maintainers
159
- * should review count changes because they indicate that an async pipeline
160
- * changed.
161
- *
162
- * ### Example
163
- *
164
- * ```ts
165
- * import { assertConditionAfterMicrotasks } from "@evolu/common";
166
- *
167
- * let ready = false;
168
- * queueMicrotask(() => {
169
- * ready = true;
170
- * });
171
- *
172
- * await assertConditionAfterMicrotasks(() => ready, 1);
173
- * ```
174
- *
175
- * @group Assertions
176
- */
177
- export const assertConditionAfterMicrotasks = async (condition, expectedMicrotaskCount) => {
153
+ export async function assertConditionAfterMicrotasks(condition, expectedMicrotaskCount, stackStartFn = assertConditionAfterMicrotasks) {
178
154
  for (let microtaskCount = 0; microtaskCount < expectedMicrotaskCount; microtaskCount++) {
179
155
  const actual = condition();
180
156
  assert(!actual, `Expected condition to be false after ${microtaskCount} microtasks.`, {
181
157
  actual,
182
158
  expected: false,
183
159
  operator: "strictEqual",
184
- stackStartFn: assertConditionAfterMicrotasks,
160
+ stackStartFn,
185
161
  });
186
162
  await Promise.resolve();
187
163
  }
@@ -190,9 +166,37 @@ export const assertConditionAfterMicrotasks = async (condition, expectedMicrotas
190
166
  actual,
191
167
  expected: true,
192
168
  operator: "strictEqual",
193
- stackStartFn: assertConditionAfterMicrotasks,
169
+ stackStartFn,
194
170
  });
171
+ }
172
+ /**
173
+ * Asserts that a Promise continuation runs after exactly the specified number
174
+ * of microtasks.
175
+ *
176
+ * Both fulfillment and rejection count as running the continuation. Use this in
177
+ * tests that intentionally specify async scheduling behavior. Application code
178
+ * must not depend on exact microtask counts. Maintainers should review count
179
+ * changes because they indicate that an async pipeline changed.
180
+ *
181
+ * ### Example
182
+ *
183
+ * ```ts
184
+ * import { assertContinuationAfterMicrotasks } from "@evolu/common";
185
+ *
186
+ * await assertContinuationAfterMicrotasks(Promise.resolve("ready"), 1);
187
+ * ```
188
+ *
189
+ * @group Assertions
190
+ */
191
+ export const assertContinuationAfterMicrotasks = async (promise, expectedMicrotaskCount) => {
192
+ let continuationCalled = false;
193
+ const markContinuationCalled = () => {
194
+ continuationCalled = true;
195
+ };
196
+ void promise.then(markContinuationCalled, markContinuationCalled);
197
+ await assertConditionAfterMicrotasksWithStackStartFn(() => continuationCalled, expectedMicrotaskCount, assertContinuationAfterMicrotasks);
195
198
  };
199
+ const assertConditionAfterMicrotasksWithStackStartFn = assertConditionAfterMicrotasks;
196
200
  export function assertThrows(run, expectedOrAssert) {
197
201
  const thrown = captureThrown(run, assertThrows);
198
202
  if (typeof expectedOrAssert === "function") {
@@ -15,6 +15,12 @@
15
15
  * `Map.prototype.getOrInsertComputed`, `WeakMap.prototype.getOrInsert`, and
16
16
  * `WeakMap.prototype.getOrInsertComputed`) for Node 24 and React Native
17
17
  *
18
+ * The polyfills are implemented directly in the Evolu Library instead of being
19
+ * third-party runtime dependencies. We audit their behavior against
20
+ * specifications, conformance tests, and native implementations, and fix issues
21
+ * when necessary. This lets Evolu understand and control every line of this
22
+ * runtime code.
23
+ *
18
24
  * `@evolu/react-native` has its own `Polyfills` module and its
19
25
  * `installPolyfills` calls this function first, then installs React Native
20
26
  * specific polyfills.
@@ -1 +1 @@
1
- {"version":3,"file":"Polyfills.d.ts","sourceRoot":"","sources":["../../src/Polyfills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,gBAAgB,QAAO,IAiBnC,CAAC"}
1
+ {"version":3,"file":"Polyfills.d.ts","sourceRoot":"","sources":["../../src/Polyfills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,gBAAgB,QAAO,IAiBnC,CAAC"}
@@ -15,6 +15,12 @@
15
15
  * `Map.prototype.getOrInsertComputed`, `WeakMap.prototype.getOrInsert`, and
16
16
  * `WeakMap.prototype.getOrInsertComputed`) for Node 24 and React Native
17
17
  *
18
+ * The polyfills are implemented directly in the Evolu Library instead of being
19
+ * third-party runtime dependencies. We audit their behavior against
20
+ * specifications, conformance tests, and native implementations, and fix issues
21
+ * when necessary. This lets Evolu understand and control every line of this
22
+ * runtime code.
23
+ *
18
24
  * `@evolu/react-native` has its own `Polyfills` module and its
19
25
  * `installPolyfills` calls this function first, then installs React Native
20
26
  * specific polyfills.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/common",
3
- "version": "8.8.0",
3
+ "version": "8.9.0",
4
4
  "description": "TypeScript library and local-first platform",
5
5
  "keywords": [
6
6
  "evolu",
@@ -5,6 +5,7 @@ import type { NonEmptyArray, NonEmptyReadonlyArray } from "./Array.ts";
5
5
  import {
6
6
  assert,
7
7
  assertConditionAfterMicrotasks,
8
+ assertContinuationAfterMicrotasks,
8
9
  assertEqual,
9
10
  assertEqualBytes,
10
11
  assertErr,
@@ -233,6 +234,13 @@ describe("assertConditionAfterMicrotasks", () => {
233
234
  nodeAssert.equal(callCount, 3);
234
235
  });
235
236
 
237
+ it("resolves without adding another microtask", async () => {
238
+ await assertContinuationAfterMicrotasks(
239
+ assertConditionAfterMicrotasks(() => true, 0),
240
+ 1,
241
+ );
242
+ });
243
+
236
244
  it("rejects when the condition becomes true too early", async () => {
237
245
  await nodeAssert.rejects(
238
246
  assertConditionAfterMicrotasks(() => true, 1),
@@ -248,6 +256,49 @@ describe("assertConditionAfterMicrotasks", () => {
248
256
  });
249
257
  });
250
258
 
259
+ describe("assertContinuationAfterMicrotasks", () => {
260
+ it("resolves when a fulfillment continuation runs after the exact count", async () => {
261
+ await assertContinuationAfterMicrotasks(Promise.resolve("done"), 1);
262
+ });
263
+
264
+ it("resolves when a rejection continuation runs after the exact count", async () => {
265
+ await assertContinuationAfterMicrotasks(
266
+ Promise.reject(new Error("failure")),
267
+ 1,
268
+ );
269
+ });
270
+
271
+ it("rejects when the continuation runs too early", async () => {
272
+ await nodeAssert.rejects(
273
+ assertContinuationAfterMicrotasks(Promise.resolve("done"), 2),
274
+ (error: unknown) => {
275
+ nodeAssert.ok(error instanceof nodeAssert.AssertionError);
276
+ nodeAssert.match(
277
+ error.message,
278
+ /Expected condition to be false after 1 microtasks\./u,
279
+ );
280
+ nodeAssert.ok(error.stack);
281
+ nodeAssert.equal(
282
+ error.stack.includes("at assertContinuationAfterMicrotasks "),
283
+ false,
284
+ );
285
+ return true;
286
+ },
287
+ );
288
+ });
289
+
290
+ it("rejects when the continuation has not run after the exact count", async () => {
291
+ const promise = new Promise<void>((resolve) => {
292
+ queueMicrotask(resolve);
293
+ });
294
+
295
+ await nodeAssert.rejects(
296
+ assertContinuationAfterMicrotasks(promise, 1),
297
+ /Expected condition to be true after exactly 1 microtasks\./u,
298
+ );
299
+ });
300
+ });
301
+
251
302
  describe("assertThrows", () => {
252
303
  it("compares the thrown value", () => {
253
304
  assertThrows(
package/src/Assert.ts CHANGED
@@ -252,10 +252,17 @@ export const assertFalse: (value: unknown) => asserts value is false = (
252
252
  *
253
253
  * @group Assertions
254
254
  */
255
- export const assertConditionAfterMicrotasks = async (
255
+ export function assertConditionAfterMicrotasks(
256
256
  condition: () => boolean,
257
257
  expectedMicrotaskCount: number,
258
- ): Promise<void> => {
258
+ ): Promise<void>;
259
+ export async function assertConditionAfterMicrotasks(
260
+ condition: () => boolean,
261
+ expectedMicrotaskCount: number,
262
+ stackStartFn: (
263
+ ...args: Array<never>
264
+ ) => unknown = assertConditionAfterMicrotasks,
265
+ ): Promise<void> {
259
266
  for (
260
267
  let microtaskCount = 0;
261
268
  microtaskCount < expectedMicrotaskCount;
@@ -269,7 +276,7 @@ export const assertConditionAfterMicrotasks = async (
269
276
  actual,
270
277
  expected: false,
271
278
  operator: "strictEqual",
272
- stackStartFn: assertConditionAfterMicrotasks,
279
+ stackStartFn,
273
280
  },
274
281
  );
275
282
  await Promise.resolve();
@@ -283,11 +290,56 @@ export const assertConditionAfterMicrotasks = async (
283
290
  actual,
284
291
  expected: true,
285
292
  operator: "strictEqual",
286
- stackStartFn: assertConditionAfterMicrotasks,
293
+ stackStartFn,
287
294
  },
288
295
  );
296
+ }
297
+
298
+ /**
299
+ * Asserts that a Promise continuation runs after exactly the specified number
300
+ * of microtasks.
301
+ *
302
+ * Both fulfillment and rejection count as running the continuation. Use this in
303
+ * tests that intentionally specify async scheduling behavior. Application code
304
+ * must not depend on exact microtask counts. Maintainers should review count
305
+ * changes because they indicate that an async pipeline changed.
306
+ *
307
+ * ### Example
308
+ *
309
+ * ```ts
310
+ * import { assertContinuationAfterMicrotasks } from "@evolu/common";
311
+ *
312
+ * await assertContinuationAfterMicrotasks(Promise.resolve("ready"), 1);
313
+ * ```
314
+ *
315
+ * @group Assertions
316
+ */
317
+ export const assertContinuationAfterMicrotasks = async (
318
+ promise: Promise<unknown>,
319
+ expectedMicrotaskCount: number,
320
+ ): Promise<void> => {
321
+ let continuationCalled = false;
322
+
323
+ const markContinuationCalled = (): void => {
324
+ continuationCalled = true;
325
+ };
326
+
327
+ void promise.then(markContinuationCalled, markContinuationCalled);
328
+
329
+ await assertConditionAfterMicrotasksWithStackStartFn(
330
+ () => continuationCalled,
331
+ expectedMicrotaskCount,
332
+ assertContinuationAfterMicrotasks,
333
+ );
289
334
  };
290
335
 
336
+ const assertConditionAfterMicrotasksWithStackStartFn =
337
+ assertConditionAfterMicrotasks as (
338
+ condition: () => boolean,
339
+ expectedMicrotaskCount: number,
340
+ stackStartFn: (...args: Array<never>) => unknown,
341
+ ) => Promise<void>;
342
+
291
343
  /**
292
344
  * Asserts that a function throws the expected value.
293
345
  *
package/src/Polyfills.ts CHANGED
@@ -16,6 +16,12 @@
16
16
  * `Map.prototype.getOrInsertComputed`, `WeakMap.prototype.getOrInsert`, and
17
17
  * `WeakMap.prototype.getOrInsertComputed`) for Node 24 and React Native
18
18
  *
19
+ * The polyfills are implemented directly in the Evolu Library instead of being
20
+ * third-party runtime dependencies. We audit their behavior against
21
+ * specifications, conformance tests, and native implementations, and fix issues
22
+ * when necessary. This lets Evolu understand and control every line of this
23
+ * runtime code.
24
+ *
19
25
  * `@evolu/react-native` has its own `Polyfills` module and its
20
26
  * `installPolyfills` calls this function first, then installs React Native
21
27
  * specific polyfills.