@warp-drive/core 5.9.0-alpha.21 → 5.9.0-alpha.22

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 (217) hide show
  1. package/dist/{-private-DDz7mWBO.js → -private-B6zXXfjU.js} +3 -33
  2. package/dist/-private-B6zXXfjU.js.map +1 -0
  3. package/dist/{unpkg/dev-deprecated/-private-B2Am6Oqc.js → -private-BHA2tQn8.js} +2 -2
  4. package/dist/{-private-D4dQm2VC.js.map → -private-BHA2tQn8.js.map} +1 -1
  5. package/dist/{-private-DYCb3vir.js → -private-DYu9CenA.js} +2 -2
  6. package/dist/{-private-DYCb3vir.js.map → -private-DYu9CenA.js.map} +1 -1
  7. package/{declarations/change-WybCP5W2.d.ts → dist/change-C7kqv2kW.d.ts} +2 -2
  8. package/dist/change-C7kqv2kW.d.ts.map +1 -0
  9. package/{declarations/concepts-CFfLCQr6.d.ts → dist/concepts-LHsLJZMl.d.ts} +3 -3
  10. package/{declarations/concepts-CFfLCQr6.d.ts.map → dist/concepts-LHsLJZMl.d.ts.map} +1 -1
  11. package/{declarations/configure-DI1HqQpX.d.ts → dist/configure-B_F639tN.d.ts} +1 -31
  12. package/dist/configure-B_F639tN.d.ts.map +1 -0
  13. package/dist/configure.d.ts +2 -0
  14. package/dist/configure.js +1 -1
  15. package/{declarations/document-CRPmGrsO.d.ts → dist/document-BEn91SwT.d.ts} +2 -2
  16. package/{declarations/document-CRPmGrsO.d.ts.map → dist/document-BEn91SwT.d.ts.map} +1 -1
  17. package/{declarations → dist}/graph/-private.d.ts +1 -1
  18. package/dist/graph/-private.js +1 -1
  19. package/{declarations/graph-Di3nFhg0.d.ts → dist/graph-DLqYXP2z.d.ts} +4 -4
  20. package/{declarations/graph-Di3nFhg0.d.ts.map → dist/graph-DLqYXP2z.d.ts.map} +1 -1
  21. package/{declarations/identifier-DyEvjMjb.d.ts → dist/identifier-DQnqOSJK.d.ts} +1 -9
  22. package/dist/identifier-DQnqOSJK.d.ts.map +1 -0
  23. package/{declarations → dist}/index.d.ts +1 -1
  24. package/dist/index.js +1 -1
  25. package/{declarations/internal-DMxLqCZa.d.ts → dist/internal-Cz-893zD.d.ts} +95 -794
  26. package/dist/internal-Cz-893zD.d.ts.map +1 -0
  27. package/{declarations/mutations-al42_Yzp.d.ts → dist/mutations-CqtoGB4t.d.ts} +2 -2
  28. package/{declarations/mutations-al42_Yzp.d.ts.map → dist/mutations-CqtoGB4t.d.ts.map} +1 -1
  29. package/{declarations/operations-Do63dgrL.d.ts → dist/operations-D1qA6r0_.d.ts} +3 -3
  30. package/{declarations/operations-Do63dgrL.d.ts.map → dist/operations-D1qA6r0_.d.ts.map} +1 -1
  31. package/{declarations → dist}/reactive/-private.d.ts +1 -1
  32. package/dist/reactive/-private.js +1 -1
  33. package/{declarations → dist}/reactive.d.ts +1 -1
  34. package/dist/reactive.js +3 -3
  35. package/{declarations/record-DCFv3y1J.d.ts → dist/record-D3QQcaIR.d.ts} +2 -6
  36. package/{declarations/record-DCFv3y1J.d.ts.map → dist/record-D3QQcaIR.d.ts.map} +1 -1
  37. package/{declarations/relationship-CT9mFtav.d.ts → dist/relationship-CmHzMPKf.d.ts} +2 -2
  38. package/{declarations/relationship-CT9mFtav.d.ts.map → dist/relationship-CmHzMPKf.d.ts.map} +1 -1
  39. package/dist/{request-CclbTH_w.js → request-PKjwxLF8.js} +2 -2
  40. package/dist/{request-CclbTH_w.js.map → request-PKjwxLF8.js.map} +1 -1
  41. package/{declarations → dist}/request.d.ts +1 -1
  42. package/dist/request.js +1 -1
  43. package/{declarations → dist}/signals/-leaked.d.ts +2 -2
  44. package/dist/signals/-leaked.js +1 -1
  45. package/dist/{src-DgZnLlik.js → src-CKp0W15R.js} +5 -7
  46. package/dist/{src-DgZnLlik.js.map → src-CKp0W15R.js.map} +1 -1
  47. package/{declarations → dist}/store/-private.d.ts +1 -1
  48. package/dist/store/-private.js +1 -1
  49. package/dist/store-DNF9Rgoh.js.map +1 -1
  50. package/dist/store.d.ts +401 -0
  51. package/dist/store.d.ts.map +1 -0
  52. package/dist/types/-private.js +1 -1
  53. package/dist/types/cache/change.d.ts +2 -0
  54. package/{declarations → dist}/types/cache/mutations.d.ts +1 -1
  55. package/{declarations → dist}/types/cache/operations.d.ts +1 -1
  56. package/{declarations → dist}/types/cache/relationship.d.ts +1 -1
  57. package/dist/types/cache.d.ts +2 -0
  58. package/{declarations → dist}/types/graph.d.ts +1 -1
  59. package/{declarations → dist}/types/identifier.d.ts +1 -1
  60. package/dist/types/record.d.ts +2 -0
  61. package/{declarations → dist}/types/request.d.ts +1 -1
  62. package/dist/types/request.js +1 -1
  63. package/dist/types/runtime.js +1 -1
  64. package/dist/types/schema/concepts.d.ts +2 -0
  65. package/{declarations → dist}/types/schema/schema-service.d.ts +1 -1
  66. package/{declarations → dist}/types/spec/document.d.ts +1 -1
  67. package/dist/types/symbols.js +1 -1
  68. package/{declarations → dist}/types.d.ts +2 -2
  69. package/dist/unpkg/dev/{-private-C1QTxlMX.js → -private-BMBb6Idm.js} +3 -33
  70. package/dist/unpkg/dev/-private-BMBb6Idm.js.map +1 -0
  71. package/dist/{-private-D4dQm2VC.js → unpkg/dev/-private-CH8hVUND.js} +2 -2
  72. package/dist/unpkg/{dev-deprecated/-private-B2Am6Oqc.js.map → dev/-private-CH8hVUND.js.map} +1 -1
  73. package/dist/unpkg/{dev-deprecated/-private-9CIgW-DA.js → dev/-private-DKrinJQa.js} +2 -2
  74. package/dist/unpkg/dev/{-private-9CIgW-DA.js.map → -private-DKrinJQa.js.map} +1 -1
  75. package/dist/unpkg/dev/configure.js +1 -1
  76. package/dist/unpkg/dev/graph/-private.js +1 -1
  77. package/dist/unpkg/dev/index.js +1 -1
  78. package/dist/unpkg/dev/reactive/-private.js +1 -1
  79. package/dist/unpkg/dev/reactive.js +3 -3
  80. package/dist/unpkg/{dev-deprecated/request-4Qkr-Uqq.js → dev/request-BI-D_mth.js} +2 -2
  81. package/dist/unpkg/{dev-deprecated/request-4Qkr-Uqq.js.map → dev/request-BI-D_mth.js.map} +1 -1
  82. package/dist/unpkg/dev/request.js +1 -1
  83. package/dist/unpkg/dev/signals/-leaked.js +1 -1
  84. package/dist/unpkg/dev/{src-Dq17geGK.js → src-C1lc4Zpr.js} +5 -7
  85. package/dist/unpkg/dev/{src-Dq17geGK.js.map → src-C1lc4Zpr.js.map} +1 -1
  86. package/dist/unpkg/dev/store/-private.js +1 -1
  87. package/dist/unpkg/dev/store-1Jt0pxEL.js.map +1 -1
  88. package/dist/unpkg/dev/types/-private.js +1 -1
  89. package/dist/unpkg/dev/types/request.js +1 -1
  90. package/dist/unpkg/dev/types/runtime.js +1 -1
  91. package/dist/unpkg/dev/types/symbols.js +1 -1
  92. package/dist/unpkg/dev-deprecated/{-private-C1QTxlMX.js → -private-BMBb6Idm.js} +3 -33
  93. package/dist/unpkg/dev-deprecated/-private-BMBb6Idm.js.map +1 -0
  94. package/dist/unpkg/{dev/-private-B2Am6Oqc.js → dev-deprecated/-private-CH8hVUND.js} +2 -2
  95. package/dist/unpkg/{prod/-private-B2hz13Ei.js.map → dev-deprecated/-private-CH8hVUND.js.map} +1 -1
  96. package/dist/unpkg/{dev/-private-9CIgW-DA.js → dev-deprecated/-private-DKrinJQa.js} +2 -2
  97. package/dist/unpkg/dev-deprecated/{-private-9CIgW-DA.js.map → -private-DKrinJQa.js.map} +1 -1
  98. package/dist/unpkg/dev-deprecated/configure.js +1 -1
  99. package/dist/unpkg/dev-deprecated/graph/-private.js +1 -1
  100. package/dist/unpkg/dev-deprecated/index.js +1 -1
  101. package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -1
  102. package/dist/unpkg/dev-deprecated/reactive.js +3 -3
  103. package/dist/unpkg/{dev/request-4Qkr-Uqq.js → dev-deprecated/request-BI-D_mth.js} +2 -2
  104. package/dist/unpkg/{dev/request-4Qkr-Uqq.js.map → dev-deprecated/request-BI-D_mth.js.map} +1 -1
  105. package/dist/unpkg/dev-deprecated/request.js +1 -1
  106. package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -1
  107. package/dist/unpkg/dev-deprecated/{src-n5P9tTX4.js → src-B8F2cFXZ.js} +5 -7
  108. package/dist/unpkg/dev-deprecated/{src-n5P9tTX4.js.map → src-B8F2cFXZ.js.map} +1 -1
  109. package/dist/unpkg/dev-deprecated/store/-private.js +1 -1
  110. package/dist/unpkg/dev-deprecated/store-GrkCubY2.js.map +1 -1
  111. package/dist/unpkg/dev-deprecated/types/-private.js +1 -1
  112. package/dist/unpkg/dev-deprecated/types/request.js +1 -1
  113. package/dist/unpkg/dev-deprecated/types/runtime.js +1 -1
  114. package/dist/unpkg/dev-deprecated/types/symbols.js +1 -1
  115. package/dist/unpkg/prod/-private-D6KXpOWM.js +22 -0
  116. package/dist/unpkg/{prod-deprecated/-private-B2hz13Ei.js.map → prod/-private-D6KXpOWM.js.map} +1 -1
  117. package/dist/unpkg/prod/{-private-o67f3_hS.js → -private-DswNByIq.js} +2 -2
  118. package/dist/unpkg/{prod-deprecated/-private-o67f3_hS.js.map → prod/-private-DswNByIq.js.map} +1 -1
  119. package/dist/unpkg/prod/{-private-CFXr06QP.js → -private-mXZAC8Mj.js} +3 -33
  120. package/dist/unpkg/prod/-private-mXZAC8Mj.js.map +1 -0
  121. package/dist/unpkg/prod/configure.js +1 -1
  122. package/dist/unpkg/prod/graph/-private.js +1 -1
  123. package/dist/unpkg/prod/index.js +1 -1
  124. package/dist/unpkg/prod/reactive/-private.js +1 -1
  125. package/dist/unpkg/prod/reactive.js +3 -3
  126. package/dist/unpkg/prod/{request-xXJYO0jK.js → request-DJzvWtQa.js} +2 -2
  127. package/dist/unpkg/{prod-deprecated/request-xXJYO0jK.js.map → prod/request-DJzvWtQa.js.map} +1 -1
  128. package/dist/unpkg/prod/request.js +1 -1
  129. package/dist/unpkg/prod/signals/-leaked.js +1 -1
  130. package/dist/unpkg/prod/{src-BXphJ7nX.js → src-H86V3qRd.js} +5 -7
  131. package/dist/unpkg/prod/{src-BXphJ7nX.js.map → src-H86V3qRd.js.map} +1 -1
  132. package/dist/unpkg/prod/store/-private.js +1 -1
  133. package/dist/unpkg/prod/store-BWhmb7Ob.js.map +1 -1
  134. package/dist/unpkg/prod/types/-private.js +1 -1
  135. package/dist/unpkg/prod/types/request.js +1 -1
  136. package/dist/unpkg/prod/types/runtime.js +1 -1
  137. package/dist/unpkg/prod/types/symbols.js +1 -1
  138. package/dist/unpkg/prod-deprecated/{-private-B2hz13Ei.js → -private-D6KXpOWM.js} +2 -2
  139. package/dist/unpkg/{dev/-private-B2Am6Oqc.js.map → prod-deprecated/-private-D6KXpOWM.js.map} +1 -1
  140. package/dist/unpkg/prod-deprecated/{-private-o67f3_hS.js → -private-DswNByIq.js} +2 -2
  141. package/dist/unpkg/{prod/-private-o67f3_hS.js.map → prod-deprecated/-private-DswNByIq.js.map} +1 -1
  142. package/dist/unpkg/prod-deprecated/{-private-CFXr06QP.js → -private-mXZAC8Mj.js} +3 -33
  143. package/dist/unpkg/prod-deprecated/-private-mXZAC8Mj.js.map +1 -0
  144. package/dist/unpkg/prod-deprecated/configure.js +1 -1
  145. package/dist/unpkg/prod-deprecated/graph/-private.js +1 -1
  146. package/dist/unpkg/prod-deprecated/index.js +1 -1
  147. package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -1
  148. package/dist/unpkg/prod-deprecated/reactive.js +3 -3
  149. package/dist/unpkg/prod-deprecated/{request-xXJYO0jK.js → request-DJzvWtQa.js} +2 -2
  150. package/dist/unpkg/{prod/request-xXJYO0jK.js.map → prod-deprecated/request-DJzvWtQa.js.map} +1 -1
  151. package/dist/unpkg/prod-deprecated/request.js +1 -1
  152. package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -1
  153. package/dist/unpkg/prod-deprecated/{src-Bzk95Vdj.js → src-Q6WCEppf.js} +5 -7
  154. package/dist/unpkg/prod-deprecated/{src-Bzk95Vdj.js.map → src-Q6WCEppf.js.map} +1 -1
  155. package/dist/unpkg/prod-deprecated/store/-private.js +1 -1
  156. package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +1 -1
  157. package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
  158. package/dist/unpkg/prod-deprecated/types/request.js +1 -1
  159. package/dist/unpkg/prod-deprecated/types/runtime.js +1 -1
  160. package/dist/unpkg/prod-deprecated/types/symbols.js +1 -1
  161. package/package.json +8 -8
  162. package/declarations/change-WybCP5W2.d.ts.map +0 -1
  163. package/declarations/configure-DI1HqQpX.d.ts.map +0 -1
  164. package/declarations/configure.d.ts +0 -2
  165. package/declarations/identifier-DyEvjMjb.d.ts.map +0 -1
  166. package/declarations/internal-DMxLqCZa.d.ts.map +0 -1
  167. package/declarations/store.d.ts +0 -10363
  168. package/declarations/store.d.ts.map +0 -1
  169. package/declarations/types/cache/change.d.ts +0 -2
  170. package/declarations/types/cache.d.ts +0 -2
  171. package/declarations/types/record.d.ts +0 -2
  172. package/declarations/types/schema/concepts.d.ts +0 -2
  173. package/dist/-private-DDz7mWBO.js.map +0 -1
  174. package/dist/unpkg/dev/-private-C1QTxlMX.js.map +0 -1
  175. package/dist/unpkg/dev-deprecated/-private-C1QTxlMX.js.map +0 -1
  176. package/dist/unpkg/prod/-private-B2hz13Ei.js +0 -22
  177. package/dist/unpkg/prod/-private-CFXr06QP.js.map +0 -1
  178. package/dist/unpkg/prod-deprecated/-private-CFXr06QP.js.map +0 -1
  179. /package/{declarations → dist}/aliases-BWYW5EhX.d.ts +0 -0
  180. /package/{declarations → dist}/aliases-BWYW5EhX.d.ts.map +0 -0
  181. /package/{declarations → dist}/build-config/babel-macros.d.ts +0 -0
  182. /package/{declarations → dist}/build-config/canary-features.d.ts +0 -0
  183. /package/{declarations → dist}/build-config/debugging.d.ts +0 -0
  184. /package/{declarations → dist}/build-config/deprecations.d.ts +0 -0
  185. /package/{declarations → dist}/build-config/env.d.ts +0 -0
  186. /package/{declarations → dist}/build-config/macros.d.ts +0 -0
  187. /package/{declarations → dist}/build-config.d.ts +0 -0
  188. /package/{declarations → dist}/error-50OSEhsF.d.ts +0 -0
  189. /package/{declarations → dist}/error-50OSEhsF.d.ts.map +0 -0
  190. /package/{declarations → dist}/fields-FM7peCiM.d.ts +0 -0
  191. /package/{declarations → dist}/fields-FM7peCiM.d.ts.map +0 -0
  192. /package/{declarations → dist}/json-api-raw-C5APJHHB.d.ts +0 -0
  193. /package/{declarations → dist}/json-api-raw-C5APJHHB.d.ts.map +0 -0
  194. /package/{declarations → dist}/params-DrEx3bf8.d.ts +0 -0
  195. /package/{declarations → dist}/params-DrEx3bf8.d.ts.map +0 -0
  196. /package/{declarations → dist}/raw-D5hnjiq7.d.ts +0 -0
  197. /package/{declarations → dist}/raw-D5hnjiq7.d.ts.map +0 -0
  198. /package/{declarations → dist}/signals/-leaked.d.ts.map +0 -0
  199. /package/{declarations → dist}/symbols-DjRDCeX0.d.ts +0 -0
  200. /package/{declarations → dist}/symbols-DjRDCeX0.d.ts.map +0 -0
  201. /package/{declarations → dist}/types/-private.d.ts +0 -0
  202. /package/{declarations → dist}/types/-private.d.ts.map +0 -0
  203. /package/{declarations → dist}/types/cache/aliases.d.ts +0 -0
  204. /package/{declarations → dist}/types/json/raw.d.ts +0 -0
  205. /package/{declarations → dist}/types/params.d.ts +0 -0
  206. /package/{declarations → dist}/types/runtime.d.ts +0 -0
  207. /package/{declarations → dist}/types/runtime.d.ts.map +0 -0
  208. /package/{declarations → dist}/types/schema/fields.d.ts +0 -0
  209. /package/{declarations → dist}/types/schema/fields.type-test.d.ts +0 -0
  210. /package/{declarations → dist}/types/spec/error.d.ts +0 -0
  211. /package/{declarations → dist}/types/spec/json-api-raw.d.ts +0 -0
  212. /package/{declarations → dist}/types/symbols.d.ts +0 -0
  213. /package/{declarations → dist}/types/utils.d.ts +0 -0
  214. /package/{declarations → dist}/utils/string.d.ts +0 -0
  215. /package/{declarations → dist}/utils/string.d.ts.map +0 -0
  216. /package/{declarations → dist}/utils-BtURiy8l.d.ts +0 -0
  217. /package/{declarations → dist}/utils-BtURiy8l.d.ts.map +0 -0
