@ember-data/legacy-compat 5.3.2 → 5.3.4
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/README.md +8 -0
- package/addon-main.cjs +5 -0
- package/{addon/-private-1aicprWG.js → dist/-private-DVN28hvw.js} +176 -63
- package/dist/-private-DVN28hvw.js.map +1 -0
- package/dist/-private.js +1 -0
- package/dist/builders.js +323 -0
- package/dist/builders.js.map +1 -0
- package/{addon → dist}/index.js +244 -72
- package/dist/index.js.map +1 -0
- package/dist/utils.js +246 -0
- package/dist/utils.js.map +1 -0
- package/package.json +47 -63
- package/unstable-preview-types/-private.d.ts +17 -0
- package/unstable-preview-types/-private.d.ts.map +1 -0
- package/unstable-preview-types/builders/find-all.d.ts +41 -0
- package/unstable-preview-types/builders/find-all.d.ts.map +1 -0
- package/unstable-preview-types/builders/find-record.d.ts +62 -0
- package/unstable-preview-types/builders/find-record.d.ts.map +1 -0
- package/unstable-preview-types/builders/query.d.ts +72 -0
- package/unstable-preview-types/builders/query.d.ts.map +1 -0
- package/unstable-preview-types/builders/save-record.d.ts +40 -0
- package/unstable-preview-types/builders/save-record.d.ts.map +1 -0
- package/unstable-preview-types/builders/utils.d.ts +6 -0
- package/unstable-preview-types/builders/utils.d.ts.map +1 -0
- package/unstable-preview-types/builders.d.ts +18 -0
- package/unstable-preview-types/builders.d.ts.map +1 -0
- package/unstable-preview-types/index.d.ts +162 -0
- package/unstable-preview-types/index.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts +49 -0
- package/unstable-preview-types/legacy-network-handler/fetch-manager.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts +5 -0
- package/unstable-preview-types/legacy-network-handler/identifier-has-id.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts +14 -0
- package/unstable-preview-types/legacy-network-handler/legacy-data-fetch.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts +8 -0
- package/unstable-preview-types/legacy-network-handler/legacy-data-utils.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts +5 -0
- package/unstable-preview-types/legacy-network-handler/legacy-network-handler.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts +549 -0
- package/unstable-preview-types/legacy-network-handler/minimum-adapter-interface.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts +235 -0
- package/unstable-preview-types/legacy-network-handler/minimum-serializer-interface.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts +9 -0
- package/unstable-preview-types/legacy-network-handler/serializer-response.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts +96 -0
- package/unstable-preview-types/legacy-network-handler/snapshot-record-array.d.ts.map +1 -0
- package/unstable-preview-types/legacy-network-handler/snapshot.d.ts +248 -0
- package/unstable-preview-types/legacy-network-handler/snapshot.d.ts.map +1 -0
- package/unstable-preview-types/utils.d.ts +161 -0
- package/unstable-preview-types/utils.d.ts.map +1 -0
- package/addon/-private-1aicprWG.js.map +0 -1
- package/addon/-private.js +0 -1
- package/addon/index.js.map +0 -1
- package/addon-main.js +0 -93
- /package/{addon → dist}/-private.js.map +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/legacy-compat",
|
|
3
3
|
"description": "Compatibility Shims for Older EmberData",
|
|
4
|
-
"version": "5.3.
|
|
4
|
+
"version": "5.3.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
7
7
|
"repository": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"homepage": "https://github.com/emberjs/data",
|
|
13
13
|
"bugs": "https://github.com/emberjs/data/issues",
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">= 18.
|
|
15
|
+
"node": ">= 18.20.3"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"ember-addon"
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
"extends": "../../package.json"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
|
-
"
|
|
25
|
-
"addon",
|
|
24
|
+
"unstable-preview-types",
|
|
25
|
+
"addon-main.cjs",
|
|
26
|
+
"dist",
|
|
26
27
|
"README.md",
|
|
27
28
|
"LICENSE.md",
|
|
28
29
|
"ember-data-logo-dark.svg",
|
|
@@ -30,27 +31,23 @@
|
|
|
30
31
|
],
|
|
31
32
|
"exports": {
|
|
32
33
|
".": {
|
|
33
|
-
"default": "./
|
|
34
|
+
"default": "./dist/index.js"
|
|
34
35
|
},
|
|
35
36
|
"./*": {
|
|
36
|
-
"default": "./
|
|
37
|
+
"default": "./dist/*.js"
|
|
37
38
|
}
|
|
38
39
|
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"lint": "eslint . --quiet --cache --cache-strategy=content --report-unused-disable-directives",
|
|
42
|
+
"build:pkg": "vite build;",
|
|
43
|
+
"sync-hardlinks": "bun run sync-dependencies-meta-injected"
|
|
44
|
+
},
|
|
39
45
|
"ember-addon": {
|
|
40
|
-
"main": "addon-main.
|
|
46
|
+
"main": "addon-main.cjs",
|
|
41
47
|
"type": "addon",
|
|
42
|
-
"version":
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"@ember-data/private-build-infra": "5.3.2",
|
|
46
|
-
"@embroider/macros": "^1.13.5",
|
|
47
|
-
"ember-cli-babel": "^8.2.0",
|
|
48
|
-
"pnpm-sync-dependencies-meta-injected": "0.0.10"
|
|
48
|
+
"version": 2
|
|
49
49
|
},
|
|
50
50
|
"dependenciesMeta": {
|
|
51
|
-
"@ember-data/private-build-infra": {
|
|
52
|
-
"injected": true
|
|
53
|
-
},
|
|
54
51
|
"@ember-data/request": {
|
|
55
52
|
"injected": true
|
|
56
53
|
},
|
|
@@ -66,25 +63,16 @@
|
|
|
66
63
|
"@warp-drive/core-types": {
|
|
67
64
|
"injected": true
|
|
68
65
|
},
|
|
69
|
-
"ember-inflector": {
|
|
70
|
-
"injected": true
|
|
71
|
-
},
|
|
72
66
|
"@ember-data/tracking": {
|
|
73
67
|
"injected": true
|
|
74
68
|
},
|
|
75
|
-
"@ember/
|
|
69
|
+
"@ember-data/request-utils": {
|
|
76
70
|
"injected": true
|
|
77
71
|
},
|
|
78
|
-
"@
|
|
72
|
+
"@warp-drive/build-config": {
|
|
79
73
|
"injected": true
|
|
80
74
|
}
|
|
81
75
|
},
|
|
82
|
-
"peerDependencies": {
|
|
83
|
-
"@ember-data/graph": "5.3.2",
|
|
84
|
-
"@ember-data/json-api": "5.3.2",
|
|
85
|
-
"@ember-data/request": "5.3.2",
|
|
86
|
-
"@ember-data/store": "5.3.2"
|
|
87
|
-
},
|
|
88
76
|
"peerDependenciesMeta": {
|
|
89
77
|
"@ember-data/graph": {
|
|
90
78
|
"optional": true
|
|
@@ -93,44 +81,40 @@
|
|
|
93
81
|
"optional": true
|
|
94
82
|
}
|
|
95
83
|
},
|
|
84
|
+
"dependencies": {
|
|
85
|
+
"@embroider/macros": "^1.16.1",
|
|
86
|
+
"@warp-drive/build-config": "0.0.0-beta.2"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"@ember-data/graph": "5.3.4",
|
|
90
|
+
"@ember-data/json-api": "5.3.4",
|
|
91
|
+
"@ember-data/request": "5.3.4",
|
|
92
|
+
"@ember-data/request-utils": "5.3.4",
|
|
93
|
+
"@ember-data/store": "5.3.4",
|
|
94
|
+
"@ember/test-waiters": "^3.1.0",
|
|
95
|
+
"@warp-drive/core-types": "0.0.0-beta.7"
|
|
96
|
+
},
|
|
96
97
|
"devDependencies": {
|
|
97
|
-
"@babel/
|
|
98
|
-
"@babel/
|
|
99
|
-
"@babel/
|
|
100
|
-
"@babel/
|
|
101
|
-
"@
|
|
102
|
-
"@
|
|
103
|
-
"@
|
|
104
|
-
"@
|
|
105
|
-
"@
|
|
106
|
-
"@
|
|
107
|
-
"@ember-
|
|
108
|
-
"@ember-data/json-api": "5.3.2",
|
|
109
|
-
"@ember-data/request": "5.3.2",
|
|
110
|
-
"@ember-data/request-utils": "5.3.2",
|
|
111
|
-
"@ember-data/store": "5.3.2",
|
|
112
|
-
"@ember-data/tracking": "5.3.2",
|
|
113
|
-
"@ember/string": "^3.1.1",
|
|
114
|
-
"@embroider/addon-dev": "^4.1.2",
|
|
98
|
+
"@babel/core": "^7.24.5",
|
|
99
|
+
"@babel/plugin-transform-typescript": "^7.24.5",
|
|
100
|
+
"@babel/preset-env": "^7.24.5",
|
|
101
|
+
"@babel/preset-typescript": "^7.24.1",
|
|
102
|
+
"@ember-data/graph": "5.3.4",
|
|
103
|
+
"@ember-data/json-api": "5.3.4",
|
|
104
|
+
"@ember-data/request": "5.3.4",
|
|
105
|
+
"@ember-data/request-utils": "5.3.4",
|
|
106
|
+
"@ember-data/store": "5.3.4",
|
|
107
|
+
"@ember-data/tracking": "5.3.4",
|
|
108
|
+
"@ember/test-waiters": "^3.1.0",
|
|
115
109
|
"@glimmer/component": "^1.1.2",
|
|
116
|
-
"@
|
|
117
|
-
"@
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"rollup": "^4.9.6",
|
|
123
|
-
"typescript": "^5.3.3",
|
|
124
|
-
"walk-sync": "^3.0.0"
|
|
110
|
+
"@warp-drive/core-types": "0.0.0-beta.7",
|
|
111
|
+
"@warp-drive/internal-config": "5.3.4",
|
|
112
|
+
"ember-source": "~5.8.0",
|
|
113
|
+
"pnpm-sync-dependencies-meta-injected": "0.0.14",
|
|
114
|
+
"typescript": "^5.4.5",
|
|
115
|
+
"vite": "^5.2.11"
|
|
125
116
|
},
|
|
126
117
|
"ember": {
|
|
127
118
|
"edition": "octane"
|
|
128
|
-
},
|
|
129
|
-
"scripts": {
|
|
130
|
-
"lint": "eslint . --quiet --cache --cache-strategy=content --ext .js,.ts,.mjs,.cjs --report-unused-disable-directives",
|
|
131
|
-
"build:types": "echo \"Types are private\" && exit 0",
|
|
132
|
-
"build:client": "rollup --config && babel ./addon --out-dir addon --plugins=../private-build-infra/src/transforms/babel-plugin-transform-ext.js",
|
|
133
|
-
"_build": "bun run build:client && bun run build:types",
|
|
134
|
-
"_syncPnpm": "bun run sync-dependencies-meta-injected"
|
|
135
119
|
}
|
|
136
|
-
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare module '@ember-data/legacy-compat/-private' {
|
|
2
|
+
import type Store from '@ember-data/store';
|
|
3
|
+
import type { CompatStore } from '@ember-data/legacy-compat';
|
|
4
|
+
/**
|
|
5
|
+
* Utilities - often temporary - for maintaining backwards compatibility with
|
|
6
|
+
* older parts of EmberData.
|
|
7
|
+
*
|
|
8
|
+
@module @ember-data/legacy-compat
|
|
9
|
+
@main @ember-data/legacy-compat
|
|
10
|
+
*/
|
|
11
|
+
export { SnapshotRecordArray } from '@ember-data/legacy-compat/legacy-network-handler/snapshot-record-array';
|
|
12
|
+
export { SaveOp } from '@ember-data/legacy-compat/legacy-network-handler/fetch-manager';
|
|
13
|
+
export { FetchManager } from '@ember-data/legacy-compat/legacy-network-handler/fetch-manager';
|
|
14
|
+
export { Snapshot } from '@ember-data/legacy-compat/legacy-network-handler/snapshot';
|
|
15
|
+
export function upgradeStore(store: Store): asserts store is CompatStore;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=-private.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"-private.d.ts","sourceRoot":"","sources":["../src/-private.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAErC;;;;;;EAME;AACF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,WAAW,CAAG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare module '@ember-data/legacy-compat/builders/find-all' {
|
|
2
|
+
/**
|
|
3
|
+
* @module @ember-data/legacy-compat/builders
|
|
4
|
+
*/
|
|
5
|
+
import type { StoreRequestInput } from '@ember-data/store';
|
|
6
|
+
import type { FindAllOptions } from '@ember-data/store/types';
|
|
7
|
+
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
8
|
+
import type { RequestSignature } from '@warp-drive/core-types/symbols';
|
|
9
|
+
type FindAllRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {
|
|
10
|
+
op: 'findAll';
|
|
11
|
+
data: {
|
|
12
|
+
type: T;
|
|
13
|
+
options: FindAllBuilderOptions;
|
|
14
|
+
};
|
|
15
|
+
[RequestSignature]?: RT;
|
|
16
|
+
};
|
|
17
|
+
type FindAllBuilderOptions<T = unknown> = FindAllOptions<T>;
|
|
18
|
+
/**
|
|
19
|
+
This function builds a request config to perform a `findAll` request for the given type.
|
|
20
|
+
When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.
|
|
21
|
+
Additionally, it takes the same options as `store.findAll`.
|
|
22
|
+
|
|
23
|
+
All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
24
|
+
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
25
|
+
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
26
|
+
|
|
27
|
+
@method findAll
|
|
28
|
+
@deprecated
|
|
29
|
+
@public
|
|
30
|
+
@static
|
|
31
|
+
@for @ember-data/legacy-compat/builders
|
|
32
|
+
@param {string} type the name of the resource
|
|
33
|
+
@param {object} query a query to be used by the adapter
|
|
34
|
+
@param {FindAllBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.findAll
|
|
35
|
+
@return {FindAllRequestInput} request config
|
|
36
|
+
*/
|
|
37
|
+
export function findAllBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, options?: FindAllBuilderOptions<T>): FindAllRequestInput<TypeFromInstance<T>, T[]>;
|
|
38
|
+
export function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;
|
|
39
|
+
export {};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=find-all.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-all.d.ts","sourceRoot":"","sources":["../../src/builders/find-all.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIvE,KAAK,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,iBAAiB,GAAG;IACxF,EAAE,EAAE,SAAS,CAAC;IACd,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC,CAAC;QACR,OAAO,EAAE,qBAAqB,CAAC;KAChC,CAAC;IACF,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;EAkBE;AACF,wBAAgB,cAAc,CAAC,CAAC,SAAS,mBAAmB,EAC1D,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,OAAO,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GACjC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACjD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
declare module '@ember-data/legacy-compat/builders/find-record' {
|
|
2
|
+
/**
|
|
3
|
+
* @module @ember-data/legacy-compat/builders
|
|
4
|
+
*/
|
|
5
|
+
import type { StoreRequestInput } from '@ember-data/store';
|
|
6
|
+
import type { FindRecordOptions } from '@ember-data/store/types';
|
|
7
|
+
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
8
|
+
import type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';
|
|
9
|
+
import type { RequestSignature } from '@warp-drive/core-types/symbols';
|
|
10
|
+
type FindRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {
|
|
11
|
+
op: 'findRecord';
|
|
12
|
+
data: {
|
|
13
|
+
record: ResourceIdentifierObject<T>;
|
|
14
|
+
options: FindRecordBuilderOptions;
|
|
15
|
+
};
|
|
16
|
+
[RequestSignature]?: RT;
|
|
17
|
+
};
|
|
18
|
+
type FindRecordBuilderOptions = Omit<FindRecordOptions, 'preload'>;
|
|
19
|
+
/**
|
|
20
|
+
This function builds a request config to find the record for a given identifier or type and id combination.
|
|
21
|
+
When passed to `store.request`, this config will result in the same behavior as a `store.findRecord` request.
|
|
22
|
+
Additionally, it takes the same options as `store.findRecord`, with the exception of `preload` (which is unsupported).
|
|
23
|
+
|
|
24
|
+
**Example 1**
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { findRecord } from '@ember-data/legacy-compat/builders';
|
|
28
|
+
const { content: post } = await store.request<Post>(findRecord<Post>('post', '1'));
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Example 2**
|
|
32
|
+
|
|
33
|
+
`findRecord` can be called with a single identifier argument instead of the combination
|
|
34
|
+
of `type` (modelName) and `id` as separate arguments. You may recognize this combo as
|
|
35
|
+
the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { findRecord } from '@ember-data/legacy-compat/builders';
|
|
39
|
+
const { content: post } = await store.request<Post>(findRecord<Post>({ type: 'post', id }));
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
43
|
+
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
44
|
+
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
45
|
+
|
|
46
|
+
@method findRecord
|
|
47
|
+
@deprecated
|
|
48
|
+
@public
|
|
49
|
+
@static
|
|
50
|
+
@for @ember-data/legacy-compat/builders
|
|
51
|
+
@param {string|object} resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record
|
|
52
|
+
@param {string|number|object} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved
|
|
53
|
+
@param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.
|
|
54
|
+
@return {FindRecordRequestInput} request config
|
|
55
|
+
*/
|
|
56
|
+
export function findRecordBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput<TypeFromInstance<T>, T>;
|
|
57
|
+
export function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput;
|
|
58
|
+
export function findRecordBuilder<T extends TypedRecordInstance>(resource: ResourceIdentifierObject<TypeFromInstance<T>>, options?: FindRecordBuilderOptions): FindRecordRequestInput<TypeFromInstance<T>, T>;
|
|
59
|
+
export function findRecordBuilder(resource: ResourceIdentifierObject, options?: FindRecordBuilderOptions): FindRecordRequestInput;
|
|
60
|
+
export {};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=find-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-record.d.ts","sourceRoot":"","sources":["../../src/builders/find-record.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,KAAK,EAAqB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIvE,KAAK,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,OAAO,IAAI,iBAAiB,GAAG;IACzF,EAAE,EAAE,YAAY,CAAC;IACjB,IAAI,EAAE;QACJ,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,EAAE,wBAAwB,CAAC;KACnC,CAAC;IACF,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,wBAAwB,GAAG,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCE;AACF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAC7D,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,wBAAwB,GACjC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,sBAAsB,CAAC;AACxH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAC7D,QAAQ,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EACvD,OAAO,CAAC,EAAE,wBAAwB,GACjC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,wBAAwB,EAClC,OAAO,CAAC,EAAE,wBAAwB,GACjC,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
declare module '@ember-data/legacy-compat/builders/query' {
|
|
2
|
+
/**
|
|
3
|
+
* @module @ember-data/legacy-compat/builders
|
|
4
|
+
*/
|
|
5
|
+
import type { StoreRequestInput } from '@ember-data/store';
|
|
6
|
+
import type { LegacyResourceQuery, QueryOptions } from '@ember-data/store/types';
|
|
7
|
+
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
8
|
+
import type { RequestSignature } from '@warp-drive/core-types/symbols';
|
|
9
|
+
type QueryRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {
|
|
10
|
+
op: 'query';
|
|
11
|
+
data: {
|
|
12
|
+
type: T;
|
|
13
|
+
query: LegacyResourceQuery;
|
|
14
|
+
options: QueryBuilderOptions;
|
|
15
|
+
};
|
|
16
|
+
[RequestSignature]?: RT;
|
|
17
|
+
};
|
|
18
|
+
type QueryBuilderOptions = QueryOptions;
|
|
19
|
+
/**
|
|
20
|
+
This function builds a request config for a given type and query object.
|
|
21
|
+
When passed to `store.request`, this config will result in the same behavior as a `store.query` request.
|
|
22
|
+
Additionally, it takes the same options as `store.query`.
|
|
23
|
+
|
|
24
|
+
All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
25
|
+
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
26
|
+
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
27
|
+
|
|
28
|
+
@method query
|
|
29
|
+
@deprecated
|
|
30
|
+
@public
|
|
31
|
+
@static
|
|
32
|
+
@for @ember-data/legacy-compat/builders
|
|
33
|
+
@param {string} type the name of the resource
|
|
34
|
+
@param {object} query a query to be used by the adapter
|
|
35
|
+
@param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query
|
|
36
|
+
@return {QueryRequestInput} request config
|
|
37
|
+
*/
|
|
38
|
+
export function queryBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, query: LegacyResourceQuery<T>, options?: QueryBuilderOptions): QueryRequestInput<TypeFromInstance<T>, T[]>;
|
|
39
|
+
export function queryBuilder(type: string, query: LegacyResourceQuery, options?: QueryBuilderOptions): QueryRequestInput;
|
|
40
|
+
type QueryRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {
|
|
41
|
+
op: 'queryRecord';
|
|
42
|
+
data: {
|
|
43
|
+
type: T;
|
|
44
|
+
query: LegacyResourceQuery;
|
|
45
|
+
options: QueryBuilderOptions;
|
|
46
|
+
};
|
|
47
|
+
[RequestSignature]?: RT;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
This function builds a request config for a given type and query object.
|
|
51
|
+
When passed to `store.request`, this config will result in the same behavior as a `store.queryRecord` request.
|
|
52
|
+
Additionally, it takes the same options as `store.queryRecord`.
|
|
53
|
+
|
|
54
|
+
All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
55
|
+
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
56
|
+
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
57
|
+
|
|
58
|
+
@method queryRecord
|
|
59
|
+
@deprecated
|
|
60
|
+
@public
|
|
61
|
+
@static
|
|
62
|
+
@for @ember-data/legacy-compat/builders
|
|
63
|
+
@param {string} type the name of the resource
|
|
64
|
+
@param {object} query a query to be used by the adapter
|
|
65
|
+
@param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query
|
|
66
|
+
@return {QueryRecordRequestInput} request config
|
|
67
|
+
*/
|
|
68
|
+
export function queryRecordBuilder<T extends TypedRecordInstance>(type: TypeFromInstance<T>, query: LegacyResourceQuery<T>, options?: QueryBuilderOptions): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;
|
|
69
|
+
export function queryRecordBuilder(type: string, query: LegacyResourceQuery, options?: QueryBuilderOptions): QueryRecordRequestInput;
|
|
70
|
+
export {};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/builders/query.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIvE,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,iBAAiB,GAAG;IACtF,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC,CAAC;QACR,KAAK,EAAE,mBAAmB,CAAC;QAC3B,OAAO,EAAE,mBAAmB,CAAC;KAC9B,CAAC;IACF,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,mBAAmB,GAAG,YAAY,CAAC;AAExC;;;;;;;;;;;;;;;;;;EAkBE;AACF,wBAAgB,YAAY,CAAC,CAAC,SAAS,mBAAmB,EACxD,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC7B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC/C,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,mBAAmB,EAC1B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,iBAAiB,CAAC;AAwBrB,KAAK,uBAAuB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,OAAO,IAAI,iBAAiB,GAAG;IAC1F,EAAE,EAAE,aAAa,CAAC;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC,CAAC;QACR,KAAK,EAAE,mBAAmB,CAAC;QAC3B,OAAO,EAAE,mBAAmB,CAAC;KAC9B,CAAC;IACF,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;EAkBE;AACF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,mBAAmB,EAC9D,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC7B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,uBAAuB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AAC1D,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,mBAAmB,EAC1B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare module '@ember-data/legacy-compat/builders/save-record' {
|
|
2
|
+
/**
|
|
3
|
+
* @module @ember-data/legacy-compat/builders
|
|
4
|
+
*/
|
|
5
|
+
import { type StoreRequestInput } from '@ember-data/store';
|
|
6
|
+
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
7
|
+
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
8
|
+
import type { RequestSignature } from '@warp-drive/core-types/symbols';
|
|
9
|
+
type SaveRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {
|
|
10
|
+
op: 'createRecord' | 'deleteRecord' | 'updateRecord';
|
|
11
|
+
data: {
|
|
12
|
+
record: StableRecordIdentifier<T>;
|
|
13
|
+
options: SaveRecordBuilderOptions;
|
|
14
|
+
};
|
|
15
|
+
records: [StableRecordIdentifier<T>];
|
|
16
|
+
[RequestSignature]?: RT;
|
|
17
|
+
};
|
|
18
|
+
type SaveRecordBuilderOptions = Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
This function builds a request config for saving the given record (e.g. creating, updating, or deleting the record).
|
|
21
|
+
When passed to `store.request`, this config will result in the same behavior as a legacy `store.saveRecord` request.
|
|
22
|
+
Additionally, it takes the same options as `store.saveRecord`.
|
|
23
|
+
|
|
24
|
+
All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
25
|
+
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
26
|
+
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
27
|
+
|
|
28
|
+
@method saveRecord
|
|
29
|
+
@deprecated
|
|
30
|
+
@public
|
|
31
|
+
@static
|
|
32
|
+
@for @ember-data/legacy-compat/builders
|
|
33
|
+
@param {object} record a record to save
|
|
34
|
+
@param {SaveRecordBuilderOptions} options optional, may include `adapterOptions` hash which will be passed to adapter.saveRecord
|
|
35
|
+
@return {SaveRecordRequestInput} request config
|
|
36
|
+
*/
|
|
37
|
+
export function saveRecordBuilder<T extends TypedRecordInstance>(record: T, options?: Record<string, unknown>): SaveRecordRequestInput<TypeFromInstance<T>, T>;
|
|
38
|
+
export {};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=save-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-record.d.ts","sourceRoot":"","sources":["../../src/builders/save-record.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAiC,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,KAAK,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,OAAO,IAAI,iBAAiB,GAAG;IACzF,EAAE,EAAE,cAAc,GAAG,cAAc,GAAG,cAAc,CAAC;IACrD,IAAI,EAAE;QACJ,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;QAClC,OAAO,EAAE,wBAAwB,CAAC;KACnC,CAAC;IACF,OAAO,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAWxD;;;;;;;;;;;;;;;;;EAiBE;AACF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAC7D,MAAM,EAAE,CAAC,EACT,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAuChD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare module '@ember-data/legacy-compat/builders/utils' {
|
|
2
|
+
import type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';
|
|
3
|
+
export function isMaybeIdentifier(maybeIdentifier: string | ResourceIdentifierObject): maybeIdentifier is ResourceIdentifierObject;
|
|
4
|
+
export function normalizeModelName(type: string): string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/builders/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAEzF,wBAAgB,iBAAiB,CAC/B,eAAe,EAAE,MAAM,GAAG,wBAAwB,GACjD,eAAe,IAAI,wBAAwB,CAO7C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAsBvD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare module '@ember-data/legacy-compat/builders' {
|
|
2
|
+
/**
|
|
3
|
+
Builders for migrating from `store` methods to `store.request`.
|
|
4
|
+
|
|
5
|
+
These builders enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.
|
|
6
|
+
This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.
|
|
7
|
+
To that end, these builders are deprecated and will be removed in a future version of Ember Data.
|
|
8
|
+
|
|
9
|
+
@module @ember-data/legacy-compat/builders
|
|
10
|
+
@main @ember-data/legacy-compat/builders
|
|
11
|
+
@deprecated
|
|
12
|
+
*/
|
|
13
|
+
export { findAllBuilder as findAll } from '@ember-data/legacy-compat/builders/find-all';
|
|
14
|
+
export { findRecordBuilder as findRecord } from '@ember-data/legacy-compat/builders/find-record';
|
|
15
|
+
export { queryBuilder as query, queryRecordBuilder as queryRecord } from '@ember-data/legacy-compat/builders/query';
|
|
16
|
+
export { saveRecordBuilder as saveRecord } from '@ember-data/legacy-compat/builders/save-record';
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,cAAc,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,EAAE,YAAY,IAAI,KAAK,EAAE,kBAAkB,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE5F,OAAO,EAAE,iBAAiB,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/// <reference path="./-private.d.ts" />
|
|
2
|
+
/// <reference path="./utils.d.ts" />
|
|
3
|
+
/// <reference path="./builders.d.ts" />
|
|
4
|
+
/// <reference path="./builders/find-record.d.ts" />
|
|
5
|
+
/// <reference path="./builders/utils.d.ts" />
|
|
6
|
+
/// <reference path="./builders/query.d.ts" />
|
|
7
|
+
/// <reference path="./builders/find-all.d.ts" />
|
|
8
|
+
/// <reference path="./builders/save-record.d.ts" />
|
|
9
|
+
/// <reference path="./legacy-network-handler/legacy-data-fetch.d.ts" />
|
|
10
|
+
/// <reference path="./legacy-network-handler/minimum-serializer-interface.d.ts" />
|
|
11
|
+
/// <reference path="./legacy-network-handler/serializer-response.d.ts" />
|
|
12
|
+
/// <reference path="./legacy-network-handler/fetch-manager.d.ts" />
|
|
13
|
+
/// <reference path="./legacy-network-handler/minimum-adapter-interface.d.ts" />
|
|
14
|
+
/// <reference path="./legacy-network-handler/snapshot.d.ts" />
|
|
15
|
+
/// <reference path="./legacy-network-handler/legacy-network-handler.d.ts" />
|
|
16
|
+
/// <reference path="./legacy-network-handler/legacy-data-utils.d.ts" />
|
|
17
|
+
/// <reference path="./legacy-network-handler/identifier-has-id.d.ts" />
|
|
18
|
+
/// <reference path="./legacy-network-handler/snapshot-record-array.d.ts" />
|
|
19
|
+
declare module '@ember-data/legacy-compat' {
|
|
20
|
+
import type Store from '@ember-data/store';
|
|
21
|
+
import type { ObjectValue } from '@warp-drive/core-types/json/raw';
|
|
22
|
+
import { FetchManager } from '@ember-data/legacy-compat/-private';
|
|
23
|
+
import type { AdapterPayload, MinimumAdapterInterface } from '@ember-data/legacy-compat/legacy-network-handler/minimum-adapter-interface';
|
|
24
|
+
import type { MinimumSerializerInterface, SerializerOptions } from '@ember-data/legacy-compat/legacy-network-handler/minimum-serializer-interface';
|
|
25
|
+
export { LegacyNetworkHandler } from '@ember-data/legacy-compat/legacy-network-handler/legacy-network-handler';
|
|
26
|
+
export type { MinimumAdapterInterface, MinimumSerializerInterface, SerializerOptions, AdapterPayload };
|
|
27
|
+
/**
|
|
28
|
+
* @module @ember-data/store
|
|
29
|
+
* @class Store
|
|
30
|
+
*/
|
|
31
|
+
export type LegacyStoreCompat = {
|
|
32
|
+
_fetchManager: FetchManager;
|
|
33
|
+
adapterFor(this: Store, modelName: string): MinimumAdapterInterface;
|
|
34
|
+
adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;
|
|
35
|
+
serializerFor<K extends string>(modelName: K, _allowMissing?: boolean): MinimumSerializerInterface | null;
|
|
36
|
+
normalize(modelName: string, payload: ObjectValue): ObjectValue;
|
|
37
|
+
pushPayload(modelName: string, payload: ObjectValue): void;
|
|
38
|
+
serializeRecord(record: unknown, options?: SerializerOptions): unknown;
|
|
39
|
+
_adapterCache: Record<string, MinimumAdapterInterface & {
|
|
40
|
+
store: Store;
|
|
41
|
+
}>;
|
|
42
|
+
_serializerCache: Record<string, MinimumSerializerInterface & {
|
|
43
|
+
store: Store;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
export type CompatStore = Store & LegacyStoreCompat;
|
|
47
|
+
/**
|
|
48
|
+
Returns an instance of the adapter for a given type. For
|
|
49
|
+
example, `adapterFor('person')` will return an instance of
|
|
50
|
+
the adapter located at `app/adapters/person.js`
|
|
51
|
+
|
|
52
|
+
If no `person` adapter is found, this method will look
|
|
53
|
+
for an `application` adapter (the default adapter for
|
|
54
|
+
your entire application).
|
|
55
|
+
|
|
56
|
+
@method adapterFor
|
|
57
|
+
@public
|
|
58
|
+
@param {String} modelName
|
|
59
|
+
@return Adapter
|
|
60
|
+
*/
|
|
61
|
+
export function adapterFor(this: Store, modelName: string): MinimumAdapterInterface;
|
|
62
|
+
export function adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;
|
|
63
|
+
/**
|
|
64
|
+
Returns an instance of the serializer for a given type. For
|
|
65
|
+
example, `serializerFor('person')` will return an instance of
|
|
66
|
+
`App.PersonSerializer`.
|
|
67
|
+
|
|
68
|
+
If no `App.PersonSerializer` is found, this method will look
|
|
69
|
+
for an `App.ApplicationSerializer` (the default serializer for
|
|
70
|
+
your entire application).
|
|
71
|
+
|
|
72
|
+
If a serializer cannot be found on the adapter, it will fall back
|
|
73
|
+
to an instance of `JSONSerializer`.
|
|
74
|
+
|
|
75
|
+
@method serializerFor
|
|
76
|
+
@public
|
|
77
|
+
@param {String} modelName the record to serialize
|
|
78
|
+
@return {Serializer}
|
|
79
|
+
*/
|
|
80
|
+
export function serializerFor(this: Store, modelName: string): MinimumSerializerInterface | null;
|
|
81
|
+
/**
|
|
82
|
+
`normalize` converts a json payload into the normalized form that
|
|
83
|
+
[push](../methods/push?anchor=push) expects.
|
|
84
|
+
|
|
85
|
+
Example
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
socket.on('message', function(message) {
|
|
89
|
+
let modelName = message.model;
|
|
90
|
+
let data = message.data;
|
|
91
|
+
store.push(store.normalize(modelName, data));
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
@method normalize
|
|
96
|
+
@public
|
|
97
|
+
@param {String} modelName The name of the model type for this payload
|
|
98
|
+
@param {Object} payload
|
|
99
|
+
@return {Object} The normalized payload
|
|
100
|
+
*/
|
|
101
|
+
export function normalize(this: Store, modelName: string, payload: ObjectValue): import("@warp-drive/core-types/spec/json-api-raw").SingleResourceDocument;
|
|
102
|
+
/**
|
|
103
|
+
Push some raw data into the store.
|
|
104
|
+
|
|
105
|
+
This method can be used both to push in brand new
|
|
106
|
+
records, as well as to update existing records. You
|
|
107
|
+
can push in more than one type of object at once.
|
|
108
|
+
All objects should be in the format expected by the
|
|
109
|
+
serializer.
|
|
110
|
+
|
|
111
|
+
```app/serializers/application.js
|
|
112
|
+
import RESTSerializer from '@ember-data/serializer/rest';
|
|
113
|
+
|
|
114
|
+
export default class ApplicationSerializer extends RESTSerializer;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
let pushData = {
|
|
119
|
+
posts: [
|
|
120
|
+
{ id: 1, postTitle: "Great post", commentIds: [2] }
|
|
121
|
+
],
|
|
122
|
+
comments: [
|
|
123
|
+
{ id: 2, commentBody: "Insightful comment" }
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
store.pushPayload(pushData);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
By default, the data will be deserialized using a default
|
|
131
|
+
serializer (the application serializer if it exists).
|
|
132
|
+
|
|
133
|
+
Alternatively, `pushPayload` will accept a model type which
|
|
134
|
+
will determine which serializer will process the payload.
|
|
135
|
+
|
|
136
|
+
```app/serializers/application.js
|
|
137
|
+
import RESTSerializer from '@ember-data/serializer/rest';
|
|
138
|
+
|
|
139
|
+
export default class ApplicationSerializer extends RESTSerializer;
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```app/serializers/post.js
|
|
143
|
+
import JSONSerializer from '@ember-data/serializer/json';
|
|
144
|
+
|
|
145
|
+
export default JSONSerializer;
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
store.pushPayload(pushData); // Will use the application serializer
|
|
150
|
+
store.pushPayload('post', pushData); // Will use the post serializer
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
@method pushPayload
|
|
154
|
+
@public
|
|
155
|
+
@param {String} modelName Optionally, a model type used to determine which serializer will be used
|
|
156
|
+
@param {Object} inputPayload
|
|
157
|
+
*/
|
|
158
|
+
export function pushPayload(this: Store, modelName: string, inputPayload: ObjectValue): void;
|
|
159
|
+
export function serializeRecord(this: Store, record: unknown, options?: SerializerOptions): unknown;
|
|
160
|
+
export function cleanup(this: Store): void;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAI3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAC;AAClH,OAAO,KAAK,EACV,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,uDAAuD,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AAEvF,YAAY,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC;AAEvG;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAAC;IACpE,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,GAAG,uBAAuB,GAAG,SAAS,CAAC;IAErG,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,0BAA0B,GAAG,IAAI,CAAC;IAE1G,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;IAChE,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3D,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAEvE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;IAC1E,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,GAAG;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CACjF,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,iBAAiB,CAAC;AAEpD;;;;;;;;;;;;;IAaI;AACJ,wBAAgB,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAAC;AACpF,wBAAgB,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,GAAG,uBAAuB,GAAG,SAAS,CAAC;AA8CrH;;;;;;;;;;;;;;;;IAgBI;AACJ,wBAAgB,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,GAAG,0BAA0B,GAAG,IAAI,CAwC/F;AAED;;;;;;;;;;;;;;;;;;;IAmBI;AAEJ,wBAAgB,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,6EAmB7E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuDI;AAEJ,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,GAAG,IAAI,CAgB3F;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAQlG;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK,QAgBlC"}
|