@warp-drive/core 5.6.0-alpha.14 → 5.6.0-alpha.17

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.
Files changed (287) hide show
  1. package/declarations/build-config/babel-macros.d.ts +1 -2
  2. package/declarations/build-config/canary-features.d.ts +1 -2
  3. package/declarations/build-config/debugging.d.ts +1 -2
  4. package/declarations/build-config/deprecations.d.ts +1 -2
  5. package/declarations/build-config/env.d.ts +1 -2
  6. package/declarations/build-config/macros.d.ts +1 -2
  7. package/declarations/build-config.d.ts +1 -2
  8. package/declarations/configure.d.ts +6 -7
  9. package/declarations/graph/-private/-diff.d.ts +21 -22
  10. package/declarations/graph/-private/-edge-definition.d.ts +134 -135
  11. package/declarations/graph/-private/-state.d.ts +93 -7
  12. package/declarations/graph/-private/-utils.d.ts +18 -13
  13. package/declarations/graph/-private/coerce-id.d.ts +6 -1
  14. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +15 -4
  15. package/declarations/graph/-private/edges/collection.d.ts +35 -36
  16. package/declarations/graph/-private/edges/implicit.d.ts +28 -29
  17. package/declarations/graph/-private/edges/resource.d.ts +19 -20
  18. package/declarations/graph/-private/graph.d.ts +83 -48
  19. package/declarations/graph/-private/normalize-link.d.ts +7 -2
  20. package/declarations/graph/-private/operations/add-to-related-records.d.ts +3 -4
  21. package/declarations/graph/-private/operations/merge-identifier.d.ts +2 -3
  22. package/declarations/graph/-private/operations/remove-from-related-records.d.ts +3 -4
  23. package/declarations/graph/-private/operations/replace-related-record.d.ts +2 -3
  24. package/declarations/graph/-private/operations/replace-related-records.d.ts +58 -4
  25. package/declarations/graph/-private/operations/update-relationship.d.ts +11 -9
  26. package/declarations/graph/-private.d.ts +9 -10
  27. package/declarations/index.d.ts +11 -12
  28. package/declarations/reactive/-private/document.d.ts +143 -144
  29. package/declarations/reactive/-private/fields/compute.d.ts +31 -28
  30. package/declarations/reactive/-private/fields/extension.d.ts +8 -0
  31. package/declarations/reactive/-private/fields/managed-array.d.ts +19 -20
  32. package/declarations/reactive/-private/fields/managed-object.d.ts +16 -16
  33. package/declarations/reactive/-private/fields/many-array-manager.d.ts +15 -16
  34. package/declarations/reactive/-private/hooks.d.ts +3 -4
  35. package/declarations/reactive/-private/record.d.ts +61 -58
  36. package/declarations/reactive/-private/schema.d.ts +256 -165
  37. package/declarations/reactive/-private/symbols.d.ts +27 -2
  38. package/declarations/reactive/-private.d.ts +1 -2
  39. package/declarations/reactive.d.ts +4 -5
  40. package/declarations/request/-private/context.d.ts +34 -35
  41. package/declarations/request/-private/debug.d.ts +2 -3
  42. package/declarations/request/-private/fetch.d.ts +23 -24
  43. package/declarations/request/-private/future.d.ts +3 -4
  44. package/declarations/request/-private/manager.d.ts +159 -157
  45. package/declarations/request/-private/promise-cache.d.ts +21 -13
  46. package/declarations/request/-private/types.d.ts +124 -124
  47. package/declarations/request/-private/utils.d.ts +8 -9
  48. package/declarations/request.d.ts +5 -6
  49. package/declarations/store/-private/cache-handler/handler.d.ts +57 -52
  50. package/declarations/store/-private/cache-handler/types.d.ts +95 -96
  51. package/declarations/store/-private/cache-handler/utils.d.ts +16 -16
  52. package/declarations/store/-private/caches/cache-utils.d.ts +7 -4
  53. package/declarations/store/-private/caches/identifier-cache.d.ts +234 -246
  54. package/declarations/store/-private/caches/instance-cache.d.ts +47 -47
  55. package/declarations/store/-private/caches/resource-utils.d.ts +3 -4
  56. package/declarations/store/-private/debug/utils.d.ts +6 -7
  57. package/declarations/store/-private/default-cache-policy.d.ts +362 -361
  58. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +154 -159
  59. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +14 -14
  60. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +21 -22
  61. package/declarations/store/-private/managers/cache-manager.d.ts +440 -425
  62. package/declarations/store/-private/managers/notification-manager.d.ts +88 -83
  63. package/declarations/store/-private/managers/record-array-manager.d.ts +89 -90
  64. package/declarations/store/-private/network/request-cache.d.ts +86 -83
  65. package/declarations/store/-private/new-core-tmp/promise-state.d.ts +252 -244
  66. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +155 -72
  67. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +148 -149
  68. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +28 -23
  69. package/declarations/store/-private/new-core-tmp/request-state.d.ts +263 -241
  70. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +261 -0
  71. package/declarations/store/-private/record-arrays/identifier-array.d.ts +125 -119
  72. package/declarations/store/-private/record-arrays/many-array.d.ts +180 -182
  73. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +120 -110
  74. package/declarations/store/-private/store-service.d.ts +1594 -1586
  75. package/declarations/store/-private/utils/coerce-id.d.ts +6 -1
  76. package/declarations/store/-private/utils/construct-resource.d.ts +1 -2
  77. package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
  78. package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
  79. package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
  80. package/declarations/store/-private.d.ts +31 -27
  81. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +96 -97
  82. package/declarations/store/-types/q/ds-model.d.ts +17 -18
  83. package/declarations/store/-types/q/identifier.d.ts +11 -12
  84. package/declarations/store/-types/q/record-instance.d.ts +16 -17
  85. package/declarations/store/-types/q/schema-service.d.ts +346 -323
  86. package/declarations/store/-types/q/store.d.ts +25 -28
  87. package/declarations/store.d.ts +1 -2
  88. package/declarations/types/-private.d.ts +16 -8
  89. package/declarations/types/cache/aliases.d.ts +11 -1
  90. package/declarations/types/cache/change.d.ts +4 -5
  91. package/declarations/types/cache/mutations.d.ts +51 -28
  92. package/declarations/types/cache/operations.d.ts +60 -47
  93. package/declarations/types/cache/relationship.d.ts +11 -9
  94. package/declarations/types/cache.d.ts +495 -484
  95. package/declarations/types/graph.d.ts +31 -32
  96. package/declarations/types/identifier.d.ts +83 -82
  97. package/declarations/types/json/raw.d.ts +1 -2
  98. package/declarations/types/params.d.ts +4 -5
  99. package/declarations/types/record.d.ts +117 -76
  100. package/declarations/types/request.d.ts +289 -266
  101. package/declarations/types/runtime.d.ts +8 -9
  102. package/declarations/types/schema/concepts.d.ts +19 -13
  103. package/declarations/types/schema/fields.d.ts +1712 -1587
  104. package/declarations/types/schema/fields.type-test.d.ts +0 -1
  105. package/declarations/types/spec/document.d.ts +28 -22
  106. package/declarations/types/spec/error.d.ts +16 -17
  107. package/declarations/types/spec/json-api-raw.d.ts +102 -102
  108. package/declarations/types/symbols.d.ts +74 -75
  109. package/declarations/types/utils.d.ts +5 -5
  110. package/declarations/types.d.ts +10 -11
  111. package/declarations/utils/string.d.ts +43 -40
  112. package/dist/{configure-BgaZESRo.js → configure-B48bFHOl.js} +38 -2
  113. package/dist/configure.js +1 -1
  114. package/dist/graph/-private.js +2 -2
  115. package/dist/{handler-cHghx9Y9.js → handler-C2T-IyJK.js} +1 -1
  116. package/dist/index.js +3 -3
  117. package/dist/reactive/-private.js +1 -1
  118. package/dist/reactive.js +287 -101
  119. package/dist/{request-state-DgwTEXLU.js → request-state-CjLph1LP.js} +1030 -249
  120. package/dist/store/-private.js +3 -3
  121. package/dist/{symbols-BmDcn6hS.js → symbols-SIstXMLI.js} +3 -3
  122. package/dist/types/-private.js +1 -1
  123. package/dist/types/schema/fields.js +4 -4
  124. package/package.json +4 -4
  125. package/declarations/build-config/babel-macros.d.ts.map +0 -1
  126. package/declarations/build-config/canary-features.d.ts.map +0 -1
  127. package/declarations/build-config/debugging.d.ts.map +0 -1
  128. package/declarations/build-config/deprecations.d.ts.map +0 -1
  129. package/declarations/build-config/env.d.ts.map +0 -1
  130. package/declarations/build-config/macros.d.ts.map +0 -1
  131. package/declarations/build-config.d.ts.map +0 -1
  132. package/declarations/configure.d.ts.map +0 -1
  133. package/declarations/graph/-private/-diff.d.ts.map +0 -1
  134. package/declarations/graph/-private/-edge-definition.d.ts.map +0 -1
  135. package/declarations/graph/-private/-state.d.ts.map +0 -1
  136. package/declarations/graph/-private/-utils.d.ts.map +0 -1
  137. package/declarations/graph/-private/coerce-id.d.ts.map +0 -1
  138. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
  139. package/declarations/graph/-private/edges/collection.d.ts.map +0 -1
  140. package/declarations/graph/-private/edges/implicit.d.ts.map +0 -1
  141. package/declarations/graph/-private/edges/resource.d.ts.map +0 -1
  142. package/declarations/graph/-private/graph.d.ts.map +0 -1
  143. package/declarations/graph/-private/normalize-link.d.ts.map +0 -1
  144. package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +0 -1
  145. package/declarations/graph/-private/operations/merge-identifier.d.ts.map +0 -1
  146. package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +0 -1
  147. package/declarations/graph/-private/operations/replace-related-record.d.ts.map +0 -1
  148. package/declarations/graph/-private/operations/replace-related-records.d.ts.map +0 -1
  149. package/declarations/graph/-private/operations/update-relationship.d.ts.map +0 -1
  150. package/declarations/graph/-private.d.ts.map +0 -1
  151. package/declarations/index.d.ts.map +0 -1
  152. package/declarations/reactive/-private/document.d.ts.map +0 -1
  153. package/declarations/reactive/-private/fields/compute.d.ts.map +0 -1
  154. package/declarations/reactive/-private/fields/managed-array.d.ts.map +0 -1
  155. package/declarations/reactive/-private/fields/managed-object.d.ts.map +0 -1
  156. package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +0 -1
  157. package/declarations/reactive/-private/hooks.d.ts.map +0 -1
  158. package/declarations/reactive/-private/record.d.ts.map +0 -1
  159. package/declarations/reactive/-private/schema.d.ts.map +0 -1
  160. package/declarations/reactive/-private/symbols.d.ts.map +0 -1
  161. package/declarations/reactive/-private.d.ts.map +0 -1
  162. package/declarations/reactive.d.ts.map +0 -1
  163. package/declarations/request/-private/context.d.ts.map +0 -1
  164. package/declarations/request/-private/debug.d.ts.map +0 -1
  165. package/declarations/request/-private/fetch.d.ts.map +0 -1
  166. package/declarations/request/-private/future.d.ts.map +0 -1
  167. package/declarations/request/-private/manager.d.ts.map +0 -1
  168. package/declarations/request/-private/promise-cache.d.ts.map +0 -1
  169. package/declarations/request/-private/types.d.ts.map +0 -1
  170. package/declarations/request/-private/utils.d.ts.map +0 -1
  171. package/declarations/request.d.ts.map +0 -1
  172. package/declarations/store/-private/cache-handler/handler.d.ts.map +0 -1
  173. package/declarations/store/-private/cache-handler/types.d.ts.map +0 -1
  174. package/declarations/store/-private/cache-handler/utils.d.ts.map +0 -1
  175. package/declarations/store/-private/caches/cache-utils.d.ts.map +0 -1
  176. package/declarations/store/-private/caches/identifier-cache.d.ts.map +0 -1
  177. package/declarations/store/-private/caches/instance-cache.d.ts.map +0 -1
  178. package/declarations/store/-private/caches/resource-utils.d.ts.map +0 -1
  179. package/declarations/store/-private/debug/utils.d.ts.map +0 -1
  180. package/declarations/store/-private/default-cache-policy.d.ts.map +0 -1
  181. package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +0 -1
  182. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
  183. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
  184. package/declarations/store/-private/managers/cache-manager.d.ts.map +0 -1
  185. package/declarations/store/-private/managers/notification-manager.d.ts.map +0 -1
  186. package/declarations/store/-private/managers/record-array-manager.d.ts.map +0 -1
  187. package/declarations/store/-private/network/request-cache.d.ts.map +0 -1
  188. package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +0 -1
  189. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
  190. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
  191. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
  192. package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +0 -1
  193. package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +0 -1
  194. package/declarations/store/-private/record-arrays/many-array.d.ts.map +0 -1
  195. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
  196. package/declarations/store/-private/store-service.d.ts.map +0 -1
  197. package/declarations/store/-private/store-service.type-test.d.ts +0 -2
  198. package/declarations/store/-private/store-service.type-test.d.ts.map +0 -1
  199. package/declarations/store/-private/utils/coerce-id.d.ts.map +0 -1
  200. package/declarations/store/-private/utils/construct-resource.d.ts.map +0 -1
  201. package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +0 -1
  202. package/declarations/store/-private/utils/normalize-model-name.d.ts.map +0 -1
  203. package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +0 -1
  204. package/declarations/store/-private.d.ts.map +0 -1
  205. package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +0 -1
  206. package/declarations/store/-types/q/ds-model.d.ts.map +0 -1
  207. package/declarations/store/-types/q/identifier.d.ts.map +0 -1
  208. package/declarations/store/-types/q/promise-proxies.d.ts +0 -2
  209. package/declarations/store/-types/q/promise-proxies.d.ts.map +0 -1
  210. package/declarations/store/-types/q/record-data-json-api.d.ts +0 -31
  211. package/declarations/store/-types/q/record-data-json-api.d.ts.map +0 -1
  212. package/declarations/store/-types/q/record-instance.d.ts.map +0 -1
  213. package/declarations/store/-types/q/schema-service.d.ts.map +0 -1
  214. package/declarations/store/-types/q/store.d.ts.map +0 -1
  215. package/declarations/store.d.ts.map +0 -1
  216. package/declarations/types/-private.d.ts.map +0 -1
  217. package/declarations/types/cache/aliases.d.ts.map +0 -1
  218. package/declarations/types/cache/change.d.ts.map +0 -1
  219. package/declarations/types/cache/mutations.d.ts.map +0 -1
  220. package/declarations/types/cache/operations.d.ts.map +0 -1
  221. package/declarations/types/cache/relationship.d.ts.map +0 -1
  222. package/declarations/types/cache.d.ts.map +0 -1
  223. package/declarations/types/graph.d.ts.map +0 -1
  224. package/declarations/types/identifier.d.ts.map +0 -1
  225. package/declarations/types/json/raw.d.ts.map +0 -1
  226. package/declarations/types/params.d.ts.map +0 -1
  227. package/declarations/types/record.d.ts.map +0 -1
  228. package/declarations/types/record.type-test.d.ts +0 -2
  229. package/declarations/types/record.type-test.d.ts.map +0 -1
  230. package/declarations/types/request.d.ts.map +0 -1
  231. package/declarations/types/request.type-test.d.ts +0 -2
  232. package/declarations/types/request.type-test.d.ts.map +0 -1
  233. package/declarations/types/runtime.d.ts.map +0 -1
  234. package/declarations/types/schema/concepts.d.ts.map +0 -1
  235. package/declarations/types/schema/fields.d.ts.map +0 -1
  236. package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
  237. package/declarations/types/spec/document.d.ts.map +0 -1
  238. package/declarations/types/spec/error.d.ts.map +0 -1
  239. package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
  240. package/declarations/types/symbols.d.ts.map +0 -1
  241. package/declarations/types/utils.d.ts.map +0 -1
  242. package/declarations/types.d.ts.map +0 -1
  243. package/declarations/utils/string.d.ts.map +0 -1
  244. package/dist/build-config/babel-macros.js.map +0 -1
  245. package/dist/build-config/canary-features.js.map +0 -1
  246. package/dist/build-config/debugging.js.map +0 -1
  247. package/dist/build-config/deprecations.js.map +0 -1
  248. package/dist/build-config/env.js.map +0 -1
  249. package/dist/build-config/macros.js.map +0 -1
  250. package/dist/build-config.js.map +0 -1
  251. package/dist/configure-BgaZESRo.js.map +0 -1
  252. package/dist/configure.js.map +0 -1
  253. package/dist/context-COmAnXUQ.js.map +0 -1
  254. package/dist/graph/-private.js.map +0 -1
  255. package/dist/handler-cHghx9Y9.js.map +0 -1
  256. package/dist/index.js.map +0 -1
  257. package/dist/reactive/-private.js.map +0 -1
  258. package/dist/reactive.js.map +0 -1
  259. package/dist/request-state-DgwTEXLU.js.map +0 -1
  260. package/dist/request.js.map +0 -1
  261. package/dist/store/-private.js.map +0 -1
  262. package/dist/store.js.map +0 -1
  263. package/dist/symbols-BmDcn6hS.js.map +0 -1
  264. package/dist/types/-private.js.map +0 -1
  265. package/dist/types/cache/aliases.js.map +0 -1
  266. package/dist/types/cache/change.js.map +0 -1
  267. package/dist/types/cache/mutations.js.map +0 -1
  268. package/dist/types/cache/operations.js.map +0 -1
  269. package/dist/types/cache/relationship.js.map +0 -1
  270. package/dist/types/cache.js.map +0 -1
  271. package/dist/types/graph.js.map +0 -1
  272. package/dist/types/identifier.js.map +0 -1
  273. package/dist/types/json/raw.js.map +0 -1
  274. package/dist/types/params.js.map +0 -1
  275. package/dist/types/record.js.map +0 -1
  276. package/dist/types/request.js.map +0 -1
  277. package/dist/types/runtime.js.map +0 -1
  278. package/dist/types/schema/concepts.js.map +0 -1
  279. package/dist/types/schema/fields.js.map +0 -1
  280. package/dist/types/schema/fields.type-test.js.map +0 -1
  281. package/dist/types/spec/document.js.map +0 -1
  282. package/dist/types/spec/error.js.map +0 -1
  283. package/dist/types/spec/json-api-raw.js.map +0 -1
  284. package/dist/types/symbols.js.map +0 -1
  285. package/dist/types/utils.js.map +0 -1
  286. package/dist/types.js.map +0 -1
  287. package/dist/utils/string.js.map +0 -1
