@ember-data/model 5.9.0-alpha.21 → 5.9.0-alpha.23
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.d.ts +1 -0
- package/dist/-private.js +1 -1
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.js +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/migration-support.d.ts +1 -0
- package/dist/migration-support.js +1 -1
- package/package.json +16 -15
- package/unstable-preview-types/-private.d.ts +0 -2
- package/unstable-preview-types/hooks.d.ts +2 -2
- package/unstable-preview-types/index.d.ts +2 -40
- package/unstable-preview-types/migration-support.d.ts +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from "@warp-drive/legacy/model/-private";
|
package/dist/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "@warp-drive/legacy/model/-private"
|
package/dist/hooks.d.ts
ADDED
package/dist/hooks.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { buildSchema, instantiateRecord, modelFor, teardownRecord } from "@warp-drive/legacy/model";
|
|
2
|
+
|
|
3
|
+
export { buildSchema, instantiateRecord, modelFor, teardownRecord };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import model_default, { AsyncBelongsTo, AsyncHasMany, HasMany, ManyArray, attr, belongsTo, buildSchema, hasMany, instantiateRecord, modelFor, teardownRecord } from "@warp-drive/legacy/model";
|
|
2
|
+
export { type AsyncBelongsTo, type AsyncHasMany, type HasMany, type ManyArray, attr, belongsTo, buildSchema, model_default as default, hasMany, instantiateRecord, modelFor, teardownRecord };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import model_default, { attr, belongsTo, buildSchema, hasMany, instantiateRecord, modelFor, teardownRecord } from "@warp-drive/legacy/model";
|
|
2
|
+
|
|
3
|
+
export { attr, belongsTo, buildSchema, model_default as default, hasMany, instantiateRecord, modelFor, teardownRecord };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from "@warp-drive/legacy/model/migration-support";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "@warp-drive/legacy/model/migration-support"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/model",
|
|
3
|
-
"version": "5.9.0-alpha.
|
|
3
|
+
"version": "5.9.0-alpha.23",
|
|
4
4
|
"description": "(Legacy) Ember implementation of a resource presentation layer for use with @ember-data/store",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"version": 2
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"unstable-preview-types",
|
|
23
22
|
"blueprints",
|
|
24
23
|
"addon-main.cjs",
|
|
25
24
|
"dist",
|
|
26
25
|
"README.md",
|
|
27
26
|
"LICENSE.md",
|
|
28
|
-
"logos"
|
|
27
|
+
"logos",
|
|
28
|
+
"unstable-preview-types"
|
|
29
29
|
],
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
@@ -44,22 +44,22 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ember/edition-utils": "^1.2.0",
|
|
46
46
|
"@embroider/macros": "^1.20.6",
|
|
47
|
-
"@warp-drive/core": "5.9.0-alpha.
|
|
48
|
-
"@warp-drive/legacy": "5.9.0-alpha.
|
|
49
|
-
"@warp-drive/utilities": "5.9.0-alpha.
|
|
47
|
+
"@warp-drive/core": "5.9.0-alpha.23",
|
|
48
|
+
"@warp-drive/legacy": "5.9.0-alpha.23",
|
|
49
|
+
"@warp-drive/utilities": "5.9.0-alpha.23",
|
|
50
50
|
"ember-cli-string-utils": "^1.1.0",
|
|
51
51
|
"ember-cli-test-info": "^1.0.0",
|
|
52
52
|
"inflection": "~3.0.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@babel/core": "^7.
|
|
56
|
-
"@babel/plugin-transform-typescript": "^7.
|
|
57
|
-
"@babel/preset-env": "^7.
|
|
58
|
-
"@babel/preset-typescript": "^7.
|
|
59
|
-
"@warp-drive/internal-config": "5.9.0-alpha.
|
|
55
|
+
"@babel/core": "^7.29.7",
|
|
56
|
+
"@babel/plugin-transform-typescript": "^7.29.7",
|
|
57
|
+
"@babel/preset-env": "^7.29.7",
|
|
58
|
+
"@babel/preset-typescript": "^7.29.7",
|
|
59
|
+
"@warp-drive/internal-config": "5.9.0-alpha.23",
|
|
60
60
|
"expect-type": "^1.2.2",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
61
|
+
"tsdown": "^0.22.14",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
63
63
|
},
|
|
64
64
|
"volta": {
|
|
65
65
|
"extends": "../../package.json"
|
|
@@ -73,8 +73,9 @@
|
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"lint": "eslint . --quiet --cache --cache-strategy=content",
|
|
76
|
-
"
|
|
76
|
+
"check:types": "tsc --noEmit",
|
|
77
|
+
"build:pkg": "node node_modules/tsdown/dist/run.mjs",
|
|
77
78
|
"sync": "echo \"syncing\"",
|
|
78
|
-
"start": "
|
|
79
|
+
"start": "node node_modules/tsdown/dist/run.mjs --watch"
|
|
79
80
|
}
|
|
80
81
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare module '@ember-data/model/hooks' {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { buildSchema, instantiateRecord, modelFor, teardownRecord } from "@warp-drive/legacy/model";
|
|
3
|
+
export { buildSchema, instantiateRecord, modelFor, teardownRecord };
|
|
4
4
|
}
|
|
@@ -2,44 +2,6 @@
|
|
|
2
2
|
/// <reference path="./migration-support.d.ts" />
|
|
3
3
|
/// <reference path="./-private.d.ts" />
|
|
4
4
|
declare module '@ember-data/model' {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* Models are defined as classes extending from `import Model from '@ember-data/model';` and the
|
|
9
|
-
* attributes and relationships on these classes are parsed at runtime to supply static "schema"
|
|
10
|
-
* to EmberData's SchemaService.
|
|
11
|
-
*
|
|
12
|
-
* Resource data for individual resources fetched from your API is presented to the UI via instances
|
|
13
|
-
* of the `Model`s you define. An instantiated `Model` is referred to as a `record`.
|
|
14
|
-
|
|
15
|
-
When we refer to the `ModelClass` as opposed to a `Model` or `Record` we are referring
|
|
16
|
-
specifically to the class definition and the static schema methods present on it.
|
|
17
|
-
|
|
18
|
-
When we refer to a `record` we refer to a specific class instance presenting
|
|
19
|
-
the resource data for a given `type` and `id`.
|
|
20
|
-
|
|
21
|
-
### Defining a Model
|
|
22
|
-
|
|
23
|
-
```js [app/models/person.js]
|
|
24
|
-
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
|
|
25
|
-
|
|
26
|
-
export default class PersonModel extends Model {
|
|
27
|
-
@attr name;
|
|
28
|
-
|
|
29
|
-
@belongsTo('pet', { inverse: 'owners', async: false }) dog;
|
|
30
|
-
|
|
31
|
-
@hasMany('person', { inverse: 'friends', async: true }) friends;
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### modelName convention
|
|
36
|
-
|
|
37
|
-
By convention, the name of a given model (its `type`) matches the name
|
|
38
|
-
of the file in the `app/models` folder and should be lowercase, singular
|
|
39
|
-
and dasherized.
|
|
40
|
-
|
|
41
|
-
@module
|
|
42
|
-
*/
|
|
43
|
-
export { default, attr, belongsTo, hasMany, instantiateRecord, teardownRecord, modelFor, buildSchema, type ManyArray, type HasMany, type AsyncHasMany, type AsyncBelongsTo } from "@warp-drive/legacy/model";
|
|
44
|
-
|
|
5
|
+
import model_default, { AsyncBelongsTo, AsyncHasMany, HasMany, ManyArray, attr, belongsTo, buildSchema, hasMany, instantiateRecord, modelFor, teardownRecord } from "@warp-drive/legacy/model";
|
|
6
|
+
export { type AsyncBelongsTo, type AsyncHasMany, type HasMany, type ManyArray, attr, belongsTo, buildSchema, model_default as default, hasMany, instantiateRecord, modelFor, teardownRecord };
|
|
45
7
|
}
|
|
@@ -1,24 +1,3 @@
|
|
|
1
1
|
declare module '@ember-data/model/migration-support' {
|
|
2
|
-
/**
|
|
3
|
-
* This module provides support for migrating away from @ember-data/model
|
|
4
|
-
* to @warp-drive/schema-record.
|
|
5
|
-
*
|
|
6
|
-
* It includes:
|
|
7
|
-
*
|
|
8
|
-
* - A `withDefaults` function to assist in creating a schema in LegacyMode
|
|
9
|
-
* - A `registerDerivations` function to register the derivations necessary to support LegacyMode
|
|
10
|
-
* - A `DelegatingSchemaService` that can be used to provide a schema service that works with both
|
|
11
|
-
* @ember-data/model and @warp-drive/schema-record simultaneously for migration purposes.
|
|
12
|
-
* - A `WithLegacy` type util that can be used to create a type that includes the legacy
|
|
13
|
-
* properties and methods of a record.
|
|
14
|
-
*
|
|
15
|
-
* Using LegacyMode features on a ReactiveResource *requires* the use of these derivations and schema
|
|
16
|
-
* additions. LegacyMode is not intended to be a long-term solution, but rather a stepping stone
|
|
17
|
-
* to assist in more rapidly adopting modern WarpDrive features.
|
|
18
|
-
*
|
|
19
|
-
* @module
|
|
20
|
-
*/
|
|
21
|
-
export * from "@warp-drive/legacy/model/migration-support";
|
|
22
2
|
export type * from "@warp-drive/legacy/model/migration-support";
|
|
23
|
-
|
|
24
3
|
}
|