@warp-drive-mirror/build-config 0.0.0-beta.7 → 4.13.0-alpha.1
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/addon-shim.cjs.map +1 -1
- package/dist/babel-macros.js +1 -1
- package/dist/babel-macros.js.map +1 -1
- package/dist/babel-plugin-transform-asserts.cjs.map +1 -1
- package/dist/babel-plugin-transform-deprecations.cjs +17 -3
- package/dist/babel-plugin-transform-deprecations.cjs.map +1 -1
- package/dist/babel-plugin-transform-features.cjs.map +1 -1
- package/dist/babel-plugin-transform-logging.cjs.map +1 -1
- package/dist/canary-features-BzGSGY5j.js.map +1 -1
- package/dist/cjs-set-config.cjs +672 -64
- package/dist/cjs-set-config.cjs.map +1 -1
- package/dist/debugging-BzogyWJo.js.map +1 -1
- package/dist/deprecations-BjnhZL6k.js +67 -0
- package/dist/deprecations-BjnhZL6k.js.map +1 -0
- package/dist/deprecations.js +1 -1
- package/dist/env.js.map +1 -1
- package/dist/index.js +672 -64
- package/dist/index.js.map +1 -1
- package/dist/macros.js.map +1 -1
- package/package.json +7 -7
- package/unstable-preview-types/-private/utils/deprecations.d.ts +3 -1
- package/unstable-preview-types/-private/utils/deprecations.d.ts.map +1 -1
- package/unstable-preview-types/deprecation-versions.d.ts +610 -50
- package/unstable-preview-types/deprecation-versions.d.ts.map +1 -1
- package/unstable-preview-types/deprecations.d.ts +20 -2
- package/unstable-preview-types/deprecations.d.ts.map +1 -1
- package/dist/deprecations-C0B5IT3G.js +0 -30
- package/dist/deprecations-C0B5IT3G.js.map +0 -1
package/dist/cjs-set-config.cjs
CHANGED
|
@@ -122,6 +122,621 @@ function getEnv() {
|
|
|
122
122
|
* @public
|
|
123
123
|
*/
|
|
124
124
|
const DEPRECATE_CATCH_ALL = '99.0';
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* **id: ember-data:rsvp-unresolved-async**
|
|
128
|
+
*
|
|
129
|
+
* Deprecates when a request promise did not resolve prior to the store tearing down.
|
|
130
|
+
*
|
|
131
|
+
* Note: in most cases even with the promise guard that is now being deprecated
|
|
132
|
+
* a test crash would still be encountered.
|
|
133
|
+
*
|
|
134
|
+
* To resolve: Tests or Fastboot instances which crash need to find triggers requests
|
|
135
|
+
* and properly await them before tearing down.
|
|
136
|
+
*
|
|
137
|
+
* @property DEPRECATE_RSVP_PROMISE
|
|
138
|
+
* @since 4.4
|
|
139
|
+
* @until 5.0
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
const DEPRECATE_RSVP_PROMISE = '4.4';
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* **id: ember-data:model-save-promise**
|
|
146
|
+
*
|
|
147
|
+
* Affects
|
|
148
|
+
* - model.save / store.saveRecord
|
|
149
|
+
* - model.reload
|
|
150
|
+
*
|
|
151
|
+
* Deprecates the promise-proxy returned by these methods in favor of
|
|
152
|
+
* a Promise return value.
|
|
153
|
+
*
|
|
154
|
+
* To resolve this deprecation, `await` or `.then` the return value
|
|
155
|
+
* before doing work with the result instead of accessing values via
|
|
156
|
+
* the proxy.
|
|
157
|
+
*
|
|
158
|
+
* To continue utilizing flags such as `isPending` in your templates
|
|
159
|
+
* consider using [ember-promise-helpers](https://github.com/fivetanley/ember-promise-helpers)
|
|
160
|
+
*
|
|
161
|
+
* @property DEPRECATE_SAVE_PROMISE_ACCESS
|
|
162
|
+
* @since 4.4
|
|
163
|
+
* @until 5.0
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
const DEPRECATE_SAVE_PROMISE_ACCESS = '4.4';
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* **id: ember-data:deprecate-snapshot-model-class-access**
|
|
170
|
+
*
|
|
171
|
+
* Deprecates accessing the factory class for a given resource type
|
|
172
|
+
* via properties on various classes.
|
|
173
|
+
*
|
|
174
|
+
* Guards
|
|
175
|
+
*
|
|
176
|
+
* - SnapshotRecordArray.type
|
|
177
|
+
* - Snapshot.type
|
|
178
|
+
* - RecordArray.type
|
|
179
|
+
*
|
|
180
|
+
* Use `store.modelFor(<resource-type>)` instead.
|
|
181
|
+
*
|
|
182
|
+
* @property DEPRECATE_SNAPSHOT_MODEL_CLASS_ACCESS
|
|
183
|
+
* @since 4.5
|
|
184
|
+
* @until 5.0
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
const DEPRECATE_SNAPSHOT_MODEL_CLASS_ACCESS = '4.5';
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* **id: ember-data:deprecate-store-find**
|
|
191
|
+
*
|
|
192
|
+
* Deprecates using `store.find` instead of `store.findRecord`. Typically
|
|
193
|
+
* `store.find` is a mistaken call that occurs when using implicit route behaviors
|
|
194
|
+
* in Ember which attempt to derive how to load data via parsing the route params
|
|
195
|
+
* for a route which does not implement a `model` hook.
|
|
196
|
+
*
|
|
197
|
+
* To resolve, use `store.findRecord`. This may require implementing an associated
|
|
198
|
+
* route's `model() {}` hook.
|
|
199
|
+
*
|
|
200
|
+
* @property DEPRECATE_STORE_FIND
|
|
201
|
+
* @since 4.5
|
|
202
|
+
* @until 5.0
|
|
203
|
+
* @public
|
|
204
|
+
*/
|
|
205
|
+
const DEPRECATE_STORE_FIND = '4.5';
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* **id: ember-data:deprecate-has-record-for-id**
|
|
209
|
+
*
|
|
210
|
+
* Deprecates `store.hasRecordForId(type, id)` in favor of `store.peekRecord({ type, id }) !== null`.
|
|
211
|
+
*
|
|
212
|
+
* Broadly speaking, while the ability to query for presence is important, a key distinction exists
|
|
213
|
+
* between these methods that make relying on `hasRecordForId` unsafe, as it may report `true` for a
|
|
214
|
+
* record which is not-yet loaded and un-peekable. `peekRecord` offers a safe mechanism by which to check
|
|
215
|
+
* for whether a record is present in a usable manner.
|
|
216
|
+
*
|
|
217
|
+
* @property DEPRECATE_HAS_RECORD
|
|
218
|
+
* @since 4.5
|
|
219
|
+
* @until 5.0
|
|
220
|
+
* @public
|
|
221
|
+
*/
|
|
222
|
+
const DEPRECATE_HAS_RECORD = '4.5';
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* **id: ember-data:deprecate-string-arg-schemas**
|
|
226
|
+
*
|
|
227
|
+
* Deprecates `schema.attributesDefinitionFor(type)` and
|
|
228
|
+
* `schema.relationshipsDefinitionFor(type)` in favor of
|
|
229
|
+
* a consistent object signature (`identifier | { type }`).
|
|
230
|
+
*
|
|
231
|
+
* To resolve change
|
|
232
|
+
*
|
|
233
|
+
* ```diff
|
|
234
|
+
* - store.getSchemaDefinitionService().attributesDefinitionFor('user')
|
|
235
|
+
* + store.getSchemaDefinitionService().attributesDefinitionFor({ type: 'user' })
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* @property DEPRECATE_STRING_ARG_SCHEMAS
|
|
239
|
+
* @since 4.5
|
|
240
|
+
* @until 5.0
|
|
241
|
+
* @public
|
|
242
|
+
*/
|
|
243
|
+
const DEPRECATE_STRING_ARG_SCHEMAS = '4.5';
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* **id: ember-data:deprecate-secret-adapter-fallback**
|
|
247
|
+
*
|
|
248
|
+
* Deprecates the secret `-json-api` fallback adapter in favor
|
|
249
|
+
* or an explicit "catch all" application adapter. In addition
|
|
250
|
+
* to this deprecation ensuring the user has explicitly chosen an
|
|
251
|
+
* adapter, this ensures that the user may choose to use no adapter
|
|
252
|
+
* at all.
|
|
253
|
+
*
|
|
254
|
+
* Simplest fix:
|
|
255
|
+
*
|
|
256
|
+
* *<project>/app/adapters/application.js*
|
|
257
|
+
* ```js
|
|
258
|
+
* export { default } from '@ember-data-mirror/adapter/json-api';
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @property DEPRECATE_JSON_API_FALLBACK
|
|
262
|
+
* @since 4.5
|
|
263
|
+
* @until 5.0
|
|
264
|
+
* @public
|
|
265
|
+
*/
|
|
266
|
+
const DEPRECATE_JSON_API_FALLBACK = '4.5';
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* **id: ember-data:deprecate-model-reopen**
|
|
270
|
+
*
|
|
271
|
+
* ----
|
|
272
|
+
*
|
|
273
|
+
* For properties known ahead of time, instead of
|
|
274
|
+
*
|
|
275
|
+
* ```ts
|
|
276
|
+
* class User extends Model { @attr firstName; }
|
|
277
|
+
*
|
|
278
|
+
* User.reopen({ lastName: attr() });
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* Extend `User` again or include it in the initial definition.
|
|
282
|
+
*
|
|
283
|
+
* ```ts
|
|
284
|
+
* class User extends Model { @attr firstName; @attr lastName }
|
|
285
|
+
* ```
|
|
286
|
+
*
|
|
287
|
+
* For properties generated dynamically, consider registering
|
|
288
|
+
* a `SchemaDefinitionService` with the store , as such services
|
|
289
|
+
* are capable of dynamically adjusting their schemas, and utilize
|
|
290
|
+
* the `instantiateRecord` hook to create a Proxy based class that
|
|
291
|
+
* can react to the changes in the schema.
|
|
292
|
+
*
|
|
293
|
+
*
|
|
294
|
+
* Use Foo extends Model to extend your class instead
|
|
295
|
+
*
|
|
296
|
+
*
|
|
297
|
+
*
|
|
298
|
+
*
|
|
299
|
+
* **id: ember-data:deprecate-model-reopenclass**
|
|
300
|
+
*
|
|
301
|
+
* ----
|
|
302
|
+
*
|
|
303
|
+
* Instead of reopenClass, define `static` properties with native class syntax
|
|
304
|
+
* or add them to the final object.
|
|
305
|
+
*
|
|
306
|
+
* ```ts
|
|
307
|
+
* // instead of
|
|
308
|
+
* User.reopenClass({ aStaticMethod() {} });
|
|
309
|
+
*
|
|
310
|
+
* // do this
|
|
311
|
+
* class User {
|
|
312
|
+
* static aStaticMethod() {}
|
|
313
|
+
* }
|
|
314
|
+
*
|
|
315
|
+
* // or do this
|
|
316
|
+
* User.aStaticMethod = function() {}
|
|
317
|
+
* ```
|
|
318
|
+
*
|
|
319
|
+
*
|
|
320
|
+
* @property DEPRECATE_MODEL_REOPEN
|
|
321
|
+
* @since 4.7
|
|
322
|
+
* @until 5.0
|
|
323
|
+
* @public
|
|
324
|
+
*/
|
|
325
|
+
const DEPRECATE_MODEL_REOPEN = '4.7';
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* **id: ember-data:deprecate-early-static**
|
|
329
|
+
*
|
|
330
|
+
* This deprecation triggers if static computed properties
|
|
331
|
+
* or methods are triggered without looking up the record
|
|
332
|
+
* via the store service's `modelFor` hook. Accessing this
|
|
333
|
+
* static information without looking up the model via the
|
|
334
|
+
* store most commonly occurs when
|
|
335
|
+
*
|
|
336
|
+
* - using ember-cli-mirage (to fix, refactor to not use its auto-discovery of ember-data models)
|
|
337
|
+
* - importing a model class and accessing its static information via the import
|
|
338
|
+
*
|
|
339
|
+
* Instead of
|
|
340
|
+
*
|
|
341
|
+
* ```js
|
|
342
|
+
* import User from 'my-app/models/user';
|
|
343
|
+
*
|
|
344
|
+
* const relationships = User.relationshipsByName;
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* Do *at least* this
|
|
348
|
+
*
|
|
349
|
+
* ```js
|
|
350
|
+
* const relationships = store.modelFor('user').relationshipsByName;
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* However, the much more future proof refactor is to not use `modelFor` at all but instead
|
|
354
|
+
* to utilize the schema service for this static information.
|
|
355
|
+
*
|
|
356
|
+
* ```js
|
|
357
|
+
* const relationships = store.getSchemaDefinitionService().relationshipsDefinitionFor({ type: 'user' });
|
|
358
|
+
* ```
|
|
359
|
+
*
|
|
360
|
+
*
|
|
361
|
+
* @property DEPRECATE_EARLY_STATIC
|
|
362
|
+
* @since 4.7
|
|
363
|
+
* @until 5.0
|
|
364
|
+
* @public
|
|
365
|
+
*/
|
|
366
|
+
const DEPRECATE_EARLY_STATIC = '4.7';
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* **id: ember-data:deprecate-errors-hash-to-array-helper**
|
|
370
|
+
* **id: ember-data:deprecate-errors-array-to-hash-helper**
|
|
371
|
+
* **id: ember-data:deprecate-normalize-modelname-helper**
|
|
372
|
+
*
|
|
373
|
+
* Deprecates `errorsHashToArray` `errorsArrayToHash` and `normalizeModelName`
|
|
374
|
+
*
|
|
375
|
+
* Users making use of these (already private) utilities can trivially copy them
|
|
376
|
+
* into their own codebase to continue using them, though we recommend refactoring
|
|
377
|
+
* to a more direct conversion into the expected errors format for the errors helpers.
|
|
378
|
+
*
|
|
379
|
+
* For refactoring normalizeModelName we also recommend following the guidance in
|
|
380
|
+
* [RFC#740 Deprecate Non-Strict Types](https://github.com/emberjs/rfcs/pull/740).
|
|
381
|
+
*
|
|
382
|
+
*
|
|
383
|
+
* @property DEPRECATE_HELPERS
|
|
384
|
+
* @since 4.7
|
|
385
|
+
* @until 5.0
|
|
386
|
+
* @public
|
|
387
|
+
*/
|
|
388
|
+
const DEPRECATE_HELPERS = '4.7';
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* **id: ember-data:deprecate-promise-many-array-behavior**
|
|
392
|
+
*
|
|
393
|
+
* [RFC Documentation](https://rfcs.emberjs.com/id/0745-ember-data-deprecate-methods-on-promise-many-array)
|
|
394
|
+
*
|
|
395
|
+
* This deprecation deprecates accessing values on the asynchronous proxy
|
|
396
|
+
* in favor of first "resolving" or "awaiting" the promise to retrieve a
|
|
397
|
+
* synchronous value.
|
|
398
|
+
*
|
|
399
|
+
* Template iteration of the asynchronous value will still work and not trigger
|
|
400
|
+
* the deprecation, but all JS access should be avoided and HBS access for anything
|
|
401
|
+
* but `{{#each}}` should also be refactored.
|
|
402
|
+
*
|
|
403
|
+
* Recommended approaches include using the addon `ember-promise-helpers`, using
|
|
404
|
+
* Ember's `resource` pattern (including potentially the addon `ember-data-resources`),
|
|
405
|
+
* resolving the value in routes/provider components, or using the references API.
|
|
406
|
+
*
|
|
407
|
+
* An example of using the [hasMany](https://api.emberjs.com/ember-data/4.11/classes/Model/methods/hasMany?anchor=hasMany) [reference API](https://api.emberjs.com/ember-data/release/classes/HasManyReference):
|
|
408
|
+
*
|
|
409
|
+
* ```ts
|
|
410
|
+
* // get the synchronous "ManyArray" value for the asynchronous "friends" relationship.
|
|
411
|
+
* // note, this will return `null` if the relationship has not been loaded yet
|
|
412
|
+
* const value = person.hasMany('friends').value();
|
|
413
|
+
*
|
|
414
|
+
* // to get just the list of related IDs
|
|
415
|
+
* const ids = person.hasMany('friends').ids();
|
|
416
|
+
* ```
|
|
417
|
+
*
|
|
418
|
+
* References participate in autotracking and getters/cached getters etc. which consume them
|
|
419
|
+
* will recompute if the value changes.
|
|
420
|
+
*
|
|
421
|
+
* @property DEPRECATE_PROMISE_MANY_ARRAY_BEHAVIORS
|
|
422
|
+
* @since 4.7
|
|
423
|
+
* @until 5.0
|
|
424
|
+
* @public
|
|
425
|
+
*/
|
|
426
|
+
const DEPRECATE_PROMISE_MANY_ARRAY_BEHAVIORS = '4.7';
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* **id: ember-data:deprecate-non-strict-relationships**
|
|
430
|
+
*
|
|
431
|
+
* Deprecates when belongsTo and hasMany relationships are defined
|
|
432
|
+
* without specifying the inverse record's type.
|
|
433
|
+
*
|
|
434
|
+
* Instead of
|
|
435
|
+
*
|
|
436
|
+
* ```ts
|
|
437
|
+
* class Company extends Model {
|
|
438
|
+
* @hasMany() employees;
|
|
439
|
+
* }
|
|
440
|
+
* class Employee extends Model {
|
|
441
|
+
* @belongsTo() company;
|
|
442
|
+
* }
|
|
443
|
+
* ```
|
|
444
|
+
*
|
|
445
|
+
* Use
|
|
446
|
+
*
|
|
447
|
+
* ```ts
|
|
448
|
+
* class Company extends Model {
|
|
449
|
+
* @hasMany('employee', { async: true, inverse: 'company' }) employees;
|
|
450
|
+
* }
|
|
451
|
+
*
|
|
452
|
+
* class Employee extends Model {
|
|
453
|
+
* @belongsTo('company', { async: true, inverse: 'employees' }) company;
|
|
454
|
+
* }
|
|
455
|
+
* ```
|
|
456
|
+
*
|
|
457
|
+
* @property DEPRECATE_RELATIONSHIPS_WITHOUT_TYPE
|
|
458
|
+
* @since 4.7
|
|
459
|
+
* @until 5.0
|
|
460
|
+
* @public
|
|
461
|
+
*/
|
|
462
|
+
const DEPRECATE_RELATIONSHIPS_WITHOUT_TYPE = '4.7';
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* **id: ember-data:deprecate-non-strict-relationships**
|
|
466
|
+
*
|
|
467
|
+
* Deprecates when belongsTo and hasMany relationships are defined
|
|
468
|
+
* without specifying whether the relationship is asynchronous.
|
|
469
|
+
*
|
|
470
|
+
* The current behavior is that relationships which do not define
|
|
471
|
+
* this setting are aschronous (`{ async: true }`).
|
|
472
|
+
*
|
|
473
|
+
* Instead of
|
|
474
|
+
*
|
|
475
|
+
* ```ts
|
|
476
|
+
* class Company extends Model {
|
|
477
|
+
* @hasMany('employee') employees;
|
|
478
|
+
* }
|
|
479
|
+
* class Employee extends Model {
|
|
480
|
+
* @belongsTo('company') company;
|
|
481
|
+
* }
|
|
482
|
+
* ```
|
|
483
|
+
*
|
|
484
|
+
* Use
|
|
485
|
+
*
|
|
486
|
+
* ```ts
|
|
487
|
+
* class Company extends Model {
|
|
488
|
+
* @hasMany('employee', { async: true, inverse: 'company' }) employees;
|
|
489
|
+
* }
|
|
490
|
+
*
|
|
491
|
+
* class Employee extends Model {
|
|
492
|
+
* @belongsTo('company', { async: true, inverse: 'employees' }) company;
|
|
493
|
+
* }
|
|
494
|
+
* ```
|
|
495
|
+
*
|
|
496
|
+
* @property DEPRECATE_RELATIONSHIPS_WITHOUT_ASYNC
|
|
497
|
+
* @since 4.7
|
|
498
|
+
* @until 5.0
|
|
499
|
+
* @public
|
|
500
|
+
*/
|
|
501
|
+
const DEPRECATE_RELATIONSHIPS_WITHOUT_ASYNC = '4.7';
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* **id: ember-data:deprecate-non-strict-relationships**
|
|
505
|
+
*
|
|
506
|
+
* Deprecates when belongsTo and hasMany relationships are defined
|
|
507
|
+
* without specifying the inverse field on the related type.
|
|
508
|
+
*
|
|
509
|
+
* The current behavior is that relationships which do not define
|
|
510
|
+
* this setting have their inverse determined at runtime, which is
|
|
511
|
+
* potentially non-deterministic when mixins and polymorphism are involved.
|
|
512
|
+
*
|
|
513
|
+
* If an inverse relationship exists and you wish changes on one side to
|
|
514
|
+
* reflect onto the other side, use the inverse key. If you wish to not have
|
|
515
|
+
* changes reflected or no inverse relationship exists, specify `inverse: null`.
|
|
516
|
+
*
|
|
517
|
+
* Instead of
|
|
518
|
+
*
|
|
519
|
+
* ```ts
|
|
520
|
+
* class Company extends Model {
|
|
521
|
+
* @hasMany('employee') employees;
|
|
522
|
+
* }
|
|
523
|
+
* class Employee extends Model {
|
|
524
|
+
* @belongsTo('company') company;
|
|
525
|
+
* }
|
|
526
|
+
* ```
|
|
527
|
+
*
|
|
528
|
+
* Use
|
|
529
|
+
*
|
|
530
|
+
* ```ts
|
|
531
|
+
* class Company extends Model {
|
|
532
|
+
* @hasMany('employee', { async: true, inverse: 'company' }) employees;
|
|
533
|
+
* }
|
|
534
|
+
*
|
|
535
|
+
* class Employee extends Model {
|
|
536
|
+
* @belongsTo('company', { async: true, inverse: 'employees' }) company;
|
|
537
|
+
* }
|
|
538
|
+
* ```
|
|
539
|
+
*
|
|
540
|
+
* Instead of
|
|
541
|
+
*
|
|
542
|
+
* ```ts
|
|
543
|
+
* class Company extends Model {
|
|
544
|
+
* @hasMany('employee') employees;
|
|
545
|
+
* }
|
|
546
|
+
* class Employee extends Model {
|
|
547
|
+
* @attr name;
|
|
548
|
+
* }
|
|
549
|
+
* ```
|
|
550
|
+
*
|
|
551
|
+
* Use
|
|
552
|
+
*
|
|
553
|
+
* ```ts
|
|
554
|
+
* class Company extends Model {
|
|
555
|
+
* @hasMany('employee', { async: true, inverse: null }) employees;
|
|
556
|
+
* }
|
|
557
|
+
*
|
|
558
|
+
* class Employee extends Model {
|
|
559
|
+
* @attr name;
|
|
560
|
+
* }
|
|
561
|
+
* ```
|
|
562
|
+
*
|
|
563
|
+
* @property DEPRECATE_RELATIONSHIPS_WITHOUT_INVERSE
|
|
564
|
+
* @since 4.7
|
|
565
|
+
* @until 5.0
|
|
566
|
+
* @public
|
|
567
|
+
*/
|
|
568
|
+
const DEPRECATE_RELATIONSHIPS_WITHOUT_INVERSE = '4.7';
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* **id: ember-data:no-a-with-array-like**
|
|
572
|
+
*
|
|
573
|
+
* Deprecates when calling `A()` on an EmberData ArrayLike class
|
|
574
|
+
* is detected. This deprecation may not always trigger due to complexities
|
|
575
|
+
* in ember-source versions and the use (or disabling) of prototype extensions.
|
|
576
|
+
*
|
|
577
|
+
* To fix, just use the native array methods instead of the EmberArray methods
|
|
578
|
+
* and refrain from wrapping the array in `A()`.
|
|
579
|
+
*
|
|
580
|
+
* Note that some computed property macros may themselves utilize `A()`, in which
|
|
581
|
+
* scenario the computed properties need to be upgraded to octane syntax.
|
|
582
|
+
*
|
|
583
|
+
* For instance, instead of:
|
|
584
|
+
*
|
|
585
|
+
* ```ts
|
|
586
|
+
* class extends Component {
|
|
587
|
+
* @filterBy('items', 'isComplete') completedItems;
|
|
588
|
+
* }
|
|
589
|
+
* ```
|
|
590
|
+
*
|
|
591
|
+
* Use the following:
|
|
592
|
+
*
|
|
593
|
+
* ```ts
|
|
594
|
+
* class extends Component {
|
|
595
|
+
* get completedItems() {
|
|
596
|
+
* return this.items.filter(item => item.isComplete);
|
|
597
|
+
* }
|
|
598
|
+
* }
|
|
599
|
+
* ```
|
|
600
|
+
*
|
|
601
|
+
* @property DEPRECATE_A_USAGE
|
|
602
|
+
* @since 4.7
|
|
603
|
+
* @until 5.0
|
|
604
|
+
* @public
|
|
605
|
+
*/
|
|
606
|
+
const DEPRECATE_A_USAGE = '4.7';
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* **id: ember-data:deprecate-promise-proxies**
|
|
610
|
+
*
|
|
611
|
+
* Additional Reading: [RFC#846 Deprecate Proxies](https://rfcs.emberjs.com/id/0846-ember-data-deprecate-proxies)
|
|
612
|
+
*
|
|
613
|
+
* Deprecates using the proxy object/proxy array capabilities of values returned from
|
|
614
|
+
*
|
|
615
|
+
* - `store.findRecord`
|
|
616
|
+
* - `store.findAll`
|
|
617
|
+
* - `store.query`
|
|
618
|
+
* - `store.queryRecord`
|
|
619
|
+
* - `record.save`
|
|
620
|
+
* - `recordArray.save`
|
|
621
|
+
* - `recordArray.update`
|
|
622
|
+
*
|
|
623
|
+
* These methods will now return a native Promise that resolves with the value.
|
|
624
|
+
*
|
|
625
|
+
* Note that this does not deprecate the proxy behaviors of `PromiseBelongsTo`. See RFC for reasoning.
|
|
626
|
+
* The opportunity should still be taken if available to stop using these proxy behaviors; however, this class
|
|
627
|
+
* will remain until `import Model from '@ember-data-mirror/model';` is deprecated more broadly.
|
|
628
|
+
*
|
|
629
|
+
* @property DEPRECATE_PROMISE_PROXIES
|
|
630
|
+
* @since 4.7
|
|
631
|
+
* @until 5.0
|
|
632
|
+
* @public
|
|
633
|
+
*/
|
|
634
|
+
const DEPRECATE_PROMISE_PROXIES = '4.7';
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* **id: ember-data:deprecate-array-like**
|
|
638
|
+
*
|
|
639
|
+
* Deprecates Ember "Array-like" methods on RecordArray and ManyArray.
|
|
640
|
+
*
|
|
641
|
+
* These are the arrays returned respectively by `store.peekAll()`, `store.findAll()`and
|
|
642
|
+
* hasMany relationships on instance of Model or `record.hasMany('relationshipName').value()`.
|
|
643
|
+
*
|
|
644
|
+
* The appropriate refactor is to treat these arrays as native arrays and to use native array methods.
|
|
645
|
+
*
|
|
646
|
+
* For instance, instead of:
|
|
647
|
+
*
|
|
648
|
+
* ```ts
|
|
649
|
+
* users.firstObject;
|
|
650
|
+
* ```
|
|
651
|
+
*
|
|
652
|
+
* Use:
|
|
653
|
+
*
|
|
654
|
+
* ```ts
|
|
655
|
+
* users[0];
|
|
656
|
+
* // or
|
|
657
|
+
* users.at(0);
|
|
658
|
+
* ```
|
|
659
|
+
*
|
|
660
|
+
* @property DEPRECATE_ARRAY_LIKE
|
|
661
|
+
* @since 4.7
|
|
662
|
+
* @until 5.0
|
|
663
|
+
* @public
|
|
664
|
+
*/
|
|
665
|
+
const DEPRECATE_ARRAY_LIKE = '4.7';
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* **id: <none yet assigned>**
|
|
669
|
+
*
|
|
670
|
+
* This is a planned deprecation which will trigger when observer or computed
|
|
671
|
+
* chains are used to watch for changes on any EmberData RecordArray, ManyArray
|
|
672
|
+
* or PromiseManyArray.
|
|
673
|
+
*
|
|
674
|
+
* Support for these chains is currently guarded by the inactive deprecation flag
|
|
675
|
+
* listed here.
|
|
676
|
+
*
|
|
677
|
+
* @property DEPRECATE_COMPUTED_CHAINS
|
|
678
|
+
* @since 5.0
|
|
679
|
+
* @until 6.0
|
|
680
|
+
* @public
|
|
681
|
+
*/
|
|
682
|
+
const DEPRECATE_COMPUTED_CHAINS = '5.0';
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* **id: ember-data:non-explicit-relationships**
|
|
686
|
+
*
|
|
687
|
+
* Deprecates when polymorphic relationships are detected via inheritance or mixins
|
|
688
|
+
* and no polymorphic relationship configuration has been setup.
|
|
689
|
+
*
|
|
690
|
+
* For further reading please review [RFC#793](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
|
|
691
|
+
* which introduced support for explicit relationship polymorphism without
|
|
692
|
+
* mixins or inheritance.
|
|
693
|
+
*
|
|
694
|
+
* You may still use mixins and inheritance to setup your polymorphism; however, the class
|
|
695
|
+
* structure is no longer what drives the design. Instead polymorphism is "traits" based or "structural":
|
|
696
|
+
* so long as each model which can satisfy the polymorphic relationship defines the inverse in the same
|
|
697
|
+
* way they work.
|
|
698
|
+
*
|
|
699
|
+
* Notably: `inverse: null` relationships can receive any type as a record with no additional configuration
|
|
700
|
+
* at all.
|
|
701
|
+
*
|
|
702
|
+
* Example Polymorphic Relationship Configuration
|
|
703
|
+
*
|
|
704
|
+
* ```ts
|
|
705
|
+
* // polymorphic relationship
|
|
706
|
+
* class Tag extends Model {
|
|
707
|
+
* @hasMany("taggable", { async: false, polymorphic: true, inverse: "tags" }) tagged;
|
|
708
|
+
* }
|
|
709
|
+
*
|
|
710
|
+
* // an inverse concrete relationship (e.g. satisfies "taggable")
|
|
711
|
+
* class Post extends Model {
|
|
712
|
+
* @hasMany("tag", { async: false, inverse: "tagged", as: "taggable" }) tags;
|
|
713
|
+
* }
|
|
714
|
+
* ```
|
|
715
|
+
*
|
|
716
|
+
* @property DEPRECATE_NON_EXPLICIT_POLYMORPHISM
|
|
717
|
+
* @since 4.7
|
|
718
|
+
* @until 5.0
|
|
719
|
+
* @public
|
|
720
|
+
*/
|
|
721
|
+
const DEPRECATE_NON_EXPLICIT_POLYMORPHISM = '4.7';
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* **id: ember-data:deprecate-many-array-duplicates**
|
|
725
|
+
*
|
|
726
|
+
* When the flag is `true` (default), adding duplicate records to a `ManyArray`
|
|
727
|
+
* is deprecated in non-production environments. In production environments,
|
|
728
|
+
* duplicate records added to a `ManyArray` will be deduped and no error will
|
|
729
|
+
* be thrown.
|
|
730
|
+
*
|
|
731
|
+
* When the flag is `false`, an error will be thrown when duplicates are added.
|
|
732
|
+
*
|
|
733
|
+
* @property DEPRECATE_MANY_ARRAY_DUPLICATES
|
|
734
|
+
* @since 5.3
|
|
735
|
+
* @until 6.0
|
|
736
|
+
* @public
|
|
737
|
+
*/
|
|
738
|
+
const DEPRECATE_MANY_ARRAY_DUPLICATES = '4.12'; // '5.3';
|
|
739
|
+
|
|
125
740
|
/**
|
|
126
741
|
* **id: ember-data:deprecate-non-strict-types**
|
|
127
742
|
*
|
|
@@ -180,42 +795,6 @@ const DEPRECATE_NON_STRICT_TYPES = '5.3';
|
|
|
180
795
|
*/
|
|
181
796
|
const DEPRECATE_NON_STRICT_ID = '5.3';
|
|
182
797
|
|
|
183
|
-
/**
|
|
184
|
-
* **id: <none yet assigned>**
|
|
185
|
-
*
|
|
186
|
-
* This is a planned deprecation which will trigger when observer or computed
|
|
187
|
-
* chains are used to watch for changes on any EmberData LiveArray, CollectionRecordArray,
|
|
188
|
-
* ManyArray or PromiseManyArray.
|
|
189
|
-
*
|
|
190
|
-
* Support for these chains is currently guarded by the deprecation flag
|
|
191
|
-
* listed here, enabling removal of the behavior if desired.
|
|
192
|
-
*
|
|
193
|
-
* @property DEPRECATE_COMPUTED_CHAINS
|
|
194
|
-
* @since 5.0
|
|
195
|
-
* @until 6.0
|
|
196
|
-
* @public
|
|
197
|
-
*/
|
|
198
|
-
const DEPRECATE_COMPUTED_CHAINS = '5.0';
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* **id: ember-data:deprecate-legacy-imports**
|
|
202
|
-
*
|
|
203
|
-
* Deprecates when importing from `ember-data/*` instead of `@ember-data/*`
|
|
204
|
-
* in order to prepare for the eventual removal of the legacy `ember-data/*`
|
|
205
|
-
*
|
|
206
|
-
* All imports from `ember-data/*` should be updated to `@ember-data/*`
|
|
207
|
-
* except for `ember-data/store`. When you are using `ember-data` (as opposed to
|
|
208
|
-
* installing the indivudal packages) you should import from `ember-data/store`
|
|
209
|
-
* instead of `@ember-data-mirror/store` in order to receive the appropriate configuration
|
|
210
|
-
* of defaults.
|
|
211
|
-
*
|
|
212
|
-
* @property DEPRECATE_LEGACY_IMPORTS
|
|
213
|
-
* @since 5.3
|
|
214
|
-
* @until 6.0
|
|
215
|
-
* @public
|
|
216
|
-
*/
|
|
217
|
-
const DEPRECATE_LEGACY_IMPORTS = '5.3';
|
|
218
|
-
|
|
219
798
|
/**
|
|
220
799
|
* **id: ember-data:deprecate-non-unique-collection-payloads**
|
|
221
800
|
*
|
|
@@ -406,23 +985,6 @@ const DEPRECATE_NON_UNIQUE_PAYLOADS = '5.3';
|
|
|
406
985
|
*/
|
|
407
986
|
const DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE = '5.3';
|
|
408
987
|
|
|
409
|
-
/**
|
|
410
|
-
* **id: ember-data:deprecate-many-array-duplicates**
|
|
411
|
-
*
|
|
412
|
-
* When the flag is `true` (default), adding duplicate records to a `ManyArray`
|
|
413
|
-
* is deprecated in non-production environments. In production environments,
|
|
414
|
-
* duplicate records added to a `ManyArray` will be deduped and no error will
|
|
415
|
-
* be thrown.
|
|
416
|
-
*
|
|
417
|
-
* When the flag is `false`, an error will be thrown when duplicates are added.
|
|
418
|
-
*
|
|
419
|
-
* @property DEPRECATE_MANY_ARRAY_DUPLICATES
|
|
420
|
-
* @since 5.3
|
|
421
|
-
* @until 6.0
|
|
422
|
-
* @public
|
|
423
|
-
*/
|
|
424
|
-
const DEPRECATE_MANY_ARRAY_DUPLICATES = '5.3';
|
|
425
|
-
|
|
426
988
|
/**
|
|
427
989
|
* **id: ember-data:deprecate-store-extends-ember-object**
|
|
428
990
|
*
|
|
@@ -494,44 +1056,90 @@ const ENABLE_LEGACY_SCHEMA_SERVICE = '5.4';
|
|
|
494
1056
|
*/
|
|
495
1057
|
const DEPRECATE_EMBER_INFLECTOR = '5.3';
|
|
496
1058
|
|
|
1059
|
+
/**
|
|
1060
|
+
* This is a special flag that can be used to opt-in early to receiving deprecations introduced in 5.x
|
|
1061
|
+
* which have had their infra backported to 4.x versions of EmberData.
|
|
1062
|
+
*
|
|
1063
|
+
* When this flag is not present or set to `true`, the deprecations from the 5.x branch
|
|
1064
|
+
* will not print their messages and the deprecation cannot be resolved.
|
|
1065
|
+
*
|
|
1066
|
+
* When this flag is present and set to `false`, the deprecations from the 5.x branch will
|
|
1067
|
+
* print and can be resolved.
|
|
1068
|
+
*
|
|
1069
|
+
* @property DISABLE_6X_DEPRECATIONS
|
|
1070
|
+
* @since 4.13
|
|
1071
|
+
* @until 5.0
|
|
1072
|
+
* @public
|
|
1073
|
+
*/
|
|
1074
|
+
const DISABLE_6X_DEPRECATIONS = '6.0';
|
|
1075
|
+
|
|
497
1076
|
const CURRENT_DEPRECATIONS = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
498
1077
|
__proto__: null,
|
|
1078
|
+
DEPRECATE_ARRAY_LIKE,
|
|
1079
|
+
DEPRECATE_A_USAGE,
|
|
499
1080
|
DEPRECATE_CATCH_ALL,
|
|
500
1081
|
DEPRECATE_COMPUTED_CHAINS,
|
|
1082
|
+
DEPRECATE_EARLY_STATIC,
|
|
501
1083
|
DEPRECATE_EMBER_INFLECTOR,
|
|
502
|
-
|
|
1084
|
+
DEPRECATE_HAS_RECORD,
|
|
1085
|
+
DEPRECATE_HELPERS,
|
|
1086
|
+
DEPRECATE_JSON_API_FALLBACK,
|
|
503
1087
|
DEPRECATE_MANY_ARRAY_DUPLICATES,
|
|
1088
|
+
DEPRECATE_MODEL_REOPEN,
|
|
1089
|
+
DEPRECATE_NON_EXPLICIT_POLYMORPHISM,
|
|
504
1090
|
DEPRECATE_NON_STRICT_ID,
|
|
505
1091
|
DEPRECATE_NON_STRICT_TYPES,
|
|
506
1092
|
DEPRECATE_NON_UNIQUE_PAYLOADS,
|
|
1093
|
+
DEPRECATE_PROMISE_MANY_ARRAY_BEHAVIORS,
|
|
1094
|
+
DEPRECATE_PROMISE_PROXIES,
|
|
1095
|
+
DEPRECATE_RELATIONSHIPS_WITHOUT_ASYNC,
|
|
1096
|
+
DEPRECATE_RELATIONSHIPS_WITHOUT_INVERSE,
|
|
1097
|
+
DEPRECATE_RELATIONSHIPS_WITHOUT_TYPE,
|
|
507
1098
|
DEPRECATE_RELATIONSHIP_REMOTE_UPDATE_CLEARING_LOCAL_STATE,
|
|
1099
|
+
DEPRECATE_RSVP_PROMISE,
|
|
1100
|
+
DEPRECATE_SAVE_PROMISE_ACCESS,
|
|
1101
|
+
DEPRECATE_SNAPSHOT_MODEL_CLASS_ACCESS,
|
|
508
1102
|
DEPRECATE_STORE_EXTENDS_EMBER_OBJECT,
|
|
1103
|
+
DEPRECATE_STORE_FIND,
|
|
1104
|
+
DEPRECATE_STRING_ARG_SCHEMAS,
|
|
1105
|
+
DISABLE_6X_DEPRECATIONS,
|
|
509
1106
|
ENABLE_LEGACY_SCHEMA_SERVICE
|
|
510
1107
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
511
1108
|
|
|
512
1109
|
function deprecationIsResolved(deprecatedSince, compatVersion) {
|
|
513
1110
|
return semver.lte(semver.minVersion(deprecatedSince), semver.minVersion(compatVersion));
|
|
514
1111
|
}
|
|
515
|
-
|
|
1112
|
+
const NextMajorVersion = '5.';
|
|
1113
|
+
function deprecationIsNextMajorCycle(deprecatedSince) {
|
|
1114
|
+
return deprecatedSince.startsWith(NextMajorVersion);
|
|
1115
|
+
}
|
|
1116
|
+
function getDeprecations(compatVersion, deprecations) {
|
|
516
1117
|
const flags = {};
|
|
517
1118
|
const keys = Object.keys(CURRENT_DEPRECATIONS);
|
|
1119
|
+
const DISABLE_6X_DEPRECATIONS = deprecations?.DISABLE_6X_DEPRECATIONS ?? true;
|
|
518
1120
|
keys.forEach(flag => {
|
|
519
1121
|
const deprecatedSince = CURRENT_DEPRECATIONS[flag];
|
|
1122
|
+
const isDeactivatedDeprecationNotice = DISABLE_6X_DEPRECATIONS && deprecationIsNextMajorCycle(deprecatedSince);
|
|
520
1123
|
let flagState = true; // default to no code-stripping
|
|
521
1124
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
1125
|
+
if (!isDeactivatedDeprecationNotice) {
|
|
1126
|
+
// if we have a specific flag setting, use it
|
|
1127
|
+
if (typeof deprecations?.[flag] === 'boolean') {
|
|
1128
|
+
flagState = deprecations?.[flag];
|
|
1129
|
+
} else if (compatVersion) {
|
|
1130
|
+
// if we are told we are compatible with a version
|
|
1131
|
+
// we check if we can strip this flag
|
|
1132
|
+
const isResolved = deprecationIsResolved(deprecatedSince, compatVersion);
|
|
1133
|
+
// if we've resolved, we strip (by setting the flag to false)
|
|
1134
|
+
/*
|
|
528
1135
|
if (DEPRECATED_FEATURE) {
|
|
529
1136
|
// deprecated code path
|
|
530
1137
|
} else {
|
|
531
1138
|
// if needed a non-deprecated code path
|
|
532
1139
|
}
|
|
533
|
-
|
|
534
|
-
|
|
1140
|
+
*/
|
|
1141
|
+
flagState = !isResolved;
|
|
1142
|
+
}
|
|
535
1143
|
}
|
|
536
1144
|
|
|
537
1145
|
// console.log(`${flag}=${flagState} (${deprecatedSince} <= ${compatVersion})`);
|
|
@@ -846,7 +1454,7 @@ function setConfig(context, appRoot, config) {
|
|
|
846
1454
|
|
|
847
1455
|
const debugOptions = Object.assign({}, LOGGING, config.debug);
|
|
848
1456
|
const env = getEnv();
|
|
849
|
-
const DEPRECATIONS = getDeprecations(config.compatWith || null);
|
|
1457
|
+
const DEPRECATIONS = getDeprecations(config.compatWith || null, config.deprecations);
|
|
850
1458
|
const FEATURES = getFeatures(env.PRODUCTION);
|
|
851
1459
|
const includeDataAdapterInProduction = typeof config.includeDataAdapterInProduction === 'boolean' ? config.includeDataAdapterInProduction : true;
|
|
852
1460
|
const includeDataAdapter = env.PRODUCTION ? includeDataAdapterInProduction : true;
|