@ember-data/store 5.6.0-alpha.1 → 5.6.0-alpha.12

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 (101) hide show
  1. package/README.md +5 -5
  2. package/addon-main.cjs +1 -1
  3. package/dist/-private.js +2 -2
  4. package/dist/-private.js.map +1 -1
  5. package/dist/configure.js +2 -1
  6. package/dist/index.js +209 -5
  7. package/dist/index.js.map +1 -1
  8. package/dist/types.js +2 -0
  9. package/package.json +8 -19
  10. package/unstable-preview-types/-private.d.ts +1 -30
  11. package/unstable-preview-types/-private.d.ts.map +1 -1
  12. package/unstable-preview-types/configure.d.ts +2 -6
  13. package/unstable-preview-types/configure.d.ts.map +1 -1
  14. package/unstable-preview-types/index.d.ts +2 -224
  15. package/unstable-preview-types/index.d.ts.map +1 -1
  16. package/unstable-preview-types/types.d.ts +1 -4
  17. package/unstable-preview-types/types.d.ts.map +1 -1
  18. package/dist/configure-BfLLW6GY.js +0 -161
  19. package/dist/configure-BfLLW6GY.js.map +0 -1
  20. package/dist/request-state-uRtpn0Lc.js +0 -7709
  21. package/dist/request-state-uRtpn0Lc.js.map +0 -1
  22. package/unstable-preview-types/-private/cache-handler/handler.d.ts +0 -62
  23. package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +0 -1
  24. package/unstable-preview-types/-private/cache-handler/types.d.ts +0 -107
  25. package/unstable-preview-types/-private/cache-handler/types.d.ts.map +0 -1
  26. package/unstable-preview-types/-private/cache-handler/utils.d.ts +0 -34
  27. package/unstable-preview-types/-private/cache-handler/utils.d.ts.map +0 -1
  28. package/unstable-preview-types/-private/caches/cache-utils.d.ts +0 -11
  29. package/unstable-preview-types/-private/caches/cache-utils.d.ts.map +0 -1
  30. package/unstable-preview-types/-private/caches/identifier-cache.d.ts +0 -180
  31. package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +0 -1
  32. package/unstable-preview-types/-private/caches/instance-cache.d.ts +0 -64
  33. package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +0 -1
  34. package/unstable-preview-types/-private/caches/resource-utils.d.ts +0 -12
  35. package/unstable-preview-types/-private/caches/resource-utils.d.ts.map +0 -1
  36. package/unstable-preview-types/-private/debug/utils.d.ts +0 -9
  37. package/unstable-preview-types/-private/debug/utils.d.ts.map +0 -1
  38. package/unstable-preview-types/-private/document.d.ts +0 -155
  39. package/unstable-preview-types/-private/document.d.ts.map +0 -1
  40. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +0 -179
  41. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +0 -1
  42. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +0 -19
  43. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
  44. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +0 -31
  45. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
  46. package/unstable-preview-types/-private/managers/cache-manager.d.ts +0 -463
  47. package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +0 -1
  48. package/unstable-preview-types/-private/managers/notification-manager.d.ts +0 -101
  49. package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +0 -1
  50. package/unstable-preview-types/-private/managers/record-array-manager.d.ts +0 -101
  51. package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +0 -1
  52. package/unstable-preview-types/-private/network/request-cache.d.ts +0 -109
  53. package/unstable-preview-types/-private/network/request-cache.d.ts.map +0 -1
  54. package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts +0 -289
  55. package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts.map +0 -1
  56. package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts +0 -92
  57. package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
  58. package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts +0 -172
  59. package/unstable-preview-types/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
  60. package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts +0 -32
  61. package/unstable-preview-types/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
  62. package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts +0 -276
  63. package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts.map +0 -1
  64. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +0 -145
  65. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +0 -1
  66. package/unstable-preview-types/-private/record-arrays/many-array.d.ts +0 -203
  67. package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +0 -1
  68. package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts +0 -118
  69. package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
  70. package/unstable-preview-types/-private/store-service.d.ts +0 -1601
  71. package/unstable-preview-types/-private/store-service.d.ts.map +0 -1
  72. package/unstable-preview-types/-private/store-service.type-test.d.ts +0 -4
  73. package/unstable-preview-types/-private/store-service.type-test.d.ts.map +0 -1
  74. package/unstable-preview-types/-private/utils/coerce-id.d.ts +0 -10
  75. package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +0 -1
  76. package/unstable-preview-types/-private/utils/construct-resource.d.ts +0 -9
  77. package/unstable-preview-types/-private/utils/construct-resource.d.ts.map +0 -1
  78. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +0 -4
  79. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts.map +0 -1
  80. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +0 -4
  81. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts.map +0 -1
  82. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +0 -4
  83. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +0 -1
  84. package/unstable-preview-types/-types/overview.d.ts +0 -21
  85. package/unstable-preview-types/-types/overview.d.ts.map +0 -1
  86. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +0 -110
  87. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +0 -1
  88. package/unstable-preview-types/-types/q/ds-model.d.ts +0 -25
  89. package/unstable-preview-types/-types/q/ds-model.d.ts.map +0 -1
  90. package/unstable-preview-types/-types/q/identifier.d.ts +0 -193
  91. package/unstable-preview-types/-types/q/identifier.d.ts.map +0 -1
  92. package/unstable-preview-types/-types/q/promise-proxies.d.ts +0 -4
  93. package/unstable-preview-types/-types/q/promise-proxies.d.ts.map +0 -1
  94. package/unstable-preview-types/-types/q/record-data-json-api.d.ts +0 -36
  95. package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +0 -1
  96. package/unstable-preview-types/-types/q/record-instance.d.ts +0 -29
  97. package/unstable-preview-types/-types/q/record-instance.d.ts.map +0 -1
  98. package/unstable-preview-types/-types/q/schema-service.d.ts +0 -354
  99. package/unstable-preview-types/-types/q/schema-service.d.ts.map +0 -1
  100. package/unstable-preview-types/-types/q/store.d.ts +0 -38
  101. package/unstable-preview-types/-types/q/store.d.ts.map +0 -1
