@ember-data/model 5.3.0-alpha.4 → 5.3.0-alpha.5

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/-private.js CHANGED
@@ -1,37 +1,2 @@
1
- import { M as Model } from "./has-many-2baf73c0";
2
- export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, P as PromiseBelongsTo, c as PromiseManyArray, a as attr, b as belongsTo, h as hasMany } from "./has-many-2baf73c0";
3
- import { getOwner } from '@ember/application';
4
-
5
- /*
6
- In case someone defined a relationship to a mixin, for example:
7
- ```
8
- import Model, { belongsTo, hasMany } from '@ember-data/model';
9
- import Mixin from '@ember/object/mixin';
10
-
11
- class CommentModel extends Model {
12
- @belongsTo('commentable', { polymorphic: true }) owner;
13
- }
14
-
15
- let Commentable = Mixin.create({
16
- @hasMany('comment') comments;
17
- });
18
- ```
19
- we want to look up a Commentable class which has all the necessary
20
- relationship meta data. Thus, we look up the mixin and create a mock
21
- Model, so we can access the relationship CPs of the mixin (`comments`)
22
- in this case
23
- */
24
- function modelForMixin(store, normalizedModelName) {
25
- let owner = getOwner(store);
26
- let MaybeMixin = owner.factoryFor(`mixin:${normalizedModelName}`);
27
- let mixin = MaybeMixin && MaybeMixin.class;
28
- if (mixin) {
29
- let ModelForMixin = Model.extend(mixin);
30
- ModelForMixin.__isMixin = true;
31
- ModelForMixin.__mixin = mixin;
32
- //Cache the class as a model
33
- owner.register('model:' + normalizedModelName, ModelForMixin);
34
- }
35
- return owner.factoryFor(`model:${normalizedModelName}`);
36
- }
37
- export { Model, modelForMixin as _modelForMixin };
1
+ export { a as attr, b as belongsTo, h as hasMany } from "./has-many-435cd213";
2
+ export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, M as Model, P as PromiseBelongsTo, a as PromiseManyArray } from "./model-99cdd629";
@@ -1 +1 @@
1
- {"version":3,"file":"-private.js","sources":["../src/-private/model-for-mixin.ts"],"sourcesContent":["import { getOwner } from '@ember/application';\n\nimport type Store from '@ember-data/store';\n\nimport Model from './model';\n\n/*\n In case someone defined a relationship to a mixin, for example:\n ```\n import Model, { belongsTo, hasMany } from '@ember-data/model';\n import Mixin from '@ember/object/mixin';\n\n class CommentModel extends Model {\n @belongsTo('commentable', { polymorphic: true }) owner;\n }\n\n let Commentable = Mixin.create({\n @hasMany('comment') comments;\n });\n ```\n we want to look up a Commentable class which has all the necessary\n relationship meta data. Thus, we look up the mixin and create a mock\n Model, so we can access the relationship CPs of the mixin (`comments`)\n in this case\n */\nexport default function modelForMixin(store: Store, normalizedModelName: string): Model | null {\n let owner: any = getOwner(store);\n let MaybeMixin = owner.factoryFor(`mixin:${normalizedModelName}`);\n let mixin = MaybeMixin && MaybeMixin.class;\n if (mixin) {\n let ModelForMixin = Model.extend(mixin);\n ModelForMixin.__isMixin = true;\n ModelForMixin.__mixin = mixin;\n //Cache the class as a model\n owner.register('model:' + normalizedModelName, ModelForMixin);\n }\n return owner.factoryFor(`model:${normalizedModelName}`);\n}\n"],"names":["modelForMixin","store","normalizedModelName","owner","getOwner","MaybeMixin","factoryFor","mixin","class","ModelForMixin","Model","extend","__isMixin","__mixin","register"],"mappings":";;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CAACC,KAAY,EAAEC,mBAA2B,EAAgB;AAC7F,EAAA,IAAIC,KAAU,GAAGC,QAAQ,CAACH,KAAK,CAAC,CAAA;EAChC,IAAII,UAAU,GAAGF,KAAK,CAACG,UAAU,CAAE,CAAA,MAAA,EAAQJ,mBAAoB,CAAA,CAAC,CAAC,CAAA;AACjE,EAAA,IAAIK,KAAK,GAAGF,UAAU,IAAIA,UAAU,CAACG,KAAK,CAAA;AAC1C,EAAA,IAAID,KAAK,EAAE;AACT,IAAA,IAAIE,aAAa,GAAGC,KAAK,CAACC,MAAM,CAACJ,KAAK,CAAC,CAAA;IACvCE,aAAa,CAACG,SAAS,GAAG,IAAI,CAAA;IAC9BH,aAAa,CAACI,OAAO,GAAGN,KAAK,CAAA;AAC7B;IACAJ,KAAK,CAACW,QAAQ,CAAC,QAAQ,GAAGZ,mBAAmB,EAAEO,aAAa,CAAC,CAAA;AAC/D,GAAA;AACA,EAAA,OAAON,KAAK,CAACG,UAAU,CAAE,CAAQJ,MAAAA,EAAAA,mBAAoB,EAAC,CAAC,CAAA;AACzD;;;;"}
1
+ {"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,496 @@
1
+ import { macroCondition, getOwnConfig } from '@embroider/macros';
2
+ import { assert, warn } from '@ember/debug';
3
+ import { computed } from '@ember/object';
4
+ import { recordIdentifierFor } from '@ember-data/store';
5
+ import { peekCache } from '@ember-data/store/-private';
6
+ import { c as computedMacroWithOptionalParams, l as lookupLegacySupport } from "./model-99cdd629";
7
+ import { dasherize } from '@ember/string';
8
+ import { A } from '@ember/array';
9
+ import { singularize } from 'ember-inflector';
10
+
11
+ /**
12
+ @module @ember-data/model
13
+ */
14
+
15
+ /**
16
+ `attr` defines an attribute on a [Model](/ember-data/release/classes/Model).
17
+ By default, attributes are passed through as-is, however you can specify an
18
+ optional type to have the value automatically transformed.
19
+ Ember Data ships with four basic transform types: `string`, `number`,
20
+ `boolean` and `date`. You can define your own transforms by subclassing
21
+ [Transform](/ember-data/release/classes/Transform).
22
+
23
+ Note that you cannot use `attr` to define an attribute of `id`.
24
+
25
+ `attr` takes an optional hash as a second parameter, currently
26
+ supported options are:
27
+
28
+ - `defaultValue`: Pass a string or a function to be called to set the attribute
29
+ to a default value if and only if the key is absent from the payload response.
30
+
31
+ Example
32
+
33
+ ```app/models/user.js
34
+ import Model, { attr } from '@ember-data/model';
35
+
36
+ export default class UserModel extends Model {
37
+ @attr('string') username;
38
+ @attr('string') email;
39
+ @attr('boolean', { defaultValue: false }) verified;
40
+ }
41
+ ```
42
+
43
+ Default value can also be a function. This is useful it you want to return
44
+ a new object for each attribute.
45
+
46
+ ```app/models/user.js
47
+ import Model, { attr } from '@ember-data/model';
48
+
49
+ export default class UserModel extends Model {
50
+ @attr('string') username;
51
+ @attr('string') email;
52
+
53
+ @attr({
54
+ defaultValue() {
55
+ return {};
56
+ }
57
+ })
58
+ settings;
59
+ }
60
+ ```
61
+
62
+ The `options` hash is passed as second argument to a transforms'
63
+ `serialize` and `deserialize` method. This allows to configure a
64
+ transformation and adapt the corresponding value, based on the config:
65
+
66
+ ```app/models/post.js
67
+ import Model, { attr } from '@ember-data/model';
68
+
69
+ export default class PostModel extends Model {
70
+ @attr('text', {
71
+ uppercase: true
72
+ })
73
+ text;
74
+ }
75
+ ```
76
+
77
+ ```app/transforms/text.js
78
+ export default class TextTransform {
79
+ serialize(value, options) {
80
+ if (options.uppercase) {
81
+ return value.toUpperCase();
82
+ }
83
+
84
+ return value;
85
+ }
86
+
87
+ deserialize(value) {
88
+ return value;
89
+ }
90
+
91
+ static create() {
92
+ return new this();
93
+ }
94
+ }
95
+ ```
96
+
97
+ @method attr
98
+ @public
99
+ @static
100
+ @for @ember-data/model
101
+ @param {String|Object} type the attribute type
102
+ @param {Object} options a hash of options
103
+ @return {Attribute}
104
+ */
105
+ function attr(type, options) {
106
+ if (typeof type === 'object') {
107
+ options = type;
108
+ type = undefined;
109
+ } else {
110
+ options = options || {};
111
+ }
112
+ let meta = {
113
+ type: type,
114
+ isAttribute: true,
115
+ options: options
116
+ };
117
+ return computed({
118
+ get(key) {
119
+ if (macroCondition(getOwnConfig().env.DEBUG)) {
120
+ if (['currentState'].indexOf(key) !== -1) {
121
+ throw new Error(`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your attr on ${this.constructor.toString()}`);
122
+ }
123
+ }
124
+ if (this.isDestroyed || this.isDestroying) {
125
+ return;
126
+ }
127
+ return peekCache(this).getAttr(recordIdentifierFor(this), key);
128
+ },
129
+ set(key, value) {
130
+ if (macroCondition(getOwnConfig().env.DEBUG)) {
131
+ if (['currentState'].indexOf(key) !== -1) {
132
+ throw new Error(`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your attr on ${this.constructor.toString()}`);
133
+ }
134
+ }
135
+ assert(`Attempted to set '${key}' on the deleted record ${recordIdentifierFor(this)}`, !this.currentState.isDeleted);
136
+ const identifier = recordIdentifierFor(this);
137
+ const cache = peekCache(this);
138
+ let currentValue = cache.getAttr(identifier, key);
139
+ if (currentValue !== value) {
140
+ cache.setAttr(identifier, key, value);
141
+ if (!this.isValid) {
142
+ const {
143
+ errors
144
+ } = this;
145
+ if (errors.get(key)) {
146
+ errors.remove(key);
147
+ this.currentState.cleanErrorRequests();
148
+ }
149
+ }
150
+ }
151
+ return value;
152
+ }
153
+ }).meta(meta);
154
+ }
155
+ var attr$1 = computedMacroWithOptionalParams(attr);
156
+ function normalizeType$1(type) {
157
+ return dasherize(type);
158
+ }
159
+ /**
160
+ @module @ember-data/model
161
+ */
162
+
163
+ /**
164
+ `belongsTo` is used to define One-To-One and One-To-Many
165
+ relationships on a [Model](/ember-data/release/classes/Model).
166
+
167
+
168
+ `belongsTo` takes an optional hash as a second parameter, currently
169
+ supported options are:
170
+
171
+ - `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.
172
+ - `inverse`: A string used to identify the inverse property on a
173
+ related model in a One-To-Many relationship. See [Explicit Inverses](#explicit-inverses)
174
+ - `polymorphic` A boolean value to mark the relationship as polymorphic
175
+
176
+ #### One-To-One
177
+ To declare a one-to-one relationship between two models, use
178
+ `belongsTo`:
179
+
180
+ ```app/models/user.js
181
+ import Model, { belongsTo } from '@ember-data/model';
182
+
183
+ export default class UserModel extends Model {
184
+ @belongsTo('profile') profile;
185
+ }
186
+ ```
187
+
188
+ ```app/models/profile.js
189
+ import Model, { belongsTo } from '@ember-data/model';
190
+
191
+ export default class ProfileModel extends Model {
192
+ @belongsTo('user') user;
193
+ }
194
+ ```
195
+
196
+ #### One-To-Many
197
+
198
+ To declare a one-to-many relationship between two models, use
199
+ `belongsTo` in combination with `hasMany`, like this:
200
+
201
+ ```app/models/post.js
202
+ import Model, { hasMany } from '@ember-data/model';
203
+
204
+ export default class PostModel extends Model {
205
+ @hasMany('comment', { async: false, inverse: 'post' }) comments;
206
+ }
207
+ ```
208
+
209
+ ```app/models/comment.js
210
+ import Model, { belongsTo } from '@ember-data/model';
211
+
212
+ export default class CommentModel extends Model {
213
+ @belongsTo('post', { async: false, inverse: 'comments' }) post;
214
+ }
215
+ ```
216
+
217
+ #### Sync relationships
218
+
219
+ Ember Data resolves sync relationships with the related resources
220
+ available in its local store, hence it is expected these resources
221
+ to be loaded before or along-side the primary resource.
222
+
223
+ ```app/models/comment.js
224
+ import Model, { belongsTo } from '@ember-data/model';
225
+
226
+ export default class CommentModel extends Model {
227
+ @belongsTo('post', {
228
+ async: false,
229
+ inverse: null
230
+ })
231
+ post;
232
+ }
233
+ ```
234
+
235
+ In contrast to async relationship, accessing a sync relationship
236
+ will always return the record (Model instance) for the existing
237
+ local resource, or null. But it will error on access when
238
+ a related resource is known to exist and it has not been loaded.
239
+
240
+ ```
241
+ let post = comment.post;
242
+
243
+ ```
244
+
245
+ @method belongsTo
246
+ @public
247
+ @static
248
+ @for @ember-data/model
249
+ @param {String} modelName (optional) type of the relationship
250
+ @param {Object} options (optional) a hash of options
251
+ @return {Ember.computed} relationship
252
+ */
253
+ function belongsTo(modelName, options) {
254
+ let opts = options;
255
+ let userEnteredModelName = modelName;
256
+ assert(`Expected belongsTo options.async to be a boolean`, opts && typeof opts.async === 'boolean');
257
+ assert(`Expected belongsTo options.inverse to be either null or the string type of the related resource.`, opts.inverse === null || typeof opts.inverse === 'string' && opts.inverse.length > 0);
258
+ let meta = {
259
+ type: normalizeType$1(userEnteredModelName),
260
+ isRelationship: true,
261
+ options: opts,
262
+ kind: 'belongsTo',
263
+ name: 'Belongs To',
264
+ key: null
265
+ };
266
+ return computed({
267
+ get(key) {
268
+ // this is a legacy behavior we may not carry into a new model setup
269
+ // it's better to error on disconnected records so users find errors
270
+ // in their logic.
271
+ if (this.isDestroying || this.isDestroyed) {
272
+ return null;
273
+ }
274
+ const support = lookupLegacySupport(this);
275
+ if (macroCondition(getOwnConfig().env.DEBUG)) {
276
+ if (['currentState'].indexOf(key) !== -1) {
277
+ throw new Error(`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`);
278
+ }
279
+ if (Object.prototype.hasOwnProperty.call(opts, 'serialize')) {
280
+ warn(`You provided a serialize option on the "${key}" property in the "${support.identifier.type}" class, this belongs in the serializer. See Serializer and it's implementations https://api.emberjs.com/ember-data/release/classes/Serializer`, false, {
281
+ id: 'ds.model.serialize-option-in-belongs-to'
282
+ });
283
+ }
284
+ if (Object.prototype.hasOwnProperty.call(opts, 'embedded')) {
285
+ warn(`You provided an embedded option on the "${key}" property in the "${support.identifier.type}" class, this belongs in the serializer. See EmbeddedRecordsMixin https://api.emberjs.com/ember-data/release/classes/EmbeddedRecordsMixin`, false, {
286
+ id: 'ds.model.embedded-option-in-belongs-to'
287
+ });
288
+ }
289
+ }
290
+ return support.getBelongsTo(key);
291
+ },
292
+ set(key, value) {
293
+ const support = lookupLegacySupport(this);
294
+ if (macroCondition(getOwnConfig().env.DEBUG)) {
295
+ if (['currentState'].indexOf(key) !== -1) {
296
+ throw new Error(`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`);
297
+ }
298
+ }
299
+ this.store._join(() => {
300
+ support.setDirtyBelongsTo(key, value);
301
+ });
302
+ return support.getBelongsTo(key);
303
+ }
304
+ }).meta(meta);
305
+ }
306
+ var belongsTo$1 = computedMacroWithOptionalParams(belongsTo);
307
+ function normalizeType(type) {
308
+ return singularize(dasherize(type));
309
+ }
310
+
311
+ /**
312
+ `hasMany` is used to define One-To-Many and Many-To-Many
313
+ relationships on a [Model](/ember-data/release/classes/Model).
314
+
315
+ `hasMany` takes an optional hash as a second parameter, currently
316
+ supported options are:
317
+
318
+ - `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.
319
+ - `inverse`: A string used to identify the inverse property on a related model.
320
+ - `polymorphic` A boolean value to mark the relationship as polymorphic
321
+
322
+ #### One-To-Many
323
+ To declare a one-to-many relationship between two models, use
324
+ `belongsTo` in combination with `hasMany`, like this:
325
+
326
+ ```app/models/post.js
327
+ import Model, { hasMany } from '@ember-data/model';
328
+
329
+ export default class PostModel extends Model {
330
+ @hasMany('comment') comments;
331
+ }
332
+ ```
333
+
334
+ ```app/models/comment.js
335
+ import Model, { belongsTo } from '@ember-data/model';
336
+
337
+ export default class CommentModel extends Model {
338
+ @belongsTo('post') post;
339
+ }
340
+ ```
341
+
342
+ #### Many-To-Many
343
+ To declare a many-to-many relationship between two models, use
344
+ `hasMany`:
345
+
346
+ ```app/models/post.js
347
+ import Model, { hasMany } from '@ember-data/model';
348
+
349
+ export default class PostModel extends Model {
350
+ @hasMany('tag') tags;
351
+ }
352
+ ```
353
+
354
+ ```app/models/tag.js
355
+ import Model, { hasMany } from '@ember-data/model';
356
+
357
+ export default class TagModel extends Model {
358
+ @hasMany('post') posts;
359
+ }
360
+ ```
361
+
362
+ You can avoid passing a string as the first parameter. In that case Ember Data
363
+ will infer the type from the singularized key name.
364
+
365
+ ```app/models/post.js
366
+ import Model, { hasMany } from '@ember-data/model';
367
+
368
+ export default class PostModel extends Model {
369
+ @hasMany tags;
370
+ }
371
+ ```
372
+
373
+ will lookup for a Tag type.
374
+
375
+ #### Explicit Inverses
376
+
377
+ Ember Data will do its best to discover which relationships map to
378
+ one another. In the one-to-many code above, for example, Ember Data
379
+ can figure out that changing the `comments` relationship should update
380
+ the `post` relationship on the inverse because post is the only
381
+ relationship to that model.
382
+
383
+ However, sometimes you may have multiple `belongsTo`/`hasMany` for the
384
+ same type. You can specify which property on the related model is
385
+ the inverse using `hasMany`'s `inverse` option:
386
+
387
+ ```app/models/comment.js
388
+ import Model, { belongsTo } from '@ember-data/model';
389
+
390
+ export default class CommentModel extends Model {
391
+ @belongsTo('post') onePost;
392
+ @belongsTo('post') twoPost
393
+ @belongsTo('post') redPost;
394
+ @belongsTo('post') bluePost;
395
+ }
396
+ ```
397
+
398
+ ```app/models/post.js
399
+ import Model, { hasMany } from '@ember-data/model';
400
+
401
+ export default class PostModel extends Model {
402
+ @hasMany('comment', {
403
+ inverse: 'redPost'
404
+ })
405
+ comments;
406
+ }
407
+ ```
408
+
409
+ You can also specify an inverse on a `belongsTo`, which works how
410
+ you'd expect.
411
+
412
+ #### Sync relationships
413
+
414
+ Ember Data resolves sync relationships with the related resources
415
+ available in its local store, hence it is expected these resources
416
+ to be loaded before or along-side the primary resource.
417
+
418
+ ```app/models/post.js
419
+ import Model, { hasMany } from '@ember-data/model';
420
+
421
+ export default class PostModel extends Model {
422
+ @hasMany('comment', {
423
+ async: false
424
+ })
425
+ comments;
426
+ }
427
+ ```
428
+
429
+ In contrast to async relationship, accessing a sync relationship
430
+ will always return a [ManyArray](/ember-data/release/classes/ManyArray) instance
431
+ containing the existing local resources. But it will error on access
432
+ when any of the known related resources have not been loaded.
433
+
434
+ ```
435
+ post.comments.forEach((comment) => {
436
+
437
+ });
438
+
439
+ ```
440
+
441
+ If you are using `links` with sync relationships, you have to use
442
+ `ref.reload` to fetch the resources.
443
+
444
+ @method hasMany
445
+ @public
446
+ @static
447
+ @for @ember-data/model
448
+ @param {String} type (optional) type of the relationship
449
+ @param {Object} options (optional) a hash of options
450
+ @return {Ember.computed} relationship
451
+ */
452
+ function hasMany(type, options) {
453
+ assert(`Expected hasMany options.async to be a boolean`, options && typeof options.async === 'boolean');
454
+
455
+ // Metadata about relationships is stored on the meta of
456
+ // the relationship. This is used for introspection and
457
+ // serialization. Note that `key` is populated lazily
458
+ // the first time the CP is called.
459
+ let meta = {
460
+ type: normalizeType(type),
461
+ options,
462
+ isRelationship: true,
463
+ kind: 'hasMany',
464
+ name: 'Has Many',
465
+ key: null
466
+ };
467
+ return computed({
468
+ get(key) {
469
+ if (macroCondition(getOwnConfig().env.DEBUG)) {
470
+ if (['currentState'].indexOf(key) !== -1) {
471
+ throw new Error(`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your hasMany on ${this.constructor.toString()}`);
472
+ }
473
+ }
474
+ if (this.isDestroying || this.isDestroyed) {
475
+ return A();
476
+ }
477
+ return lookupLegacySupport(this).getHasMany(key);
478
+ },
479
+ set(key, records) {
480
+ if (macroCondition(getOwnConfig().env.DEBUG)) {
481
+ if (['currentState'].indexOf(key) !== -1) {
482
+ throw new Error(`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your hasMany on ${this.constructor.toString()}`);
483
+ }
484
+ }
485
+ const support = lookupLegacySupport(this);
486
+ const manyArray = support.getManyArray(key);
487
+ assert(`You must pass an array of records to set a hasMany relationship`, Array.isArray(records));
488
+ this.store._join(() => {
489
+ manyArray.splice(0, manyArray.length, ...records);
490
+ });
491
+ return support.getHasMany(key);
492
+ }
493
+ }).meta(meta);
494
+ }
495
+ var hasMany$1 = computedMacroWithOptionalParams(hasMany);
496
+ export { attr$1 as a, belongsTo$1 as b, hasMany$1 as h };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-many-435cd213.js","sources":["../src/-private/attr.js","../src/-private/belongs-to.js","../src/-private/has-many.js"],"sourcesContent":["import { assert } from '@ember/debug';\nimport { computed } from '@ember/object';\n\nimport { DEBUG } from '@ember-data/env';\nimport { recordIdentifierFor } from '@ember-data/store';\nimport { peekCache } from '@ember-data/store/-private';\n\nimport { computedMacroWithOptionalParams } from './util';\n\n/**\n @module @ember-data/model\n*/\n\n/**\n `attr` defines an attribute on a [Model](/ember-data/release/classes/Model).\n By default, attributes are passed through as-is, however you can specify an\n optional type to have the value automatically transformed.\n Ember Data ships with four basic transform types: `string`, `number`,\n `boolean` and `date`. You can define your own transforms by subclassing\n [Transform](/ember-data/release/classes/Transform).\n\n Note that you cannot use `attr` to define an attribute of `id`.\n\n `attr` takes an optional hash as a second parameter, currently\n supported options are:\n\n - `defaultValue`: Pass a string or a function to be called to set the attribute\n to a default value if and only if the key is absent from the payload response.\n\n Example\n\n ```app/models/user.js\n import Model, { attr } from '@ember-data/model';\n\n export default class UserModel extends Model {\n @attr('string') username;\n @attr('string') email;\n @attr('boolean', { defaultValue: false }) verified;\n }\n ```\n\n Default value can also be a function. This is useful it you want to return\n a new object for each attribute.\n\n ```app/models/user.js\n import Model, { attr } from '@ember-data/model';\n\n export default class UserModel extends Model {\n @attr('string') username;\n @attr('string') email;\n\n @attr({\n defaultValue() {\n return {};\n }\n })\n settings;\n }\n ```\n\n The `options` hash is passed as second argument to a transforms'\n `serialize` and `deserialize` method. This allows to configure a\n transformation and adapt the corresponding value, based on the config:\n\n ```app/models/post.js\n import Model, { attr } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @attr('text', {\n uppercase: true\n })\n text;\n }\n ```\n\n ```app/transforms/text.js\n export default class TextTransform {\n serialize(value, options) {\n if (options.uppercase) {\n return value.toUpperCase();\n }\n\n return value;\n }\n\n deserialize(value) {\n return value;\n }\n\n static create() {\n return new this();\n }\n }\n ```\n\n @method attr\n @public\n @static\n @for @ember-data/model\n @param {String|Object} type the attribute type\n @param {Object} options a hash of options\n @return {Attribute}\n*/\nfunction attr(type, options) {\n if (typeof type === 'object') {\n options = type;\n type = undefined;\n } else {\n options = options || {};\n }\n\n let meta = {\n type: type,\n isAttribute: true,\n options: options,\n };\n\n return computed({\n get(key) {\n if (DEBUG) {\n if (['currentState'].indexOf(key) !== -1) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your attr on ${this.constructor.toString()}`\n );\n }\n }\n if (this.isDestroyed || this.isDestroying) {\n return;\n }\n return peekCache(this).getAttr(recordIdentifierFor(this), key);\n },\n set(key, value) {\n if (DEBUG) {\n if (['currentState'].indexOf(key) !== -1) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your attr on ${this.constructor.toString()}`\n );\n }\n }\n assert(\n `Attempted to set '${key}' on the deleted record ${recordIdentifierFor(this)}`,\n !this.currentState.isDeleted\n );\n const identifier = recordIdentifierFor(this);\n const cache = peekCache(this);\n\n let currentValue = cache.getAttr(identifier, key);\n if (currentValue !== value) {\n cache.setAttr(identifier, key, value);\n\n if (!this.isValid) {\n const { errors } = this;\n if (errors.get(key)) {\n errors.remove(key);\n this.currentState.cleanErrorRequests();\n }\n }\n }\n\n return value;\n },\n }).meta(meta);\n}\n\nexport default computedMacroWithOptionalParams(attr);\n","import { assert, warn } from '@ember/debug';\nimport { computed } from '@ember/object';\nimport { dasherize } from '@ember/string';\n\nimport { DEBUG } from '@ember-data/env';\n\nimport { lookupLegacySupport } from './model';\nimport { computedMacroWithOptionalParams } from './util';\n\nfunction normalizeType(type) {\n return dasherize(type);\n}\n/**\n @module @ember-data/model\n*/\n\n/**\n `belongsTo` is used to define One-To-One and One-To-Many\n relationships on a [Model](/ember-data/release/classes/Model).\n\n\n `belongsTo` takes an optional hash as a second parameter, currently\n supported options are:\n\n - `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.\n - `inverse`: A string used to identify the inverse property on a\n related model in a One-To-Many relationship. See [Explicit Inverses](#explicit-inverses)\n - `polymorphic` A boolean value to mark the relationship as polymorphic\n\n #### One-To-One\n To declare a one-to-one relationship between two models, use\n `belongsTo`:\n\n ```app/models/user.js\n import Model, { belongsTo } from '@ember-data/model';\n\n export default class UserModel extends Model {\n @belongsTo('profile') profile;\n }\n ```\n\n ```app/models/profile.js\n import Model, { belongsTo } from '@ember-data/model';\n\n export default class ProfileModel extends Model {\n @belongsTo('user') user;\n }\n ```\n\n #### One-To-Many\n\n To declare a one-to-many relationship between two models, use\n `belongsTo` in combination with `hasMany`, like this:\n\n ```app/models/post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('comment', { async: false, inverse: 'post' }) comments;\n }\n ```\n\n ```app/models/comment.js\n import Model, { belongsTo } from '@ember-data/model';\n\n export default class CommentModel extends Model {\n @belongsTo('post', { async: false, inverse: 'comments' }) post;\n }\n ```\n\n #### Sync relationships\n\n Ember Data resolves sync relationships with the related resources\n available in its local store, hence it is expected these resources\n to be loaded before or along-side the primary resource.\n\n ```app/models/comment.js\n import Model, { belongsTo } from '@ember-data/model';\n\n export default class CommentModel extends Model {\n @belongsTo('post', {\n async: false,\n inverse: null\n })\n post;\n }\n ```\n\n In contrast to async relationship, accessing a sync relationship\n will always return the record (Model instance) for the existing\n local resource, or null. But it will error on access when\n a related resource is known to exist and it has not been loaded.\n\n ```\n let post = comment.post;\n\n ```\n\n @method belongsTo\n @public\n @static\n @for @ember-data/model\n @param {String} modelName (optional) type of the relationship\n @param {Object} options (optional) a hash of options\n @return {Ember.computed} relationship\n*/\nfunction belongsTo(modelName, options) {\n let opts = options;\n let userEnteredModelName = modelName;\n\n assert(`Expected belongsTo options.async to be a boolean`, opts && typeof opts.async === 'boolean');\n assert(\n `Expected belongsTo options.inverse to be either null or the string type of the related resource.`,\n opts.inverse === null || (typeof opts.inverse === 'string' && opts.inverse.length > 0)\n );\n\n let meta = {\n type: normalizeType(userEnteredModelName),\n isRelationship: true,\n options: opts,\n kind: 'belongsTo',\n name: 'Belongs To',\n key: null,\n };\n\n return computed({\n get(key) {\n // this is a legacy behavior we may not carry into a new model setup\n // it's better to error on disconnected records so users find errors\n // in their logic.\n if (this.isDestroying || this.isDestroyed) {\n return null;\n }\n const support = lookupLegacySupport(this);\n\n if (DEBUG) {\n if (['currentState'].indexOf(key) !== -1) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`\n );\n }\n if (Object.prototype.hasOwnProperty.call(opts, 'serialize')) {\n warn(\n `You provided a serialize option on the \"${key}\" property in the \"${support.identifier.type}\" class, this belongs in the serializer. See Serializer and it's implementations https://api.emberjs.com/ember-data/release/classes/Serializer`,\n false,\n {\n id: 'ds.model.serialize-option-in-belongs-to',\n }\n );\n }\n\n if (Object.prototype.hasOwnProperty.call(opts, 'embedded')) {\n warn(\n `You provided an embedded option on the \"${key}\" property in the \"${support.identifier.type}\" class, this belongs in the serializer. See EmbeddedRecordsMixin https://api.emberjs.com/ember-data/release/classes/EmbeddedRecordsMixin`,\n false,\n {\n id: 'ds.model.embedded-option-in-belongs-to',\n }\n );\n }\n }\n\n return support.getBelongsTo(key);\n },\n set(key, value) {\n const support = lookupLegacySupport(this);\n if (DEBUG) {\n if (['currentState'].indexOf(key) !== -1) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`\n );\n }\n }\n this.store._join(() => {\n support.setDirtyBelongsTo(key, value);\n });\n\n return support.getBelongsTo(key);\n },\n }).meta(meta);\n}\n\nexport default computedMacroWithOptionalParams(belongsTo);\n","/**\n @module @ember-data/model\n*/\nimport { A } from '@ember/array';\nimport { assert } from '@ember/debug';\nimport { computed } from '@ember/object';\nimport { dasherize } from '@ember/string';\n\nimport { singularize } from 'ember-inflector';\n\nimport { DEBUG } from '@ember-data/env';\n\nimport { lookupLegacySupport } from './model';\nimport { computedMacroWithOptionalParams } from './util';\n\nfunction normalizeType(type) {\n return singularize(dasherize(type));\n}\n\n/**\n `hasMany` is used to define One-To-Many and Many-To-Many\n relationships on a [Model](/ember-data/release/classes/Model).\n\n `hasMany` takes an optional hash as a second parameter, currently\n supported options are:\n\n - `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.\n - `inverse`: A string used to identify the inverse property on a related model.\n - `polymorphic` A boolean value to mark the relationship as polymorphic\n\n #### One-To-Many\n To declare a one-to-many relationship between two models, use\n `belongsTo` in combination with `hasMany`, like this:\n\n ```app/models/post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('comment') comments;\n }\n ```\n\n ```app/models/comment.js\n import Model, { belongsTo } from '@ember-data/model';\n\n export default class CommentModel extends Model {\n @belongsTo('post') post;\n }\n ```\n\n #### Many-To-Many\n To declare a many-to-many relationship between two models, use\n `hasMany`:\n\n ```app/models/post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('tag') tags;\n }\n ```\n\n ```app/models/tag.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class TagModel extends Model {\n @hasMany('post') posts;\n }\n ```\n\n You can avoid passing a string as the first parameter. In that case Ember Data\n will infer the type from the singularized key name.\n\n ```app/models/post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany tags;\n }\n ```\n\n will lookup for a Tag type.\n\n #### Explicit Inverses\n\n Ember Data will do its best to discover which relationships map to\n one another. In the one-to-many code above, for example, Ember Data\n can figure out that changing the `comments` relationship should update\n the `post` relationship on the inverse because post is the only\n relationship to that model.\n\n However, sometimes you may have multiple `belongsTo`/`hasMany` for the\n same type. You can specify which property on the related model is\n the inverse using `hasMany`'s `inverse` option:\n\n ```app/models/comment.js\n import Model, { belongsTo } from '@ember-data/model';\n\n export default class CommentModel extends Model {\n @belongsTo('post') onePost;\n @belongsTo('post') twoPost\n @belongsTo('post') redPost;\n @belongsTo('post') bluePost;\n }\n ```\n\n ```app/models/post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('comment', {\n inverse: 'redPost'\n })\n comments;\n }\n ```\n\n You can also specify an inverse on a `belongsTo`, which works how\n you'd expect.\n\n #### Sync relationships\n\n Ember Data resolves sync relationships with the related resources\n available in its local store, hence it is expected these resources\n to be loaded before or along-side the primary resource.\n\n ```app/models/post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('comment', {\n async: false\n })\n comments;\n }\n ```\n\n In contrast to async relationship, accessing a sync relationship\n will always return a [ManyArray](/ember-data/release/classes/ManyArray) instance\n containing the existing local resources. But it will error on access\n when any of the known related resources have not been loaded.\n\n ```\n post.comments.forEach((comment) => {\n\n });\n\n ```\n\n If you are using `links` with sync relationships, you have to use\n `ref.reload` to fetch the resources.\n\n @method hasMany\n @public\n @static\n @for @ember-data/model\n @param {String} type (optional) type of the relationship\n @param {Object} options (optional) a hash of options\n @return {Ember.computed} relationship\n*/\nfunction hasMany(type, options) {\n assert(`Expected hasMany options.async to be a boolean`, options && typeof options.async === 'boolean');\n\n // Metadata about relationships is stored on the meta of\n // the relationship. This is used for introspection and\n // serialization. Note that `key` is populated lazily\n // the first time the CP is called.\n let meta = {\n type: normalizeType(type),\n options,\n isRelationship: true,\n kind: 'hasMany',\n name: 'Has Many',\n key: null,\n };\n\n return computed({\n get(key) {\n if (DEBUG) {\n if (['currentState'].indexOf(key) !== -1) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your hasMany on ${this.constructor.toString()}`\n );\n }\n }\n if (this.isDestroying || this.isDestroyed) {\n return A();\n }\n return lookupLegacySupport(this).getHasMany(key);\n },\n set(key, records) {\n if (DEBUG) {\n if (['currentState'].indexOf(key) !== -1) {\n throw new Error(\n `'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your hasMany on ${this.constructor.toString()}`\n );\n }\n }\n const support = lookupLegacySupport(this);\n const manyArray = support.getManyArray(key);\n assert(`You must pass an array of records to set a hasMany relationship`, Array.isArray(records));\n this.store._join(() => {\n manyArray.splice(0, manyArray.length, ...records);\n });\n\n return support.getHasMany(key);\n },\n }).meta(meta);\n}\n\nexport default computedMacroWithOptionalParams(hasMany);\n"],"names":["attr","type","options","undefined","meta","isAttribute","computed","get","key","macroCondition","getOwnConfig","env","DEBUG","indexOf","Error","constructor","toString","isDestroyed","isDestroying","peekCache","getAttr","recordIdentifierFor","set","value","assert","currentState","isDeleted","identifier","cache","currentValue","setAttr","isValid","errors","remove","cleanErrorRequests","computedMacroWithOptionalParams","normalizeType","dasherize","belongsTo","modelName","opts","userEnteredModelName","async","inverse","length","isRelationship","kind","name","support","lookupLegacySupport","Object","prototype","hasOwnProperty","call","warn","id","getBelongsTo","store","_join","setDirtyBelongsTo","singularize","hasMany","A","getHasMany","records","manyArray","getManyArray","Array","isArray","splice"],"mappings":";;;;;;;;;;AASA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAIA,CAACC,IAAI,EAAEC,OAAO,EAAE;AAC3B,EAAA,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE;AAC5BC,IAAAA,OAAO,GAAGD,IAAI,CAAA;AACdA,IAAAA,IAAI,GAAGE,SAAS,CAAA;AAClB,GAAC,MAAM;AACLD,IAAAA,OAAO,GAAGA,OAAO,IAAI,EAAE,CAAA;AACzB,GAAA;AAEA,EAAA,IAAIE,IAAI,GAAG;AACTH,IAAAA,IAAI,EAAEA,IAAI;AACVI,IAAAA,WAAW,EAAE,IAAI;AACjBH,IAAAA,OAAO,EAAEA,OAAAA;GACV,CAAA;AAED,EAAA,OAAOI,QAAQ,CAAC;IACdC,GAAGA,CAACC,GAAG,EAAE;AACP,MAAA,IAAAC,cAAA,CAAAC,YAAA,GAAAC,GAAA,CAAAC,KAAA,CAAW,EAAA;QACT,IAAI,CAAC,cAAc,CAAC,CAACC,OAAO,CAACL,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;AACxC,UAAA,MAAM,IAAIM,KAAK,CACZ,CAAA,CAAA,EAAGN,GAAI,CAAkI,gIAAA,EAAA,IAAI,CAACO,WAAW,CAACC,QAAQ,EAAG,EACxK,CAAC,CAA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UAAA,IAAIA,MAAM,CAACzB,GAAG,CAACC,GAAG,CAAC,EAAE;AACnBwB,YAAAA,MAAM,CAACC,MAAM,CAACzB,GAAG,CAAC,CAAA;AAClB,YAAA,IAAI,CAACiB,YAAY,CAACS,kBAAkB,EAAE,CAAA;AACxC,WAAA;AACF,SAAA;AACF,OAAA;AAEA,MAAA,OAAOX,KAAK,CAAA;AACd,KAAA;AACF,GAAC,CAAC,CAACnB,IAAI,CAACA,IAAI,CAAC,CAAA;AACf,CAAA;AAEA,aAAe+B,+BAA+B,CAACnC,IAAI,CAAC;;AC3JpD,SAASoC,eAAaA,CAACnC,IAAI,EAAE;EAC3B,OAAOoC,SAAS,CAACpC,IAAI,CAAC,CAAA;AACxB,CAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASqC,SAASA,CAACC,SAAS,EAAErC,OAAO,EAAE;EACrC,IAAIsC,IAAI,GAAGtC,OAAO,CAAA;EAClB,IAAIuC,oBAAoB,GAAGF,SAAS,CAAA;EAEpCf,MAAM,CAAE,CAAiD,gDAAA,CAAA,EAAEgB,IAAI,IAAI,OAAOA,IAAI,CAACE,KAAK,KAAK,SAAS,CAAC,CAAA;EACnGlB,MAAM,CACH,kGAAiG,EAClGgB,IAAI,CAACG,OAAO,KAAK,IAAI,IAAK,OAAOH,I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AAW,CAACvB,SAAS,CAACpC,IAAI,CAAC,CAAC,CAAA;AACrC,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS4D,OAAOA,CAAC5D,IAAI,EAAEC,OAAO,EAAE;EAC9BsB,MAAM,CAAE,CAA+C,8CAAA,CAAA,EAAEtB,OAAO,IAAI,OAAOA,OAAO,CAACwC,KAAK,KAAK,SAAS,CAAC,CAAA;;AAEvG;AACA;AACA;AACA;AACA,EAAA,IAAItC,IAAI,GAAG;AACTH,IAAAA,IAAI,EAAEmC,aAAa,CAACnC,IAAI,CAAC;IACzBC,OAAO;AACP2C,IAAAA,cAAc,EAAE,IAAI;AACpBC,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,UAAU;AAChBvC,IAAAA,GAAG,EAAE,IAAA;GACN,CAAA;AAED,EAAA,OAAOF,QAAQ,CAAC;IACdC,GAAGA,CAACC,GAAG,EAAE;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