@@ -1,3 +1,3 @@
1
- import { C as setRecordIdentifier, D as isResourceKey, E as isRequestKey, F as ensureStringId, I as log, L as logGroup, N as normalizeModelName, P as coerceId, S as recordIdentifierFor, T as assertPrivateCapabilities, _ as isPrivateStore, b as StoreMap, f as createLegacyManyArray, g as assertPrivateStore, h as Store, m as CacheHandler, p as constructResource, v as RecordArrayManager, w as storeFor, x as _clearCaches, y as fastPush } from "../src-n5P9tTX4.js";
1
+ import { C as setRecordIdentifier, D as isResourceKey, E as isRequestKey, F as ensureStringId, I as log, L as logGroup, N as normalizeModelName, P as coerceId, S as recordIdentifierFor, T as assertPrivateCapabilities, _ as isPrivateStore, b as StoreMap, f as createLegacyManyArray, g as assertPrivateStore, h as Store, m as CacheHandler, p as constructResource, v as RecordArrayManager, w as storeFor, x as _clearCaches, y as fastPush } from "../src-B8F2cFXZ.js";
2
2
 
3
3
  export { CacheHandler, RecordArrayManager, Store, StoreMap, _clearCaches, normalizeModelName as _deprecatingNormalize, assertPrivateCapabilities, assertPrivateStore, coerceId, constructResource, createLegacyManyArray, ensureStringId, fastPush, isPrivateStore, isRequestKey, isResourceKey, log, logGroup, recordIdentifierFor, setRecordIdentifier, storeFor };
