@filelayer/core 0.4.0 → 0.4.1

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/CHANGELOG.md CHANGED
@@ -46,7 +46,8 @@ change with an additive API whose migration is `MIGRATIONS.md` Entry 2.
46
46
  `loadSchemaSql` are exported exactly as before, and production code — a
47
47
  `pg.Pool` (or anything satisfying `Queryable`) passed to `new Filelayer()` —
48
48
  never touches the removed dependency. If you use `quickstart()` or
49
- `createTestDb()`, add `npm install --save-dev @electric-sql/pglite`.
49
+ `createTestDb()`, add
50
+ `npm install --save-dev "@electric-sql/pglite@^0.3.11"`.
50
51
  - **`createTestDb()` without PGlite installed now explains itself.** It used to
51
52
  surface Node's raw `ERR_MODULE_NOT_FOUND` from inside `dist/`, naming a
52
53
  package the caller never asked for. It now throws an error that names
@@ -167,6 +168,101 @@ change with an additive API whose migration is `MIGRATIONS.md` Entry 2.
167
168
 
168
169
  ---
169
170
 
171
+ ## [0.4.1] — 2026-09-06
172
+
173
+ A single defect, in the first command a new user runs. Nothing else changed: no
174
+ API change, no schema change, no behaviour change. If you already have a working
175
+ install, this release does nothing for you.
176
+
177
+ ### Fixed
178
+
179
+ - **The documented command for installing PGlite could not resolve against the
180
+ peer range this package declares.** `0.4.0` declares
181
+ `peerDependencies: { "@electric-sql/pglite": "^0.3.11" }`, as an optional peer.
182
+ The install command in the `createTestDb()` error message, in `README.md`, in
183
+ `docs/QUICKSTART.md`, in `llms.txt` and in the changelog entry above carried no
184
+ version at all. PGlite's `latest` on npm is `0.5.8`, outside `^0.3.11`, so
185
+ following our own written instructions could put a version on disk that the
186
+ declared range does not admit — and npm then refuses the whole tree:
187
+
188
+ ```
189
+ npm error Could not resolve dependency:
190
+ npm error peerOptional @electric-sql/pglite@"^0.3.11" from @filelayer/core@0.4.0
191
+ ```
192
+
193
+ It is deterministic for anyone whose project already has PGlite, or who asks
194
+ for a specific version, and it is a hard stop about sixty seconds in. Every
195
+ install command in this repository is now version-explicit:
196
+
197
+ ```bash
198
+ npm install --save-dev "@electric-sql/pglite@^0.3.11"
199
+ ```
200
+
201
+ The quotes are for the shell, not for npm — `^` is a glob operator under `zsh`
202
+ with `extendedglob` and an escape character in `cmd.exe`, and a command that
203
+ breaks in a common shell is the same defect wearing a different hat.
204
+
205
+ ### Not changed, deliberately
206
+
207
+ - **The peer range is still `^0.3.11`. PGlite 0.5.x is not supported.** Before
208
+ choosing between widening the range and fixing the instructions, the full
209
+ suite was run against `0.5.8`. It does not pass. `tsc --noEmit` is clean and
210
+ every assertion that executes passes, but seven test files are killed by the
211
+ operating system and the run aborts after 92 of 313 tests. Reproduced in
212
+ isolation with 3.6 GB free, so it is not a plain out-of-memory: one suite runs
213
+ 20 of 21 subtests green and is then killed. Against `0.3.16` the identical
214
+ suite is 313 of 313.
215
+
216
+ We have not diagnosed it further, because the supported range is the decision
217
+ in front of us and the cause is upstream. What we will not do is widen the
218
+ range to whatever npm installs by default and describe an untested
219
+ configuration as supported. When 0.5.x passes, the range moves and this entry
220
+ gets a successor.
221
+
222
+ ### Added
223
+
224
+ - **`tools/check-install-commands.mjs`, wired into `npm run verify`.** It reads
225
+ every tracked file and fails the build if an install command names a
226
+ version-constrained package without a version constraint, or pins one to a
227
+ range that is not the range `packages/core/package.json` declares. The
228
+ comparison is semver intervals rather than string equality and runs in both
229
+ directions, so widening the peer range without updating the documentation
230
+ fails, and so does the reverse. No network and no install: it is a check on
231
+ what we wrote, evaluated against what we declared.
232
+
233
+ It carries a negative control that runs on every invocation, before the real
234
+ scan: fourteen commands whose correct classification is known — including the
235
+ exact unversioned command `0.4.0` shipped, in each of the five forms it was
236
+ written in — plus seven pieces of text that must *not* be read as install
237
+ commands. If the detector misclassifies any of them the check exits `2` and
238
+ says the detector is broken rather than reporting a clean repository. A
239
+ checker that has never rejected anything is a green tick of unknown value.
240
+
241
+ ### Changed
242
+
243
+ - **The release gate now runs the documented command instead of its own.**
244
+ `tools/verify-release.mjs` reads the install command out of `README.md` at run
245
+ time and executes that string in its empty consumer directory. It used to
246
+ write its own equivalent, which is why a green gate and a broken instruction
247
+ could coexist for a whole release: the gate was testing a command no user
248
+ would ever type.
249
+ - **The gate also installs in the other order.** Phases 1 and 2 install the
250
+ package first and PGlite second, and in that order npm can rescue a bad
251
+ instruction by quietly walking `latest` back into the peer range — which is
252
+ precisely how `0.4.0`'s command passed. A new phase does it the other way
253
+ round, in a second directory that has never contained anything: the documented
254
+ command first, then `@filelayer/core` on top. There is nothing left to rescue
255
+ there, so the resolution failure is either real or absent. It asserts, too,
256
+ that the version actually installed satisfies the declared range, because an
257
+ install that succeeds by giving the reader something other than what they
258
+ asked for is still a broken instruction.
259
+ - `README.md`, `docs/QUICKSTART.md` and the `createTestDb()` error message now
260
+ state the supported range in words as well as in the command: the 0.3.x line
261
+ is supported, 0.5.x is not, and the reason is that the suite does not pass
262
+ against it.
263
+
264
+ ---
265
+
170
266
  ## [0.4.0] — 2026-09-06
