@warp-drive/legacy 5.7.0-alpha.0 → 5.7.0-alpha.10
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/declarations/adapter/error.d.ts +2 -2
- package/declarations/compat/builders/find-all.d.ts +2 -2
- package/declarations/compat/builders/query.d.ts +2 -2
- package/declarations/model/-private/model-methods.d.ts +3 -0
- package/declarations/model/-private/model.d.ts +3 -0
- package/declarations/model/-private.d.ts +1 -0
- package/declarations/model/migration-support.d.ts +2 -20
- package/declarations/model.d.ts +1 -1
- package/declarations/store/-private.d.ts +235 -0
- package/declarations/store.d.ts +3 -0
- package/dist/adapter/error.js +66 -0
- package/dist/adapter/rest.js +1 -1
- package/dist/compat/builders.js +1 -21
- package/dist/model/migration-support.js +90 -8
- package/dist/model.js +3 -2
- package/dist/{schema-provider-BdQhkT-Q.js → schema-provider-Cbnf6sKm.js} +104 -35
- package/dist/store.js +631 -0
- package/dist/util-Dul6TZts.js +35 -0
- package/dist/utils-Cqw9eRj5.js +23 -0
- package/package.json +6 -6
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { deprecate } from '@ember/debug';
|
|
1
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
2
3
|
import { notifyInternalSignal, ARRAY_SIGNAL } from '@warp-drive/core/store/-private';
|
|
3
4
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
4
5
|
import { Type } from '@warp-drive/core/types/symbols';
|
|
5
6
|
import { l as lookupLegacySupport, E as Errors } from "../errors-BX5wowuz.js";
|
|
6
|
-
import { b as buildSchema, u as unloadRecord, s as serialize, a as save, r as rollbackAttributes, c as reload, h as hasMany,
|
|
7
|
+
import { b as buildSchema, u as unloadRecord, s as serialize, _ as _save, a as save, r as rollbackAttributes, c as _reload, d as reload, h as hasMany, e as _destroyRecord, f as destroyRecord, g as deleteRecord, R as RecordState, i as changedAttributes, j as belongsTo, k as createSnapshot } from "../schema-provider-Cbnf6sKm.js";
|
|
7
8
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -25,7 +26,6 @@ import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
|
25
26
|
*
|
|
26
27
|
* @module
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
29
|
// 'isDestroying', 'isDestroyed'
|
|
30
30
|
const LegacyFields = ['_createSnapshot', 'adapterError', 'belongsTo', 'changedAttributes', 'constructor', 'currentState', 'deleteRecord', 'destroyRecord', 'dirtyType', 'errors', 'hasDirtyAttributes', 'hasMany', 'isDeleted', 'isEmpty', 'isError', 'isLoaded', 'isLoading', 'isNew', 'isSaving', 'isValid', 'reload', 'rollbackAttributes', 'save', 'serialize', 'unloadRecord'];
|
|
31
31
|
|
|
@@ -78,10 +78,13 @@ function legacySupport(record, options, prop) {
|
|
|
78
78
|
state = {};
|
|
79
79
|
LegacySupport.set(record, state);
|
|
80
80
|
}
|
|
81
|
+
const suppressDeprecation = Boolean(options && options.suppressDeprecation);
|
|
81
82
|
switch (prop) {
|
|
82
83
|
case '_createSnapshot':
|
|
84
|
+
// FIXME should be deprecated too?
|
|
83
85
|
return createSnapshot;
|
|
84
86
|
case 'adapterError':
|
|
87
|
+
// FIXME should be deprecated too?
|
|
85
88
|
return record.currentState.adapterError;
|
|
86
89
|
case 'belongsTo':
|
|
87
90
|
return belongsTo;
|
|
@@ -98,10 +101,11 @@ function legacySupport(record, options, prop) {
|
|
|
98
101
|
case 'deleteRecord':
|
|
99
102
|
return deleteRecord;
|
|
100
103
|
case 'destroyRecord':
|
|
101
|
-
return destroyRecord;
|
|
104
|
+
return suppressDeprecation ? _destroyRecord : destroyRecord;
|
|
102
105
|
case 'dirtyType':
|
|
103
106
|
return record.currentState.dirtyType;
|
|
104
107
|
case 'errors':
|
|
108
|
+
// FIXME should be deprecated too?
|
|
105
109
|
// @ts-expect-error
|
|
106
110
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
107
111
|
return state.errors = state.errors || Errors.create({
|
|
@@ -128,12 +132,13 @@ function legacySupport(record, options, prop) {
|
|
|
128
132
|
case 'isValid':
|
|
129
133
|
return record.currentState.isValid;
|
|
130
134
|
case 'reload':
|
|
131
|
-
return reload;
|
|
135
|
+
return suppressDeprecation ? _reload : reload;
|
|
132
136
|
case 'rollbackAttributes':
|
|
133
137
|
return rollbackAttributes;
|
|
134
138
|
case 'save':
|
|
135
|
-
return save;
|
|
139
|
+
return suppressDeprecation ? _save : save;
|
|
136
140
|
case 'serialize':
|
|
141
|
+
// FIXME should be deprecated too? (is somewhat deprecated via store.serializeRecord)
|
|
137
142
|
return serialize;
|
|
138
143
|
case 'unloadRecord':
|
|
139
144
|
return unloadRecord;
|
|
@@ -214,6 +219,50 @@ function withDefaults(schema) {
|
|
|
214
219
|
kind: 'derived'
|
|
215
220
|
});
|
|
216
221
|
});
|
|
222
|
+
schema.fields.push({
|
|
223
|
+
name: '_isReloading',
|
|
224
|
+
kind: '@local',
|
|
225
|
+
type: 'boolean',
|
|
226
|
+
options: {
|
|
227
|
+
defaultValue: false
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
schema.fields.push({
|
|
231
|
+
name: 'isDestroying',
|
|
232
|
+
kind: '@local',
|
|
233
|
+
type: 'boolean',
|
|
234
|
+
options: {
|
|
235
|
+
defaultValue: false
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
schema.fields.push({
|
|
239
|
+
name: 'isDestroyed',
|
|
240
|
+
kind: '@local',
|
|
241
|
+
type: 'boolean',
|
|
242
|
+
options: {
|
|
243
|
+
defaultValue: false
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
schema.objectExtensions = schema.objectExtensions || [];
|
|
247
|
+
schema.objectExtensions.push('deprecated-model-behaviors');
|
|
248
|
+
return schema;
|
|
249
|
+
}
|
|
250
|
+
function withRestoredDeprecatedModelRequestBehaviors(schema) {
|
|
251
|
+
schema.legacy = true;
|
|
252
|
+
schema.identity = {
|
|
253
|
+
kind: '@id',
|
|
254
|
+
name: 'id'
|
|
255
|
+
};
|
|
256
|
+
LegacyFields.forEach(field => {
|
|
257
|
+
schema.fields.push({
|
|
258
|
+
type: '@legacy',
|
|
259
|
+
name: field,
|
|
260
|
+
kind: 'derived',
|
|
261
|
+
options: {
|
|
262
|
+
suppressDeprecation: true
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
});
|
|
217
266
|
schema.fields.push({
|
|
218
267
|
name: 'isReloading',
|
|
219
268
|
kind: '@local',
|
|
@@ -261,27 +310,32 @@ function registerDerivations(schema) {
|
|
|
261
310
|
schema._registerMode('@legacy', {
|
|
262
311
|
belongsTo: {
|
|
263
312
|
get(store, record, cacheKey, field) {
|
|
313
|
+
// FIXME field.name here should likely be field.sourceKey || field.name
|
|
264
314
|
return lookupLegacySupport(record).getBelongsTo(field.name);
|
|
265
315
|
},
|
|
266
316
|
set(store, record, cacheKey, field, value) {
|
|
267
317
|
store._join(() => {
|
|
318
|
+
// FIXME field.name here should likely be field.sourceKey || field.name
|
|
268
319
|
lookupLegacySupport(record).setDirtyBelongsTo(field.name, value);
|
|
269
320
|
});
|
|
270
321
|
}
|
|
271
322
|
},
|
|
272
323
|
hasMany: {
|
|
273
324
|
get(store, record, cacheKey, field) {
|
|
325
|
+
// FIXME field.name here should likely be field.sourceKey || field.name
|
|
274
326
|
return lookupLegacySupport(record).getHasMany(field.name);
|
|
275
327
|
},
|
|
276
328
|
set(store, record, cacheKey, field, value) {
|
|
277
329
|
store._join(() => {
|
|
278
330
|
const support = lookupLegacySupport(record);
|
|
331
|
+
// FIXME field.name here should likely be field.sourceKey || field.name
|
|
279
332
|
const manyArray = support.getManyArray(field.name);
|
|
280
333
|
manyArray.splice(0, manyArray.length, ...value);
|
|
281
334
|
});
|
|
282
335
|
},
|
|
283
336
|
notify(store, record, cacheKey, field) {
|
|
284
337
|
const support = lookupLegacySupport(record);
|
|
338
|
+
// FIXME field.name here should likely be field.sourceKey || field.name
|
|
285
339
|
const manyArray = support && support._manyArrayCache[field.name];
|
|
286
340
|
const hasPromise = support && support._relationshipPromisesCache[field.name];
|
|
287
341
|
if (manyArray && hasPromise) {
|
|
@@ -297,6 +351,34 @@ function registerDerivations(schema) {
|
|
|
297
351
|
}
|
|
298
352
|
}
|
|
299
353
|
});
|
|
354
|
+
schema.CAUTION_MEGA_DANGER_ZONE_registerExtension({
|
|
355
|
+
name: 'deprecated-model-behaviors',
|
|
356
|
+
kind: 'object',
|
|
357
|
+
features: {
|
|
358
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
359
|
+
get isReloading() {
|
|
360
|
+
deprecate(`record.isReloading is deprecated, please use store.request and either <Request> or getRequuestState to keep track of the request state instead.`, false, {
|
|
361
|
+
id: 'warp-drive:deprecate-legacy-request-methods',
|
|
362
|
+
until: '6.0',
|
|
363
|
+
for: '@warp-drive/core',
|
|
364
|
+
url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',
|
|
365
|
+
since: {
|
|
366
|
+
enabled: '5.7',
|
|
367
|
+
available: '5.7'
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
// @ts-expect-error
|
|
371
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
372
|
+
return this._isReloading;
|
|
373
|
+
},
|
|
374
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
375
|
+
set isReloading(v) {
|
|
376
|
+
// @ts-expect-error
|
|
377
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
378
|
+
this._isReloading = v;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
300
382
|
}
|
|
301
383
|
|
|
302
384
|
/**
|
|
@@ -403,8 +485,8 @@ class DelegatingSchemaService {
|
|
|
403
485
|
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource) {
|
|
404
486
|
return this._preferred.CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource);
|
|
405
487
|
}
|
|
406
|
-
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field) {
|
|
407
|
-
return this._preferred.CAUTION_MEGA_DANGER_ZONE_objectExtensions(field);
|
|
488
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field, resolvedType) {
|
|
489
|
+
return this._preferred.CAUTION_MEGA_DANGER_ZONE_objectExtensions(field, resolvedType);
|
|
408
490
|
}
|
|
409
491
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field) {
|
|
410
492
|
return this._preferred.CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field);
|
|
@@ -461,4 +543,4 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
|
|
|
461
543
|
return this._preferred.doesTypeExist?.(type) || this._secondary.doesTypeExist?.(type) || false;
|
|
462
544
|
};
|
|
463
545
|
}
|
|
464
|
-
export { DelegatingSchemaService, registerDerivations, withDefaults };
|
|
546
|
+
export { DelegatingSchemaService, registerDerivations, withDefaults, withRestoredDeprecatedModelRequestBehaviors };
|
package/dist/model.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { computed } from '@ember/object';
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
3
|
import { peekCache, setRecordIdentifier, StoreMap, setCacheFor } from '@warp-drive/core/store/-private';
|
|
4
|
-
import {
|
|
5
|
-
export { M as Model, b as buildSchema, M as default } from "./schema-provider-BdQhkT-Q.js";
|
|
4
|
+
import { i as isElementDescriptor, n as normalizeModelName } from "./util-Dul6TZts.js";
|
|
6
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
7
6
|
import { warn, deprecate } from '@ember/debug';
|
|
8
7
|
import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
9
8
|
import { l as lookupLegacySupport } from "./errors-BX5wowuz.js";
|
|
10
9
|
import { singularize, dasherize } from '@warp-drive/utilities/string';
|
|
10
|
+
import { l as getModelFactory } from "./schema-provider-Cbnf6sKm.js";
|
|
11
|
+
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-Cbnf6sKm.js";
|
|
11
12
|
import { setOwner, getOwner } from '@ember/application';
|
|
12
13
|
function _attr(type, options) {
|
|
13
14
|
if (typeof type === 'object') {
|
|
@@ -2,45 +2,14 @@ import { getOwner } from '@ember/application';
|
|
|
2
2
|
import { deprecate } from '@ember/debug';
|
|
3
3
|
import EmberObject from '@ember/object';
|
|
4
4
|
import { recordIdentifierFor, storeFor } from '@warp-drive/core';
|
|
5
|
-
import { peekCache, notifyInternalSignal, peekInternalSignal, withSignalStore, ARRAY_SIGNAL, recordIdentifierFor as recordIdentifierFor$1, gate, memoized, defineSignal, coerceId, entangleSignal } from '@warp-drive/core/store/-private';
|
|
5
|
+
import { peekCache, notifyInternalSignal, peekInternalSignal, withSignalStore, ARRAY_SIGNAL, recordIdentifierFor as recordIdentifierFor$1, gate, memoized, defineSignal, coerceId, entangleSignal, defineGate } from '@warp-drive/core/store/-private';
|
|
6
6
|
import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
7
7
|
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-BX5wowuz.js";
|
|
8
8
|
import { u as upgradeStore, F as FetchManager } from "./-private-CKrP0ogQ.js";
|
|
9
9
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
10
10
|
import { cacheFor } from '@ember/object/internals';
|
|
11
11
|
import { d as decorateMethodV2 } from "./runtime-BPCpkOf1-BKOwiRJp.js";
|
|
12
|
-
import {
|
|
13
|
-
function isElementDescriptor(args) {
|
|
14
|
-
const [maybeTarget, maybeKey, maybeDesc] = args;
|
|
15
|
-
return (
|
|
16
|
-
// Ensure we have the right number of args
|
|
17
|
-
args.length === 3 && (
|
|
18
|
-
// Make sure the target is a class or object (prototype)
|
|
19
|
-
typeof maybeTarget === 'function' || typeof maybeTarget === 'object' && maybeTarget !== null) &&
|
|
20
|
-
// Make sure the key is a string
|
|
21
|
-
typeof maybeKey === 'string' && (
|
|
22
|
-
// Make sure the descriptor is the right shape
|
|
23
|
-
typeof maybeDesc === 'object' && maybeDesc !== null && 'enumerable' in maybeDesc && 'configurable' in maybeDesc ||
|
|
24
|
-
// TS compatibility
|
|
25
|
-
maybeDesc === undefined)
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
function normalizeModelName(type) {
|
|
29
|
-
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_NON_STRICT_TYPES)) {
|
|
30
|
-
const result = dasherize(type);
|
|
31
|
-
deprecate(`The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`, result === type, {
|
|
32
|
-
id: 'ember-data:deprecate-non-strict-types',
|
|
33
|
-
until: '6.0',
|
|
34
|
-
for: 'ember-data',
|
|
35
|
-
since: {
|
|
36
|
-
available: '4.13',
|
|
37
|
-
enabled: '5.3'
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
return type;
|
|
43
|
-
}
|
|
12
|
+
import { n as normalizeModelName } from "./util-Dul6TZts.js";
|
|
44
13
|
function rollbackAttributes() {
|
|
45
14
|
const {
|
|
46
15
|
currentState
|
|
@@ -70,6 +39,27 @@ function hasMany(prop) {
|
|
|
70
39
|
return lookupLegacySupport(this).referenceFor('hasMany', prop);
|
|
71
40
|
}
|
|
72
41
|
function reload(options = {}) {
|
|
42
|
+
if (macroCondition(!getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_REQUEST_METHODS)) {
|
|
43
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
44
|
+
{
|
|
45
|
+
throw new Error(`You cannot use reload() on a record when ENABLE_LEGACY_REQUEST_METHODS is false.`);
|
|
46
|
+
}
|
|
47
|
+
})() : {};
|
|
48
|
+
} else {
|
|
49
|
+
deprecate(`record.reload is deprecated, please use store.request to initiate a request instead.`, false, {
|
|
50
|
+
id: 'warp-drive:deprecate-legacy-request-methods',
|
|
51
|
+
until: '6.0',
|
|
52
|
+
for: '@warp-drive/core',
|
|
53
|
+
url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',
|
|
54
|
+
since: {
|
|
55
|
+
enabled: '5.7',
|
|
56
|
+
available: '5.7'
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return _reload.call(this, options);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function _reload(options = {}) {
|
|
73
63
|
options.isReloading = true;
|
|
74
64
|
options.reload = true;
|
|
75
65
|
const identifier = recordIdentifierFor(this);
|
|
@@ -107,6 +97,27 @@ function deleteRecord() {
|
|
|
107
97
|
}
|
|
108
98
|
}
|
|
109
99
|
function save(options) {
|
|
100
|
+
if (macroCondition(!getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_REQUEST_METHODS)) {
|
|
101
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
102
|
+
{
|
|
103
|
+
throw new Error(`You cannot use save() on a record when ENABLE_LEGACY_REQUEST_METHODS is false.`);
|
|
104
|
+
}
|
|
105
|
+
})() : {};
|
|
106
|
+
} else {
|
|
107
|
+
deprecate(`record.save is deprecated, please use store.request to initiate a request instead.`, false, {
|
|
108
|
+
id: 'warp-drive:deprecate-legacy-request-methods',
|
|
109
|
+
until: '6.0',
|
|
110
|
+
for: '@warp-drive/core',
|
|
111
|
+
url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',
|
|
112
|
+
since: {
|
|
113
|
+
enabled: '5.7',
|
|
114
|
+
available: '5.7'
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return _save.call(this, options);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function _save(options) {
|
|
110
121
|
let promise;
|
|
111
122
|
if (this.currentState.isNew && this.currentState.isDeleted) {
|
|
112
123
|
promise = Promise.resolve(this);
|
|
@@ -117,6 +128,27 @@ function save(options) {
|
|
|
117
128
|
return promise;
|
|
118
129
|
}
|
|
119
130
|
function destroyRecord(options) {
|
|
131
|
+
if (macroCondition(!getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_REQUEST_METHODS)) {
|
|
132
|
+
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
133
|
+
{
|
|
134
|
+
throw new Error(`You cannot use destroyRecord() on a record when ENABLE_LEGACY_REQUEST_METHODS is false.`);
|
|
135
|
+
}
|
|
136
|
+
})() : {};
|
|
137
|
+
} else {
|
|
138
|
+
deprecate(`record.destroyRecord is deprecated, please use store.request to initiate a request instead.`, false, {
|
|
139
|
+
id: 'warp-drive:deprecate-legacy-request-methods',
|
|
140
|
+
until: '6.0',
|
|
141
|
+
for: '@warp-drive/core',
|
|
142
|
+
url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',
|
|
143
|
+
since: {
|
|
144
|
+
enabled: '5.7',
|
|
145
|
+
available: '5.7'
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return _destroyRecord.call(this, options);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function _destroyRecord(options) {
|
|
120
152
|
const {
|
|
121
153
|
isNew
|
|
122
154
|
} = this.currentState;
|
|
@@ -1917,7 +1949,44 @@ Model.prototype.deleteRecord = deleteRecord;
|
|
|
1917
1949
|
Model.prototype.changedAttributes = changedAttributes;
|
|
1918
1950
|
Model.prototype.rollbackAttributes = rollbackAttributes;
|
|
1919
1951
|
Model.prototype.reload = reload;
|
|
1920
|
-
|
|
1952
|
+
defineGate(Model.prototype, 'isReloading', {
|
|
1953
|
+
get() {
|
|
1954
|
+
deprecate(`record.isReloading is deprecated, please use store.request and either <Request> or getRequuestState to keep track of the request state instead.`, false, {
|
|
1955
|
+
id: 'warp-drive:deprecate-legacy-request-methods',
|
|
1956
|
+
until: '6.0',
|
|
1957
|
+
for: '@warp-drive/core',
|
|
1958
|
+
url: 'https://docs.warp-drive.io/api/@warp-drive/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS',
|
|
1959
|
+
since: {
|
|
1960
|
+
enabled: '5.7',
|
|
1961
|
+
available: '5.7'
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
return this._isReloading ?? false;
|
|
1965
|
+
},
|
|
1966
|
+
set(v) {
|
|
1967
|
+
this._isReloading = v;
|
|
1968
|
+
},
|
|
1969
|
+
configurable: true,
|
|
1970
|
+
// @ts-expect-error specially handled prop
|
|
1971
|
+
isLocal: true
|
|
1972
|
+
});
|
|
1973
|
+
function restoreDeprecatedModelRequestBehaviors(ModelKlass) {
|
|
1974
|
+
// @ts-expect-error TS doesn't know how to do `this` function overloads
|
|
1975
|
+
ModelKlass.prototype.save = _save;
|
|
1976
|
+
// @ts-expect-error TS doesn't know how to do `this` function overloads
|
|
1977
|
+
ModelKlass.prototype.destroyRecord = _destroyRecord;
|
|
1978
|
+
ModelKlass.prototype.reload = _reload;
|
|
1979
|
+
defineGate(Model.prototype, 'isReloading', {
|
|
1980
|
+
get() {
|
|
1981
|
+
return this._isReloading ?? false;
|
|
1982
|
+
},
|
|
1983
|
+
set(v) {
|
|
1984
|
+
this._isReloading = v;
|
|
1985
|
+
},
|
|
1986
|
+
// @ts-expect-error specially handled prop
|
|
1987
|
+
isLocal: true
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1921
1990
|
|
|
1922
1991
|
// this is required to prevent `init` from passing
|
|
1923
1992
|
// the values initialized during create to `setUnknownProperty`
|
|
@@ -2232,4 +2301,4 @@ function getModelFactory(store, type) {
|
|
|
2232
2301
|
}
|
|
2233
2302
|
return factory;
|
|
2234
2303
|
}
|
|
2235
|
-
export { Model as M, RecordState as R, save as a, buildSchema as b,
|
|
2304
|
+
export { Model as M, RecordState as R, _save as _, save as a, buildSchema as b, _reload as c, reload as d, _destroyRecord as e, destroyRecord as f, deleteRecord as g, hasMany as h, changedAttributes as i, belongsTo as j, createSnapshot as k, getModelFactory as l, restoreDeprecatedModelRequestBehaviors as m, rollbackAttributes as r, serialize as s, unloadRecord as u };
|