as-model 0.1.5 → 0.1.7

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.
Files changed (3) hide show
  1. package/esm/index.js +2 -0
  2. package/index.d.ts +28 -22
  3. package/package.json +1 -1
package/esm/index.js CHANGED
@@ -38,6 +38,7 @@ function config() {
38
38
  var _config = config(), createStore = _config.createStore, createKey = _config.createKey, createStores = _config.createStores, model = _config.model;
39
39
  import { createSignal, createSelector } from "./store";
40
40
  import { validations } from "./validation";
41
+ import { shallowEqual } from "./tools";
41
42
  export {
42
43
  config,
43
44
  createKey,
@@ -46,5 +47,6 @@ export {
46
47
  createStore,
47
48
  createStores,
48
49
  model,
50
+ shallowEqual,
49
51
  validations
50
52
  };
package/index.d.ts CHANGED
@@ -107,25 +107,12 @@ export declare interface ModelKey<
107
107
  createStore: <D extends S>(state?: D) => Store<S, T, R>;
108
108
  }
109
109
 
110
- // eslint-disable-next-line @typescript-eslint/naming-convention
111
- export declare interface createKey {
112
- <
113
- S,
114
- T extends ModelInstance,
115
- D extends S,
116
- R extends (instance: () => T) => any = (instance: () => T) => T
117
- >(
118
- model: Model<S, T> | ModelUsage<S, T, R>,
119
- state?: D
120
- ): ModelKey<S, T, R>;
121
- isModelKey: <
122
- ST,
123
- INS extends ModelInstance,
124
- SE extends (instance: () => INS) => any = (instance: () => INS) => INS
125
- >(
126
- data: unknown
127
- ) => data is ModelKey<ST, INS, SE>;
128
- }
110
+ export declare function createKey<
111
+ S,
112
+ T extends ModelInstance,
113
+ D extends S,
114
+ R extends (instance: () => T) => any = (instance: () => T) => T
115
+ >(model: Model<S, T> | ModelUsage<S, T, R>, state?: D): ModelKey<S, T, R>;
129
116
 
130
117
  /** createStores * */
131
118
 
@@ -256,9 +243,25 @@ export declare function createSelector<
256
243
 
257
244
  /** config * */
258
245
  export declare function config(configuration: Config): {
259
- createStore: typeof createStore;
260
- createKey: typeof createKey;
261
- createStores: typeof createStores;
246
+ createStore: <
247
+ S,
248
+ T extends ModelInstance,
249
+ D extends S,
250
+ R extends (instance: () => T) => any = (instance: () => T) => T
251
+ >(
252
+ model: Model<S, T> | Key<S, T, R> | ModelUsage<S, T, R>,
253
+ state?: D
254
+ ) => Store<S, T, R>;
255
+ createKey: <
256
+ S,
257
+ T extends ModelInstance,
258
+ D extends S,
259
+ R extends (instance: () => T) => any = (instance: () => T) => T
260
+ >(
261
+ model: Model<S, T> | ModelUsage<S, T, R>,
262
+ state?: D
263
+ ) => ModelKey<S, T, R>;
264
+ createStores: (...modelKeys: (ModelKey | StoreIndex)[]) => StoreCollection;
262
265
  model: model;
263
266
  };
264
267
 
@@ -287,3 +290,6 @@ export declare const validations: {
287
290
  data: unknown
288
291
  ) => data is ModelUsage<S, T, R>;
289
292
  };
293
+
294
+ /** tools * */
295
+ export declare function shallowEqual(prev: unknown, current: unknown): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "as-model",
4
- "version": "0.1.5",
4
+ "version": "0.1.7",
5
5
  "description": "This is a model state management tool",
6
6
  "license": "MIT",
7
7
  "author": "Jimmy.Harding",