@expressive/mvc 1.0.0-beta.12 → 1.0.0-beta.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressive/mvc",
3
- "version": "1.0.0-beta.12",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "Use classes to define state in React!",
5
5
  "author": {
6
6
  "name": "Gabe Klein",
@@ -27,7 +27,7 @@
27
27
  "watch": "rollup --config --sourcemap --watch",
28
28
  "prebuild": "rm -rf lib/",
29
29
  "publish:pre": "npm version prerelease --preid=beta",
30
- "preversion": "jest",
30
+ "preversion": "jest --coverage",
31
31
  "postversion": "npm run build; npm publish",
32
32
  "postpublish": "git push; git push --tags; rm -rf lib",
33
33
  "coverage": "jest --collectCoverage",
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export {
2
+ State,
2
3
  Model,
3
4
  Model as default,
4
5
  Singleton
@@ -1,5 +1,5 @@
1
- import Model from '.';
2
- import { Async, Class, EffectCallback, InstanceOf } from './types';
1
+ import Model, { Selector } from '.';
2
+ import { Async, Class, InstanceOf, InterceptCallback } from './types';
3
3
 
4
4
  /**
5
5
  * Run instruction as controller sets itself up.
@@ -55,7 +55,7 @@ export function use <T extends Model> (): T | undefined;
55
55
  *
56
56
  * Note: Child will *not* be same object as one provided.
57
57
  */
58
- export function use <T extends BunchOf<any>> (object: T): T;
58
+ export function use <T extends {}> (object: T): T;
59
59
 
60
60
  /**
61
61
  * Generic instruction used by `use()` and `tap()` for recursive subscription.
@@ -99,15 +99,22 @@ export function tap <T extends typeof Model> (Type: T, callback?: (instance?: In
99
99
  * @param required - Throw if instance of Type cannot be found.
100
100
  */
101
101
  export function tap <T extends Class> (Type: T, required?: boolean): InstanceOf<T>;
102
-
102
+
103
103
  /**
104
- * Sets property to synchronously call effect upon update.
104
+ * Cause property to synchronously run effect upon update.
105
+ *
106
+ * Callback may return an effect callback, Promise (ignored), or a boolean.
107
+ *
108
+ * If a boolean is returned explicitly, new value will be dropped. Useful to override.
109
+ *
110
+ * - `false` will prevent update.
111
+ * - `true` will emit update (unchanged).
105
112
  *
106
- * @param starting - Beginning value of host property.
107
- * @param callback - Effect-callback fired upon set of host property.
113
+ * @param initialValue - Beginning value of host property.
114
+ * @param onUpdate - Effect-callback fired upon set of host property.
108
115
  */
109
- export function on <T = any> (initial: undefined, callback: EffectCallback<T>): T | undefined;
110
- export function on <T = any> (initial: T, callback: EffectCallback<T>): T;
116
+ export function on <T = any> (initialValue: undefined, onUpdate: InterceptCallback<T>): T | undefined;
117
+ export function on <T = any> (initialValue: T, onUpdate: InterceptCallback<T>): T;
111
118
 
112
119
  /**
113
120
  * Creates a ref-compatible property for use with components.
@@ -117,7 +124,7 @@ export function on <T = any> (initial: T, callback: EffectCallback<T>): T;
117
124
  *
118
125
  * @param callback - Optional callback to synchronously fire when reference is first set or does update.
119
126
  */
120
- export function ref <T = HTMLElement> (callback?: EffectCallback<T>): Model.Ref<T>;
127
+ export function ref <T = HTMLElement> (this: any, callback?: InterceptCallback<T>): Model.Ref<T>;
121
128
 
122
129
  /**
123
130
  * Sets an exotic method with managed ready-state. Property accepts an async function.
@@ -130,15 +137,24 @@ export function ref <T = HTMLElement> (callback?: EffectCallback<T>): Model.Ref<
130
137
  * @param action - Action to fire when resulting property is invoked.
131
138
  */
132
139
  export function act <T extends Async> (action: T): T & { active: boolean };
133
-
140
+
134
141
  /**
135
- * Implement a computed value; output will be generated by provided function.
142
+ * Implement a computed value; output is returned by function from provided factory.
136
143
  *
137
- * *Alternative to using native getters; works exactly the same!*
144
+ * @param fn - Factory function to generate a getter to subscribe dependancies.
145
+ */
146
+ export function from <R> (fn: (property: string) => (this: any, on: any) => R): R;
147
+
148
+ /**
149
+ * Implement a computed value; output will be generated by provided function.
138
150
  *
139
- * @param fn - Factory function to generate value and subscribe dependancies.
151
+ * @param source - Source model from which computed value will be subscribed.
152
+ * **Note:** Currently will only support `this`.
153
+ *
154
+ * @param fn - Compute function. Bound to a subscriber-proxy of source, returns output value.
155
+ * Will update automatically as accessed values change.
140
156
  */
141
- export function from <T, R> (fn: (this: T, on: T) => R): R;
157
+ export function from <T, R> (source: T, fn: (this: T, on: T) => R): R;
142
158
 
143
159
  /**
144
160
  * Memoized value. Computes and stores a value returned by provided factory.
package/types/model.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import Dispatch from './dispatch';
2
1
  import Lifecycle from './lifecycle';
3
- import { Selector } from './selector';
2
+ import { Select, Selector } from './selector';
4
3
  import { Class, InstanceOf, Key } from './types';
5
4
 
6
5
  interface PropertyDescriptor<T> {
@@ -12,6 +11,12 @@ interface PropertyDescriptor<T> {
12
11
  set?(v: T): void;
13
12
  }
14
13
 
14
+ type Argument<T> = T extends (arg: infer U) => any ? U : never;
15
+
16
+ type Thenable<T> = {
17
+ then(onFulfilled: (arg: T) => void): void;
18
+ }
19
+
15
20
  export namespace Model {
16
21
  /** Exotic value, actual value is contained. */
17
22
  interface Ref<T = any> {
@@ -25,7 +30,7 @@ export namespace Model {
25
30
  * Property initializer, will run upon instance creation.
26
31
  * Optional returned callback will run when once upon first access.
27
32
  */
28
- type Instruction<T> = (this: Controller, key: string) =>
33
+ type Instruction<T> = (this: Controller, key: string, thisArg: Controller) =>
29
34
  void | GetFunction<T> | PropertyDescriptor<T>;
30
35
 
31
36
  /** Shallow replacement given all entries of Model */
@@ -96,6 +101,14 @@ export namespace Model {
96
101
 
97
102
  type SelectField<T> = (arg: Omit<T, keyof Model>) => any;
98
103
 
104
+ type SelectFieldKey<T> = Select.Key<Fields<T>>;
105
+
106
+ type Typeof<T, ST, X extends keyof T = Exclude<keyof T, keyof Model>> = {
107
+ [Key in X]: T[Key] extends ST ? Key : never;
108
+ }[X];
109
+
110
+ type SelectTypeof<T, ST> = Select.Key<Typeof<T, ST>>;
111
+
99
112
  type HandleValue = (value: any) => boolean | void;
100
113
 
101
114
  export class Controller {
@@ -107,9 +120,7 @@ export namespace Model {
107
120
 
108
121
  select(using?: Query): string[];
109
122
 
110
- sets(key: string, effect?: HandleValue): (value: any) => boolean | void;
111
-
112
- watch(target: string | Iterable<string> | Query, handler: Function, squash?: boolean, once?: boolean): Callback;
123
+ setter(key: string, effect?: HandleValue): (value: any) => boolean | void;
113
124
 
114
125
  addListener(batch: BunchOf<RequestCallback>): Callback;
115
126
 
@@ -118,18 +129,16 @@ export namespace Model {
118
129
  include(cb: RequestCallback): void;
119
130
  }
120
131
 
121
- type Listener = {
122
- commit(): void;
123
- release(): void;
124
- }
125
-
126
132
  export class Subscriber {
127
133
  proxy: any;
128
134
  source: any;
135
+ parent: Controller;
129
136
  active: boolean;
130
137
  follows: BunchOf<Callback>;
131
- dependant: Set<Listener>;
132
- parent: Controller;
138
+ dependant: Set<{
139
+ commit(): void;
140
+ release(): void;
141
+ }>;
133
142
 
134
143
  follow(key: string, cb?: Callback | undefined): void;
135
144
  commit(): Callback;
@@ -142,9 +151,16 @@ declare const CONTROL: unique symbol;
142
151
  declare const LOCAL: unique symbol;
143
152
  declare const STATE: unique symbol;
144
153
 
145
- export interface Model extends Dispatch, Lifecycle {}
154
+ export abstract class State {
155
+ /** Controller for this instance. */
156
+ [CONTROL]: Model.Controller;
157
+
158
+ /** Current state of this instance. */
159
+ [STATE]?: Model.State<this>;
160
+
161
+ /** Current subscriber (if present) while used in a live context (e.g. hook or effect). */
162
+ [LOCAL]?: Model.Subscriber;
146
163
 
147
- export abstract class Model {
148
164
  /**
149
165
  * Circular reference to `this` controller.
150
166
  *
@@ -204,6 +220,36 @@ export abstract class Model {
204
220
  */
205
221
  set: this;
206
222
 
223
+ import <O extends Model.Data<this>> (via: O, select?: string[] | Model.SelectFields<this>): void;
224
+
225
+ export(): Model.State<this>;
226
+ export <P extends Model.Fields<this>> (select: P[]): Model.State<this, P>;
227
+ export <S extends Model.SelectFields<this>> (select: S): Model.State<this, Selector.From<S>>;
228
+
229
+ update(): PromiseLike<string[] | false>;
230
+ update(strict: true): Promise<string[]>;
231
+ update(strict: false): Promise<false>;
232
+ update(strict: boolean): Promise<string[] | false>;
233
+
234
+ update(keys: Model.Fields<this>): Thenable<string[]>;
235
+ update(keys: Model.SelectFieldKey<this>): Thenable<string[]>;
236
+
237
+ update(keys: Model.Fields<this>, callMethod: boolean): PromiseLike<string[]>;
238
+ update(keys: Model.SelectFields<this>, callMethod: boolean): PromiseLike<string[]>;
239
+
240
+ update<T>(keys: Model.Fields<this>, argument: T): PromiseLike<string[]>;
241
+ update<T>(keys: Model.SelectFields<this>, argument: T): PromiseLike<string[]>;
242
+
243
+ /*
244
+ Issue with self-reference, using fallback.
245
+
246
+ update(keys: Model.Typeof<this, () => void>, callMethod: boolean): Thenable<string[]>;
247
+ update(keys: Model.SelectTypeof<this, () => void>, callMethod: boolean): Thenable<string[]>;
248
+
249
+ update<T>(keys: Model.Typeof<this, (arg: T) => void>, argument: T): Thenable<string[]>;
250
+ update<T>(keys: Model.SelectTypeof<this, (arg: T) => void>, argument: T): Thenable<string[]>;
251
+ */
252
+
207
253
  /**
208
254
  * Mark this instance for garbage-collection and send `willDestroy` event to all listeners.
209
255
  *
@@ -233,33 +279,6 @@ export abstract class Model {
233
279
  tap <K extends Model.SelectField<this>> (key: K, expect?: boolean): ReturnType<K>;
234
280
  tap <K extends Model.SelectField<this>> (key: K, expect: true): Exclude<ReturnType<K>, undefined>;
235
281
 
236
- /**
237
- * **React Hook** - Attach to instance of this controller within ambient component.
238
- *
239
- * This method will fire lifecycle events on given controller.
240
- *
241
- * @param id - Argument passed to controller-lifecycle methods. Use to identify the consumer.
242
- */
243
- tag(id?: Key): this;
244
-
245
- /**
246
- * **React Hook** - Attach to instance of this controller within ambient component.
247
- *
248
- * This method will fire lifecycle events on given controller.
249
- *
250
- * @param idFactory - Will be invoked with fetched instance. Use this to register a tag as-needed.
251
- */
252
- tag(idFactory: (idFactory: this) => Key | void): this;
253
-
254
- /** Controller for this instance. */
255
- [CONTROL]: Model.Controller;
256
-
257
- /** Current state of this instance. */
258
- [STATE]?: Model.State<this>;
259
-
260
- /** Current subscriber (if present) while used in a live context (e.g. hook or effect). */
261
- [LOCAL]?: Model.Subscriber;
262
-
263
282
  /** Use symbol to access controller of a model. */
264
283
  static CONTROL: typeof CONTROL;
265
284
 
@@ -283,8 +302,11 @@ export abstract class Model {
283
302
  *
284
303
  * Differs from `use()` in lacking subscription and lifecycle events.
285
304
  * Much more efficient if you don't need hook-based features.
305
+ *
306
+ * @param args - Arguments passed to constructor of `this`
307
+ * @param callback - Run after creation of instance.
286
308
  */
287
- static new <T extends Class> (this: T, ...args: ConstructorParameters<T>): InstanceOf<T>;
309
+ static new <T extends Class> (this: T, args?: ConstructorParameters<T>, callback?: (instance: InstanceOf<T>) => void): InstanceOf<T>;
288
310
 
289
311
  /**
290
312
  * **React Hook** - Create and attach an instance of this controller a react component.
@@ -292,8 +314,9 @@ export abstract class Model {
292
314
  * Note: Model will be destroyed when ambient component unmounts!
293
315
  *
294
316
  * @param args - Arguments passed to constructor of `this`
317
+ * @param callback - Run after creation of instance.
295
318
  */
296
- static use <T extends Class> (this: T, ...args: ConstructorParameters<T>): InstanceOf<T>;
319
+ static use <T extends Class> (this: T, args?: ConstructorParameters<T>, callback?: (instance: InstanceOf<T>) => void): InstanceOf<T>;
297
320
 
298
321
  /**
299
322
  * **React Hook** - Similar to `use`, will instanciate a controller bound to ambient component.
@@ -301,7 +324,7 @@ export abstract class Model {
301
324
  *
302
325
  * @param data - Data to be applied to controller upon creation.
303
326
  */
304
- static uses <T extends Class, I extends InstanceOf<T>, D extends Partial<I>> (this: T, data: D): I;
327
+ static uses <T extends Class, I extends InstanceOf<T>, D extends Partial<I>> (this: T, data: D, only?: (keyof D)[]): I;
305
328
 
306
329
  /**
307
330
  * **React Hook** - Similar to `uses`, will instanciate a controller includive of given data.
@@ -310,7 +333,13 @@ export abstract class Model {
310
333
  *
311
334
  * @param data - Data to be observed by controller.
312
335
  */
313
- static using <T extends Class, I extends InstanceOf<T>, D extends Partial<I>> (this: T, data: D): I;
336
+ static using <T extends Class, I extends InstanceOf<T>, D extends Partial<I>> (this: T, data: D, only?: (keyof D)[]): I;
337
+
338
+ /**
339
+ * **React Hook** - Locate most relevant instance of this type in context.
340
+ */
341
+ static find <T extends Class>(this: T, strict: true): InstanceOf<T>;
342
+ static find <T extends Class>(this: T, strict?: boolean): InstanceOf<T> | undefined;
314
343
 
315
344
  /**
316
345
  * **React Hook** - Fetch most instance of this controller from context, if it exists.
@@ -356,6 +385,61 @@ export abstract class Model {
356
385
  static tap <T extends Class, I extends InstanceOf<T>, K extends Model.Fields<I>> (this: T, key: K, expect: true): Exclude<I[K], undefined>;
357
386
  static tap <T extends Class, I extends InstanceOf<T>, K extends Model.SelectField<I>> (this: T, key: K, expect: true): Exclude<ReturnType<K>, undefined>;
358
387
 
388
+ /**
389
+ * Static equivalent of `x instanceof this`.
390
+ *
391
+ * Will determine if provided class is a subtype of this one.
392
+ */
393
+ static isTypeof <T extends Class>(this: T, subject: any): subject is T;
394
+ }
395
+
396
+ export interface Model extends Lifecycle {}
397
+ export abstract class Model extends State {
398
+ // Keyed
399
+ on <S extends Model.SelectEvents<this>> (via: S, cb: Selector.Callback<S, this>, squash?: false, once?: boolean): Callback;
400
+ on <P extends Model.EventsCompat<this>> (key: P | P[], listener: UpdateCallback<this, P>, squash?: false, once?: boolean): Callback;
401
+ // Squash
402
+ on <S extends Model.SelectEvents<this>> (via: S, cb: (keys: Selector.From<S>[]) => void, squash: true, once?: boolean): Callback;
403
+ on <P extends Model.EventsCompat<this>> (key: P | P[], listener: (keys: P[]) => void, squash: true, once?: boolean): Callback;
404
+ // Unknown
405
+ on <S extends Model.SelectEvents<this>> (via: S, cb: unknown, squash: boolean, once?: boolean): Callback;
406
+ on <P extends Model.EventsCompat<this>> (key: P | P[], listener: unknown, squash: boolean, once?: boolean): Callback;
407
+
408
+ // Keyed
409
+ once <S extends Model.SelectEvents<this>> (via: S, cb: Selector.Callback<S, this>, squash?: false): Callback;
410
+ once <P extends Model.EventsCompat<this>> (key: P | P[], listener: UpdateCallback<this, P>, squash?: false): Callback;
411
+ // Squash
412
+ once <S extends Model.SelectEvents<this>> (via: S, cb: (keys: Selector.From<S>[]) => void, squash: true): Callback;
413
+ once <P extends Model.EventsCompat<this>> (key: P | P[], listener: (keys: P[]) => void, squash: true): Callback;
414
+ // Promise
415
+ once <S extends Model.SelectEvents<this>> (via: S): Promise<Selector.From<S>[]>;
416
+ once <P extends Model.EventsCompat<this>> (key: P | P[]): Promise<P[]>;
417
+ // Unknown
418
+ once <S extends Model.SelectEvents<this>> (via: S, cb: unknown, squash: boolean): Callback;
419
+ once <P extends Model.EventsCompat<this>> (key: P | P[], listener: unknown, squash: boolean): Callback;
420
+
421
+ effect(callback: (this: this, state: this) => void, select?: Model.SelectFields<this>): Callback;
422
+ effect(callback: (this: this, state: this) => void, select?: (keyof this)[]): Callback;
423
+
424
+ /**
425
+ * **React Hook** - Attach to instance of this controller within ambient component.
426
+ *
427
+ * This method will fire lifecycle events on given controller.
428
+ *
429
+ * @param id - Argument passed to controller-lifecycle methods. Use to identify the consumer.
430
+ */
431
+ tag(id?: Key): this;
432
+
433
+ /**
434
+ * **React Hook** - Attach to instance of this controller within ambient component.
435
+ *
436
+ * This method will fire lifecycle events on given controller.
437
+ *
438
+ * @param idFactory - Will be invoked with fetched instance. Use this to register a tag as-needed.
439
+ */
440
+ tag(idFactory: (idFactory: this) => Key | void): this;
441
+
442
+
359
443
  /**
360
444
  * **React Hook** - Attach to instance of this controller within ambient component.
361
445
  *
@@ -389,28 +473,20 @@ export abstract class Model {
389
473
  * Documentation TBD.
390
474
  */
391
475
  static meta <T extends Class, K extends Model.SelectField<T>> (this: T, key?: K): ReturnType<K>;
392
-
393
- /**
394
- * **React Hook** - Locate most relevant instance of this type in context.
395
- */
396
- static find <T extends Class>(this: T): InstanceOf<T>;
397
-
398
- /**
399
- * Static equivalent of `x instanceof this`.
400
- *
401
- * Will determine if provided class is a subtype of this one.
402
- */
403
- static isTypeof <T extends Class>(this: T, subject: any): subject is T;
404
-
405
- /**
406
- * Retreives parent inherited by this class, unless it is base `Model`.
407
- */
408
- static inherits: typeof Model | undefined;
409
476
  }
410
477
 
411
478
  export class Singleton extends Model {
412
- /** Current instance of this controller accessable anywhere. */
413
- static current?: Singleton;
479
+ /** Get current instance of this singleton. Will throw if one does not exist. */
480
+ static is<T extends Class>(this: T): InstanceOf<T>;
481
+
482
+ /**
483
+ * Update the active instance of this class.
484
+ * Returns a thenable; resolves after successful update.
485
+ * If instance does not already exist, one will be created.
486
+ **/
487
+ static update<T extends Class>(
488
+ this: T, updates: Model.Data<InstanceOf<T>>
489
+ ): PromiseLike<string[] | false>;
414
490
 
415
491
  /** Destroy current instance of Singleton, if it exists. */
416
492
  static reset(): void;
package/types/selector.ts CHANGED
@@ -1,3 +1,7 @@
1
+ export type KeysOfType<T, ST> = {
2
+ [Key in keyof T]: T[Key] extends ST ? Key : never
3
+ }[keyof T];
4
+
1
5
  export namespace Selector {
2
6
  /**
3
7
  * Shallow-recursive clone of source object.
@@ -29,4 +33,15 @@ export namespace Selector {
29
33
 
30
34
  export type Callback<S extends Function<any>, T> =
31
35
  (this: T, value: Gets<S>, key: From<S>) => void;
36
+ }
37
+
38
+ export namespace Select {
39
+ export type One<T> =
40
+ (arg: { [K in keyof T]: K }) => string & keyof T;
41
+
42
+ export type Key<T extends string | number | symbol> =
43
+ (arg: { [K in T]: K }) => string & T;
44
+
45
+ export type From<T extends One<any>> =
46
+ T extends (from: any) => infer R ? R : never;
32
47
  }
package/types/types.d.ts CHANGED
@@ -10,5 +10,6 @@ export type Callback = () => void;
10
10
  export type RequestCallback = (keys?: string[]) => void;
11
11
  export type EffectCallback<T, A = T> = (this: T, argument: A) => Callback | Promise<any> | void;
12
12
  export type UpdateCallback<T, P> = (this: T, value: IfApplicable<T, P>, changed: P) => void;
13
+ export type InterceptCallback<T> = (argument: T) => ((next: T) => void) | Promise<any> | void | boolean;
13
14
 
14
15
  export type RefFunction = (e: HTMLElement | null) => void;
@@ -1,52 +0,0 @@
1
- import { Model } from './model';
2
- import { Selector } from './selector';
3
- import { Callback, EffectCallback, UpdateCallback } from './types';
4
-
5
- /**
6
- * Observable Instance
7
- *
8
- * Implements internal value tracking.
9
- * Able to be subscribed to, per-value to know when updated.
10
- */
11
- interface Dispatch {
12
- // Keyed
13
- on <S extends Model.SelectEvents<this>> (via: S, cb: Selector.Callback<S, this>, squash?: false, once?: boolean): Callback;
14
- on <P extends Model.EventsCompat<this>> (key: P | P[], listener: UpdateCallback<this, P>, squash?: false, once?: boolean): Callback;
15
- // Squash
16
- on <S extends Model.SelectEvents<this>> (via: S, cb: (keys: Selector.From<S>[]) => void, squash: true, once?: boolean): Callback;
17
- on <P extends Model.EventsCompat<this>> (key: P | P[], listener: (keys: P[]) => void, squash: true, once?: boolean): Callback;
18
- // Unknown
19
- on <S extends Model.SelectEvents<this>> (via: S, cb: unknown, squash: boolean, once?: boolean): Callback;
20
- on <P extends Model.EventsCompat<this>> (key: P | P[], listener: unknown, squash: boolean, once?: boolean): Callback;
21
-
22
- // Keyed
23
- once <S extends Model.SelectEvents<this>> (via: S, cb: Selector.Callback<S, this>, squash?: false): Callback;
24
- once <P extends Model.EventsCompat<this>> (key: P | P[], listener: UpdateCallback<this, P>, squash?: false): Callback;
25
- // Squash
26
- once <S extends Model.SelectEvents<this>> (via: S, cb: (keys: Selector.From<S>[]) => void, squash: true): Callback;
27
- once <P extends Model.EventsCompat<this>> (key: P | P[], listener: (keys: P[]) => void, squash: true): Callback;
28
- // Promise
29
- once <S extends Model.SelectEvents<this>> (via: S): Promise<Selector.From<S>[]>;
30
- once <P extends Model.EventsCompat<this>> (key: P | P[]): Promise<P[]>;
31
- // Unknown
32
- once <S extends Model.SelectEvents<this>> (via: S, cb: unknown, squash: boolean): Callback;
33
- once <P extends Model.EventsCompat<this>> (key: P | P[], listener: unknown, squash: boolean): Callback;
34
-
35
- effect(callback: EffectCallback<this>, select?: Model.SelectFields<this>): Callback;
36
- effect(callback: EffectCallback<this>, select?: (keyof this)[]): Callback;
37
-
38
- import <O extends Model.Data<this>> (via: O, select?: string[] | Model.SelectFields<this>): void;
39
-
40
- export(): Model.State<this>;
41
- export <P extends Model.Fields<this>> (select: P[]): Model.State<this, P>;
42
- export <S extends Model.SelectFields<this>> (select: S): Model.State<this, Selector.From<S>>;
43
-
44
- update(strict: true): Promise<string[]>;
45
- update(strict: false): Promise<false>;
46
- update(strict?: boolean): Promise<string[] | false>;
47
- update(keys: Model.Fields<this>[]): Promise<string[]>;
48
- update(keys: Model.Fields<this>): Promise<string[]>;
49
- update(keys: Model.SelectFields<this>): Promise<string[]>;
50
- }
51
-
52
- export = Dispatch;