@ember-data/model 5.8.0-alpha.29 → 5.8.0-alpha.30
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/README.md +39 -33
- package/package.json +5 -5
- package/unstable-preview-types/index.d.ts +2 -2
package/README.md
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<img
|
|
3
3
|
class="project-logo"
|
|
4
|
-
src="./logos/
|
|
5
|
-
alt="
|
|
6
|
-
width="
|
|
7
|
-
title="
|
|
8
|
-
/>
|
|
9
|
-
<img
|
|
10
|
-
class="project-logo"
|
|
11
|
-
src="./logos/ember-data-logo-light.svg#gh-light-mode-only"
|
|
12
|
-
alt="EmberData Model"
|
|
13
|
-
width="240px"
|
|
14
|
-
title="EmberData Model"
|
|
4
|
+
src="./logos/logo-yellow-slab.svg"
|
|
5
|
+
alt="WarpDrive"
|
|
6
|
+
width="180px"
|
|
7
|
+
title="WarpDrive"
|
|
15
8
|
/>
|
|
16
9
|
</p>
|
|
17
10
|
|
|
18
|
-
|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+
[](https://discord.gg/zT3asNS
|
|
15
|
+
)
|
|
16
|
+
[](https://discord.gg/PHBbnWJx5S
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<br>
|
|
21
|
+
<a href="https://warp-drive.io">WarpDrive</a> is the lightweight data library for web apps —
|
|
22
|
+
<br>
|
|
23
|
+
universal, typed, reactive, and ready to scale.
|
|
24
|
+
<br/><br/>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
---
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
# @ember-data/model
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
Runtime classes for use as a source of ResourceSchema and as a ReactiveResource for older "legacy" EmberData/WarpDrive configurations.
|
|
23
32
|
|
|
24
|
-
|
|
25
|
-
pnpm add @ember-data/model
|
|
26
|
-
```
|
|
33
|
+
If using more recent versions of WarpDrive, install this via [@warp-drive/legacy](https://www.npmjs.com/package/@warp-drive/legacy) instead.
|
|
27
34
|
|
|
28
35
|
**Tagged Releases**
|
|
29
36
|
|
|
@@ -33,8 +40,7 @@ pnpm add @ember-data/model
|
|
|
33
40
|
- 
|
|
34
41
|
- 
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
<p align="center">Provides a Presentation Model for resource data in an EmberData Cache</p>
|
|
43
|
+
## About
|
|
38
44
|
|
|
39
45
|
This package implements the EmberData Store's `instantiateRecord` and `teardownRecord` hooks
|
|
40
46
|
as well as configures an associated `SchemaService` implementation.
|
|
@@ -52,23 +58,23 @@ specifically to the class definition and the static schema methods present on it
|
|
|
52
58
|
When we refer to a `record` we refer to a specific class instance presenting
|
|
53
59
|
the resource data for a given `type` and `id`.
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
### Defining a Model
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
*app/models/person.js*
|
|
64
|
+
```ts
|
|
65
|
+
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
export default class PersonModel extends Model {
|
|
68
|
+
@attr name;
|
|
63
69
|
|
|
64
|
-
|
|
70
|
+
@belongsTo('pet', { inverse: 'owners', async: false }) dog;
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
@hasMany('person', { inverse: 'friends', async: true }) friends;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
69
75
|
|
|
70
|
-
|
|
76
|
+
### modelName convention
|
|
71
77
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
By convention, the name of a given model (its `type`) matches the name
|
|
79
|
+
of the file in the `app/models` folder and should be lowercase, singular
|
|
80
|
+
and dasherized.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/model",
|
|
3
|
-
"version": "5.8.0-alpha.
|
|
3
|
+
"version": "5.8.0-alpha.30",
|
|
4
4
|
"description": "A basic Ember implementation of a resource presentation layer for use with @ember-data/store",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"ember-cli-string-utils": "^1.1.0",
|
|
49
49
|
"ember-cli-test-info": "^1.0.0",
|
|
50
50
|
"inflection": "~3.0.2",
|
|
51
|
-
"@warp-drive/core": "5.8.0-alpha.
|
|
52
|
-
"@warp-drive/legacy": "5.8.0-alpha.
|
|
53
|
-
"@warp-drive/utilities": "5.8.0-alpha.
|
|
51
|
+
"@warp-drive/core": "5.8.0-alpha.30",
|
|
52
|
+
"@warp-drive/legacy": "5.8.0-alpha.30",
|
|
53
|
+
"@warp-drive/utilities": "5.8.0-alpha.30"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@babel/core": "^7.28.3",
|
|
57
57
|
"@babel/plugin-transform-typescript": "^7.28.0",
|
|
58
58
|
"@babel/preset-env": "^7.28.3",
|
|
59
59
|
"@babel/preset-typescript": "^7.27.1",
|
|
60
|
-
"@warp-drive/internal-config": "5.8.0-alpha.
|
|
60
|
+
"@warp-drive/internal-config": "5.8.0-alpha.30",
|
|
61
61
|
"expect-type": "^1.2.2",
|
|
62
62
|
"typescript": "^5.9.2",
|
|
63
63
|
"vite": "^7.1.3"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference path="./hooks.d.ts" />
|
|
2
|
-
/// <reference path="./migration-support.d.ts" />
|
|
3
1
|
/// <reference path="./-private.d.ts" />
|
|
2
|
+
/// <reference path="./migration-support.d.ts" />
|
|
3
|
+
/// <reference path="./hooks.d.ts" />
|
|
4
4
|
declare module '@ember-data/model' {
|
|
5
5
|
/**
|
|
6
6
|
* This package provides a Presentation Model for resource data in an EmberData Cache.
|