foldkit-remote-server 0.12.1 → 0.13.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/dist/index.d.mts CHANGED
@@ -1,11 +1,24 @@
1
- import { Effect, Layer, Schema, Stream } from "effect";
2
- import { QueryEvaluateError, Row, assertSupported, evaluate, supported } from "foldkit-entity";
3
- import { Boundary, ConnectionChangeSchema, ConnectionIdentity, LiveChange, MutationDescriptor, NormalizedPatch, QueryDescriptor, QueryWindow, RelationRequirement, RemoteClient, RemoteDescriptor, RemoteJsonAnswer, RemoteReadError, RemoteRpcClient, Requirement } from "foldkit-remote";
1
+ import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
2
+ import { AnyWrite, EntityRef, QueryEvaluateError, Row, assertSupported, evaluate, supported } from "foldkit-entity";
3
+ import { Boundary, ConnectionChangeSchema, ConnectionIdentity, LiveChange, MutationDescriptor, NormalizedPatch, QueryDescriptor, QueryWindow, RelationRequirement, RemoteClient, RemoteDescriptor, RemoteForbidden, RemoteJsonAnswer, RemoteReadError, RemoteRpcClient, Requirement } from "foldkit-remote";
4
4
  //#region src/index.d.ts
5
5
  declare const RemoteServerError_base: Schema.Class<RemoteServerError, Schema.TaggedStruct<"RemoteServerError", {
6
6
  readonly message: Schema.String;
7
7
  }>, import("effect/Cause").YieldableError>;
8
8
  export declare class RemoteServerError extends RemoteServerError_base {}
