@ember-data/legacy-compat 5.4.0-alpha.32 → 5.4.0-alpha.33
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 +15 -15
- package/unstable-preview-types/-private.d.ts +17 -15
- package/unstable-preview-types/index.d.ts +154 -141
- package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts +49 -47
- package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts +5 -3
- package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts +5 -3
- package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts +6 -4
- package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts +5 -3
- package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts +549 -547
- package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts +235 -233
- package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts +9 -7
- package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts +88 -86
- package/unstable-preview-types/legacy-network-handler/snapshot.d.ts +248 -246
|
@@ -1,95 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
7
|
-
import type {
|
|
8
|
-
import type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@class SnapshotRecordArray
|
|
15
|
-
@public
|
|
16
|
-
*/
|
|
17
|
-
export default class SnapshotRecordArray {
|
|
18
|
-
_snapshots: Snapshot[] | null;
|
|
19
|
-
_type: ModelSchema | null;
|
|
20
|
-
modelName: string;
|
|
21
|
-
__store: Store;
|
|
22
|
-
adapterOptions?: Record<string, unknown>;
|
|
23
|
-
include?: string | string[];
|
|
24
|
-
/**
|
|
25
|
-
SnapshotRecordArray is not directly instantiable.
|
|
26
|
-
Instances are provided to consuming application's
|
|
27
|
-
adapters and serializers for certain requests.
|
|
28
|
-
|
|
29
|
-
@method constructor
|
|
30
|
-
@private
|
|
31
|
-
@constructor
|
|
32
|
-
@param {Store} store
|
|
33
|
-
@param {string} type
|
|
34
|
-
@param options
|
|
35
|
-
*/
|
|
36
|
-
constructor(store: Store, type: string, options?: FindAllOptions);
|
|
37
|
-
/**
|
|
38
|
-
An array of records
|
|
39
|
-
|
|
40
|
-
@property _recordArray
|
|
41
|
-
@private
|
|
42
|
-
@type {Array}
|
|
43
|
-
*/
|
|
44
|
-
get _recordArray(): IdentifierArray;
|
|
45
|
-
/**
|
|
46
|
-
Number of records in the array
|
|
1
|
+
declare module '@ember-data/legacy-compat/legacy-network-handler/snapshot-record-array' {
|
|
2
|
+
/**
|
|
3
|
+
@module @ember-data/legacy-compat
|
|
4
|
+
*/
|
|
5
|
+
import type Store from '@ember-data/store';
|
|
6
|
+
import type IdentifierArray from '@ember-data/store/-private/record-arrays/identifier-array';
|
|
7
|
+
import type { ModelSchema } from '@ember-data/store/-types/q/ds-model';
|
|
8
|
+
import type { FindAllOptions } from '@ember-data/store/-types/q/store';
|
|
9
|
+
import type Snapshot from '@ember-data/legacy-compat/legacy-network-handler/snapshot';
|
|
10
|
+
/**
|
|
11
|
+
SnapshotRecordArray is not directly instantiable.
|
|
12
|
+
Instances are provided to consuming application's
|
|
13
|
+
adapters for certain `findAll` requests.
|
|
47
14
|
|
|
15
|
+
@class SnapshotRecordArray
|
|
16
|
+
@public
|
|
17
|
+
*/
|
|
18
|
+
export default class SnapshotRecordArray {
|
|
19
|
+
_snapshots: Snapshot[] | null;
|
|
20
|
+
_type: ModelSchema | null;
|
|
21
|
+
modelName: string;
|
|
22
|
+
__store: Store;
|
|
23
|
+
adapterOptions?: Record<string, unknown>;
|
|
24
|
+
include?: string | string[];
|
|
25
|
+
/**
|
|
26
|
+
SnapshotRecordArray is not directly instantiable.
|
|
27
|
+
Instances are provided to consuming application's
|
|
28
|
+
adapters and serializers for certain requests.
|
|
29
|
+
|
|
30
|
+
@method constructor
|
|
31
|
+
@private
|
|
32
|
+
@constructor
|
|
33
|
+
@param {Store} store
|
|
34
|
+
@param {string} type
|
|
35
|
+
@param options
|
|
36
|
+
*/
|
|
37
|
+
constructor(store: Store, type: string, options?: FindAllOptions);
|
|
38
|
+
/**
|
|
39
|
+
An array of records
|
|
40
|
+
|
|
41
|
+
@property _recordArray
|
|
42
|
+
@private
|
|
43
|
+
@type {Array}
|
|
44
|
+
*/
|
|
45
|
+
get _recordArray(): IdentifierArray;
|
|
46
|
+
/**
|
|
47
|
+
Number of records in the array
|
|
48
|
+
|
|
49
|
+
Example
|
|
50
|
+
|
|
51
|
+
```app/adapters/post.js
|
|
52
|
+
import JSONAPIAdapter from '@ember-data/adapter/json-api';
|
|
53
|
+
|
|
54
|
+
export default class PostAdapter extends JSONAPIAdapter {
|
|
55
|
+
shouldReloadAll(store, snapshotRecordArray) {
|
|
56
|
+
return !snapshotRecordArray.length;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
@property length
|
|
62
|
+
@public
|
|
63
|
+
@type {Number}
|
|
64
|
+
*/
|
|
65
|
+
get length(): number;
|
|
66
|
+
/**
|
|
67
|
+
Get snapshots of the underlying record array
|
|
68
|
+
|
|
48
69
|
Example
|
|
49
|
-
|
|
70
|
+
|
|
50
71
|
```app/adapters/post.js
|
|
51
72
|
import JSONAPIAdapter from '@ember-data/adapter/json-api';
|
|
52
|
-
|
|
73
|
+
|
|
53
74
|
export default class PostAdapter extends JSONAPIAdapter {
|
|
54
|
-
shouldReloadAll(store,
|
|
55
|
-
|
|
75
|
+
shouldReloadAll(store, snapshotArray) {
|
|
76
|
+
let snapshots = snapshotArray.snapshots();
|
|
77
|
+
|
|
78
|
+
return snapshots.any(function(ticketSnapshot) {
|
|
79
|
+
let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');
|
|
80
|
+
if (timeDiff > 20) {
|
|
81
|
+
return true;
|
|
82
|
+
} else {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
56
86
|
}
|
|
57
|
-
}
|
|
87
|
+
}
|
|
58
88
|
```
|
|
59
|
-
|
|
60
|
-
@
|
|
89
|
+
|
|
90
|
+
@method snapshots
|
|
61
91
|
@public
|
|
62
|
-
@
|
|
92
|
+
@return {Array} Array of snapshots
|
|
63
93
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Example
|
|
69
|
-
|
|
70
|
-
```app/adapters/post.js
|
|
71
|
-
import JSONAPIAdapter from '@ember-data/adapter/json-api';
|
|
72
|
-
|
|
73
|
-
export default class PostAdapter extends JSONAPIAdapter {
|
|
74
|
-
shouldReloadAll(store, snapshotArray) {
|
|
75
|
-
let snapshots = snapshotArray.snapshots();
|
|
76
|
-
|
|
77
|
-
return snapshots.any(function(ticketSnapshot) {
|
|
78
|
-
let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');
|
|
79
|
-
if (timeDiff > 20) {
|
|
80
|
-
return true;
|
|
81
|
-
} else {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
@method snapshots
|
|
90
|
-
@public
|
|
91
|
-
@return {Array} Array of snapshots
|
|
92
|
-
*/
|
|
93
|
-
snapshots(): Snapshot<unknown>[];
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=snapshot-record-array.d.ts.map
|
|
94
|
+
snapshots(): Snapshot<unknown>[];
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=snapshot-record-array.d.ts.map
|
|
97
|
+
}
|