@warp-drive/legacy 5.8.0-alpha.22 → 5.8.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/declarations/index.d.ts
CHANGED
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
* @mergeModuleWith <project>
|
|
4
4
|
*/
|
|
5
5
|
import { Store, type StoreSetupOptions } from "@warp-drive/core";
|
|
6
|
+
import type { CacheCapabilitiesManager } from "@warp-drive/core/types";
|
|
7
|
+
import type { Cache } from "@warp-drive/core/types/cache";
|
|
6
8
|
import type { ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
|
|
7
|
-
interface _LegacyStoreSetupOptions extends Omit<StoreSetupOptions
|
|
9
|
+
interface _LegacyStoreSetupOptions<T extends Cache> extends Omit<StoreSetupOptions<T>, "schemas"> {
|
|
8
10
|
schemas?: Array<ResourceSchema | ObjectSchema>;
|
|
9
11
|
/**
|
|
10
12
|
* Whether to include support for ModelFragments migrations.
|
|
11
13
|
*/
|
|
12
14
|
modelFragments?: boolean;
|
|
13
15
|
}
|
|
14
|
-
export interface LegacyModelStoreSetupOptions extends _LegacyStoreSetupOptions {
|
|
16
|
+
export interface LegacyModelStoreSetupOptions<T extends Cache> extends _LegacyStoreSetupOptions<T> {
|
|
15
17
|
/**
|
|
16
18
|
* If true, it is presumed that no requests require use of the LegacyNetworkHandler
|
|
17
19
|
* and associated adapters/serializer methods.
|
|
@@ -23,7 +25,7 @@ export interface LegacyModelStoreSetupOptions extends _LegacyStoreSetupOptions {
|
|
|
23
25
|
*/
|
|
24
26
|
legacyRequests?: false;
|
|
25
27
|
}
|
|
26
|
-
export interface LegacyModelAndNetworkStoreSetupOptions extends _LegacyStoreSetupOptions {
|
|
28
|
+
export interface LegacyModelAndNetworkStoreSetupOptions<T extends Cache> extends _LegacyStoreSetupOptions<T> {
|
|
27
29
|
/**
|
|
28
30
|
* If true, it is presumed that no requests require use of the LegacyNetworkHandler
|
|
29
31
|
* and associated adapters/serializer methods.
|
|
@@ -35,7 +37,7 @@ export interface LegacyModelAndNetworkStoreSetupOptions extends _LegacyStoreSetu
|
|
|
35
37
|
*/
|
|
36
38
|
legacyRequests?: false;
|
|
37
39
|
}
|
|
38
|
-
export interface LegacyModelAndNetworkAndRequestStoreSetupOptions extends _LegacyStoreSetupOptions {
|
|
40
|
+
export interface LegacyModelAndNetworkAndRequestStoreSetupOptions<T extends Cache> extends _LegacyStoreSetupOptions<T> {
|
|
39
41
|
/**
|
|
40
42
|
* If true, it is presumed that no requests require use of the LegacyNetworkHandler
|
|
41
43
|
* and associated adapters/serializer methods.
|
|
@@ -47,11 +49,22 @@ export interface LegacyModelAndNetworkAndRequestStoreSetupOptions extends _Legac
|
|
|
47
49
|
*/
|
|
48
50
|
legacyRequests: true;
|
|
49
51
|
}
|
|
50
|
-
export type LegacyStoreSetupOptions = LegacyModelStoreSetupOptions | LegacyModelAndNetworkStoreSetupOptions | LegacyModelAndNetworkAndRequestStoreSetupOptions
|
|
52
|
+
export type LegacyStoreSetupOptions<T extends Cache = Cache> = LegacyModelStoreSetupOptions<T> | LegacyModelAndNetworkStoreSetupOptions<T> | LegacyModelAndNetworkAndRequestStoreSetupOptions<T>;
|
|
53
|
+
export declare class ConfiguredStore<T extends {
|
|
54
|
+
cache: Cache;
|
|
55
|
+
}> extends Store {
|
|
56
|
+
createCache(capabilities: CacheCapabilitiesManager): T["cache"];
|
|
57
|
+
}
|
|
51
58
|
/**
|
|
52
59
|
* Use the legacy store with the given options.
|
|
53
60
|
*/
|
|
54
|
-
export declare function useLegacyStore(options: LegacyModelStoreSetupOptions
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
export declare function useLegacyStore<T extends Cache>(options: LegacyModelStoreSetupOptions<T>, StoreKlass?: typeof Store): typeof ConfiguredStore<{
|
|
62
|
+
cache: T;
|
|
63
|
+
}>;
|
|
64
|
+
export declare function useLegacyStore<T extends Cache>(options: LegacyModelAndNetworkStoreSetupOptions<T>, StoreKlass?: typeof Store): typeof ConfiguredStore<{
|
|
65
|
+
cache: T;
|
|
66
|
+
}>;
|
|
67
|
+
export declare function useLegacyStore<T extends Cache>(options: LegacyModelAndNetworkAndRequestStoreSetupOptions<T>, StoreKlass?: typeof Store): typeof ConfiguredStore<{
|
|
68
|
+
cache: T;
|
|
69
|
+
}>;
|
|
57
70
|
export {};
|
|
@@ -7,7 +7,7 @@ import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
|
7
7
|
import type { ObjectValue } from "@warp-drive/core/types/json/raw";
|
|
8
8
|
import type { TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
|
|
9
9
|
import type { Derivation, HashFn, Transformation } from "@warp-drive/core/types/schema/concepts";
|
|
10
|
-
import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyResourceSchema, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
|
|
10
|
+
import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyResourceSchema, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
|
|
11
11
|
import type { WithPartial } from "@warp-drive/core/types/utils";
|
|
12
12
|
import type { Snapshot } from "../compat/-private.js";
|
|
13
13
|
import type { MinimalLegacyRecord } from "./-private/model-methods.js";
|
|
@@ -222,6 +222,9 @@ export declare class DelegatingSchemaService implements SchemaService {
|
|
|
222
222
|
fields(resource: ResourceKey | {
|
|
223
223
|
type: string;
|
|
224
224
|
}): Map<string, FieldSchema>;
|
|
225
|
+
cacheFields?(resource: {
|
|
226
|
+
type: string;
|
|
227
|
+
}): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
225
228
|
transformation(field: GenericField | ObjectField | ArrayField | {
|
|
226
229
|
type: string;
|
|
227
230
|
}): Transformation;
|
package/dist/index.js
CHANGED
|
@@ -128,9 +128,6 @@ function useLegacyStore(options, StoreKlass = Store) {
|
|
|
128
128
|
options.modelFragments ? fragmentsModelFor.call(this, type) : false) ||
|
|
129
129
|
// fallback to ShimModelClass
|
|
130
130
|
super.modelFor(type);
|
|
131
|
-
|
|
132
|
-
// eslint-disable-next-line no-console
|
|
133
|
-
console.log(`model for ${type}`, klass);
|
|
134
131
|
return klass;
|
|
135
132
|
}
|
|
136
133
|
adapterFor(modelName, _allowMissing) {
|
|
@@ -454,6 +454,14 @@ class DelegatingSchemaService {
|
|
|
454
454
|
}
|
|
455
455
|
return this._secondary.fields(resource);
|
|
456
456
|
}
|
|
457
|
+
cacheFields(resource) {
|
|
458
|
+
if (this._preferred.cacheFields?.(resource)) {
|
|
459
|
+
return this._preferred.cacheFields(resource);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// @ts-expect-error
|
|
463
|
+
return this._secondary.cacheFields?.(resource);
|
|
464
|
+
}
|
|
457
465
|
transformation(field) {
|
|
458
466
|
return this._preferred.transformation(field);
|
|
459
467
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/legacy",
|
|
3
|
-
"version": "5.8.0-alpha.
|
|
3
|
+
"version": "5.8.0-alpha.23",
|
|
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,8 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@warp-drive/core": "5.8.0-alpha.
|
|
36
|
-
"@warp-drive/utilities": "5.8.0-alpha.
|
|
35
|
+
"@warp-drive/core": "5.8.0-alpha.23",
|
|
36
|
+
"@warp-drive/utilities": "5.8.0-alpha.23"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@embroider/macros": "^1.18.1"
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@babel/plugin-transform-typescript": "^7.28.0",
|
|
44
44
|
"@babel/preset-typescript": "^7.27.1",
|
|
45
45
|
"@types/jquery": "^3.5.33",
|
|
46
|
-
"@warp-drive/internal-config": "5.8.0-alpha.
|
|
47
|
-
"@warp-drive/core": "5.8.0-alpha.
|
|
48
|
-
"@warp-drive/utilities": "5.8.0-alpha.
|
|
46
|
+
"@warp-drive/internal-config": "5.8.0-alpha.23",
|
|
47
|
+
"@warp-drive/core": "5.8.0-alpha.23",
|
|
48
|
+
"@warp-drive/utilities": "5.8.0-alpha.23",
|
|
49
49
|
"ember-source": "~6.6.0",
|
|
50
50
|
"decorator-transforms": "^2.3.0",
|
|
51
51
|
"expect-type": "^1.2.2",
|