lowlander 0.2.4 → 0.3.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.
@@ -5,7 +5,7 @@ Creates a stream type for reactive model streaming to clients with automatic upd
5
5
  Specify which fields to include; when they change, updates are pushed to subscribed clients.
6
6
  Supports nested linked models and type-safe field selection.
7
7
 
8
- **Signature:** `<T, S extends FieldSelection<T>>(Model: typeof E.Model<unknown> & (new (...args: any[]) => T), selection: S & ValidateSelection<T, S>, options?: { cache?: number; }) => typeof StreamType`
8
+ **Signature:** `<T, S extends FieldSelection<T>>(Model: (new () => any) & ModelClassRuntime<any, readonly any[], any, any> & (new (initial?: Partial<any>, txn?: Transaction) => any) & (new (...args: any[]) => T), selection: S & ValidateSelection<...>, options?: { ...; }) => typeof StreamType`
9
9
 
10
10
  **Type Parameters:**
11
11
 
@@ -14,7 +14,7 @@ Supports nested linked models and type-safe field selection.
14
14
 
15
15
  **Parameters:**
16
16
 
17
- - `Model: ModelClass & (new (...args: any[]) => T)` - - The Edinburgh model class
17
+ - `Model: E.AnyModelClass & (new (...args: any[]) => T)` - - The Edinburgh model class
18
18
  - `selection: S & ValidateSelection<T, S>` - - Field selection: `true` for simple fields, nested object for linked models
19
19
  - `options?: { cache?: number }` - - Optional settings
20
20
 
@@ -23,13 +23,12 @@ Supports nested linked models and type-safe field selection.
23
23
  **Examples:**
24
24
 
25
25
  ```ts
26
- ⁣@E.registerModel
27
- class Person extends Model {
28
- name = field(string);
29
- age = field(number);
30
- password = field(string);
31
- friends = field(array(link(Person)));
32
- }
26
+ const Person = E.defineModel('Person', class {
27
+ name = E.field(E.string);
28
+ age = E.field(E.number);
29
+ password = E.field(E.string);
30
+ friends = E.field(E.array(E.link(() => Person)));
31
+ }, { pk: 'name' });
33
32
 
34
33
  // Exclude password, include friends' names; cache 30s
35
34
  const PersonStream = createStreamType(Person, {
@@ -39,7 +38,7 @@ const PersonStream = createStreamType(Person, {
39
38
  }, { cache: 30 });
40
39
 
41
40
  export function streamPerson() {
42
- const person = Person.byName.get('Alice')!;
41
+ const person = Person.get('Alice')!;
43
42
  return new PersonStream(person);
44
43
  }
45
44
  ```
@@ -3,7 +3,7 @@
3
3
  Subscribes `target` to this model, and sends initial data.
4
4
  `target` is a virtual socket with a requestId+'d' user prefix, or a channel that subscribes such virtual sockets.
5
5
 
6
- **Signature:** `(target: number | Uint8Array<ArrayBufferLike> | number[], model: Model<any>, commitId: number, SubStreamType: typeof StreamTypeBase<any>, delta: number) => void`
6
+ **Signature:** `(target: number | Uint8Array<ArrayBufferLike> | number[], model: any, commitId: number, SubStreamType: typeof StreamTypeBase<any>, delta: number) => void`
7
7
 
8
8
  **Parameters:**
9
9
 
@@ -3,7 +3,7 @@
3
3
  Sends (updated) data for `model` to `target`.
4
4
  `target` is a virtual socket with a requestId+'d' user prefix, or a channel that subscribes such virtual sockets.
5
5
 
6
- **Signature:** `(target: number | Uint8Array<ArrayBufferLike> | number[], model: Model<any>, commitId: number, StreamType: typeof StreamTypeBase<any>, changed?: Change) => void`
6
+ **Signature:** `(target: number | Uint8Array<ArrayBufferLike> | number[], model: any, commitId: number, StreamType: typeof StreamTypeBase<any>, changed?: Change) => void`
7
7
 
8
8
  **Parameters:**
9
9