@warp-drive/legacy 5.7.0-alpha.37 → 5.7.0-alpha.39
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/-private/build-url-mixin.d.ts +0 -13
- package/declarations/adapter/-private/utils/serialize-query-params.d.ts +0 -4
- package/declarations/adapter/error.d.ts +0 -1
- package/declarations/adapter/rest.d.ts +0 -2
- package/declarations/adapter.d.ts +0 -5
- package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +0 -1
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +0 -5
- package/declarations/compat.d.ts +0 -3
- package/declarations/model/-private/attr.d.ts +0 -13
- package/declarations/model/-private/belongs-to.d.ts +0 -11
- package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +0 -12
- package/declarations/model/-private/errors.d.ts +0 -6
- package/declarations/model/-private/has-many.d.ts +0 -4
- package/declarations/model/-private/model-for-mixin.d.ts +0 -16
- package/declarations/model/-private/model.d.ts +0 -38
- package/declarations/model/-private/promise-belongs-to.d.ts +0 -6
- package/declarations/model/-private/promise-many-array.d.ts +0 -8
- package/declarations/model/-private/references/belongs-to.d.ts +0 -1
- package/declarations/model/-private/references/has-many.d.ts +0 -1
- package/declarations/model/-private.d.ts +0 -1
- package/declarations/serializer/json-api.d.ts +0 -1
- package/declarations/serializer/json.d.ts +0 -1
- package/declarations/serializer/rest.d.ts +0 -1
- package/declarations/store/-private.d.ts +0 -1
- package/package.json +10 -10
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import Mixin from "@ember/object/mixin";
|
|
2
2
|
import type { Snapshot, SnapshotRecordArray } from "../../compat/-private.js";
|
|
3
|
-
/*
|
|
4
|
-
The structure of this file is such because typing Mixins is hard. Here we've structured it in
|
|
5
|
-
such a way as to maximize the type information that a consumer can utilize. There are simpler
|
|
6
|
-
ways to type a mixin but we would not be able to provide the nice overload signature for buildURL
|
|
7
|
-
*/
|
|
8
|
-
// the interface must fully declare the function signatures that the individual functions
|
|
9
|
-
// will also declare. If instead we try to keep them in sync by doing something like
|
|
10
|
-
// `interface BuildURLMixin { buildURL: typeof buildURL }`
|
|
11
|
-
// then an extending class overwriting one of the methods will break because typescript
|
|
12
|
-
// thinks it is a switch from an instance prop (that is a method) to an instance method.
|
|
13
3
|
export interface BuildURLMixin {
|
|
14
4
|
buildURL(this: MixtBuildURLMixin, modelName: string, id: string, snapshot: Snapshot, requestType: "findRecord"): string;
|
|
15
5
|
buildURL(this: MixtBuildURLMixin, modelName: string, id: null, snapshot: SnapshotRecordArray, requestType: "findAll"): string;
|
|
@@ -36,9 +26,6 @@ export interface BuildURLMixin {
|
|
|
36
26
|
urlPrefix(this: MixtBuildURLMixin, path?: string | null, parentURL?: string): string;
|
|
37
27
|
pathForType(this: MixtBuildURLMixin, modelName: string): string;
|
|
38
28
|
}
|
|
39
|
-
// prevents the final constructed object from needing to add
|
|
40
|
-
// host and namespace which are provided by the final consuming
|
|
41
|
-
// class to the prototype which can result in overwrite errors
|
|
42
29
|
export interface MixtBuildURLMixin extends BuildURLMixin {
|
|
43
30
|
host: string | null;
|
|
44
31
|
namespace: string | null;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
interface PlainObject {
|
|
2
2
|
[key: string]: string | PlainObject | PlainObject[] | string[];
|
|
3
3
|
}
|
|
4
|
-
/*
|
|
5
|
-
* Helper function that turns the data/body of a request into a query param string.
|
|
6
|
-
* This is directly copied from jQuery.param.
|
|
7
|
-
*/
|
|
8
4
|
export declare function serializeQueryParams(queryParamsObject: PlainObject | string): string;
|
|
9
5
|
export {};
|
|
@@ -71,7 +71,6 @@ wrap the error payload unaltered.
|
|
|
71
71
|
@class InvalidError
|
|
72
72
|
@public
|
|
73
73
|
*/
|
|
74
|
-
// TODO @deprecate extractError documentation
|
|
75
74
|
export type InvalidError = AdapterRequestError<"InvalidError">;
|
|
76
75
|
export declare const InvalidError: AdapterRequestErrorConstructor<InvalidError>;
|
|
77
76
|
/**
|
|
@@ -650,7 +650,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
650
650
|
*/
|
|
651
651
|
deleteRecord(store: Store, schema: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
652
652
|
_stripIDFromURL(store: Store, snapshot: Snapshot): string;
|
|
653
|
-
// http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
|
|
654
653
|
maxURLLength: number;
|
|
655
654
|
/**
|
|
656
655
|
Organize records into groups, each of which is to be passed to separate
|
|
@@ -806,7 +805,6 @@ declare class RESTAdapter extends AdapterWithBuildURLMixin {
|
|
|
806
805
|
*/
|
|
807
806
|
buildQuery(snapshot: Snapshot | SnapshotRecordArray): QueryState;
|
|
808
807
|
}
|
|
809
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
810
808
|
interface RESTAdapter extends MixtBuildURLMixin {}
|
|
811
809
|
/**
|
|
812
810
|
* Helper function that translates the options passed to `jQuery.ajax` into a format that `fetch` expects.
|
|
@@ -277,7 +277,6 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
277
277
|
|
|
278
278
|
@public
|
|
279
279
|
*/
|
|
280
|
-
// @ts-expect-error
|
|
281
280
|
findRecord(store: Store, type: ModelSchema, id: string, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
282
281
|
/**
|
|
283
282
|
The `findAll()` method is used to retrieve all records for a given type.
|
|
@@ -331,7 +330,6 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
331
330
|
|
|
332
331
|
@public
|
|
333
332
|
*/
|
|
334
|
-
// @ts-expect-error
|
|
335
333
|
query(store: Store, type: ModelSchema, query: Record<string, unknown>): Promise<AdapterPayload>;
|
|
336
334
|
/**
|
|
337
335
|
The `queryRecord()` method is invoked when the store is asked for a single
|
|
@@ -448,7 +446,6 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
448
446
|
|
|
449
447
|
@public
|
|
450
448
|
*/
|
|
451
|
-
// @ts-expect-error
|
|
452
449
|
createRecord(store: Store, type: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
453
450
|
/**
|
|
454
451
|
Implement this method in a subclass to handle the updating of
|
|
@@ -499,7 +496,6 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
499
496
|
@return {Promise} promise
|
|
500
497
|
@public
|
|
501
498
|
*/
|
|
502
|
-
// @ts-expect-error
|
|
503
499
|
updateRecord(store: Store, type: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
504
500
|
/**
|
|
505
501
|
Implement this method in a subclass to handle the deletion of
|
|
@@ -542,7 +538,6 @@ export declare class Adapter extends EmberObject implements MinimumAdapterInterf
|
|
|
542
538
|
@return {Promise} promise
|
|
543
539
|
@public
|
|
544
540
|
*/
|
|
545
|
-
// @ts-expect-error
|
|
546
541
|
deleteRecord(store: Store, type: ModelSchema, snapshot: Snapshot): Promise<AdapterPayload>;
|
|
547
542
|
/**
|
|
548
543
|
By default the store will try to coalesce all `findRecord` calls within the same runloop
|
|
@@ -15,7 +15,6 @@ export type FetchMutationOptions = FindRecordOptions & {
|
|
|
15
15
|
interface PendingFetchItem {
|
|
16
16
|
identifier: PersistedResourceKey;
|
|
17
17
|
queryRequest: Request;
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
18
|
resolver: Deferred<any>;
|
|
20
19
|
options: FindRecordOptions;
|
|
21
20
|
trace?: unknown;
|
|
@@ -5,11 +5,6 @@ import type { LegacyRelationshipField as RelationshipSchema } from "@warp-drive/
|
|
|
5
5
|
import type { Snapshot } from "./snapshot.js";
|
|
6
6
|
import type { SnapshotRecordArray } from "./snapshot-record-array.js";
|
|
7
7
|
type Group = Snapshot[];
|
|
8
|
-
// TODO this should probably just alias unknown
|
|
9
|
-
// since in theory a user could pass a blob or a string
|
|
10
|
-
// however those deserialization cases are handled
|
|
11
|
-
// far easier in the adapter itself and are unlikely
|
|
12
|
-
// to be passed to the serializer today.
|
|
13
8
|
export type AdapterPayload = Record<string, unknown> | unknown[];
|
|
14
9
|
/**
|
|
15
10
|
* <blockquote style="margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;">
|
package/declarations/compat.d.ts
CHANGED
|
@@ -72,7 +72,6 @@ store.push(store.normalize(modelName, data));
|
|
|
72
72
|
@param modelName The name of the model type for this payload
|
|
73
73
|
@return The normalized payload
|
|
74
74
|
*/
|
|
75
|
-
// TODO @runspired @deprecate users should call normalize on the associated serializer directly
|
|
76
75
|
export declare function normalize(this: Store, modelName: string, payload: ObjectValue): SingleResourceDocument;
|
|
77
76
|
/**
|
|
78
77
|
Push some raw data into the store.
|
|
@@ -129,8 +128,6 @@ store.pushPayload('post', pushData); // Will use the post serializer
|
|
|
129
128
|
@param {String} modelName Optionally, a model type used to determine which serializer will be used
|
|
130
129
|
@param {Object} inputPayload
|
|
131
130
|
*/
|
|
132
|
-
// TODO @runspired @deprecate pushPayload in favor of looking up the serializer
|
|
133
131
|
export declare function pushPayload(this: Store, modelName: string, inputPayload: ObjectValue): void;
|
|
134
|
-
// TODO @runspired @deprecate records should implement their own serialization if desired
|
|
135
132
|
export declare function serializeRecord(this: Store, record: unknown, options?: SerializerOptions): unknown;
|
|
136
133
|
export declare function cleanup(this: Store): void;
|
|
@@ -37,13 +37,6 @@ export type AttrOptions<DV = PrimitiveValue | object | unknown[]> = {
|
|
|
37
37
|
*/
|
|
38
38
|
defaultValue?: DV extends PrimitiveValue ? DV : () => DV;
|
|
39
39
|
};
|
|
40
|
-
// NOTE: Usage of Explicit ANY
|
|
41
|
-
// -------------------------------------------------------------------
|
|
42
|
-
// any is required here because we are the maximal not the minimal
|
|
43
|
-
// subset of options allowed. If we used unknown, object, or
|
|
44
|
-
// Record<string, unknown> we would get type errors when we try to
|
|
45
|
-
// assert against a more specific implementation with precise options.
|
|
46
|
-
// -------------------------------------------------------------------
|
|
47
40
|
type LooseTransformInstance<
|
|
48
41
|
V,
|
|
49
42
|
Raw,
|
|
@@ -53,15 +46,11 @@ type LooseTransformInstance<
|
|
|
53
46
|
* value type must match the return type of the deserialize method
|
|
54
47
|
*
|
|
55
48
|
*/
|
|
56
|
-
// see note on Explicit ANY above
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
49
|
serialize: (value: V, options: any) => Raw;
|
|
59
50
|
/**
|
|
60
51
|
* defaultValue type must match the return type of the deserialize method
|
|
61
52
|
*
|
|
62
53
|
*/
|
|
63
|
-
// see note on Explicit ANY above
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
54
|
deserialize: (value: Raw, options: any) => V;
|
|
66
55
|
[TransformName]: Name;
|
|
67
56
|
};
|
|
@@ -72,8 +61,6 @@ export type TypedTransformInstance<
|
|
|
72
61
|
V,
|
|
73
62
|
T extends string
|
|
74
63
|
> = LooseTransformInstance<V, string, T> | LooseTransformInstance<V, number, T> | LooseTransformInstance<V, boolean, T> | LooseTransformInstance<V, null, T> | LooseTransformInstance<V, ObjectValue, T> | LooseTransformInstance<V, ArrayValue, T> | LooseTransformInstance<V, string | null, T> | LooseTransformInstance<V, number | null, T> | LooseTransformInstance<V, boolean | null, T> | LooseTransformInstance<V, ObjectValue | null, T> | LooseTransformInstance<V, ArrayValue | null, T>;
|
|
75
|
-
// see note on Explicit ANY above
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
64
|
export type GetMaybeDeserializeValue<T> = T extends {
|
|
78
65
|
deserialize: (...args: any[]) => unknown;
|
|
79
66
|
} ? ReturnType<T["deserialize"]> : never;
|
|
@@ -12,13 +12,6 @@ export type RelationshipOptions<
|
|
|
12
12
|
resetOnRemoteUpdate?: boolean;
|
|
13
13
|
};
|
|
14
14
|
export type NoNull<T> = Exclude<T, null>;
|
|
15
|
-
// type BelongsToDecoratorObject<getT> = {
|
|
16
|
-
// get: () => getT;
|
|
17
|
-
// // set: (value: Awaited<getT>) => void;
|
|
18
|
-
// set: (value: getT) => void;
|
|
19
|
-
// // init: () => getT;
|
|
20
|
-
// };
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
15
|
export type RelationshipDecorator<T> = <This>(target: This, key: string, desc?: PropertyDescriptor) => void;
|
|
23
16
|
/**
|
|
24
17
|
`belongsTo` is used to define One-To-One and One-To-Many, and One-To-None
|
|
@@ -179,8 +172,4 @@ type each record satisfies on both sides.
|
|
|
179
172
|
export declare function belongsTo(): never;
|
|
180
173
|
export declare function belongsTo(type: string): never;
|
|
181
174
|
export declare function belongsTo<T>(type: TypeFromInstance<NoNull<T>>, options: RelationshipOptions<T, boolean>): RelationshipDecorator<T>;
|
|
182
|
-
// export function belongsTo<K extends Promise<unknown>, T extends Awaited<K> = Awaited<K>>(
|
|
183
|
-
// type: TypeFromInstance<NoNull<T>>,
|
|
184
|
-
// options: RelationshipOptions<T, true>
|
|
185
|
-
// ): RelationshipDecorator<K>;
|
|
186
175
|
export declare function belongsTo(type: string, options: RelationshipOptions<unknown, boolean>): RelationshipDecorator<unknown>;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { UpgradedMeta } from "@warp-drive/core/graph/-private";
|
|
3
3
|
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
4
|
-
/*
|
|
5
|
-
Assert that `addedRecord` has a valid type so it can be added to the
|
|
6
|
-
relationship of the `record`.
|
|
7
|
-
|
|
8
|
-
The assert basically checks if the `addedRecord` can be added to the
|
|
9
|
-
relationship (specified via `relationshipMeta`) of the `record`.
|
|
10
|
-
|
|
11
|
-
This utility should only be used internally, as both record parameters must
|
|
12
|
-
be stable record identifiers and the `relationshipMeta` needs to be the meta
|
|
13
|
-
information about the relationship, retrieved via
|
|
14
|
-
`record.relationshipFor(key)`.
|
|
15
|
-
*/
|
|
16
4
|
declare let assertPolymorphicType: (parentIdentifier: ResourceKey, parentDefinition: UpgradedMeta, addedIdentifier: ResourceKey, store: Store) => void;
|
|
17
5
|
export { assertPolymorphicType };
|
|
@@ -6,16 +6,10 @@ type ValidationError = {
|
|
|
6
6
|
message: string;
|
|
7
7
|
};
|
|
8
8
|
interface ArrayProxyWithCustomOverrides<T> extends Omit<ArrayProxy<T>, "clear" | "content"> {
|
|
9
|
-
// Omit causes `content` to be merged with the class def for ArrayProxy
|
|
10
|
-
// which then causes it to be seen as a property, disallowing defining it
|
|
11
|
-
// as an accessor. This restores our ability to define it as an accessor.
|
|
12
9
|
content: NativeArray<T>;
|
|
13
10
|
clear(): void;
|
|
14
11
|
_has(name: string): boolean;
|
|
15
12
|
}
|
|
16
|
-
// we force the type here to our own construct because mixin and extend patterns
|
|
17
|
-
// lose generic signatures. We also do this because we need to Omit `clear` from
|
|
18
|
-
// the type of ArrayProxy as we override it's signature.
|
|
19
13
|
declare const ArrayProxyWithCustomOverrides: new <T>() => ArrayProxyWithCustomOverrides<T>;
|
|
20
14
|
/**
|
|
21
15
|
Holds validation errors for a given record, organized by attribute names.
|
|
@@ -160,8 +160,4 @@ type each record satisfies on both sides.
|
|
|
160
160
|
export declare function hasMany(): never;
|
|
161
161
|
export declare function hasMany(type: string): never;
|
|
162
162
|
export declare function hasMany<T>(type: TypeFromInstance<NoNull<T>>, options: RelationshipOptions<T, boolean>): RelationshipDecorator<T>;
|
|
163
|
-
// export function hasMany<K extends Promise<unknown>, T extends Awaited<K> = Awaited<K>>(
|
|
164
|
-
// type: TypeFromInstance<NoNull<T>>,
|
|
165
|
-
// options: RelationshipOptions<T, true>
|
|
166
|
-
// ): RelationshipDecorator<K>;
|
|
167
163
|
export declare function hasMany(type: string, options: RelationshipOptions<unknown, boolean>): RelationshipDecorator<unknown>;
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import { type ModelFactory } from "./model.js";
|
|
3
|
-
/*
|
|
4
|
-
In case someone defined a relationship to a mixin, for example:
|
|
5
|
-
```ts
|
|
6
|
-
class CommentModel extends Model {
|
|
7
|
-
@belongsTo('commentable', { polymorphic: true }) owner;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let Commentable = Mixin.create({
|
|
11
|
-
@hasMany('comment') comments;
|
|
12
|
-
});
|
|
13
|
-
```
|
|
14
|
-
we want to look up a Commentable class which has all the necessary
|
|
15
|
-
relationship meta data. Thus, we look up the mixin and create a mock
|
|
16
|
-
Model, so we can access the relationship CPs of the mixin (`comments`)
|
|
17
|
-
in this case
|
|
18
|
-
*/
|
|
19
3
|
export default function modelForMixin(store: Store, normalizedModelName: string): ModelFactory | undefined;
|
|
@@ -12,7 +12,6 @@ import type HasManyReference from "./references/has-many.js";
|
|
|
12
12
|
import type { _MaybeBelongsToFields, isSubClass, MaybeAttrFields, MaybeHasManyFields, MaybeRelationshipFields } from "./type-utils.js";
|
|
13
13
|
export type ModelCreateArgs = {
|
|
14
14
|
_createProps: Record<string, unknown>;
|
|
15
|
-
// TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for
|
|
16
15
|
_secretInit: {
|
|
17
16
|
identifier: ResourceKey;
|
|
18
17
|
store: Store;
|
|
@@ -26,8 +25,6 @@ export type ModelFactory = {
|
|
|
26
25
|
class: StaticModel;
|
|
27
26
|
};
|
|
28
27
|
export type FactoryCache = Record<string, ModelFactory>;
|
|
29
|
-
// we put this on the store for interop because it's used by modelFor and
|
|
30
|
-
// instantiateRecord as well.
|
|
31
28
|
export type ModelStore = Store & {
|
|
32
29
|
_modelFactoryCache: FactoryCache;
|
|
33
30
|
};
|
|
@@ -35,7 +32,6 @@ export type ModelStore = Store & {
|
|
|
35
32
|
* @noInheritDoc
|
|
36
33
|
*/
|
|
37
34
|
interface Model {
|
|
38
|
-
// set during create by the store
|
|
39
35
|
/**
|
|
40
36
|
* The store service instance which created this record instance
|
|
41
37
|
*/
|
|
@@ -169,7 +165,6 @@ interface Model {
|
|
|
169
165
|
@public
|
|
170
166
|
*/
|
|
171
167
|
rollbackAttributes<T extends MinimalLegacyRecord>(this: T): void;
|
|
172
|
-
// TODO @deprecate in favor of a public API or examples of how to test successfully
|
|
173
168
|
/**
|
|
174
169
|
@private
|
|
175
170
|
*/
|
|
@@ -241,10 +236,6 @@ interface Model {
|
|
|
241
236
|
with an error.
|
|
242
237
|
*/
|
|
243
238
|
reload<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
|
|
244
|
-
// belongsTo<T extends MinimalLegacyRecord, K extends MaybeBelongsToFields<T>>(
|
|
245
|
-
// this: T,
|
|
246
|
-
// prop: K
|
|
247
|
-
// ): BelongsToReference<T, K>;
|
|
248
239
|
/**
|
|
249
240
|
Get the reference for the specified belongsTo relationship.
|
|
250
241
|
|
|
@@ -427,7 +418,6 @@ interface Model {
|
|
|
427
418
|
*/
|
|
428
419
|
declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
429
420
|
/** @private */
|
|
430
|
-
// @ts-expect-error destroy should not return a value, but ember's types force it to
|
|
431
421
|
destroy(): this;
|
|
432
422
|
/**
|
|
433
423
|
If this property is `true` the record is in the `empty`
|
|
@@ -677,8 +667,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
677
667
|
@property currentState
|
|
678
668
|
@private
|
|
679
669
|
*/
|
|
680
|
-
// TODO we can probably make this a computeOnce
|
|
681
|
-
// we likely do not need to notify the currentState root anymore
|
|
682
670
|
get currentState(): RecordState;
|
|
683
671
|
set currentState(_v: RecordState);
|
|
684
672
|
/**
|
|
@@ -748,15 +736,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
748
736
|
*/
|
|
749
737
|
get adapterError(): unknown;
|
|
750
738
|
set adapterError(v: unknown);
|
|
751
|
-
/*
|
|
752
|
-
We hook the default implementation to ensure
|
|
753
|
-
our tagged properties are properly notified
|
|
754
|
-
as well. We still super for everything because
|
|
755
|
-
sync observers require a direct call occuring
|
|
756
|
-
to trigger their flush. We wouldn't need to
|
|
757
|
-
super in 4.0+ where sync observers are removed.
|
|
758
|
-
*/
|
|
759
|
-
// @ts-expect-error no return is necessary, but Ember's types are forcing it
|
|
760
739
|
notifyPropertyChange(prop: string): this;
|
|
761
740
|
/**
|
|
762
741
|
Given a callback, iterates over each of the relationships in the model,
|
|
@@ -844,22 +823,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
844
823
|
@readonly
|
|
845
824
|
*/
|
|
846
825
|
static modelName: string;
|
|
847
|
-
/*
|
|
848
|
-
These class methods below provide relationship
|
|
849
|
-
introspection abilities about relationships.
|
|
850
|
-
|
|
851
|
-
A note about the computed properties contained here:
|
|
852
|
-
|
|
853
|
-
**These properties are effectively sealed once called for the first time.**
|
|
854
|
-
To avoid repeatedly doing expensive iteration over a model's fields, these
|
|
855
|
-
values are computed once and then cached for the remainder of the runtime of
|
|
856
|
-
your application.
|
|
857
|
-
|
|
858
|
-
If your application needs to modify a class after its initial definition
|
|
859
|
-
(for example, using `reopen()` to add additional attributes), make sure you
|
|
860
|
-
do it before using your model with the store, which uses these properties
|
|
861
|
-
extensively.
|
|
862
|
-
*/
|
|
863
826
|
/**
|
|
864
827
|
For a given relationship name, returns the model type of the relationship.
|
|
865
828
|
|
|
@@ -914,7 +877,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
914
877
|
@return the inverse relationship, or null
|
|
915
878
|
*/
|
|
916
879
|
static inverseFor(name: string, store: Store): LegacyRelationshipField | null;
|
|
917
|
-
//Calculate the inverse, ignoring the cache
|
|
918
880
|
static _findInverseFor(name: string, store: Store): LegacyRelationshipField | null;
|
|
919
881
|
/**
|
|
920
882
|
The model's relationships as a map, keyed on the type of the
|
|
@@ -16,13 +16,10 @@ export interface BelongsToProxyCreateArgs<T = unknown> {
|
|
|
16
16
|
}
|
|
17
17
|
export declare const LegacyPromiseProxy: unique symbol;
|
|
18
18
|
interface PromiseObjectType<T> extends PromiseProxyMixin<T | null>, ObjectProxy<T> {
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-new
|
|
20
19
|
new <PT>(...args: unknown[]): PromiseObjectType<PT>;
|
|
21
20
|
}
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-extraneous-class
|
|
23
21
|
declare class PromiseObjectType<T> {}
|
|
24
22
|
declare const Extended: PromiseObjectType<OpaqueRecordInstance>;
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
23
|
interface PromiseBelongsTo<T> {
|
|
27
24
|
[LegacyPromiseProxy]: true;
|
|
28
25
|
}
|
|
@@ -37,9 +34,6 @@ Right now we proxy:
|
|
|
37
34
|
declare class PromiseBelongsTo<T = unknown> extends Extended<T> {
|
|
38
35
|
_belongsToState: BelongsToProxyMeta<T>;
|
|
39
36
|
get id(): string | null;
|
|
40
|
-
// we don't proxy meta because we would need to proxy it to the relationship state container
|
|
41
|
-
// however, meta on relationships does not trigger change notifications.
|
|
42
|
-
// if you need relationship meta, you should do `record.belongsTo(relationshipName).meta()`
|
|
43
37
|
get meta(): void;
|
|
44
38
|
reload(options: Record<string, unknown>): Promise<this>;
|
|
45
39
|
}
|
|
@@ -6,7 +6,6 @@ export interface HasManyProxyCreateArgs<T = unknown> {
|
|
|
6
6
|
promise: Promise<ManyArray<T>>;
|
|
7
7
|
content?: ManyArray<T>;
|
|
8
8
|
}
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
9
|
export interface PromiseManyArray<T> {
|
|
11
10
|
[LegacyPromiseProxy]: true;
|
|
12
11
|
}
|
|
@@ -37,10 +36,6 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
37
36
|
* @public
|
|
38
37
|
*/
|
|
39
38
|
get length(): number;
|
|
40
|
-
// this will error if someone tries to call
|
|
41
|
-
// A(identifierArray) since it is not configurable
|
|
42
|
-
// which is preferrable to the `meta` override we used
|
|
43
|
-
// before which required importing all of Ember
|
|
44
39
|
get "[]"(): 0 | ManyArray<T> | undefined;
|
|
45
40
|
/**
|
|
46
41
|
* Iterate the proxied content. Called by the glimmer iterator in #each
|
|
@@ -59,7 +54,6 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
59
54
|
* @return
|
|
60
55
|
*/
|
|
61
56
|
reload(options: Omit<BaseFinderOptions, "">): this;
|
|
62
|
-
//---- Properties/Methods from the PromiseProxyMixin that we will keep as our API
|
|
63
57
|
/**
|
|
64
58
|
* Whether the loading promise is still pending
|
|
65
59
|
*
|
|
@@ -113,9 +107,7 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
113
107
|
* @return {Promise}
|
|
114
108
|
*/
|
|
115
109
|
finally(cb: Parameters<Promise<ManyArray<T>>["finally"]>[0]): Promise<unknown>;
|
|
116
|
-
//---- Methods on EmberObject that we should keep
|
|
117
110
|
destroy(): void;
|
|
118
|
-
//---- Methods/Properties on ManyArray that we own and proxy to
|
|
119
111
|
/**
|
|
120
112
|
* Retrieve the links for this relationship
|
|
121
113
|
* @property links
|
|
@@ -57,7 +57,6 @@ export default class BelongsToReference<
|
|
|
57
57
|
* @public
|
|
58
58
|
*/
|
|
59
59
|
type: TypeFromInstanceOrString<Related>;
|
|
60
|
-
// unsubscribe tokens given to us by the notification manager
|
|
61
60
|
___token: object;
|
|
62
61
|
___identifier: ResourceKey<TypeFromInstanceOrString<T>>;
|
|
63
62
|
___relatedToken: object | null;
|
|
@@ -66,7 +66,6 @@ export default class HasManyReference<
|
|
|
66
66
|
* @public
|
|
67
67
|
*/
|
|
68
68
|
type: TypeFromInstanceOrString<Related>;
|
|
69
|
-
// unsubscribe tokens given to us by the notification manager
|
|
70
69
|
___token: object;
|
|
71
70
|
___identifier: ResourceKey<TypeFromInstanceOrString<T>>;
|
|
72
71
|
___relatedTokenMap: Map<ResourceKey, object>;
|
|
@@ -4,6 +4,5 @@ export { Errors } from "./-private/errors.js";
|
|
|
4
4
|
export type { LegacyManyArray as ManyArray } from "@warp-drive/core/store/-private";
|
|
5
5
|
export { PromiseBelongsTo } from "./-private/promise-belongs-to.js";
|
|
6
6
|
export { PromiseManyArray } from "./-private/promise-many-array.js";
|
|
7
|
-
// // Used by tests, migration support
|
|
8
7
|
export { lookupLegacySupport, LEGACY_SUPPORT } from "./-private/legacy-relationships-support.js";
|
|
9
8
|
export type { MaybeHasManyFields, MaybeBelongsToFields, MaybeRelationshipFields } from "./-private/type-utils.js";
|
|
@@ -48,7 +48,6 @@ the method (`serialize` or `deserialize`) as the third parameter.
|
|
|
48
48
|
@class RESTSerializer
|
|
49
49
|
@public
|
|
50
50
|
*/
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
51
|
declare const RESTSerializer: any;
|
|
53
52
|
export { EmbeddedRecordsMixin } from "./-private/embedded-records-mixin.js";
|
|
54
53
|
export { RESTSerializer };
|
|
@@ -210,7 +210,6 @@ export declare class RecordReference {
|
|
|
210
210
|
reload(): Promise<unknown>;
|
|
211
211
|
}
|
|
212
212
|
export declare function getShimClass<T>(store: Store, modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string): ShimModelClass<T>;
|
|
213
|
-
// Mimics the static apis of @ember-data/model
|
|
214
213
|
export declare class ShimModelClass<T = unknown> implements ModelSchema<T> {
|
|
215
214
|
__store: Store;
|
|
216
215
|
modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/legacy",
|
|
3
|
-
"version": "5.7.0-alpha.
|
|
3
|
+
"version": "5.7.0-alpha.39",
|
|
4
4
|
"description": "Decommissioned Packages for WarpDrive | Things your app might still want to maintain use of for a little longer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -32,25 +32,25 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
36
|
-
"@warp-drive/utilities": "5.7.0-alpha.
|
|
35
|
+
"@warp-drive/core": "5.7.0-alpha.39",
|
|
36
|
+
"@warp-drive/utilities": "5.7.0-alpha.39"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@embroider/macros": "^1.18.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@babel/core": "^7.28.
|
|
42
|
+
"@babel/core": "^7.28.3",
|
|
43
43
|
"@babel/plugin-transform-typescript": "^7.28.0",
|
|
44
44
|
"@babel/preset-typescript": "^7.27.1",
|
|
45
|
-
"@types/jquery": "^3.5.
|
|
46
|
-
"@warp-drive/internal-config": "5.7.0-alpha.
|
|
47
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
48
|
-
"@warp-drive/utilities": "5.7.0-alpha.
|
|
45
|
+
"@types/jquery": "^3.5.33",
|
|
46
|
+
"@warp-drive/internal-config": "5.7.0-alpha.39",
|
|
47
|
+
"@warp-drive/core": "5.7.0-alpha.39",
|
|
48
|
+
"@warp-drive/utilities": "5.7.0-alpha.39",
|
|
49
49
|
"ember-source": "~6.6.0",
|
|
50
50
|
"decorator-transforms": "^2.3.0",
|
|
51
|
-
"expect-type": "^1.2.
|
|
51
|
+
"expect-type": "^1.2.2",
|
|
52
52
|
"typescript": "^5.9.2",
|
|
53
|
-
"vite": "^7.1.
|
|
53
|
+
"vite": "^7.1.3"
|
|
54
54
|
},
|
|
55
55
|
"volta": {
|
|
56
56
|
"extends": "../../package.json"
|