@ember-data/model 5.9.0-alpha.23 → 5.9.0-alpha.27
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/CHANGELOG.md +210 -0
- package/blueprints/model/files/__root__/__path__/__name__.js +1 -5
- package/blueprints/model/index.js +8 -150
- package/blueprints/model-test/index.js +10 -14
- package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +1 -13
- package/package.json +9 -16
- package/unstable-preview-types/index.d.ts +2 -2
- package/blueprints/model/native-files/__root__/__path__/__name__.js +0 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# @ember-data/model Changelog
|
|
2
|
+
|
|
3
|
+
## v5.8.0 (2025-10-07)
|
|
4
|
+
|
|
5
|
+
#### :house: Internal
|
|
6
|
+
|
|
7
|
+
* [#10349](https://github.com/warp-drive-data/warp-drive/pull/10349) chore: update all emberjs/data links to warp-drive-data/warp-drive ([@runspired](https://github.com/runspired))
|
|
8
|
+
|
|
9
|
+
#### Committers: (1)
|
|
10
|
+
|
|
11
|
+
Chris Thoburn ([@runspired](https://github.com/runspired))
|
|
12
|
+
|
|
13
|
+
## v5.7.0 (2025-08-26)
|
|
14
|
+
|
|
15
|
+
#### :house: Internal
|
|
16
|
+
|
|
17
|
+
* [#10130](https://github.com/warp-drive-data/warp-drive/pull/10130) chore: bump pnpm version ([@runspired](https://github.com/runspired))
|
|
18
|
+
* [#10129](https://github.com/warp-drive-data/warp-drive/pull/10129) chore: bump typescript to 5.9 ([@runspired](https://github.com/runspired))
|
|
19
|
+
* [#10124](https://github.com/warp-drive-data/warp-drive/pull/10124) chore: mark a few types as private ([@runspired](https://github.com/runspired))
|
|
20
|
+
|
|
21
|
+
#### Committers: (1)
|
|
22
|
+
|
|
23
|
+
Chris Thoburn ([@runspired](https://github.com/runspired))
|
|
24
|
+
|
|
25
|
+
## v5.6.0 (2025-07-01)
|
|
26
|
+
|
|
27
|
+
#### :memo: Documentation
|
|
28
|
+
|
|
29
|
+
* [#9991](https://github.com/warp-drive-data/warp-drive/pull/9991) chore: improve output of typedoc ([@runspired](https://github.com/runspired))
|
|
30
|
+
* [#9989](https://github.com/warp-drive-data/warp-drive/pull/9989) [BREAKING] docs: integrate API docs to the new docs site ([@runspired](https://github.com/runspired))
|
|
31
|
+
|
|
32
|
+
#### :rocket: Enhancement
|
|
33
|
+
|
|
34
|
+
* [#10011](https://github.com/warp-drive-data/warp-drive/pull/10011) feat: @warp-drive/core/build-config ([@runspired](https://github.com/runspired))
|
|
35
|
+
* [#10005](https://github.com/warp-drive-data/warp-drive/pull/10005) feat: @warp-drive/legacy ([@runspired](https://github.com/runspired))
|
|
36
|
+
|
|
37
|
+
#### :bug: Bug Fix
|
|
38
|
+
|
|
39
|
+
* [#9982](https://github.com/warp-drive-data/warp-drive/pull/9982) fix: simplify peer configuration to avoid bringing extra copies of glimmer/validator ([@runspired](https://github.com/runspired))
|
|
40
|
+
|
|
41
|
+
#### :house: Internal
|
|
42
|
+
|
|
43
|
+
* [#10042](https://github.com/warp-drive-data/warp-drive/pull/10042) chore: upgrade to vite7 ([@runspired](https://github.com/runspired))
|
|
44
|
+
* [#10040](https://github.com/warp-drive-data/warp-drive/pull/10040) chore: isolated declarations ([@runspired](https://github.com/runspired))
|
|
45
|
+
* [#10039](https://github.com/warp-drive-data/warp-drive/pull/10039) chore: bump pnpm ([@runspired](https://github.com/runspired))
|
|
46
|
+
|
|
47
|
+
#### Committers: (1)
|
|
48
|
+
|
|
49
|
+
Chris Thoburn ([@runspired](https://github.com/runspired))
|
|
50
|
+
|
|
51
|
+
## v5.5.0 (2025-05-08)
|
|
52
|
+
|
|
53
|
+
#### :memo: Documentation
|
|
54
|
+
|
|
55
|
+
* [#9975](https://github.com/warp-drive-data/warp-drive/pull/9975) types: fixup PolarisMode schema types to check better ([@runspired](https://github.com/runspired))
|
|
56
|
+
* [#9971](https://github.com/warp-drive-data/warp-drive/pull/9971) docs: add more documentation and type utils around LegacyMode and potential migration paths ([@runspired](https://github.com/runspired))
|
|
57
|
+
|
|
58
|
+
#### :rocket: Enhancement
|
|
59
|
+
|
|
60
|
+
* [#9971](https://github.com/warp-drive-data/warp-drive/pull/9971) docs: add more documentation and type utils around LegacyMode and potential migration paths ([@runspired](https://github.com/runspired))
|
|
61
|
+
* [#9965](https://github.com/warp-drive-data/warp-drive/pull/9965) feat: universal reactivity hooks ([@runspired](https://github.com/runspired))
|
|
62
|
+
|
|
63
|
+
#### :house: Internal
|
|
64
|
+
|
|
65
|
+
* [#9965](https://github.com/warp-drive-data/warp-drive/pull/9965) feat: universal reactivity hooks ([@runspired](https://github.com/runspired))
|
|
66
|
+
* [#9964](https://github.com/warp-drive-data/warp-drive/pull/9964) chore: refactor PromiseState and RequestState to prep for @warp-drive/core ([@runspired](https://github.com/runspired))
|
|
67
|
+
|
|
68
|
+
#### Committers: (1)
|
|
69
|
+
|
|
70
|
+
Chris Thoburn ([@runspired](https://github.com/runspired))
|
|
71
|
+
|
|
72
|
+
## v5.4.0 (2025-04-11)
|
|
73
|
+
|
|
74
|
+
#### :memo: Documentation
|
|
75
|
+
|
|
76
|
+
* [#9586](https://github.com/warp-drive-data/warp-drive/pull/9586) Fix `until` in deprecation warning `ember-data:schema-service-updates` (must be 6.0 instead of 5.0) ([@mkszepp](https://github.com/mkszepp))
|
|
77
|
+
|
|
78
|
+
#### :rocket: Enhancement
|
|
79
|
+
|
|
80
|
+
* [#9896](https://github.com/warp-drive-data/warp-drive/pull/9896) feat: whoa debugging ([@runspired](https://github.com/runspired))
|
|
81
|
+
* [#9883](https://github.com/warp-drive-data/warp-drive/pull/9883) feat: make documents react to cache updates ([@runspired](https://github.com/runspired))
|
|
82
|
+
* [#9769](https://github.com/warp-drive-data/warp-drive/pull/9769) chore: remove restriction on new field kinds being used with legacy mode ([@runspired](https://github.com/runspired))
|
|
83
|
+
* [#9757](https://github.com/warp-drive-data/warp-drive/pull/9757) feat: schema type utils ([@runspired](https://github.com/runspired))
|
|
84
|
+
* [#9676](https://github.com/warp-drive-data/warp-drive/pull/9676) Feat: hasMany linksMode ([@leoeuclids](https://github.com/leoeuclids))
|
|
85
|
+
* [#9585](https://github.com/warp-drive-data/warp-drive/pull/9585) chore: stub out linksMode work ([@runspired](https://github.com/runspired))
|
|
86
|
+
* [#9541](https://github.com/warp-drive-data/warp-drive/pull/9541) feat: eslint-plugin-(ember-data|warp-drive) ([@runspired](https://github.com/runspired))
|
|
87
|
+
|
|
88
|
+
#### :bug: Bug Fix
|
|
89
|
+
|
|
90
|
+
* [#9698](https://github.com/warp-drive-data/warp-drive/pull/9698) fix: Don't notify changes for attributes not registered with the schema ([@gitKrystan](https://github.com/gitKrystan))
|
|
91
|
+
* [#9592](https://github.com/warp-drive-data/warp-drive/pull/9592) fix: add ember-source as explicit peer-dep for use of @ember/debug ([@runspired](https://github.com/runspired))
|
|
92
|
+
* [#9566](https://github.com/warp-drive-data/warp-drive/pull/9566) fix: attr should support transforms with union serialized types ([@runspired](https://github.com/runspired))
|
|
93
|
+
|
|
94
|
+
#### :house: Internal
|
|
95
|
+
|
|
96
|
+
* [#9780](https://github.com/warp-drive-data/warp-drive/pull/9780) chore: bump @glimmer/component ([@runspired](https://github.com/runspired))
|
|
97
|
+
* [#9759](https://github.com/warp-drive-data/warp-drive/pull/9759) chore: Improve contributing experience ([@runspired](https://github.com/runspired))
|
|
98
|
+
* [#9752](https://github.com/warp-drive-data/warp-drive/pull/9752) chore: tooling upgrades to support WarpDrive package unification ([@runspired](https://github.com/runspired))
|
|
99
|
+
* [#9705](https://github.com/warp-drive-data/warp-drive/pull/9705) chore: make diagnostic shutdown safer, use bun for holodeck server ([@runspired](https://github.com/runspired))
|
|
100
|
+
* [#9699](https://github.com/warp-drive-data/warp-drive/pull/9699) chore: update to pnpm 10 ([@runspired](https://github.com/runspired))
|
|
101
|
+
* [#9629](https://github.com/warp-drive-data/warp-drive/pull/9629) fix: restore * versions and setup publish to not overwrite them ([@runspired](https://github.com/runspired))
|
|
102
|
+
* [#9620](https://github.com/warp-drive-data/warp-drive/pull/9620) Starwars ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
|
|
103
|
+
* [#9596](https://github.com/warp-drive-data/warp-drive/pull/9596) chore: Remove unused `--report-unused-disable-directives` flag ([@gitKrystan](https://github.com/gitKrystan))
|
|
104
|
+
* [#9490](https://github.com/warp-drive-data/warp-drive/pull/9490) Add export point for direct export of blueprints ([@Baltazore](https://github.com/Baltazore))
|
|
105
|
+
|
|
106
|
+
#### Committers: (6)
|
|
107
|
+
|
|
108
|
+
Markus Sanin ([@mkszepp](https://github.com/mkszepp))
|
|
109
|
+
Chris Thoburn ([@runspired](https://github.com/runspired))
|
|
110
|
+
Leo Euclides ([@leoeuclids](https://github.com/leoeuclids))
|
|
111
|
+
Krystan HuffMenne ([@gitKrystan](https://github.com/gitKrystan))
|
|
112
|
+
[@NullVoxPopuli](https://github.com/NullVoxPopuli)
|
|
113
|
+
Kirill Shaplyko ([@Baltazore](https://github.com/Baltazore))
|
|
114
|
+
|
|
115
|
+
## v5.3.4 (2024-06-15)
|
|
116
|
+
|
|
117
|
+
#### :memo: Documentation
|
|
118
|
+
|
|
119
|
+
* [#9328](https://github.com/warp-drive-data/warp-drive/pull/9328) chore: update READMEs with status and dist tag info ([@runspired](https://github.com/runspired))
|
|
120
|
+
|
|
121
|
+
#### :rocket: Enhancement
|
|
122
|
+
|
|
123
|
+
* [#9471](https://github.com/warp-drive-data/warp-drive/pull/9471) feat: npx warp-drive ([@runspired](https://github.com/runspired))
|
|
124
|
+
* [#9468](https://github.com/warp-drive-data/warp-drive/pull/9468) feat: string utils 🌌 ([@runspired](https://github.com/runspired))
|
|
125
|
+
* [#9464](https://github.com/warp-drive-data/warp-drive/pull/9464) feat: implement support for legacy hasMany and belongsTo relationship reads ([@runspired](https://github.com/runspired))
|
|
126
|
+
* [#9407](https://github.com/warp-drive-data/warp-drive/pull/9407) feat: v2 addons ([@runspired](https://github.com/runspired))
|
|
127
|
+
* [#9453](https://github.com/warp-drive-data/warp-drive/pull/9453) feat: update SchemaService to reflect RFC updates ([@runspired](https://github.com/runspired))
|
|
128
|
+
* [#9448](https://github.com/warp-drive-data/warp-drive/pull/9448) feat: impl SchemaService RFC ([@runspired](https://github.com/runspired))
|
|
129
|
+
* [#9450](https://github.com/warp-drive-data/warp-drive/pull/9450) feat: improve typing around Model and createRecord ([@runspired](https://github.com/runspired))
|
|
130
|
+
* [#9387](https://github.com/warp-drive-data/warp-drive/pull/9387) feat: better types for legacy store methods ([@runspired](https://github.com/runspired))
|
|
131
|
+
* [#9366](https://github.com/warp-drive-data/warp-drive/pull/9366) feat: typed Model ([@runspired](https://github.com/runspired))
|
|
132
|
+
* [#9317](https://github.com/warp-drive-data/warp-drive/pull/9317) feat: ensure data utils work well with legacy relationship proxies ([@runspired](https://github.com/runspired))
|
|
133
|
+
* [#9260](https://github.com/warp-drive-data/warp-drive/pull/9260) feat: ember specific data utils ([@runspired](https://github.com/runspired))
|
|
134
|
+
* [#9256](https://github.com/warp-drive-data/warp-drive/pull/9256) feat: improve alpha types support ([@runspired](https://github.com/runspired))
|
|
135
|
+
* [#9250](https://github.com/warp-drive-data/warp-drive/pull/9250) feat: fix types for legacy decorator syntax ([@runspired](https://github.com/runspired))
|
|
136
|
+
* [#9249](https://github.com/warp-drive-data/warp-drive/pull/9249) chore: handle declare statements in module rewriting ([@runspired](https://github.com/runspired))
|
|
137
|
+
* [#9245](https://github.com/warp-drive-data/warp-drive/pull/9245) feat: add consumer types for Model APIs ([@runspired](https://github.com/runspired))
|
|
138
|
+
* [#9244](https://github.com/warp-drive-data/warp-drive/pull/9244) feat: improves consumer-facing store types ([@runspired](https://github.com/runspired))
|
|
139
|
+
|
|
140
|
+
#### :bug: Bug Fix
|
|
141
|
+
|
|
142
|
+
* [#9265](https://github.com/warp-drive-data/warp-drive/pull/9265) feat: Improve config handling for polyfillUUID ([@MehulKChaudhari](https://github.com/MehulKChaudhari))
|
|
143
|
+
|
|
144
|
+
#### :house: Internal
|
|
145
|
+
|
|
146
|
+
* [#9476](https://github.com/warp-drive-data/warp-drive/pull/9476) chore: cleanup symbol usage ([@runspired](https://github.com/runspired))
|
|
147
|
+
* [#9463](https://github.com/warp-drive-data/warp-drive/pull/9463) types: ManyArray => HasMany ([@runspired](https://github.com/runspired))
|
|
148
|
+
* [#9292](https://github.com/warp-drive-data/warp-drive/pull/9292) feat: add new build-config package ([@runspired](https://github.com/runspired))
|
|
149
|
+
* [#9370](https://github.com/warp-drive-data/warp-drive/pull/9370) chore: rename macros ([@runspired](https://github.com/runspired))
|
|
150
|
+
* [#9303](https://github.com/warp-drive-data/warp-drive/pull/9303) infra: setup mirror and types publishing ([@runspired](https://github.com/runspired))
|
|
151
|
+
* [#9279](https://github.com/warp-drive-data/warp-drive/pull/9279) types: branded transforms and improve types needed for serializers ([@runspired](https://github.com/runspired))
|
|
152
|
+
|
|
153
|
+
#### Committers: (2)
|
|
154
|
+
|
|
155
|
+
Chris Thoburn ([@runspired](https://github.com/runspired))
|
|
156
|
+
Mehul Kiran Chaudhari ([@MehulKChaudhari](https://github.com/MehulKChaudhari))
|
|
157
|
+
|
|
158
|
+
For the full project changelog see [https://github.com/warp-drive-data/warp-drive/blob/main/CHANGELOG.md](https://github.com/warp-drive-data/warp-drive/blob/main/CHANGELOG.md)
|
|
159
|
+
|
|
160
|
+
## v5.3.1 (2024-02-24)
|
|
161
|
+
|
|
162
|
+
#### :evergreen_tree: New Deprecation
|
|
163
|
+
|
|
164
|
+
* [#9189](https://github.com/warp-drive-data/warp-drive/pull/9189) fix: mutating ManyArray should handle duplicates gracefully (with deprecation) ([@gitKrystan](https://github.com/gitKrystan))
|
|
165
|
+
|
|
166
|
+
#### :memo: Documentation
|
|
167
|
+
|
|
168
|
+
* [#9159](https://github.com/warp-drive-data/warp-drive/pull/9159) fix: support full range of json:api for references, update docs ([@runspired](https://github.com/runspired))
|
|
169
|
+
* [#9072](https://github.com/warp-drive-data/warp-drive/pull/9072) feat: advanced JSON:API queries & basic request example ([@runspired](https://github.com/runspired))
|
|
170
|
+
|
|
171
|
+
#### :rocket: Enhancement
|
|
172
|
+
|
|
173
|
+
* [#9220](https://github.com/warp-drive-data/warp-drive/pull/9220) feat: request infra improvements ([@runspired](https://github.com/runspired))
|
|
174
|
+
* [#9159](https://github.com/warp-drive-data/warp-drive/pull/9159) fix: support full range of json:api for references, update docs ([@runspired](https://github.com/runspired))
|
|
175
|
+
* [#9094](https://github.com/warp-drive-data/warp-drive/pull/9094) feat: support legacy attribute behaviors in SchemaRecord ([@gitKrystan](https://github.com/gitKrystan))
|
|
176
|
+
* [#9095](https://github.com/warp-drive-data/warp-drive/pull/9095) feat (internal): support legacy model behaviors in SchemaRecord legacy mode ([@runspired](https://github.com/runspired))
|
|
177
|
+
* [#9072](https://github.com/warp-drive-data/warp-drive/pull/9072) feat: advanced JSON:API queries & basic request example ([@runspired](https://github.com/runspired))
|
|
178
|
+
* [#8949](https://github.com/warp-drive-data/warp-drive/pull/8949) feat:prepare for universal reactivity ([@runspired](https://github.com/runspired))
|
|
179
|
+
* [#8935](https://github.com/warp-drive-data/warp-drive/pull/8935) feat: (private) implement basic field support for schema-record ([@runspired](https://github.com/runspired))
|
|
180
|
+
|
|
181
|
+
#### :bug: Bug Fix
|
|
182
|
+
|
|
183
|
+
* [#9189](https://github.com/warp-drive-data/warp-drive/pull/9189) fix: mutating ManyArray should handle duplicates gracefully (with deprecation) ([@gitKrystan](https://github.com/gitKrystan))
|
|
184
|
+
* [#9159](https://github.com/warp-drive-data/warp-drive/pull/9159) fix: support full range of json:api for references, update docs ([@runspired](https://github.com/runspired))
|
|
185
|
+
|
|
186
|
+
#### :house: Internal
|
|
187
|
+
|
|
188
|
+
* [#9110](https://github.com/warp-drive-data/warp-drive/pull/9110) Stricter typescript-eslint config ([@gitKrystan](https://github.com/gitKrystan))
|
|
189
|
+
* [#9058](https://github.com/warp-drive-data/warp-drive/pull/9058) Switch from eslint-plugin-prettier to running prettier directly ([@gitKrystan](https://github.com/gitKrystan))
|
|
190
|
+
* [#9057](https://github.com/warp-drive-data/warp-drive/pull/9057) Add eslint-plugin-n to eslint config for node files ([@gitKrystan](https://github.com/gitKrystan))
|
|
191
|
+
* [#9055](https://github.com/warp-drive-data/warp-drive/pull/9055) Fix ESLint for VSCode ([@gitKrystan](https://github.com/gitKrystan))
|
|
192
|
+
* [#9051](https://github.com/warp-drive-data/warp-drive/pull/9051) chore: use references for tsc, add checks to schema-record, bun to run scripts ([@runspired](https://github.com/runspired))
|
|
193
|
+
* [#9032](https://github.com/warp-drive-data/warp-drive/pull/9032) chore(types): split out lint and type commands to be per-package ([@runspired](https://github.com/runspired))
|
|
194
|
+
* [#9050](https://github.com/warp-drive-data/warp-drive/pull/9050) chore: use composite mode for tsc ([@runspired](https://github.com/runspired))
|
|
195
|
+
* [#9049](https://github.com/warp-drive-data/warp-drive/pull/9049) chore: incremental tsc builds ([@runspired](https://github.com/runspired))
|
|
196
|
+
* [#9046](https://github.com/warp-drive-data/warp-drive/pull/9046) chore: reduce number of things turbo builds for build ([@runspired](https://github.com/runspired))
|
|
197
|
+
* [#9029](https://github.com/warp-drive-data/warp-drive/pull/9029) chore: add @warp-drive/core as home for shared code ([@runspired](https://github.com/runspired))
|
|
198
|
+
* [#9028](https://github.com/warp-drive-data/warp-drive/pull/9028) chore: more isolated types ([@runspired](https://github.com/runspired))
|
|
199
|
+
* [#9025](https://github.com/warp-drive-data/warp-drive/pull/9025) chore: reconfigure request package type location ([@runspired](https://github.com/runspired))
|
|
200
|
+
* [#9021](https://github.com/warp-drive-data/warp-drive/pull/9021) chore: cleanup ember-data/-private types ([@runspired](https://github.com/runspired))
|
|
201
|
+
* [#9019](https://github.com/warp-drive-data/warp-drive/pull/9019) chore: make model types strict ([@runspired](https://github.com/runspired))
|
|
202
|
+
* [#9006](https://github.com/warp-drive-data/warp-drive/pull/9006) chore (internal): convert builder and request tests to use diagnostic+runner ([@runspired](https://github.com/runspired))
|
|
203
|
+
* [#8931](https://github.com/warp-drive-data/warp-drive/pull/8931) chore: package infra for schema-record ([@runspired](https://github.com/runspired))
|
|
204
|
+
* [#8930](https://github.com/warp-drive-data/warp-drive/pull/8930) chore: get last request for any record on instantiation ([@runspired](https://github.com/runspired))
|
|
205
|
+
|
|
206
|
+
#### Committers: (2)
|
|
207
|
+
|
|
208
|
+
Krystan HuffMenne ([@gitKrystan](https://github.com/gitKrystan))
|
|
209
|
+
Chris Thoburn ([@runspired](https://github.com/runspired))
|
|
210
|
+
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const EOL = require('os').EOL;
|
|
3
|
-
|
|
4
|
-
const { has } = require('@ember/edition-utils');
|
|
5
|
-
|
|
6
|
-
const inflection = require('inflection');
|
|
7
|
-
const stringUtils = require('ember-cli-string-utils');
|
|
8
|
-
|
|
9
1
|
module.exports = {
|
|
10
2
|
description: 'Generates an ember-data Model.',
|
|
11
3
|
|
|
@@ -13,151 +5,17 @@ module.exports = {
|
|
|
13
5
|
|
|
14
6
|
root: __dirname,
|
|
15
7
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (hasOctane && process.env.EMBER_EDITION === 'classic') {
|
|
19
|
-
hasOctane = false; //forcible override
|
|
20
|
-
}
|
|
21
|
-
let rootPath = hasOctane ? 'native-files' : 'files';
|
|
22
|
-
return path.join(__dirname, rootPath);
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
locals(options) {
|
|
27
|
-
let attrs = [];
|
|
28
|
-
let needs = [];
|
|
29
|
-
let entityOptions = options.entity.options;
|
|
30
|
-
let includeHasMany = false;
|
|
31
|
-
let includeBelongsTo = false;
|
|
32
|
-
let includeAttr = false;
|
|
33
|
-
|
|
34
|
-
for (let name in entityOptions) {
|
|
35
|
-
let type = entityOptions[name] || '';
|
|
36
|
-
let foreignModel = name;
|
|
37
|
-
if (type.indexOf(':') > -1) {
|
|
38
|
-
foreignModel = type.split(':')[1];
|
|
39
|
-
type = type.split(':')[0];
|
|
40
|
-
}
|
|
41
|
-
let dasherizedName = stringUtils.dasherize(name);
|
|
42
|
-
let camelizedName = stringUtils.camelize(name);
|
|
43
|
-
let dasherizedType = stringUtils.dasherize(type);
|
|
44
|
-
let dasherizedForeignModel = stringUtils.dasherize(foreignModel);
|
|
45
|
-
let dasherizedForeignModelSingular = inflection.singularize(dasherizedForeignModel);
|
|
46
|
-
|
|
47
|
-
let attr;
|
|
48
|
-
if (/has-many/.test(dasherizedType)) {
|
|
49
|
-
includeHasMany = true;
|
|
50
|
-
let camelizedNamePlural = inflection.pluralize(camelizedName);
|
|
51
|
-
attr = {
|
|
52
|
-
name: dasherizedForeignModelSingular,
|
|
53
|
-
type: dasherizedType,
|
|
54
|
-
propertyName: camelizedNamePlural,
|
|
55
|
-
};
|
|
56
|
-
} else if (/belongs-to/.test(dasherizedType)) {
|
|
57
|
-
includeBelongsTo = true;
|
|
58
|
-
attr = {
|
|
59
|
-
name: dasherizedForeignModel,
|
|
60
|
-
type: dasherizedType,
|
|
61
|
-
propertyName: camelizedName,
|
|
62
|
-
};
|
|
63
|
-
} else {
|
|
64
|
-
includeAttr = true;
|
|
65
|
-
attr = {
|
|
66
|
-
name: dasherizedName,
|
|
67
|
-
type: dasherizedType,
|
|
68
|
-
propertyName: camelizedName,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
attrs.push(attr);
|
|
72
|
-
|
|
73
|
-
if (/has-many|belongs-to/.test(dasherizedType)) {
|
|
74
|
-
needs.push("'model:" + dasherizedForeignModelSingular + "'");
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (attrs.length) {
|
|
79
|
-
let attrTransformer, attrSeparator;
|
|
8
|
+
async locals(options) {
|
|
9
|
+
const { generateModelSource } = await import('warp-drive/generators/model');
|
|
80
10
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
if (hasOctane) {
|
|
86
|
-
attrTransformer = nativeAttr;
|
|
87
|
-
attrSeparator = ';';
|
|
88
|
-
} else {
|
|
89
|
-
attrTransformer = classicAttr;
|
|
90
|
-
attrSeparator = ',';
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
attrs = attrs.map(attrTransformer);
|
|
94
|
-
attrs = ' ' + attrs.join(attrSeparator + EOL + ' ');
|
|
95
|
-
if (hasOctane) {
|
|
96
|
-
attrs = attrs + attrSeparator;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
let needsDeduplicated = needs.filter(function (need, i) {
|
|
101
|
-
return needs.indexOf(need) === i;
|
|
11
|
+
const entityOptions = options.entity.options;
|
|
12
|
+
const rawAttrs = Object.keys(entityOptions).map((name) => {
|
|
13
|
+
const type = entityOptions[name];
|
|
14
|
+
return type ? `${name}:${type}` : name;
|
|
102
15
|
});
|
|
103
|
-
needs = ' needs: [' + needsDeduplicated.join(', ') + ']';
|
|
104
|
-
|
|
105
|
-
let importedModules = [];
|
|
106
|
-
if (includeAttr) {
|
|
107
|
-
importedModules.push('attr');
|
|
108
|
-
}
|
|
109
|
-
if (includeBelongsTo) {
|
|
110
|
-
importedModules.push('belongsTo');
|
|
111
|
-
}
|
|
112
|
-
if (includeHasMany) {
|
|
113
|
-
importedModules.push('hasMany');
|
|
114
|
-
}
|
|
115
|
-
importedModules = importedModules.join(', ');
|
|
116
16
|
|
|
117
17
|
return {
|
|
118
|
-
|
|
119
|
-
attrs,
|
|
120
|
-
needs,
|
|
18
|
+
content: generateModelSource(options.entity.name, rawAttrs),
|
|
121
19
|
};
|
|
122
20
|
},
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function nativeAttr(attr) {
|
|
126
|
-
let name = attr.name,
|
|
127
|
-
type = attr.type,
|
|
128
|
-
propertyName = attr.propertyName,
|
|
129
|
-
result;
|
|
130
|
-
|
|
131
|
-
if (type === 'belongs-to') {
|
|
132
|
-
result = "@belongsTo('" + name + "', { async: false, inverse: null })";
|
|
133
|
-
} else if (type === 'has-many') {
|
|
134
|
-
result = "@hasMany('" + name + "', { async: false, inverse: null })";
|
|
135
|
-
} else if (type === '') {
|
|
136
|
-
result = '@attr';
|
|
137
|
-
} else {
|
|
138
|
-
result = "@attr('" + type + "')";
|
|
139
|
-
}
|
|
140
|
-
return result + ' ' + propertyName;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function classicAttr(attr) {
|
|
144
|
-
let name = attr.name,
|
|
145
|
-
type = attr.type,
|
|
146
|
-
propertyName = attr.propertyName,
|
|
147
|
-
result;
|
|
148
|
-
|
|
149
|
-
if (type === 'belongs-to') {
|
|
150
|
-
result = "belongsTo('" + name + "', { async: false, inverse: null })";
|
|
151
|
-
} else if (type === 'has-many') {
|
|
152
|
-
result = "hasMany('" + name + "', { async: false, inverse: null })";
|
|
153
|
-
} else if (type === '') {
|
|
154
|
-
//"If you don't specify the type of the attribute, it will be whatever was provided by the server"
|
|
155
|
-
//https://emberjs.com/guides/models/defining-models/
|
|
156
|
-
result = 'attr()';
|
|
157
|
-
} else {
|
|
158
|
-
result = "attr('" + type + "')";
|
|
159
|
-
}
|
|
160
|
-
return propertyName + ': ' + result;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
21
|
+
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
|
-
const testInfo = require('ember-cli-test-info');
|
|
4
|
-
const { dasherize } = require('ember-cli-string-utils');
|
|
5
|
-
|
|
6
|
-
const ModelBlueprint = require('../model');
|
|
7
|
-
|
|
8
3
|
module.exports = {
|
|
9
4
|
description: 'Generates an EmberData Model unit test',
|
|
10
|
-
supportsAddon() {
|
|
5
|
+
supportsAddon() {
|
|
6
|
+
return false;
|
|
7
|
+
},
|
|
11
8
|
|
|
12
9
|
root: __dirname,
|
|
13
10
|
|
|
@@ -22,18 +19,17 @@ module.exports = {
|
|
|
22
19
|
};
|
|
23
20
|
},
|
|
24
21
|
|
|
25
|
-
locals(options) {
|
|
26
|
-
const
|
|
22
|
+
async locals(options) {
|
|
23
|
+
const { generateUnitTestSource } = await import('warp-drive/generators/tests');
|
|
24
|
+
const { dasherize } = await import('warp-drive/generators/strings');
|
|
27
25
|
const modulePrefix = dasherize(options.project.config().modulePrefix);
|
|
26
|
+
|
|
28
27
|
return {
|
|
29
|
-
|
|
30
|
-
friendlyTestDescription: testInfo.description(options.entity.name, 'Unit', 'Model'),
|
|
31
|
-
modulePrefix,
|
|
28
|
+
content: generateUnitTestSource('Model', options.entity.name, modulePrefix),
|
|
32
29
|
};
|
|
33
30
|
},
|
|
34
31
|
|
|
35
32
|
filesPath() {
|
|
36
|
-
return path.join(__dirname, 'qunit-files')
|
|
37
|
-
}
|
|
33
|
+
return path.join(__dirname, 'qunit-files');
|
|
34
|
+
},
|
|
38
35
|
};
|
|
39
|
-
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { module, test } from 'qunit';
|
|
3
|
-
|
|
4
|
-
module('<%= friendlyTestDescription %>', function (hooks) {
|
|
5
|
-
setupTest(hooks);
|
|
6
|
-
|
|
7
|
-
// Replace this with your real tests.
|
|
8
|
-
test('it exists', function (assert) {
|
|
9
|
-
const store = this.owner.lookup('service:store');
|
|
10
|
-
const model = store.createRecord('<%= dasherizedModuleName %>', {});
|
|
11
|
-
assert.ok(model, 'model exists');
|
|
12
|
-
});
|
|
13
|
-
});
|
|
1
|
+
<%- content %>
|
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.27",
|
|
4
4
|
"description": "(Legacy) Ember implementation of a resource presentation layer for use with @ember-data/store",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -42,27 +42,21 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ember/edition-utils": "^1.2.0",
|
|
46
45
|
"@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.
|
|
50
|
-
"
|
|
51
|
-
"ember-cli-test-info": "^1.0.0",
|
|
52
|
-
"inflection": "~3.0.2"
|
|
46
|
+
"@warp-drive/core": "5.9.0-alpha.27",
|
|
47
|
+
"@warp-drive/legacy": "5.9.0-alpha.27",
|
|
48
|
+
"@warp-drive/utilities": "5.9.0-alpha.27",
|
|
49
|
+
"warp-drive": "0.2.0-alpha.70"
|
|
53
50
|
},
|
|
54
51
|
"devDependencies": {
|
|
55
52
|
"@babel/core": "^7.29.7",
|
|
56
53
|
"@babel/plugin-transform-typescript": "^7.29.7",
|
|
57
54
|
"@babel/preset-env": "^7.29.7",
|
|
58
55
|
"@babel/preset-typescript": "^7.29.7",
|
|
59
|
-
"@warp-drive/internal-config": "5.9.0-alpha.
|
|
60
|
-
"expect-type": "^1.
|
|
56
|
+
"@warp-drive/internal-config": "5.9.0-alpha.27",
|
|
57
|
+
"expect-type": "^1.4.0",
|
|
61
58
|
"tsdown": "^0.22.14",
|
|
62
|
-
"typescript": "
|
|
63
|
-
},
|
|
64
|
-
"volta": {
|
|
65
|
-
"extends": "../../package.json"
|
|
59
|
+
"typescript-7": "npm:typescript@7.1.0-dev.20260828.1"
|
|
66
60
|
},
|
|
67
61
|
"typesVersions": {
|
|
68
62
|
"*": {
|
|
@@ -72,8 +66,7 @@
|
|
|
72
66
|
}
|
|
73
67
|
},
|
|
74
68
|
"scripts": {
|
|
75
|
-
"
|
|
76
|
-
"check:types": "tsc --noEmit",
|
|
69
|
+
"check:types": "node ./node_modules/typescript-7/bin/tsc --noEmit",
|
|
77
70
|
"build:pkg": "node node_modules/tsdown/dist/run.mjs",
|
|
78
71
|
"sync": "echo \"syncing\"",
|
|
79
72
|
"start": "node node_modules/tsdown/dist/run.mjs --watch"
|
|
@@ -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
|
import model_default, { AsyncBelongsTo, AsyncHasMany, HasMany, ManyArray, attr, belongsTo, buildSchema, hasMany, instantiateRecord, modelFor, teardownRecord } from "@warp-drive/legacy/model";
|
|
6
6
|
export { type AsyncBelongsTo, type AsyncHasMany, type HasMany, type ManyArray, attr, belongsTo, buildSchema, model_default as default, hasMany, instantiateRecord, modelFor, teardownRecord };
|