171
267
 
172
268
  ### Changed
@@ -178,9 +274,14 @@ change with an additive API whose migration is `MIGRATIONS.md` Entry 2.
178
274
  deployment; it did, and that was wrong.
179
275
  `createTestDb()` and `Filelayer.quickstart()` still need it, and now say so
180
276
  with an actionable message instead of a module-resolution error. If you use
181
- either in tests, add `npm install --save-dev @electric-sql/pglite`. Nothing
277
+ either in tests, add
278
+ `npm install --save-dev "@electric-sql/pglite@^0.3.11"`. Nothing
182
279
  else changes; production code paths never imported it.
183
280
 
281
+ *(The command in this entry originally omitted the version constraint. That
282
+ omission is the defect fixed in 0.4.1, and the command has been corrected here
283
+ so that nobody reading the history copies the broken one.)*
284
+
184
285
  ### Added
185
286
 
186
287
  - A CI job that exercises the S3/R2 storage adapter against live object storage
package/README.md CHANGED
@@ -195,9 +195,18 @@ declared as an *optional peer dependency* so that it never lands in a production
195
195
  otherwise — `createTestDb()` will tell you, by name, if you need it:
196
196
 
197
197
  ```bash
198
- npm install --save-dev @electric-sql/pglite
198
+ npm install --save-dev "@electric-sql/pglite@^0.3.11"
199
199
  ```
200
200
 