@@ -1,383 +1,384 @@
1
- import type { Cache } from '@warp-drive/core/types/cache';
2
- import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core/types/identifier';
3
- import type { ImmutableRequestInfo, ResponseInfo, StructuredDocument } from '@warp-drive/core/types/request';
4
- import type { ResourceDocument } from '@warp-drive/core/types/spec/document';
1
+ import type { Cache } from "@warp-drive/core/types/cache";
2
+ import type { StableDocumentIdentifier, StableRecordIdentifier } from "@warp-drive/core/types/identifier";
3
+ import type { ImmutableRequestInfo, ResponseInfo, StructuredDocument } from "@warp-drive/core/types/request";
4
+ import type { ResourceDocument } from "@warp-drive/core/types/spec/document";
5
5
  type UnsubscribeToken = object;
6
- type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
7
- type DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';
6
+ type CacheOperation = "added" | "removed" | "updated" | "state";
7
+ type DocumentCacheOperation = "invalidated" | "added" | "removed" | "updated" | "state";
8
8
  export interface NotificationCallback {
9
- (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;
10
- (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
9
+ (identifier: StableRecordIdentifier, notificationType: "attributes" | "relationships", key?: string): void;
10
+ (identifier: StableRecordIdentifier, notificationType: "errors" | "meta" | "identity" | "state"): void;
11
11
  }
12
12
  interface ResourceOperationCallback {
13
- (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
13
+ // resource updates
14
+ (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;
14
15
  }
15
16
  interface DocumentOperationCallback {
16
- (identifier: StableDocumentIdentifier, notificationType: DocumentCacheOperation): void;
17
+ // document updates
18
+ (identifier: StableDocumentIdentifier, notificationType: DocumentCacheOperation): void;
17
19
  }
18
20
  type NotificationManager = {
19
- subscribe(identifier: StableRecordIdentifier, callback: NotificationCallback): UnsubscribeToken;
20
- subscribe(identifier: 'resource', callback: ResourceOperationCallback): UnsubscribeToken;
21
- subscribe(identifier: 'document' | StableDocumentIdentifier, callback: DocumentOperationCallback): UnsubscribeToken;
22
- notify(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;
23
- notify(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;
24
- notify(identifier: StableRecordIdentifier, value: CacheOperation): boolean;
25
- notify(identifier: StableDocumentIdentifier, value: DocumentCacheOperation): boolean;
21
+ subscribe(identifier: StableRecordIdentifier, callback: NotificationCallback): UnsubscribeToken;
22
+ subscribe(identifier: "resource", callback: ResourceOperationCallback): UnsubscribeToken;
23
+ subscribe(identifier: "document" | StableDocumentIdentifier, callback: DocumentOperationCallback): UnsubscribeToken;
24
+ notify(identifier: StableRecordIdentifier, value: "attributes" | "relationships", key?: string): boolean;
25
+ notify(identifier: StableRecordIdentifier, value: "errors" | "meta" | "identity" | "state"): boolean;
26
+ notify(identifier: StableRecordIdentifier, value: CacheOperation): boolean;
27
+ notify(identifier: StableDocumentIdentifier, value: DocumentCacheOperation): boolean;
26
28
  };
27
29
  type Store = {
28
- cache: Cache;
29
- notifications: NotificationManager;
30
+ cache: Cache;
31
+ notifications: NotificationManager;
30
32
  };
31
33
  export interface CacheControlValue {
32
- immutable?: boolean;
33
- 'max-age'?: number;
34
- 'must-revalidate'?: boolean;
35
- 'must-understand'?: boolean;
36
- 'no-cache'?: boolean;
37
- 'no-store'?: boolean;
38
- 'no-transform'?: boolean;
39
- 'only-if-cached'?: boolean;
40
- private?: boolean;
41
- 'proxy-revalidate'?: boolean;
42
- public?: boolean;
43
- 's-maxage'?: number;
44
- 'stale-if-error'?: number;
45
- 'stale-while-revalidate'?: number;
34
+ immutable?: boolean;
35
+ "max-age"?: number;
36
+ "must-revalidate"?: boolean;
37
+ "must-understand"?: boolean;
38
+ "no-cache"?: boolean;
39
+ "no-store"?: boolean;
40
+ "no-transform"?: boolean;
41
+ "only-if-cached"?: boolean;
42
+ private?: boolean;
43
+ "proxy-revalidate"?: boolean;
44
+ public?: boolean;
45
+ "s-maxage"?: number;
46
+ "stale-if-error"?: number;
47
+ "stale-while-revalidate"?: number;
46
48
  }
47
49
  /**
48
- * Parses a string Cache-Control header value into an object with the following structure:
49
- *
50
- * ```ts
51
- * interface CacheControlValue {
52
- * immutable?: boolean;
53
- * 'max-age'?: number;
54
- * 'must-revalidate'?: boolean;
55
- * 'must-understand'?: boolean;
56
- * 'no-cache'?: boolean;
57
- * 'no-store'?: boolean;
58
- * 'no-transform'?: boolean;
59
- * 'only-if-cached'?: boolean;
60
- * private?: boolean;
61
- * 'proxy-revalidate'?: boolean;
62
- * public?: boolean;
63
- * 's-maxage'?: number;
64
- * 'stale-if-error'?: number;
65
- * 'stale-while-revalidate'?: number;
66
- * }
67
- * ```
68
- *
69
- * @public
70
- * @param {String} header
71
- * @return {CacheControlValue}
72
- */
50
+ * Parses a string Cache-Control header value into an object with the following structure:
51
+ *
52
+ * ```ts
53
+ * interface CacheControlValue {
54
+ * immutable?: boolean;
55
+ * 'max-age'?: number;
56
+ * 'must-revalidate'?: boolean;
57
+ * 'must-understand'?: boolean;
58
+ * 'no-cache'?: boolean;
59
+ * 'no-store'?: boolean;
60
+ * 'no-transform'?: boolean;
61
+ * 'only-if-cached'?: boolean;
62
+ * private?: boolean;
63
+ * 'proxy-revalidate'?: boolean;
64
+ * public?: boolean;
65
+ * 's-maxage'?: number;
66
+ * 'stale-if-error'?: number;
67
+ * 'stale-while-revalidate'?: number;
68
+ * }
69
+ * ```
70
+ *
71
+ * @public
72
+ * @param {String} header
73
+ * @return {CacheControlValue}
74
+ */
73
75
  export declare function parseCacheControl(header: string): CacheControlValue;
74
76
  /**
75
- * The configuration options for the {@link DefaultCachePolicy}
76
- *
77
- * ```ts
78
- * import { DefaultCachePolicy } from '@warp-drive/core/store';
79
- *
80
- * new DefaultCachePolicy({
81
- * // ... PolicyConfig Settings ... //
82
- * });
83
- * ```
84
- *
85
- */
77
+ * The configuration options for the {@link DefaultCachePolicy}
78
+ *
79
+ * ```ts
80
+ * import { DefaultCachePolicy } from '@warp-drive/core/store';
81
+ *
82
+ * new DefaultCachePolicy({
83
+ * // ... PolicyConfig Settings ... //
84
+ * });
85
+ * ```
86
+ *
87
+ */
86
88
  export type PolicyConfig = {
87
- /**
88
- * the number of milliseconds after which a request is considered
89
- * stale. If a request is issued again after this time, the request
90
- * will respond from cache immediately while a background request
91
- * is made to update the cache.
92
- *
93
- * This is calculated against the `date` header of the response.
94
- *
95
- * If your API does not provide a `date` header, the `Fetch` handler
96
- * provided by `@warp-drive/core` will automatically add
97
- * it to responses if it is not present. Responses without a `date`
98
- * header will be considered stale immediately.
99
- *
100
- */
101
- apiCacheSoftExpires: number;
102
- /**
103
- * the number of milliseconds after which a request is considered
104
- * expired and should be re-fetched. If a request is issued again
105
- * after this time, the request will disregard the cache and
106
- * wait for a fresh response from the API.
107
- *
108
- * This is calculated against the `date` header of the response.
109
- *
110
- * If your API does not provide a `date` header, the `Fetch` handler
111
- * provided by `@warp-drive/core` will automatically add
112
- * it to responses if it is not present. Responses without a `date`
113
- * header will be considered hard expired immediately.
114
- *
115
- */
116
- apiCacheHardExpires: number;
117
- /**
118
- * In Testing environments, the `apiCacheSoftExpires` will always be `false`
119
- * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.
120
- *
121
- * This helps reduce flakiness and produce predictably rendered results in test suites.
122
- *
123
- * Requests that specifically set `cacheOptions.backgroundReload = true` will
124
- * still be background reloaded in tests.
125
- *
126
- * This behavior can be opted out of by setting this value to `true`.
127
- *
128
- */
129
- disableTestOptimization?: boolean;
130
- /**
131
- * In addition to the simple time-based expiration strategy, CachePolicy
132
- * supports various common server-supplied expiration strategies via
133
- * headers, as well as custom expiration strategies via the `isExpired`
134
- * function.
135
- *
136
- * Requests will be validated for expiration against these constraints.
137
- * If any of these constraints are not met, the request will be considered
138
- * expired. If all constraints are met, the request will be considered
139
- * valid and the time based expiration strategy will NOT be used.
140
- *
141
- * Meeting a constraint means BOTH that the properties the constraint
142
- * requires are present AND that the expiration time indicated by those
143
- * properties has not been exceeded.
144
- *
145
- * In other words, if the properties for a constraint are not present,
146
- * this does not count either as meeting or as not meeting the constraint,
147
- * the constraint simply does not apply.
148
- *
149
- * The `isExpired` function is called with the request and should return
150
- * `true` if the request is expired, `false` if it is not expired, and
151
- * `null` if the expiration status is unknown.
152
- *
153
- * In order constraints are checked:
154
- *
155
- * - isExpired function
156
- * - ↳ (if null) X-WarpDrive-Expires header
157
- * - ↳ (if null) Cache-Control header
158
- * - ↳ (if null) Expires header
159
- *
160
- */
161
- constraints?: {
162
- /**
163
- * Headers that should be checked for expiration.
164
- *
165
- */
166
- headers?: {
167
- /**
168
- * Whether the `Cache-Control` header should be checked for expiration.
169
- * If `true`, then the `max-age` and `s-maxage` directives are used alongside
170
- * the `Age` and `Date` headers to determine if the expiration time has passed.
171
- *
172
- * Other directives are ignored.
173
- *
174
- * 'Cache-Control' will take precedence over 'Expires' if both are present
175
- * and both configured to be checked.
176
- *
177
- */
178
- 'Cache-Control'?: boolean;
179
- /**
180
- * Whether the `Expires` header should be checked for expiration.
181
- *
182
- * If `true`, then the `Expires` header is used to caclulate the expiration time
183
- * and determine if the expiration time has passed.
184
- *
185
- * 'Cache-Control' will take precedence over 'Expires' if both are present.
186
- *
187
- */
188
- Expires?: boolean;
189
- /**
190
- * Whether the `X-WarpDrive-Expires` header should be checked for expiration.
191
- *
192
- * If `true`, then the `X-WarpDrive-Expires` header is used to caclulate the expiration time
193
- * and determine if the expiration time has passed.
194
- *
195
- * This header will take precedence over 'Cache-Control' and 'Expires' if all three are present.
196
- *
197
- * The header's value should be a [UTC date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString).
198
- *
199
- */
200
- 'X-WarpDrive-Expires'?: boolean;
201
- };
202
- /**
203
- * A function that should be called to determine if the request is expired.
204
- *
205
- * If present, this function will be called with the request and should return
206
- * `true` if the request is expired, `false` if it is not expired, and
207
- * `null` if the expiration status is unknown.
208
- *
209
- * If the function does not return `null`,
210
- *
211
- */
212
- isExpired?: (request: StructuredDocument<ResourceDocument>) => boolean | null;
213
- };
89
+ /**
90
+ * the number of milliseconds after which a request is considered
91
+ * stale. If a request is issued again after this time, the request
92
+ * will respond from cache immediately while a background request
93
+ * is made to update the cache.
94
+ *
95
+ * This is calculated against the `date` header of the response.
96
+ *
97
+ * If your API does not provide a `date` header, the `Fetch` handler
98
+ * provided by `@warp-drive/core` will automatically add
99
+ * it to responses if it is not present. Responses without a `date`
100
+ * header will be considered stale immediately.
101
+ *
102
+ */
103
+ apiCacheSoftExpires: number;
104
+ /**
105
+ * the number of milliseconds after which a request is considered
106
+ * expired and should be re-fetched. If a request is issued again
107
+ * after this time, the request will disregard the cache and
108
+ * wait for a fresh response from the API.
109
+ *
110
+ * This is calculated against the `date` header of the response.
111
+ *
112
+ * If your API does not provide a `date` header, the `Fetch` handler
113
+ * provided by `@warp-drive/core` will automatically add
114
+ * it to responses if it is not present. Responses without a `date`
115
+ * header will be considered hard expired immediately.
116
+ *
117
+ */
118
+ apiCacheHardExpires: number;
119
+ /**
120
+ * In Testing environments, the `apiCacheSoftExpires` will always be `false`
121
+ * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.
122
+ *
123
+ * This helps reduce flakiness and produce predictably rendered results in test suites.
124
+ *
125
+ * Requests that specifically set `cacheOptions.backgroundReload = true` will
126
+ * still be background reloaded in tests.
127
+ *
128
+ * This behavior can be opted out of by setting this value to `true`.
129
+ *
130
+ */
131
+ disableTestOptimization?: boolean;
132
+ /**
133
+ * In addition to the simple time-based expiration strategy, CachePolicy
134
+ * supports various common server-supplied expiration strategies via
135
+ * headers, as well as custom expiration strategies via the `isExpired`
136
+ * function.
137
+ *
138
+ * Requests will be validated for expiration against these constraints.
139
+ * If any of these constraints are not met, the request will be considered
140
+ * expired. If all constraints are met, the request will be considered
141
+ * valid and the time based expiration strategy will NOT be used.
142
+ *
143
+ * Meeting a constraint means BOTH that the properties the constraint
144
+ * requires are present AND that the expiration time indicated by those
145
+ * properties has not been exceeded.
146
+ *
147
+ * In other words, if the properties for a constraint are not present,
148
+ * this does not count either as meeting or as not meeting the constraint,
149
+ * the constraint simply does not apply.
150
+ *
151
+ * The `isExpired` function is called with the request and should return
152
+ * `true` if the request is expired, `false` if it is not expired, and
153
+ * `null` if the expiration status is unknown.
154
+ *
155
+ * In order constraints are checked:
156
+ *
157
+ * - isExpired function
158
+ * - ↳ (if null) X-WarpDrive-Expires header
159
+ * - ↳ (if null) Cache-Control header
160
+ * - ↳ (if null) Expires header
161
+ *
162
+ */
163
+ constraints?: {
164
+ /**
165
+ * Headers that should be checked for expiration.
166
+ *
167
+ */
168
+ headers?: {
169
+ /**
170
+ * Whether the `Cache-Control` header should be checked for expiration.
171
+ * If `true`, then the `max-age` and `s-maxage` directives are used alongside
172
+ * the `Age` and `Date` headers to determine if the expiration time has passed.
173
+ *
174
+ * Other directives are ignored.
175
+ *
176
+ * 'Cache-Control' will take precedence over 'Expires' if both are present
177
+ * and both configured to be checked.
178
+ *
179
+ */
180
+ "Cache-Control"?: boolean;
181
+ /**
182
+ * Whether the `Expires` header should be checked for expiration.
183
+ *
184
+ * If `true`, then the `Expires` header is used to caclulate the expiration time
185
+ * and determine if the expiration time has passed.
186
+ *
187
+ * 'Cache-Control' will take precedence over 'Expires' if both are present.
188
+ *
189
+ */
190
+ Expires?: boolean;
191
+ /**
192
+ * Whether the `X-WarpDrive-Expires` header should be checked for expiration.
193
+ *
194
+ * If `true`, then the `X-WarpDrive-Expires` header is used to caclulate the expiration time
195
+ * and determine if the expiration time has passed.
196
+ *
197
+ * This header will take precedence over 'Cache-Control' and 'Expires' if all three are present.
198
+ *
199
+ * The header's value should be a [UTC date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString).
200
+ *
201
+ */
202
+ "X-WarpDrive-Expires"?: boolean;
203
+ };
204
+ /**
205
+ * A function that should be called to determine if the request is expired.
206
+ *
207
+ * If present, this function will be called with the request and should return
208
+ * `true` if the request is expired, `false` if it is not expired, and
209
+ * `null` if the expiration status is unknown.
210
+ *
211
+ * If the function does not return `null`,
212
+ *
213
+ */
214
+ isExpired?: (request: StructuredDocument<ResourceDocument>) => boolean | null;
215
+ };
214
216
  };
215
217
  /**
216
- * A basic CachePolicy that can be added to the Store service.
217
- *
218
- * Determines staleness based on time since the request was last received from the API
219
- * using the `date` header.
220
- *
221
- * Determines expiration based on configured constraints as well as a time based
222
- * expiration strategy based on the `date` header.
223
- *
224
- * In order expiration is determined by:
225
- *
226
- * - Is explicitly invalidated
227
- * - ↳ (if null) isExpired function \<IF Constraint Active>
228
- * - ↳ (if null) X-WarpDrive-Expires header \<IF Constraint Active>
229
- * - ↳ (if null) Cache-Control header \<IF Constraint Active>
230
- * - ↳ (if null) Expires header \<IF Constraint Active>
231
- * - ↳ (if null) Date header + apiCacheHardExpires \< current time
232
- *
233
- * Invalidates any request for which `cacheOptions.types` was provided when a createRecord
234
- * request for that type is successful.
235
- *
236
- * For this to work, the `createRecord` request must include the `cacheOptions.types` array
237
- * with the types that should be invalidated, or its request should specify the identifiers
238
- * of the records that are being created via `records`. Providing both is valid.
239
- *
240
- * > [!NOTE]
241
- * > only requests that had specified `cacheOptions.types` and occurred prior to the
242
- * > createRecord request will be invalidated. This means that a given request should always
243
- * > specify the types that would invalidate it to opt into this behavior. Abstracting this
244
- * > behavior via builders is recommended to ensure consistency.
245
- *
246
- * This allows the Store's CacheHandler to determine if a request is expired and
247
- * should be refetched upon next request.
248
- *
249
- * The `Fetch` handler provided by `@warp-drive/core` will automatically
250
- * add the `date` header to responses if it is not present.
251
- *
252
- * > [!NOTE]
253
- * > Date headers do not have millisecond precision, so expiration times should
254
- * > generally be larger than 1000ms.
255
- *
256
- * Usage:
257
- *
258
- * ```ts
259
- * import { Store } from '@warp-drive/core';
260
- * import { DefaultCachePolicy } from '@warp-drive/core/store';
261
- *
262
- * export class AppStore extends Store {
263
- * lifetimes = new DefaultCachePolicy({
264
- * apiCacheSoftExpires: 30_000,
265
- * apiCacheHardExpires: 60_000
266
- * });
267
- * }
268
- * ```
269
- *
270
- * In Testing environments, the `apiCacheSoftExpires` will always be `false`
271
- * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.
272
- *
273
- * This helps reduce flakiness and produce predictably rendered results in test suites.
274
- *
275
- * Requests that specifically set `cacheOptions.backgroundReload = true` will
276
- * still be background reloaded in tests.
277
- *
278
- * This behavior can be opted out of by setting `disableTestOptimization = true`
279
- * in the policy config.
280
- *
281
- * @public
282
- */
218
+ * A basic CachePolicy that can be added to the Store service.
219
+ *
220
+ * Determines staleness based on time since the request was last received from the API
221
+ * using the `date` header.
222
+ *
223
+ * Determines expiration based on configured constraints as well as a time based
224
+ * expiration strategy based on the `date` header.
225
+ *
226
+ * In order expiration is determined by:
227
+ *
228
+ * - Is explicitly invalidated
229
+ * - ↳ (if null) isExpired function \<IF Constraint Active>
230
+ * - ↳ (if null) X-WarpDrive-Expires header \<IF Constraint Active>
231
+ * - ↳ (if null) Cache-Control header \<IF Constraint Active>
232
+ * - ↳ (if null) Expires header \<IF Constraint Active>
233
+ * - ↳ (if null) Date header + apiCacheHardExpires \< current time
234
+ *
235
+ * Invalidates any request for which `cacheOptions.types` was provided when a createRecord
236
+ * request for that type is successful.
237
+ *
238
+ * For this to work, the `createRecord` request must include the `cacheOptions.types` array
239
+ * with the types that should be invalidated, or its request should specify the identifiers
240
+ * of the records that are being created via `records`. Providing both is valid.
241
+ *
242
+ * > [!NOTE]
243
+ * > only requests that had specified `cacheOptions.types` and occurred prior to the
244
+ * > createRecord request will be invalidated. This means that a given request should always
245
+ * > specify the types that would invalidate it to opt into this behavior. Abstracting this
246
+ * > behavior via builders is recommended to ensure consistency.
247
+ *
248
+ * This allows the Store's CacheHandler to determine if a request is expired and
249
+ * should be refetched upon next request.
250
+ *
251
+ * The `Fetch` handler provided by `@warp-drive/core` will automatically
252
+ * add the `date` header to responses if it is not present.
253
+ *
254
+ * > [!NOTE]
255
+ * > Date headers do not have millisecond precision, so expiration times should
256
+ * > generally be larger than 1000ms.
257
+ *
258
+ * Usage:
259
+ *
260
+ * ```ts
261
+ * import { Store } from '@warp-drive/core';
262
+ * import { DefaultCachePolicy } from '@warp-drive/core/store';
263
+ *
264
+ * export class AppStore extends Store {
265
+ * lifetimes = new DefaultCachePolicy({
266
+ * apiCacheSoftExpires: 30_000,
267
+ * apiCacheHardExpires: 60_000
268
+ * });
269
+ * }
270
+ * ```
271
+ *
272
+ * In Testing environments, the `apiCacheSoftExpires` will always be `false`
273
+ * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.
274
+ *
275
+ * This helps reduce flakiness and produce predictably rendered results in test suites.
276
+ *
277
+ * Requests that specifically set `cacheOptions.backgroundReload = true` will
278
+ * still be background reloaded in tests.
279
+ *
280
+ * This behavior can be opted out of by setting `disableTestOptimization = true`
281
+ * in the policy config.
282
+ *
283
+ * @public
284
+ */
283
285
  export declare class DefaultCachePolicy {
284
- config: PolicyConfig;
285
- _stores: WeakMap<Store, {
286
- invalidated: Set<StableDocumentIdentifier>;
287
- types: Map<string, Set<StableDocumentIdentifier>>;
288
- }>;
289
- _getStore(store: Store): {
290
- invalidated: Set<StableDocumentIdentifier>;
291
- types: Map<string, Set<StableDocumentIdentifier>>;
292
- };
293
- constructor(config: PolicyConfig);
294
- /**
295
- * Invalidate a request by its identifier for a given store instance.
296
- *
297
- * While the store argument may seem redundant, the CachePolicy
298
- * is designed to be shared across multiple stores / forks
299
- * of the store.
300
- *
301
- * ```ts
302
- * store.lifetimes.invalidateRequest(store, identifier);
303
- * ```
304
- *
305
- * @public
306
- * @param {StableDocumentIdentifier} identifier
307
- * @param {Store} store
308
- */
309
- invalidateRequest(identifier: StableDocumentIdentifier, store: Store): void;
310
- /**
311
- * Invalidate all requests associated to a specific type
312
- * for a given store instance.
313
- *
314
- * While the store argument may seem redundant, the CachePolicy
315
- * is designed to be shared across multiple stores / forks
316
- * of the store.
317
- *
318
- * This invalidation is done automatically when using this service
319
- * for both the CacheHandler and the LegacyNetworkHandler.
320
- *
321
- * ```ts
322
- * store.lifetimes.invalidateRequestsForType(store, 'person');
323
- * ```
324
- *
325
- * @public
326
- * @param {String} type
327
- * @param {Store} store
328
- */
329
- invalidateRequestsForType(type: string, store: Store): void;
330
- /**
331
- * Invoked when a request has been fulfilled from the configured request handlers.
332
- * This is invoked by the CacheHandler for both foreground and background requests
333
- * once the cache has been updated.
334
- *
335
- * Note, this is invoked by the CacheHandler regardless of whether
336
- * the request has a cache-key.
337
- *
338
- * This method should not be invoked directly by consumers.
339
- *
340
- * @public
341
- * @param {ImmutableRequestInfo} request
342
- * @param {ImmutableResponse} response
343
- * @param {Store} store
344
- * @param {StableDocumentIdentifier | null} identifier
345
- * @return {void}
346
- */
347
- didRequest(request: ImmutableRequestInfo, response: Response | ResponseInfo | null, identifier: StableDocumentIdentifier | null, store: Store): void;
348
- /**
349
- * Invoked to determine if the request may be fulfilled from cache
350
- * if possible.
351
- *
352
- * Note, this is only invoked by the CacheHandler if the request has
353
- * a cache-key.
354
- *
355
- * If no cache entry is found or the entry is hard expired,
356
- * the request will be fulfilled from the configured request handlers
357
- * and the cache will be updated before returning the response.
358
- *
359
- * @public
360
- * @param {StableDocumentIdentifier} identifier
361
- * @param {Store} store
362
- * @return {Boolean} true if the request is considered hard expired
363
- */
364
- isHardExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
365
- /**
366
- * Invoked if `isHardExpired` is false to determine if the request
367
- * should be update behind the scenes if cache data is already available.
368
- *
369
- * Note, this is only invoked by the CacheHandler if the request has
370
- * a cache-key.
371
- *
372
- * If true, the request will be fulfilled from cache while a backgrounded
373
- * request is made to update the cache via the configured request handlers.
374
- *
375
- * @public
376
- * @param {StableDocumentIdentifier} identifier
377
- * @param {Store} store
378
- * @return {Boolean} true if the request is considered soft expired
379
- */
380
- isSoftExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
286
+ config: PolicyConfig;
287
+ _stores: WeakMap<Store, {
288
+ invalidated: Set<StableDocumentIdentifier>;
289
+ types: Map<string, Set<StableDocumentIdentifier>>;
290
+ }>;
291
+ _getStore(store: Store): {
292
+ invalidated: Set<StableDocumentIdentifier>;
293
+ types: Map<string, Set<StableDocumentIdentifier>>;
294
+ };
295
+ constructor(config: PolicyConfig);
296
+ /**
297
+ * Invalidate a request by its identifier for a given store instance.
298
+ *
299
+ * While the store argument may seem redundant, the CachePolicy
300
+ * is designed to be shared across multiple stores / forks
301
+ * of the store.
302
+ *
303
+ * ```ts
304
+ * store.lifetimes.invalidateRequest(store, identifier);
305
+ * ```
306
+ *
307
+ * @public
308
+ * @param {StableDocumentIdentifier} identifier
309
+ * @param {Store} store
310
+ */
311
+ invalidateRequest(identifier: StableDocumentIdentifier, store: Store): void;
312
+ /**
313
+ * Invalidate all requests associated to a specific type
314
+ * for a given store instance.
315
+ *
316
+ * While the store argument may seem redundant, the CachePolicy
317
+ * is designed to be shared across multiple stores / forks
318
+ * of the store.
319
+ *
320
+ * This invalidation is done automatically when using this service
321
+ * for both the CacheHandler and the LegacyNetworkHandler.
322
+ *
323
+ * ```ts
324
+ * store.lifetimes.invalidateRequestsForType(store, 'person');
325
+ * ```
326
+ *
327
+ * @public
328
+ * @param {String} type
329
+ * @param {Store} store
330
+ */
331
+ invalidateRequestsForType(type: string, store: Store): void;
332
+ /**
333
+ * Invoked when a request has been fulfilled from the configured request handlers.
334
+ * This is invoked by the CacheHandler for both foreground and background requests
335
+ * once the cache has been updated.
336
+ *
337
+ * Note, this is invoked by the CacheHandler regardless of whether
338
+ * the request has a cache-key.
339
+ *
340
+ * This method should not be invoked directly by consumers.
341
+ *
342
+ * @public
343
+ * @param {ImmutableRequestInfo} request
344
+ * @param {ImmutableResponse} response
345
+ * @param {Store} store
346
+ * @param {StableDocumentIdentifier | null} identifier
347
+ * @return {void}
348
+ */
349
+ didRequest(request: ImmutableRequestInfo, response: Response | ResponseInfo | null, identifier: StableDocumentIdentifier | null, store: Store): void;
350
+ /**
351
+ * Invoked to determine if the request may be fulfilled from cache
352
+ * if possible.
353
+ *
354
+ * Note, this is only invoked by the CacheHandler if the request has
355
+ * a cache-key.
356
+ *
357
+ * If no cache entry is found or the entry is hard expired,
358
+ * the request will be fulfilled from the configured request handlers
359
+ * and the cache will be updated before returning the response.
360
+ *
361
+ * @public
362
+ * @param {StableDocumentIdentifier} identifier
363
+ * @param {Store} store
364
+ * @return {Boolean} true if the request is considered hard expired
365
+ */
366
+ isHardExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
367
+ /**
368
+ * Invoked if `isHardExpired` is false to determine if the request
369
+ * should be update behind the scenes if cache data is already available.
370
+ *
371
+ * Note, this is only invoked by the CacheHandler if the request has
372
+ * a cache-key.
373
+ *
374
+ * If true, the request will be fulfilled from cache while a backgrounded
375
+ * request is made to update the cache via the configured request handlers.
376
+ *
377
+ * @public
378
+ * @param {StableDocumentIdentifier} identifier
379
+ * @param {Store} store
380
+ * @return {Boolean} true if the request is considered soft expired
381
+ */
382
+ isSoftExpired(identifier: StableDocumentIdentifier, store: Store): boolean;
381
383
  }
382
384
  export {};
383
- //# sourceMappingURL=default-cache-policy.d.ts.map