@ember-data/legacy-compat 5.6.0-beta.0 → 5.6.0-beta.2
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/addon-main.cjs +1 -1
- package/dist/-private.js +1 -1
- package/dist/builders.js +1 -323
- package/dist/index.js +1 -1011
- package/dist/utils.js +1 -246
- package/package.json +7 -34
- package/unstable-preview-types/-private.d.ts +7 -14
- package/unstable-preview-types/builders.d.ts +9 -13
- package/unstable-preview-types/index.d.ts +4 -159
- package/unstable-preview-types/utils.d.ts +9 -159
- package/dist/-private-Bnt-3W7M.js +0 -1207
- package/dist/-private-Bnt-3W7M.js.map +0 -1
- package/dist/-private.js.map +0 -1
- package/dist/builders.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/unstable-preview-types/-private.d.ts.map +0 -1
- package/unstable-preview-types/builders/find-all.d.ts +0 -41
- package/unstable-preview-types/builders/find-all.d.ts.map +0 -1
- package/unstable-preview-types/builders/find-record.d.ts +0 -62
- package/unstable-preview-types/builders/find-record.d.ts.map +0 -1
- package/unstable-preview-types/builders/query.d.ts +0 -72
- package/unstable-preview-types/builders/query.d.ts.map +0 -1
- package/unstable-preview-types/builders/save-record.d.ts +0 -40
- package/unstable-preview-types/builders/save-record.d.ts.map +0 -1
- package/unstable-preview-types/builders/utils.d.ts +0 -6
- package/unstable-preview-types/builders/utils.d.ts.map +0 -1
- package/unstable-preview-types/builders.d.ts.map +0 -1
- package/unstable-preview-types/index.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts +0 -49
- package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts +0 -5
- package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts +0 -14
- package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts +0 -8
- package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts +0 -5
- package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts +0 -549
- package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts +0 -235
- package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts +0 -9
- package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts +0 -96
- package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts.map +0 -1
- package/unstable-preview-types/legacy-network-handler/snapshot.d.ts +0 -248
- package/unstable-preview-types/legacy-network-handler/snapshot.d.ts.map +0 -1
- package/unstable-preview-types/utils.d.ts.map +0 -1
|
@@ -1,161 +1,11 @@
|
|
|
1
1
|
declare module '@ember-data/legacy-compat/utils' {
|
|
2
|
-
type Reporter = (type: 'formatted-id' | 'formatted-type', actual: unknown, expected: unknown) => void;
|
|
3
2
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
export function configureMismatchReporter(fn: Reporter): void;
|
|
15
|
-
/**
|
|
16
|
-
* Configure a function to be called when an id or type
|
|
17
|
-
* fails validation. This is useful for instrumenting
|
|
18
|
-
* to discover places where usage in the app is not consistent.
|
|
19
|
-
*
|
|
20
|
-
* @method configureAssertFn
|
|
21
|
-
* @for @ember-data/legacy-compat/utils
|
|
22
|
-
* @param method a function which takes a message and a condition
|
|
23
|
-
* @public
|
|
24
|
-
* @static
|
|
25
|
-
*/
|
|
26
|
-
export function configureAssertFn(fn: (message: string, condition: unknown) => void): void;
|
|
27
|
-
/**
|
|
28
|
-
* Configure a function to be called to normalize
|
|
29
|
-
* a resource type string. Used by both formattedType
|
|
30
|
-
* and isEquivType to ensure consistent normalization
|
|
31
|
-
* during comparison.
|
|
32
|
-
*
|
|
33
|
-
* If validation fails or the type turns out be unnormalized
|
|
34
|
-
* the configured mismatch reporter and assert functions will
|
|
35
|
-
* be called.
|
|
36
|
-
*
|
|
37
|
-
* @method configureTypeNormalization
|
|
38
|
-
* @for @ember-data/legacy-compat/utils
|
|
39
|
-
* @param method a function which takes a string and returns a string
|
|
40
|
-
* @public
|
|
41
|
-
* @static
|
|
42
|
-
*/
|
|
43
|
-
export function configureTypeNormalization(fn: (type: string) => string): void;
|
|
44
|
-
/**
|
|
45
|
-
* Converts a potentially unnormalized type into the format expected
|
|
46
|
-
* by our EmberData Cache. Currently this is singular-dasherized.
|
|
47
|
-
*
|
|
48
|
-
* you should not rely on this function to give you an exact format
|
|
49
|
-
* for display purposes. Formatting for display should be handled
|
|
50
|
-
* differently if the exact format matters.
|
|
51
|
-
*
|
|
52
|
-
* Asserts invalid types (undefined, null, '') in dev.
|
|
53
|
-
*
|
|
54
|
-
* **Usage**
|
|
55
|
-
*
|
|
56
|
-
* ```js
|
|
57
|
-
* import formattedType from 'soxhub-client/helpers/formatted-type';
|
|
58
|
-
*
|
|
59
|
-
* formattedType('post'); // => 'post'
|
|
60
|
-
* formattedType('posts'); // => 'post'
|
|
61
|
-
* formattedType('Posts'); // => 'post'
|
|
62
|
-
* formattedType('post-comment'); // => 'post-comment'
|
|
63
|
-
* formattedType('post-comments'); // => 'post-comment'
|
|
64
|
-
* formattedType('post_comment'); // => 'post-comment'
|
|
65
|
-
* formattedType('postComment'); // => 'post-comment'
|
|
66
|
-
* formattedType('PostComment'); // => 'post-comment'
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* @method formattedType
|
|
70
|
-
* @for @ember-data/legacy-compat/utils
|
|
71
|
-
* @param {String} type the potentially un-normalized type
|
|
72
|
-
* @return {String} the normalized type
|
|
73
|
-
* @public
|
|
74
|
-
* @static
|
|
75
|
-
*/
|
|
76
|
-
export function formattedType<T extends string>(type: T | string): T;
|
|
77
|
-
/**
|
|
78
|
-
* Format an id to the format expected by the EmberData Cache.
|
|
79
|
-
* Currently this means that id should be `string | null`.
|
|
80
|
-
*
|
|
81
|
-
* Asserts invalid IDs (undefined, '', 0, '0') in dev.
|
|
82
|
-
*
|
|
83
|
-
* **Usage**
|
|
84
|
-
*
|
|
85
|
-
* ```js
|
|
86
|
-
* import formattedId from 'client/utils/formatted-id';
|
|
87
|
-
*
|
|
88
|
-
* formattedId('1'); // => '1'
|
|
89
|
-
* formattedId(1); // => '1'
|
|
90
|
-
* formattedId(null); // => null
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* @method formattedId
|
|
94
|
-
* @for @ember-data/legacy-compat/utils
|
|
95
|
-
* @param {String | Number | null} id the potentially un-normalized id
|
|
96
|
-
* @return {String | null} the normalized id
|
|
97
|
-
* @public
|
|
98
|
-
* @static
|
|
99
|
-
*/
|
|
100
|
-
export function formattedId(id: string | number): string;
|
|
101
|
-
export function formattedId(id: null): null;
|
|
102
|
-
export function formattedId(id: string | number | null): string | null;
|
|
103
|
-
export function expectId(id: string | number): string;
|
|
104
|
-
export function expectId(id: null): never;
|
|
105
|
-
/**
|
|
106
|
-
* Compares two types for strict equality, converting them to
|
|
107
|
-
* the format expected by the EmberData Cache to ensure
|
|
108
|
-
* differences in format are accounted for in the comparison.
|
|
109
|
-
*
|
|
110
|
-
* Asserts when expected or actual are invalid types in dev.
|
|
111
|
-
* Expected may never be null.
|
|
112
|
-
*
|
|
113
|
-
* ```js
|
|
114
|
-
* isEquivType('posts', 'post'); // true
|
|
115
|
-
* isEquivType('post', 'post'); // true
|
|
116
|
-
* isEquivType('posts', 'posts'); // true
|
|
117
|
-
* isEquivType('post-comment', 'postComment'); // true
|
|
118
|
-
* isEquivType('post-comment', 'PostComment'); // true
|
|
119
|
-
* isEquivType('post-comment', 'post_comment'); // true
|
|
120
|
-
* isEquivType('post-comment', 'post-comment'); // true
|
|
121
|
-
* isEquivType('post-comment', 'post'); // false
|
|
122
|
-
* isEquivType('posts', null); // false
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* @method isEquivType
|
|
126
|
-
* @for @ember-data/legacy-compat/utils
|
|
127
|
-
* @param {String} expected a potentially unnormalized type to match against
|
|
128
|
-
* @param {String} actual a potentially unnormalized type to match against
|
|
129
|
-
* @return {Boolean} true if the types are equivalent
|
|
130
|
-
* @public
|
|
131
|
-
* @static
|
|
132
|
-
*/
|
|
133
|
-
export function isEquivType(expected: string, actual: string): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Compares two IDs for strict equality, converting them to
|
|
136
|
-
* the format expected by the EmberData Cache to ensure
|
|
137
|
-
* differences in format are accounted for in the comparison.
|
|
138
|
-
*
|
|
139
|
-
* Asserts when expected or actual are invalid IDs in dev.
|
|
140
|
-
* Expected may never be null.
|
|
141
|
-
*
|
|
142
|
-
* ```js
|
|
143
|
-
* isEquivId('1', 1); // true
|
|
144
|
-
* isEquivId('2', '2'); // true
|
|
145
|
-
* isEquivId(3, '3'); // true
|
|
146
|
-
* isEquivId(4, '3'); // false
|
|
147
|
-
* isEquivId(1, null); // false
|
|
148
|
-
* ```
|
|
149
|
-
*
|
|
150
|
-
* @method isEquivId
|
|
151
|
-
* @for @ember-data/legacy-compat/utils
|
|
152
|
-
* @param {string | number} expected a potentially un-normalized id to match against
|
|
153
|
-
* @param {string | number} actual a potentially un-normalized id to match against
|
|
154
|
-
* @return {Boolean} true if the ids are equivalent
|
|
155
|
-
* @public
|
|
156
|
-
* @static
|
|
157
|
-
*/
|
|
158
|
-
export function isEquivId(expected: string | number, actual: string | number | null): boolean;
|
|
159
|
-
export {};
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
3
|
+
Utilities for helping to migrate to stricter
|
|
4
|
+
and more consistent use of IDs and types.
|
|
5
|
+
|
|
6
|
+
@module
|
|
7
|
+
@deprecated
|
|
8
|
+
*/
|
|
9
|
+
export * from "@warp-drive/legacy/compat/utils";
|
|
10
|
+
|
|
11
|
+
}
|