as-model 0.2.7 → 0.2.9
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.js +1 -0
- package/esm/updater/token.js +2 -0
- package/index.d.ts +13 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
package/esm/updater/token.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isToken } from "../validation";
|
|
2
|
+
import { tokenIdentifier } from "../identifiers";
|
|
2
3
|
function createToken() {
|
|
3
4
|
const value = {};
|
|
4
5
|
return {
|
|
@@ -8,6 +9,7 @@ function createToken() {
|
|
|
8
9
|
}
|
|
9
10
|
return token.value !== value;
|
|
10
11
|
},
|
|
12
|
+
tokenIdentifier,
|
|
11
13
|
value
|
|
12
14
|
};
|
|
13
15
|
}
|
package/index.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ export declare function createStore<
|
|
|
121
121
|
D extends S,
|
|
122
122
|
R extends (instance: () => T) => any = (instance: () => T) => T
|
|
123
123
|
>(
|
|
124
|
-
model: Model<S, T> | Key<S, T, R> | ModelUsage<S, T, R>,
|
|
124
|
+
model: Model<S, T> | Key<S, T, R> | ModelUsage<S, T, Model<S, T>, R>,
|
|
125
125
|
state?: D
|
|
126
126
|
): Store<S, T, R>;
|
|
127
127
|
|
|
@@ -142,7 +142,10 @@ export declare function createKey<
|
|
|
142
142
|
T extends ModelInstance,
|
|
143
143
|
D extends S,
|
|
144
144
|
R extends (instance: () => T) => any = (instance: () => T) => T
|
|
145
|
-
>(
|
|
145
|
+
>(
|
|
146
|
+
model: Model<S, T> | ModelUsage<S, T, Model<S, T>, R>,
|
|
147
|
+
state?: D
|
|
148
|
+
): ModelKey<S, T, R>;
|
|
146
149
|
|
|
147
150
|
/** createStores * */
|
|
148
151
|
|
|
@@ -165,20 +168,20 @@ export declare function createStores(
|
|
|
165
168
|
|
|
166
169
|
/** model API * */
|
|
167
170
|
|
|
168
|
-
export declare
|
|
171
|
+
export declare type ModelUsage<
|
|
169
172
|
S,
|
|
170
173
|
T extends ModelInstance,
|
|
174
|
+
M extends Model<S, T>,
|
|
171
175
|
R extends (instance: () => T) => any = (instance: () => T) => T
|
|
172
|
-
> {
|
|
173
|
-
(s: S): ValidInstance<S, T>;
|
|
176
|
+
> = M & {
|
|
174
177
|
createKey: <D extends S>(state?: D) => ModelKey<S, T, R>;
|
|
175
178
|
createStore: <D extends S>(state?: D) => Store<S, T, R>;
|
|
176
179
|
produce: <C extends (instance: () => T) => any = (instance: () => T) => T>(
|
|
177
180
|
s: C
|
|
178
|
-
) => ModelUsage<S, T, C>;
|
|
181
|
+
) => ModelUsage<S, T, M, C>;
|
|
179
182
|
wrapper: R;
|
|
180
|
-
extends: <E extends Record<string, any>>(e: E) => ModelUsage<S, T, R> & E;
|
|
181
|
-
}
|
|
183
|
+
extends: <E extends Record<string, any>>(e: E) => ModelUsage<S, T, M, R> & E;
|
|
184
|
+
};
|
|
182
185
|
|
|
183
186
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
184
187
|
export declare interface model {
|
|
@@ -189,7 +192,7 @@ export declare interface model {
|
|
|
189
192
|
>(
|
|
190
193
|
modelFn: Model<S, T>,
|
|
191
194
|
s?: R
|
|
192
|
-
): ModelUsage<S, T, R>;
|
|
195
|
+
): ModelUsage<S, T, typeof modelFn, R>;
|
|
193
196
|
createField: <P extends () => any>(
|
|
194
197
|
callback: P,
|
|
195
198
|
deps?: any[]
|
|
@@ -311,7 +314,7 @@ export declare const validations: {
|
|
|
311
314
|
R extends (ins: () => T) => any = (ins: () => T) => T
|
|
312
315
|
>(
|
|
313
316
|
data: any
|
|
314
|
-
) => data is ModelUsage<S, T, R>;
|
|
317
|
+
) => data is ModelUsage<S, T, typeof data, R>;
|
|
315
318
|
isStoreIndex: <
|
|
316
319
|
S,
|
|
317
320
|
T extends ModelInstance,
|