@ember-data/model 5.6.0-alpha.2 → 5.6.0-alpha.4
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/-private.js +1 -2
- package/dist/-private.js.map +1 -1
- package/dist/{model-Dkk-TZlL.js → errors-DsUSZ9m8.js} +41 -2335
- package/dist/errors-DsUSZ9m8.js.map +1 -0
- package/dist/{hooks-o1U_cEA3.js → hooks-rXIjX2-H.js} +1 -2
- package/dist/{hooks-o1U_cEA3.js.map → hooks-rXIjX2-H.js.map} +1 -1
- package/dist/hooks.js +2 -2
- package/dist/index.js +667 -5
- package/dist/index.js.map +1 -1
- package/dist/migration-support.js +7 -14
- package/dist/migration-support.js.map +1 -1
- package/dist/schema-provider-B6-5uzxP.js +2229 -0
- package/dist/schema-provider-B6-5uzxP.js.map +1 -0
- package/package.json +16 -19
- package/unstable-preview-types/-private/attr.d.ts +4 -12
- package/unstable-preview-types/-private/attr.d.ts.map +1 -1
- package/unstable-preview-types/-private/belongs-to.d.ts +0 -6
- package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/errors.d.ts +4 -15
- package/unstable-preview-types/-private/errors.d.ts.map +1 -1
- package/unstable-preview-types/-private/has-many.d.ts +0 -3
- package/unstable-preview-types/-private/has-many.d.ts.map +1 -1
- package/unstable-preview-types/-private/model.d.ts +531 -562
- package/unstable-preview-types/-private/model.d.ts.map +1 -1
- package/unstable-preview-types/-private/promise-belongs-to.d.ts +0 -4
- package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/promise-many-array.d.ts +3 -11
- package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/references/belongs-to.d.ts +3 -12
- package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/references/has-many.d.ts +7 -19
- package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -1
- package/unstable-preview-types/-private/type-utils.d.ts +0 -5
- package/unstable-preview-types/-private/type-utils.d.ts.map +1 -1
- package/unstable-preview-types/-private.d.ts +0 -4
- package/unstable-preview-types/-private.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +23 -20
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/unstable-preview-types/migration-support.d.ts +4 -10
- package/unstable-preview-types/migration-support.d.ts.map +1 -1
- package/dist/has-many-BXU96bZ9.js +0 -682
- package/dist/has-many-BXU96bZ9.js.map +0 -1
- package/dist/model-Dkk-TZlL.js.map +0 -1
- package/dist/schema-provider-DyG6fJXt.js +0 -259
- package/dist/schema-provider-DyG6fJXt.js.map +0 -1
|
@@ -6,9 +6,6 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
6
6
|
attribute: string;
|
|
7
7
|
message: string;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
@module @ember-data/model
|
|
11
|
-
*/
|
|
12
9
|
interface ArrayProxyWithCustomOverrides<T> extends Omit<ArrayProxy<T>, 'clear' | 'content'> {
|
|
13
10
|
content: NativeArray<T>;
|
|
14
11
|
clear(): void;
|
|
@@ -26,7 +23,7 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
26
23
|
|
|
27
24
|
For Example, if you had a `User` model that looked like this:
|
|
28
25
|
|
|
29
|
-
```app/models/user.js
|
|
26
|
+
```js [app/models/user.js]
|
|
30
27
|
import Model, { attr } from '@ember-data/model';
|
|
31
28
|
|
|
32
29
|
export default class UserModel extends Model {
|
|
@@ -88,7 +85,6 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
88
85
|
|
|
89
86
|
@class Errors
|
|
90
87
|
@public
|
|
91
|
-
@extends Ember.ArrayProxy
|
|
92
88
|
*/
|
|
93
89
|
export class Errors extends ArrayProxyWithCustomOverrides<ValidationError> {
|
|
94
90
|
__record: {
|
|
@@ -114,7 +110,6 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
114
110
|
});
|
|
115
111
|
```
|
|
116
112
|
|
|
117
|
-
@method errorsFor
|
|
118
113
|
@public
|
|
119
114
|
@param {String} attribute
|
|
120
115
|
@return {Array}
|
|
@@ -144,7 +139,6 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
144
139
|
*/
|
|
145
140
|
get content(): NativeArray<ValidationError>;
|
|
146
141
|
/**
|
|
147
|
-
@method unknownProperty
|
|
148
142
|
@private
|
|
149
143
|
*/
|
|
150
144
|
unknownProperty(attribute: string): NativeArray<ValidationError> | undefined;
|
|
@@ -154,7 +148,7 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
154
148
|
@property length
|
|
155
149
|
@type {Number}
|
|
156
150
|
@public
|
|
157
|
-
@
|
|
151
|
+
@readonly
|
|
158
152
|
*/
|
|
159
153
|
/**
|
|
160
154
|
`true` if we have no errors.
|
|
@@ -162,7 +156,7 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
162
156
|
@property isEmpty
|
|
163
157
|
@type {Boolean}
|
|
164
158
|
@public
|
|
165
|
-
@
|
|
159
|
+
@readonly
|
|
166
160
|
*/
|
|
167
161
|
isEmpty: boolean;
|
|
168
162
|
/**
|
|
@@ -197,14 +191,12 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
197
191
|
// { attribute: 'username', message: 'This field is required' },
|
|
198
192
|
// ]
|
|
199
193
|
```
|
|
200
|
-
@method add
|
|
201
194
|
@public
|
|
202
195
|
@param {String} attribute - the property name of an attribute or relationship
|
|
203
196
|
@param {string[]|string} messages - an error message or array of error messages for the attribute
|
|
204
197
|
*/
|
|
205
198
|
add(attribute: string, messages: string[] | string): void;
|
|
206
199
|
/**
|
|
207
|
-
@method _findOrCreateMessages
|
|
208
200
|
@private
|
|
209
201
|
*/
|
|
210
202
|
_findOrCreateMessages(attribute: string, messages: string | string[]): ValidationError[];
|
|
@@ -231,7 +223,6 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
231
223
|
errors.errorsFor('phone');
|
|
232
224
|
// => undefined
|
|
233
225
|
```
|
|
234
|
-
@method remove
|
|
235
226
|
@public
|
|
236
227
|
@param {String} member - the property name of an attribute or relationship
|
|
237
228
|
*/
|
|
@@ -272,14 +263,13 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
272
263
|
errors.messages
|
|
273
264
|
// => []
|
|
274
265
|
```
|
|
275
|
-
@method clear
|
|
276
266
|
@public
|
|
277
267
|
*/
|
|
278
268
|
clear(): void;
|
|
279
269
|
/**
|
|
280
270
|
Checks if there are error messages for the given attribute.
|
|
281
271
|
|
|
282
|
-
```app/controllers/user/edit.js
|
|
272
|
+
```js [app/controllers/user/edit.js]
|
|
283
273
|
export default class UserEditController extends Controller {
|
|
284
274
|
@action
|
|
285
275
|
save(user) {
|
|
@@ -291,7 +281,6 @@ declare module '@ember-data/model/-private/errors' {
|
|
|
291
281
|
}
|
|
292
282
|
```
|
|
293
283
|
|
|
294
|
-
@method has
|
|
295
284
|
@public
|
|
296
285
|
@param {String} attribute
|
|
297
286
|
@return {Boolean} true if there some errors on given attribute
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/-private/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAI5C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAE9C,KAAK,eAAe,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/-private/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAI5C,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAE9C,KAAK,eAAe,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;I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,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,eAAe,EAAE;IAqBxF;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM;IAwBxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,KAAK,IAAI,IAAI;IAqBb;;;;;;;;;;;;;;;;;;MAkBE;IACF,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;CAGhC"}
|
|
@@ -153,10 +153,7 @@ declare module '@ember-data/model/-private/has-many' {
|
|
|
153
153
|
must be declared as polymorphic, and the `as` option must be used to the abstract
|
|
154
154
|
type each record satisfies on both sides.
|
|
155
155
|
|
|
156
|
-
@method hasMany
|
|
157
156
|
@public
|
|
158
|
-
@static
|
|
159
|
-
@for @ember-data/model
|
|
160
157
|
@param {String} type (optional) the name of the related resource
|
|
161
158
|
@param {Object} options (optional) a hash of options
|
|
162
159
|
@return {PropertyDescriptor} relationship
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has-many.d.ts","sourceRoot":"","sources":["../../src/-private/has-many.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"has-many.d.ts","sourceRoot":"","sources":["../../src/-private/has-many.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAgFvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4JE;AACF,wBAAgB,OAAO,IAAI,KAAK,CAAC;AACjC,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;AAC7C,wBAAgB,OAAO,CAAC,CAAC,EACvB,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EACjC,OAAO,EAAE,mBAAmB,CAAC,CAAC,EAAE,OAAO,CAAC,GACvC,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAK5B,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC"}
|