foldkit-guard 0.11.0 → 0.12.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.
- package/README.md +157 -85
- package/dist/agent.d.mts +9 -6
- package/dist/agent.d.mts.map +1 -1
- package/dist/agent.mjs +21 -13
- package/dist/agent.mjs.map +1 -1
- package/dist/{attach-CJl-GtbN.d.mts → attach-CER19mzk.d.mts} +46 -9
- package/dist/attach-CER19mzk.d.mts.map +1 -0
- package/dist/{attach-CEGlbWu5.mjs → attach-DlrBpxOl.mjs} +33 -3
- package/dist/attach-DlrBpxOl.mjs.map +1 -0
- package/dist/{condition-dNSbUHzE.mjs → condition-VNIr9gDe.mjs} +2 -4
- package/dist/condition-VNIr9gDe.mjs.map +1 -0
- package/dist/drizzle.d.mts +1 -1
- package/dist/drizzle.mjs +7 -4
- package/dist/drizzle.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{may-DprCmMgK.mjs → may-Bd6O91A-.mjs} +62 -20
- package/dist/may-Bd6O91A-.mjs.map +1 -0
- package/dist/{me-C-gX1paZ.mjs → me-Bv7I0EcH.mjs} +3 -3
- package/dist/{me-C-gX1paZ.mjs.map → me-Bv7I0EcH.mjs.map} +1 -1
- package/dist/media.d.mts +1 -1
- package/dist/{placed-CGyo-NRR.mjs → placed-Dt05PaWi.mjs} +2 -2
- package/dist/{placed-CGyo-NRR.mjs.map → placed-Dt05PaWi.mjs.map} +1 -1
- package/dist/server.d.mts +9 -2
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +96 -73
- package/dist/server.mjs.map +1 -1
- package/dist/sync.d.mts +5 -3
- package/dist/sync.d.mts.map +1 -1
- package/dist/sync.mjs +10 -6
- package/dist/sync.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/attach-CEGlbWu5.mjs.map +0 -1
- package/dist/attach-CJl-GtbN.d.mts.map +0 -1
- package/dist/condition-dNSbUHzE.mjs.map +0 -1
- package/dist/may-DprCmMgK.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -14,7 +14,9 @@ server:
|
|
|
14
14
|
server, so it never ships to the browser;
|
|
15
15
|
- a **row guard** is an `Expr` over one Entity's fields, with the principal's
|
|
16
16
|
fields as inputs. It is data, so the SQL compiler and `evaluate` run it, and
|
|
17
|
-
the client may hold it without learning anything a query does not.
|
|
17
|
+
the client may hold it without learning anything a query does not. The
|
|
18
|
+
language is the one queries and invariants are written in; see the
|
|
19
|
+
[Expressions guide](../../docs/expressions.md).
|
|
18
20
|
|
|
19
21
|
## What it owns, and what it does not
|
|
20
22
|
|
|
@@ -32,21 +34,34 @@ reads (`may`) is the server's answer, or the client's reading of the shared
|
|
|
32
34
|
rules for a row it just wrote, and the server checks every write again when
|
|
33
35
|
it is made.
|
|
34
36
|
|
|
37
|
+
Use a guard for a rule about **who**: one that depends on the principal, or on
|
|
38
|
+
the principal and the row, and that must hold on every seam at once. A rule
|
|
39
|
+
about **what** a row may hold, whoever writes it, is an invariant
|
|
40
|
+
(`Entity.invariant`): an owner cannot skip one, and the two are refused apart
|
|
41
|
+
(`Forbidden` against `Invalid`).
|
|
42
|
+
[One domain declaration](../../docs/entity.md) shows both on one Entity, and
|
|
43
|
+
[Auth and Guard](../../docs/auth-and-guard.md) follows a sign-in through to a
|
|
44
|
+
guarded row; this README is the reference for each seam.
|
|
45
|
+
|
|
35
46
|
## Mental model
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Guards.declare
|
|
40
|
-
Guards.attach
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
The rules are declared on both sides and decided on the server:
|
|
49
|
+
|
|
50
|
+
- Shared by client and server: `Guards.declare` names the guards and their `Expr`s,
|
|
51
|
+
and `Guards.attach` puts the rules on an Entity.
|
|
52
|
+
- Server only: `G.implement` gives the principal guards their bodies, which make the
|
|
53
|
+
`Policy`.
|
|
54
|
+
|
|
55
|
+
Every seam reads the same rules, decided by the same Policy:
|
|
56
|
+
|
|
57
|
+
- **Reads:** `GuardDrizzle.visible` and `GuardServer.memory` decide which rows;
|
|
58
|
+
`GuardServer.filter` decides members, relations and `may`.
|
|
59
|
+
- **Writes:** `GuardServer.writer` and `GuardServer.mutation` check before and read
|
|
60
|
+
back after.
|
|
61
|
+
- **Sync:** `GuardSync.authorize`, `admit` and `opens` guard edits through the
|
|
62
|
+
journal.
|
|
63
|
+
- **Agents:** `GuardAgent` guards reads and `may`.
|
|
64
|
+
- **Startup:** `GuardServer.validate` checks that every guarded Source is guarded.
|
|
50
65
|
|
|
51
66
|
A rule is decided in two steps: each principal guard by its body, once per
|
|
52
67
|
request, then what is left, row guards, as a condition over the row that SQL
|
|
@@ -205,9 +220,22 @@ Guards.matrix([Todo])
|
|
|
205
220
|
another Entity, a guard of another set, or a misspelled interaction is a type
|
|
206
221
|
error where it is written.
|
|
207
222
|
- Attaching is metadata: the result is the same Entity (`Entity.same`), and
|
|
208
|
-
attaching twice appends to each surface's list and
|
|
209
|
-
|
|
210
|
-
|
|
223
|
+
attaching twice appends to each surface's list, and a refusal the later
|
|
224
|
+
one names replaces the earlier.
|
|
225
|
+
The rules travel on the descriptor `Guards.attach` returns, not on the one
|
|
226
|
+
it was given, so give the returned one to everything that enforces them:
|
|
227
|
+
`GuardServer.writer`, `filter`, `memory` and `mutation`,
|
|
228
|
+
`GuardDrizzle.visible`, and `GuardSync.document`. Each throws where it is
|
|
229
|
+
built when given a descriptor without the rules of an Entity another
|
|
230
|
+
descriptor of which carries them (`Todo carries guards on another
|
|
231
|
+
descriptor of it; pass the one Guards.attach returned`), since it would
|
|
232
|
+
otherwise serve the Entity unguarded. A rule is still declared over the
|
|
233
|
+
bare descriptor (`guard.row(TodoFields, …)`), and the client's hints
|
|
234
|
+
(`may`, placement) read whatever descriptor they are given.
|
|
235
|
+
- `Guards.guardFields(Todo, 'Read')` names the members of the row itself that
|
|
236
|
+
a row interaction's guards read (and the relation an inherited Read
|
|
237
|
+
follows), so a change to one is known to change who may. What a rule reads
|
|
238
|
+
of another row, and the relation its path leaves by, are not among them.
|
|
211
239
|
- A surface with no guards on a guarded Entity falls to the set's
|
|
212
240
|
`unguarded`, which `declare` requires so the choice is written down:
|
|
213
241
|
`'deny'` refuses it (the matrix prints `closed`), `'allow'` lets everyone
|
|
@@ -240,38 +268,6 @@ Beyond the row's own fields:
|
|
|
240
268
|
row](#rules-that-read-another-row)). Every other surface is judged over one
|
|
241
269
|
row, so `Guards.attach` refuses such a rule there.
|
|
242
270
|
|
|
243
|
-
## Deciding reads and writes
|
|
244
|
-
|
|
245
|
-
A server asks the `Policy` which rows a principal may read. Every principal
|
|
246
|
-
guard is decided by its body (once, however many rules name it); what is
|
|
247
|
-
left is a `Condition` over the row, which an interpreter runs:
|
|
248
|
-
|
|
249
|
-
```ts
|
|
250
|
-
import { Condition } from 'foldkit-guard'
|
|
251
|
-
|
|
252
|
-
const ada = Option.some({ id: 'ada', role: 'member' as const, projectIds: ['p1'] })
|
|
253
|
-
const readable = Effect.runSync(Policy.readable(Todo, ada))
|
|
254
|
-
// isAdmin was false, so: isOwner or inProject, over each row
|
|
255
|
-
|
|
256
|
-
const t1 = { id: 't1', ownerId: 'ada', projectId: 'p9', title: 'Write the README' }
|
|
257
|
-
Condition.holds(readable, t1, Policy.inputOf(ada), () => false, Policy.operators)
|
|
258
|
-
// true
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
- `Condition.always` and `Condition.never` are a read settled without
|
|
262
|
-
looking at rows: an admin, or a visitor whose rules all read the principal.
|
|
263
|
-
- `Condition.holds` is how an interpreter that has the rows runs it; a
|
|
264
|
-
database compiles it instead. Its last argument answers an inherited Read,
|
|
265
|
-
which only the caller can look up.
|
|
266
|
-
- `Policy.readMembers(Todo, principal, members)` decides each member's own
|
|
267
|
-
Read rule, with the refusal it shows (`Omit` or `Redact`).
|
|
268
|
-
- Writes are decided alike, each principal guard's body told the interaction:
|
|
269
|
-
`Policy.writable(Todo, principal, 'Update')` is the row's rule for it,
|
|
270
|
-
`{ condition, deny }` (`Forbidden`, or `Explain` with its sentence);
|
|
271
|
-
`Policy.writeMembers(Todo, principal, members, 'Update')` each member's;
|
|
272
|
-
`Policy.linkable(Todo, principal, 'project', 'Link')` a relation's, when it
|
|
273
|
-
has one.
|
|
274
|
-
|
|
275
271
|
## Serving reads
|
|
276
272
|
|
|
277
273
|
`foldkit-guard/server` turns the rules into `foldkit-remote-server`'s seams.
|
|
@@ -362,10 +358,12 @@ const TodoSource = source(Db.Todo, { filter: GuardServer.filter(Todo, Policy) })
|
|
|
362
358
|
is not fails its first read, which is when the binding is first known.
|
|
363
359
|
- The principal reaches a binding untyped, so it is checked: one that is not
|
|
364
360
|
an `Option` of the set's schema is a defect, never read as a visitor.
|
|
365
|
-
- A rule calling a primitive operator
|
|
366
|
-
|
|
361
|
+
- A rule calling a primitive operator is checked when built against, and
|
|
362
|
+
compiled by, the SQL table passed here
|
|
367
363
|
(`GuardDrizzle.visible(Policy, [Todo], { operators })`, the kernel when not
|
|
368
|
-
given), since `visible` is built before
|
|
364
|
+
given), whatever table `bind` is given, since `visible` is built before
|
|
365
|
+
`bind`. Pass the bindings' table, so a rule and a query compile one
|
|
366
|
+
operator alike.
|
|
369
367
|
- `visible` is the row's Read. Member and relation Reads are the Source's
|
|
370
368
|
`filter`, as `TodoSource` has it.
|
|
371
369
|
|
|
@@ -485,6 +483,8 @@ RemoteServer.write(EditTodo, GuardServer.writer(Todo, Policy, writer(Db.Todo)))
|
|
|
485
483
|
of a Doc you may not change", with its `explain`, naming no row. The
|
|
486
484
|
Entity goes in `children` as a cascade's does.
|
|
487
485
|
|
|
486
|
+
### A revision closes the gap between the check and the write
|
|
487
|
+
|
|
488
488
|
Reading the row and writing it are two statements, so another write can land
|
|
489
489
|
between the check and the write. Name a revision, a field stored as a number
|
|
490
490
|
that the writer moves on by one with every write it lands, and the guard closes
|
|
@@ -493,8 +493,15 @@ a `revision` field, `GuardServer.writer(Todo, Policy, writer(Db.Todo), {
|
|
|
493
493
|
revision: 'revision' })`. Every update and delete then lands only on the
|
|
494
494
|
revision its rules were decided over (the writer's `expect`, one compare and
|
|
495
495
|
set statement). If the row moved after the check, it is decided again over
|
|
496
|
-
the row as it now is, up to three times, then fails
|
|
497
|
-
|
|
496
|
+
the row as it now is, up to three times, then fails; nothing is written over a
|
|
497
|
+
version no rule saw. That failure, like every failure on the guard's own side
|
|
498
|
+
(a write that reads a member its writer may not, a Read rule that cannot be
|
|
499
|
+
compiled for who asks, a value it cannot work out), is not a refusal: the
|
|
500
|
+
caller reads `Internal error` and an incident, and the server's `ServerDefect`
|
|
501
|
+
report says which ("changed while it was written"), so nothing a Read rule
|
|
502
|
+
hides is named to the caller. A rule's `explain`, `Forbidden`, `Conflict` and
|
|
503
|
+
the other declared refusals are written for the reader and arrive as they
|
|
504
|
+
are. An input that
|
|
498
505
|
`expect`s a revision the row is not at is a `Conflict`, decided before any
|
|
499
506
|
rule, and not retried. An input may expect only the revision the writer pins:
|
|
500
507
|
one expecting another field is refused, at startup by `GuardServer.validate`
|
|
@@ -505,12 +512,14 @@ write through one that a change can come between, as an `UnpinnedWrites`
|
|
|
505
512
|
an Entity the server also updates. An insert has no row before it, so an
|
|
506
513
|
Entity that is only inserted and deleted needs no revision.
|
|
507
514
|
|
|
515
|
+
### Preconditions, increments and invariants
|
|
516
|
+
|
|
508
517
|
A declared write's `when` (`foldkit-entity`) is the writer's to check, in the
|
|
509
518
|
statement that writes; the guarded writer passes it through and speaks first.
|
|
510
|
-
The order is: a row hidden from the writer, then a
|
|
511
|
-
(
|
|
512
|
-
|
|
513
|
-
row. A precondition, or an expected revision, over a member with a Read rule
|
|
519
|
+
The order is: a row hidden from the writer (`Forbidden`), then a stale input
|
|
520
|
+
revision (`Conflict`, which says nothing its reader could not read), then a
|
|
521
|
+
rule that does not hold (`Forbidden`), then the precondition (`Unmet`). So
|
|
522
|
+
`Unmet` reaches only someone the rules let write the row. A precondition, or an expected revision, over a member with a Read rule
|
|
514
523
|
would still answer for that member (Unmet or written, Conflict or not), so the
|
|
515
524
|
guarded writer refuses such a write before any rule, whether or not
|
|
516
525
|
`GuardServer.validate` ran; `validate` refuses it at startup too, as it refuses
|
|
@@ -545,6 +554,8 @@ invariant) is the same: the writer's, after the rules. An invariant that reads a
|
|
|
545
554
|
a Read rule is enforced all the same, but its refusal names no invariant and no path ("The row
|
|
546
555
|
would be invalid"), since naming it would say what that member holds.
|
|
547
556
|
|
|
557
|
+
### Retries
|
|
558
|
+
|
|
548
559
|
Over a writer with a ledger (`foldkit-remote-drizzle`'s `writer(binding, {
|
|
549
560
|
ledger })`), a retry of an operation that landed is answered from the ledger,
|
|
550
561
|
before any rule: it was decided when it landed, and deciding it again over a row
|
|
@@ -554,11 +565,15 @@ after a reload or a send nothing answered, is such a retry when its first send
|
|
|
554
565
|
landed; when it did not, it is a new write, decided as whoever the request
|
|
555
566
|
carrying it authenticates.
|
|
556
567
|
|
|
568
|
+
### The writer's binding
|
|
569
|
+
|
|
557
570
|
The binding must have a `visible` rule, which is how the writer reads a row
|
|
558
571
|
as its writer may see it; the writer refuses one without. That the rule is
|
|
559
572
|
`GuardDrizzle.visible`'s is what `GuardServer.validate` checks of the
|
|
560
573
|
Entity's Source, so give the writer that Source's binding.
|
|
561
574
|
|
|
575
|
+
### Fields the server sets
|
|
576
|
+
|
|
562
577
|
A client should not choose whose a new row is. The Entity says which fields
|
|
563
578
|
the write's context sets (`Entity.sets` in `foldkit-entity`), and
|
|
564
579
|
`RemoteServer.write` sets them before the guarded writer checks the create or
|
|
@@ -577,6 +592,8 @@ the writer's ledger recognises a retry, by its operation and who asked, and
|
|
|
577
592
|
answers it with its row, first time kept; the same id from another account is
|
|
578
593
|
refused.
|
|
579
594
|
|
|
595
|
+
### Handlers
|
|
596
|
+
|
|
580
597
|
A handler writes what its code writes, so it is guarded where it is defined:
|
|
581
598
|
`GuardServer.mutation` is `RemoteServer.mutation` with the row's rule for one
|
|
582
599
|
interaction checked before the handler runs.
|
|
@@ -627,8 +644,19 @@ remote-drizzle's `writer` holds the row to, refusing with `Forbidden` (and the
|
|
|
627
644
|
viewer leaves it too: a member whose rule reads their team's organisation
|
|
628
645
|
cannot move their own team.
|
|
629
646
|
- `may` leaves such an interaction unanswered, since one row cannot decide it.
|
|
647
|
+
`May.answer(may, 'Update')` reads it as none, apart from a yes and a no.
|
|
648
|
+
`May.locks`, `GuardAgent` and the client's own check of a write (`forbids`)
|
|
649
|
+
act only on a no, so the editor stays editable and the server's refusal is
|
|
650
|
+
shown when it comes. `May.can` and `May.canSet` are true only on a yes:
|
|
651
|
+
hide a control with `May.refused`, not `!May.can`.
|
|
630
652
|
- `GuardServer.writer` over a writer without `requires` throws where it is
|
|
631
653
|
made, rather than letting the rule go unchecked.
|
|
654
|
+
- Only the declared writer judges such a rule. `GuardServer.mutation` (for
|
|
655
|
+
the interaction it checks), `GuardSync.document` (for `Update`) and
|
|
656
|
+
`GuardServer.memory` (for `Read`) judge one row in memory, so each throws
|
|
657
|
+
where it is made for an Entity whose rule there reads another row, naming
|
|
658
|
+
the rule. Serve such an Entity's updates and deletes as declared writes,
|
|
659
|
+
and its reads through `GuardDrizzle.visible`.
|
|
632
660
|
- Every other surface (`Create`, `Write`, a member, a relation, a named
|
|
633
661
|
interaction, `always`) is judged over one row in memory, so `Guards.attach`
|
|
634
662
|
refuses such a rule there and names the surfaces that may hold one.
|
|
@@ -665,9 +693,12 @@ It throws, naming each:
|
|
|
665
693
|
that anyone may;
|
|
666
694
|
- for a live Source over such an Entity that does not read through the Source
|
|
667
695
|
checked here: `pollLive` over that Source names it (`LiveSource.reads`) and
|
|
668
|
-
passes
|
|
669
|
-
|
|
696
|
+
passes; a hand-written stream, or a `pollLive` over another Source, is
|
|
697
|
+
refused. A live hub is not a live Source and is not checked: give it the
|
|
698
|
+
server's own Sources (`backend.server.entities.values()`), as below;
|
|
670
699
|
- for an Entity carrying another set's guards;
|
|
700
|
+
- for a rule calling a primitive operator the Policy's table does not run
|
|
701
|
+
(`G.implement(bodies, { operators })`), which would fail when first asked;
|
|
671
702
|
- for a field its Source declares `shared` (sent to every live subscriber as
|
|
672
703
|
written) when a Read rule could tell readers apart: the rows', `always`, the
|
|
673
704
|
field's own, or, for a relation, its target rows', a target not among
|
|
@@ -683,25 +714,6 @@ Drizzle, each Source takes its `filter`, and each binding its `visible`.
|
|
|
683
714
|
A handler (`RemoteServer.mutation`) writes what its code writes, which no
|
|
684
715
|
check at startup can read.
|
|
685
716
|
|
|
686
|
-
## Diagnostics
|
|
687
|
-
|
|
688
|
-
Two things a guarded server goes past without failing are reported through
|
|
689
|
-
`foldkit-surface`'s `Diagnostics` channel (re-exported by `foldkit-remote`),
|
|
690
|
-
by default Effect's log:
|
|
691
|
-
|
|
692
|
-
| `_tag` | `level` | When |
|
|
693
|
-
| --- | --- | --- |
|
|
694
|
-
| `ComputeRefused` | `error` | An operator refused to work out a value a guarded write computes (text holding NUL, an implementation that throws). The write was refused with a fixed message; this carries the operator's `error`. |
|
|
695
|
-
| `UnpinnedWrites` | `warning` | `GuardServer.validate` found `mutations` writing through a writer with no `revision` that a change can come between. |
|
|
696
|
-
|
|
697
|
-
`ComputeRefused` is reported inside the write, so the reporter the server
|
|
698
|
-
runs with applies (`serveFetch`'s `diagnostics`, or
|
|
699
|
-
`Layer.succeed(Diagnostics.Reporter, report)` in its layer).
|
|
700
|
-
`GuardServer.validate` runs before any Effect of the server's, so it takes
|
|
701
|
-
the reporter as an option, `diagnostics`, beside `entities`, `domain` and
|
|
702
|
-
`server`. In a test, pass `Diagnostics.collect().report` and assert on
|
|
703
|
-
`reported`.
|
|
704
|
-
|
|
705
717
|
## Who is asking
|
|
706
718
|
|
|
707
719
|
Authentication decides who is asking; guards only read it. Give the handlers
|
|
@@ -777,8 +789,10 @@ May.canLink(row.may, Todo, 'project', 'Link')
|
|
|
777
789
|
The write is checked when it is made, whatever `may` said.
|
|
778
790
|
- A Source without the filter does not answer it: the client reads it as
|
|
779
791
|
unavailable.
|
|
780
|
-
- `foldkit-crud`'s editor locks the keys
|
|
781
|
-
`locks: May.locks(Todo)`, for
|
|
792
|
+
- `foldkit-crud`'s editor locks the keys `may` refuses (the row's `Update`,
|
|
793
|
+
or the key's own rule, said no) with `locks: May.locks(Todo)`, for
|
|
794
|
+
`foldkit-mixins-form`'s `locked`; a key whose answer was not said stays
|
|
795
|
+
editable.
|
|
782
796
|
|
|
783
797
|
For a row the client writes, which the server has not answered yet, Remote
|
|
784
798
|
foresees `may` from the same rules (`Derived.make`'s `predict`): a row guard
|
|
@@ -898,6 +912,25 @@ A refusal says why only through `Guards.explain`: a plain one is `forbidden`,
|
|
|
898
912
|
so a probing caller learns only "no", and a row a principal may not read is
|
|
899
913
|
not found rather than forbidden, so its existence does not leak.
|
|
900
914
|
|
|
915
|
+
## Diagnostics
|
|
916
|
+
|
|
917
|
+
Two things a guarded server goes past without failing are reported through
|
|
918
|
+
`foldkit-surface`'s `Diagnostics` channel (re-exported by `foldkit-remote`),
|
|
919
|
+
by default Effect's log:
|
|
920
|
+
|
|
921
|
+
| `_tag` | `level` | When |
|
|
922
|
+
| --- | --- | --- |
|
|
923
|
+
| `ComputeRefused` | `error` | An operator refused to work out a value a guarded write computes (text holding NUL, an implementation that throws). The write was refused with a fixed message; this carries the operator's `error`. |
|
|
924
|
+
| `UnpinnedWrites` | `warning` | `GuardServer.validate` found `mutations` writing through a writer with no `revision` that a change can come between. |
|
|
925
|
+
|
|
926
|
+
`ComputeRefused` is reported inside the write, so the reporter the server
|
|
927
|
+
runs with applies (`serveFetch`'s `diagnostics`, or
|
|
928
|
+
`Layer.succeed(Diagnostics.Reporter, report)` in its layer).
|
|
929
|
+
`GuardServer.validate` runs before any Effect of the server's, so it takes
|
|
930
|
+
the reporter as an option, `diagnostics`, beside `entities`, `domain` and
|
|
931
|
+
`server`. In a test, pass `Diagnostics.collect().report` and assert on
|
|
932
|
+
`reported`.
|
|
933
|
+
|
|
901
934
|
## Sync
|
|
902
935
|
|
|
903
936
|
A `foldkit-sync/entity` cell edit is a write to a member of a row, through the
|
|
@@ -1010,6 +1043,8 @@ has a `RequestedArchive` with the todo's `id`.
|
|
|
1010
1043
|
|
|
1011
1044
|
- `Row` selects `may`. A row not read yet, or whose read failed, refuses:
|
|
1012
1045
|
there is no answer to go on. One being read again answers as it last did.
|
|
1046
|
+
A row whose `may` does not say (a rule reading another row) is allowed and
|
|
1047
|
+
offered: the server decides.
|
|
1013
1048
|
A refusal its rule explained is the agent's error message.
|
|
1014
1049
|
- `available` is for a capability over a row the Model alone names (the one
|
|
1015
1050
|
selected): a visitor is then not offered it at all.
|
|
@@ -1065,6 +1100,40 @@ const uploads = uploadLayer().pipe(
|
|
|
1065
1100
|
- Beside a deployment's secret for scripts:
|
|
1066
1101
|
`uploadPolicyAny(uploadPolicyBearer(secret), GuardMedia.uploadPolicy(…))`.
|
|
1067
1102
|
|
|
1103
|
+
## Lower level: asking the Policy yourself
|
|
1104
|
+
|
|
1105
|
+
The seams above are built from a few questions the `Policy` answers, which a
|
|
1106
|
+
Source or an interpreter of your own asks directly. Which rows may a
|
|
1107
|
+
principal read: every principal guard is decided by its body (once, however
|
|
1108
|
+
many rules name it), and what is left is a `Condition` over the row, which an
|
|
1109
|
+
interpreter runs:
|
|
1110
|
+
|
|
1111
|
+
```ts
|
|
1112
|
+
import { Condition } from 'foldkit-guard'
|
|
1113
|
+
|
|
1114
|
+
const ada = Option.some({ id: 'ada', role: 'member' as const, projectIds: ['p1'] })
|
|
1115
|
+
const readable = Effect.runSync(Policy.readable(Todo, ada))
|
|
1116
|
+
// isAdmin was false, so: isOwner or inProject, over each row
|
|
1117
|
+
|
|
1118
|
+
const t1 = { id: 't1', ownerId: 'ada', projectId: 'p9', title: 'Write the README' }
|
|
1119
|
+
Condition.holds(readable, t1, Policy.inputOf(ada), () => false, Policy.operators)
|
|
1120
|
+
// true
|
|
1121
|
+
```
|
|
1122
|
+
|
|
1123
|
+
- `Condition.always` and `Condition.never` are a read settled without
|
|
1124
|
+
looking at rows: an admin, or a visitor whose rules all read the principal.
|
|
1125
|
+
- `Condition.holds` is how an interpreter that has the rows runs it; a
|
|
1126
|
+
database compiles it instead. Its last argument answers an inherited Read,
|
|
1127
|
+
which only the caller can look up.
|
|
1128
|
+
- `Policy.readMembers(Todo, principal, members)` decides each member's own
|
|
1129
|
+
Read rule, with the refusal it shows (`Omit` or `Redact`).
|
|
1130
|
+
- Writes are decided alike, each principal guard's body told the interaction:
|
|
1131
|
+
`Policy.writable(Todo, principal, 'Update')` is the row's rule for it,
|
|
1132
|
+
`{ condition, deny }` (`Forbidden`, or `Explain` with its sentence);
|
|
1133
|
+
`Policy.writeMembers(Todo, principal, members, 'Update')` each member's;
|
|
1134
|
+
`Policy.linkable(Todo, principal, 'project', 'Link')` a relation's, when it
|
|
1135
|
+
has one.
|
|
1136
|
+
|
|
1068
1137
|
## Limits
|
|
1069
1138
|
|
|
1070
1139
|
- **`may` is as stale as its row.** It is the server's answer for the row as
|
|
@@ -1074,10 +1143,13 @@ const uploads = uploadLayer().pipe(
|
|
|
1074
1143
|
checks the row's rule for its interaction; members it sets and relations
|
|
1075
1144
|
it points are not known to it, and no startup check can read them.
|
|
1076
1145
|
- **Under a Read rule over fields, a new row is fetched into a list, not
|
|
1077
|
-
placed.** `Guards.attach` records the
|
|
1078
|
-
the client, which runs none of them, refetches a list when a row
|
|
1079
|
-
hold changes one of them, as a create does: only the server can
|
|
1080
|
-
the rule lets it in.
|
|
1146
|
+
placed.** `Guards.attach` records the row's own members that its Read rules
|
|
1147
|
+
read, and the client, which runs none of them, refetches a list when a row
|
|
1148
|
+
it does not hold changes one of them, as a create does: only the server can
|
|
1149
|
+
say whether the rule lets it in. What a Read rule reads through a path or
|
|
1150
|
+
an exists is not recorded, neither the relation it leaves the row by nor
|
|
1151
|
+
the row it reaches: a change there leaves such a list as stale as its last
|
|
1152
|
+
read.
|
|
1081
1153
|
- **A Sync document is one audience.** Per-member or per-row secrecy within
|
|
1082
1154
|
one is not something a replicated log offers: `GuardSync.document` refuses
|
|
1083
1155
|
it where it is declared.
|
package/dist/agent.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as MayAnswer, l as InteractionKey } from "./attach-
|
|
1
|
+
import { j as MayAnswer, l as InteractionKey } from "./attach-CER19mzk.mjs";
|
|
2
2
|
import { RemoteData } from "foldkit-remote";
|
|
3
3
|
/** A row read with `may`, as `Data.get(Row, id).read(model)` gives it. */
|
|
4
4
|
type MayRow = RemoteData<{
|
|
@@ -7,9 +7,11 @@ type MayRow = RemoteData<{
|
|
|
7
7
|
export declare const GuardAgent: {
|
|
8
8
|
/**
|
|
9
9
|
* A capability's `authorize`: the row the request names, read from the
|
|
10
|
-
* Model, must
|
|
11
|
-
* whose read failed, refuses: there is no
|
|
12
|
-
*
|
|
10
|
+
* Model, must not refuse the principal `interaction`. A row not read yet,
|
|
11
|
+
* or whose read failed, refuses: there is no row to act on, and a refusal
|
|
12
|
+
* may be why. A row whose answer does not say (its rule reads another row)
|
|
13
|
+
* is allowed: the server decides. A refusal its rule explained says so, as
|
|
14
|
+
* the agent's error.
|
|
13
15
|
*
|
|
14
16
|
* ```ts
|
|
15
17
|
* authorize: GuardAgent.authorize(Archive.key, ({ input, model }) =>
|
|
@@ -29,8 +31,9 @@ export declare const GuardAgent: {
|
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* A capability's `available`, for one that acts on a row the Model alone
|
|
32
|
-
* names (the todo that is selected): offered
|
|
33
|
-
* principal
|
|
34
|
+
* names (the todo that is selected): offered while that row is read and
|
|
35
|
+
* does not refuse the principal `interaction`, so a visitor is not offered
|
|
36
|
+
* it at all.
|
|
34
37
|
*/
|
|
35
38
|
available: <Model>(interaction: 'Update' | 'Delete' | InteractionKey, row: (model: Model) => MayRow) => (model: Model) => boolean;
|
|
36
39
|
};
|
package/dist/agent.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.mts","names":[],"sources":["../src/agent.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"agent.d.mts","names":[],"sources":["../src/agent.ts"],"mappings":";;;KAeK,SAAS;WAAsB,KAAK;;qBAkC5B;;;;;;;;;;;;;;;EAeX,YACG,OAAO,OAAK,mCACwB,gBAAc,MAC3C;aAAoB,OAAO;aAAgB,OAAO;QAAY,YAAM;aAGjE,OAAO;aACP,OAAO;;aACO;aAAyB;;;;;;;;EASpD,YACG,OAAK,mCAAqC,gBAAc,MAAQ,OAAO,UAAU,YAAM,OAChF"}
|
package/dist/agent.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as May } from "./may-
|
|
1
|
+
import { t as May } from "./may-Bd6O91A-.mjs";
|
|
2
2
|
import { Option } from "effect";
|
|
3
3
|
import { RemoteData } from "foldkit-remote";
|
|
4
4
|
// src/agent.ts
|
|
@@ -6,8 +6,10 @@ import { RemoteData } from "foldkit-remote";
|
|
|
6
6
|
* `foldkit-guard/agent`: a `foldkit-agent` capability's `authorize` and
|
|
7
7
|
* `available`, read from the `may` the server answered for a row the Model
|
|
8
8
|
* holds. The client has no rule to run, and is not where a write is checked:
|
|
9
|
-
* this keeps an agent from offering or attempting what the server
|
|
10
|
-
* refuse, and the Message's mutation is checked on the server all the
|
|
9
|
+
* this keeps an agent from offering or attempting what the server said it
|
|
10
|
+
* would refuse, and the Message's mutation is checked on the server all the
|
|
11
|
+
* same. What the answer does not say (a rule reading another row, which one
|
|
12
|
+
* row cannot decide) is offered and attempted: the server decides it.
|
|
11
13
|
*/
|
|
12
14
|
/** The answer, while the row's value is there to read: refreshing or not. */
|
|
13
15
|
const answered = (row) => RemoteData.match(row, {
|
|
@@ -21,20 +23,25 @@ const answered = (row) => RemoteData.match(row, {
|
|
|
21
23
|
/** Allowed, refused, or refused with the `explain` its rule gave: what `authorize` answers. */
|
|
22
24
|
const decided = (row, interaction) => Option.match(answered(row), {
|
|
23
25
|
onNone: () => false,
|
|
24
|
-
onSome: (may) =>
|
|
25
|
-
onNone: () =>
|
|
26
|
-
onSome: (
|
|
27
|
-
|
|
28
|
-
reason
|
|
26
|
+
onSome: (may) => Option.match(May.answer(may, interaction), {
|
|
27
|
+
onNone: () => true,
|
|
28
|
+
onSome: (allowed) => allowed || Option.match(May.reason(may, interaction), {
|
|
29
|
+
onNone: () => false,
|
|
30
|
+
onSome: (reason) => ({
|
|
31
|
+
allowed: false,
|
|
32
|
+
reason
|
|
33
|
+
})
|
|
29
34
|
})
|
|
30
35
|
})
|
|
31
36
|
});
|
|
32
37
|
const GuardAgent = {
|
|
33
38
|
/**
|
|
34
39
|
* A capability's `authorize`: the row the request names, read from the
|
|
35
|
-
* Model, must
|
|
36
|
-
* whose read failed, refuses: there is no
|
|
37
|
-
*
|
|
40
|
+
* Model, must not refuse the principal `interaction`. A row not read yet,
|
|
41
|
+
* or whose read failed, refuses: there is no row to act on, and a refusal
|
|
42
|
+
* may be why. A row whose answer does not say (its rule reads another row)
|
|
43
|
+
* is allowed: the server decides. A refusal its rule explained says so, as
|
|
44
|
+
* the agent's error.
|
|
38
45
|
*
|
|
39
46
|
* ```ts
|
|
40
47
|
* authorize: GuardAgent.authorize(Archive.key, ({ input, model }) =>
|
|
@@ -45,8 +52,9 @@ const GuardAgent = {
|
|
|
45
52
|
authorize: (interaction, row) => (request) => decided(row(request), interaction),
|
|
46
53
|
/**
|
|
47
54
|
* A capability's `available`, for one that acts on a row the Model alone
|
|
48
|
-
* names (the todo that is selected): offered
|
|
49
|
-
* principal
|
|
55
|
+
* names (the todo that is selected): offered while that row is read and
|
|
56
|
+
* does not refuse the principal `interaction`, so a visitor is not offered
|
|
57
|
+
* it at all.
|
|
50
58
|
*/
|
|
51
59
|
available: (interaction, row) => (model) => decided(row(model), interaction) === true
|
|
52
60
|
};
|
package/dist/agent.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.mjs","names":[],"sources":["../src/agent.ts"],"sourcesContent":["/**\n * `foldkit-guard/agent`: a `foldkit-agent` capability's `authorize` and\n * `available`, read from the `may` the server answered for a row the Model\n * holds. The client has no rule to run, and is not where a write is checked:\n * this keeps an agent from offering or attempting what the server
|
|
1
|
+
{"version":3,"file":"agent.mjs","names":[],"sources":["../src/agent.ts"],"sourcesContent":["/**\n * `foldkit-guard/agent`: a `foldkit-agent` capability's `authorize` and\n * `available`, read from the `may` the server answered for a row the Model\n * holds. The client has no rule to run, and is not where a write is checked:\n * this keeps an agent from offering or attempting what the server said it\n * would refuse, and the Message's mutation is checked on the server all the\n * same. What the answer does not say (a rule reading another row, which one\n * row cannot decide) is offered and attempted: the server decides it.\n */\nimport { Option } from 'effect'\nimport { RemoteData } from 'foldkit-remote'\nimport type { InteractionKey } from './attach.js'\nimport { May, type MayAnswer } from './may.js'\n\n/** A row read with `may`, as `Data.get(Row, id).read(model)` gives it. */\ntype MayRow = RemoteData<{ readonly may: MayAnswer }>\n\n/** The answer, while the row's value is there to read: refreshing or not. */\nconst answered = (row: MayRow): Option.Option<MayAnswer> =>\n RemoteData.match(row, {\n Initial: () => Option.none(),\n Loading: () => Option.none(),\n Ready: ({ may }) => Option.some(may),\n Refreshing: ({ may }) => Option.some(may),\n // Not the last answer known good: a refusal may be why the read failed.\n Failed: () => Option.none(),\n NotFound: () => Option.none(),\n })\n\n/** Allowed, refused, or refused with the `explain` its rule gave: what `authorize` answers. */\nconst decided = (\n row: MayRow,\n interaction: 'Update' | 'Delete' | InteractionKey,\n): boolean | { readonly allowed: false; readonly reason: string } =>\n Option.match(answered(row), {\n onNone: () => false,\n onSome: may =>\n Option.match(May.answer(may, interaction), {\n // Not said: the server decides when the Message's write reaches it.\n onNone: () => true,\n onSome: allowed =>\n allowed ||\n Option.match(May.reason(may, interaction), {\n onNone: () => false,\n onSome: reason => ({ allowed: false as const, reason }),\n }),\n }),\n })\n\nexport const GuardAgent = {\n /**\n * A capability's `authorize`: the row the request names, read from the\n * Model, must not refuse the principal `interaction`. A row not read yet,\n * or whose read failed, refuses: there is no row to act on, and a refusal\n * may be why. A row whose answer does not say (its rule reads another row)\n * is allowed: the server decides. A refusal its rule explained says so, as\n * the agent's error.\n *\n * ```ts\n * authorize: GuardAgent.authorize(Archive.key, ({ input, model }) =>\n * Data.get(TodoRow, input.id).read(model),\n * )\n * ```\n */\n authorize:\n <Input, Model>(\n interaction: 'Update' | 'Delete' | InteractionKey,\n row: (request: { readonly input: Input; readonly model: Model }) => MayRow,\n ) =>\n (request: {\n readonly input: Input\n readonly model: Model\n }): boolean | { readonly allowed: false; readonly reason: string } =>\n decided(row(request), interaction),\n\n /**\n * A capability's `available`, for one that acts on a row the Model alone\n * names (the todo that is selected): offered while that row is read and\n * does not refuse the principal `interaction`, so a visitor is not offered\n * it at all.\n */\n available:\n <Model>(interaction: 'Update' | 'Delete' | InteractionKey, row: (model: Model) => MayRow) =>\n (model: Model): boolean =>\n decided(row(model), interaction) === true,\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,YAAY,QAChB,WAAW,MAAM,KAAK;CACpB,eAAe,OAAO,KAAK;CAC3B,eAAe,OAAO,KAAK;CAC3B,QAAQ,EAAE,UAAU,OAAO,KAAK,GAAG;CACnC,aAAa,EAAE,UAAU,OAAO,KAAK,GAAG;CAExC,cAAc,OAAO,KAAK;CAC1B,gBAAgB,OAAO,KAAK;AAC9B,CAAC;;AAGH,MAAM,WACJ,KACA,gBAEA,OAAO,MAAM,SAAS,GAAG,GAAG;CAC1B,cAAc;CACd,SAAQ,QACN,OAAO,MAAM,IAAI,OAAO,KAAK,WAAW,GAAG;EAEzC,cAAc;EACd,SAAQ,YACN,WACA,OAAO,MAAM,IAAI,OAAO,KAAK,WAAW,GAAG;GACzC,cAAc;GACd,SAAQ,YAAW;IAAE,SAAS;IAAgB;GAAO;EACvD,CAAC;CACL,CAAC;AACL,CAAC;AAEH,MAAa,aAAa;;;;;;;;;;;;;;;CAexB,YAEI,aACA,SAED,YAIC,QAAQ,IAAI,OAAO,GAAG,WAAW;;;;;;;CAQrC,YACU,aAAmD,SAC1D,UACC,QAAQ,IAAI,KAAK,GAAG,WAAW,MAAM;AAC3C"}
|
|
@@ -100,6 +100,11 @@ interface RowRule {
|
|
|
100
100
|
* application named), per member with its own `Update` rule, and per relation
|
|
101
101
|
* with a `Link` or `Unlink` rule; and, for a row interaction refused with an
|
|
102
102
|
* `explain`, its sentence.
|
|
103
|
+
*
|
|
104
|
+
* `row` says one of three things of an interaction: `true`, its rule let the
|
|
105
|
+
* reader; `false`, it refused; and nothing, the key left out, where the rule
|
|
106
|
+
* reads another row and one row cannot decide it. The write's statement
|
|
107
|
+
* decides that one. Read the three with `May.answer`.
|
|
103
108
|
*/
|
|
104
109
|
declare const MaySchema: Schema.Struct<{
|
|
105
110
|
readonly row: Schema.$Record<Schema.String, Schema.Boolean>;
|
|
@@ -178,26 +183,58 @@ declare const May: {
|
|
|
178
183
|
}>;
|
|
179
184
|
}> : never;
|
|
180
185
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
186
|
+
* What the answer says of the row's rule for `interaction`: `some(true)`,
|
|
187
|
+
* it let the reader when the row was read; `some(false)`, it refused; none,
|
|
188
|
+
* the answer does not say, since the rule reads another row and one row
|
|
189
|
+
* cannot decide it. The server decides that one when the write reaches it.
|
|
190
|
+
*
|
|
191
|
+
* ```ts
|
|
192
|
+
* Option.match(May.answer(todo.may, 'Update'), {
|
|
193
|
+
* onNone: () => 'the server will say',
|
|
194
|
+
* onSome: allowed => (allowed ? 'yes' : 'no'),
|
|
195
|
+
* })
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
answer: (may: MayAnswer, interaction: 'Update' | 'Delete' | InteractionKey) => Option.Option<boolean>;
|
|
199
|
+
/**
|
|
200
|
+
* Whether the answer says yes to `interaction`: `false` both where the rule
|
|
201
|
+
* refused and where the answer does not say. For what is drawn only on a
|
|
202
|
+
* certain yes; to hide or disable only what was refused, read `refused`.
|
|
184
203
|
*/
|
|
185
204
|
can: (may: MayAnswer, interaction: 'Update' | 'Delete' | InteractionKey) => boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Whether the answer says no to `interaction`: `false` both where the rule
|
|
207
|
+
* let the reader and where the answer does not say. What a hint hides,
|
|
208
|
+
* disables or refuses on: what was not said is left for the server.
|
|
209
|
+
*/
|
|
210
|
+
refused: (may: MayAnswer, interaction: 'Update' | 'Delete' | InteractionKey) => boolean;
|
|
186
211
|
/**
|
|
187
212
|
* Why the row's rule for `interaction` refused, when it was refused with an
|
|
188
213
|
* `explain`: words for whoever asked. None where it was allowed (the server
|
|
189
214
|
* gives none then), or refused without one.
|
|
190
215
|
*/
|
|
191
216
|
reason: (may: MayAnswer, interaction: 'Update' | 'Delete' | InteractionKey) => Option.Option<string>;
|
|
192
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Whether the answer says the principal may set `member` on this row: a
|
|
219
|
+
* yes to the row's `Update`, and no refusal from the member's own rule.
|
|
220
|
+
* `false` where the row's `Update` was not said: to lock only what was
|
|
221
|
+
* refused, read `locks`.
|
|
222
|
+
*/
|
|
193
223
|
canSet: <E extends AnyEntity>(may: MayAnswer, _entity: E, member: MemberKeys$1<E>) => boolean;
|
|
194
|
-
/**
|
|
224
|
+
/**
|
|
225
|
+
* Whether the answer says the principal may point `relation` at a row, or
|
|
226
|
+
* away from one: a yes to the row's `Update`, and no refusal from the
|
|
227
|
+
* relation's own rule. `false` where the row's `Update` was not said.
|
|
228
|
+
*/
|
|
195
229
|
canLink: <E extends AnyEntity>(may: MayAnswer, _entity: E, relation: keyof E['relations'] & string, interaction: 'Link' | 'Unlink') => boolean;
|
|
196
230
|
/**
|
|
197
231
|
* `foldkit-crud`'s `locks` for `entity`: an editor loads `may` beside the
|
|
198
|
-
* form's members and locks each the
|
|
199
|
-
*
|
|
200
|
-
*
|
|
232
|
+
* form's members and locks each the answer refuses: the row's `Update`, or
|
|
233
|
+
* the member's own rule, said no. A relation is locked where its `Unlink`
|
|
234
|
+
* or its `Link` said no. Nothing is locked on what was not said: a row's
|
|
235
|
+
* `Update` whose rule reads another row, or a `may` not answered at all (a
|
|
236
|
+
* Source without the filter). The write is checked anyway, and its refusal
|
|
237
|
+
* is the server's to give.
|
|
201
238
|
*
|
|
202
239
|
* ```ts
|
|
203
240
|
* Crud.editor('todo', { form, mutation: EditTodo, locks: May.locks(Todo) })
|
|
@@ -657,4 +694,4 @@ interface Attachment {
|
|
|
657
694
|
}
|
|
658
695
|
declare const attached: (entity: AnyEntity) => Option.Option<Attachment>;
|
|
659
696
|
export { May as A, PrincipalGuard as C, RowSpec as D, RowGuard as E, RowRule as F, MaySchema as M, Condition as N, ME as O, MemberRead as P, Policy as S, PrincipalSpec as T, Builders as _, Deny as a, Guards as b, Interaction as c, Redact as d, RuleFor as f, Body as g, AnyGuard as h, Attachment as i, MayAnswer as j, MeEntity as k, InteractionKey as l, About as m, AnyRule as n, Explain as o, Surface as p, Attach as r, Inherit as s, All as t, On as u, Decision as v, PrincipalOf as w, Placeholders as x, GuardSet as y };
|
|
660
|
-
//# sourceMappingURL=attach-
|
|
697
|
+
//# sourceMappingURL=attach-CER19mzk.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach-CER19mzk.d.mts","names":["MemberKeys","_$__attach_js0.Attach","_$__attach_js0.AnyRule","_$__attach_js0.Inherit","_$__attach_js0.All","_$__attach_js0.Redact","_$__attach_js0.Explain","_$__attach_js0.On"],"sources":["../src/condition.ts","../src/may.ts","../src/me.ts","../src/index.ts","../src/attach.ts"],"mappings":";;KA8BY;WACG;;WACA;;;;WAGA;WACA,OAAO,cAAc;WACrB,SAAS;;;;WAGT;WAA0B;;WAC1B;WAAsB,YAAY,cAAc;;WAChD;WAAqB,YAAY,cAAc;;;cAMxD,MAAG,YAAgB,cAAc,eAAa;;cAY9C,KAAE,YAAgB,cAAc,eAAa;cAWt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