@filelayer/core 0.4.0 → 0.4.2
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 +223 -41
- package/README.md +16 -9
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +27 -1
- package/dist/db.js.map +1 -1
- package/dist/filelayer.d.ts +22 -9
- package/dist/filelayer.d.ts.map +1 -1
- package/dist/filelayer.js +21 -2
- package/dist/filelayer.js.map +1 -1
- package/dist/simple.d.ts +1 -1
- package/dist/store.d.ts +98 -7
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +115 -18
- package/dist/store.js.map +1 -1
- package/package.json +1 -1
- package/src/db.ts +28 -1
- package/src/filelayer.ts +25 -11
- package/src/store.ts +243 -28
- package/test/audit-resolution.test.ts +379 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,25 +7,234 @@ Versioning is pre-1.0 and is explained in [`MIGRATIONS.md`](MIGRATIONS.md) §1.
|
|
|
7
7
|
|
|
8
8
|
## A note on honesty, before the entries
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
are writing them up as a changelog rather than starting the history at the first
|
|
13
|
-
publish because a consumer deciding whether to depend on a `0.x` library is
|
|
14
|
-
entitled to know what has already moved underneath it, and because most of the
|
|
15
|
-
entries are security defects we found in our own code.
|
|
16
|
-
|
|
17
|
-
They are described the way we found them, including the ones that were
|
|
10
|
+
Most of the entries below are security defects we found in our own code, and
|
|
11
|
+
they are described the way we found them, including the ones that were
|
|
18
12
|
embarrassing. A changelog that only records features is a marketing document.
|
|
19
13
|
|
|
20
|
-
`0.3.0`
|
|
14
|
+
`0.3.0` was the first version published to npm, under the `alpha` dist-tag.
|
|
15
|
+
`0.1.0` and `0.2.0` predate the registry: they are real, dated development
|
|
16
|
+
milestones in this repository rather than releases anyone could install. They
|
|
17
|
+
are written up anyway, because a consumer deciding whether to depend on a `0.x`
|
|
18
|
+
library is entitled to know what has already moved underneath it.
|
|
21
19
|
|
|
22
20
|
---
|
|
23
21
|
|
|
24
22
|
## [Unreleased]
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
Nothing yet.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## [0.4.2] — 2026-09-06
|
|
29
|
+
|
|
30
|
+
The audit log now answers in your identifiers instead of ours. No schema
|
|
31
|
+
change, no API break, no change to any authorization decision.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **`auditLog()` answers "who touched this?" in the caller's own vocabulary.**
|
|
36
|
+
The log stored `actor_id`, `file_id` and `org_id` — internal uuids — and
|
|
37
|
+
shipped no supported way back to the ids the caller had supplied. So the one
|
|
38
|
+
question the audit trail exists to answer rendered as
|
|
39
|
+
`97cf1649-dd8...` where the developer had written `marco`, and the only route
|
|
40
|
+
to a readable answer was to find the `actor` table in `schema.sql` and write
|
|
41
|
+
SQL against it. The first developer to try it from the public docs lost about
|
|
42
|
+
eight minutes there, on the step this product is *for*.
|
|
43
|
+
|
|
44
|
+
Every row returned by `fl.auditLog()` (and therefore by `fl.orgs.audit()`) is
|
|
45
|
+
now a `ResolvedAuditRow`, which is `AuditRow` **plus** four fields:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const [row] = await fl.orgs.audit('acme', { as: 'ceo', decision: 'deny' });
|
|
49
|
+
|
|
50
|
+
row.summary; // '2026-09-06T10:12:41.002Z marco file.read deny:grant_revoked contract.pdf @acme'
|
|
51
|
+
row.actor.label; // 'marco' — the `as:` that was passed
|
|
52
|
+
row.file.label; // 'contract.pdf'
|
|
53
|
+
row.org.label; // 'acme' — the `org:` that was passed
|
|
54
|
+
row.actorId; // the uuid, unchanged, exactly where it has always been
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- **Additive, deliberately.** Every internal id is still on the row, in the
|
|
58
|
+
same field, with the same value. Something downstream may be keyed on them;
|
|
59
|
+
replacing them would have been a breaking change wearing a usability
|
|
60
|
+
costume.
|
|
61
|
+
- **`label` is never null**, so a row always prints. An access with no
|
|
62
|
+
principal — a share link, a public URL — reads as `anonymous` rather than a
|
|
63
|
+
null the caller has to interpret. An event with no tenant (the system
|
|
64
|
+
chain, `org_id IS NULL`) reads as `system`. An id that resolves to nothing
|
|
65
|
+
keeps its uuid and says `resolution: 'unresolved'` rather than inventing a
|
|
66
|
+
name. `.actor.externalId`, `.org.externalId` and `.file.name` are the same
|
|
67
|
+
values without the fallback, for callers who want the null.
|
|
68
|
+
- **It is still one query.** Resolution is three `LEFT JOIN`s on the statement
|
|
69
|
+
that already reads the events, not a lookup per row: an audit read happens
|
|
70
|
+
during an incident, and turning it into N+1 round trips would be a worse
|
|
71
|
+
defect than the one being fixed.
|
|
72
|
+
- **The joins are project-scoped (P8).** An audit event may legitimately name
|
|
73
|
+
an identifier belonging to another application — that is what a probe looks
|
|
74
|
+
like — and such an id must resolve to nothing rather than print another
|
|
75
|
+
customer's vocabulary into this tenant's trail.
|
|
76
|
+
- `packages/core/test/audit-resolution.test.ts` covers the legible answer, a
|
|
77
|
+
denial with its reason and the principal who was refused, anonymous access,
|
|
78
|
+
the system chain, the project boundary, and the single-statement claim.
|
|
79
|
+
|
|
80
|
+
### Fixed — documentation
|
|
81
|
+
|
|
82
|
+
- **`packages/core/CHANGELOG.md` asserted in bold that "No version of this
|
|
83
|
+
package has been published to npm", directly above dated entries for `0.3.0`,
|
|
84
|
+
`0.4.0` and `0.4.1`, all of which are on the registry.** It was true when it
|
|
85
|
+
was written and nobody deleted it at the first publish. The same staleness had
|
|
86
|
+
left everything shipped in `0.3.0` and `0.4.0` sitting under an
|
|
87
|
+
`[Unreleased]` heading; that material is now filed under the releases it went
|
|
88
|
+
out in, with its text unchanged.
|
|
89
|
+
- `llms.txt` announced the current version as `0.3.0`, and `README.md` dated its
|
|
90
|
+
Limitations list "current as of `0.3.0`". Both are `0.4.2`.
|
|
91
|
+
- The HTML comment in `README.md` explaining that the CI and npm badges "render
|
|
92
|
+
as unknown until the repository is pushed and the package is published" has
|
|
93
|
+
outlived both conditions and is gone.
|
|
94
|
+
- `TRUST.md` and `README.md` both put the suite at 313 tests. It is 324.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## [0.4.1] — 2026-09-06
|
|
99
|
+
|
|
100
|
+
A single defect, in the first command a new user runs. Nothing else changed: no
|
|
101
|
+
API change, no schema change, no behaviour change. If you already have a working
|
|
102
|
+
install, this release does nothing for you.
|
|
103
|
+
|
|
104
|
+
### Fixed
|
|
105
|
+
|
|
106
|
+
- **The documented command for installing PGlite could not resolve against the
|
|
107
|
+
peer range this package declares.** `0.4.0` declares
|
|
108
|
+
`peerDependencies: { "@electric-sql/pglite": "^0.3.11" }`, as an optional peer.
|
|
109
|
+
The install command in the `createTestDb()` error message, in `README.md`, in
|
|
110
|
+
`docs/QUICKSTART.md`, in `llms.txt` and in the changelog entry above carried no
|
|
111
|
+
version at all. PGlite's `latest` on npm is `0.5.8`, outside `^0.3.11`, so
|
|
112
|
+
following our own written instructions could put a version on disk that the
|
|
113
|
+
declared range does not admit — and npm then refuses the whole tree:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
npm error Could not resolve dependency:
|
|
117
|
+
npm error peerOptional @electric-sql/pglite@"^0.3.11" from @filelayer/core@0.4.0
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
It is deterministic for anyone whose project already has PGlite, or who asks
|
|
121
|
+
for a specific version, and it is a hard stop about sixty seconds in. Every
|
|
122
|
+
install command in this repository is now version-explicit:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm install --save-dev "@electric-sql/pglite@^0.3.11"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The quotes are for the shell, not for npm — `^` is a glob operator under `zsh`
|
|
129
|
+
with `extendedglob` and an escape character in `cmd.exe`, and a command that
|
|
130
|
+
breaks in a common shell is the same defect wearing a different hat.
|
|
131
|
+
|
|
132
|
+
### Not changed, deliberately
|
|
133
|
+
|
|
134
|
+
- **The peer range is still `^0.3.11`. PGlite 0.5.x is not supported.** Before
|
|
135
|
+
choosing between widening the range and fixing the instructions, the full
|
|
136
|
+
suite was run against `0.5.8`. It does not pass. `tsc --noEmit` is clean and
|
|
137
|
+
every assertion that executes passes, but seven test files are killed by the
|
|
138
|
+
operating system and the run aborts after 92 of 313 tests. Reproduced in
|
|
139
|
+
isolation with 3.6 GB free, so it is not a plain out-of-memory: one suite runs
|
|
140
|
+
20 of 21 subtests green and is then killed. Against `0.3.16` the identical
|
|
141
|
+
suite is 313 of 313.
|
|
142
|
+
|
|
143
|
+
We have not diagnosed it further, because the supported range is the decision
|
|
144
|
+
in front of us and the cause is upstream. What we will not do is widen the
|
|
145
|
+
range to whatever npm installs by default and describe an untested
|
|
146
|
+
configuration as supported. When 0.5.x passes, the range moves and this entry
|
|
147
|
+
gets a successor.
|
|
148
|
+
|
|
149
|
+
### Added
|
|
150
|
+
|
|
151
|
+
- **`tools/check-install-commands.mjs`, wired into `npm run verify`.** It reads
|
|
152
|
+
every tracked file and fails the build if an install command names a
|
|
153
|
+
version-constrained package without a version constraint, or pins one to a
|
|
154
|
+
range that is not the range `packages/core/package.json` declares. The
|
|
155
|
+
comparison is semver intervals rather than string equality and runs in both
|
|
156
|
+
directions, so widening the peer range without updating the documentation
|
|
157
|
+
fails, and so does the reverse. No network and no install: it is a check on
|
|
158
|
+
what we wrote, evaluated against what we declared.
|
|
159
|
+
|
|
160
|
+
It carries a negative control that runs on every invocation, before the real
|
|
161
|
+
scan: fourteen commands whose correct classification is known — including the
|
|
162
|
+
exact unversioned command `0.4.0` shipped, in each of the five forms it was
|
|
163
|
+
written in — plus seven pieces of text that must *not* be read as install
|
|
164
|
+
commands. If the detector misclassifies any of them the check exits `2` and
|
|
165
|
+
says the detector is broken rather than reporting a clean repository. A
|
|
166
|
+
checker that has never rejected anything is a green tick of unknown value.
|
|
167
|
+
|
|
168
|
+
### Changed
|
|
169
|
+
|
|
170
|
+
- **The release gate now runs the documented command instead of its own.**
|
|
171
|
+
`tools/verify-release.mjs` reads the install command out of `README.md` at run
|
|
172
|
+
time and executes that string in its empty consumer directory. It used to
|
|
173
|
+
write its own equivalent, which is why a green gate and a broken instruction
|
|
174
|
+
could coexist for a whole release: the gate was testing a command no user
|
|
175
|
+
would ever type.
|
|
176
|
+
- **The gate also installs in the other order.** Phases 1 and 2 install the
|
|
177
|
+
package first and PGlite second, and in that order npm can rescue a bad
|
|
178
|
+
instruction by quietly walking `latest` back into the peer range — which is
|
|
179
|
+
precisely how `0.4.0`'s command passed. A new phase does it the other way
|
|
180
|
+
round, in a second directory that has never contained anything: the documented
|
|
181
|
+
command first, then `@filelayer/core` on top. There is nothing left to rescue
|
|
182
|
+
there, so the resolution failure is either real or absent. It asserts, too,
|
|
183
|
+
that the version actually installed satisfies the declared range, because an
|
|
184
|
+
install that succeeds by giving the reader something other than what they
|
|
185
|
+
asked for is still a broken instruction.
|
|
186
|
+
- `README.md`, `docs/QUICKSTART.md` and the `createTestDb()` error message now
|
|
187
|
+
state the supported range in words as well as in the command: the 0.3.x line
|
|
188
|
+
is supported, 0.5.x is not, and the reason is that the suite does not pass
|
|
189
|
+
against it.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## [0.4.0] — 2026-09-06
|
|
194
|
+
|
|
195
|
+
### Changed
|
|
196
|
+
|
|
197
|
+
- **`@electric-sql/pglite` is no longer a runtime dependency.** It is now a
|
|
198
|
+
dev dependency and an *optional* peer. The published package declares zero
|
|
199
|
+
runtime dependencies. A library whose premise is "run it against your own
|
|
200
|
+
Postgres" should not install an embedded WASM Postgres into every production
|
|
201
|
+
deployment; it did, and that was wrong.
|
|
202
|
+
`createTestDb()` and `Filelayer.quickstart()` still need it, and now say so
|
|
203
|
+
with an actionable message instead of a module-resolution error. If you use
|
|
204
|
+
either in tests, add
|
|
205
|
+
`npm install --save-dev "@electric-sql/pglite@^0.3.11"`. Nothing
|
|
206
|
+
else changes; production code paths never imported it.
|
|
207
|
+
|
|
208
|
+
*(The command in this entry originally omitted the version constraint. That
|
|
209
|
+
omission is the defect fixed in 0.4.1, and the command has been corrected here
|
|
210
|
+
so that nobody reading the history copies the broken one.)*
|
|
211
|
+
|
|
212
|
+
### Added
|
|
213
|
+
|
|
214
|
+
- A CI job that exercises the S3/R2 storage adapter against live object storage
|
|
215
|
+
when credentials are configured, and states plainly in the build summary when
|
|
216
|
+
they are not. See `docs/LIVE-S3-TESTS.md`.
|
|
217
|
+
- `TRUST.md` — the current state of this project in numbers, including the ones
|
|
218
|
+
that are zero, and what would change them.
|
|
219
|
+
|
|
220
|
+
### Fixed
|
|
221
|
+
|
|
222
|
+
- `FILELAYER_TEST_S3_PREFIX` used `??` rather than `||`, so the empty string CI
|
|
223
|
+
supplies for an unset variable became a real value and rooted test objects at
|
|
224
|
+
the bucket root instead of under the prefix cleanup deletes.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Detail for 0.4.0 and 0.3.0
|
|
229
|
+
|
|
230
|
+
Everything below shipped. It was written under an `[Unreleased]` heading and
|
|
231
|
+
stayed there through two releases; the heading was wrong, the text was not, so
|
|
232
|
+
the text is kept verbatim and correctly filed. **Packaging** — the published
|
|
233
|
+
tarball having no runtime dependencies — and the live-storage CI job are
|
|
234
|
+
`0.4.0`. **Group grant subjects** (RFC-001), the byte-range status fix and the
|
|
235
|
+
`getActorGrants` ordering fix are `0.3.0`. The dated entries above and below are
|
|
236
|
+
the short form of the same work; this is the long form, kept because it is where
|
|
237
|
+
the reasoning is.
|
|
29
238
|
|
|
30
239
|
### Changed — packaging
|
|
31
240
|
|
|
@@ -46,7 +255,8 @@ change with an additive API whose migration is `MIGRATIONS.md` Entry 2.
|
|
|
46
255
|
`loadSchemaSql` are exported exactly as before, and production code — a
|
|
47
256
|
`pg.Pool` (or anything satisfying `Queryable`) passed to `new Filelayer()` —
|
|
48
257
|
never touches the removed dependency. If you use `quickstart()` or
|
|
49
|
-
`createTestDb()`, add
|
|
258
|
+
`createTestDb()`, add
|
|
259
|
+
`npm install --save-dev "@electric-sql/pglite@^0.3.11"`.
|
|
50
260
|
- **`createTestDb()` without PGlite installed now explains itself.** It used to
|
|
51
261
|
surface Node's raw `ERR_MODULE_NOT_FOUND` from inside `dist/`, naming a
|
|
52
262
|
package the caller never asked for. It now throws an error that names
|
|
@@ -167,34 +377,6 @@ change with an additive API whose migration is `MIGRATIONS.md` Entry 2.
|
|
|
167
377
|
|
|
168
378
|
---
|
|
169
379
|
|
|
170
|
-
## [0.4.0] — 2026-09-06
|
|
171
|
-
|
|
172
|
-
### Changed
|
|
173
|
-
|
|
174
|
-
- **`@electric-sql/pglite` is no longer a runtime dependency.** It is now a
|
|
175
|
-
dev dependency and an *optional* peer. The published package declares zero
|
|
176
|
-
runtime dependencies. A library whose premise is "run it against your own
|
|
177
|
-
Postgres" should not install an embedded WASM Postgres into every production
|
|
178
|
-
deployment; it did, and that was wrong.
|
|
179
|
-
`createTestDb()` and `Filelayer.quickstart()` still need it, and now say so
|
|
180
|
-
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
|
|
182
|
-
else changes; production code paths never imported it.
|
|
183
|
-
|
|
184
|
-
### Added
|
|
185
|
-
|
|
186
|
-
- A CI job that exercises the S3/R2 storage adapter against live object storage
|
|
187
|
-
when credentials are configured, and states plainly in the build summary when
|
|
188
|
-
they are not. See `docs/LIVE-S3-TESTS.md`.
|
|
189
|
-
- `TRUST.md` — the current state of this project in numbers, including the ones
|
|
190
|
-
that are zero, and what would change them.
|
|
191
|
-
|
|
192
|
-
### Fixed
|
|
193
|
-
|
|
194
|
-
- `FILELAYER_TEST_S3_PREFIX` used `??` rather than `||`, so the empty string CI
|
|
195
|
-
supplies for an unset variable became a real value and rooted test objects at
|
|
196
|
-
the bucket root instead of under the prefix cleanup deletes.
|
|
197
|
-
|
|
198
380
|
## [0.3.0] — 2026-09-05
|
|
199
381
|
|
|
200
382
|
The release that makes the package installable, and the one that closes the
|
package/README.md
CHANGED
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
[](https://nodejs.org)
|
|
6
6
|
[](https://github.com/filelayer/filelayer/blob/main/LICENSE)
|
|
7
7
|
|
|
8
|
-
<!--
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
namespaces are unclaimed and reserved for this project, so the badges
|
|
12
|
-
resolve on their own with no edit here. The licence badge is live now. -->
|
|
8
|
+
<!-- Every URL on this page is rooted at github.com/filelayer/filelayer and
|
|
9
|
+
npmjs.com/package/@filelayer/core, so the badges resolve on their own with
|
|
10
|
+
no edit here. -->
|
|
13
11
|
|
|
14
12
|
> ## ⚠️ Alpha — developer preview. Not production software.
|
|
15
13
|
|
|
@@ -154,7 +152,7 @@ engine, not by convention, and each has tests named after it.
|
|
|
154
152
|
| **P2** | No ambient authority | Knowing an object key, a URL or a file id grants nothing. Storage location is never an input to a decision. |
|
|
155
153
|
| **P3** | Structural tenant isolation | A grant's `org_id` must equal its file's `org_id`, enforced by a composite foreign key. Cross-tenant access is unrepresentable, not merely prevented by a `WHERE` clause. |
|
|
156
154
|
| **P4** | A URL never outlives its permission | Every signed URL embeds a grant id and is re-validated on **every** request, transitively through the whole delegation chain. Revocation beats a live URL. |
|
|
157
|
-
| **P5** | Every decision is audited, including denials | Hash-chained per tenant. Probes that cannot be attributed to a tenant go to a system chain rather than being dropped. |
|
|
155
|
+
| **P5** | Every decision is audited, including denials | Hash-chained per tenant. Probes that cannot be attributed to a tenant go to a system chain rather than being dropped. The log answers in *your* identifiers — `marco`, `contract.pdf`, `acme` — alongside the internal ones, so "who accessed this?" needs no SQL of yours. |
|
|
158
156
|
|
|
159
157
|
Three more properties are enforced in the schema and documented in
|
|
160
158
|
[`packages/core/SEMANTICS.md`](https://github.com/filelayer/filelayer/blob/main/packages/core/SEMANTICS.md): atomic download
|
|
@@ -195,9 +193,18 @@ declared as an *optional peer dependency* so that it never lands in a production
|
|
|
195
193
|
otherwise — `createTestDb()` will tell you, by name, if you need it:
|
|
196
194
|
|
|
197
195
|
```bash
|
|
198
|
-
npm install --save-dev @electric-sql/pglite
|
|
196
|
+
npm install --save-dev "@electric-sql/pglite@^0.3.11"
|
|
199
197
|
```
|
|
200
198
|
|
|
199
|
+
**Install PGlite with that version constraint.** Filelayer supports the
|
|
200
|
+
**0.3.x** line, which is what `peerDependencies` declares and what the suite runs
|
|
201
|
+
against. **0.5.x is not supported**: we ran the full suite against 0.5.8 and it
|
|
202
|
+
does not pass, so the range has not been widened. PGlite's `latest` on npm is a
|
|
203
|
+
0.5.x release, so omitting the constraint can install a version outside the
|
|
204
|
+
supported range — and npm then refuses the whole tree with `ERESOLVE`. The quotes
|
|
205
|
+
are for your shell, not for npm: `^` is a glob operator under `zsh` with
|
|
206
|
+
`extendedglob` and an escape character in `cmd.exe`.
|
|
207
|
+
|
|
201
208
|
```ts
|
|
202
209
|
import { Filelayer } from '@filelayer/core';
|
|
203
210
|
|
|
@@ -221,7 +228,7 @@ running in-process, so there is no daemon and no Docker:
|
|
|
221
228
|
```bash
|
|
222
229
|
git clone https://github.com/filelayer/filelayer && cd filelayer
|
|
223
230
|
npm run bootstrap # npm ci in packages/core
|
|
224
|
-
npm test # the security property suite,
|
|
231
|
+
npm test # the security property suite, 324 tests
|
|
225
232
|
npm run typecheck
|
|
226
233
|
npm run verify # typecheck + tests + build + doc and language checks
|
|
227
234
|
npm run example:tier1 # a public avatar, on :3000
|
|
@@ -318,7 +325,7 @@ README says is the most valuable thing you can send us.
|
|
|
318
325
|
## Limitations
|
|
319
326
|
|
|
320
327
|
Restated here so they are not only in an appendix. Each one is current as of
|
|
321
|
-
`0.
|
|
328
|
+
`0.4.2`; where a limitation has been lifted since an earlier release, the
|
|
322
329
|
[changelog](https://github.com/filelayer/filelayer/blob/main/packages/core/CHANGELOG.md) says so.
|
|
323
330
|
|
|
324
331
|
1. **No `Range` responses from the shipped HTTP routes.** `f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,OAAO,CAAC,CAAC,CAAC,CAAC;CAChD;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,SAAS,GAAG,EAAE,IAAI,EAAE,CAE5C;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;gBACZ,KAAK,EAAE,OAAO;CAK3B;AAoBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACrC,EAAE,EAAE,SAAS,EACb,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,CAAC,CAAC,CAqCZ;AA6CD,eAAO,MAAM,WAAW,QAAiC,CAAC;AAE1D,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAErD;AAiDD;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC;IAC5C,EAAE,EAAE,SAAS,GAAG;QAAE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;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
|
-
`
|
|
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,OA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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/dist/filelayer.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import { type Capability, type FileRef, type FileVisibility, type GrantSubjectType, type OrgRole, type Principal } from './authz.ts';
|
|
29
29
|
import { type Queryable } from './db.ts';
|
|
30
|
-
import { PostgresStore, type
|
|
30
|
+
import { PostgresStore, type AuditFilter, type AuditChainResult, type ResolvedAuditRow } from './store.ts';
|
|
31
31
|
import { type PutBody, type StorageAdapter } from './storage.ts';
|
|
32
32
|
import { FilesApi, OrgsApi, SharesApi } from './simple.ts';
|
|
33
33
|
import { type Disposition, type RedirectDeliveryConfig, type StreamedDelivery } from './delivery.ts';
|
|
@@ -491,14 +491,27 @@ export declare class Filelayer {
|
|
|
491
491
|
file: FileRecord;
|
|
492
492
|
remainingDownloads: number | null;
|
|
493
493
|
}>;
|
|
494
|
-
/**
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
494
|
+
/**
|
|
495
|
+
* "Who touched this?", answered in the words the caller used.
|
|
496
|
+
*
|
|
497
|
+
* Requires `read_audit` in the org, which is admin+. Asked of the engine.
|
|
498
|
+
*
|
|
499
|
+
* Each row is a `ResolvedAuditRow`: the stored `actorId`, `fileId` and
|
|
500
|
+
* `orgId` are present and unchanged, and alongside them are `.actor`,
|
|
501
|
+
* `.file` and `.org`, carrying the external ids the caller supplied, plus a
|
|
502
|
+
* `.summary` line that prints as an answer:
|
|
503
|
+
*
|
|
504
|
+
* ```text
|
|
505
|
+
* 2026-09-06T10:12:41.002Z marco file.read deny:grant_revoked contract.pdf @acme
|
|
506
|
+
* ```
|
|
507
|
+
*
|
|
508
|
+
* Resolution is a join on the same statement, so this remains one query.
|
|
509
|
+
* `.actor.label` is `'anonymous'` for a link redemption, `.org.label` is
|
|
510
|
+
* `'system'` on the system chain, and an id that resolves to nothing in this
|
|
511
|
+
* project (a probe) keeps the uuid as its label with `resolution:
|
|
512
|
+
* 'unresolved'` -- there is no null to interpret and nothing is invented.
|
|
513
|
+
*/
|
|
514
|
+
auditLog(principal: Principal, orgId: string, filter?: AuditFilter): Promise<ResolvedAuditRow[]>;
|
|
502
515
|
/**
|
|
503
516
|
* Verify the tamper-evidence chain for an org.
|
|
504
517
|
*
|
package/dist/filelayer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filelayer.d.ts","sourceRoot":"","sources":["../src/filelayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EAUL,KAAK,UAAU,EAEf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,SAAS,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,aAAa,EAMb,KAAK,
|
|
1
|
+
{"version":3,"file":"filelayer.d.ts","sourceRoot":"","sources":["../src/filelayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EAUL,KAAK,UAAU,EAEf,KAAK,OAAO,EACZ,K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IACvC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAqCD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAKhE"}
|
package/dist/filelayer.js
CHANGED
|
@@ -1212,14 +1212,33 @@ export class Filelayer {
|
|
|
1212
1212
|
// ---------------------------------------------------------------------------
|
|
1213
1213
|
// Audit
|
|
1214
1214
|
// ---------------------------------------------------------------------------
|
|
1215
|
-
/**
|
|
1215
|
+
/**
|
|
1216
|
+
* "Who touched this?", answered in the words the caller used.
|
|
1217
|
+
*
|
|
1218
|
+
* Requires `read_audit` in the org, which is admin+. Asked of the engine.
|
|
1219
|
+
*
|
|
1220
|
+
* Each row is a `ResolvedAuditRow`: the stored `actorId`, `fileId` and
|
|
1221
|
+
* `orgId` are present and unchanged, and alongside them are `.actor`,
|
|
1222
|
+
* `.file` and `.org`, carrying the external ids the caller supplied, plus a
|
|
1223
|
+
* `.summary` line that prints as an answer:
|
|
1224
|
+
*
|
|
1225
|
+
* ```text
|
|
1226
|
+
* 2026-09-06T10:12:41.002Z marco file.read deny:grant_revoked contract.pdf @acme
|
|
1227
|
+
* ```
|
|
1228
|
+
*
|
|
1229
|
+
* Resolution is a join on the same statement, so this remains one query.
|
|
1230
|
+
* `.actor.label` is `'anonymous'` for a link redemption, `.org.label` is
|
|
1231
|
+
* `'system'` on the system chain, and an id that resolves to nothing in this
|
|
1232
|
+
* project (a probe) keeps the uuid as its label with `resolution:
|
|
1233
|
+
* 'unresolved'` -- there is no null to interpret and nothing is invented.
|
|
1234
|
+
*/
|
|
1216
1235
|
async auditLog(principal, orgId, filter = {}) {
|
|
1217
1236
|
const decision = await authorizeOrg(this.store, principal, orgId, 'read_audit', {
|
|
1218
1237
|
action: 'audit.read',
|
|
1219
1238
|
emitAllow: false, // reading the log should not spam the log
|
|
1220
1239
|
});
|
|
1221
1240
|
this.#raise(decision);
|
|
1222
|
-
return this.store.
|
|
1241
|
+
return this.store.listAuditResolved(orgId, filter);
|
|
1223
1242
|
}
|
|
1224
1243
|
/**
|
|
1225
1244
|
* Verify the tamper-evidence chain for an org.
|