@ember-data/store 5.5.0-alpha.9 → 5.5.0-beta.0

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 (123) hide show
  1. package/LICENSE.md +19 -7
  2. package/README.md +21 -12
  3. package/addon-main.cjs +5 -0
  4. package/dist/-private.js +2 -0
  5. package/{addon → dist}/-private.js.map +1 -1
  6. package/dist/configure-BfLLW6GY.js +161 -0
  7. package/dist/configure-BfLLW6GY.js.map +1 -0
  8. package/dist/configure.js +1 -0
  9. package/dist/configure.js.map +1 -0
  10. package/dist/index.js +5 -0
  11. package/{addon → dist}/index.js.map +1 -1
  12. package/dist/request-state-uRtpn0Lc.js +7709 -0
  13. package/dist/request-state-uRtpn0Lc.js.map +1 -0
  14. package/dist/types.js +0 -0
  15. package/dist/types.js.map +1 -0
  16. package/logos/NCC-1701-a-blue.svg +4 -0
  17. package/logos/NCC-1701-a-gold.svg +4 -0
  18. package/logos/NCC-1701-a-gold_100.svg +1 -0
  19. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  20. package/logos/NCC-1701-a.svg +4 -0
  21. package/logos/README.md +4 -0
  22. package/logos/docs-badge.svg +2 -0
  23. package/logos/github-header.svg +444 -0
  24. package/logos/social1.png +0 -0
  25. package/logos/social2.png +0 -0
  26. package/logos/warp-drive-logo-dark.svg +4 -0
  27. package/logos/warp-drive-logo-gold.svg +4 -0
  28. package/package.json +66 -53
  29. package/unstable-preview-types/-private/cache-handler/handler.d.ts +62 -0
  30. package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +1 -0
  31. package/unstable-preview-types/-private/cache-handler/types.d.ts +107 -0
  32. package/unstable-preview-types/-private/cache-handler/types.d.ts.map +1 -0
  33. package/unstable-preview-types/-private/cache-handler/utils.d.ts +34 -0
  34. package/unstable-preview-types/-private/cache-handler/utils.d.ts.map +1 -0
  35. package/unstable-preview-types/-private/caches/cache-utils.d.ts +11 -0
  36. package/unstable-preview-types/-private/caches/cache-utils.d.ts.map +1 -0
  37. package/unstable-preview-types/-private/caches/identifier-cache.d.ts +180 -0
  38. package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +1 -0
  39. package/unstable-preview-types/-private/caches/instance-cache.d.ts +64 -0
  40. package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +1 -0
  41. package/unstable-preview-types/-private/caches/resource-utils.d.ts +12 -0
  42. package/unstable-preview-types/-private/caches/resource-utils.d.ts.map +1 -0
  43. package/unstable-preview-types/-private/debug/utils.d.ts +9 -0
  44. package/unstable-preview-types/-private/debug/utils.d.ts.map +1 -0
  45. package/unstable-preview-types/-private/document.d.ts +155 -0
  46. package/unstable-preview-types/-private/document.d.ts.map +1 -0
  47. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +179 -0
  48. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +1 -0
  49. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +19 -0
  50. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +1 -0
  51. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +31 -0
  52. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +1 -0
  53. package/unstable-preview-types/-private/managers/cache-manager.d.ts +463 -0
  54. package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +1 -0
  55. package/unstable-preview-types/-private/managers/notification-manager.d.ts +101 -0
  56. package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -0
  57. package/unstable-preview-types/-private/managers/record-array-manager.d.ts +101 -0
  58. package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +1 -0
  59. package/unstable-preview-types/-private/network/request-cache.d.ts +109 -0
  60. package/unstable-preview-types/-private/network/request-cache.d.ts.map +1 -0
  61. package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts +289 -0
  62. package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts.map +1 -0
  63. package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts +92 -0
  64. package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts.map +1 -0
  65. package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts +172 -0
  66. package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts.map +1 -0
  67. package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts +32 -0
  68. package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts.map +1 -0
  69. package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts +276 -0
  70. package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts.map +1 -0
  71. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +145 -0
  72. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +1 -0
  73. package/unstable-preview-types/-private/record-arrays/many-array.d.ts +203 -0
  74. package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +1 -0
  75. package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts +118 -0
  76. package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts.map +1 -0
  77. package/unstable-preview-types/-private/store-service.d.ts +1601 -0
  78. package/unstable-preview-types/-private/store-service.d.ts.map +1 -0
  79. package/unstable-preview-types/-private/store-service.type-test.d.ts +4 -0
  80. package/unstable-preview-types/-private/store-service.type-test.d.ts.map +1 -0
  81. package/unstable-preview-types/-private/utils/coerce-id.d.ts +10 -0
  82. package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +1 -0
  83. package/unstable-preview-types/-private/utils/construct-resource.d.ts +9 -0
  84. package/unstable-preview-types/-private/utils/construct-resource.d.ts.map +1 -0
  85. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +4 -0
  86. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts.map +1 -0
  87. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +4 -0
  88. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts.map +1 -0
  89. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +4 -0
  90. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +1 -0
  91. package/unstable-preview-types/-private.d.ts +33 -0
  92. package/unstable-preview-types/-private.d.ts.map +1 -0
  93. package/unstable-preview-types/-types/overview.d.ts +21 -0
  94. package/unstable-preview-types/-types/overview.d.ts.map +1 -0
  95. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +110 -0
  96. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +1 -0
  97. package/unstable-preview-types/-types/q/ds-model.d.ts +25 -0
  98. package/unstable-preview-types/-types/q/ds-model.d.ts.map +1 -0
  99. package/unstable-preview-types/-types/q/identifier.d.ts +193 -0
  100. package/unstable-preview-types/-types/q/identifier.d.ts.map +1 -0
  101. package/unstable-preview-types/-types/q/promise-proxies.d.ts +4 -0
  102. package/unstable-preview-types/-types/q/promise-proxies.d.ts.map +1 -0
  103. package/unstable-preview-types/-types/q/record-data-json-api.d.ts +36 -0
  104. package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +1 -0
  105. package/unstable-preview-types/-types/q/record-instance.d.ts +29 -0
  106. package/unstable-preview-types/-types/q/record-instance.d.ts.map +1 -0
  107. package/unstable-preview-types/-types/q/schema-service.d.ts +354 -0
  108. package/unstable-preview-types/-types/q/schema-service.d.ts.map +1 -0
  109. package/unstable-preview-types/-types/q/store.d.ts +38 -0
  110. package/unstable-preview-types/-types/q/store.d.ts.map +1 -0
  111. package/unstable-preview-types/configure.d.ts +21 -0
  112. package/unstable-preview-types/configure.d.ts.map +1 -0
  113. package/unstable-preview-types/index.d.ts +229 -0
  114. package/unstable-preview-types/index.d.ts.map +1 -0
  115. package/unstable-preview-types/types.d.ts +7 -0
  116. package/unstable-preview-types/types.d.ts.map +1 -0
  117. package/addon/-private.js +0 -1
  118. package/addon/index.js +0 -1
  119. package/addon/store-service-45bbfe5a.js +0 -5619
  120. package/addon/store-service-45bbfe5a.js.map +0 -1
  121. package/addon-main.js +0 -93
  122. /package/{ember-data-logo-dark.svg → logos/ember-data-logo-dark.svg} +0 -0
  123. /package/{ember-data-logo-light.svg → logos/ember-data-logo-light.svg} +0 -0