201
+ **Install PGlite with that version constraint.** Filelayer supports the
202
+ **0.3.x** line, which is what `peerDependencies` declares and what the suite runs
203
+ against. **0.5.x is not supported**: we ran the full suite against 0.5.8 and it
204
+ does not pass, so the range has not been widened. PGlite's `latest` on npm is a
205
+ 0.5.x release, so omitting the constraint can install a version outside the
206
+ supported range — and npm then refuses the whole tree with `ERESOLVE`. The quotes
207
+ are for your shell, not for npm: `^` is a glob operator under `zsh` with
208
+ `extendedglob` and an escape character in `cmd.exe`.
209
+
201
210
  ```ts
202
211
  import { Filelayer } from '@filelayer/core';
203
212
 
package/dist/db.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAMH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC;;;;OAIG;IACH,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACpE;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,EAAG,SAAQ,SAAS;IACnC,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AAA;KAAE,CAAC;IAC3C,GAAG,EAAE,OAAO,CAAC;CACd,CAAC,CAMD"}
package/dist/db.js CHANGED
@@ -214,6 +214,26 @@ export async function loadSchemaSql() {
214
214
  * inside our `dist`, and no indication that installing one thing fixes it.
215
215
  */
216
216
  const PGLITE = '@electric-sql/pglite';
217
+ /**
218
+ * The install command a caller is handed, spelled out in full.
219
+ *
220
+ * The version constraint is not decoration. PGlite's `latest` on npm is a 0.5.x
221
+ * release and this package declares `peerDependencies` of `^0.3.11`, so an
222
+ * install with no constraint on it can land a version outside the declared
223
+ * range -- at which point npm refuses the whole tree with ERESOLVE and the
224
+ * developer is stuck one minute in, having typed what we told them to type.
225
+ * That happened; it is the defect 0.4.1 fixes.
226
+ *
227
+ * The range is a literal rather than a template so that
228
+ * `tools/check-install-commands.mjs` can read it out of this file and fail the
229
+ * build if it ever stops matching `peerDependencies` in package.json. The two
230
+ * are the same fact written in two places, and the check is what keeps them
231
+ * one fact.
232
+ *
233
+ * The quotes are for the shell, not for npm: `^` is a glob operator under zsh
234
+ * with `extendedglob`, and an escape character in cmd.exe.
235
+ */
236
+ const PGLITE_INSTALL = 'npm install --save-dev "@electric-sql/pglite@^0.3.11"';
217
237
  /** True when `err` is Node refusing to resolve `spec`, and not some other failure. */
218
238
  function isModuleNotFound(err, spec) {
219
239
  const code = err?.code;
@@ -255,7 +275,13 @@ async function importPglite() {
255
275
  throw err;
256
276
  throw new Error(`createTestDb() needs "${PGLITE}", which is not installed.\n` +
257
277
  `\n` +
258
- ` npm install --save-dev ${PGLITE}\n` +
278
+ ` ${PGLITE_INSTALL}\n` +
279
+ `\n` +
280
+ `The version is part of the command. @filelayer/core supports the 0.3.x line\n` +
281
+ `of ${PGLITE}; 0.5.x is not supported, because the test suite does\n` +
282
+ `not pass against it. Installing without the constraint can resolve to a\n` +
283
+ `version outside the supported range, and npm then refuses the install with\n` +
284
+ `ERESOLVE rather than giving you a working tree.\n` +
259
285
  `\n` +
260
286
  `It is an OPTIONAL peer dependency of @filelayer/core, on purpose: it is an\n` +
261
287
  `embedded WASM PostgreSQL used by createTestDb() and Filelayer.quickstart()\n` +
package/dist/db.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAkC1C,MAAM,UAAU,IAAI,CAAC,EAAa;IAChC,OAAQ,EAAkB,CAAC,aAAa,KAAK,IAAI,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,KAAK,CAAU;IACxB,YAAY,KAAc;QACxB,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAWD,SAAS,MAAM,CAAC,EAAa;IAC3B,OAAO,OAAQ,EAAwB,CAAC,OAAO,KAAK,UAAU,CAAC;AACjE,CAAC;AACD,SAAS,QAAQ,CAAC,EAAa;IAC7B,OAAO,OAAQ,EAA0B,CAAC,WAAW,KAAK,UAAU,CAAC;AACvE,CAAC;AAED,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,EAAa,EACb,EAA0B;IAE1B,IAAI,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAEhD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AC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,EAAE,EAAE,EAAE,EAAuD,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAClF,CAAC;AAED,KAAK,UAAU,YAAY;IAIzB,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACvC,MAAM,CAAC,sBAAsB,CAAC;YAC9B,MAAM,CAAC,uCAAuC,CAAC;SAChD,CAAC,CAAC;QACH,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC5D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC;YAAE,MAAM,GAAG,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,yBAAyB,MAAM,8BAA8B;YAC3D,IAAI;YACJ,KAAK,cAAc,IAAI;YACvB,IAAI;YACJ,+EAA+E;YAC/E,MAAM,MAAM,yDAAyD;YACrE,2EAA2E;YAC3E,8EAA8E;YAC9E,mDAAmD;YACnD,IAAI;YACJ,8EAA8E;YAC9E,8EAA8E;YAC9E,8EAA8E;YAC9E,6DAA6D;YAC7D,IAAI;YACJ,oEAAoE;YACpE,IAAI;YACJ,gCAAgC;YAChC,4FAA4F;YAC5F,IAAI;YACJ,mCAAmC;YACnC,IAAI;YACJ,qEAAqE,EACvE,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filelayer/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Multi-tenant file authorization and lifecycle for Postgres: one decision point for public and private files, revocable URLs, delegated share links and a hash-chained audit trail.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/db.ts CHANGED
@@ -267,6 +267,27 @@ export async function loadSchemaSql(): Promise<string> {
267
267
  */
268
268
  const PGLITE = '@electric-sql/pglite';
269
269
 
270
+ /**
271
+ * The install command a caller is handed, spelled out in full.
272
+ *
273
+ * The version constraint is not decoration. PGlite's `latest` on npm is a 0.5.x
274
+ * release and this package declares `peerDependencies` of `^0.3.11`, so an
275
+ * install with no constraint on it can land a version outside the declared
276
+ * range -- at which point npm refuses the whole tree with ERESOLVE and the
277
+ * developer is stuck one minute in, having typed what we told them to type.
278
+ * That happened; it is the defect 0.4.1 fixes.
279
+ *
280
+ * The range is a literal rather than a template so that
281
+ * `tools/check-install-commands.mjs` can read it out of this file and fail the
282
+ * build if it ever stops matching `peerDependencies` in package.json. The two
283
+ * are the same fact written in two places, and the check is what keeps them
284
+ * one fact.
285
+ *
286
+ * The quotes are for the shell, not for npm: `^` is a glob operator under zsh
287
+ * with `extendedglob`, and an escape character in cmd.exe.
288
+ */
289
+ const PGLITE_INSTALL = 'npm install --save-dev "@electric-sql/pglite@^0.3.11"';
290
+
270
291
  /** True when `err` is Node refusing to resolve `spec`, and not some other failure. */
271
292
  function isModuleNotFound(err: unknown, spec: string): boolean {
272
293
  const code = (err as { code?: unknown } | null)?.code;
@@ -314,7 +335,13 @@ async function importPglite(): Promise<{
314
335
  throw new Error(
315
336
  `createTestDb() needs "${PGLITE}", which is not installed.\n` +
316
337
  `\n` +
317
- ` npm install --save-dev ${PGLITE}\n` +
338
+ ` ${PGLITE_INSTALL}\n` +
339
+ `\n` +
340
+ `The version is part of the command. @filelayer/core supports the 0.3.x line\n` +
341
+ `of ${PGLITE}; 0.5.x is not supported, because the test suite does\n` +
342
+ `not pass against it. Installing without the constraint can resolve to a\n` +
343
+ `version outside the supported range, and npm then refuses the install with\n` +
344
+ `ERESOLVE rather than giving you a working tree.\n` +
318
345
  `\n` +
319
346
  `It is an OPTIONAL peer dependency of @filelayer/core, on purpose: it is an\n` +
320
347
  `embedded WASM PostgreSQL used by createTestDb() and Filelayer.quickstart()\n` +