@effectstream/db 0.100.27 → 0.100.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectstream/db",
3
- "version": "0.100.27",
3
+ "version": "0.100.28",
4
4
  "license": "MIT",
5
5
  "homepage": "https://effectstream.github.io/docs/",
6
6
  "repository": {
@@ -21,11 +21,11 @@
21
21
  "./version": "./migrations/system-version.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@effectstream/coroutine": "0.100.27",
25
- "@effectstream/log": "0.100.27",
26
- "@effectstream/runtime": "0.100.27",
27
- "@effectstream/sync": "0.100.27",
28
- "@effectstream/utils": "0.100.27",
24
+ "@effectstream/coroutine": "0.100.28",
25
+ "@effectstream/log": "0.100.28",
26
+ "@effectstream/runtime": "0.100.28",
27
+ "@effectstream/sync": "0.100.28",
28
+ "@effectstream/utils": "0.100.28",
29
29
  "@electric-sql/pglite": "^0.3.14",
30
30
  "@pgtyped/runtime": "2.4.2",
31
31
  "@pgtyped/parser": "2.4.2",
@@ -397,7 +397,7 @@ export interface IGetEarliestScheduledBlockHeightQuery {
397
397
  result: IGetEarliestScheduledBlockHeightResult;
398
398
  }
399
399
 
400
- const getEarliestScheduledBlockHeightIR: any = {"usedParamSet":{},"params":[],"statement":"SELECT MIN(rollup_input_future_block.future_block_height) AS min_block_height\nFROM effectstream.rollup_input_future_block\nLEFT OUTER JOIN effectstream.rollup_input_result\n ON rollup_input_result.id = rollup_input_future_block.id\nWHERE rollup_input_result.id IS NULL"};
400
+ const getEarliestScheduledBlockHeightIR: any = {"usedParamSet":{},"params":[],"statement":"SELECT MIN(rollup_input_future_block.future_block_height) AS min_block_height\nFROM effectstream.rollup_input_future_block\nLEFT OUTER JOIN effectstream.rollup_input_result\n ON rollup_input_result.id = rollup_input_future_block.id\nWHERE rollup_input_result.id IS NULL\n AND rollup_input_future_block.future_block_height >\n (SELECT COALESCE(MAX(block_height), 0) FROM effectstream.effectstream_blocks)"};
401
401
 
402
402
  /**
403
403
  * Query generated from SQL:
@@ -407,6 +407,8 @@ const getEarliestScheduledBlockHeightIR: any = {"usedParamSet":{},"params":[],"s
407
407
  * LEFT OUTER JOIN effectstream.rollup_input_result
408
408
  * ON rollup_input_result.id = rollup_input_future_block.id
409
409
  * WHERE rollup_input_result.id IS NULL
410
+ * AND rollup_input_future_block.future_block_height >
411
+ * (SELECT COALESCE(MAX(block_height), 0) FROM effectstream.effectstream_blocks)
410
412
  * ```
411
413
  */
412
414
  export const getEarliestScheduledBlockHeight = new PreparedQuery<IGetEarliestScheduledBlockHeightParams,IGetEarliestScheduledBlockHeightResult>(getEarliestScheduledBlockHeightIR);
@@ -151,11 +151,20 @@ WHERE rollup_input_future_timestamp.future_ms_timestamp <= :max_timestamp! AND
151
151
  ORDER BY rollup_input_future_timestamp.future_ms_timestamp ASC;
152
152
 
153
153
  /* @name getEarliestScheduledBlockHeight */
154
+ -- Earliest *upcoming* scheduled block (strictly above the last applied block).
155
+ -- The `> MAX(applied)` filter is load-bearing for empty-block coalescing: it must
156
+ -- never return a height at/below the head. A scheduled input left un-fired below
157
+ -- the head (e.g. one that was already skipped) would otherwise become the MIN and,
158
+ -- via the caller's `>= fromBlockNumber ? : null` fallback, collapse the coalescing
159
+ -- boundary to NULL — disabling the guard and causing every subsequent scheduled
160
+ -- input inside an empty run to be coalesced over (one orphan permanently breaks it).
154
161
  SELECT MIN(rollup_input_future_block.future_block_height) AS min_block_height
155
162
  FROM effectstream.rollup_input_future_block
156
163
  LEFT OUTER JOIN effectstream.rollup_input_result
157
164
  ON rollup_input_result.id = rollup_input_future_block.id
158
- WHERE rollup_input_result.id IS NULL;
165
+ WHERE rollup_input_result.id IS NULL
166
+ AND rollup_input_future_block.future_block_height >
167
+ (SELECT COALESCE(MAX(block_height), 0) FROM effectstream.effectstream_blocks);
159
168
 
160
169
  /* @name getEarliestScheduledTimestamp */
161
170
  SELECT MIN(rollup_input_future_timestamp.future_ms_timestamp) AS min_timestamp