@@ -1 +1 @@
1
- {"version":3,"file":"store-GrkCubY2.js","names":["LRUCache","getGlobalConfig","getGlobalConfig0","NUMERIC_KEYS","Set","parseCacheControl","header","CACHE_CONTROL_CACHE","get","key","value","isParsingKey","cacheControlValue","i","length","char","charAt","test","Error","has","parseCacheControlValue","stringToParse","parsedValue","Number","parseInt","isNaN","isExpired","cacheKey","request","config","constraints","result","WarpDrive","debug","LOG_CACHE_POLICY","globalThis","getWarpDriveRuntimeConfig","console","log","lid","headers","response","now","Date","date","xWarpDriveExpires","expirationTime","getTime","cacheControl","age","maxAge","ageValue","dateValue","Expires","expires","apiCacheHardExpires","disableTestOptimization","apiCacheSoftExpires","time","deadline","DefaultCachePolicy","_getStore","store","set","_stores","invalidated","types","Map","constructor","WeakMap","_config","arguments","warn","invalidateRequest","add","invalidateRequestsForType","type","storeCache","notifications","forEach","id","notify","didRequest","op","statusNumber","status","records","map","r","additionalTypes","cacheOptions","delete","isHardExpired","cache","cached","peekRequest","isSoftExpired"],"sources":["../../../src/store/-private/default-cache-policy.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { CacheHandler, Fetch } from '@warp-drive/core';\nimport { LOG_CACHE_POLICY } from '@warp-drive/core/build-config/debugging';\nimport { TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { RequestKey, ResourceKey } from '@warp-drive/core/types/identifier';\nimport type {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n CacheOptions,\n ImmutableRequestInfo,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n RequestInfo,\n ResponseInfo,\n StructuredDocument,\n} from '@warp-drive/core/types/request';\nimport type { ResourceDocument } from '@warp-drive/core/types/spec/document';\n\nimport { LRUCache } from '../../utils/string';\nimport type { CachePolicy } from '../-private';\n\ntype UnsubscribeToken = object;\ntype CacheOperation = 'added' | 'removed' | 'updated' | 'state';\ntype DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';\n\nexport interface NotificationCallback {\n (resourceKey: ResourceKey, notificationType: 'attributes' | 'relationships', key?: string): void;\n (resourceKey: ResourceKey, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;\n // (resourceKey: ResourceKey, notificationType: NotificationType, key?: string): void;\n}\n\ninterface ResourceOperationCallback {\n // resource updates\n (resourceKey: ResourceKey, notificationType: CacheOperation): void;\n}\n\ninterface DocumentOperationCallback {\n // document updates\n (cacheKey: RequestKey, notificationType: DocumentCacheOperation): void;\n}\n\ntype NotificationManager = {\n subscribe(resourceKey: ResourceKey, callback: NotificationCallback): UnsubscribeToken;\n subscribe(cacheKey: 'resource', callback: ResourceOperationCallback): UnsubscribeToken;\n subscribe(cacheKey: 'document' | RequestKey, callback: DocumentOperationCallback): UnsubscribeToken;\n\n notify(cacheKey: ResourceKey, value: 'attributes' | 'relationships', key?: string): boolean;\n notify(cacheKey: ResourceKey, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;\n notify(cacheKey: ResourceKey, value: CacheOperation): boolean;\n notify(cacheKey: RequestKey, value: DocumentCacheOperation): boolean;\n};\n\ntype Store = {\n cache: Cache;\n notifications: NotificationManager;\n};\n\n/**\n * Interface of a parsed Cache-Control header value.\n *\n * - [MDN Cache-Control Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control)\n */\nexport interface CacheControlValue {\n /** Indicates the response will never change; parsed but not currently used by this cache policy's expiration logic. */\n immutable?: boolean;\n /** Seconds since the response's `Date` that it is considered fresh; combined with the `Age` header to determine expiration. */\n 'max-age'?: number;\n /** Indicates a stale response must be revalidated before use; parsed but not currently used by this cache policy's expiration logic. */\n 'must-revalidate'?: boolean;\n /** Indicates the client must understand the response's status code semantics before caching; parsed but not currently used by this cache policy's expiration logic. */\n 'must-understand'?: boolean;\n /** Indicates the response must be revalidated before being reused from cache; parsed but not currently used by this cache policy's expiration logic. */\n 'no-cache'?: boolean;\n /** Indicates the response must not be stored in any cache; parsed but not currently used by this cache policy's expiration logic. */\n 'no-store'?: boolean;\n /** Indicates the response must not be transformed by intermediaries; parsed but not currently used by this cache policy's expiration logic. */\n 'no-transform'?: boolean;\n /** Indicates only an already-cached response should be used; parsed but not currently used by this cache policy's expiration logic. */\n 'only-if-cached'?: boolean;\n /** Indicates the response is intended for a single user and should not be stored by shared caches; parsed but not currently used by this cache policy's expiration logic. */\n private?: boolean;\n /** Like `must-revalidate` but only for shared caches; parsed but not currently used by this cache policy's expiration logic. */\n 'proxy-revalidate'?: boolean;\n /** Indicates the response may be stored by any cache; parsed but not currently used by this cache policy's expiration logic. */\n public?: boolean;\n /** Seconds since the response's `Date` that it is considered fresh for shared caches; used as a fallback for `max-age` when determining expiration. */\n 's-maxage'?: number;\n /** Seconds a stale response may be reused if an error occurs while revalidating; parsed but not currently used by this cache policy's expiration logic. */\n 'stale-if-error'?: number;\n /** Seconds a stale response may be reused while a revalidation happens in the background; parsed but not currently used by this cache policy's expiration logic. */\n 'stale-while-revalidate'?: number;\n}\n\ntype CacheControlKey = keyof CacheControlValue;\n\nconst NUMERIC_KEYS = new Set(['max-age', 's-maxage', 'stale-if-error', 'stale-while-revalidate']);\n\n/**\n * Parses a string Cache-Control header value into an object with the following structure:\n *\n * ```ts\n * interface CacheControlValue {\n * immutable?: boolean;\n * 'max-age'?: number;\n * 'must-revalidate'?: boolean;\n * 'must-understand'?: boolean;\n * 'no-cache'?: boolean;\n * 'no-store'?: boolean;\n * 'no-transform'?: boolean;\n * 'only-if-cached'?: boolean;\n * private?: boolean;\n * 'proxy-revalidate'?: boolean;\n * public?: boolean;\n * 's-maxage'?: number;\n * 'stale-if-error'?: number;\n * 'stale-while-revalidate'?: number;\n * }\n * ```\n *\n * See also {@link CacheControlValue} and [Response Directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control#response_directives)\n *\n * @public\n */\nexport function parseCacheControl(header: string): CacheControlValue {\n return CACHE_CONTROL_CACHE.get(header);\n}\n\nconst CACHE_CONTROL_CACHE = new LRUCache((header: string) => {\n let key: CacheControlKey = '' as CacheControlKey;\n let value = '';\n let isParsingKey = true;\n const cacheControlValue: CacheControlValue = {};\n\n for (let i = 0; i < header.length; i++) {\n const char = header.charAt(i);\n if (char === ',') {\n assert(`Invalid Cache-Control value, expected a value`, !isParsingKey || !NUMERIC_KEYS.has(key));\n assert(\n `Invalid Cache-Control value, expected a value after \"=\" but got \",\"`,\n i === 0 || header.charAt(i - 1) !== '='\n );\n isParsingKey = true;\n // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n key = '' as CacheControlKey;\n value = '';\n continue;\n } else if (char === '=') {\n assert(`Invalid Cache-Control value, expected a value after \"=\"`, i + 1 !== header.length);\n isParsingKey = false;\n } else if (char === ' ' || char === `\\t` || char === `\\n`) {\n continue;\n } else if (isParsingKey) {\n key += char;\n } else {\n value += char;\n }\n\n if (i === header.length - 1) {\n // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n }\n }\n\n return cacheControlValue;\n}, 200);\n\nfunction parseCacheControlValue(stringToParse: string): number {\n const parsedValue = Number.parseInt(stringToParse);\n assert(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`, !Number.isNaN(parsedValue));\n assert(`Invalid Cache-Control value, expected a number greater than 0 but got - ${stringToParse}`, parsedValue >= 0);\n if (Number.isNaN(parsedValue) || parsedValue < 0) {\n return 0;\n }\n\n return parsedValue;\n}\n\nfunction isExpired(cacheKey: RequestKey, request: StructuredDocument<ResourceDocument>, config: PolicyConfig): boolean {\n const { constraints } = config;\n\n if (constraints?.isExpired) {\n const result = constraints.isExpired(request);\n if (result !== null) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because constraints.isExpired returned ${result}`\n );\n }\n return result;\n }\n }\n\n const { headers } = request.response!;\n\n if (!headers) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no headers were provided`);\n }\n\n // if we have no headers then both the headers based expiration\n // and the time based expiration will be considered expired\n return true;\n }\n\n // check for X-WarpDrive-Expires\n const now = Date.now();\n const date = headers.get('Date');\n\n if (constraints?.headers) {\n if (constraints.headers['X-WarpDrive-Expires']) {\n const xWarpDriveExpires = headers.get('X-WarpDrive-Expires');\n if (xWarpDriveExpires) {\n const expirationTime = new Date(xWarpDriveExpires).getTime();\n const result = now >= expirationTime;\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by X-WarpDrive-Expires header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n return result;\n }\n }\n\n // check for Cache-Control\n if (constraints.headers['Cache-Control']) {\n const cacheControl = headers.get('Cache-Control');\n const age = headers.get('Age');\n\n if (cacheControl && age && date) {\n const cacheControlValue = parseCacheControl(cacheControl);\n\n // max-age and s-maxage are stored in\n const maxAge = cacheControlValue['max-age'] || cacheControlValue['s-maxage'];\n\n if (maxAge) {\n // age is stored in seconds\n const ageValue = parseInt(age, 10);\n assert(`Invalid Cache-Control value, expected a number but got - ${age}`, !Number.isNaN(ageValue));\n assert(`Invalid Cache-Control value, expected a number greater than 0 but got - ${age}`, ageValue >= 0);\n\n if (!Number.isNaN(ageValue) && ageValue >= 0) {\n const dateValue = new Date(date).getTime();\n const expirationTime = dateValue + (maxAge - ageValue) * 1000;\n const result = now >= expirationTime;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Cache-Control header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n\n return result;\n }\n }\n }\n }\n\n // check for Expires\n if (constraints.headers.Expires) {\n const expires = headers.get('Expires');\n if (expires) {\n const expirationTime = new Date(expires).getTime();\n const result = now >= expirationTime;\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Expires header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n return result;\n }\n }\n }\n\n // check for Date\n if (!date) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no Date header was provided`);\n }\n return true;\n }\n\n let expirationTime = config.apiCacheHardExpires;\n if (TESTING) {\n if (!config.disableTestOptimization) {\n expirationTime = config.apiCacheSoftExpires;\n }\n }\n\n const time = new Date(date).getTime();\n const deadline = time + expirationTime;\n const result = now >= deadline;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the apiCacheHardExpires time since the response's Date header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n\n return result;\n}\n\n/**\n * The constraint options for {@link PolicyConfig.constraints}\n */\nexport interface PolicyConfigConstraints {\n /**\n * Headers that should be checked for expiration.\n *\n */\n headers?: {\n /**\n * Whether the `Cache-Control` header should be checked for expiration.\n * If `true`, then the `max-age` and `s-maxage` directives are used alongside\n * the `Age` and `Date` headers to determine if the expiration time has passed.\n *\n * Other directives are ignored.\n *\n * 'Cache-Control' will take precedence over 'Expires' if both are present\n * and both configured to be checked.\n *\n */\n 'Cache-Control'?: boolean;\n\n /**\n * Whether the `Expires` header should be checked for expiration.\n *\n * If `true`, then the `Expires` header is used to caclulate the expiration time\n * and determine if the expiration time has passed.\n *\n * 'Cache-Control' will take precedence over 'Expires' if both are present.\n *\n */\n Expires?: boolean;\n\n /**\n * Whether the `X-WarpDrive-Expires` header should be checked for expiration.\n *\n * If `true`, then the `X-WarpDrive-Expires` header is used to caclulate the expiration time\n * and determine if the expiration time has passed.\n *\n * This header will take precedence over 'Cache-Control' and 'Expires' if all three are present.\n *\n * The header's value should be a [UTC date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString).\n *\n */\n 'X-WarpDrive-Expires'?: boolean;\n };\n\n /**\n * A function that should be called to determine if the request is expired.\n *\n * If present, this function will be called with the request and should return\n * `true` if the request is expired, `false` if it is not expired, and\n * `null` if the expiration status is unknown.\n *\n * If the function does not return `null`,\n *\n */\n isExpired?: (request: StructuredDocument<ResourceDocument>) => boolean | null;\n}\n\n/**\n * The configuration options for the {@link DefaultCachePolicy}\n *\n * ```ts [app/services/store.ts]\n * import { Store } from '@warp-drive/core';\n * import { DefaultCachePolicy } from '@warp-drive/core/store'; // [!code focus]\n *\n * export default class AppStore extends Store {\n * lifetimes = new DefaultCachePolicy({ // [!code focus:3]\n * // ... PolicyConfig Settings ... //\n * });\n * }\n * ```\n *\n */\nexport interface PolicyConfig {\n /**\n * the number of milliseconds after which a request is considered\n * stale. If a request is issued again after this time, the request\n * will respond from cache immediately while a background request\n * is made to update the cache.\n *\n * This is calculated against the `date` header of the response.\n *\n * If your API does not provide a `date` header, the {@link Fetch} handler\n * will automatically add it to responses if it is not present. Responses\n * without a `date` header will be considered stale immediately.\n *\n */\n apiCacheSoftExpires: number;\n /**\n * the number of milliseconds after which a request is considered\n * expired and should be re-fetched. If a request is issued again\n * after this time, the request will disregard the cache and\n * wait for a fresh response from the API.\n *\n * This is calculated against the `date` header of the response.\n *\n * If your API does not provide a `date` header, the {@link Fetch} handler\n * will automatically add it to responses if it is not present. Responses\n * without a `date` header will be considered hard expired immediately.\n *\n */\n apiCacheHardExpires: number;\n /**\n * In Testing environments, the `apiCacheSoftExpires` will always be `false`\n * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.\n *\n * This helps reduce flakiness and produce predictably rendered results in test suites.\n *\n * Requests that specifically set {@link RequestInfo.cacheOptions.backgroundReload | cacheOptions.backgroundReload }\n * will still be background reloaded in tests.\n *\n * This behavior can be opted out of by setting this value to `true`.\n *\n */\n disableTestOptimization?: boolean;\n\n /**\n * In addition to the simple time-based expiration strategy, CachePolicy\n * supports various common server-supplied expiration strategies via\n * headers, as well as custom expiration strategies via the {@link PolicyConfigConstraints.isExpired | isExpired}\n * function.\n *\n * Requests will be validated for expiration against these constraints.\n * If any of these constraints are not met, the request will be considered\n * expired. If all constraints are met, the request will be considered\n * valid and the time based expiration strategy will NOT be used.\n *\n * Meeting a constraint means BOTH that the properties the constraint\n * requires are present AND that the expiration time indicated by those\n * properties has not been exceeded.\n *\n * In other words, if the properties for a constraint are not present,\n * this does not count either as meeting or as not meeting the constraint,\n * the constraint simply does not apply.\n *\n * The `isExpired` function is called with the request and should return\n * `true` if the request is expired, `false` if it is not expired, and\n * `null` if the expiration status is unknown.\n *\n * In order constraints are checked:\n *\n * - isExpired function\n * - ↳ (if null) X-WarpDrive-Expires header\n * - ↳ (if null) Cache-Control header\n * - ↳ (if null) Expires header\n *\n * See {@link PolicyConfigConstraints} for configuration options.\n */\n constraints?: PolicyConfigConstraints;\n}\n\n/**\n * A basic {@link CachePolicy} that can be added to the Store service.\n *\n * ```ts [app/services/store.ts]\n * import { Store } from '@warp-drive/core';\n * import { DefaultCachePolicy } from '@warp-drive/core/store'; // [!code focus]\n *\n * export default class AppStore extends Store {\n * lifetimes = new DefaultCachePolicy({ // [!code focus:5]\n * apiCacheSoftExpires: 30_000,\n * apiCacheHardExpires: 60_000,\n * // ... Other PolicyConfig Settings ... //\n * });\n * }\n * ```\n *\n * :::tip 💡 TIP\n * Date headers do not have millisecond precision, so expiration times should\n * generally be larger than 1000ms.\n * :::\n *\n * See also {@link PolicyConfig} for configuration options.\n *\n * ### The Mechanics\n *\n * This policy determines staleness based on various configurable constraints falling back to a simple\n * check of the time elapsed since the request was last received from the API using the `date` header\n * from the last response.\n *\n * :::tip 💡 TIP\n * The {@link Fetch} handler provided by `@warp-drive/core` will automatically\n * add the `date` header to responses if it is not present.\n * :::\n *\n * - For manual override of reload see {@link CacheOptions.reload | cacheOptions.reload}\n * - For manual override of background reload see {@link CacheOptions.backgroundReload | cacheOptions.backgroundReload}\n *\n * In order expiration is determined by:\n *\n * ```md\n * Is explicitly invalidated by `cacheOptions.reload`\n * ↳ (if falsey) if the request has been explicitly invalidated\n * since the last request (see Automatic Invalidation below)\n * ↳ (if false) (If Active) isExpired function\n * ↳ (if null) (If Active) X-WarpDrive-Expires header\n * ↳ (if null) (If Active) Cache-Control header\n * ↳ (if null) (If Active) Expires header\n * ↳ (if null) Date header + apiCacheHardExpires < current time\n *\n * -- <if above is false, a background request is issued if> --\n *\n * ↳ is invalidated by `cacheOptions.backgroundReload`\n * ↳ (if falsey) Date header + apiCacheSoftExpires < current time\n * ```\n *\n * ### Automatic Invalidation / Entanglement\n *\n * It also invalidates any request with an {@link RequestInfo.op | OpCode} of `\"query\"`\n * for which {@link CacheOptions.types | cacheOptions.types} was provided\n * when a request with an `OpCode` of `\"createRecord\"` is successful and also includes\n * a matching type in its own `cacheOptions.types` array.\n\n * :::tip 💡 TIP\n * Abstracting this behavior via builders is recommended to ensure consistency.\n * :::\n *\n * ### Testing\n *\n * In Testing environments:\n *\n * - `apiCacheSoftExpires` will always be `false`\n * - `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.\n *\n * This helps reduce flakiness and produce predictably rendered results in test suites.\n *\n * Requests that specifically set `cacheOptions.backgroundReload = true` will\n * still be background reloaded in tests.\n *\n * This behavior can be opted out of by setting `disableTestOptimization = true`\n * in the policy config.\n *\n * @public\n */\nexport class DefaultCachePolicy implements CachePolicy {\n /**\n * @internal\n */\n declare private config: PolicyConfig;\n /**\n * @internal\n */\n declare private _stores: WeakMap<Store, { invalidated: Set<RequestKey>; types: Map<string, Set<RequestKey>> }>;\n\n /**\n * @internal\n */\n private _getStore(store: Store): {\n invalidated: Set<RequestKey>;\n types: Map<string, Set<RequestKey>>;\n } {\n let set = this._stores.get(store);\n if (!set) {\n set = { invalidated: new Set(), types: new Map() };\n this._stores.set(store, set);\n }\n return set;\n }\n\n constructor(config: PolicyConfig) {\n this._stores = new WeakMap();\n\n const _config = arguments.length === 1 ? config : (arguments[1] as unknown as PolicyConfig);\n deprecate(\n `Passing a Store to the CachePolicy is deprecated, please pass only a config instead.`,\n arguments.length === 1,\n {\n id: 'ember-data:request-utils:lifetimes-service-store-arg',\n since: {\n enabled: '5.4',\n available: '4.13',\n },\n for: '@ember-data/request-utils',\n until: '6.0',\n }\n );\n assert(`You must pass a config to the CachePolicy`, _config);\n assert(`You must pass a apiCacheSoftExpires to the CachePolicy`, typeof _config.apiCacheSoftExpires === 'number');\n assert(`You must pass a apiCacheHardExpires to the CachePolicy`, typeof _config.apiCacheHardExpires === 'number');\n this.config = _config;\n }\n\n /**\n * Invalidate a request by its CacheKey for the given store instance.\n *\n * While the store argument may seem redundant, the CachePolicy\n * is designed to be shared across multiple stores / forks\n * of the store.\n *\n * ```ts\n * store.lifetimes.invalidateRequest(store, cacheKey);\n * ```\n *\n * @public\n */\n invalidateRequest(cacheKey: RequestKey, store: Store): void {\n this._getStore(store).invalidated.add(cacheKey);\n }\n\n /**\n * Invalidate all requests associated to a specific type\n * for a given store instance.\n *\n * While the store argument may seem redundant, the CachePolicy\n * is designed to be shared across multiple stores / forks\n * of the store.\n *\n * This invalidation is done automatically when using this service\n * for both the {@link CacheHandler} and the [NetworkHandler](/api/@warp-drive/legacy/compat/variables/LegacyNetworkHandler).\n *\n * ```ts\n * store.lifetimes.invalidateRequestsForType(store, 'person');\n * ```\n *\n * @public\n */\n invalidateRequestsForType(type: string, store: Store): void {\n const storeCache = this._getStore(store);\n const set = storeCache.types.get(type);\n const notifications = store.notifications;\n\n if (set) {\n // TODO batch notifications\n set.forEach((id) => {\n storeCache.invalidated.add(id);\n // @ts-expect-error\n notifications.notify(id, 'invalidated', null);\n });\n }\n }\n\n /**\n * Invoked when a request has been fulfilled from the configured request handlers.\n * This is invoked by the CacheHandler for both foreground and background requests\n * once the cache has been updated.\n *\n * Note, this is invoked by the {@link CacheHandler} regardless of whether\n * the request has a cache-key.\n *\n * This method should not be invoked directly by consumers.\n *\n * @public\n */\n didRequest(\n request: ImmutableRequestInfo,\n response: Response | ResponseInfo | null,\n cacheKey: RequestKey | null,\n store: Store\n ): void {\n // if this is a successful createRecord request, invalidate the cacheKey for the type\n if (request.op === 'createRecord') {\n const statusNumber = response?.status ?? 0;\n if (statusNumber >= 200 && statusNumber < 400) {\n const types = new Set(request.records?.map((r) => r.type));\n const additionalTypes = request.cacheOptions?.types;\n additionalTypes?.forEach((type) => {\n types.add(type);\n });\n\n types.forEach((type) => {\n this.invalidateRequestsForType(type, store);\n });\n }\n\n // add this document's cacheKey to a map for all associated types\n // it is recommended to only use this for queries\n } else if (cacheKey && request.cacheOptions?.types?.length) {\n const storeCache = this._getStore(store);\n request.cacheOptions?.types.forEach((type) => {\n const set = storeCache.types.get(type);\n if (set) {\n set.add(cacheKey);\n storeCache.invalidated.delete(cacheKey);\n } else {\n storeCache.types.set(type, new Set([cacheKey]));\n }\n });\n }\n }\n\n /**\n * Invoked to determine if the request may be fulfilled from cache\n * if possible.\n *\n * Note, this is only invoked by the {@link CacheHandler} if the request has\n * a cache-key.\n *\n * If no cache entry is found or the entry is hard expired,\n * the request will be fulfilled from the configured request handlers\n * and the cache will be updated before returning the response.\n *\n * @public\n * @return true if the request is considered hard expired\n */\n isHardExpired(cacheKey: RequestKey, store: Store): boolean {\n // if we are explicitly invalidated, we are hard expired\n const storeCache = this._getStore(store);\n if (storeCache.invalidated.has(cacheKey)) {\n return true;\n }\n const cache = store.cache;\n const cached = cache.peekRequest(cacheKey);\n\n if (!cached?.response) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no cache entry was found`);\n }\n return true;\n }\n\n return isExpired(cacheKey, cached, this.config);\n }\n\n /**\n * Invoked if `isHardExpired` is false to determine if the request\n * should be update behind the scenes if cache data is already available.\n *\n * Note, this is only invoked by the {@link CacheHandler} if the request has\n * a cache-key.\n *\n * If true, the request will be fulfilled from cache while a backgrounded\n * request is made to update the cache via the configured request handlers.\n *\n * @public\n * @return true if the request is considered soft expired\n */\n isSoftExpired(cacheKey: RequestKey, store: Store): boolean {\n if (TESTING) {\n if (!this.config.disableTestOptimization) {\n return false;\n }\n }\n const cache = store.cache;\n const cached = cache.peekRequest(cacheKey);\n\n if (cached?.response) {\n const date = cached.response.headers.get('date');\n\n if (!date) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is STALE because no date header was found`);\n }\n return true;\n } else {\n const time = new Date(date).getTime();\n const now = Date.now();\n const deadline = time + this.config.apiCacheSoftExpires;\n const result = now >= deadline;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'STALE' : 'NOT stale'}. Expiration time: ${deadline}, now: ${now}`\n );\n }\n\n return result;\n }\n }\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is STALE because no cache entry was found`);\n }\n\n return true;\n }\n}\n"],"mappings":";;;;;;;;;AAiGA,MAAMG,+BAAe,IAAIC,IAAI;CAAC;CAAW;CAAY;CAAkB;AAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BhG,SAAgBC,kBAAkBC,QAAmC;CACnE,OAAOC,oBAAoBC,IAAIF,MAAM;AACvC;AAEA,MAAMC,sBAAsB,IAAIP,UAAUM,WAAmB;CAC3D,IAAIG,MAAuB;CAC3B,IAAIC,QAAQ;CACZ,IAAIC,eAAe;CACnB,MAAMC,oBAAuC,CAAC;CAE9C,KAAK,IAAIC,IAAI,GAAGA,IAAIP,OAAOQ,QAAQD,KAAK;EACtC,MAAME,OAAOT,OAAOU,OAAOH,CAAC;EAC5B,IAAIE,SAAS,KAAK;GAChB,EAAAE,SAAA;IAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAO,+CAA+C;GAAA,EAAA,CAAE,CAACP,gBAAgB,CAACR,aAAagB,IAAIV,GAAG,CAAC;GAC/F,EAAAQ,SAAA;IAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MACE,qEAAqE;GAAA,EAAA,CACrEL,MAAM,KAAKP,OAAOU,OAAOH,IAAI,CAAC,MAAM,GAAG;GAEzCF,eAAe;GAEfC,kBAAkBH,OAAON,aAAagB,IAAIV,GAAG,IAAIW,uBAAuBV,KAAK,IAAI;GACjFD,MAAM;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IAAG,2CAA4C;EAGtF,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"store-GrkCubY2.js","names":["LRUCache","getGlobalConfig","getGlobalConfig0","NUMERIC_KEYS","Set","parseCacheControl","header","CACHE_CONTROL_CACHE","get","key","value","isParsingKey","cacheControlValue","i","length","char","charAt","test","Error","has","parseCacheControlValue","stringToParse","parsedValue","Number","parseInt","isNaN","isExpired","cacheKey","request","config","constraints","result","WarpDrive","debug","LOG_CACHE_POLICY","globalThis","getWarpDriveRuntimeConfig","console","log","lid","headers","response","now","Date","date","xWarpDriveExpires","expirationTime","getTime","cacheControl","age","maxAge","ageValue","dateValue","Expires","expires","apiCacheHardExpires","disableTestOptimization","apiCacheSoftExpires","time","deadline","DefaultCachePolicy","_getStore","store","set","_stores","invalidated","types","Map","constructor","WeakMap","_config","arguments","warn","invalidateRequest","add","invalidateRequestsForType","type","storeCache","notifications","forEach","id","notify","didRequest","op","statusNumber","status","records","map","r","additionalTypes","cacheOptions","delete","isHardExpired","cache","cached","peekRequest","isSoftExpired"],"sources":["../../../src/store/-private/default-cache-policy.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { LOG_CACHE_POLICY } from '@warp-drive/core/build-config/debugging';\nimport { TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Fetch } from '../../request/-private/fetch';\nimport type { Cache } from '../../types/cache';\nimport type { RequestKey, ResourceKey } from '../../types/identifier';\nimport type {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n CacheOptions,\n ImmutableRequestInfo,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n RequestInfo,\n ResponseInfo,\n StructuredDocument,\n} from '../../types/request';\nimport type { ResourceDocument } from '../../types/spec/document';\nimport { LRUCache } from '../../utils/string';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { CacheHandler, CachePolicy } from '../-private';\n\ntype UnsubscribeToken = object;\ntype CacheOperation = 'added' | 'removed' | 'updated' | 'state';\ntype DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';\n\nexport interface NotificationCallback {\n (resourceKey: ResourceKey, notificationType: 'attributes' | 'relationships', key?: string): void;\n (resourceKey: ResourceKey, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;\n // (resourceKey: ResourceKey, notificationType: NotificationType, key?: string): void;\n}\n\ninterface ResourceOperationCallback {\n // resource updates\n (resourceKey: ResourceKey, notificationType: CacheOperation): void;\n}\n\ninterface DocumentOperationCallback {\n // document updates\n (cacheKey: RequestKey, notificationType: DocumentCacheOperation): void;\n}\n\ntype NotificationManager = {\n subscribe(resourceKey: ResourceKey, callback: NotificationCallback): UnsubscribeToken;\n subscribe(cacheKey: 'resource', callback: ResourceOperationCallback): UnsubscribeToken;\n subscribe(cacheKey: 'document' | RequestKey, callback: DocumentOperationCallback): UnsubscribeToken;\n\n notify(cacheKey: ResourceKey, value: 'attributes' | 'relationships', key?: string): boolean;\n notify(cacheKey: ResourceKey, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;\n notify(cacheKey: ResourceKey, value: CacheOperation): boolean;\n notify(cacheKey: RequestKey, value: DocumentCacheOperation): boolean;\n};\n\ntype Store = {\n cache: Cache;\n notifications: NotificationManager;\n};\n\n/**\n * Interface of a parsed Cache-Control header value.\n *\n * - [MDN Cache-Control Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control)\n */\nexport interface CacheControlValue {\n /** Indicates the response will never change; parsed but not currently used by this cache policy's expiration logic. */\n immutable?: boolean;\n /** Seconds since the response's `Date` that it is considered fresh; combined with the `Age` header to determine expiration. */\n 'max-age'?: number;\n /** Indicates a stale response must be revalidated before use; parsed but not currently used by this cache policy's expiration logic. */\n 'must-revalidate'?: boolean;\n /** Indicates the client must understand the response's status code semantics before caching; parsed but not currently used by this cache policy's expiration logic. */\n 'must-understand'?: boolean;\n /** Indicates the response must be revalidated before being reused from cache; parsed but not currently used by this cache policy's expiration logic. */\n 'no-cache'?: boolean;\n /** Indicates the response must not be stored in any cache; parsed but not currently used by this cache policy's expiration logic. */\n 'no-store'?: boolean;\n /** Indicates the response must not be transformed by intermediaries; parsed but not currently used by this cache policy's expiration logic. */\n 'no-transform'?: boolean;\n /** Indicates only an already-cached response should be used; parsed but not currently used by this cache policy's expiration logic. */\n 'only-if-cached'?: boolean;\n /** Indicates the response is intended for a single user and should not be stored by shared caches; parsed but not currently used by this cache policy's expiration logic. */\n private?: boolean;\n /** Like `must-revalidate` but only for shared caches; parsed but not currently used by this cache policy's expiration logic. */\n 'proxy-revalidate'?: boolean;\n /** Indicates the response may be stored by any cache; parsed but not currently used by this cache policy's expiration logic. */\n public?: boolean;\n /** Seconds since the response's `Date` that it is considered fresh for shared caches; used as a fallback for `max-age` when determining expiration. */\n 's-maxage'?: number;\n /** Seconds a stale response may be reused if an error occurs while revalidating; parsed but not currently used by this cache policy's expiration logic. */\n 'stale-if-error'?: number;\n /** Seconds a stale response may be reused while a revalidation happens in the background; parsed but not currently used by this cache policy's expiration logic. */\n 'stale-while-revalidate'?: number;\n}\n\ntype CacheControlKey = keyof CacheControlValue;\n\nconst NUMERIC_KEYS = new Set(['max-age', 's-maxage', 'stale-if-error', 'stale-while-revalidate']);\n\n/**\n * Parses a string Cache-Control header value into an object with the following structure:\n *\n * ```ts\n * interface CacheControlValue {\n * immutable?: boolean;\n * 'max-age'?: number;\n * 'must-revalidate'?: boolean;\n * 'must-understand'?: boolean;\n * 'no-cache'?: boolean;\n * 'no-store'?: boolean;\n * 'no-transform'?: boolean;\n * 'only-if-cached'?: boolean;\n * private?: boolean;\n * 'proxy-revalidate'?: boolean;\n * public?: boolean;\n * 's-maxage'?: number;\n * 'stale-if-error'?: number;\n * 'stale-while-revalidate'?: number;\n * }\n * ```\n *\n * See also {@link CacheControlValue} and [Response Directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control#response_directives)\n *\n * @public\n */\nexport function parseCacheControl(header: string): CacheControlValue {\n return CACHE_CONTROL_CACHE.get(header);\n}\n\nconst CACHE_CONTROL_CACHE = new LRUCache((header: string) => {\n let key: CacheControlKey = '' as CacheControlKey;\n let value = '';\n let isParsingKey = true;\n const cacheControlValue: CacheControlValue = {};\n\n for (let i = 0; i < header.length; i++) {\n const char = header.charAt(i);\n if (char === ',') {\n assert(`Invalid Cache-Control value, expected a value`, !isParsingKey || !NUMERIC_KEYS.has(key));\n assert(\n `Invalid Cache-Control value, expected a value after \"=\" but got \",\"`,\n i === 0 || header.charAt(i - 1) !== '='\n );\n isParsingKey = true;\n // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n key = '' as CacheControlKey;\n value = '';\n continue;\n } else if (char === '=') {\n assert(`Invalid Cache-Control value, expected a value after \"=\"`, i + 1 !== header.length);\n isParsingKey = false;\n } else if (char === ' ' || char === `\\t` || char === `\\n`) {\n continue;\n } else if (isParsingKey) {\n key += char;\n } else {\n value += char;\n }\n\n if (i === header.length - 1) {\n // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n }\n }\n\n return cacheControlValue;\n}, 200);\n\nfunction parseCacheControlValue(stringToParse: string): number {\n const parsedValue = Number.parseInt(stringToParse);\n assert(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`, !Number.isNaN(parsedValue));\n assert(`Invalid Cache-Control value, expected a number greater than 0 but got - ${stringToParse}`, parsedValue >= 0);\n if (Number.isNaN(parsedValue) || parsedValue < 0) {\n return 0;\n }\n\n return parsedValue;\n}\n\nfunction isExpired(cacheKey: RequestKey, request: StructuredDocument<ResourceDocument>, config: PolicyConfig): boolean {\n const { constraints } = config;\n\n if (constraints?.isExpired) {\n const result = constraints.isExpired(request);\n if (result !== null) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because constraints.isExpired returned ${result}`\n );\n }\n return result;\n }\n }\n\n const { headers } = request.response!;\n\n if (!headers) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no headers were provided`);\n }\n\n // if we have no headers then both the headers based expiration\n // and the time based expiration will be considered expired\n return true;\n }\n\n // check for X-WarpDrive-Expires\n const now = Date.now();\n const date = headers.get('Date');\n\n if (constraints?.headers) {\n if (constraints.headers['X-WarpDrive-Expires']) {\n const xWarpDriveExpires = headers.get('X-WarpDrive-Expires');\n if (xWarpDriveExpires) {\n const expirationTime = new Date(xWarpDriveExpires).getTime();\n const result = now >= expirationTime;\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by X-WarpDrive-Expires header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n return result;\n }\n }\n\n // check for Cache-Control\n if (constraints.headers['Cache-Control']) {\n const cacheControl = headers.get('Cache-Control');\n const age = headers.get('Age');\n\n if (cacheControl && age && date) {\n const cacheControlValue = parseCacheControl(cacheControl);\n\n // max-age and s-maxage are stored in\n const maxAge = cacheControlValue['max-age'] || cacheControlValue['s-maxage'];\n\n if (maxAge) {\n // age is stored in seconds\n const ageValue = parseInt(age, 10);\n assert(`Invalid Cache-Control value, expected a number but got - ${age}`, !Number.isNaN(ageValue));\n assert(`Invalid Cache-Control value, expected a number greater than 0 but got - ${age}`, ageValue >= 0);\n\n if (!Number.isNaN(ageValue) && ageValue >= 0) {\n const dateValue = new Date(date).getTime();\n const expirationTime = dateValue + (maxAge - ageValue) * 1000;\n const result = now >= expirationTime;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Cache-Control header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n\n return result;\n }\n }\n }\n }\n\n // check for Expires\n if (constraints.headers.Expires) {\n const expires = headers.get('Expires');\n if (expires) {\n const expirationTime = new Date(expires).getTime();\n const result = now >= expirationTime;\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Expires header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n return result;\n }\n }\n }\n\n // check for Date\n if (!date) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no Date header was provided`);\n }\n return true;\n }\n\n let expirationTime = config.apiCacheHardExpires;\n if (TESTING) {\n if (!config.disableTestOptimization) {\n expirationTime = config.apiCacheSoftExpires;\n }\n }\n\n const time = new Date(date).getTime();\n const deadline = time + expirationTime;\n const result = now >= deadline;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the apiCacheHardExpires time since the response's Date header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n\n return result;\n}\n\n/**\n * The constraint options for {@link PolicyConfig.constraints}\n */\nexport interface PolicyConfigConstraints {\n /**\n * Headers that should be checked for expiration.\n *\n */\n headers?: {\n /**\n * Whether the `Cache-Control` header should be checked for expiration.\n * If `true`, then the `max-age` and `s-maxage` directives are used alongside\n * the `Age` and `Date` headers to determine if the expiration time has passed.\n *\n * Other directives are ignored.\n *\n * 'Cache-Control' will take precedence over 'Expires' if both are present\n * and both configured to be checked.\n *\n */\n 'Cache-Control'?: boolean;\n\n /**\n * Whether the `Expires` header should be checked for expiration.\n *\n * If `true`, then the `Expires` header is used to caclulate the expiration time\n * and determine if the expiration time has passed.\n *\n * 'Cache-Control' will take precedence over 'Expires' if both are present.\n *\n */\n Expires?: boolean;\n\n /**\n * Whether the `X-WarpDrive-Expires` header should be checked for expiration.\n *\n * If `true`, then the `X-WarpDrive-Expires` header is used to caclulate the expiration time\n * and determine if the expiration time has passed.\n *\n * This header will take precedence over 'Cache-Control' and 'Expires' if all three are present.\n *\n * The header's value should be a [UTC date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString).\n *\n */\n 'X-WarpDrive-Expires'?: boolean;\n };\n\n /**\n * A function that should be called to determine if the request is expired.\n *\n * If present, this function will be called with the request and should return\n * `true` if the request is expired, `false` if it is not expired, and\n * `null` if the expiration status is unknown.\n *\n * If the function does not return `null`,\n *\n */\n isExpired?: (request: StructuredDocument<ResourceDocument>) => boolean | null;\n}\n\n/**\n * The configuration options for the {@link DefaultCachePolicy}\n *\n * ```ts [app/services/store.ts]\n * import { Store } from '@warp-drive/core';\n * import { DefaultCachePolicy } from '@warp-drive/core/store'; // [!code focus]\n *\n * export default class AppStore extends Store {\n * lifetimes = new DefaultCachePolicy({ // [!code focus:3]\n * // ... PolicyConfig Settings ... //\n * });\n * }\n * ```\n *\n */\nexport interface PolicyConfig {\n /**\n * the number of milliseconds after which a request is considered\n * stale. If a request is issued again after this time, the request\n * will respond from cache immediately while a background request\n * is made to update the cache.\n *\n * This is calculated against the `date` header of the response.\n *\n * If your API does not provide a `date` header, the {@link Fetch} handler\n * will automatically add it to responses if it is not present. Responses\n * without a `date` header will be considered stale immediately.\n *\n */\n apiCacheSoftExpires: number;\n /**\n * the number of milliseconds after which a request is considered\n * expired and should be re-fetched. If a request is issued again\n * after this time, the request will disregard the cache and\n * wait for a fresh response from the API.\n *\n * This is calculated against the `date` header of the response.\n *\n * If your API does not provide a `date` header, the {@link Fetch} handler\n * will automatically add it to responses if it is not present. Responses\n * without a `date` header will be considered hard expired immediately.\n *\n */\n apiCacheHardExpires: number;\n /**\n * In Testing environments, the `apiCacheSoftExpires` will always be `false`\n * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.\n *\n * This helps reduce flakiness and produce predictably rendered results in test suites.\n *\n * Requests that specifically set {@link RequestInfo.cacheOptions.backgroundReload | cacheOptions.backgroundReload }\n * will still be background reloaded in tests.\n *\n * This behavior can be opted out of by setting this value to `true`.\n *\n */\n disableTestOptimization?: boolean;\n\n /**\n * In addition to the simple time-based expiration strategy, CachePolicy\n * supports various common server-supplied expiration strategies via\n * headers, as well as custom expiration strategies via the {@link PolicyConfigConstraints.isExpired | isExpired}\n * function.\n *\n * Requests will be validated for expiration against these constraints.\n * If any of these constraints are not met, the request will be considered\n * expired. If all constraints are met, the request will be considered\n * valid and the time based expiration strategy will NOT be used.\n *\n * Meeting a constraint means BOTH that the properties the constraint\n * requires are present AND that the expiration time indicated by those\n * properties has not been exceeded.\n *\n * In other words, if the properties for a constraint are not present,\n * this does not count either as meeting or as not meeting the constraint,\n * the constraint simply does not apply.\n *\n * The `isExpired` function is called with the request and should return\n * `true` if the request is expired, `false` if it is not expired, and\n * `null` if the expiration status is unknown.\n *\n * In order constraints are checked:\n *\n * - isExpired function\n * - ↳ (if null) X-WarpDrive-Expires header\n * - ↳ (if null) Cache-Control header\n * - ↳ (if null) Expires header\n *\n * See {@link PolicyConfigConstraints} for configuration options.\n */\n constraints?: PolicyConfigConstraints;\n}\n\n/**\n * A basic {@link CachePolicy} that can be added to the Store service.\n *\n * ```ts [app/services/store.ts]\n * import { Store } from '@warp-drive/core';\n * import { DefaultCachePolicy } from '@warp-drive/core/store'; // [!code focus]\n *\n * export default class AppStore extends Store {\n * lifetimes = new DefaultCachePolicy({ // [!code focus:5]\n * apiCacheSoftExpires: 30_000,\n * apiCacheHardExpires: 60_000,\n * // ... Other PolicyConfig Settings ... //\n * });\n * }\n * ```\n *\n * :::tip 💡 TIP\n * Date headers do not have millisecond precision, so expiration times should\n * generally be larger than 1000ms.\n * :::\n *\n * See also {@link PolicyConfig} for configuration options.\n *\n * ### The Mechanics\n *\n * This policy determines staleness based on various configurable constraints falling back to a simple\n * check of the time elapsed since the request was last received from the API using the `date` header\n * from the last response.\n *\n * :::tip 💡 TIP\n * The {@link Fetch} handler provided by `@warp-drive/core` will automatically\n * add the `date` header to responses if it is not present.\n * :::\n *\n * - For manual override of reload see {@link CacheOptions.reload | cacheOptions.reload}\n * - For manual override of background reload see {@link CacheOptions.backgroundReload | cacheOptions.backgroundReload}\n *\n * In order expiration is determined by:\n *\n * ```md\n * Is explicitly invalidated by `cacheOptions.reload`\n * ↳ (if falsey) if the request has been explicitly invalidated\n * since the last request (see Automatic Invalidation below)\n * ↳ (if false) (If Active) isExpired function\n * ↳ (if null) (If Active) X-WarpDrive-Expires header\n * ↳ (if null) (If Active) Cache-Control header\n * ↳ (if null) (If Active) Expires header\n * ↳ (if null) Date header + apiCacheHardExpires < current time\n *\n * -- <if above is false, a background request is issued if> --\n *\n * ↳ is invalidated by `cacheOptions.backgroundReload`\n * ↳ (if falsey) Date header + apiCacheSoftExpires < current time\n * ```\n *\n * ### Automatic Invalidation / Entanglement\n *\n * It also invalidates any request with an {@link RequestInfo.op | OpCode} of `\"query\"`\n * for which {@link CacheOptions.types | cacheOptions.types} was provided\n * when a request with an `OpCode` of `\"createRecord\"` is successful and also includes\n * a matching type in its own `cacheOptions.types` array.\n\n * :::tip 💡 TIP\n * Abstracting this behavior via builders is recommended to ensure consistency.\n * :::\n *\n * ### Testing\n *\n * In Testing environments:\n *\n * - `apiCacheSoftExpires` will always be `false`\n * - `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.\n *\n * This helps reduce flakiness and produce predictably rendered results in test suites.\n *\n * Requests that specifically set `cacheOptions.backgroundReload = true` will\n * still be background reloaded in tests.\n *\n * This behavior can be opted out of by setting `disableTestOptimization = true`\n * in the policy config.\n *\n * @public\n */\nexport class DefaultCachePolicy implements CachePolicy {\n /**\n * @internal\n */\n declare private config: PolicyConfig;\n /**\n * @internal\n */\n declare private _stores: WeakMap<Store, { invalidated: Set<RequestKey>; types: Map<string, Set<RequestKey>> }>;\n\n /**\n * @internal\n */\n private _getStore(store: Store): {\n invalidated: Set<RequestKey>;\n types: Map<string, Set<RequestKey>>;\n } {\n let set = this._stores.get(store);\n if (!set) {\n set = { invalidated: new Set(), types: new Map() };\n this._stores.set(store, set);\n }\n return set;\n }\n\n constructor(config: PolicyConfig) {\n this._stores = new WeakMap();\n\n const _config = arguments.length === 1 ? config : (arguments[1] as unknown as PolicyConfig);\n deprecate(\n `Passing a Store to the CachePolicy is deprecated, please pass only a config instead.`,\n arguments.length === 1,\n {\n id: 'ember-data:request-utils:lifetimes-service-store-arg',\n since: {\n enabled: '5.4',\n available: '4.13',\n },\n for: '@ember-data/request-utils',\n until: '6.0',\n }\n );\n assert(`You must pass a config to the CachePolicy`, _config);\n assert(`You must pass a apiCacheSoftExpires to the CachePolicy`, typeof _config.apiCacheSoftExpires === 'number');\n assert(`You must pass a apiCacheHardExpires to the CachePolicy`, typeof _config.apiCacheHardExpires === 'number');\n this.config = _config;\n }\n\n /**\n * Invalidate a request by its CacheKey for the given store instance.\n *\n * While the store argument may seem redundant, the CachePolicy\n * is designed to be shared across multiple stores / forks\n * of the store.\n *\n * ```ts\n * store.lifetimes.invalidateRequest(store, cacheKey);\n * ```\n *\n * @public\n */\n invalidateRequest(cacheKey: RequestKey, store: Store): void {\n this._getStore(store).invalidated.add(cacheKey);\n }\n\n /**\n * Invalidate all requests associated to a specific type\n * for a given store instance.\n *\n * While the store argument may seem redundant, the CachePolicy\n * is designed to be shared across multiple stores / forks\n * of the store.\n *\n * This invalidation is done automatically when using this service\n * for both the {@link CacheHandler} and the [NetworkHandler](/api/@warp-drive/legacy/compat/variables/LegacyNetworkHandler).\n *\n * ```ts\n * store.lifetimes.invalidateRequestsForType(store, 'person');\n * ```\n *\n * @public\n */\n invalidateRequestsForType(type: string, store: Store): void {\n const storeCache = this._getStore(store);\n const set = storeCache.types.get(type);\n const notifications = store.notifications;\n\n if (set) {\n // TODO batch notifications\n set.forEach((id) => {\n storeCache.invalidated.add(id);\n // @ts-expect-error\n notifications.notify(id, 'invalidated', null);\n });\n }\n }\n\n /**\n * Invoked when a request has been fulfilled from the configured request handlers.\n * This is invoked by the CacheHandler for both foreground and background requests\n * once the cache has been updated.\n *\n * Note, this is invoked by the {@link CacheHandler} regardless of whether\n * the request has a cache-key.\n *\n * This method should not be invoked directly by consumers.\n *\n * @public\n */\n didRequest(\n request: ImmutableRequestInfo,\n response: Response | ResponseInfo | null,\n cacheKey: RequestKey | null,\n store: Store\n ): void {\n // if this is a successful createRecord request, invalidate the cacheKey for the type\n if (request.op === 'createRecord') {\n const statusNumber = response?.status ?? 0;\n if (statusNumber >= 200 && statusNumber < 400) {\n const types = new Set(request.records?.map((r) => r.type));\n const additionalTypes = request.cacheOptions?.types;\n additionalTypes?.forEach((type) => {\n types.add(type);\n });\n\n types.forEach((type) => {\n this.invalidateRequestsForType(type, store);\n });\n }\n\n // add this document's cacheKey to a map for all associated types\n // it is recommended to only use this for queries\n } else if (cacheKey && request.cacheOptions?.types?.length) {\n const storeCache = this._getStore(store);\n request.cacheOptions?.types.forEach((type) => {\n const set = storeCache.types.get(type);\n if (set) {\n set.add(cacheKey);\n storeCache.invalidated.delete(cacheKey);\n } else {\n storeCache.types.set(type, new Set([cacheKey]));\n }\n });\n }\n }\n\n /**\n * Invoked to determine if the request may be fulfilled from cache\n * if possible.\n *\n * Note, this is only invoked by the {@link CacheHandler} if the request has\n * a cache-key.\n *\n * If no cache entry is found or the entry is hard expired,\n * the request will be fulfilled from the configured request handlers\n * and the cache will be updated before returning the response.\n *\n * @public\n * @return true if the request is considered hard expired\n */\n isHardExpired(cacheKey: RequestKey, store: Store): boolean {\n // if we are explicitly invalidated, we are hard expired\n const storeCache = this._getStore(store);\n if (storeCache.invalidated.has(cacheKey)) {\n return true;\n }\n const cache = store.cache;\n const cached = cache.peekRequest(cacheKey);\n\n if (!cached?.response) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no cache entry was found`);\n }\n return true;\n }\n\n return isExpired(cacheKey, cached, this.config);\n }\n\n /**\n * Invoked if `isHardExpired` is false to determine if the request\n * should be update behind the scenes if cache data is already available.\n *\n * Note, this is only invoked by the {@link CacheHandler} if the request has\n * a cache-key.\n *\n * If true, the request will be fulfilled from cache while a backgrounded\n * request is made to update the cache via the configured request handlers.\n *\n * @public\n * @return true if the request is considered soft expired\n */\n isSoftExpired(cacheKey: RequestKey, store: Store): boolean {\n if (TESTING) {\n if (!this.config.disableTestOptimization) {\n return false;\n }\n }\n const cache = store.cache;\n const cached = cache.peekRequest(cacheKey);\n\n if (cached?.response) {\n const date = cached.response.headers.get('date');\n\n if (!date) {\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is STALE because no date header was found`);\n }\n return true;\n } else {\n const time = new Date(date).getTime();\n const now = Date.now();\n const deadline = time + this.config.apiCacheSoftExpires;\n const result = now >= deadline;\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'STALE' : 'NOT stale'}. Expiration time: ${deadline}, now: ${now}`\n );\n }\n\n return result;\n }\n }\n\n if (LOG_CACHE_POLICY) {\n // eslint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is STALE because no cache entry was found`);\n }\n\n return true;\n }\n}\n"],"mappings":";;;;;;;;;AAkGA,MAAMG,+BAAe,IAAIC,IAAI;CAAC;CAAW;CAAY;CAAkB;AAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BhG,SAAgBC,kBAAkBC,QAAmC;CACnE,OAAOC,oBAAoBC,IAAIF,MAAM;AACvC;AAEA,MAAMC,sBAAsB,IAAIP,UAAUM,WAAmB;CAC3D,IAAIG,MAAuB;CAC3B,IAAIC,QAAQ;CACZ,IAAIC,eAAe;CACnB,MAAMC,oBAAuC,CAAC;CAE9C,KAAK,IAA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AAIf,KAAKC,IAAI,CAAC,CAACG,QAAQ;IACpC,MAAML,MAAMC,KAAKD,IAAI;IACrB,MAAMiB,WAAWD,OAAO,KAAK7B,OAAO4B;IACpC,MAAM1B,SAASW,OAAOiB;IAAS,IAAAzD,gBAAA,CAAA,CAAA8B,UAAAC,MAAAC,oBAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,kBAI7BG,QAAQC,IACN,gBAAgBX,SAASY,IAAG,MAAOR,SAAS,UAAU,YAAW,qBAAsB4B,SAAQ,SAAUjB,KAC3G;IAGF,OAAOX;GACT;EACF;EAAC,IAAA7B,gBAAA,CAAA,CAAA8B,UAAAC,MAAAC,oBAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,kBAICG,QAAQC,IAAI,gBAAgBX,SAASY,IAAG,2CAA4C;EAGtF,OAAO;CACT;AACF"}
@@ -1,3 +1,3 @@
1
- import { a as setTransient, i as peekUniversalTransient, n as getOrSetUniversal, o as setUniversalTransient, r as peekTransient, t as getOrSetGlobal } from "../-private-9CIgW-DA.js";
1
+ import { a as setTransient, i as peekUniversalTransient, n as getOrSetUniversal, o as setUniversalTransient, r as peekTransient, t as getOrSetGlobal } from "../-private-DKrinJQa.js";
2
2
 
3
3
  export { getOrSetGlobal, getOrSetUniversal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient };
@@ -1,4 +1,4 @@
1
- import { n as getOrSetUniversal, t as getOrSetGlobal } from "../-private-9CIgW-DA.js";
1
+ import { n as getOrSetUniversal, t as getOrSetGlobal } from "../-private-DKrinJQa.js";
2
2
 
3
3
  //#region src/types/request.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { n as getOrSetUniversal } from "../-private-9CIgW-DA.js";
1
+ import { n as getOrSetUniversal } from "../-private-DKrinJQa.js";
2
2
 
3
3
  //#region src/types/runtime.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as getOrSetGlobal } from "../-private-9CIgW-DA.js";
1
+ import { t as getOrSetGlobal } from "../-private-DKrinJQa.js";
2
2
 
3
3
  //#region src/types/symbols.ts
4
4
  /**
@@ -0,0 +1,22 @@
1
+ import { t as getOrSetGlobal } from "./-private-DswNByIq.js";
2
+
3
+ //#region src/reactive/-private/symbols.ts
4
+ const SOURCE = getOrSetGlobal("SOURCE", Symbol("#source"));
5
+ const Destroy = getOrSetGlobal("Destroy", Symbol.dispose || Symbol.for("Dispose"));
6
+ /**
7
+ * Symbol for the method used to request a mutable copy of an otherwise
8
+ * immutable {@link ReactiveResource}.
9
+ *
10
+ * @deprecated use the {@link checkout} utility function instead.
11
+ */
12
+ const Checkout = getOrSetGlobal("Checkout", Symbol("Checkout"));
13
+ const Commit = getOrSetGlobal("Commit", Symbol("Commit"));
14
+ /**
15
+ * Symbol used to stash the internal field/resource context (schema, store,
16
+ * mutability, etc.) on a {@link ReactiveResource} or reactive field instance.
17
+ */
18
+ const Context = getOrSetGlobal("Context", Symbol("Context"));
19
+
20
+ //#endregion
21
+ export { SOURCE as a, Destroy as i, Commit as n, Context as r, Checkout as t };
22
+ //# sourceMappingURL=-private-D6KXpOWM.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"-private-B2hz13Ei.js","names":["getOrSetGlobal","SOURCE","Symbol","Destroy","dispose","for","Checkout","Commit","Context"],"sources":["../../../src/reactive/-private/symbols.ts"],"sourcesContent":["///////////////////\n///// WARNING /////\n///////////////////\n\nimport { getOrSetGlobal } from '../../types/-private';\n\n// Great, got your attention with that warning didn't we?\n// Good. Here's the deal: typescript treats symbols as unique types.\n// If by accident a module creating a symbol is processed more than\n// once, the symbol will be different in each processing. This will\n// cause a type error.\n// It could also cause a runtime error if the symbol is used innapropriately.\n// However, this case is extremely hard to hit and would require other things\n// to go wrong first.\n//\n// So, why do the warning? And why do we lie about the types of the symbols?\n//\n// Because we intentionally create multiple copies of them within the types\n// at build time. This is because we rollup our d.ts files in order to give\n// our consumers a better experience.\n//\n// However, no tool today supports rolling up d.ts files with multiple entry\n// points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor\n// which creates a fully unique stand-alone types file per-entry-point. Thus\n// every entry point that uses one of these symbols somewhere will have accidentally\n// created a new symbol type.\n//\n// This cast allows us to rollup these types using this tool while not encountering\n// the unique symbol type issue.\n//\n// Note that none of these symbols are part of the public API, these are used for\n// debugging DX and as a safe way to provide an intimate contract on public objects.\n\nexport const SOURCE: '___(unique) Symbol(SOURCE)' = getOrSetGlobal('SOURCE', Symbol('#source'));\n\nexport const Destroy: '___(unique) Symbol(Destroy)' = getOrSetGlobal(\n 'Destroy',\n Symbol.dispose || Symbol.for('Dispose')\n);\n/**\n * Symbol for the method used to request a mutable copy of an otherwise\n * immutable {@link ReactiveResource}.\n *\n * @deprecated use the {@link checkout} utility function instead.\n */\nexport const Checkout: '___(unique) Symbol(Checkout)' = getOrSetGlobal('Checkout', Symbol('Checkout'));\nexport const Commit: '___(unique) Symbol(Commit)' = getOrSetGlobal('Commit', Symbol('Commit'));\n\n/**\n * Symbol used to stash the internal field/resource context (schema, store,\n * mutability, etc.) on a {@link ReactiveResource} or reactive field instance.\n */\nexport const Context: '___(unique) Symbol(Context)' = getOrSetGlobal('Context', Symbol('Context'));\n"],"mappings":";;;AAiCA,MAAaC,SAAuCD,eAAe,UAAUE,OAAO,SAAS,CAAC;AAE9F,MAAaC,UAAyCH,eACpD,WACAE,OAAOE,WAAWF,OAAOG,IAAI,SAAS,CACxC;;;;;;;AAOA,MAAaC,WAA2CN,eAAe,YAAYE,OAAO,UAAU,CAAC;AACrG,MAAaK,SAAuCP,eAAe,UAAUE,OAAO,QAAQ,CAAC;;;;;AAM7F,MAAaM,UAAyCR,eAAe,WAAWE,OAAO,SAAS,CAAC"}
1
+ {"version":3,"file":"-private-D6KXpOWM.js","names":["getOrSetGlobal","SOURCE","Symbol","Destroy","dispose","for","Checkout","Commit","Context"],"sources":["../../../src/reactive/-private/symbols.ts"],"sourcesContent":["///////////////////\n///// WARNING /////\n///////////////////\n\nimport { getOrSetGlobal } from '../../types/-private';\n\n// Great, got your attention with that warning didn't we?\n// Good. Here's the deal: typescript treats symbols as unique types.\n// If by accident a module creating a symbol is processed more than\n// once, the symbol will be different in each processing. This will\n// cause a type error.\n// It could also cause a runtime error if the symbol is used innapropriately.\n// However, this case is extremely hard to hit and would require other things\n// to go wrong first.\n//\n// So, why do the warning? And why do we lie about the types of the symbols?\n//\n// Because we intentionally create multiple copies of them within the types\n// at build time. This is because we rollup our d.ts files in order to give\n// our consumers a better experience.\n//\n// However, no tool today supports rolling up d.ts files with multiple entry\n// points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor\n// which creates a fully unique stand-alone types file per-entry-point. Thus\n// every entry point that uses one of these symbols somewhere will have accidentally\n// created a new symbol type.\n//\n// This cast allows us to rollup these types using this tool while not encountering\n// the unique symbol type issue.\n//\n// Note that none of these symbols are part of the public API, these are used for\n// debugging DX and as a safe way to provide an intimate contract on public objects.\n\nexport const SOURCE: '___(unique) Symbol(SOURCE)' = getOrSetGlobal('SOURCE', Symbol('#source'));\n\nexport const Destroy: '___(unique) Symbol(Destroy)' = getOrSetGlobal(\n 'Destroy',\n Symbol.dispose || Symbol.for('Dispose')\n);\n/**\n * Symbol for the method used to request a mutable copy of an otherwise\n * immutable {@link ReactiveResource}.\n *\n * @deprecated use the {@link checkout} utility function instead.\n */\nexport const Checkout: '___(unique) Symbol(Checkout)' = getOrSetGlobal('Checkout', Symbol('Checkout'));\nexport const Commit: '___(unique) Symbol(Commit)' = getOrSetGlobal('Commit', Symbol('Commit'));\n\n/**\n * Symbol used to stash the internal field/resource context (schema, store,\n * mutability, etc.) on a {@link ReactiveResource} or reactive field instance.\n */\nexport const Context: '___(unique) Symbol(Context)' = getOrSetGlobal('Context', Symbol('Context'));\n"],"mappings":";;;AAiCA,MAAaC,SAAuCD,eAAe,UAAUE,OAAO,SAAS,CAAC;AAE9F,MAAaC,UAAyCH,eACpD,WACAE,OAAOE,WAAWF,OAAOG,IAAI,SAAS,CACxC;;;;;;;AAOA,MAAaC,WAA2CN,eAAe,YAAYE,OAAO,UAAU,CAAC;AACrG,MAAaK,SAAuCP,eAAe,UAAUE,OAAO,QAAQ,CAAC;;;;;AAM7F,MAAaM,UAAyCR,eAAe,WAAWE,OAAO,SAAS,CAAC"}
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "@warp-drive/core";
3
- var version = "5.9.0-alpha.21";
3
+ var version = "5.9.0-alpha.22";
4
4
 
5
5
  //#endregion
6
6
  //#region src/types/-private.ts
@@ -96,4 +96,4 @@ function setUniversalTransient(key, value) {
96
96
 
97
97
  //#endregion
98
98
  export { setTransient as a, peekUniversalTransient as i, getOrSetUniversal as n, setUniversalTransient as o, peekTransient as r, getOrSetGlobal as t };
99
- //# sourceMappingURL=-private-o67f3_hS.js.map
99
+ //# sourceMappingURL=-private-DswNByIq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"-private-o67f3_hS.js","names":["name","version","GlobalRef","globalThis","UniversalCache","__warpDrive_universalCache","__version","GlobalSink","ModuleScopedCaches","__warpDrive_ModuleScopedCaches","__warpDrive_hasOtherCopy","Error","getOrSetGlobal","key","value","peekTransient","globalKey","setTransient","getOrSetUniversal","peekUniversalTransient","setUniversalTransient"],"sources":["../../../package.json","../../../src/types/-private.ts"],"sourcesContent":["","// in testing mode, we utilize globals to ensure only one copy exists of\n// these maps, due to bugs in ember-auto-import\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\n\nimport { name, version } from '../../package.json';\n\ntype UniversalTransientKey =\n // @warp-drive/core/request\n 'REQ_ID';\n\ntype UniversalKey =\n | `(transient) ${UniversalTransientKey}`\n // @warp-drive/core/request\n | 'RequestMap'\n | 'PromiseCache'\n | 'RequestCache'\n // @warp-drive/core-types/request\n | 'SkipCache'\n | 'EnableHydration'\n // @warp-drive/core-types/runtime\n | 'WarpDriveRuntimeConfig';\n\ntype TransientKey =\n // @warp-drive/core/graph\n | 'transactionRef'\n // @warp-drive/core/store\n | 'configuredGenerationMethod'\n | 'configuredUpdateMethod'\n | 'configuredForgetMethod'\n | 'configuredResetMethod'\n | 'configuredKeyInfoMethod'\n | 'signalHooks';\n\ntype GlobalKey =\n | `(transient) ${TransientKey}`\n // @warp-drive/legacy/adapter\n | 'AdapterError'\n | 'InvalidError'\n | 'TimeoutError'\n | 'AbortError'\n | 'UnauthorizedError'\n | 'ForbiddenError'\n | 'NotFoundError'\n | 'ConflictError'\n | 'ServerError'\n // @warp-drive/core/store/reactivity\n | '#{}'\n | '#[]'\n | 'Signals'\n // @warp-drive/legacy LegacySupport\n | 'AvailableShims'\n // @warp-drive/core RecordArrayManager\n | 'FAKE_ARR'\n // @warp-drive/core ReactiveArray\n | '#source'\n | '#update'\n | '#notify'\n | 'IS_COLLECTION'\n // @warp-drive/core RequestCache\n | 'Touching'\n | 'RequestPromise'\n // @warp-drive/legacy/compat FetchManager\n | 'SaveOp'\n // @warp-drive/legacy Model\n | 'LEGACY_SUPPORT'\n | 'LegacySupport'\n // @warp-drive/core/graph\n | 'Graphs'\n // @warp-drive/core/request\n | 'IS_FROZEN'\n | 'IS_CACHE_HANDLER'\n // @warp-drive/utilities\n | 'CONFIG'\n // @warp-drive/core CacheKeyManager\n | 'DEBUG_MAP'\n | 'IDENTIFIERS'\n | 'DOCUMENTS'\n // @warp-drive/core InstanceCache\n | 'RecordCache'\n | 'StoreMap'\n // @warp-drive/core/types/symbols\n | 'Store'\n | '$type'\n | 'TransformName'\n | 'RequestSignature'\n // @warp-drive/core/types/request\n | 'IS_FUTURE'\n | 'DOC'\n // @warp-drive/core/reactive\n | 'ManagedArrayMap'\n | 'ManagedObjectMap'\n | 'Support'\n | 'SOURCE'\n | 'Destroy'\n | 'Checkout'\n | 'Commit'\n | 'Context';\n\ntype ModuleScopedCaches = Record<GlobalKey, unknown>;\n\nconst GlobalRef = globalThis as unknown as Record<\n string,\n {\n __warpDrive_ModuleScopedCaches?: ModuleScopedCaches;\n __warpDrive_hasOtherCopy?: boolean;\n __version: string;\n }\n> & {\n __warpDrive_universalCache: Record<UniversalKey, unknown>;\n};\nconst UniversalCache = (GlobalRef.__warpDrive_universalCache =\n GlobalRef.__warpDrive_universalCache ?? ({} as Record<UniversalKey, unknown>));\n\n// in order to support mirror packages, we ensure that each\n// unique package name has its own global cache\nGlobalRef[name] = GlobalRef[name] ?? { __version: version };\nconst GlobalSink = GlobalRef[name];\n\nif (DEBUG) {\n if (GlobalSink.__version !== version) {\n throw new Error('Multiple versions of WarpDrive detected, the application will malfunction.');\n }\n}\n\nconst ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? ({} as ModuleScopedCaches);\nif (TESTING) {\n if (!GlobalSink.__warpDrive_ModuleScopedCaches) {\n GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`\nMultiple copies of WarpDrive have been detected. This may be due to a bug in ember-auto-import\n in which test assets get their own copy of some v2-addons. This can cause the application to\n malfunction as each copy will maintain its own separate state.`);\n }\n} else {\n if (GlobalSink.__warpDrive_hasOtherCopy) {\n throw new Error('Multiple copies of WarpDrive detected, the application will malfunction.');\n }\n GlobalSink.__warpDrive_hasOtherCopy = true;\n}\n\ntype UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;\ntype UniqueSymbolOr<T, K extends string> = T extends symbol ? UniqueSymbol<K> : T;\n\n/**\n * Coordinates creation of a singleton `value` (e.g. a symbol, WeakMap, or\n * error class) for `key` so that duplicate copies of this package loaded\n * into the same process observe the same instance instead of each creating\n * their own.\n *\n * In `TESTING` builds this stores/reads `value` from a cache namespaced to\n * this package's name on `globalThis` (see the file-level comments above for\n * why this is necessary). Outside of `TESTING`, only one copy of the package\n * is expected to exist, so this is a no-op that always returns `value`\n * unchanged.\n *\n * The return type lies about symbols being unique to work around the d.ts\n * rollup issue described in `reactive/-private/symbols.ts`.\n *\n * @private\n */\nexport function getOrSetGlobal<T, K extends GlobalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = ModuleScopedCaches[key];\n if (existing === undefined) {\n return (ModuleScopedCaches[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\n/**\n * Reads back the current value stored for `key` by {@link setTransient}, or\n * `null` if nothing has been stored yet.\n *\n * Unlike {@link getOrSetGlobal}, this always reads through the same\n * package-namespaced cache regardless of the `TESTING` flag, since this is\n * used for genuinely mutable state (not just singleton values) that must\n * stay in sync across any duplicate copies of this package.\n *\n * @private\n */\nexport function peekTransient<T>(key: TransientKey): T | null {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] as T) ?? null;\n}\n\n/**\n * Stores `value` for `key`, overwriting whatever was previously stored, so\n * that it can later be read back via {@link peekTransient}.\n *\n * See {@link peekTransient} for details on when/why this cache is shared.\n *\n * @private\n */\nexport function setTransient<T>(key: TransientKey, value: T): T {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] = value);\n}\n\n/**\n * Like {@link getOrSetGlobal}, but reads/writes a cache that is shared across\n * *all* copies of WarpDrive on `globalThis`, regardless of package name.\n *\n * This is used for keys (e.g. request/promise caches) that must be\n * coordinated even across \"mirror\" packages published under different\n * names, rather than only across duplicate copies of the same package name.\n *\n * @private\n */\nexport function getOrSetUniversal<T, K extends UniversalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = UniversalCache[key];\n if (existing === undefined) {\n return (UniversalCache[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\n/**\n * Like {@link peekTransient}, but reads from the package-name-independent\n * cache used by {@link getOrSetUniversal}. Always reads through this shared\n * cache regardless of the `TESTING` flag.\n *\n * @private\n */\nexport function peekUniversalTransient<T>(key: UniversalTransientKey): T | null {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] as T) ?? null;\n}\n\n/**\n * Like {@link setTransient}, but writes to the package-name-independent\n * cache used by {@link getOrSetUniversal}, so it can later be read via\n * {@link peekUniversalTransient}.\n *\n * @private\n */\nexport function setUniversalTransient<T>(key: UniversalTransientKey, value: T): T {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] = value);\n}\n"],"mappings":";;;;;;ACoGA,MAAME,YAAYC;AAUlB,MAAMC,iBAAkBF,UAAUG,6BAChCH,UAAUG,8BAA+B,CAAC;AAI5CH,UAAUF,QAAQE,UAAUF,SAAS,EAAEM,WAAWL,QAAQ;AAC1D,MAAMM,aAAaL,UAAUF;AAQ7B,MAAMQ,qBAAqBD,WAAWE,kCAAmC,CAAC;AAYxE,IAAIF,WAAWG,0BACb,MAAM,IAAIC,MAAM,0EAA0E;AAE5FJ,WAAWG,2BAA2B;;;;;;;;;;;;;;;;;;AAuBxC,SAAgBE,eAAuCC,KAAQC,OAAgC;CAS3F,OAAOA;AAEX;;;;;;;;;;;;AAaA,SAAgBC,cAAiBF,KAA6B;CAC5D,MAAMG,YAA2C,eAAeH;CAChE,OAAQL,mBAAmBQ,cAAoB;AACjD;;;;;;;;;AAUA,SAAgBC,aAAgBJ,KAAmBC,OAAa;CAC9D,MAAME,YAA2C,eAAeH;CAChE,OAAQL,mBAAmBQ,aAAaF;AAC1C;;;;;;;;;;;AAYA,SAAgBI,kBAA6CL,KAAQC,OAAgC;CASjG,OAAOA;AAEX;;;;;;;;AASA,SAAgBK,uBAA0BN,KAAsC;CAC9E,MAAMG,YAAoD,eAAeH;CACzE,OAAQT,eAAeY,cAAoB;AAC7C;;;;;;;;AASA,SAAgBI,sBAAyBP,KAA4BC,OAAa;CAChF,MAAME,YAAoD,eAAeH;CACzE,OAAQT,eAAeY,aAAaF;AACtC"}
1
+ {"version":3,"file":"-private-DswNByIq.js","names":["name","version","GlobalRef","globalThis","UniversalCache","__warpDrive_universalCache","__version","GlobalSink","ModuleScopedCaches","__warpDrive_ModuleScopedCaches","__warpDrive_hasOtherCopy","Error","getOrSetGlobal","key","value","peekTransient","globalKey","setTransient","getOrSetUniversal","peekUniversalTransient","setUniversalTransient"],"sources":["../../../package.json","../../../src/types/-private.ts"],"sourcesContent":["","// in testing mode, we utilize globals to ensure only one copy exists of\n// these maps, due to bugs in ember-auto-import\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\n\nimport { name, version } from '../../package.json';\n\ntype UniversalTransientKey =\n // @warp-drive/core/request\n 'REQ_ID';\n\ntype UniversalKey =\n | `(transient) ${UniversalTransientKey}`\n // @warp-drive/core/request\n | 'RequestMap'\n | 'PromiseCache'\n | 'RequestCache'\n // @warp-drive/core-types/request\n | 'SkipCache'\n | 'EnableHydration'\n // @warp-drive/core-types/runtime\n | 'WarpDriveRuntimeConfig';\n\ntype TransientKey =\n // @warp-drive/core/graph\n | 'transactionRef'\n // @warp-drive/core/store\n | 'configuredGenerationMethod'\n | 'configuredUpdateMethod'\n | 'configuredForgetMethod'\n | 'configuredResetMethod'\n | 'configuredKeyInfoMethod'\n | 'signalHooks';\n\ntype GlobalKey =\n | `(transient) ${TransientKey}`\n // @warp-drive/legacy/adapter\n | 'AdapterError'\n | 'InvalidError'\n | 'TimeoutError'\n | 'AbortError'\n | 'UnauthorizedError'\n | 'ForbiddenError'\n | 'NotFoundError'\n | 'ConflictError'\n | 'ServerError'\n // @warp-drive/core/store/reactivity\n | '#{}'\n | '#[]'\n | 'Signals'\n // @warp-drive/legacy LegacySupport\n | 'AvailableShims'\n // @warp-drive/core RecordArrayManager\n | 'FAKE_ARR'\n // @warp-drive/core ReactiveArray\n | '#source'\n | '#update'\n | '#notify'\n | 'IS_COLLECTION'\n // @warp-drive/core RequestCache\n | 'Touching'\n | 'RequestPromise'\n // @warp-drive/legacy/compat FetchManager\n | 'SaveOp'\n // @warp-drive/legacy Model\n | 'LEGACY_SUPPORT'\n | 'LegacySupport'\n // @warp-drive/core/graph\n | 'Graphs'\n // @warp-drive/core/request\n | 'IS_FROZEN'\n | 'IS_CACHE_HANDLER'\n // @warp-drive/utilities\n | 'CONFIG'\n // @warp-drive/core CacheKeyManager\n | 'DEBUG_MAP'\n | 'IDENTIFIERS'\n | 'DOCUMENTS'\n // @warp-drive/core InstanceCache\n | 'RecordCache'\n | 'StoreMap'\n // @warp-drive/core/types/symbols\n | 'Store'\n | '$type'\n | 'TransformName'\n | 'RequestSignature'\n // @warp-drive/core/types/request\n | 'IS_FUTURE'\n | 'DOC'\n // @warp-drive/core/reactive\n | 'ManagedArrayMap'\n | 'ManagedObjectMap'\n | 'Support'\n | 'SOURCE'\n | 'Destroy'\n | 'Checkout'\n | 'Commit'\n | 'Context';\n\ntype ModuleScopedCaches = Record<GlobalKey, unknown>;\n\nconst GlobalRef = globalThis as unknown as Record<\n string,\n {\n __warpDrive_ModuleScopedCaches?: ModuleScopedCaches;\n __warpDrive_hasOtherCopy?: boolean;\n __version: string;\n }\n> & {\n __warpDrive_universalCache: Record<UniversalKey, unknown>;\n};\nconst UniversalCache = (GlobalRef.__warpDrive_universalCache =\n GlobalRef.__warpDrive_universalCache ?? ({} as Record<UniversalKey, unknown>));\n\n// in order to support mirror packages, we ensure that each\n// unique package name has its own global cache\nGlobalRef[name] = GlobalRef[name] ?? { __version: version };\nconst GlobalSink = GlobalRef[name];\n\nif (DEBUG) {\n if (GlobalSink.__version !== version) {\n throw new Error('Multiple versions of WarpDrive detected, the application will malfunction.');\n }\n}\n\nconst ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? ({} as ModuleScopedCaches);\nif (TESTING) {\n if (!GlobalSink.__warpDrive_ModuleScopedCaches) {\n GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`\nMultiple copies of WarpDrive have been detected. This may be due to a bug in ember-auto-import\n in which test assets get their own copy of some v2-addons. This can cause the application to\n malfunction as each copy will maintain its own separate state.`);\n }\n} else {\n if (GlobalSink.__warpDrive_hasOtherCopy) {\n throw new Error('Multiple copies of WarpDrive detected, the application will malfunction.');\n }\n GlobalSink.__warpDrive_hasOtherCopy = true;\n}\n\ntype UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;\ntype UniqueSymbolOr<T, K extends string> = T extends symbol ? UniqueSymbol<K> : T;\n\n/**\n * Coordinates creation of a singleton `value` (e.g. a symbol, WeakMap, or\n * error class) for `key` so that duplicate copies of this package loaded\n * into the same process observe the same instance instead of each creating\n * their own.\n *\n * In `TESTING` builds this stores/reads `value` from a cache namespaced to\n * this package's name on `globalThis` (see the file-level comments above for\n * why this is necessary). Outside of `TESTING`, only one copy of the package\n * is expected to exist, so this is a no-op that always returns `value`\n * unchanged.\n *\n * The return type lies about symbols being unique to work around the d.ts\n * rollup issue described in `reactive/-private/symbols.ts`.\n *\n * @private\n */\nexport function getOrSetGlobal<T, K extends GlobalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = ModuleScopedCaches[key];\n if (existing === undefined) {\n return (ModuleScopedCaches[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\n/**\n * Reads back the current value stored for `key` by {@link setTransient}, or\n * `null` if nothing has been stored yet.\n *\n * Unlike {@link getOrSetGlobal}, this always reads through the same\n * package-namespaced cache regardless of the `TESTING` flag, since this is\n * used for genuinely mutable state (not just singleton values) that must\n * stay in sync across any duplicate copies of this package.\n *\n * @private\n */\nexport function peekTransient<T>(key: TransientKey): T | null {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] as T) ?? null;\n}\n\n/**\n * Stores `value` for `key`, overwriting whatever was previously stored, so\n * that it can later be read back via {@link peekTransient}.\n *\n * See {@link peekTransient} for details on when/why this cache is shared.\n *\n * @private\n */\nexport function setTransient<T>(key: TransientKey, value: T): T {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] = value);\n}\n\n/**\n * Like {@link getOrSetGlobal}, but reads/writes a cache that is shared across\n * *all* copies of WarpDrive on `globalThis`, regardless of package name.\n *\n * This is used for keys (e.g. request/promise caches) that must be\n * coordinated even across \"mirror\" packages published under different\n * names, rather than only across duplicate copies of the same package name.\n *\n * @private\n */\nexport function getOrSetUniversal<T, K extends UniversalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = UniversalCache[key];\n if (existing === undefined) {\n return (UniversalCache[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\n/**\n * Like {@link peekTransient}, but reads from the package-name-independent\n * cache used by {@link getOrSetUniversal}. Always reads through this shared\n * cache regardless of the `TESTING` flag.\n *\n * @private\n */\nexport function peekUniversalTransient<T>(key: UniversalTransientKey): T | null {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] as T) ?? null;\n}\n\n/**\n * Like {@link setTransient}, but writes to the package-name-independent\n * cache used by {@link getOrSetUniversal}, so it can later be read via\n * {@link peekUniversalTransient}.\n *\n * @private\n */\nexport function setUniversalTransient<T>(key: UniversalTransientKey, value: T): T {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] = value);\n}\n"],"mappings":";;;;;;ACoGA,MAAME,YAAYC;AAUlB,MAAMC,iBAAkBF,UAAUG,6BAChCH,UAAUG,8BAA+B,CAAC;AAI5CH,UAAUF,QAAQE,UAAUF,SAAS,EAAEM,WAAWL,QAAQ;AAC1D,MAAMM,aAAaL,UAAUF;AAQ7B,MAAMQ,qBAAqBD,WAAWE,kCAAmC,CAAC;AAYxE,IAAIF,WAAWG,0BACb,MAAM,IAAIC,MAAM,0EAA0E;AAE5FJ,WAAWG,2BAA2B;;;;;;;;;;;;;;;;;;AAuBxC,SAAgBE,eAAuCC,KAAQC,OAAgC;CAS3F,OAAOA;AAEX;;;;;;;;;;;;AAaA,SAAgBC,cAAiBF,KAA6B;CAC5D,MAAMG,YAA2C,eAAeH;CAChE,OAAQL,mBAAmBQ,cAAoB;AACjD;;;;;;;;;AAUA,SAAgBC,aAAgBJ,KAAmBC,OAAa;CAC9D,MAAME,YAA2C,eAAeH;CAChE,OAAQL,mBAAmBQ,aAAaF;AAC1C;;;;;;;;;;;AAYA,SAAgBI,kBAA6CL,KAAQC,OAAgC;CASjG,OAAOA;AAEX;;;;;;;;AASA,SAAgBK,uBAA0BN,KAAsC;CAC9E,MAAMG,YAAoD,eAAeH;CACzE,OAAQT,eAAeY,cAAoB;AAC7C;;;;;;;;AASA,SAAgBI,sBAAyBP,KAA4BC,OAAa;CAChF,MAAME,YAAoD,eAAeH;CACzE,OAAQT,eAAeY,aAAaF;AACtC"}
@@ -1,40 +1,10 @@
1
- import { a as setTransient, r as peekTransient, t as getOrSetGlobal } from "./-private-o67f3_hS.js";
2
- import { f as setPromiseResult, o as DOMError, u as getPromiseResult } from "./request-xXJYO0jK.js";
1
+ import { a as setTransient, r as peekTransient, t as getOrSetGlobal } from "./-private-DswNByIq.js";
2
+ import { f as setPromiseResult, o as DOMError, u as getPromiseResult } from "./request-DJzvWtQa.js";
3
3
 
4
4
  //#region src/signals/reactivity/configure.ts
5
5
  const ARRAY_SIGNAL = getOrSetGlobal("#[]", Symbol("#[]"));
6
6
  const OBJECT_SIGNAL = getOrSetGlobal("#{}", Symbol("#{}"));
7
7
  /**
8
- * Requirements:
9
- *
10
- * Signal:
11
- *
12
- * - signal: a way of creating a reference that we can dirty when we desire to notify
13
- * - @signal: a way of creating an accessor on an object that subscribes to a signal on access
14
- * and notifies the signal on set, or of upgrading a descriptor to be such an accessor
15
- * - defineSignal: a way of creating a signal on an object
16
- * - notifySignal: a way of notifying the underlying signal that it has been dirtied
17
- * - peekSignal: a way of inspecting the signal without notifying it
18
- *
19
- * - gate: a memoized getter function that re-runs when on access if its signal is dirty
20
- * conceptually, a gate is a tightly coupled signal and memo
21
- * - @gate: a way of creating a gate on an object or upgrading a descriptor with a getter
22
- * to be a gate
23
- * - defineGate: a way of creating a gate on an object
24
- * - notifySignal: a way of notifying the signal for a gate that it has been dirtied
25
- *
26
- * - memo:
27
- * - @memo: a way of creating a memoized getter on an object or upgrading a descriptor with a getter
28
- * to be a memo
29
- * - defineMemo: a way of creating a memo on an object
30
- *
31
- * - signalStore: storage bucket for signals associated to an object
32
- * - withSignalStore: a way of pre-creating a signal store on an object
33
- *
34
- *
35
- * @internal
36
- */
37
- /**
38
8
  * An Opaque type that represents a framework specific or TC39 signal.
39
9
  *
40
10
  * It may be an array of signals or a single signal.
@@ -1521,4 +1491,4 @@ function getPromiseState(promise) {
1521
1491
 
1522
1492
  //#endregion
1523
1493
  export { ARRAY_SIGNAL as C, willSyncFlushWatchers as D, waitFor as E, withSignalStore as S, setupSignals as T, createInternalSignal as _, createSignalDescriptor as a, notifyInternalSignal as b, defineSignal as c, gate as d, memoized as f, createInternalMemo as g, consumeInternalSignal as h, getRequestState as i, entangleInitiallyStaleSignal as l, Signals as m, DISPOSE as n, defineGate as o, signal as p, createRequestSubscription as r, defineNonEnumerableSignal as s, getPromiseState as t, entangleSignal as u, getOrCreateInternalSignal as v, OBJECT_SIGNAL as w, peekInternalSignal as x, makeInitializer as y };
1524
- //# sourceMappingURL=-private-CFXr06QP.js.map
1494
+ //# sourceMappingURL=-private-mXZAC8Mj.js.map