@ember-data/store 5.4.1-beta.1 → 5.4.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/-private.js +2 -1
- package/dist/-private.js.map +1 -1
- package/dist/configure-BfLLW6GY.js +161 -0
- package/dist/configure-BfLLW6GY.js.map +1 -0
- package/dist/configure.js +1 -0
- package/dist/configure.js.map +1 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/{many-array-BwVo-2vv.js → request-state-uRtpn0Lc.js} +919 -129
- package/dist/request-state-uRtpn0Lc.js.map +1 -0
- package/package.json +19 -11
- package/unstable-preview-types/-private/cache-handler/types.d.ts +2 -2
- package/unstable-preview-types/-private/document.d.ts +9 -9
- package/unstable-preview-types/-private/document.d.ts.map +1 -1
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +1 -1
- package/unstable-preview-types/-private/managers/cache-manager.d.ts +7 -7
- package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -1
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +1 -1
- package/unstable-preview-types/-private/network/request-cache.d.ts +8 -8
- package/unstable-preview-types/-private/network/request-cache.d.ts.map +1 -1
- package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts +289 -0
- package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts.map +1 -0
- package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts +92 -0
- package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts.map +1 -0
- package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts +172 -0
- package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts.map +1 -0
- package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts +32 -0
- package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts.map +1 -0
- package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts +276 -0
- package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts.map +1 -0
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +4 -9
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/record-arrays/many-array.d.ts +10 -6
- package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/store-service.d.ts +21 -15
- package/unstable-preview-types/-private/store-service.d.ts.map +1 -1
- package/unstable-preview-types/-private.d.ts +7 -2
- package/unstable-preview-types/-private.d.ts.map +1 -1
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +4 -3
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +1 -1
- package/unstable-preview-types/-types/q/schema-service.d.ts +36 -48
- package/unstable-preview-types/-types/q/schema-service.d.ts.map +1 -1
- package/unstable-preview-types/configure.d.ts +21 -0
- package/unstable-preview-types/configure.d.ts.map +1 -0
- package/unstable-preview-types/index.d.ts +35 -29
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/dist/many-array-BwVo-2vv.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/store",
|
|
3
|
-
"version": "5.4.1-beta.
|
|
3
|
+
"version": "5.4.1-beta.2",
|
|
4
4
|
"description": "The core of EmberData. Provides the Store service which coordinates the cache with the network and presentation layers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -33,26 +33,34 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@embroider/macros": "^1.16.12",
|
|
36
|
-
"@warp-drive/build-config": "5.4.1-beta.
|
|
36
|
+
"@warp-drive/build-config": "5.4.1-beta.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
|
|
40
|
-
"@ember-data/request": "5.4.1-beta.
|
|
41
|
-
"@ember-data/request-utils": "5.4.1-beta.
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
40
|
+
"@ember-data/request": "5.4.1-beta.2",
|
|
41
|
+
"@ember-data/request-utils": "5.4.1-beta.2",
|
|
42
|
+
"@warp-drive/core-types": "5.4.1-beta.2",
|
|
43
|
+
"@ember-data/tracking": "5.4.1-beta.2"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"@ember-data/tracking": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"ember-source": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
44
52
|
},
|
|
45
53
|
"devDependencies": {
|
|
46
54
|
"@babel/core": "^7.26.10",
|
|
47
55
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
48
56
|
"@babel/preset-env": "^7.26.9",
|
|
49
57
|
"@babel/preset-typescript": "^7.27.0",
|
|
50
|
-
"@ember-data/request": "5.4.1-beta.
|
|
51
|
-
"@ember-data/request-utils": "5.4.1-beta.
|
|
52
|
-
"@ember-data/tracking": "5.4.1-beta.1",
|
|
58
|
+
"@ember-data/request": "5.4.1-beta.2",
|
|
59
|
+
"@ember-data/request-utils": "5.4.1-beta.2",
|
|
53
60
|
"@glimmer/component": "^2.0.0",
|
|
54
|
-
"@warp-drive/core-types": "5.4.1-beta.
|
|
55
|
-
"@warp-drive/internal-config": "5.4.1-beta.
|
|
61
|
+
"@warp-drive/core-types": "5.4.1-beta.2",
|
|
62
|
+
"@warp-drive/internal-config": "5.4.1-beta.2",
|
|
63
|
+
"@ember-data/tracking": "5.4.1-beta.2",
|
|
56
64
|
"decorator-transforms": "^2.3.0",
|
|
57
65
|
"ember-source": "~6.3.0",
|
|
58
66
|
"expect-type": "^1.2.1",
|
|
@@ -31,7 +31,7 @@ declare module '@ember-data/store/-private/cache-handler/types' {
|
|
|
31
31
|
* @public
|
|
32
32
|
* @param {StableDocumentIdentifier} identifier
|
|
33
33
|
* @param {Store} store
|
|
34
|
-
* @return {
|
|
34
|
+
* @return {Boolean} true if the request is considered hard expired
|
|
35
35
|
*/
|
|
36
36
|
isHardExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
|
|
37
37
|
/**
|
|
@@ -47,7 +47,7 @@ declare module '@ember-data/store/-private/cache-handler/types' {
|
|
|
47
47
|
* @public
|
|
48
48
|
* @param {StableDocumentIdentifier} identifier
|
|
49
49
|
* @param {Store} store
|
|
50
|
-
* @return {
|
|
50
|
+
* @return {Boolean} true if the request is considered soft expired
|
|
51
51
|
*/
|
|
52
52
|
isSoftExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
|
|
53
53
|
/**
|
|
@@ -30,7 +30,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
32
|
* @property links
|
|
33
|
-
* @type {
|
|
33
|
+
* @type {Object|undefined} - a links object
|
|
34
34
|
* @public
|
|
35
35
|
*/
|
|
36
36
|
readonly links?: PaginationLinks;
|
|
@@ -45,7 +45,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
45
45
|
*
|
|
46
46
|
* @property data
|
|
47
47
|
* @public
|
|
48
|
-
* @type {
|
|
48
|
+
* @type {Object|Array<object>|null|undefined} - a data object
|
|
49
49
|
*/
|
|
50
50
|
readonly data?: T;
|
|
51
51
|
/**
|
|
@@ -53,7 +53,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
53
53
|
*
|
|
54
54
|
* @property errors
|
|
55
55
|
* @public
|
|
56
|
-
* @type {
|
|
56
|
+
* @type {Object|undefined} - an errors object
|
|
57
57
|
*/
|
|
58
58
|
readonly errors?: object[];
|
|
59
59
|
/**
|
|
@@ -61,7 +61,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
61
61
|
*
|
|
62
62
|
* @property meta
|
|
63
63
|
* @public
|
|
64
|
-
* @type {
|
|
64
|
+
* @type {Object|undefined} - a meta object
|
|
65
65
|
*/
|
|
66
66
|
readonly meta?: Meta;
|
|
67
67
|
/**
|
|
@@ -88,7 +88,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
88
88
|
*
|
|
89
89
|
* @method fetch
|
|
90
90
|
* @public
|
|
91
|
-
* @param {
|
|
91
|
+
* @param {Object} options
|
|
92
92
|
* @return Promise<Document>
|
|
93
93
|
*/
|
|
94
94
|
fetch(options?: Partial<RequestInfo<T, ReactiveDocument<T>>>): Promise<ReactiveDocument<T>>;
|
|
@@ -99,7 +99,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
99
99
|
*
|
|
100
100
|
* @method next
|
|
101
101
|
* @public
|
|
102
|
-
* @param {
|
|
102
|
+
* @param {Object} options
|
|
103
103
|
* @return Promise<Document | null>
|
|
104
104
|
*/
|
|
105
105
|
next(options?: Partial<RequestInfo<T, ReactiveDocument<T>>>): Promise<ReactiveDocument<T> | null>;
|
|
@@ -110,7 +110,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
110
110
|
*
|
|
111
111
|
* @method prev
|
|
112
112
|
* @public
|
|
113
|
-
* @param {
|
|
113
|
+
* @param {Object} options
|
|
114
114
|
* @return Promise<Document | null>
|
|
115
115
|
*/
|
|
116
116
|
prev(options?: Partial<RequestInfo<T, ReactiveDocument<T>>>): Promise<ReactiveDocument<T> | null>;
|
|
@@ -121,7 +121,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
121
121
|
*
|
|
122
122
|
* @method first
|
|
123
123
|
* @public
|
|
124
|
-
* @param {
|
|
124
|
+
* @param {Object} options
|
|
125
125
|
* @return Promise<Document | null>
|
|
126
126
|
*/
|
|
127
127
|
first(options?: Partial<RequestInfo<T, ReactiveDocument<T>>>): Promise<ReactiveDocument<T> | null>;
|
|
@@ -132,7 +132,7 @@ declare module '@ember-data/store/-private/document' {
|
|
|
132
132
|
*
|
|
133
133
|
* @method last
|
|
134
134
|
* @public
|
|
135
|
-
* @param {
|
|
135
|
+
* @param {Object} options
|
|
136
136
|
* @return Promise<Document | null>
|
|
137
137
|
*/
|
|
138
138
|
last(options?: Partial<RequestInfo<T, ReactiveDocument<T>>>): Promise<ReactiveDocument<T> | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/-private/document.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/-private/document.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AACxF,OAAO,KAAK,EAAkC,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7G,OAAO,KAAK,EAAQ,IAAI,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAM5F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C;;;;;;;;;;;GAWG;AACH,qBAAa,gBAAgB,CAAC,CAAC;;IAC7B;;;;;;;;;;;;;;OAcG;IACH,SAAiB,KAAK,CAAC,EAAE,eAAe,CAAC;IACzC;;;;;;;;;;;;OAYG;IACH,SAAiB,IAAI,CAAC,EAAE,CAAC,CAAC;IAE1B;;;;;;OAMG;IACH,SAAiB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnC;;;;;;OAMG;IACH,SAAiB,IAAI,CAAC,EAAE,IAAI,CAAC;IAE7B;;;;;;OAMG;IACH,SAAiB,UAAU,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAE7D,mBAA2B,MAAM,EAAE,KAAK,CAAC;IACzC,mBAA2B,WAAW,EAAE;QAAE,QAAQ,EAAE,gBAAgB,CAAC;QAAC,OAAO,EAAE,oBAAoB,CAAA;KAAE,GAAG,IAAI,CAAC;gBAG3G,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,wBAAwB,GAAG,IAAI,EAC3C,UAAU,EAAE;QAAE,QAAQ,EAAE,gBAAgB,CAAC;QAAC,OAAO,EAAE,oBAAoB,CAAA;KAAE,GAAG,IAAI;IAiDlF;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO,GAAE,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAO/F;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAO,GAAE,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAIrG;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAO,GAAE,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAIrG;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO,GAAE,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAItG;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAO,GAAE,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAIrG;;;;;;;;;;;;OAYG;IACH,MAAM,IAAI,MAAM;CAiBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-reference.d.ts","sourceRoot":"","sources":["../../../src/-private/legacy-model-support/record-reference.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record-reference.d.ts","sourceRoot":"","sources":["../../../src/-private/legacy-model-support/record-reference.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF;;EAEE;AACF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAEvF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAG3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;EAEE;AAEF;;;;;;EAME;AACF,MAAM,CAAC,OAAO,OAAO,eAAe;IAC1B,KAAK,EAAE,KAAK,CAAC;IAErB,QAAQ,EAAG,MAAM,CAAC;IAClB,aAAa,EAAE,sBAAsB,CAAC;IAE9B,IAAI,EAAE,MAAM,CAAC;gBAET,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,sBAAsB;IAa5D,OAAO;IAIP,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;;;;;;;;;;;;;;MAiBE;IACF,EAAE;IAMF;;;;;;;;;;;;;;;;;MAiBE;IACF,UAAU,IAAI,sBAAsB;IAIpC;;;;;;;;;;;;;;;;MAgBE;IACF,UAAU,IAAI,UAAU;IAIxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsCE;IACF,IAAI,CAAC,eAAe,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAO9G;;;;;;;;;;;;;;;;MAgBE;IACF,KAAK,IAAI,oBAAoB,GAAG,IAAI;IAIpC;;;;;;;;;;;;;;;;MAgBE;IACF,IAAI;IAQJ;;;;;;;;;;;;;;;;MAgBE;IACF,MAAM;CAOP"}
|
|
@@ -318,7 +318,7 @@ declare module '@ember-data/store/-private/managers/cache-manager' {
|
|
|
318
318
|
* @method hasChangedAttrs
|
|
319
319
|
* @public
|
|
320
320
|
* @param identifier
|
|
321
|
-
* @return {
|
|
321
|
+
* @return {Boolean}
|
|
322
322
|
*/
|
|
323
323
|
hasChangedAttrs(identifier: StableRecordIdentifier): boolean;
|
|
324
324
|
/**
|
|
@@ -364,7 +364,7 @@ declare module '@ember-data/store/-private/managers/cache-manager' {
|
|
|
364
364
|
* @method hasChangedRelationships
|
|
365
365
|
* @public
|
|
366
366
|
* @param {StableRecordIdentifier} identifier
|
|
367
|
-
* @return {
|
|
367
|
+
* @return {Boolean}
|
|
368
368
|
*/
|
|
369
369
|
hasChangedRelationships(identifier: StableRecordIdentifier): boolean;
|
|
370
370
|
/**
|
|
@@ -377,7 +377,7 @@ declare module '@ember-data/store/-private/managers/cache-manager' {
|
|
|
377
377
|
* @method rollbackRelationships
|
|
378
378
|
* @public
|
|
379
379
|
* @param {StableRecordIdentifier} identifier
|
|
380
|
-
* @return {
|
|
380
|
+
* @return {String[]} the names of relationships that were restored
|
|
381
381
|
*/
|
|
382
382
|
rollbackRelationships(identifier: StableRecordIdentifier): string[];
|
|
383
383
|
/**
|
|
@@ -425,7 +425,7 @@ declare module '@ember-data/store/-private/managers/cache-manager' {
|
|
|
425
425
|
* @method isEmpty
|
|
426
426
|
* @public
|
|
427
427
|
* @param identifier
|
|
428
|
-
* @return {
|
|
428
|
+
* @return {Boolean}
|
|
429
429
|
*/
|
|
430
430
|
isEmpty(identifier: StableRecordIdentifier): boolean;
|
|
431
431
|
/**
|
|
@@ -435,7 +435,7 @@ declare module '@ember-data/store/-private/managers/cache-manager' {
|
|
|
435
435
|
* @method isNew
|
|
436
436
|
* @public
|
|
437
437
|
* @param identifier
|
|
438
|
-
* @return {
|
|
438
|
+
* @return {Boolean}
|
|
439
439
|
*/
|
|
440
440
|
isNew(identifier: StableRecordIdentifier): boolean;
|
|
441
441
|
/**
|
|
@@ -445,7 +445,7 @@ declare module '@ember-data/store/-private/managers/cache-manager' {
|
|
|
445
445
|
* @method isDeleted
|
|
446
446
|
* @public
|
|
447
447
|
* @param identifier
|
|
448
|
-
* @return {
|
|
448
|
+
* @return {Boolean}
|
|
449
449
|
*/
|
|
450
450
|
isDeleted(identifier: StableRecordIdentifier): boolean;
|
|
451
451
|
/**
|
|
@@ -455,7 +455,7 @@ declare module '@ember-data/store/-private/managers/cache-manager' {
|
|
|
455
455
|
* @method isDeletionCommitted
|
|
456
456
|
* @public
|
|
457
457
|
* @param identifier
|
|
458
|
-
* @return {
|
|
458
|
+
* @return {Boolean}
|
|
459
459
|
*/
|
|
460
460
|
isDeletionCommitted(identifier: StableRecordIdentifier): boolean;
|
|
461
461
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/notification-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"notification-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/notification-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAK1G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AACvE,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAQ/F,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,eAAe,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAC;AAEhH,MAAM,WAAW,oBAAoB;IACnC,CAAC,UAAU,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,YAAY,GAAG,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3G,CAAC,UAAU,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GA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EAAE,YAAY,GAAG,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IACxG,MAAM,CAAC,UAAU,EAAE,sBAAsB,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO;IACpG,MAAM,CAAC,UAAU,EAAE,sBAAsB,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO;IAC1E,MAAM,CAAC,UAAU,EAAE,wBAAwB,EAAE,KAAK,EAAE,sBAAsB,GAAG,OAAO;IAmEpF,YAAY,CAAC,EAAE,EAAE,MAAM,IAAI;IAI3B,eAAe,IAAI,OAAO;IAkB1B,MAAM;IAiBN,kBAAkB,CAAC,UAAU,EAAE,sBAAsB,EAAE,KAAK,EAAE,YAAY,GAAG,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IACpH,kBAAkB,CAAC,UAAU,EAAE,sBAAsB,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO;IAChH,kBAAkB,CAAC,UAAU,EAAE,sBAAsB,GAAG,wBAAwB,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO;IAyCjH,OAAO;CAIR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-array-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/record-array-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record-array-manager.d.ts","sourceRoot":"","sources":["../../../src/-private/managers/record-array-manager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC1G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAI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record<string, unknown>;
|
|
21
21
|
}
|
|
22
22
|
export type RequestStates = 'pending' | 'fulfilled' | 'rejected';
|
|
23
|
-
export interface
|
|
23
|
+
export interface RequestCacheRequestState {
|
|
24
24
|
state: RequestStates;
|
|
25
25
|
type: 'query' | 'mutation';
|
|
26
26
|
request: Request;
|
|
@@ -29,11 +29,11 @@ declare module '@ember-data/store/-private/network/request-cache' {
|
|
|
29
29
|
export interface Response {
|
|
30
30
|
data: unknown;
|
|
31
31
|
}
|
|
32
|
-
interface InternalRequest extends
|
|
32
|
+
interface InternalRequest extends RequestCacheRequestState {
|
|
33
33
|
[Touching]: StableRecordIdentifier[];
|
|
34
34
|
[RequestPromise]?: Promise<unknown>;
|
|
35
35
|
}
|
|
36
|
-
export type RequestSubscription = (requestState:
|
|
36
|
+
export type RequestSubscription = (requestState: RequestCacheRequestState) => void;
|
|
37
37
|
/**
|
|
38
38
|
* The RequestStateService is used to track the state of requests
|
|
39
39
|
* for fetching or updating known resource identifies that are inflight.
|
|
@@ -82,7 +82,7 @@ declare module '@ember-data/store/-private/network/request-cache' {
|
|
|
82
82
|
* @method subscribeForRecord
|
|
83
83
|
* @public
|
|
84
84
|
* @param {StableRecordIdentifier} identifier
|
|
85
|
-
* @param {(state:
|
|
85
|
+
* @param {(state: RequestCacheRequestState) => void} callback
|
|
86
86
|
*/
|
|
87
87
|
subscribeForRecord(identifier: StableRecordIdentifier, callback: RequestSubscription): void;
|
|
88
88
|
/**
|
|
@@ -91,18 +91,18 @@ declare module '@ember-data/store/-private/network/request-cache' {
|
|
|
91
91
|
* @method getPendingRequestsForRecord
|
|
92
92
|
* @public
|
|
93
93
|
* @param {StableRecordIdentifier} identifier
|
|
94
|
-
* @return {
|
|
94
|
+
* @return {RequestCacheRequestState[]} an array of request states for any pending requests for the given identifier
|
|
95
95
|
*/
|
|
96
|
-
getPendingRequestsForRecord(identifier: StableRecordIdentifier):
|
|
96
|
+
getPendingRequestsForRecord(identifier: StableRecordIdentifier): RequestCacheRequestState[];
|
|
97
97
|
/**
|
|
98
98
|
* Retrieve the last completed request for a given resource identity.
|
|
99
99
|
*
|
|
100
100
|
* @method getLastRequestForRecord
|
|
101
101
|
* @public
|
|
102
102
|
* @param {StableRecordIdentifier} identifier
|
|
103
|
-
* @return {
|
|
103
|
+
* @return {RequestCacheRequestState | null} the state of the most recent request for the given identifier
|
|
104
104
|
*/
|
|
105
|
-
getLastRequestForRecord(identifier: StableRecordIdentifier):
|
|
105
|
+
getLastRequestForRecord(identifier: StableRecordIdentifier): RequestCacheRequestState | null;
|
|
106
106
|
}
|
|
107
107
|
export {};
|
|
108
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-cache.d.ts","sourceRoot":"","sources":["../../../src/-private/network/request-cache.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,QAAA,MAAM,QAAQ,gCAAiD,CAAC;AAChE,eAAO,MAAM,cAAc,sCAAsD,CAAC;AAGlF,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACvC,gBAAgB,EAAE,sBAAsB,CAAC;CAC1C;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,EAAE,EAAE,YAAY,CAAC;CAClB;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,EAAE,EAAE,YAAY,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,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
|
3
|
+
/**
|
|
4
|
+
* The state of a promise in the "pending"
|
|
5
|
+
* state. This is the default initial state.
|
|
6
|
+
*
|
|
7
|
+
* @typedoc
|
|
8
|
+
*/
|
|
9
|
+
export interface PendingPromise {
|
|
10
|
+
/**
|
|
11
|
+
* The status of the promise.
|
|
12
|
+
*
|
|
13
|
+
* @typedoc
|
|
14
|
+
*/
|
|
15
|
+
status: 'pending';
|
|
16
|
+
/**
|
|
17
|
+
* Whether the promise is pending.
|
|
18
|
+
*
|
|
19
|
+
* @typedoc
|
|
20
|
+
*/
|
|
21
|
+
isPending: true;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the promise is pending.
|
|
24
|
+
*
|
|
25
|
+
* @deprecated use `isPending` instead
|
|
26
|
+
* @typedoc
|
|
27
|
+
*/
|
|
28
|
+
isLoading: true;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the promise has resolved
|
|
31
|
+
* successfully.
|
|
32
|
+
*
|
|
33
|
+
* @typedoc
|
|
34
|
+
*/
|
|
35
|
+
isSuccess: false;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the promise has rejected
|
|
38
|
+
* with an error.
|
|
39
|
+
*
|
|
40
|
+
* @typedoc
|
|
41
|
+
*/
|
|
42
|
+
isError: false;
|
|
43
|
+
/**
|
|
44
|
+
* Once the promise has resolved, this will
|
|
45
|
+
* be the value the promise resolved to.
|
|
46
|
+
*
|
|
47
|
+
* @typedoc
|
|
48
|
+
*/
|
|
49
|
+
value: null;
|
|
50
|
+
/**
|
|
51
|
+
* Once the promise has resolved, this will
|
|
52
|
+
* be the value the promise resolved to.
|
|
53
|
+
*
|
|
54
|
+
* @deprecated use `value` instead
|
|
55
|
+
* @typedoc
|
|
56
|
+
*/
|
|
57
|
+
result: null;
|
|
58
|
+
/**
|
|
59
|
+
* Once the promise has rejected, this will
|
|
60
|
+
* be the error the promise rejected with.
|
|
61
|
+
*
|
|
62
|
+
*
|
|
63
|
+
* @deprecated use `reason` instead
|
|
64
|
+
* @typedoc
|
|
65
|
+
*/
|
|
66
|
+
error: null;
|
|
67
|
+
/**
|
|
68
|
+
* Once the promise has rejected, this will
|
|
69
|
+
* be the error the promise rejected with.
|
|
70
|
+
*
|
|
71
|
+
* @typedoc
|
|
72
|
+
*/
|
|
73
|
+
reason: null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The state of a promise in the "fulfilled" state.
|
|
77
|
+
* This is the state of a promise that has resolved
|
|
78
|
+
* successfully.
|
|
79
|
+
*
|
|
80
|
+
* @typedoc
|
|
81
|
+
*/
|
|
82
|
+
export interface ResolvedPromise<T> {
|
|
83
|
+
/**
|
|
84
|
+
* The status of the promise.
|
|
85
|
+
*
|
|
86
|
+
* @typedoc
|
|
87
|
+
*/
|
|
88
|
+
status: 'fulfilled';
|
|
89
|
+
/**
|
|
90
|
+
* Whether the promise is pending.
|
|
91
|
+
*
|
|
92
|
+
* @typedoc
|
|
93
|
+
*/
|
|
94
|
+
isPending: false;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the promise is pending.
|
|
97
|
+
*
|
|
98
|
+
* @deprecated use `isPending` instead
|
|
99
|
+
* @typedoc
|
|
100
|
+
*/
|
|
101
|
+
isLoading: false;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the promise has resolved
|
|
104
|
+
* successfully.
|
|
105
|
+
*
|
|
106
|
+
* @typedoc
|
|
107
|
+
*/
|
|
108
|
+
isSuccess: true;
|
|
109
|
+
/**
|
|
110
|
+
* Whether the promise has rejected
|
|
111
|
+
* with an error.
|
|
112
|
+
*
|
|
113
|
+
* @typedoc
|
|
114
|
+
*/
|
|
115
|
+
isError: false;
|
|
116
|
+
/**
|
|
117
|
+
* Once the promise has resolved, this will
|
|
118
|
+
* be the value the promise resolved to.
|
|
119
|
+
*
|
|
120
|
+
* @typedoc
|
|
121
|
+
*/
|
|
122
|
+
value: T;
|
|
123
|
+
/**
|
|
124
|
+
* Once the promise has resolved, this will
|
|
125
|
+
* be the value the promise resolved to.
|
|
126
|
+
*
|
|
127
|
+
* @deprecated use `value` instead
|
|
128
|
+
* @typedoc
|
|
129
|
+
*/
|
|
130
|
+
result: T;
|
|
131
|
+
/**
|
|
132
|
+
* Once the promise has rejected, this will
|
|
133
|
+
* be the error the promise rejected with.
|
|
134
|
+
*
|
|
135
|
+
*
|
|
136
|
+
* @deprecated use `reason` instead
|
|
137
|
+
* @typedoc
|
|
138
|
+
*/
|
|
139
|
+
error: null;
|
|
140
|
+
/**
|
|
141
|
+
* Once the promise has rejected, this will
|
|
142
|
+
* be the error the promise rejected with.
|
|
143
|
+
*
|
|
144
|
+
* @typedoc
|
|
145
|
+
*/
|
|
146
|
+
reason: null;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The state of a promise in the "rejected" state.
|
|
150
|
+
* This is the state of a promise that has rejected
|
|
151
|
+
* with an error.
|
|
152
|
+
*
|
|
153
|
+
* @typedoc
|
|
154
|
+
*/
|
|
155
|
+
export interface RejectedPromise<E> {
|
|
156
|
+
/**
|
|
157
|
+
* The status of the promise.
|
|
158
|
+
*
|
|
159
|
+
* @typedoc
|
|
160
|
+
*/
|
|
161
|
+
status: 'rejected';
|
|
162
|
+
/**
|
|
163
|
+
* Whether the promise is pending.
|
|
164
|
+
*
|
|
165
|
+
* @typedoc
|
|
166
|
+
*/
|
|
167
|
+
isPending: false;
|
|
168
|
+
/**
|
|
169
|
+
* Whether the promise is pending.
|
|
170
|
+
*
|
|
171
|
+
* @deprecated use `isPending` instead
|
|
172
|
+
* @typedoc
|
|
173
|
+
*/
|
|
174
|
+
isLoading: false;
|
|
175
|
+
/**
|
|
176
|
+
* Whether the promise has resolved
|
|
177
|
+
* successfully.
|
|
178
|
+
*
|
|
179
|
+
* @typedoc
|
|
180
|
+
*/
|
|
181
|
+
isSuccess: false;
|
|
182
|
+
/**
|
|
183
|
+
* Whether the promise has rejected
|
|
184
|
+
* with an error.
|
|
185
|
+
*
|
|
186
|
+
* @typedoc
|
|
187
|
+
*/
|
|
188
|
+
isError: true;
|
|
189
|
+
/**
|
|
190
|
+
* Once the promise has resolved, this will
|
|
191
|
+
* be the value the promise resolved to.
|
|
192
|
+
*
|
|
193
|
+
* @typedoc
|
|
194
|
+
*/
|
|
195
|
+
value: null;
|
|
196
|
+
/**
|
|
197
|
+
* Once the promise has resolved, this will
|
|
198
|
+
* be the value the promise resolved to.
|
|
199
|
+
*
|
|
200
|
+
* @deprecated use `value` instead
|
|
201
|
+
* @typedoc
|
|
202
|
+
*/
|
|
203
|
+
result: null;
|
|
204
|
+
/**
|
|
205
|
+
* Once the promise has rejected, this will
|
|
206
|
+
* be the error the promise rejected with.
|
|
207
|
+
*
|
|
208
|
+
*
|
|
209
|
+
* @deprecated use `reason` instead
|
|
210
|
+
* @typedoc
|
|
211
|
+
*/
|
|
212
|
+
error: E;
|
|
213
|
+
/**
|
|
214
|
+
* Once the promise has rejected, this will
|
|
215
|
+
* be the error the promise rejected with.
|
|
216
|
+
*
|
|
217
|
+
* @typedoc
|
|
218
|
+
*/
|
|
219
|
+
reason: E;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* The state of a promise. This is the type that is returned
|
|
223
|
+
* from `getPromiseState`.
|
|
224
|
+
*
|
|
225
|
+
* See also:
|
|
226
|
+
* - {@link PendingPromise}
|
|
227
|
+
* - {@link ResolvedPromise}
|
|
228
|
+
* - {@link RejectedPromise}
|
|
229
|
+
*
|
|
230
|
+
* @typedoc
|
|
231
|
+
*/
|
|
232
|
+
export type PromiseState<T = unknown, E = unknown> = PendingPromise | ResolvedPromise<T> | RejectedPromise<E>;
|
|
233
|
+
export function createPromiseState<T, E>(promise: Promise<T> | Awaitable<T, E>): Readonly<PromiseState<T, E>>;
|
|
234
|
+
/**
|
|
235
|
+
* Returns a reactive state-machine for the provided promise or awaitable.
|
|
236
|
+
*
|
|
237
|
+
* Repeat calls to `getPromiseState` with the same promise will return the same state object
|
|
238
|
+
* making is safe and easy to use in templates and JavaScript code to produce reactive
|
|
239
|
+
* behaviors around promises.
|
|
240
|
+
*
|
|
241
|
+
* `getPromiseState` can be used in both JavaScript and Template contexts.
|
|
242
|
+
*
|
|
243
|
+
* ```ts
|
|
244
|
+
* import { getPromiseState } from '@warp-drive/ember';
|
|
245
|
+
*
|
|
246
|
+
* const state = getPromiseState(promise);
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* For instance, we could write a getter on a component that updates whenever
|
|
250
|
+
* the promise state advances or the promise changes, by combining the function
|
|
251
|
+
* with the use of `@cached`
|
|
252
|
+
*
|
|
253
|
+
* ```ts
|
|
254
|
+
* class Component {
|
|
255
|
+
* @cached
|
|
256
|
+
* get title() {
|
|
257
|
+
* const state = getPromiseState(this.args.request);
|
|
258
|
+
* if (state.isPending) {
|
|
259
|
+
* return 'loading...';
|
|
260
|
+
* }
|
|
261
|
+
* if (state.isError) { return null; }
|
|
262
|
+
* return state.result.title;
|
|
263
|
+
* }
|
|
264
|
+
* }
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* Or in a template as a helper:
|
|
268
|
+
*
|
|
269
|
+
* ```gjs
|
|
270
|
+
* import { getPromiseState } from '@warp-drive/ember';
|
|
271
|
+
*
|
|
272
|
+
* <template>
|
|
273
|
+
* {{#let (getPromiseState @request) as |state|}}
|
|
274
|
+
* {{#if state.isPending}} <Spinner />
|
|
275
|
+
* {{else if state.isError}} <ErrorForm @error={{state.error}} />
|
|
276
|
+
* {{else}}
|
|
277
|
+
* <h1>{{state.result.title}}</h1>
|
|
278
|
+
* {{/if}}
|
|
279
|
+
* {{/let}}
|
|
280
|
+
* </template>
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* If looking to use in a template, consider also the `<Await />` component.
|
|
284
|
+
*
|
|
285
|
+
* @typedoc
|
|
286
|
+
*/
|
|
287
|
+
export function getPromiseState<T = unknown, E = unknown>(promise: Promise<T> | Awaitable<T, E>): Readonly<PromiseState<T, E>>;
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=promise-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-state.d.ts","sourceRoot":"","sources":["../../../src/-private/new-core-tmp/promise-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAOrD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,MAAM,EAAE,SAAS,CAAC;IAElB;;;;OAIG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;;;;OAKG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;;;;OAKG;IACH,SAAS,EAAE,KAAK,CAAC;IAEjB;;;;;OAKG;IACH,OAAO,EAAE,KAAK,CAAC;IAEf;;;;;OAKG;IACH,KAAK,EAAE,IAAI,CAAC;IACZ;;;;;;OAMG;IACH,MAAM,EAAE,IAAI,CAAC;IAEb;;;;;;;OAOG;IACH,KAAK,EAAE,IAAI,CAAC;IAEZ;;;;;OAKG;IACH,MAAM,EAAE,IAAI,CAAC;CACd;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC;;;;OAIG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;;;OAIG;IACH,SAAS,EAAE,KAAK,CAAC;IAEjB;;;;;OAKG;IACH,SAAS,EAAE,KAAK,CAAC;IACjB;;;;;OAKG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;;;;OAKG;IACH,OAAO,EAAE,KAAK,CAAC;IAEf;;;;;OAKG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;;;;;OAMG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;;;;;;OAOG;IACH,KAAK,EAAE,IAAI,CAAC;IAEZ;;;;;OAKG;IACH,MAAM,EAAE,IAAI,CAAC;CACd;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC;;;;OAIG;IACH,MAAM,EAAE,UAAU,CAAC;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