@rotorsoft/act 1.32.3 → 1.32.5

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/index.js CHANGED
@@ -809,7 +809,7 @@ function next_window_open(window, now) {
809
809
  const boundary = new Date(
810
810
  candidate.getTime() - candidate.getTime() % 36e5
811
811
  );
812
- if (is_dst_gap_open(boundary, window.timeZone, window.start))
812
+ if (boundary.getTime() >= start_ms && is_dst_gap_open(boundary, window.timeZone, window.start))
813
813
  return boundary;
814
814
  }
815
815
  return new Date(start_ms + 864e5);
@@ -3050,6 +3050,7 @@ var DrainController = class {
3050
3050
  if (!cycle) {
3051
3051
  this._deps.breaker.passed();
3052
3052
  this._armed = false;
3053
+ if (this._defer.size > 0) this._defer.schedule();
3053
3054
  return EMPTY_DRAIN;
3054
3055
  }
3055
3056
  const { leased, fetched, handled, acked, blocked, closeable } = cycle;
@@ -4950,23 +4951,29 @@ function base_type_name(zodType) {
4950
4951
  return t.constructor.name;
4951
4952
  }
4952
4953
  function merge_schemas(existing, incoming, state_name) {
4953
- if (existing instanceof ZodObject && incoming instanceof ZodObject) {
4954
- const existing_shape = existing.shape;
4955
- const incoming_shape = incoming.shape;
4956
- for (const key of Object.keys(incoming_shape)) {
4957
- if (key in existing_shape) {
4958
- const existing_base = base_type_name(existing_shape[key]);
4959
- const incoming_base = base_type_name(incoming_shape[key]);
4960
- if (existing_base !== incoming_base) {
4961
- throw new Error(
4962
- `Schema conflict in "${state_name}": key "${key}" has type "${existing_base}" but incoming partial declares "${incoming_base}"`
4963
- );
4964
- }
4954
+ if (existing === incoming) return existing;
4955
+ const existing_object = as_object(existing, "existing", state_name);
4956
+ const incoming_object = as_object(incoming, "incoming", state_name);
4957
+ const existing_shape = existing_object.shape;
4958
+ const incoming_shape = incoming_object.shape;
4959
+ for (const key of Object.keys(incoming_shape)) {
4960
+ if (key in existing_shape) {
4961
+ const existing_base = base_type_name(existing_shape[key]);
4962
+ const incoming_base = base_type_name(incoming_shape[key]);
4963
+ if (existing_base !== incoming_base) {
4964
+ throw new Error(
4965
+ `Schema conflict in "${state_name}": key "${key}" has type "${existing_base}" but incoming partial declares "${incoming_base}"`
4966
+ );
4965
4967
  }
4966
4968
  }
4967
- return existing.extend(incoming_shape);
4968
4969
  }
4969
- return existing;
4970
+ return existing_object.extend(incoming_shape);
4971
+ }
4972
+ function as_object(schema, side, state_name) {
4973
+ if (schema instanceof ZodObject) return schema;
4974
+ throw new Error(
4975
+ `Cannot merge state schemas for "${state_name}": the ${side} partial's schema is a ${schema.constructor.name}, not a z.object. Partials of the same state are merged by extending their shapes, so declare every partial's state as a plain z.object({ ... }).`
4976
+ );
4970
4977
  }
4971
4978
  function merge_inits(existing, incoming) {
4972
4979
  return () => ({ ...existing(), ...incoming() });