9
+ declare const MutationRefused_base: Schema.Class<MutationRefused, Schema.TaggedStruct<"MutationRefused", {
10
+ /** The mutation the refusal was made for: a Source refusing as another is a bug. */
11
+ readonly mutation: Schema.String;
12
+ readonly refusal: Schema.Unknown;
13
+ /** What a person reads: the error's message beside the refusal. */
14
+ readonly message: Schema.String;
15
+ }>, import("effect/Cause").YieldableError>;
16
+ /**
17
+ * A mutation Source's refusal, as the value its descriptor's `Refusal`
18
+ * declares: made with `RemoteServer.refuse`, which checks the value's type
19
+ * against the mutation, and sent to the client encoded, beside a message.
20
+ */
21
+ export declare class MutationRefused extends MutationRefused_base {}
9
22
  export interface EntityRecord {
10
23
  readonly id: string;
11
24
  readonly values: Readonly<Record<string, unknown>>;
@@ -24,6 +37,99 @@ export interface EntitySource<P, R = never> {
24
37
  readonly read: (context: EntitySourceContext<P>) => Effect.Effect<ReadonlyArray<EntityRecord>, RemoteServerError, R>;
25
38
  /** Returns the fields this principal may read; omitted means all requested. */
26
39
  readonly authorize?: (principal: P, fields: readonly string[]) => readonly string[];
40
+ /**
41
+ * Decides, per record, what a principal sees of the fields `authorize`
42
+ * allowed: run once per read, before `read`. A member it drops from a
43
+ * record is settled unread, as one the source did not return.
44
+ */
45
+ readonly filter?: (principal: P, fields: readonly string[]) => Effect.Effect<ReadPlan, RemoteServerError, R>;
46
+ /**
47
+ * The rule that decides which rows this source returns, as it was given one
48
+ * (a Drizzle binding's `visible`, `RemoteServer.memory`'s `readable`). The
49
+ * server never runs it: it is here so a check at startup, such as
50
+ * `GuardServer.validate`, can confirm a source applies the rule its Entity
51
+ * requires.
52
+ */
53
+ readonly visible?: unknown;
54
+ /**
55
+ * The fields every principal reads alike, of every row: no rule about who
56
+ * is asking hides the row or the field, or changes its value. A promise the
57
+ * server keeps by trusting it: the live hub sends a declared write's value
58
+ * of one to every subscriber as it is, with no read per principal.
59
+ */
60
+ readonly shared?: ReadonlySet<string> | undefined;
61
+ }
62
+ /** What `EntitySource.filter` decides for one read. */
63
+ export interface ReadPlan {
64
+ /** The fields to read: those allowed, and any the decision itself needs. */
65
+ readonly fields: readonly string[];
66
+ /** One record as the principal sees it: a member dropped, or its value replaced. */
67
+ readonly apply: (record: EntityRecord) => EntityRecord;
68
+ }
69
+ /**
70
+ * Where a declared write lands: one row's new values, encoded as the store holds
71
+ * them. With `expect`, the row is written only while its revision is still that
72
+ * value, and the revision moves on with the write. The row as written answers;
73
+ * none when no row matched.
74
+ */
75
+ export interface EntityWriter<P, R = never> {
76
+ readonly entity: string;
77
+ readonly update: (context: {
78
+ readonly id: string;
79
+ readonly values: Readonly<Record<string, unknown>>;
80
+ /** Each `one` relation it points, by the relation's key: the row, or none. */
81
+ readonly links: Readonly<Record<string, Option.Option<EntityRef>>>;
82
+ readonly expect: Option.Option<{
83
+ readonly field: string;
84
+ readonly revision: unknown;
85
+ }>;
86
+ readonly principal: P;
87
+ }) => Effect.Effect<Option.Option<Readonly<Record<string, unknown>>>, RemoteServerError | RemoteForbidden, R>;
88
+ /**
89
+ * Inserts the row, or finds one already there under that id holding what
90
+ * it writes (a retry); answers the row as it is. Fails when the id holds
91
+ * any other row.
92
+ */
93
+ readonly insert: (context: {
94
+ readonly id: string;
95
+ readonly values: Readonly<Record<string, unknown>>;
96
+ readonly links: Readonly<Record<string, Option.Option<EntityRef>>>;
97
+ readonly principal: P;
98
+ }) => Effect.Effect<Readonly<Record<string, unknown>>, RemoteServerError | RemoteForbidden, R>;
99
+ /**
100
+ * Deletes the row, while it is still at the revision when one is expected:
101
+ * `deleted`, `absent` (no row, so nothing to delete; a retry's case), or
102
+ * `moved` (the row is there at another revision, and stays).
103
+ */
104
+ readonly delete: (context: {
105
+ readonly id: string;
106
+ readonly expect: Option.Option<{
107
+ readonly field: string;
108
+ readonly revision: unknown;
109
+ }>;
110
+ readonly principal: P;
111
+ }) => Effect.Effect<'deleted' | 'absent' | 'moved', RemoteServerError | RemoteForbidden, R>;
112
+ /**
113
+ * The row as `principal` may see it, under the read rule its Source applies:
114
+ * none when there is no such row, or it is hidden. Given, a write's answer
115
+ * is read back through it, so an answer never shows its writer a row it may
116
+ * not read, and a row the write hid from them answers as deleted.
117
+ */
118
+ readonly read?: (context: {
119
+ readonly id: string;
120
+ readonly fields: ReadonlyArray<string>;
121
+ readonly principal: P;
122
+ }) => Effect.Effect<Option.Option<Readonly<Record<string, unknown>>>, RemoteServerError, R>;
123
+ /**
124
+ * Each of `relations`' links as stored, by ref key (`'Project:p1'`) or
125
+ * `null`, whatever a reader may see of the row it points at; none when there
126
+ * is no such row. A guard reads it to tell a write that unlinks a row hidden
127
+ * from its writer from one that changes nothing.
128
+ */
129
+ readonly linked?: (context: {
130
+ readonly id: string;
131
+ readonly relations: ReadonlyArray<string>;
132
+ }) => Effect.Effect<Option.Option<Readonly<Record<string, unknown>>>, RemoteServerError, R>;
27
133
  }
28
134
  /** A connection change a mutation made, as the wire carries it. */
29
135
  export type ConnectionChange = Schema.Schema.Type<typeof ConnectionChangeSchema>;
@@ -43,11 +149,28 @@ export interface MutationOutcome<Output> {
43
149
  }
44
150
  export interface MutationSource<P, R = never> {
45
151
  readonly mutation: string;
152
+ /**
153
+ * For a declared write (`RemoteServer.write`), the Entity it writes and the
154
+ * writer it lands through, as it was given one. The server never reads it;
155
+ * a startup check such as `GuardServer.validate` does.
156
+ */
157
+ readonly writes?: {
158
+ readonly entity: string;
159
+ readonly writer: unknown;
160
+ };
46
161
  readonly Input: Schema.Codec<unknown>;
47
162
  readonly Output: Schema.Codec<unknown>;
163
+ readonly Refusal: Schema.Codec<unknown, unknown>;
48
164
  readonly run: (context: {
49
165
  readonly input: unknown;
50
166
  readonly principal: P;
167
+ /**
168
+ * The client's id for this request, the same on every retry of it: what a
169
+ * Source keys a record of the write by, so a retry finds it was made.
170
+ */
171
+ readonly requestId: string;
172
+ /** For a declared write: the input keys to write, when the client named only some. */
173
+ readonly keys?: ReadonlyArray<string> | undefined;
51
174
  }) => Effect.Effect<{
52
175
  readonly output: unknown;
53
176
  readonly entities: ReadonlyArray<NormalizedPatch>;
@@ -56,7 +179,7 @@ export interface MutationSource<P, R = never> {
56
179
  readonly entity: string;
57
180
  readonly id: string;
58
181
  }>;
59
- }, RemoteServerError, R>;
182
+ }, RemoteServerError | MutationRefused | RemoteForbidden, R>;
60
183
  }