package/LICENSE.md CHANGED
@@ -1,11 +1,23 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (C) 2017-2023 Ember.js contributors
4
- Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors.
5
- Portions Copyright (C) 2011 LivingSocial Inc.
3
+ Copyright (c) 2017-2025 Ember.js and contributors
4
+ Copyright (c) 2011-2017 Tilde, Inc. and contributors
5
+ Copyright (c) 2011 LivingSocial Inc.
6
6
 
7
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
8
13
 
9
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
10
16
 
11
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  <p align="center">
2
2
  <img
3
3
  class="project-logo"
4
- src="./ember-data-logo-dark.svg#gh-dark-mode-only"
4
+ src="./logos/ember-data-logo-dark.svg#gh-dark-mode-only"
5
5
  alt="EmberData Store"
6
6
  width="240px"
7
7
  title="EmberData Store"
8
8
  />
9
9
  <img
10
10
  class="project-logo"
11
- src="./ember-data-logo-light.svg#gh-light-mode-only"
11
+ src="./logos/ember-data-logo-light.svg#gh-light-mode-only"
12
12
  alt="EmberData Store"
13
13
  width="240px"
14
14
  title="EmberData Store"
@@ -55,12 +55,21 @@ pnpm add @ember-data/store
55
55
 
56
56
  After installing you will want to configure your first `Store`. Read more below for how to create and configure stores for your application.
