resourcerer 1.1.4 → 1.1.6
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/index.d.ts +17 -15
- package/package.json +6 -23
package/index.d.ts
CHANGED
|
@@ -36,30 +36,30 @@ declare module 'resourcerer' {
|
|
|
36
36
|
|
|
37
37
|
has(key: keyof T): boolean;
|
|
38
38
|
|
|
39
|
-
clear(options?: SetOptions): Model
|
|
39
|
+
clear(options?: SetOptions): Model<T>;
|
|
40
40
|
|
|
41
|
-
unset(attr: keyof T, options?: SetOptions): Model
|
|
41
|
+
unset(attr: keyof T, options?: SetOptions): Model<T>;
|
|
42
42
|
|
|
43
43
|
parse(response: Record<string, any>): T;
|
|
44
44
|
|
|
45
45
|
pick<K extends keyof T>(...attrs: K[]): Pick<T, K>;
|
|
46
46
|
|
|
47
|
-
set(attrs: Partial<T>, options?: SetOptions): Model
|
|
47
|
+
set(attrs: Partial<T>, options?: SetOptions): Model<T>;
|
|
48
48
|
|
|
49
|
-
fetch(options?: {parse?: boolean} & SyncOptions & SetOptions): Promise<[Model
|
|
49
|
+
fetch(options?: {parse?: boolean} & SyncOptions & SetOptions): Promise<[Model<T>, Response]>;
|
|
50
50
|
|
|
51
51
|
save(attrs: Partial<T>, options?: {wait?: boolean} & SyncOptions & SetOptions):
|
|
52
|
-
Promise<[Model
|
|
52
|
+
Promise<[Model<T>, Response]>;
|
|
53
53
|
|
|
54
|
-
destroy(options?: {wait?: boolean} & SyncOptions & SetOptions): Promise<[Model
|
|
54
|
+
destroy(options?: {wait?: boolean} & SyncOptions & SetOptions): Promise<[Model<T>, Response]>;
|
|
55
55
|
|
|
56
56
|
isNew(): boolean;
|
|
57
57
|
|
|
58
58
|
toJSON(): T;
|
|
59
59
|
|
|
60
|
-
url(): string;
|
|
60
|
+
url(urlOptions?: Record<string, any>): string;
|
|
61
61
|
|
|
62
|
-
urlRoot(): string;
|
|
62
|
+
urlRoot(urlOptions?: Record<string, any>): string;
|
|
63
63
|
|
|
64
64
|
static cacheFields: Array<string | ((attrs: T) => Record<string, any>)>;
|
|
65
65
|
|
|
@@ -81,17 +81,17 @@ declare module 'resourcerer' {
|
|
|
81
81
|
constructor(
|
|
82
82
|
models?: ModelArg<T> | ModelArg<T>[],
|
|
83
83
|
options?: O
|
|
84
|
-
): Collection
|
|
84
|
+
): Collection<T>;
|
|
85
85
|
|
|
86
86
|
length: number;
|
|
87
87
|
|
|
88
|
-
add(models: ModelArg<T> | ModelArg<T>[], options?: CSetOptions): Collection
|
|
88
|
+
add(models: ModelArg<T> | ModelArg<T>[], options?: CSetOptions): Collection<T>;
|
|
89
89
|
|
|
90
|
-
remove(models: ModelArg<T> | ModelArg<T>[]): Collection
|
|
90
|
+
remove(models: ModelArg<T> | ModelArg<T>[]): Collection<T>;
|
|
91
91
|
|
|
92
|
-
set(models: ModelArg<T> | ModelArg<T>[], options?: CSetOptions): Collection
|
|
92
|
+
set(models: ModelArg<T> | ModelArg<T>[], options?: CSetOptions): Collection<T>;
|
|
93
93
|
|
|
94
|
-
reset(models: ModelArg<T>[], options?: CSetOptions): Collection
|
|
94
|
+
reset(models: ModelArg<T>[], options?: CSetOptions): Collection<T>;
|
|
95
95
|
|
|
96
96
|
get(id?: string | ModelArg<T>): Model<T> | undefined;
|
|
97
97
|
|
|
@@ -125,9 +125,9 @@ declare module 'resourcerer' {
|
|
|
125
125
|
create(
|
|
126
126
|
model: ModelArg<T>,
|
|
127
127
|
options?: {wait?: boolean} & SyncOptions & CSetOptions
|
|
128
|
-
): Promise<[
|
|
128
|
+
): Promise<[Model<T>, Response]>;
|
|
129
129
|
|
|
130
|
-
fetch(options?: {parse?: boolean} & SyncOptions & CSetOptions): Promise<[Collection
|
|
130
|
+
fetch(options?: {parse?: boolean} & SyncOptions & CSetOptions): Promise<[Collection<T>, Response]>;
|
|
131
131
|
|
|
132
132
|
url(urlOptions?: O): string;
|
|
133
133
|
|
|
@@ -165,6 +165,8 @@ declare module 'resourcerer' {
|
|
|
165
165
|
setResourceState(newState: {[key: string]: any}): void;
|
|
166
166
|
isOrWillBeLoading(): boolean;
|
|
167
167
|
[key: `${string}LoadingState`]: LoadingTypes;
|
|
168
|
+
[key: `${string}Collection`]: Collection;
|
|
169
|
+
[key: `${string}Model`]: Model;
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
declare function haveAllLoaded(loadingStates: LoadingTypes | LoadingTypes[]): boolean;
|
package/package.json
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resourcerer",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"repository": "github.com/noahgrant/resourcerer",
|
|
5
5
|
"description": "Declarative data-fetching and caching framework for React",
|
|
6
|
-
"keywords": [
|
|
7
|
-
|
|
8
|
-
"react"
|
|
9
|
-
],
|
|
10
|
-
"files": [
|
|
11
|
-
"*.js",
|
|
12
|
-
"index.d.ts",
|
|
13
|
-
"lib/*.js",
|
|
14
|
-
"test/*.js",
|
|
15
|
-
"*.md",
|
|
16
|
-
"docs/*.md"
|
|
17
|
-
],
|
|
6
|
+
"keywords": ["declarative data-fetching framework", "react"],
|
|
7
|
+
"files": ["*.js", "index.d.ts", "lib/*.js", "test/*.js", "*.md", "docs/*.md"],
|
|
18
8
|
"main": "index.js",
|
|
19
9
|
"type": "module",
|
|
20
10
|
"scripts": {
|
|
@@ -25,16 +15,9 @@
|
|
|
25
15
|
"test:debug": "node --inspect-brk ./node_modules/.bin/jest --runInBand"
|
|
26
16
|
},
|
|
27
17
|
"jest": {
|
|
28
|
-
"collectCoverageFrom": [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
],
|
|
32
|
-
"moduleDirectories": [
|
|
33
|
-
"node_modules"
|
|
34
|
-
],
|
|
35
|
-
"setupFilesAfterEnv": [
|
|
36
|
-
"./test/setup"
|
|
37
|
-
],
|
|
18
|
+
"collectCoverageFrom": ["lib/*.{js,jsx}", "!lib/constants.js"],
|
|
19
|
+
"moduleDirectories": ["node_modules"],
|
|
20
|
+
"setupFilesAfterEnv": ["./test/setup"],
|
|
38
21
|
"testEnvironment": "jsdom"
|
|
39
22
|
},
|
|
40
23
|
"exports": "./index.js",
|