@ember-data/model 4.12.0-alpha.2 → 4.12.0-alpha.20

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (C) 2017-2022 Ember.js contributors
3
+ Copyright (C) 2017-2023 Ember.js contributors
4
4
  Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
5
5
  Portions Copyright (C) 2011 LivingSocial Inc.
6
6
 
package/README.md CHANGED
@@ -1,31 +1,55 @@
1
- @ember-data/model
2
- ==============================================================================
1
+ <p align="center">
2
+ <img
3
+ class="project-logo"
4
+ src="./ember-data-logo-dark.svg#gh-dark-mode-only"
5
+ alt="EmberData Model"
6
+ width="240px"
7
+ title="EmberData Model"
8
+ />
9
+ <img
10
+ class="project-logo"
11
+ src="./ember-data-logo-light.svg#gh-light-mode-only"
12
+ alt="EmberData Model"
13
+ width="240px"
14
+ title="EmberData Model"
15
+ />
16
+ </p>
3
17
 
4
- [Short description of the addon.]
18
+ <p align="center">Provides a Presentation Model for resource data in an EmberData Cache</p>
5
19
 
20
+ This package implements the EmberData Store's `instantiateRecord` and `teardownRecord` hooks
21
+ as well as configures an associated `SchemaService` implementation.
6
22
 
7
- Compatibility
8
- ------------------------------------------------------------------------------
23
+ Models are defined as classes extending from `import Model from '@ember-data/model';` and the
24
+ attributes and relationships on these classes are parsed at runtime to supply static "schema"
25
+ to EmberData's SchemaService.
9
26
 
10
- * Ember.js v3.4 or above
11
- * Ember CLI v2.13 or above
27
+ Resource data for individual resources fetched from your API is presented to the UI via instances
28
+ of the `Model`s you define. An instantiated `Model` is referred to as a `record`.
12
29
 
30
+ When we refer to the `ModelClass` as opposed to a `Model` or `Record` we are referring
31
+ specifically to the class definition and the static schema methods present on it.
13
32
 
14
- Installation
15
- ------------------------------------------------------------------------------
33
+ When we refer to a `record` we refer to a specific class instance presenting
34
+ the resource data for a given `type` and `id`.
16
35
 
17
- ```
18
- ember install @ember-data/model
19
- ```
36
+ ### Defining a Model
20
37
 
38
+ *app/models/person.js*
39
+ ```ts
40
+ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
21
41
 
22
- Usage
23
- ------------------------------------------------------------------------------
42
+ export default class PersonModel extends Model {
43
+ @attr name;
24
44
 
25
- [Longer description of how to use the addon in apps.]
45
+ @belongsTo('pet', { inverse: 'owners', async: false }) dog;
26
46
 
47
+ @hasMany('person', { inverse: 'friends', async: true }) friends;
48
+ }
49
+ ```
27
50
 
28
- License
29
- ------------------------------------------------------------------------------
51
+ ### modelName convention
30
52
 
31
- This project is licensed under the [MIT License](LICENSE.md).
53
+ By convention, the name of a given model (its `type`) matches the name
54
+ of the file in the `app/models` folder and should be lowercase, singular
55
+ and dasherized.
package/addon/-private.js CHANGED
@@ -1,5 +1,5 @@
1
- import { M as Model } from "./has-many-26353d30";
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-26353d30";
1
+ import { M as Model } from "./has-many-465843f4";
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-465843f4";
3
3
  import { getOwner } from '@ember/application';
4
4
 
5
5
  /*