57
57
 
58
+ **Tagged Releases**
59
+
60
+ - ![NPM Canary Version](https://img.shields.io/npm/v/%40ember-data/store/canary?label=%40canary&color=FFBF00)
61
+ - ![NPM Beta Version](https://img.shields.io/npm/v/%40ember-data/store/beta?label=%40beta&color=ff00ff)
62
+ - ![NPM Stable Version](https://img.shields.io/npm/v/%40ember-data/store/latest?label=%40latest&color=90EE90)
63
+ - ![NPM LTS Version](https://img.shields.io/npm/v/%40ember-data/store/lts?label=%40lts&color=0096FF)
64
+ - ![NPM LTS 4.12 Version](https://img.shields.io/npm/v/%40ember-data/store/lts-4-12?label=%40lts-4-12&color=bbbbbb)
65
+
58
66
 
59
67
  ## 🔨 Creating A Store
60
68
 
61
69
  To use a `Store` we will need to do few things: add a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache) to store data **in-memory**, add a [Handler](https://github.com/emberjs/data/tree/main/packages/request#handling-requests) to fetch data from a source, and implement `instantiateRecord` to tell the store how to display the data for individual resources.
62
70
 
63
- > **Note** If you are using the package `ember-data` then a `JSON:API` cache and `instantiateRecord` are configured for you by default.
71
+ > **Note**
72
+ > If you are using the package `ember-data` then a `JSON:API` cache and `instantiateRecord` are configured for you by default.
64
73
 
65
74
  ### Configuring A Cache
66
75
 
@@ -81,7 +90,8 @@ class extends Store {
81
90
 
82
91
  Now that we have a `cache` let's setup something to handle fetching and saving data via our API.
83
92
 
84
- > **Note** The `ember-data` package automatically includes and configures the `@ember-data/json-api` cache for you.
93
+ > **Note**
94
+ > The `ember-data` package automatically includes and configures the `@ember-data/json-api` cache for you.
85
95
 
86
96
  ### Handling Requests
87
97
 
@@ -89,7 +99,8 @@ When *Ember***Data** needs to fetch or save data it will pass that request to yo
89
99
 
90
100
  To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
91
101
 
92
- > **Note** If your app uses `GraphQL`, `REST` or different conventions for `JSON:API` than your cache expects, other handlers may better fit your data. You can author your own handler by creating one that conforms to the [handler interface](https://github.com/emberjs/data/tree/main/packages/request#handling-requests).
102
+ > **Note**
103
+ > If your app uses `GraphQL`, `REST` or different conventions for `JSON:API` than your cache expects, other handlers may better fit your data. You can author your own handler by creating one that conforms to the [handler interface](https://github.com/emberjs/data/tree/main/packages/request#handling-requests).
93
104
 
94
105
  ```ts
95
106
  import Store, { CacheHandler } from '@ember-data/store';
@@ -97,12 +108,9 @@ import RequestManager from '@ember-data/request';
97
108
  import Fetch from '@ember-data/request/fetch';
98
109
 
99
110
  export default class extends Store {
100
- constructor() {
101
- super(...arguments);
102
- this.requestManager = new RequestManager();
103
- this.requestManager.use([Fetch]);
104
- this.requestManager.useCache(CacheHandler);
105
- }
111
+ requestManager = new RequestManager()
112
+ .use([Fetch])
113
+ .useCache(CacheHandler);
106
114
  }
107
115
  ```
108
116
 
@@ -185,5 +193,6 @@ Typically you will choose an existing record implementation such as `@ember-data
185
193
 
186
194
  Because of the boundaries around instantiation and the cache, record implementations should be capable of interop both with each other and with any `Cache`. Due to this, if needed an application can utilize multiple record implementations and multiple cache implementations either to support enhanced features for only a subset of records or to be able to incrementally migrate from one record/cache to another record or cache.
187
195
 
188
- > **Note:** The `ember-data` package automatically includes the `@ember-data/model`
196
+ > **Note**
197
+ > The `ember-data` package automatically includes the `@ember-data/model`
189
198
  > package and configures it for you.
package/addon-main.cjs ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const { addonShim } = require('@warp-drive/build-config/addon-shim.cjs');
4
+
5
+ module.exports = addonShim(__dirname);
@@ -0,0 +1,2 @@
1
+ export { C as CacheHandler, k as CollectionRecordArray, I as LiveArray, M as MUTATE, R as RecordArrayManager, v as RelatedCollection, l as SOURCE, G as Signals, S as Store, q as StoreMap, _ as _clearCaches, u as _deprecatingNormalize, h as coerceId, g as constructResource, L as consumeInternalSignal, F as defineNonEnumerableSignal, E as defineSignal, j as ensureStringId, D as entangleSignal, m as fastPush, B as gate, N as getOrCreateInternalSignal, y as getPromiseState, z as getRequestState, f as isDocumentIdentifier, i as isStableIdentifier, w as log, x as logGroup, A as memoized, K as notifyInternalSignal, p as peekCache, H as peekInternalSignal, r as recordIdentifierFor, n as removeRecordDataFor, t as setCacheFor, o as setRecordIdentifier, s as storeFor, J as withSignalStore } from "./request-state-uRtpn0Lc.js";
2
+ export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, c as createMemo } from "./configure-BfLLW6GY.js";
@@ -1 +1 @@
1
- {"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,161 @@
1
+ import { deprecate } from '@ember/debug';
2
+ import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
3
+ import { getOrSetGlobal, setTransient, peekTransient } from '@warp-drive/core-types/-private';
4
+ const ARRAY_SIGNAL = getOrSetGlobal('#[]', Symbol('#[]'));
5
+ const OBJECT_SIGNAL = getOrSetGlobal('#{}', Symbol('#{}'));
6
+
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
+ /**
39
+ * An Opaque type that represents a framework specific or TC39 signal.
40
+ *
41
+ * It may be an array of signals or a single signal.
42
+ *
43
+ * @internal
44
+ */
45
+
46
+ /**
47
+ * The hooks which MUST be configured in order to use this library,
48
+ * either for framework specfic signals or TC39 signals.
49
+ *
50
+ * Support for multiple frameworks simultaneously can be done via
51
+ * this abstraction by returning multiple signals from the `createSignal`
52
+ * method, and consuming the correct one via the correct framework via
53
+ * the `consumeSignal` and `notifySignal` methods.
54
+ *
55
+ * @typedoc
56
+ */
57
+
58
+ /**
59
+ * The public API for configuring the signal hooks.
60
+ *
61
+ * @internal
62
+ */
63
+ function setupSignals(buildConfig) {
64
+ // We want to assert this but can't because too many package manager
65
+ // and bundler bugs exist that cause this to be called multiple times
66
+ // for what should be a single call.
67
+ // assert(`Cannot override configured signal hooks`, peekTransient('signalHooks') === null);
68
+ const hooks = buildConfig({
69
+ wellknown: {
70
+ Array: ARRAY_SIGNAL
71
+ }
72
+ });
73
+ setTransient('signalHooks', hooks);
74
+ }
75
+
76
+ /**
77
+ * Internal method for consuming the configured `createSignal` hook
78
+ *
79
+ * @internal
80
+ */
81
+ function createSignal(obj, key) {
82
+ const signalHooks = peekTransient('signalHooks');
83
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
84
+ if (!test) {
85
+ throw new Error(`Signal hooks not configured`);
86
+ }
87
+ })(signalHooks) : {};
88
+ return signalHooks.createSignal(obj, key);
89
+ }
90
+
91
+ /**
92
+ * Internal method for consuming the configured `consumeSignal` hook
93
+ *
94
+ * @internal
95
+ */
96
+ function consumeSignal(signal) {
97
+ const signalHooks = peekTransient('signalHooks');
98
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
99
+ if (!test) {
100
+ throw new Error(`Signal hooks not configured`);
101
+ }
102
+ })(signalHooks) : {};
103
+ return signalHooks.consumeSignal(signal);
104
+ }
105
+
106
+ /**
107
+ * Internal method for consuming the configured `notifySignal` hook
108
+ *
109
+ * @internal
110
+ */
111
+ function notifySignal(signal) {
112
+ const signalHooks = peekTransient('signalHooks');
113
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
114
+ if (!test) {
115
+ throw new Error(`Signal hooks not configured`);
116
+ }
117
+ })(signalHooks) : {};
118
+ return signalHooks.notifySignal(signal);
119
+ }
120
+ function createMemo(object, key, fn) {
121
+ const signalHooks = peekTransient('signalHooks');
122
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
123
+ if (!test) {
124
+ throw new Error(`Signal hooks not configured`);
125
+ }
126
+ })(signalHooks) : {};
127
+ return signalHooks.createMemo(object, key, fn);
128
+ }
129
+ function willSyncFlushWatchers() {
130
+ const signalHooks = peekTransient('signalHooks');
131
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
132
+ if (!test) {
133
+ throw new Error(`Signal hooks not configured`);
134
+ }
135
+ })(signalHooks) : {};
136
+ return signalHooks.willSyncFlushWatchers();
137
+ }
138
+ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_TRACKING_PACKAGE)) {
139
+ let hasEmberDataTracking = false;
140
+ if (macroCondition(dependencySatisfies('@ember-data/tracking', '*'))) {
141
+ hasEmberDataTracking = true;
142
+ // @ts-expect-error
143
+ const {
144
+ buildSignalConfig
145
+ } = importSync('@ember-data/tracking');
146
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
147
+ setupSignals(buildSignalConfig);
148
+ }
149
+ const message = [`Using WarpDrive with EmberJS requires configuring it to use Ember's reactivity system.`, `Previously this was provided by installing the package '@ember-data/tracking', but this package is now deprecated.`, ``, `To resolve this deprecation, follow these steps:`, hasEmberDataTracking ? `- remove "@ember-data/tracking" and (if needed) "@ember-data-types/tracking" from your project in both your package.json and tsconfig.json` : false, `- add "@warp-drive/ember" to your project in both your package.json and tsconfig.json`, '- add the following import to your app.js file:', '', '\t```', `\timport '@warp-drive/ember/install';`, '\t```', ``, '- mark this deprecation as resolved in your project by adding the following to your WarpDrive config in ember-cli-build.js:', '', '\t```', '\tconst { setConfig } = await import("@warp-drive/build-config");', '\tsetConfig(app, __dirname, {', '\t deprecations: {', '\t DEPRECATE_TRACKING_PACKAGE: false,', '\t },', '\t});', '\t```', ``, `For more information, see the Package Unification RFC: https://rfcs.emberjs.com/id/1075-warp-drive-package-unification/`].filter(l => l !== false).join('\n');
150
+ deprecate(message, false, {
151
+ id: 'warp-drive.deprecate-tracking-package',
152
+ until: '6.0.0',
153
+ for: 'warp-drive',
154
+ since: {
155
+ enabled: '5.3.4',
156
+ available: '4.13'
157
+ },
158
+ url: 'https://deprecations.emberjs.com/id/warp-drive.deprecate-tracking-package'
159
+ });
160
+ }
161
+ export { ARRAY_SIGNAL as A, OBJECT_SIGNAL as O, createSignal as a, consumeSignal as b, createMemo as c, notifySignal as n, setupSignals as s, willSyncFlushWatchers as w };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-BfLLW6GY.js","sources":["../src/-private/new-core-tmp/reactivity/configure.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { dependencySatisfies, importSync, macroCondition } from '@embroider/macros';\n\nimport { DEPRECATE_TRACKING_PACKAGE } from '@warp-drive/build-config/deprecations';\nimport { assert } from '@warp-drive/build-config/macros';\nimport { getOrSetGlobal, peekTransient, setTransient } from '@warp-drive/core-types/-private';\n\nexport const ARRAY_SIGNAL = getOrSetGlobal('#[]', Symbol('#[]'));\nexport const OBJECT_SIGNAL = getOrSetGlobal('#{}', Symbol('#{}'));\n\n/**\n * Requirements:\n *\n * Signal:\n *\n * - signal: a way of creating a reference that we can dirty when we desire to notify\n * - @signal: a way of creating an accessor on an object that subscribes to a signal on access\n * and notifies the signal on set, or of upgrading a descriptor to be such an accessor\n * - defineSignal: a way of creating a signal on an object\n * - notifySignal: a way of notifying the underlying signal that it has been dirtied\n * - peekSignal: a way of inspecting the signal without notifying it\n *\n * - gate: a memoized getter function that re-runs when on access if its signal is dirty\n * conceptually, a gate is a tightly coupled signal and memo\n * - @gate: a way of creating a gate on an object or upgrading a descriptor with a getter\n * to be a gate\n * - defineGate: a way of creating a gate on an object\n * - notifySignal: a way of notifying the signal for a gate that it has been dirtied\n *\n * - memo:\n * - @memo: a way of creating a memoized getter on an object or upgrading a descriptor with a getter\n * to be a memo\n * - defineMemo: a way of creating a memo on an object\n *\n * - signalStore: storage bucket for signals associated to an object\n * - withSignalStore: a way of pre-creating a signal store on an object\n *\n *\n * @internal\n */\n\n/**\n * An Opaque type that represents a framework specific or TC39 signal.\n *\n * It may be an array of signals or a single signal.\n *\n * @internal\n */\nexport type SignalRef = unknown;\n/**\n * The hooks which MUST be configured in order to use this library,\n * either for framework specfic signals or TC39 signals.\n *\n * Support for multiple frameworks simultaneously can be done via\n * this abstraction by returning multiple signals from the `createSignal`\n * method, and consuming the correct one via the correct framework via\n * the `consumeSignal` and `notifySignal` methods.\n *\n * @typedoc\n */\nexport interface SignalHooks<T = SignalRef> {\n createSignal: (obj: object, key: string | symbol) => T;\n consumeSignal: (signal: T) => void;\n notifySignal: (signal: T) => void;\n createMemo: <F>(obj: object, key: string | symbol, fn: () => F) => () => F;\n willSyncFlushWatchers: () => boolean;\n}\n\nexport interface HooksOptions {\n wellknown: {\n Array: symbol | string;\n };\n}\n\n/**\n * The public API for configuring the signal hooks.\n *\n * @internal\n */\nexport function setupSignals<T>(buildConfig: (options: HooksOptions) => SignalHooks<T>) {\n // We want to assert this but can't because too many package manager\n // and bundler bugs exist that cause this to be called multiple times\n // for what should be a single call.\n // assert(`Cannot override configured signal hooks`, peekTransient('signalHooks') === null);\n const hooks = buildConfig({\n wellknown: {\n Array: ARRAY_SIGNAL,\n },\n });\n setTransient('signalHooks', hooks);\n}\n\n/**\n * Internal method for consuming the configured `createSignal` hook\n *\n * @internal\n */\nexport function createSignal(obj: object, key: string | symbol): SignalRef {\n const signalHooks: SignalHooks | null = peekTransient('signalHooks');\n assert(`Signal hooks not configured`, signalHooks);\n return signalHooks.createSignal(obj, key);\n}\n\n/**\n * Internal method for consuming the configured `consumeSignal` hook\n *\n * @internal\n */\nexport function consumeSignal(signal: SignalRef) {\n const signalHooks: SignalHooks | null = peekTransient('signalHooks');\n\n assert(`Signal hooks not configured`, signalHooks);\n return signalHooks.consumeSignal(signal);\n}\n\n/**\n * Internal method for consuming the configured `notifySignal` hook\n *\n * @internal\n */\nexport function notifySignal(signal: SignalRef) {\n const signalHooks: SignalHooks | null = peekTransient('signalHooks');\n assert(`Signal hooks not configured`, signalHooks);\n return signalHooks.notifySignal(signal);\n}\n\nexport function createMemo<T>(object: object, key: string | symbol, fn: () => T): () => T {\n const signalHooks: SignalHooks | null = peekTransient('signalHooks');\n assert(`Signal hooks not configured`, signalHooks);\n return signalHooks.createMemo(object, key, fn);\n}\n\nexport function willSyncFlushWatchers(): boolean {\n const signalHooks: SignalHooks | null = peekTransient('signalHooks');\n assert(`Signal hooks not configured`, signalHooks);\n return signalHooks.willSyncFlushWatchers();\n}\n\nif (DEPRECATE_TRACKING_PACKAGE) {\n let hasEmberDataTracking = false;\n if (macroCondition(dependencySatisfies('@ember-data/tracking', '*'))) {\n hasEmberDataTracking = true;\n // @ts-expect-error\n const { buildSignalConfig } = importSync('@ember-data/tracking');\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n setupSignals(buildSignalConfig);\n }\n\n const message = [\n `Using WarpDrive with EmberJS requires configuring it to use Ember's reactivity system.`,\n `Previously this was provided by installing the package '@ember-data/tracking', but this package is now deprecated.`,\n ``,\n `To resolve this deprecation, follow these steps:`,\n hasEmberDataTracking\n ? `- remove \"@ember-data/tracking\" and (if needed) \"@ember-data-types/tracking\" from your project in both your package.json and tsconfig.json`\n : false,\n `- add \"@warp-drive/ember\" to your project in both your package.json and tsconfig.json`,\n '- add the following import to your app.js file:',\n '',\n '\\t```',\n `\\timport '@warp-drive/ember/install';`,\n '\\t```',\n ``,\n '- mark this deprecation as resolved in your project by adding the following to your WarpDrive config in ember-cli-build.js:',\n '',\n '\\t```',\n '\\tconst { setConfig } = await import(\"@warp-drive/build-config\");',\n '\\tsetConfig(app, __dirname, {',\n '\\t deprecations: {',\n '\\t DEPRECATE_TRACKING_PACKAGE: false,',\n '\\t },',\n '\\t});',\n '\\t```',\n ``,\n `For more information, see the Package Unification RFC: https://rfcs.emberjs.com/id/1075-warp-drive-package-unification/`,\n ]\n .filter((l) => l !== false)\n .join('\\n');\n\n deprecate(message, false, {\n id: 'warp-drive.deprecate-tracking-package',\n until: '6.0.0',\n for: 'warp-drive',\n since: {\n enabled: '5.3.4',\n available: '4.13',\n },\n url: 'https://deprecations.emberjs.com/id/warp-drive.deprecate-tracking-package',\n });\n}\n"],"names":["ARRAY_SIGNAL","getOrSetGlobal","Symbol","OBJECT_SIGNAL","setupSignals","buildConfig","hooks","wellknown","Array","setTransient","createSignal","obj","key","signalHooks","peekTransient","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","consumeSignal","signal","notifySignal","createMemo","object","fn","willSyncFlushWatchers","deprecations","DEPRECATE_TRACKING_PACKAGE","hasEmberDataTracking","dependencySatisfies","buildSignalConfig","importSync","message","filter","l","join","deprecate","id","until","for","since","enabled","available","url"],"mappings":";;;;AAQO,MAAMA,YAAY,GAAGC,cAAc,CAAC,KAAK,EAAEC,MAAM,CAAC,KAAK,CAAC;AACxD,MAAMC,aAAa,GAAGF,cAAc,CAAC,KAAK,EAAEC,MAAM,CAAC,KAAK,CAAC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACO,SAASE,YAAYA,CAAIC,WAAsD,EAAE;AACtF;AACA;AACA;AACA;EACA,MAAMC,KAAK,GAAGD,WAAW,CAAC;AACxBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,KAAK,EAAER;AACT;AACF,GAAC,CAAC;AACFS,EAAAA,YAAY,CAAC,aAAa,EAAEH,KAAK,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASI,YAAYA,CAACC,GAAW,EAAEC,GAAoB,EAAa;AACzE,EAAA,MAAMC,WAA+B,GAAGC,aAA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AA,sFAAA,CAAwF,EACxF,CAAoH,kHAAA,CAAA,EACpH,CAAE,CAAA,EACF,CAAkD,gDAAA,CAAA,EAClDJ,oBAAoB,GAChB,4IAA4I,GAC5I,KAAK,EACT,CAAA,qFAAA,CAAuF,EACvF,iDAAiD,EACjD,EAAE,EACF,OAAO,EACP,CAAuC,qCAAA,CAAA,EACvC,OAAO,EACP,CAAE,CAAA,EACF,6HAA6H,EAC7H,EAAE,EACF,OAAO,EACP,mEAAmE,EACnE,+BAA+B,EAC/B,qBAAqB,EACrB,0CAA0C,EAC1C,QAAQ,EACR,OAAO,EACP,OAAO,EACP,CAAA,CAAE,EACF,CAAA,uHAAA,CAAyH,CAC1H,CACEK,MAAM,CAAEC,CAAC,IAAKA,CAAC,KAAK,KAAK,CAAC,CAC1BC,IAAI,CAAC,IAAI,CAAC;AAEbC,EAAAA,SAAS,CAACJ,OAAO,EAAE,KAAK,EAAE;AACxBK,IAAAA,EAAE,EAAE,uCAAuC;AAC3CC,IAAAA,KAAK,EAAE,OAAO;AACdC,IAAAA,GAAG,EAAE,YAAY;AACjBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,OAAO,EAAE,OAAO;AAChBC,MAAAA,SAAS,EAAE;KACZ;AACDC,IAAAA,GAAG,EAAE;AACP,GAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1 @@
1
+ export { s as setupSignals } from "./configure-BfLLW6GY.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { C as CacheHandler, S as default, r as recordIdentifierFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, e as setKeyInfoForResource, s as storeFor } from "./request-state-uRtpn0Lc.js";
2
+ import '@ember/debug';
3
+ import '@embroider/macros';
4
+ import '@ember-data/request-utils/string';
5
+ import "./configure-BfLLW6GY.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}