61
184
  export interface QueryPage {
62
185
  readonly edges: ReadonlyArray<{
@@ -82,6 +205,8 @@ export interface QuerySource<P, R = never> {
82
205
  */
83
206
  readonly select?: RelationRequirement | undefined;
84
207
  }) => Effect.Effect<QueryPage, RemoteServerError, R>;
208
+ /** The rule that decides which rows the query lists. See `EntitySource.visible`. */
209
+ readonly visible?: unknown;
85
210
  }
86
211
  export interface LiveSource<P, R = never> {
87
212
  readonly entity: string;
@@ -120,8 +245,18 @@ interface LiveRef {
120
245
  * duplicate and gap handling is unchanged.
121
246
  */
122
247
  export interface LiveHub<P, R = never> {
123
- readonly changed: (ref: LiveRef, fields: ReadonlyArray<string>) => Effect.Effect<void, RemoteServerError, R>;
124
- readonly deleted: (ref: LiveRef) => Effect.Effect<void>;
248
+ /**
249
+ * `values`, when given, are the row's stored values of `fields` (a declared
250
+ * write's answer): a field of them the source declares `shared` is sent as
251
+ * it is, and only the rest are re-read.
252
+ */
253
+ readonly changed: (ref: LiveRef, fields: ReadonlyArray<string>, values?: Readonly<Record<string, unknown>> | undefined) => Effect.Effect<void, RemoteServerError, R>;
254
+ /**
255
+ * `ref` may be gone: each subscriber's selection of it is read again, and
256
+ * one it is no longer there to is sent a deletion. A row deleted for one
257
+ * writer may only be hidden from them, and still there to others.
258
+ */
259
+ readonly deleted: (ref: LiveRef) => Effect.Effect<void, RemoteServerError, R>;
125
260
  /** Registers a subscriber for the stream's lifetime; `handlers` calls this. */
126
261
  readonly subscribe: (context: {
127
262
  readonly requirements: ReadonlyArray<Requirement>;
@@ -179,12 +314,25 @@ export type MemoryConfig<P> = {
179
314
  readonly mutations?: (store: MemoryStore) => ReadonlyArray<MutationSource<P>>;
180
315
  /** Per entity name, the fields a principal may read, as `RemoteServer.entity` takes it. */
181
316
  readonly authorize?: Readonly<Record<string, NonNullable<EntitySource<P>['authorize']>>>;
317
+ /** Per entity name, what a principal sees of each record, as `RemoteServer.entity` takes it. */
318
+ readonly filter?: Readonly<Record<string, NonNullable<EntitySource<P>['filter']>>>;
319
+ /** Per entity name, the fields every principal reads alike: see `EntitySource.shared`. */
320
+ readonly shared?: Readonly<Record<string, ReadonlyArray<string>>>;
321
+ /**
322
+ * Which stored rows a principal may read, decided once per read. A row it
323
+ * may not read is absent from a read by id and from every query, and a ref
324
+ * to one is dropped from a relation (a `one` ref reads as `null`). `row`
325
+ * looks another stored row up, for a decision that follows a relation.
326
+ */
327
+ readonly readable?: (principal: P, row: (entity: string, id: string) => Option.Option<Readonly<Record<string, unknown>>>) => Effect.Effect<MemoryReadable, RemoteServerError>;
182
328
  } & (undefined extends P ? {
183
329
  readonly principal?: P;
184
330
  } : {
185
331
  /** Who the `layer` answers as. */
186
332
  readonly principal: P;
187
333
  });
334
+ /** Whether a stored row of `entity` may be read, given its whole stored values. */
335
+ export type MemoryReadable = (entity: string, row: Readonly<Record<string, unknown>>) => boolean;
188
336
  export declare const RemoteServer: {
189
337
  /** A backend held in memory, for a first run, a test or a demo. See `memory`. */
190
338
  memory: <P = undefined>(config: MemoryConfig<P>) => MemoryBackend<P>;
@@ -212,11 +360,46 @@ export declare const RemoteServer: {
212
360
  entity: <P = unknown, R = never>(entity: EntityName, options: {
213
361
  readonly read: EntitySource<P, R>["read"];
214
362
  readonly authorize?: EntitySource<P, R>["authorize"];
363
+ readonly filter?: EntitySource<P, R>["filter"];
364
+ /** See `EntitySource.shared`: each must be a member the source serves. */
365
+ readonly shared?: ReadonlyArray<string> | undefined;
215
366
  }) => EntitySource<P, R>;
216
- mutation: <P = unknown, R = never, Name extends string = string, Input = unknown, Output = unknown>(mutation: MutationDescriptor<Name, Input, Output>, run: (context: {
367
+ mutation: <P = unknown, R = never, Name extends string = string, Input = unknown, Output = unknown, Refused = unknown>(mutation: MutationDescriptor<Name, Input, Output, Refused>, run: (context: {
217
368
  readonly input: Input;
218
369
  readonly principal: P;
219
- }) => Effect.Effect<MutationOutcome<Output>, RemoteServerError, R>) => MutationSource<P, R>;
370
+ /** The client's id for this request, the same on every retry of it. */
371
+ readonly requestId: string;
372
+ }) => Effect.Effect<MutationOutcome<Output>, RemoteServerError | MutationRefused | RemoteForbidden, R>) => MutationSource<P, R>;
373
+ /**
374
+ * A refusal of `mutation`, as a value of its declared `Refusal`: fail a
375
+ * Source with it (`yield* RemoteServer.refuse(SavePost, { _tag: 'Field', ... })`)
376
+ * and the client reads it, decoded, with `Data.refusal`. `message` is what a
377
+ * person reads, beside it.
378
+ */
379
+ refuse: <Refused>(mutation: MutationDescriptor<string, any, any, Refused>, refusal: NoInfer<Refused>, message?: string) => MutationRefused;
380
+ /**
381
+ * A refusal of who is asking: fail a Source with it
382
+ * (`yield* RemoteServer.forbid()`) and the write never runs. `reason`, when
383
+ * given, is what the person who asked reads; without it the refusal says
384
+ * nothing of why. `answer` sends it as a 403, and the client's mutation
385
+ * fails with `_tag: 'Forbidden'`.
386
+ */
387
+ forbid: (reason?: string) => RemoteForbidden;
388
+ /**
389
+ * The Source of a mutation that is a declared `Write`, with no handler: the
390
+ * input bound to the write lands through `writer`, and the row as written
391
+ * answers as a patch (a deletion as `deleted`). An update writes only the
392
+ * keys the client named, when it named some, and fails for a row that is not
393
+ * there; an insert of an id already holding what it writes (a retry)
394
+ * answers with that row, and of one holding anything else fails; a delete of
395
+ * a row already gone succeeds. A row that moved past the revision the write
396
+ * `expect`s is refused as a conflict.
397
+ */
398
+ write: <P = unknown, R = never, Name extends string = string, Input = unknown>(mutation: MutationDescriptor<Name, Input, {}, {
399
+ readonly _tag: "Conflict";
400
+ }> & {
401
+ readonly write: AnyWrite;
402
+ }, writer: EntityWriter<P, R>) => MutationSource<P, R>;
220
403
  query: <P = unknown, R = never, Input = unknown>(query: QueryDescriptor<string, Input, unknown>, run: (context: {
221
404
  readonly input: Input;
222
405
  readonly window: QueryWindow;
@@ -228,14 +411,21 @@ export declare const RemoteServer: {
228
411
  readonly subscribe: LiveSource<P, R>["subscribe"];
229
412
  }) => LiveSource<P, R>;
230
413
  /**
231
- * A `LiveHub` over entity sources. Pass it to `handlers` as `live`, then
232
- * call `hub.changed(ref, fields)` from wherever the data changes (a mutation
233
- * source, a database trigger); each subscriber that selects any of those
234
- * fields receives them, re-read through the entity source under its own
235
- * principal. It needs only the entity sources, so the mutation sources that
236
- * signal it can be built after it.
414
+ * A `LiveHub` over entity sources. Pass it to `handlers` as `live`, and every
415
+ * mutation's answered patches and deletions are published to it; call
416
+ * `hub.changed(ref, fields)` yourself only for a write that is not a
417
+ * mutation (a database trigger, a job). Each subscriber that selects any of
418
+ * those fields receives them, re-read through the entity source under its
419
+ * own principal.
237
420
  */
238
- liveHub: <P, R>(entities: ReadonlyArray<EntitySource<P, R>>) => Effect.Effect<LiveHub<P, R>>;
421
+ liveHub: <P, R>(entities: ReadonlyArray<EntitySource<P, R>>, options?: {
422
+ /**
423
+ * Who a principal is, for sharing re-reads: subscribers whose principals
424
+ * have one key share one read, under the first one's principal. Default:
425
+ * the principal itself, so only the same value shares.
426
+ */
427
+ readonly key?: ((principal: P) => unknown) | undefined;
428
+ }) => Effect.Effect<LiveHub<P, R>>;
239
429
  make: <P = unknown, R = never>(config: {
240
430
  readonly entities: readonly EntitySource<P, R>[];
241
431
  readonly mutations?: readonly MutationSource<P, R>[];
@@ -248,12 +438,6 @@ export declare const RemoteServer: {
248
438
  * call time.
249
439
  */
250
440
  validate: (domain: RemoteDescriptor, server: ServerDefinition<any, any>) => void;
251
- /**
252
- * Compiles the server into the `Read`/`Mutate` RPC handlers. `principal` is
253
- * resolved outside (authentication middleware in a later phase); unknown
254
- * entities, entities with no allowed fields, and unknown mutations return an
255
- * error or nothing rather than leaking existence.
256
- */
257
441
  /**
258
442
  * Reads entity requirements through the entity sources, level by level,
259
443
  * following relations as `FoldkitRemoteRead` does. Shared by the read
@@ -277,15 +461,23 @@ export declare const RemoteServer: {
277
461
  * worker or a server in the page calls with the body it received, parsed.
278
462
  * The request and its payload are decoded by the protocol's own schemas
279
463
  * before a handler sees them, so an operation name is one of Remote's three
280
- * and nothing else. A body that is not a request is a 400; a handler's
281
- * failure a 500 with its message; a defect a 500 that says nothing of it.
464
+ * and nothing else. A body that is not a request is a 400; a refusal of who
465
+ * is asking a 403; a handler's failure a 500 with its message; a defect a
466
+ * 500 that says nothing of it.
282
467
  * `Remote.json` and `Remote.http` are the other end.
283
468
  */
284
469
  answer: <R>(handlers: RemoteRpcClient<R>, body: unknown) => Effect.Effect<{
285
- readonly status: 200 | 400 | 500;
470
+ readonly status: 200 | 400 | 403 | 422 | 500;
286
471
  readonly body: RemoteJsonAnswer;
287
472
  }, never, R>;
288
- handlers: <P, R>(server: ServerDefinition<P, R>, principal: P, options?: HandlerOptions<P, R>) => RemoteRpcClient<R>;
473
+ /**
474
+ * Compiles the server into Remote's RPC handlers, answering as `principal`:
475
+ * a value, or a Context key (`G.Principal`) read on each call, which
476
+ * authentication provides per request. Unknown entities, entities with no
477
+ * allowed fields, and unknown mutations return an error or nothing rather
478
+ * than leaking existence.
479
+ */
480
+ handlers: <P, R, I = never>(server: ServerDefinition<P, R>, principal: P | Context.Key<I, P>, options?: HandlerOptions<P, R>) => RemoteRpcClient<R | I>;
289
481
  };
290
482
  //#endregion
291
483
  export { QueryEvaluateError, type Row, assertSupported, evaluate, supported };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;qBAmDa,0BAA0B;iBAOtB;WACN;WACA,QAAQ,SAAS;;iBAGX,oBAAoB;WAC1B;WACA;;WAEA,UAAU,SAAS,eAAe;WAClC,WAAW;;iBAGL,aAAa,GAAG;WACtB;;WAEA,SAAS;WACT,OACP,SAAS,oBAAoB,OAC1B,OAAO,OAAO,cAAc,eAAe,mBAAmB;;WAE1D,aAAa,WAAW,GAAG;;;YAI1B,mBAAmB,OAAO,OAAO,YAAY;iBA8CxC,gBAAgB;WACtB,QAAQ;WACR,WAAW,cAAc;;WAEzB,cAAc,cAAc;;;;;WAK5B,UAAU;aAAyB;aAAyB;;;iBAGtD,eAAe,GAAG;WACxB;WACA,OAAO,OAAO;WACd,QAAQ,OAAO;WACf,MAAM;aAAoB;aAAyB,WAAW;QAAQ,OAAO;aAEzE;aACA,UAAU,cAAc;aACxB,aAAa,cAAc;aAC3B,SAAS;eAAyB;eAAyB;;KAEtE,mBACA;;iBAIa;WACN,OAAO;aACL;aACA;aACA;;WAE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