@@ -1,229 +1,7 @@
1
- /// <reference path="./types.d.ts" />
2
1
  /// <reference path="./configure.d.ts" />
3
2
  /// <reference path="./-private.d.ts" />
4
- /// <reference path="./-types/overview.d.ts" />
5
- /// <reference path="./-types/q/store.d.ts" />
6
- /// <reference path="./-types/q/identifier.d.ts" />
7
- /// <reference path="./-types/q/promise-proxies.d.ts" />
8
- /// <reference path="./-types/q/schema-service.d.ts" />
9
- /// <reference path="./-types/q/record-instance.d.ts" />
10
- /// <reference path="./-types/q/record-data-json-api.d.ts" />
11
- /// <reference path="./-types/q/cache-capabilities-manager.d.ts" />
12
- /// <reference path="./-types/q/ds-model.d.ts" />
13
- /// <reference path="./-private/store-service.d.ts" />
14
- /// <reference path="./-private/store-service.type-test.d.ts" />
15
- /// <reference path="./-private/document.d.ts" />
16
- /// <reference path="./-private/caches/cache-utils.d.ts" />
17
- /// <reference path="./-private/caches/resource-utils.d.ts" />
18
- /// <reference path="./-private/caches/instance-cache.d.ts" />
19
- /// <reference path="./-private/caches/identifier-cache.d.ts" />
20
- /// <reference path="./-private/legacy-model-support/shim-model-class.d.ts" />
21
- /// <reference path="./-private/legacy-model-support/record-reference.d.ts" />
22
- /// <reference path="./-private/managers/notification-manager.d.ts" />
23
- /// <reference path="./-private/managers/record-array-manager.d.ts" />
24
- /// <reference path="./-private/managers/cache-capabilities-manager.d.ts" />
25
- /// <reference path="./-private/managers/cache-manager.d.ts" />
26
- /// <reference path="./-private/new-core-tmp/request-state.d.ts" />
27
- /// <reference path="./-private/new-core-tmp/promise-state.d.ts" />
28
- /// <reference path="./-private/new-core-tmp/reactivity/internal.d.ts" />
29
- /// <reference path="./-private/new-core-tmp/reactivity/signal.d.ts" />
30
- /// <reference path="./-private/new-core-tmp/reactivity/configure.d.ts" />
31
- /// <reference path="./-private/debug/utils.d.ts" />
32
- /// <reference path="./-private/network/request-cache.d.ts" />
33
- /// <reference path="./-private/cache-handler/utils.d.ts" />
34
- /// <reference path="./-private/cache-handler/types.d.ts" />
35
- /// <reference path="./-private/cache-handler/handler.d.ts" />
36
- /// <reference path="./-private/utils/normalize-model-name.d.ts" />
37
- /// <reference path="./-private/utils/uuid-polyfill.d.ts" />
38
- /// <reference path="./-private/utils/construct-resource.d.ts" />
39
- /// <reference path="./-private/utils/is-non-empty-string.d.ts" />
40
- /// <reference path="./-private/utils/coerce-id.d.ts" />
41
- /// <reference path="./-private/record-arrays/identifier-array.d.ts" />
42
- /// <reference path="./-private/record-arrays/many-array.d.ts" />
43
- /// <reference path="./-private/record-arrays/native-proxy-type-fix.d.ts" />
3
+ /// <reference path="./types.d.ts" />
44
4
  declare module '@ember-data/store' {
45
- /**
46
- * <p align="center">
47
- * <img
48
- * class="project-logo"
49
- * src="https://raw.githubusercontent.com/emberjs/data/4612c9354e4c54d53327ec2cf21955075ce21294/ember-data-logo-light.svg#gh-light-mode-only"
50
- * alt="EmberData Store"
51
- * width="240px"
52
- * title="EmberData Store"
53
- * />
54
- * </p>
55
- *
56
- * This package provides [*Ember***Data**](https://github.com/emberjs/data/)'s `Store` class.
57
- *
58
- * A [Store](https://api.emberjs.com/ember-data/release/classes/Store) coordinates interaction between your application, a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache),
59
- * and sources of data (such as your API or a local persistence layer) accessed via a [RequestManager](https://github.com/emberjs/data/tree/main/packages/request).
60
- *
61
- * Optionally, a Store can be configured to hydrate the response data into rich presentation classes.
62
- *
63
- * ## Installation
64
- *
65
- * If you have installed `ember-data` then you already have this package installed.
66
- * Otherwise you can install it using your javascript package manager of choice.
67
- * For instance with [pnpm](https://pnpm.io/)
68
- *
69
- * ```
70
- * pnpm add @ember-data/store
71
- * ```
72
- *
73
- * After installing you will want to configure your first `Store`. Read more below
74
- * for how to create and configure stores for your application.
75
- *
76
- *
77
- * ## 🔨 Creating A Store
78
- *
79
- * 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)
80
- * to store data **in-memory**, add a [Handler](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache) to fetch data from a source,
81
- * and implement `instantiateRecord` to tell the store how to display the data for individual resources.
82
- *
83
- * > **Note**
84
- * > If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,
85
- * > and `instantiateRecord` are configured for you by default.
86
- *
87
- * ### Configuring A Cache
88
- *
89
- * To start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other
90
- * caches may better fit your data. You can author your own cache by creating one that
91
- * conforms to the [spec](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache).
92
- *
93
- * The package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.
94
- * After installing it, we can configure the store to use this cache.
95
- *
96
- * ```js
97
- * import Store from '@ember-data/store';
98
- * import Cache from '@ember-data/json-api';
99
- *
100
- * class extends Store {
101
- * createCache(storeWrapper) {
102
- * return new Cache(storeWrapper);
103
- * }
104
- * }
105
- * ```
106
- *
107
- * Now that we have a `cache` let's setup something to handle fetching
108
- * and saving data via our API.
109
- *
110
- * > **Note**
111
- * > The `ember-data` package automatically includes and configures
112
- * > the `@ember-data/json-api` cache for you.
113
- *
114
- * ### Handling Requests
115
- *
116
- * When *Ember***Data** needs to fetch or save data it will pass that request to your application's `RequestManager` for fulfillment. How this fulfillment occurs (in-memory, device storage, via single or multiple API requests, etc.) is then up to the registered request handlers.
117
- *
118
- * To start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.
119
- *
120
- * > **Note**
121
- * > 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).
122
- *
123
- * ```ts
124
- * import Store from '@ember-data/store';
125
- * import RequestManager from '@ember-data/request';
126
- * import Fetch from '@ember-data/request/fetch';
127
- *
128
- * export default class extends Store {
129
- * requestManager = new RequestManager()
130
- * .use([Fetch]);
131
- * }
132
- * ```
133
- *
134
- * **Using RequestManager as a Service**
135
- *
136
- * Alternatively if you have configured the `RequestManager` to be a service you may re-use it.
137
- *
138
- * *app/services/request.js*
139
- * ```ts
140
- * import RequestManager from '@ember-data/request';
141
- * import Fetch from '@ember-data/request/fetch';
142
- *
143
- * export default class extends RequestManager {
144
- * constructor(createArgs) {
145
- * super(createArgs);
146
- * this.use([Fetch]);
147
- * }
148
- * }
149
- * ```
150
- *
151
- * *app/services/store.js*
152
- * ```ts
153
- * import Store from '@ember-data/store';
154
- * import { service } from '@ember/service';
155
- *
156
- * export default class extends Store {
157
- * @service('request') requestManager
158
- * }
159
- * ```
160
- *
161
- *
162
- * ### Presenting Data from the Cache
163
- *
164
- * Now that we have a source and a cache for our data, we need to configure how
165
- * the Store delivers that data back to our application. We do this via the hook
166
- * [instantiateRecord](https://api.emberjs.com/ember-data/release/classes/Store/methods/instantiateRecord%20(hook)?anchor=instantiateRecord%20(hook)),
167
- * which allows us to transform the data for a resource before handing it to the application.
168
- *
169
- * A naive way to present the data would be to return it as JSON. Typically instead
170
- * this hook will be used to add reactivity and make each unique resource a singleton,
171
- * ensuring that if the cache updates our presented data will reflect the new state.
172
- *
173
- * Below is an example of using the hooks `instantiateRecord` and a `teardownRecord`
174
- * to provide minimal read-only reactive state for simple resources.
175
- *
176
- * ```ts
177
- * import Store, { recordIdentifierFor } from '@ember-data/store';
178
- * import { TrackedObject } from 'tracked-built-ins';
179
- *
180
- * class extends Store {
181
- * instantiateRecord(identifier) {
182
- * const { cache, notifications } = this;
183
- *
184
- * // create a TrackedObject with our attributes, id and type
185
- * const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));
186
- * record.type = identifier.type;
187
- * record.id = identifier.id;
188
- *
189
- * notifications.subscribe(identifier, (_, change) => {
190
- * if (change === 'attributes') {
191
- * Object.assign(record, cache.peek(identifier));
192
- * }
193
- * });
194
- *
195
- * return record;
196
- * }
197
- * }
198
- * ```
199
- *
200
- * Because `instantiateRecord` is opaque to the nature of the record, an implementation
201
- * can be anything from a fairly simple object to a robust proxy that intelligently links
202
- * together associated records through relationships.
203
- *
204
- * This also enables creating a record that separates `edit` flows from `create` flows
205
- * entirely. A record class might choose to implement a `checkout`method that gives access
206
- * to an editable instance while the primary record continues to be read-only and reflect
207
- * only persisted (non-mutated) state.
208
- *
209
- * Typically you will choose an existing record implementation such as `@ember-data/model`
210
- * for your application.
211
- *
212
- * Because of the boundaries around instantiation and the cache, record implementations
213
- * should be capable of interop both with each other and with any `Cache`. Due to this,
214
- * if needed an application can utilize multiple record implementations and multiple cache
215
- * implementations either to support enhanced features for only a subset of records or to
216
- * be able to incrementally migrate from one record/cache to another record or cache.
217
- *
218
- * > **Note**
219
- * > The `ember-data` package automatically includes the `@ember-data/model`
220
- * > package and configures it for you.
221
- *
222
- * @module @ember-data/store
223
- * @main @ember-data/store
224
- */
225
- export { Store as default, type StoreRequestContext, CacheHandler, type Document, type CachePolicy, type StoreRequestInput, recordIdentifierFor, storeFor, } from '@ember-data/store/-private';
226
- export type { DocumentCacheOperation, CacheOperation, NotificationType, } from '@ember-data/store/-private/managers/notification-manager';
227
- export { setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, setKeyInfoForResource, } from '@ember-data/store/-private/caches/identifier-cache';
5
+ export { Store as default, type StoreRequestContext, CacheHandler, type Document, type CachePolicy, type StoreRequestInput, recordIdentifierFor, storeFor, type DocumentCacheOperation, type CacheOperation, type NotificationType, setIdentifierGenerationMethod, setIdentifierUpdateMethod, setIdentifierForgetMethod, setIdentifierResetMethod, setKeyInfoForResource, } from '@warp-drive/core';
228
6
  }
229
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmLG;AACH,OAAO,EACL,KAAK,IAAI,OAAO,EAChB,KAAK,mBAAmB,EACxB,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,gBAAgB,GACjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2LA,OAAO,EACL,KAAK,IAAI,OAAO,EAChB,KAAK,mBAAmB,EACxB,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,QAAQ,EACR,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC"}
@@ -1,7 +1,4 @@
1
1
  declare module '@ember-data/store/types' {
2
- export type { CacheCapabilitiesManager } from '@ember-data/store/-types/q/cache-capabilities-manager';
3
- export type { ModelSchema } from '@ember-data/store/-types/q/ds-model';
4
- export type { SchemaService } from '@ember-data/store/-types/q/schema-service';
5
- export type { BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions, } from '@ember-data/store/-types/q/store';
2
+ export type { CacheCapabilitiesManager, ModelSchema, SchemaService, BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions, } from '@warp-drive/core/types';
6
3
  }
7
4
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACtF,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,wBAAwB,EACxB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACf,MAAM,wBAAwB,CAAC"}
@@ -1,161 +0,0 @@
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 };
@@ -1 +0,0 @@
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,aAAa,CAAC,aAAa,CAAC;EACpEC,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,IAAA,IAAA,CAAAA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